123 |
- 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,d(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}).apply(this,arguments)}function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,a(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(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&&a(r,i.prototype),r}).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,o(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,t)})(t)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _(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 f(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=function(t,e){if(t){if("string"==typeof t)return _(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){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 d(t){var e=function(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)}(t,"string");return"symbol"==typeof e?e:String(e)}function p(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 m(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 g(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t({$:function(t){return HP.test(t)},J:function(){return 0},N:WP,P:jP,W:XP,X:YP,Y:qP,Z:KP,_:f,a0:function(t){return zP.test(t)},a1:$P,a2:tB,a3:eB,aB:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},aC:GX,aQ:Xn,aS:gn,aU:cn,aW:Fn,aZ:Hn,ay:R1,az:I1,b0:Qn,b2:Jn,b4:En,b9:Oi,bB:Se,bC:be,bD:xe,bI:function(t){t>0&&(dt=t)},bM:St,bN:function(t){for(var e,i=f(t);!(e=i()).done;)At(e.value)},bO:function(t){return gt||(gt="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return At(e),Reflect.get(t,e,i)}})),gt},bP:Lo,bQ:No,bT:Ei,bU:Ci,ba:Li,bb:Ni,bc:Fi,bd:ki,be:Vi,bf:Gi,bg:Ui,bh:zi,bi:Hi,bj:Wi,bk:ji,bl:Xi,bm:Yi,bn:qi,bo:Ki,bp:Qi,bq:Zi,br:Ji,bs:$i,bt:tn,bu:an,bv:hn,c:Hbt,c$:to,c2:function(t){return t[Ia]},c5:uo,c7:W,c8:G,c9:z,cE:hc,cF:Hu,cG:ol,cS:Pa,cU:lc,cX:pi,cY:mi,ca:U,cb:H,cc:Z,cd:K,ce:et,cf:$,cg:rt,ch:ot,ci:at,cj:st,d0:eo,d3: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))}))}))},d4:j,d5:function(t,e){return aa(t,e,0)},d6:aa,d7:function(t,e,i){for(var n=0,r=t.length-1,s=r>>>1;n<=r;s=n+r>>>1){var o=t[s];if(i(o,e)<0)r=s-1;else{if(!(i(o,e)>0))return s;n=s+1}}return~n},d8:function(){},d9:function(){},dU:lm,dW:SJ,da:Ae,db:pc,dp:RR,gK:BHt,gL:OHt}),g("CC_WECHAT",!0),g("CC_BAIDU",!1),g("CC_XIAOMI",!1),g("CC_ALIPAY",!1),g("CC_BYTEDANCE",!1),g("CC_OPPO",!1),g("CC_VIVO",!1),g("CC_HUAWEI",!1),g("CC_COCOSPLAY",!1),g("CC_QTT",!1),g("CC_LINKSURE",!1);g("CC_EDITOR",!1),g("CC_PREVIEW",!1),g("CC_BUILD",!0),g("CC_TEST",!1),g("CC_DEBUG",!1),g("CC_DEV",!1),g("CC_MINIGAME",!0),g("CC_RUNTIME_BASED",!1),g("CC_SUPPORT_JIT",!1),g("CC_JSB",!1);var y="undefined"==typeof window?global:window,v=t("aN",{_global:y});v.internal={};var S=t("aM","3.8.4");y.CocosEngine=v.ENGINE_VERSION=S,y.cc=v;var A=void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis;y.ccwindow=A;var T=2147483647;function b(t){return(t>0)-(t<0)}function E(t,e){return t^(t^e)&-(t<e)}function C(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 x(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function w(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 D(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}var R=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}}(R);var I=Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:T,INT_MIN:-2147483648,sign:b,abs:function(t){var e=t>>31;return(t^e)-e},min:function(t,e){return e^(t^e)&-(t<e)},max:E,isPow2:function(t){return!(t&t-1||!t)},log2:C,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},popCount:x,countTrailingZeros:w,nextPow2:D,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},reverse:function(t){return R[255&t]<<24|R[t>>>8&255]<<16|R[t>>>16&255]<<8|R[t>>>24&255]},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},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},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},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},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>w(t)+1}});t("aO",I);var M=A.document,P="https://github.com/cocos/cocos-engine/blob/"+S+"/EngineErrorMap.md",B=null,O=console.log.bind(console),L=O,N=O,F=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: "+V.apply(void 0,[e].concat(n)))}},k=O;function V(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return v.js.formatStr.apply(null,e)}function G(){return O.apply(void 0,arguments)}function U(){return L.apply(void 0,arguments)}function z(){return N.apply(void 0,arguments)}function H(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 F.apply(void 0,[t,e].concat(n))}function W(){return k.apply(void 0,arguments)}function j(t){if(O=L=N=F=k=function(){},t!==it.NONE){if(t>it.ERROR){var e=function(t){if(v.game.canvas){if(!B){var e=M.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200");var i=v.game.canvas.height;e.setAttribute("height",""+i);var n=e.style;n.zIndex="99999",n.position="absolute",n.top=n.left="0",(B=M.createElement("textarea")).setAttribute("rows","20"),B.setAttribute("cols","30"),B.setAttribute("disabled","true");var r=B.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(B),v.game.canvas.parentNode.appendChild(e)}B.value=B.value+t+"\r\n",B.scrollTop=B.scrollHeight}};N=function(){e("ERROR : "+V.apply(void 0,arguments))},F=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: "+V.apply(void 0,[i].concat(r)))}},t!==it.ERROR_FOR_WEB_PAGE&&(L=function(){e("WARN : "+V.apply(void 0,arguments))}),t===it.INFO_FOR_WEB_PAGE&&(O=function(){e(V.apply(void 0,arguments))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),N=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)},F=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=V.apply(void 0,[e].concat(n));throw new Error(s)}});if(t!==it.ERROR&&(L=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<=it.INFO&&(O=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<=it.VERBOSE&&"function"==typeof console.debug){var i=console.debug.bind(console);k=function(){return i.apply(void 0,arguments)}}}}function X(t){z(t.stack||t)}function Y(t){return function(e){for(var i=t+" "+e+", please go to "+P+"#"+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 q=Y("Log");function K(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];G(q.apply(void 0,[t].concat(i)))}var Q=Y("Debug");function Z(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];W(Q.apply(void 0,[t].concat(i)))}var J=Y("Warning");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];U(J.apply(void 0,[t].concat(i)))}var tt=Y("Error");function et(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];z(tt.apply(void 0,[t].concat(i)))}var it,nt=Y("Assert");function rt(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];H(!1,nt.apply(void 0,[e].concat(n)))}}function st(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 tt.apply(void 0,[t].concat(i))}function ot(){return!!v.profiler&&v.profiler.isShowingStats()}function at(t){v.profiler&&(t?v.profiler.showStats():v.profiler.hideStats())}t("ck",it),function(t){t[t.NONE=0]="NONE",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.INFO_FOR_WEB_PAGE=5]="INFO_FOR_WEB_PAGE",t[t.WARN_FOR_WEB_PAGE=6]="WARN_FOR_WEB_PAGE",t[t.ERROR_FOR_WEB_PAGE=7]="ERROR_FOR_WEB_PAGE"}(it||t("ck",it={}));var ht,ut,lt,ct,_t,ft=Object.freeze({__proto__:null,log:G,warn:U,error:z,assert:H,debug:W,_resetDebugSetting:j,_throw:X,logID:K,debugID:Z,warnID:$,errorID:et,assertID:rt,get DebugMode(){return it},getError:st,isDisplayStats:ot,setDisplayStats:at}),dt=10;t("bJ",ht),t("bK",ut),t("bL",lt);var pt=0,mt=new Map;ct=function(t,e,i,n,r,s,o){var a=mt.get(s);a&&a.logTimes>a.count&&(r("'%s' is deprecated, please use '%s' instead. "+o,t+"."+e,i+"."+n),a.count++)},t("bJ",ht=function(t,e,i){null!=t&&i.forEach((function(i){var n=pt++;mt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:dt});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,o=null!=i.targetName?i.targetName:e,a=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return ct(e,i.name,o,s,U,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 ct(e,i.name,o,s,U,n,h),i.customGetter.call(this)},set:function(t){ct(e,i.name,o,s,U,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){ct(e,i.name,o,s,U,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return ct(e,i.name,o,s,U,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return ct(e,i.name,o,s,U,n,h),a?this[s]:r[s]},set:function(t){ct(e,i.name,o,s,U,n,h),a?this[s]=t:r[s]=t},enumerable:!1})}))}),_t=function(t,e,i,n,r){var s=mt.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},t("bK",ut=function(t,e,i){null!=t&&i.forEach((function(i){var n=pt++;mt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:dt});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return _t(e,i.name,z,n,r)},set:function(){_t(e,i.name,z,n,r)},enumerable:!1})}))}),t("bL",lt=function(){});var gt,yt,vt={};function St(t){for(var e in t){var i=t[e];vt[e]=i}}function At(t){var e=vt[t];if(e){var i=e.newName,n=e.since;e.removed?i?et(16003,t,n,i):et(16002,t,n):i?$(16001,t,n,i):$(16e3,t,n)}}var Tt=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}();yt=Tt,Tt.global=new yt("global");var bt=new Tt("TmpCId."),Et="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Ct="__cid__";function xt(t){return"number"==typeof t||t instanceof Number}function wt(t){return"string"==typeof t||t instanceof String}function Dt(t){for(var e in t)return!1;return!0}var Rt,It=(Rt={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(t,e,i,n,r){Rt.value=i,Rt.writable=n,Rt.enumerable=r,Object.defineProperty(t,e,Rt),Rt.value=void 0}),Mt=function(){var t={get:void 0,set:void 0,enumerable:!1};return function(e,i,n,r,s,o){void 0===s&&(s=!1),void 0===o&&(o=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),t.get=n,t.set=r,t.enumerable=s,t.configurable=o,Object.defineProperty(e,i,t),t.get=void 0,t.set=void 0}}(),Pt=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}}(),Bt=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 Ot(t){var e=Object.create(null);return t&&(e["."]=1,e["/"]=1,delete e["."],delete e["/"]),e}function Lt(t){if("function"==typeof t){var e=t.prototype;if(e&&e.hasOwnProperty("__classname__")&&e.__classname__)return e.__classname__;var i="";if(t.name&&(i=t.name),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?Lt(t.constructor):""}function Nt(t,e,i,n){var r=/([^.]+)$/,s=r.exec(e)[0],o=r.exec(i)[0];function a(){return this[o]}n?Mt(t,s,a,(function(t){this[o]=t})):Pt(t,s,a)}function Ft(t,e,i,n){for(var r in i)Nt(t,e+"."+r,i[r],n)}var kt=/(%d)|(%s)/,Vt=/%s/;function Gt(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;var r="string"==typeof t&&kt.test(t);if(r)for(var s,o=f(i);!(s=o()).done;){var a=s.value,h="number"==typeof a?kt:Vt;if(h.test(t)){var u=""+a;t=t.replace(h,u)}else t+=" "+a}else for(var l,c=f(i);!(l=c()).done;){var _=l.value;t+=" "+_}return t}function Ut(){for(var t=arguments.length-1,e=new Array(t),i=0;i<t;++i)e[i]=arguments[i+1];return e}function zt(t,e){for(;t;){var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}return null}function Ht(t,e,i){var n=zt(e,t);n&&Object.defineProperty(i,t,n)}function Wt(t){t=t||{};for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];for(var r=0,s=i;r<s.length;r++){var o=s[r];if(o){if("object"!=typeof o){et(5402,o);continue}for(var a in o)a in t||Ht(a,o,t)}}return t}function jt(t){t=t||{};for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];for(var r=0,s=i;r<s.length;r++){var o=s[r];if(o){if("object"!=typeof o){et(5403,o);continue}for(var a in o)Ht(a,o,t)}}return t}function Xt(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 Yt(t){var e=t.prototype,i=e&&Object.getPrototypeOf(e);return i&&i.constructor}function qt(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=Yt(t)))return!1;if(t===e)return!0}}return!1}function Kt(t){for(var e=0,i=Object.keys(t);e<i.length;e++)delete t[i[e]]}var Qt=Ot(!0),Zt=Ot(!0);function Jt(t,e,i){return function(n,r){if(r.prototype.hasOwnProperty(t)&&delete e[r.prototype[t]],It(r.prototype,t,n),n){var s=e[n];!i&&s&&s!==r?et(16334,t,n,""):e[n]=r}}}var $t=Jt("__cid__",Qt,!1),te=Jt("__classname__",Zt,!0);function ee(t,e){if(te(t,e),!e.prototype.hasOwnProperty(Ct)){var i=t||bt.getNewId();i&&$t(i,e)}}function ie(t,e){var i=Zt[e],n=Qt[e],r=!0;if(i&&i!==t&&(et(16335,e),r=!1),n&&n!==t&&(et(16336,e),r=!1),r){var s=t[Et];s||(s=[],t[Et]=s),s.push(e),Zt[e]=t,Qt[e]=t}}function ne(){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],o=s.prototype,a=o.__cid__;a&&delete Qt[a];var h=o.__classname__;h&&delete Zt[h];var u=o[Et];if(u)for(var l=0;l<u.length;++l){var c=u[l];delete Zt[c],delete Qt[c]}}}function re(t){return se(t)}function se(t){return Qt[t]}function oe(t){return Zt[t]}function ae(t,e){return he(t,e)}function he(t,e){if(e=void 0===e||e,"function"==typeof t&&t.prototype.hasOwnProperty(Ct))return t.prototype.__cid__;if(t&&t.constructor){var i=t.constructor.prototype;if(i&&i.hasOwnProperty(Ct))return t.__cid__}return""}var ue=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}(),le=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 ce(t,e){t.splice(e,1)}function _e(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function fe(t,e){var i=t.indexOf(e);return i>=0&&(ce(t,i),!0)}function de(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)}function pe(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return ce(t,i),n}}function me(t,e){return t.indexOf(e)>=0}var ge=Object.freeze({__proto__:null,MutableForwardIterator:le,removeAt:ce,fastRemoveAt:_e,remove:fe,fastRemove:de,removeIf:pe,verifyType:function(t,e){if(t&&t.length>0)for(var i,n=f(t);!(i=n()).done;)if(!(i.value instanceof e))return K(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i<n;i++)fe(t,e[i])},appendObjectsAt:function(t,e,i){return t.splice.apply(t,[i,0].concat(e)),t},contains:me,copy:function(t){for(var e=t.length,i=new Array(e),n=0;n<e;n+=1)i[n]=t[n];return i}}),ye={IDGenerator:Tt,Pool:ue,array:ge,isNumber:xt,isString:wt,isEmptyObject:Dt,getPropertyDescriptor:zt,addon:Wt,mixin:jt,extend:Xt,getSuper:Yt,isChildClassOf:qt,clear:Kt,value:It,getset:Mt,get:Pt,set:Bt,unregisterClass:ne,getClassName:Lt,setClassName:ee,setClassAlias:ie,getClassByName:oe,getClassById:se,get _registeredClassNames(){return r({},Zt)},set _registeredClassNames(t){Kt(Zt),Object.assign(Zt,t)},get _registeredClassIds(){return r({},Qt)},set _registeredClassIds(t){Kt(Qt),Object.assign(Qt,t)},_getClassId:ae,getClassId:he,_setClassId:$t,_getClassById:re,obsolete:Nt,obsoletes:Ft,formatStr:Gt,shiftArguments:Ut,createMap:Ot};v.js=ye;var ve=Object.freeze({__proto__:null,array:ge,js:ye,IDGenerator:Tt,Pool:ue,isNumber:xt,isString:wt,isEmptyObject:Dt,value:It,getset:Mt,get:Pt,set:Bt,createMap:Ot,getClassName:Lt,obsolete:Nt,obsoletes:Ft,formatStr:Gt,shiftArguments:Ut,getPropertyDescriptor:zt,copyAllProperties:function(t,e,i){for(var n=Object.getOwnPropertyNames(t),r=0,s=n.length;r<s;++r){var o=n[r];-1===i.indexOf(o)&&Ht(o,t,e)}},addon:Wt,mixin:jt,extend:Xt,getSuper:Yt,isChildClassOf:qt,clear:Kt,_idToClass:Qt,_nameToClass:Zt,_setClassId:$t,setClassName:ee,setClassAlias:ie,unregisterClass:ne,_getClassById:re,getClassById:se,getClassByName:oe,_getClassId:ae,getClassId:he});function Se(t){if("__bitmask__"in t)return t;It(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 o=""+s;r!==o&&It(t,o,r)}return t}function Ae(t,e){e>=0&&t.length,t.length}t("bF",ve),Se.isBitMask=function(t){return t&&Object.prototype.hasOwnProperty.call(t,"__bitmask__")},Se.getList=function(t){return t.__bitmask__?t.__bitmask__:Se.update(t)},Se.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},v.BitMask=Se;var Te=Object.prototype.hasOwnProperty;function be(t){return"__enums__"in t?t:(It(t,"__enums__",null,!0),be.update(t))}function Ee(t){Te.call(t,"__enums__")}function Ce(t){Ee(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 xe(t){"__enums__"in t||It(t,"__enums__",null,!0)}be.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 o=""+s;r!==o&&It(t,o,r)}return Array.isArray(t.__enums__)&&Ce(t),t},be||t("bC",be={}),be.isEnum=function(t){return t&&Te.call(t,"__enums__")},be.getList=function(t){return Ee(t),t.__enums__?t.__enums__:Ce(t)},be.sortList=function(t,e){Ee(t),Array.isArray(t.__enums__)&&t.__enums__.sort(e)},v.Enum=be;var we,De=t("bE",function(){function t(){}var e=t.prototype;return e.clone=function(){return et(100,Lt(this)+".clone"),this},e.equals=function(){return!1},e.set=function(){et(100,Lt(this)+".set")},e.toString=function(){return""},t}());ee("cc.ValueType",De),v.ValueType=De,function(t){t.PATH="path",t.ENGINE="engine",t.ASSETS="assets",t.SCRIPTING="scripting",t.PHYSICS="physics",t.RENDERING="rendering",t.LAUNCH="launch",t.SCREEN="screen",t.SPLASH_SCREEN="splashScreen",t.ANIMATION="animation",t.PROFILING="profiling",t.PLUGINS="plugins",t.XR="xr"}(we||(we={}));var Re=t("cA",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){if(t.startsWith("http")){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)}else{var s=fsUtils.readJsonSync(t);s instanceof Error?n(s):(i._settings=s,e())}})):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}());Re.Category=we;var Ie,Me=t("cB",new Re);v.settings=Me,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"}(Ie||(Ie={}));var Pe=t("cn",{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:Ie.PORTRAIT,ORIENTATION_PORTRAIT_UPSIDE_DOWN:Ie.PORTRAIT_UPSIDE_DOWN,ORIENTATION_LANDSCAPE:Ie.LANDSCAPE,ORIENTATION_LANDSCAPE_LEFT:Ie.LANDSCAPE_LEFT,ORIENTATION_LANDSCAPE_RIGHT:Ie.LANDSCAPE_RIGHT,ORIENTATION_AUTO:Ie.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(){this.CLEANUP_IMAGE_CACHE=!0;var t=Me.querySettings(Re.Category.ENGINE,"macros");if(t)for(var e in t)Pe[e]=t[e]}});function Be(t,e){for(var i,n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];var o=performance.now(),a=requestAnimationFrame||window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame;if(void 0===a||null!==(i=globalThis.__globalXR)&&void 0!==i&&i.isWebXR)return setTimeout.apply(void 0,[t,e].concat(r));var h=function i(){performance.now()-o<e?a(i):t.apply(void 0,r)};return a(h)}v.macro=Pe;for(var Oe=/^(?:cc|dragonBones|sp|ccsg)\..+/,Le=new Array(123),Ne=0;Ne<123;++Ne)Le[Ne]=64;for(var Fe=0;Fe<64;++Fe)Le["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Fe)]=Fe;var ke=Le;function Ve(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];Mt(t,e,s,t[n])}}for(var r,s=t.prototype,o=0,a=e.length;o<a;++o){var h=(r=e[o])[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 Ge(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 Ue(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 ze(t){return"object"==typeof window&&"function"==typeof Node?t instanceof Node:!!t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName}function He(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&&Be((function(){t.apply(void 0,i)}),0)}function We(t){return!(!t||t.constructor!==Object)&&Dt(t)}function je(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t<i?t:i}function Xe(t){return t*Pe.RAD}function Ye(t){return t*Pe.DEG}v.misc={BUILTIN_CLASSID_RE:Oe,BASE64_VALUES:ke,propertyDefine:Ve,pushToMap:Ge,contains:Ue,isDomNode:ze,callInNextTick:He,isPlainEmptyObj_DEV:We,clampf:je,degreesToRadians:Xe,radiansToDegrees:Ye},t("bG",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:Oe,BASE64_VALUES:ke,propertyDefine:Ve,pushToMap:Ge,contains:Ue,isDomNode:ze,callInNextTick:He,tryCatchFunctor_EDITOR:function(t){return Function("target","try {\n target."+t+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:We,clampf:je,degreesToRadians:Xe,radiansToDegrees:Ye}));var qe="$_$";function Ke(t,e){var i=e?Object.create(e):{};return It(t,"__attrs__",i),i}function Qe(t){if("function"!=typeof t)return Ke(t,Je(t.constructor));for(var e,i=v.Class.getInheritanceChain(t),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Ke(r,(e=i[n+1])&&e.__attrs__)}return Ke(t,(e=i[0])&&e.__attrs__),t.__attrs__}function Ze(t,e){var i=Je(t),n=e+qe,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Je(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Qe(t)}function $e(t,e,i,n){Je(t)[e+qe+i]=n}var ti=function(){function t(t,e){this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),ei=t("bW",new ti("Integer",0));v.Integer=ei,v.CCInteger=ei;var ii=t("bX",new ti("Float",0));v.Float=ii,v.CCFloat=ii;var ni=t("bY",new ti("Boolean",!1));v.Boolean=ni,v.CCBoolean=ni;var ri=t("bZ",new ti("String",""));function si(t,e){return function(i,n){var r='"'+Lt(i)+"."+n+'"',s=Ze(i,n),o=s.type;if(o===ei||o===ii?o="Number":o!==ri&&o!==ni||(o=""+o),o===t){if(s.hasOwnProperty("default")){var a=s.default;if(void 0!==a&&!Array.isArray(a)&&!We(a)){var h=typeof a,u=t.toLowerCase();if(h===u)if("object"===u){if(!a||a instanceof s.ctor)return;$(3605,r,Lt(s.ctor))}else"Number"!==t&&$(3606,e,r,t);else{if("function"===h)return;t===ri.default&&null==a?$(3607,r):$(3611,e,r,h)}delete s.type}}}else $(3604,r)}}v.String=ri,v.CCString=ri;var oi=Object.freeze({__proto__:null,DELIMETER:qe,createAttrsSingle:Ke,createAttrs:Qe,attr:Ze,getClassAttrs:Je,setClassAttr:$e,PrimitiveType:ti,CCInteger:ei,CCFloat:ii,CCBoolean:ni,CCString:ri,getTypeChecker_ET:si,getObjTypeChecker_ET:function(t){return function(e,i){si("Object","type")(e,i);var n=Je(e)[i+qe+"default"],r=v.Class.getDefault(n);if(!Array.isArray(r)&&qt(t,v.ValueType)){var s=Lt(t),o=Gt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Lt(e),i,s);n?G(o):$(3612,o,s,Lt(e),i,s)}}}}),ai={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function hi(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 o in n[r]=s,ai){var a=ai[o];t.hasOwnProperty(o)&&(s[o]=t[o],a.canUsedInGet||delete t[o])}}}function ui(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return et(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=v.String:e===Boolean?t.type=v.Boolean:e===Number&&(t.type=v.Float))}function li(t,e,i){var n=t||void 0===e?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function ci(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return li(e,[],t);if("function"==typeof t){var i=t;return li(e,qt(i,v.ValueType)?new i:null,i)}return t instanceof ti?li(e,void 0,t):li(e,t)}return null}var _i,fi=[];function di(){return fi[fi.length-1]}function pi(t,e,i){mi(Je(t),e,i)}function mi(t,e,i){t[e+"$_$type"]="Enum",t[e+"$_$enumList"]=be.getList(i)}v._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),fi.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=fi.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:di},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(_i||(_i={}));var gi=qe,yi="__ctors__",vi=t("cZ","Enum"),Si=t("c_","BitMask");function Ai(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),wi(t,n,e,i)}function Ti(t,e,i,n){var r=n.get;n.set,r&&(wi(t,n,e,i),$e(t,i,"serializable",!1))}function bi(t){return"function"==typeof t?t():t}function Ei(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=v.Component,r=di();if(r&&qt(e,n)){if(qt(r.cls,n))return et(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return It(n,yi,!0,!0),n.prototype,e&&(n.$super=e),ee(t,n),n}(t,e,i);if(r)if(qt(e,n)){var o=r.uuid;o&&$t(o,s),r.cls=s}else qt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=v.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in function(t,e){for(var i in t){var n=t[i],r=ci(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&hi(n,i,s,t),"type"in n&&ui(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?Ti(t,e,r,s):Ai(t,e,r,s)}var o=Je(t);t.__values__=t.__props__.filter((function(t){return!1!==o[t+"$_$serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&qt(i,v.Component)&&v.Component._registerEditorProps(n,r),n}function Ci(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}Ei._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,yi)},Ei.fastDefine=function(t,e,i){ee(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Je(e),s=0;s<n.length;s++){var o=n[s];r[o+gi+"visible"]=!1,r[o+gi+"default"]=i[o]}},Ei.Attr=oi,Ei.attr=Ze,Ei.isCCClassOrFastDefined=Ci,Ei.getInheritanceChain=function(t){for(var e=[];t=Yt(t);)t!==Object&&e.push(t);return e};var xi={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function wi(t,e,i,n){var r=null,s="";function o(){return s=n+gi,r=Je(t)}"type"in e&&void 0===e.type&&$(3660,n,i);var a=e.type;a&&(xi[a]?(r||o())[s+"type"]=a:"Object"===a||("object"==typeof a?be.isEnum(a)?mi(r||o(),n,a):Se.isBitMask(a)&&((r||o())[s+"type"]=Si,r[s+"bitmaskList"]=Se.getList(a)):"function"==typeof a&&((r||o())[s+"type"]="Object",r[s+"ctor"]=a))),"default"in e&&((r||o())[s+"default"]=e.default);var h,u=function(t,i){if(t in e){var n=e[t];typeof n===i&&((r||o())[s+t]=n)}};e.editorOnly&&((r||o())[s+"editorOnly"]=!0),e.__internalFlags&_i.STANDALONE?h=!0===e.serializable||0!=(e.__internalFlags&_i.IMPLICIT_SERIALIZABLE):!1===e.serializable&&(h=!1),void 0!==h&&((r||o())[s+"serializable"]=h),u("formerlySerializedAs","string");var l=e.range;l&&Array.isArray(l)&&l.length>=2&&((r||o())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),u("step","number"),u("userData","object")}Ei.isArray=function(t){return t=bi(t),Array.isArray(t)},Ei.getDefault=bi,Ei.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},Ei.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,Ei.getNewValueTypeCode=!1,v.Class=Ei;var Di=Math.PI/180,Ri=180/Math.PI,Ii=Math.random,Mi=t("b6",.5*Math.PI),Pi=t("b7",2*Math.PI),Bi=t("b8",1e-6);function Oi(t,e){return Math.abs(t-e)<=Bi*Math.max(1,Math.abs(t),Math.abs(e))}function Li(t,e,i){return i=i||Bi,Math.abs(t-e)<=i}function Ni(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}function Fi(t){return t<0?0:t>1?1:t}function ki(t,e,i){return t+(e-t)*i}function Vi(t){return t*Di}function Gi(t){return t*Ri}function Ui(){return Ii()}function zi(t){Ii=t}function Hi(t,e){return Ui()*(e-t)+t}function Wi(t,e){return Math.floor(Hi(t,e))}function ji(t){return(t=(9301*t+49297)%233280)/233280}function Xi(t,e,i){return ji(t)*(i-e)+e}function Yi(t,e,i){return Math.floor(Xi(t,e,i))}function qi(t){return D(t)}function Ki(t,e){return t-Math.floor(t/e)*e}function Qi(t,e){return t=Ki(t,2*e),e-Math.abs(t-e)}function Zi(t,e,i){return(i-t)/(e-t)}function Ji(t){return Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?t.x:t.z:Math.abs(t.y)>Math.abs(t.z)?t.y:t.z}function $i(t,e){return Math.abs(t)>Math.abs(e)?t:e}function tn(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var en,nn,rn,sn=(en=new Float32Array(1),nn=new Int32Array(en.buffer),function(t){en[0]=t;var e=nn[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,nn[0]=i|r,nn[0]}),on=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 an(t){return sn(t)}function hn(t){return on(t)}var un,ln=t("aT",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 Math.atan2(Math.sqrt(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=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(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 Math.sqrt(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 Math.sqrt(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 Math.abs(i)<Bi?t.x=0:t.x=1/i,Math.abs(n)<Bi?t.y=0:t.y=1/n,Math.abs(r)<Bi?t.z=0:t.z=1/r,Math.abs(s)<Bi?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,o=i*i+n*n+r*r+s*s;return o>0?(o=1/Math.sqrt(o),t.x=i*o,t.y=n*o,t.z=r*o,t.w=s*o):(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*Ui()*Math.PI,n=2*Ui()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(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,o=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*o,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*o,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*o,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*o,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*o,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*o,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*o,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.x,a=i.y,h=i.z,u=i.w,l=u*n+a*s-h*r,c=u*r+h*n-o*s,_=u*s+o*r-a*n,f=-o*n-a*r-h*s;return t.x=l*u+f*-o+c*-h-_*-a,t.y=c*u+f*-a+_*-o-l*-h,t.z=_*u+f*-h+l*-a-c*-o,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){return void 0===i&&(i=Bi),!(Math.abs(t.x)===1/0||Math.abs(t.y)===1/0||Math.abs(t.z)===1/0||Math.abs(t.w)===1/0||Math.abs(e.x)===1/0||Math.abs(e.y)===1/0||Math.abs(e.z)===1/0||Math.abs(e.w)===1/0)&&Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(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){return void 0===e&&(e=Bi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.equals4f=function(t,e,i,n,r){return void 0===r&&(r=Bi),Math.abs(this.x-t)<=r*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=r*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=r*Math.max(1,Math.abs(this.z),Math.abs(i))&&Math.abs(this.w-n)<=r*Math.max(1,Math.abs(this.w),Math.abs(n))},i.strictEquals=function(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.x,n=this.y,r=this.z,s=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this.w=s+e*(t.w-s),this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},i.clampf=function(t,e){return this.x=Ni(this.x,t.x,e.x),this.y=Ni(this.y,t.y,e.y),this.z=Ni(this.z,t.z,e.z),this.w=Ni(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&$(16361),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&$(16362),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*r-e*o,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return this.x=t.m00*e+t.m04*i+t.m08*n+t.m12*r,this.y=t.m01*e+t.m05*i+t.m09*n+t.m13*r,this.z=t.m02*e+t.m06*i+t.m10*n+t.m14*r,this.w=t.m03*e+t.m07*i+t.m11*n+t.m15*r,this},e}(De));function cn(t,e,i,n){return new ln(t,e,i,n)}rn=ln,ln.ZERO=Object.freeze(new rn(0,0,0,0)),ln.ONE=Object.freeze(new rn(1,1,1,1)),ln.NEG_ONE=Object.freeze(new rn(-1,-1,-1,-1)),ln.UNIT_X=Object.freeze(new rn(1,0,0,0)),ln.UNIT_Y=Object.freeze(new rn(0,1,0,0)),ln.UNIT_Z=Object.freeze(new rn(0,0,1,0)),ln.UNIT_W=Object.freeze(new rn(0,0,0,1)),Ei.fastDefine("cc.Vec4",ln,{x:0,y:0,z:0,w:0}),v.Vec4=ln,v.v4=cn;var _n,fn,dn,pn,mn=t("aR",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=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(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 Math.sqrt(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 Math.sqrt(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 Math.abs(i)<Bi?t.x=0:t.x=1/i,Math.abs(n)<Bi?t.y=0:t.y=1/n,Math.abs(r)<Bi?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/Math.sqrt(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,o=i.x,a=i.y,h=i.z;return t.x=r*h-s*a,t.y=s*o-n*h,t.z=n*a-r*o,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*Ui()*Math.PI,n=2*Ui()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.m03*n+i.m07*r+i.m11*s+i.m15;return o=o?1/o:1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*o,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*o,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*o,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=i.m03*n+i.m07*r+i.m11*s;return o=o?1/o:1,t.x=(i.m00*n+i.m04*r+i.m08*s)*o,t.y=(i.m01*n+i.m05*r+i.m09*s)*o,t.z=(i.m02*n+i.m06*r+i.m10*s)*o,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,o=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+o*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+o*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+o*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,o=e.y*r.y,a=e.z*r.z,h=i.w*s+i.y*a-i.z*o,u=i.w*o+i.z*s-i.x*a,l=i.w*a+i.x*o-i.y*s,c=-i.x*s-i.y*o-i.z*a;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,o=e.y-n.y,a=e.z-n.z,h=i.w*s-i.y*a+i.z*o,u=i.w*o-i.z*s+i.x*a,l=i.w*a-i.x*o+i.y*s,c=i.x*s+i.y*o+i.z*a;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,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=r,l=s*a-o*h,c=s*h+o*a;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,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=o*h+r*a,l=s,c=o*a-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,o=e.z-i.z,a=Math.cos(n),h=Math.sin(n),u=r*a-s*h,l=r*h+s*a,c=o;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,o=e.y-i.y,a=e.z-i.z,h=n.x,u=n.y,l=n.z,c=Math.cos(r),_=Math.sin(r),f=s*(h*h*(1-c)+c)+o*(h*u*(1-c)-l*_)+a*(h*l*(1-c)+u*_),d=s*(h*u*(1-c)+l*_)+o*(u*u*(1-c)+c)+a*(u*l*(1-c)-h*_),p=s*(h*l*(1-c)-u*_)+o*(u*l*(1-c)+h*_)+a*(l*l*(1-c)+c);return t.x=f+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=Bi);var n=t.x,r=t.y,s=t.z,o=e.x,a=e.y,h=e.z;return Math.abs(n-o)<=i*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=i*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(s-h)<=i*Math.max(1,Math.abs(s),Math.abs(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)/Math.sqrt(i*n);return r=Ni(r,-1,1),Math.acos(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,o=i.z-e.z,a=r*r+s*s+o*o;if(0===a||n>=0&&a<n*n)return t.x=i.x,t.y=i.y,t.z=i.z,t;var h=n/Math.sqrt(a);return t.x=e.x+r*h,t.y=e.y+s*h,t.z=e.z+o*h,t},e.generateOrthogonal=function(t,i){var n=i.x,r=i.y,s=i.z,o=Math.abs(n),a=Math.abs(r),h=Math.abs(s);return o<a&&o<h?e.set(t,0,s,-r):a<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=Bi),Math.abs(this.x-t.x)<=e&&Math.abs(this.y-t.y)<=e&&Math.abs(this.z-t.z)<=e},i.equals3f=function(t,e,i,n){return void 0===n&&(n=Bi),Math.abs(this.x-t)<=n&&Math.abs(this.y-e)<=n&&Math.abs(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.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},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&&$(16357),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&$(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=Ni(this.x,t.x,e.x),this.y=Ni(this.y,t.y,e.y),this.z=Ni(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,o=t.z;return this.x=i*o-n*s,this.y=n*r-e*o,this.z=e*s-i*r,this},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},i.toVec2=function(){return new v.Vec2(this.x,this.y)},e}(De));function gn(t,e,i){return new mn(t,e,i)}un=mn,mn.UNIT_X=Object.freeze(new un(1,0,0)),mn.UNIT_Y=Object.freeze(new un(0,1,0)),mn.UNIT_Z=Object.freeze(new un(0,0,1)),mn.RIGHT=Object.freeze(new un(1,0,0)),mn.UP=Object.freeze(new un(0,1,0)),mn.FORWARD=Object.freeze(new un(0,0,-1)),mn.ZERO=Object.freeze(new un(0,0,0)),mn.ONE=Object.freeze(new un(1,1,1)),mn.NEG_ONE=Object.freeze(new un(-1,-1,-1)),mn.slerp=(_n=new un,fn=new un,dn=new un,function(t,e,i,n){var r=1e-5,s=un.len(e),o=un.len(i);if(s<r||o<r)return un.lerp(t,e,i,n);var a=ki(s,o,n),h=un.dot(e,i)/(s*o);if(h>.99999)return un.lerp(t,e,i,n);if(h<-.99999){var u=un.multiplyScalar(_n,e,1/s),l=un.generateOrthogonal(fn,u),c=Math.PI*n;return Sn(dn,u,l,c),un.multiplyScalar(t,dn,a),t}var _=h,f=Math.acos(_)*n,d=un.multiplyScalar(_n,e,1/s),p=un.multiplyScalar(fn,i,1/o);return un.scaleAndAdd(dn,p,d,-_),un.normalize(dn,dn),un.multiplyScalar(dn,dn,Math.sin(f)),un.scaleAndAdd(dn,dn,d,Math.cos(f)),un.multiplyScalar(t,dn,a),t}),mn.signedAngle=(pn=new un,function(t,e,i){var n=un.angle(t,e),r=un.cross(pn,t,e);return un.dot(r,i)<0?-n:n}),Ei.fastDefine("cc.Vec3",mn,{x:0,y:0,z:0}),v.Vec3=mn;var yn,vn,Sn=(yn={x:0,y:0,z:0,w:0},function(t,e,i,n){var r=.5*n,s=Math.sin(r);return yn.x=s*i.x,yn.y=s*i.y,yn.z=s*i.z,yn.w=Math.cos(r),mn.transformQuat(t,e,yn),t});v.v3=gn;var An,Tn=1/255,bn=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){return(e=void 0!==e?e:new ln).x=t._data[0]*Tn,e.y=t._data[1]*Tn,e.z=t._data[2]*Tn,e.w=t._data[3]*Tn,e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i)._data[0]=t.x/Tn,i._data[1]=t.y/Tn,i._data[2]=t.z/Tn,i._data[3]=t.w/Tn,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,o=e.b,a=e.a;return t.r=r+(i.r-r)*n,t.g=s+(i.g-s)*n,t.b=o+(i.b-o)*n,t.a=a+(i.a-a)*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=Bi),!(Math.abs(t.r)===1/0||Math.abs(t.g)===1/0||Math.abs(t.b)===1/0||Math.abs(t.a)===1/0)&&Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(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;return t&&this._data[0]===e.r&&this._data[1]===e.g&&this._data[2]===e.b&&this._data[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*Tn).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="0",i=[(this._data[0]<16?e:"")+this._data[0].toString(16),(this._data[1]<16?e:"")+this._data[1].toString(16),(this._data[2]<16?e:"")+this._data[2].toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this._data[3]<16?e:"")+this._data[3].toString(16)),i.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 o=Math.floor(t),a=t-o,h=i*(1-e),u=i*(1-e*a),l=i*(1-e*(1-a));switch(o){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}}return this._data[0]=255*n,this._data[1]=255*r,this._data[2]=255*s,this},i.toHSV=function(){var t=this._data[0]*Tn,e=this._data[1]*Tn,i=this._data[2]*Tn,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),o=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(o=r-s,n.h=t===r?(e-i)/o:e===r?2+(i-t)/o:4+(t-e)/o,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){if("object"==typeof t){var r,s,o,a,h=t;h._data?this._data.set(h._data):(this._data[0]=null!==(r=h.r)&&void 0!==r?r:0,this._data[1]=null!==(s=h.g)&&void 0!==s?s:0,this._data[2]=null!==(o=h.b)&&void 0!==o?o:0,this._data[3]=null!==(a=h.a)&&void 0!==a?a:255)}else this._data[0]=null!=t?t:0,this._data[1]=null!=e?e:0,this._data[2]=null!=i?i:0,this._data[3]=null!=n?n:255;return this},i.multiply=function(t){return this._data[0]*=t.r/255,this._data[1]*=t.g/255,this._data[2]*=t.b/255,this._data[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]*Tn},set:function(t){this._data[0]=255*t}},{key:"y",get:function(){return this._data[1]*Tn},set:function(t){this._data[1]=255*t}},{key:"z",get:function(){return this._data[2]*Tn},set:function(t){this._data[2]=255*t}},{key:"w",get:function(){return this._data[3]*Tn},set:function(t){this._data[3]=255*t}}]),e}(De));function En(t,e,i,n){return new bn(t,e,i,n)}function Cn(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}vn=bn,bn.WHITE=Object.freeze(new vn(255,255,255,255)),bn.GRAY=Object.freeze(new vn(127,127,127,255)),bn.BLACK=Object.freeze(new vn(0,0,0,255)),bn.TRANSPARENT=Object.freeze(new vn(0,0,0,0)),bn.RED=Object.freeze(new vn(255,0,0,255)),bn.GREEN=Object.freeze(new vn(0,255,0,255)),bn.BLUE=Object.freeze(new vn(0,0,255,255)),bn.CYAN=Object.freeze(new vn(0,255,255,255)),bn.MAGENTA=Object.freeze(new vn(255,0,255,255)),bn.YELLOW=Object.freeze(new vn(255,255,0,255)),Ei.fastDefine("cc.Color",bn,{r:0,g:0,b:0,a:255}),v.Color=bn,v.color=En;var xn=t("aX",function(t){function e(e,i,n,r,s,o,a,h,u){var l;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=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=1),l=t.call(this)||this,"object"==typeof e?(l.m00=e.m00,l.m01=e.m01,l.m02=e.m02,l.m03=e.m03,l.m04=e.m04,l.m05=e.m05,l.m06=e.m06,l.m07=e.m07,l.m08=e.m08):(l.m00=e,l.m01=i,l.m02=n,l.m03=r,l.m04=s,l.m05=o,l.m06=a,l.m07=h,l.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,o,a,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=o,t.m06=a,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,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,l=e.m08,c=l*o-a*u,_=-l*s+a*h,f=u*s-o*h,d=i*c+n*_+r*f;return 0===d?(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):(d=1/d,t.m00=c*d,t.m01=(-l*n+r*u)*d,t.m02=(a*n-r*o)*d,t.m03=_*d,t.m04=(l*i-r*h)*d,t.m05=(-a*i+r*s)*d,t.m06=f*d,t.m07=(-u*i+n*h)*d,t.m08=(o*i-n*s)*d,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,o=t.m05,a=t.m06,h=t.m07,u=t.m08;return e*(u*s-o*h)+i*(-u*r+o*a)+n*(h*r-s*a)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,y=i.m06,v=i.m07,S=i.m08;return t.m00=_*n+f*o+d*u,t.m01=_*r+f*a+d*l,t.m02=_*s+f*h+d*c,t.m03=p*n+m*o+g*u,t.m04=p*r+m*a+g*l,t.m05=p*s+m*h+g*c,t.m06=y*n+v*o+S*u,t.m07=y*r+v*a+S*l,t.m08=y*s+v*h+S*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,y=i.m08,v=i.m09,S=i.m10;return t.m00=_*n+f*o+d*u,t.m01=_*r+f*a+d*l,t.m02=_*s+f*h+d*c,t.m03=p*n+m*o+g*u,t.m04=p*r+m*a+g*l,t.m05=p*s+m*h+g*c,t.m06=y*n+v*o+S*u,t.m07=y*r+v*a+S*l,t.m08=y*s+v*h+S*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,o=e.m03,a=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.x,f=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=o,t.m04=a,t.m05=h,t.m06=_*n+f*o+u,t.m07=_*r+f*a+l,t.m08=_*s+f*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,o=e.m03,a=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=Math.sin(i),f=Math.cos(i);return t.m00=f*n+_*o,t.m01=f*r+_*a,t.m02=f*s+_*h,t.m03=f*o-_*n,t.m04=f*a-_*r,t.m05=f*h-_*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 mn.lengthSqr(i)<Bi*Bi?(e.identity(t),t):(n=n||mn.UNIT_Y,mn.normalize(Dn,mn.cross(Dn,n,i)),mn.lengthSqr(Dn)<Bi*Bi?(e.identity(t),t):(mn.cross(Rn,i,Dn),e.set(t,Dn.x,Dn.y,Dn.z,Rn.x,Rn.y,Rn.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,o=i+i,a=n+n,h=r+r,u=i*o,l=n*o,c=n*a,_=r*o,f=r*a,d=r*h,p=s*o,m=s*a,g=s*h;return t.m00=1-c-d,t.m03=l-g,t.m06=_+m,t.m01=l+g,t.m04=1-u-d,t.m07=f-p,t.m02=_-m,t.m05=f+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,o=e.m04,a=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*a-n*o,v=i*h-r*o,S=i*u-s*o,A=n*h-r*a,T=n*u-s*a,b=r*u-s*h,E=l*p-c*d,C=l*m-_*d,x=l*g-f*d,w=c*m-_*p,D=c*g-f*p,R=_*g-f*m,I=y*R-v*D+S*w+A*x-T*C+b*E;return I?(I=1/I,t.m00=(a*R-h*D+u*w)*I,t.m01=(h*x-o*R-u*C)*I,t.m02=(o*D-a*x+u*E)*I,t.m03=(r*D-n*R-s*w)*I,t.m04=(i*R-r*x+s*C)*I,t.m05=(n*x-i*D-s*E)*I,t.m06=(p*b-m*T+g*A)*I,t.m07=(m*S-d*b-g*v)*I,t.m08=(d*T-p*S+g*y)*I,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=Bi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(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 o=t.m06,a=t.m07,h=t.m08;return a<.999?a>-.999?(e.x=Math.asin(-a),e.y=Math.atan2(o,h),e.z=Math.atan2(n,s),!0):(e.x=Mi,e.y=Math.atan2(r,i),e.z=0,!1):(e.x=-Mi,e.y=Math.atan2(-r,i),e.z=0,!1)};var i=e.prototype;return i.clone=function(){var t=this;return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},i.set=function(t,e,i,n,r,s,o,a,h){return 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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=1),"object"==typeof t?(this.m00=t.m00,this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08):(this.m00=t,this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=o,this.m07=a,this.m08=h),this},i.equals=function(t,e){return void 0===e&&(e=Bi),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08},i.toString=function(){var t=this;return"[\n"+t.m00+", "+t.m01+", "+t.m02+",\n"+t.m03+",\n"+t.m04+", "+t.m05+",\n"+t.m06+", "+t.m07+",\n"+t.m08+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=1,this.m05=0,this.m06=0,this.m07=0,this.m08=1,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=t,this.m05=this.m07,this.m06=e,this.m07=i,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=h*r-s*a,l=-h*n+s*o,c=a*n-r*o,_=t*u+e*l+i*c;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=u*_,this.m01=(-h*e+i*a)*_,this.m02=(s*e-i*r)*_,this.m03=l*_,this.m04=(h*t-i*o)*_,this.m05=(-s*t+i*n)*_,this.m06=c*_,this.m07=(-a*t+e*o)*_,this.m08=(r*t-e*n)*_,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08;return t*(h*r-s*a)+e*(-h*n+s*o)+i*(a*n-r*o)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=this.m06,h=this.m07,u=this.m08,l=t.m00,c=t.m01,_=t.m02,f=t.m03,d=t.m04,p=t.m05,m=t.m06,g=t.m07,y=t.m08;return this.m00=l*e+c*r+_*a,this.m01=l*i+c*s+_*h,this.m02=l*n+c*o+_*u,this.m03=f*e+d*r+p*a,this.m04=f*i+d*s+p*h,this.m05=f*n+d*o+p*u,this.m06=m*e+g*r+y*a,this.m07=m*i+g*s+y*h,this.m08=m*n+g*o+y*u,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this},i.scale=function(t){var e=t.x,i=t.y;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=i,this.m04*=i,this.m05*=i,this},i.rotate=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=this.m06,h=this.m07,u=this.m08,l=Math.sin(t),c=Math.cos(t);return this.m00=c*e+l*r,this.m01=c*i+l*s,this.m02=c*n+l*o,this.m03=c*r-l*e,this.m04=c*s-l*i,this.m05=c*o-l*n,this.m06=a,this.m07=h,this.m08=u,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,o=i+i,a=n+n,h=e*s,u=i*s,l=i*o,c=n*s,_=n*o,f=n*a,d=r*s,p=r*o,m=r*a;return this.m00=1-l-f,this.m03=u-m,this.m06=c+p,this.m01=u+m,this.m04=1-h-f,this.m07=_-d,this.m02=c-p,this.m05=_+d,this.m08=1-h-l,this},e}(De));An=xn,xn.IDENTITY=Object.freeze(new An);var wn,Dn=new mn,Rn=new mn;Ei.fastDefine("cc.Mat3",xn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),v.Mat3=xn;var In=t("aV",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=mn.dot(i,n);return r<-.999999?(mn.cross(On,mn.UNIT_X,i),On.length()<1e-6&&mn.cross(On,mn.UNIT_Y,i),mn.normalize(On,On),e.fromAxisAngle(t,On,Math.PI),t):r>.999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(mn.cross(On,i,n),t.x=On.x,t.y=On.y,t.z=On.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(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,o=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=o,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){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r+h*n,t.y=o*r+a*n,t.z=a*r-o*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r-a*n,t.y=o*r+h*n,t.z=a*r+s*n,t.w=h*r-o*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,o=e.y,a=e.z,h=e.w;return t.x=s*r+o*n,t.y=o*r-s*n,t.z=a*r+h*n,t.w=h*r-a*n,t},e.rotateAround=function(t,i,n,r){return e.invert(Pn,i),mn.transformQuat(On,n,Pn),e.fromAxisAngle(Pn,On,r),e.multiply(t,i,Pn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(Pn,n,r),e.multiply(t,i,Pn),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(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,o=i.x,a=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,o=-o,a=-a,h=-h,u=-u),1-l>1e-6){var c=Math.acos(l),_=Math.sin(c);r=Math.sin((1-n)*c)/_,s=Math.sin(n*c)/_}else r=1-n,s=n;return t.x=r*e.x+s*o,t.y=r*e.y+s*a,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,o){return e.slerp(Pn,i,s,o),e.slerp(Bn,n,r,o),e.slerp(t,Pn,Bn,2*o*(1-o)),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 Math.sqrt(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/Math.sqrt(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 xn.set(Ln,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,Ln))},e.fromViewUp=function(t,i,n){return xn.fromViewUp(Ln,i,n),e.normalize(t,e.fromMat3(t,Ln))},e.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,l=e.m08,c=i-o-l,_=o-i-l,f=l-i-o,d=0,p=i+o+l;c>p&&(p=c,d=1),_>p&&(p=_,d=2),f>p&&(p=f,d=3);var m=.5*Math.sqrt(p+1),g=.25/m;switch(d){case 0:t.w=m,t.x=(a-u)*g,t.y=(h-r)*g,t.z=(n-s)*g;break;case 1:t.w=(a-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=(a+u)*g;break;case 3:t.w=(n-s)*g,t.x=(h+r)*g,t.y=(a+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){e*=Nn,i*=Nn,n*=Nn;var r=Math.sin(e),s=Math.cos(e),o=Math.sin(i),a=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*a*u+s*o*h,t.y=s*o*u+r*a*h,t.z=s*a*h-r*o*u,t.w=s*a*u-r*o*h,t},e.fromAngleZ=function(t,e){return e*=Nn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(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,o=e.w,a=0,h=0,u=0,l=n*r+s*o;if(l>.499999)a=0,h=Gi(2*Math.atan2(n,o)),u=90;else if(l<-.499999)a=0,h=-Gi(2*Math.atan2(n,o)),u=-90;else{var c=n*n,_=r*r,f=s*s;a=Gi(Math.atan2(2*n*o-2*r*s,1-2*c-2*f)),h=Gi(Math.atan2(2*r*o-2*n*s,1-2*_-2*f)),u=Gi(Math.asin(2*l)),i&&(a=-180*Math.sign(a+1e-6)+a,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=a,t.y=h,t.z=u,t},e.toEulerInYXZOrder=function(t,e){xn.fromQuat(Ln,e),xn.toEuler(Ln,t),t.x=Gi(t.x),t.y=Gi(t.y),t.z=Gi(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=Bi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))},e.angle=function(t,i){var n=Math.min(Math.abs(e.dot(t,i)),1);return 2*Math.acos(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 o=Math.min(r/Gi(s),1);return e.slerp(t,i,n,o)};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,e){return void 0===e&&(e=Bi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},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){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this.w+=e*(t.w-this.w),this},i.slerp=function(t,i){return e.slerp(this,this,t,i)},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e}(De));wn=In,In.IDENTITY=Object.freeze(new wn);var Mn,Pn=new In,Bn=new In,On=new mn,Ln=new xn,Nn=.5*Math.PI/180;function Fn(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 In(t,e,i,n)}Ei.fastDefine("cc.Quat",In,{x:0,y:0,z:0,w:1}),v.Quat=In,v.quat=Fn;var kn=t("b5",Object.freeze([Object.freeze([1,0,0,1]),Object.freeze([0,1,-1,0]),Object.freeze([-1,0,0,-1]),Object.freeze([0,-1,1,0])])),Vn=t("aY",function(t){function e(e,i,n,r,s,o,a,h,u,l,c,_,f,d,p,m){var g;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===o&&(o=1),void 0===a&&(a=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===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),g=t.call(this)||this,"object"==typeof e?(g.m00=e.m00,g.m01=e.m01,g.m02=e.m02,g.m03=e.m03,g.m04=e.m04,g.m05=e.m05,g.m06=e.m06,g.m07=e.m07,g.m08=e.m08,g.m09=e.m09,g.m10=e.m10,g.m11=e.m11,g.m12=e.m12,g.m13=e.m13,g.m14=e.m14,g.m15=e.m15):(g.m00=e,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=o,g.m06=a,g.m07=h,g.m08=u,g.m09=l,g.m10=c,g.m11=_,g.m12=f,g.m13=d,g.m14=p,g.m15=m),g}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,o,a,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=o,t.m06=a,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=_,t.m12=f,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.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,o=e.m07,a=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=o,t.m14=a}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,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*a-n*o,v=i*h-r*o,S=i*u-s*o,A=n*h-r*a,T=n*u-s*a,b=r*u-s*h,E=l*p-c*d,C=l*m-_*d,x=l*g-f*d,w=c*m-_*p,D=c*g-f*p,R=_*g-f*m,I=y*R-v*D+S*w+A*x-T*C+b*E;return 0===I?(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):(I=1/I,t.m00=(a*R-h*D+u*w)*I,t.m01=(r*D-n*R-s*w)*I,t.m02=(p*b-m*T+g*A)*I,t.m03=(_*T-c*b-f*A)*I,t.m04=(h*x-o*R-u*C)*I,t.m05=(i*R-r*x+s*C)*I,t.m06=(m*S-d*b-g*v)*I,t.m07=(l*b-_*S+f*v)*I,t.m08=(o*D-a*x+u*E)*I,t.m09=(n*x-i*D-s*E)*I,t.m10=(d*T-p*S+g*y)*I,t.m11=(c*S-l*T-f*y)*I,t.m12=(a*C-o*w-h*E)*I,t.m13=(i*w-n*C+r*E)*I,t.m14=(p*v-d*A-m*y)*I,t.m15=(l*A-c*v+_*y)*I,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,o=t.m05,a=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,_=t.m11,f=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*o-i*s)*(c*m-_*p)-(e*a-n*s)*(l*m-_*d)+(e*h-r*s)*(l*p-c*d)+(i*a-n*o)*(u*m-_*f)-(i*h-r*o)*(u*p-c*f)+(n*h-r*a)*(u*d-l*f)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,o=e.m03,a=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=e.m09,f=e.m10,d=e.m11,p=e.m12,m=e.m13,g=e.m14,y=e.m15,v=i.m00,S=i.m01,A=i.m02,T=i.m03;return t.m00=v*n+S*a+A*c+T*p,t.m01=v*r+S*h+A*_+T*m,t.m02=v*s+S*u+A*f+T*g,t.m03=v*o+S*l+A*d+T*y,v=i.m04,S=i.m05,A=i.m06,T=i.m07,t.m04=v*n+S*a+A*c+T*p,t.m05=v*r+S*h+A*_+T*m,t.m06=v*s+S*u+A*f+T*g,t.m07=v*o+S*l+A*d+T*y,v=i.m08,S=i.m09,A=i.m10,T=i.m11,t.m08=v*n+S*a+A*c+T*p,t.m09=v*r+S*h+A*_+T*m,t.m10=v*s+S*u+A*f+T*g,t.m11=v*o+S*l+A*d+T*y,v=i.m12,S=i.m13,A=i.m14,T=i.m15,t.m12=v*n+S*a+A*c+T*p,t.m13=v*r+S*h+A*_+T*m,t.m14=v*s+S*u+A*f+T*g,t.m15=v*o+S*l+A*d+T*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 o=e.m00,a=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,_=e.m06,f=e.m07,d=e.m08,p=e.m09,m=e.m10,g=e.m11;t.m00=o,t.m01=a,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=_,t.m07=f,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=o*n+l*r+d*s+e.m12,t.m13=a*n+c*r+p*s+e.m13,t.m14=h*n+_*r+m*s+e.m14,t.m15=u*n+f*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,o=n.z,a=Math.sqrt(r*r+s*s+o*o);if(Math.abs(a)<Bi)return null;r*=a=1/a,s*=a,o*=a;var h=Math.sin(i),u=Math.cos(i),l=1-u,c=e.m00,_=e.m01,f=e.m02,d=e.m03,p=e.m04,m=e.m05,g=e.m06,y=e.m07,v=e.m08,S=e.m09,A=e.m10,T=e.m11,b=r*r*l+u,E=s*r*l+o*h,C=o*r*l-s*h,x=r*s*l-o*h,w=s*s*l+u,D=o*s*l+r*h,R=r*o*l+s*h,I=s*o*l-r*h,M=o*o*l+u;return t.m00=c*b+p*E+v*C,t.m01=_*b+m*E+S*C,t.m02=f*b+g*E+A*C,t.m03=d*b+y*E+T*C,t.m04=c*x+p*w+v*D,t.m05=_*x+m*w+S*D,t.m06=f*x+g*w+A*D,t.m07=d*x+y*w+T*D,t.m08=c*R+p*I+v*M,t.m09=_*R+m*I+S*M,t.m10=f*R+g*I+A*M,t.m11=d*R+y*I+T*M,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=Math.sin(i),r=Math.cos(i),s=e.m04,o=e.m05,a=e.m06,h=e.m07,u=e.m08,l=e.m09,c=e.m10,_=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=o*r+l*n,t.m06=a*r+c*n,t.m07=h*r+_*n,t.m08=u*r-s*n,t.m09=l*r-o*n,t.m10=c*r-a*n,t.m11=_*r-h*n,t},e.rotateY=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m00,o=e.m01,a=e.m02,h=e.m03,u=e.m08,l=e.m09,c=e.m10,_=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=o*r-l*n,t.m02=a*r-c*n,t.m03=h*r-_*n,t.m08=s*n+u*r,t.m09=o*n+l*r,t.m10=a*n+c*r,t.m11=h*n+_*r,t},e.rotateZ=function(t,e,i){var n=Math.sin(i),r=Math.cos(i),s=e.m00,o=e.m01,a=e.m02,h=e.m03,u=e.m04,l=e.m05,c=e.m06,_=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=o*r+l*n,t.m02=a*r+c*n,t.m03=h*r+_*n,t.m04=u*r-s*n,t.m05=l*r-o*n,t.m06=c*r-a*n,t.m07=_*r-h*n,t},e.fromTranslation=function(t,e){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=e.x,t.m13=e.y,t.m14=e.z,t.m15=1,t},e.fromScaling=function(t,e){return t.m00=e.x,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=e.y,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=e.z,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromRotation=function(t,e,i){var n=i.x,r=i.y,s=i.z,o=Math.sqrt(n*n+r*r+s*s);if(Math.abs(o)<Bi)return null;n*=o=1/o,r*=o,s*=o;var a=Math.sin(e),h=Math.cos(e),u=1-h;return t.m00=n*n*u+h,t.m01=r*n*u+s*a,t.m02=s*n*u-r*a,t.m03=0,t.m04=n*r*u-s*a,t.m05=r*r*u+h,t.m06=s*r*u+n*a,t.m07=0,t.m08=n*s*u+r*a,t.m09=r*s*u-n*a,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,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=n,t.m06=i,t.m07=0,t.m08=0,t.m09=-i,t.m10=n,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromYRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=0,t.m02=-i,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=i,t.m09=0,t.m10=n,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.fromZRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t.m00=n,t.m01=i,t.m02=0,t.m03=0,t.m04=-i,t.m05=n,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.fromRT=function(t,e,i){var n=e.x,r=e.y,s=e.z,o=e.w,a=n+n,h=r+r,u=s+s,l=n*a,c=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=o*a,g=o*h,y=o*u;return t.m00=1-(f+p),t.m01=c+y,t.m02=_-g,t.m03=0,t.m04=c-y,t.m05=1-(l+p),t.m06=d+m,t.m07=0,t.m08=_+g,t.m09=d-m,t.m10=1-(l+f),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=zn.m00=e.m00,n=zn.m01=e.m01,r=zn.m02=e.m02,s=zn.m03=e.m04,o=zn.m04=e.m05,a=zn.m05=e.m06,h=zn.m06=e.m08,u=zn.m07=e.m09,l=zn.m08=e.m10;return t.x=Math.sqrt(i*i+n*n+r*r),t.y=Math.sqrt(s*s+o*o+a*a),t.z=Math.sqrt(h*h+u*u+l*l),xn.determinant(zn)<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*Math.sqrt(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*Math.sqrt(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*Math.sqrt(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*Math.sqrt(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&&mn.set(i,t.m12,t.m13,t.m14);var r=mn.set(Un,t.m00,t.m01,t.m02).length(),s=mn.set(Un,t.m04,t.m05,t.m06).length(),o=mn.set(Un,t.m08,t.m09,t.m10).length();if(n&&(n.x=r,n.y=s,n.z=o),0!==r&&0!==s&&0!==o){zn.m00=t.m00/r,zn.m01=t.m01/r,zn.m02=t.m02/r,zn.m03=t.m04/s,zn.m04=t.m05/s,zn.m05=t.m06/s,zn.m06=t.m08/o,zn.m07=t.m09/o,zn.m08=t.m10/o;var a=xn.determinant(zn);n&&a<0&&(n.x*=-1),e&&(a<0&&(zn.m00*=-1,zn.m01*=-1,zn.m02*=-1),In.fromMat3(e,zn))}else e&&In.identity(e)},e.toEuler=function(t,e){return xn.set(zn,t.m00,t.m01,t.m02,t.m04,t.m05,t.m06,t.m08,t.m09,t.m10),xn.toEuler(zn,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,o=e.z,a=e.w,h=r+r,u=s+s,l=o+o,c=r*h,_=r*u,f=r*l,d=s*u,p=s*l,m=o*l,g=a*h,y=a*u,v=a*l,S=n.x,A=n.y,T=n.z;return t.m00=(1-(d+m))*S,t.m01=(_+v)*S,t.m02=(f-y)*S,t.m03=0,t.m04=(_-v)*A,t.m05=(1-(c+m))*A,t.m06=(p+g)*A,t.m07=0,t.m08=(f+y)*T,t.m09=(p-g)*T,t.m10=(1-(c+d))*T,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,o=e.y,a=e.z,h=e.w,u=s+s,l=o+o,c=a+a,_=s*u,f=s*l,d=s*c,p=o*l,m=o*c,g=a*c,y=h*u,v=h*l,S=h*c,A=n.x,T=n.y,b=n.z,E=r.x,C=r.y,x=r.z;return t.m00=(1-(p+g))*A,t.m01=(f+S)*A,t.m02=(d-v)*A,t.m03=0,t.m04=(f-S)*T,t.m05=(1-(_+g))*T,t.m06=(m+y)*T,t.m07=0,t.m08=(d+v)*b,t.m09=(m-y)*b,t.m10=(1-(_+p))*b,t.m11=0,t.m12=i.x+E-(t.m00*E+t.m04*C+t.m08*x),t.m13=i.y+C-(t.m01*E+t.m05*C+t.m09*x),t.m14=i.z+x-(t.m02*E+t.m06*C+t.m10*x),t.m15=1,t},e.fromSRTOrigin=function(t,e,i,n,r){var s=e.x,o=e.y,a=e.z,h=e.w,u=s+s,l=o+o,c=a+a,_=s*u,f=s*l,d=s*c,p=o*l,m=o*c,g=a*c,y=h*u,v=h*l,S=h*c,A=n.x,T=n.y,b=n.z,E=r.x,C=r.y,x=r.z;return t.m00=(1-(p+g))*A,t.m01=(f+S)*A,t.m02=(d-v)*A,t.m03=0,t.m04=(f-S)*T,t.m05=(1-(_+g))*T,t.m06=(m+y)*T,t.m07=0,t.m08=(d+v)*b,t.m09=(m-y)*b,t.m10=(1-(_+p))*b,t.m11=0,t.m12=i.x+E-(t.m00*E+t.m04*C+t.m08*x),t.m13=i.y+C-(t.m01*E+t.m05*C+t.m09*x),t.m14=i.z+x-(t.m02*E+t.m06*C+t.m10*x),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,o=i+i,a=n+n,h=r+r,u=i*o,l=n*o,c=n*a,_=r*o,f=r*a,d=r*h,p=s*o,m=s*a,g=s*h;return t.m00=1-c-d,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-u-d,t.m06=f+p,t.m07=0,t.m08=_+m,t.m09=f-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,o){var a=1/(i-e),h=1/(r-n),u=1/(s-o);return t.m00=2*s*a,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)*a,t.m09=(r+n)*h,t.m10=(o+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=o*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,o,a,h){void 0===s&&(s=!0),void 0===o&&(o=-1),void 0===a&&(a=1),void 0===h&&(h=0);var u=1/Math.tan(e/2),l=1/(n-r),c=s?u/i:u,_=(s?u:u*i)*a,f=kn[h];return t.m00=c*f[0],t.m01=c*f[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-o*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-o),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,o,a,h,u){void 0===a&&(a=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,_=1/(s-o),f=-2*l,d=-2*c,p=(e+i)*l,m=(r+n)*c,g=kn[u];return t.m00=f*g[0],t.m01=f*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=_*(1-a),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-a*o)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,o=e.z,a=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,_=o-i.z,f=1/Math.sqrt(l*l+c*c+_*_),d=h*(_*=f)-u*(c*=f),p=u*(l*=f)-a*_,m=a*c-h*l,g=c*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),y=_*(d*=f)-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=_,t.m11=0,t.m12=-(d*r+p*s+m*o),t.m13=-(g*r+y*s+v*o),t.m14=-(l*r+c*s+_*o),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,o=e.m04,a=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*a-n*o,v=i*h-r*o,S=i*u-s*o,A=n*h-r*a,T=n*u-s*a,b=r*u-s*h,E=l*p-c*d,C=l*m-_*d,x=l*g-f*d,w=c*m-_*p,D=c*g-f*p,R=_*g-f*m,I=y*R-v*D+S*w+A*x-T*C+b*E;return I?(I=1/I,t.m00=(a*R-h*D+u*w)*I,t.m01=(h*x-o*R-u*C)*I,t.m02=(o*D-a*x+u*E)*I,t.m03=0,t.m04=(r*D-n*R-s*w)*I,t.m05=(i*R-r*x+s*C)*I,t.m06=(n*x-i*D-s*E)*I,t.m07=0,t.m08=(p*b-m*T+g*A)*I,t.m09=(m*S-d*b-g*v)*I,t.m10=(d*T-p*S+g*y)*I,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=Bi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(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,o,a,h,u,l,c,_,f,d,p){return 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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=o,this.m07=a,this.m08=h,this.m09=u,this.m10=l,this.m11=c,this.m12=_,this.m13=f,this.m14=d,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=Bi),!(Math.abs(this.m00)===1/0||Math.abs(this.m01)===1/0||Math.abs(this.m02)===1/0||Math.abs(this.m03)===1/0||Math.abs(this.m04)===1/0||Math.abs(this.m05)===1/0||Math.abs(this.m06)===1/0||Math.abs(this.m07)===1/0||Math.abs(this.m08)===1/0||Math.abs(this.m09)===1/0||Math.abs(this.m10)===1/0||Math.abs(this.m11)===1/0||Math.abs(this.m12)===1/0||Math.abs(this.m13)===1/0||Math.abs(this.m14)===1/0||Math.abs(this.m15)===1/0)&&Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15,m=t*s-e*r,g=t*o-i*r,y=t*a-n*r,v=e*o-i*s,S=e*a-n*s,A=i*a-n*o,T=h*f-u*_,b=h*d-l*_,E=h*p-c*_,C=u*d-l*f,x=u*p-c*f,w=l*p-c*d,D=m*w-g*x+y*C+v*E-S*b+A*T;return 0===D?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(D=1/D,this.m00=(s*w-o*x+a*C)*D,this.m01=(i*x-e*w-n*C)*D,this.m02=(f*A-d*S+p*v)*D,this.m03=(l*S-u*A-c*v)*D,this.m04=(o*E-r*w-a*b)*D,this.m05=(t*w-i*E+n*b)*D,this.m06=(d*y-_*A-p*g)*D,this.m07=(h*A-l*y+c*g)*D,this.m08=(r*x-s*E+a*T)*D,this.m09=(e*E-t*x-n*T)*D,this.m10=(_*S-f*y+p*m)*D,this.m11=(u*y-h*S-c*m)*D,this.m12=(s*b-r*C-o*T)*D,this.m13=(t*C-e*b+i*T)*D,this.m14=(f*g-_*v-d*m)*D,this.m15=(h*v-u*g+l*m)*D,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,o=this.m06,a=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*d)-(t*o-i*r)*(u*p-c*f)+(t*a-n*r)*(u*d-l*f)+(e*o-i*s)*(h*p-c*_)-(e*a-n*s)*(h*d-l*_)+(i*a-n*o)*(h*f-u*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,o=this.m05,a=this.m06,h=this.m07,u=this.m08,l=this.m09,c=this.m10,_=this.m11,f=this.m12,d=this.m13,p=this.m14,m=this.m15,g=t.m00,y=t.m01,v=t.m02,S=t.m03;return this.m00=g*e+y*s+v*u+S*f,this.m01=g*i+y*o+v*l+S*d,this.m02=g*n+y*a+v*c+S*p,this.m03=g*r+y*h+v*_+S*m,g=t.m04,y=t.m05,v=t.m06,S=t.m07,this.m04=g*e+y*s+v*u+S*f,this.m05=g*i+y*o+v*l+S*d,this.m06=g*n+y*a+v*c+S*p,this.m07=g*r+y*h+v*_+S*m,g=t.m08,y=t.m09,v=t.m10,S=t.m11,this.m08=g*e+y*s+v*u+S*f,this.m09=g*i+y*o+v*l+S*d,this.m10=g*n+y*a+v*c+S*p,this.m11=g*r+y*h+v*_+S*m,g=t.m12,y=t.m13,v=t.m14,S=t.m15,this.m12=g*e+y*s+v*u+S*f,this.m13=g*i+y*o+v*l+S*d,this.m14=g*n+y*a+v*c+S*p,this.m15=g*r+y*h+v*_+S*m,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},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.m00,s=this.m01,o=this.m02,a=this.m03,h=this.m04,u=this.m05,l=this.m06,c=this.m07,_=this.m08,f=this.m09,d=this.m10,p=this.m11;return this.m12=r*e+h*i+_*n+this.m12,this.m13=s*e+u*i+f*n+this.m13,this.m14=o*e+l*i+d*n+this.m14,this.m15=a*e+c*i+p*n+this.m15,this},i.scale=function(t){var e=t.x,i=t.y,n=t.z;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=i,this.m05*=i,this.m06*=i,this.m07*=i,this.m08*=n,this.m09*=n,this.m10*=n,this.m11*=n,this},i.rotate=function(t,e){var i=e.x,n=e.y,r=e.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)<Bi)return null;i*=s=1/s,n*=s,r*=s;var o=Math.sin(t),a=Math.cos(t),h=1-a,u=this.m00,l=this.m01,c=this.m02,_=this.m03,f=this.m04,d=this.m05,p=this.m06,m=this.m07,g=this.m08,y=this.m09,v=this.m10,S=this.m11,A=i*i*h+a,T=n*i*h+r*o,b=r*i*h-n*o,E=i*n*h-r*o,C=n*n*h+a,x=r*n*h+i*o,w=i*r*h+n*o,D=n*r*h-i*o,R=r*r*h+a;return this.m00=u*A+f*T+g*b,this.m01=l*A+d*T+y*b,this.m02=c*A+p*T+v*b,this.m03=_*A+m*T+S*b,this.m04=u*E+f*C+g*x,this.m05=l*E+d*C+y*x,this.m06=c*E+p*C+v*x,this.m07=_*E+m*C+S*x,this.m08=u*w+f*D+g*R,this.m09=l*w+d*D+y*R,this.m10=c*w+p*D+v*R,this.m11=_*w+m*D+S*R,this},i.getTranslation=function(t){return t.x=this.m12,t.y=this.m13,t.z=this.m14,t},i.getScale=function(t){var e=zn.m00=this.m00,i=zn.m01=this.m01,n=zn.m02=this.m02,r=zn.m03=this.m04,s=zn.m04=this.m05,o=zn.m05=this.m06,a=zn.m06=this.m08,h=zn.m07=this.m09,u=zn.m08=this.m10;return t.x=Math.sqrt(e*e+i*i+n*n),t.y=Math.sqrt(r*r+s*s+o*o),t.z=Math.sqrt(a*a+h*h+u*u),xn.determinant(zn)<0&&(t.x*=-1),t},i.getRotation=function(t){var e=mn.set(Un,this.m00,this.m01,this.m02).length(),i=mn.set(Un,this.m04,this.m05,this.m06).length(),n=mn.set(Un,this.m08,this.m09,this.m10).length();return zn.m00=this.m00/e,zn.m01=this.m01/e,zn.m02=this.m02/e,zn.m03=this.m04/i,zn.m04=this.m05/i,zn.m05=this.m06/i,zn.m06=this.m08/n,zn.m07=this.m09/n,zn.m08=this.m10/n,xn.determinant(zn)<0&&(zn.m00*=-1,zn.m01*=-1,zn.m02*=-1),In.fromMat3(t,zn)},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,o=t.w,a=n+n,h=r+r,u=s+s,l=n*a,c=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=o*a,g=o*h,y=o*u,v=i.x,S=i.y,A=i.z;return this.m00=(1-(f+p))*v,this.m01=(c+y)*v,this.m02=(_-g)*v,this.m03=0,this.m04=(c-y)*S,this.m05=(1-(l+p))*S,this.m06=(d+m)*S,this.m07=0,this.m08=(_+g)*A,this.m09=(d-m)*A,this.m10=(1-(l+f))*A,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromSRT=function(t,e,i){var n=t.x,r=t.y,s=t.z,o=t.w,a=n+n,h=r+r,u=s+s,l=n*a,c=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=o*a,g=o*h,y=o*u,v=i.x,S=i.y,A=i.z;return this.m00=(1-(f+p))*v,this.m01=(c+y)*v,this.m02=(_-g)*v,this.m03=0,this.m04=(c-y)*S,this.m05=(1-(l+p))*S,this.m06=(d+m)*S,this.m07=0,this.m08=(_+g)*A,this.m09=(d-m)*A,this.m10=(1-(l+f))*A,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,o=i+i,a=n+n,h=e*s,u=i*s,l=i*o,c=n*s,_=n*o,f=n*a,d=r*s,p=r*o,m=r*a;return this.m00=1-l-f,this.m01=u+m,this.m02=c-p,this.m03=0,this.m04=u-m,this.m05=1-h-f,this.m06=_+d,this.m07=0,this.m08=c+p,this.m09=_-d,this.m10=1-h-l,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(De));Mn=Vn,Vn.IDENTITY=Object.freeze(new Mn);var Gn,Un=new mn,zn=new xn;function Hn(t,e,i,n,r,s,o,a,h,u,l,c,_,f,d,p){return new Vn(t,e,i,n,r,s,o,a,h,u,l,c,_,f,d,p)}Ei.fastDefine("cc.Mat4",Vn,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1}),v.Mat4=Vn,v.mat4=Hn;var Wn,jn=t("aP",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=Math.ceil(e.x),t.y=Math.ceil(e.y),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(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 Math.sqrt(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 Math.sqrt(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 Math.abs(i)<Bi?t.x=0:t.x=1/i,Math.abs(n)<Bi?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/Math.sqrt(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 mn?(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*Ui()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(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=Bi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(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)/Math.sqrt(i*n);return r=Ni(r,-1,1),Math.acos(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,e){return void 0===e&&(e=Bi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))},i.equals2f=function(t,e,i){return void 0===i&&(i=Bi),Math.abs(this.x-t)<=i*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=i*Math.max(1,Math.abs(this.y),Math.abs(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.toFixed(2)+", "+this.y.toFixed(2)+")"},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=Ni(this.x,t.x,e.x),this.y=Ni(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&&$(16359),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&$(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 Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return 0;var n=this.dot(t)/Math.sqrt(e*i);return n=Ni(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.cross(t),i=this.dot(t);return Math.atan2(e,i)},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(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 mn(this.x,this.y,0)},e}(De));function Xn(t,e){return new jn(t,e)}Gn=jn,jn.ZERO=Object.freeze(new Gn(0,0)),jn.ONE=Object.freeze(new Gn(1,1)),jn.NEG_ONE=Object.freeze(new Gn(-1,-1)),jn.UNIT_X=Object.freeze(new Gn(1,0)),jn.UNIT_Y=Object.freeze(new Gn(0,1)),Ei.fastDefine("cc.Vec2",jn,{x:0,y:0}),v.Vec2=jn,v.v2=Xn,ht(jn,"Vec2",[{name:"sub",newName:"subtract",target:jn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:jn,targetName:"Vec2"},{name:"div",newName:"divide",target:jn,targetName:"Vec2"},{name:"dist",newName:"distance",target:jn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:jn,targetName:"Vec2"},{name:"mag",newName:"len",target:jn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:jn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:jn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:jn,targetName:"Vec2"}]),ht(jn.prototype,"Vec2",[{name:"mag",newName:"length",target:jn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:jn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:jn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:jn.prototype,targetName:"Vec2"}]),ht(mn,"Vec3",[{name:"sub",newName:"subtract",target:mn,targetName:"Vec3"},{name:"mul",newName:"multiply",target:mn,targetName:"Vec3"},{name:"div",newName:"divide",target:mn,targetName:"Vec3"},{name:"dist",newName:"distance",target:mn,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:mn,targetName:"Vec3"},{name:"mag",newName:"len",target:mn,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:mn,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:mn,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:mn,targetName:"Vec3"}]),ht(mn.prototype,"Vec3",[{name:"mag",newName:"length",target:mn.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:mn.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:mn.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:mn.prototype,targetName:"Vec3"}]),ht(ln,"Vec4",[{name:"sub",newName:"subtract",target:ln,targetName:"Vec4"},{name:"mul",newName:"multiply",target:ln,targetName:"Vec4"},{name:"div",newName:"divide",target:ln,targetName:"Vec4"},{name:"dist",newName:"distance",target:ln,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:ln,targetName:"Vec4"},{name:"mag",newName:"len",target:ln,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:ln,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:ln,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:ln,targetName:"Vec4"}]),ht(ln.prototype,"Vec4",[{name:"mag",newName:"length",target:ln.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:ln.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:ln.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:ln.prototype,targetName:"Vec4"}]),ht(In,"Quat",[{name:"mag",newName:"len",target:In,targetName:"Quat"},{name:"mul",newName:"multiply",target:In,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:In,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:In,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:In,targetName:"Quat"}]),ht(In.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:In.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:In.prototype,targetName:"Quat"}]),ht(bn,"Color",[{name:"sub",newName:"subtract",target:bn,targetName:"Color"},{name:"mul",newName:"multiply",target:bn,targetName:"Color"},{name:"div",newName:"divide",target:bn,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:bn,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 v.Color.fromHEX(e[0],n)}}]),ht(xn,"Mat3",[{name:"sub",newName:"subtract",target:xn,targetName:"Mat3"},{name:"mul",newName:"multiply",target:xn,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:xn,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:xn,targetName:"Mat3"}]),ht(xn.prototype,"Mat3",[{name:"sub",newName:"subtract",target:xn.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:xn.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:xn.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:xn.prototype,targetName:"Mat3"}]),ht(Vn,"Mat4",[{name:"sub",newName:"subtract",target:Vn,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Vn,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Vn,targetName:"Mat4"}]),ht(Vn.prototype,"Mat4",[{name:"sub",newName:"subtract",target:Vn.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:Vn.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:Vn.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:Vn.prototype,targetName:"Mat4"}]),function(t){t[t.VEC2=0]="VEC2",t[t.VEC3=1]="VEC3",t[t.VEC4=2]="VEC4",t[t.QUATERNION=3]="QUATERNION",t[t.MAT3=4]="MAT3",t[t.MAT4=5]="MAT4",t[t.SIZE=6]="SIZE",t[t.RECT=7]="RECT",t[t.COLOR=8]="COLOR"}(Wn||(Wn={}));var Yn,qn=t("a_",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,o=e.d,a=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+o*i.c,t.d=s*i.b+o*i.d,t.tx=a*i.a+h*i.c+i.tx,t.ty=a*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,o=i.b*e.x+i.d*e.y+i.ty,a=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,_=i.b*n+i.d*r+i.ty,f=Math.min(s,a,u,c),d=Math.max(s,a,u,c),p=Math.min(o,h,l,_),m=Math.max(o,h,l,_);t.x=f,t.y=p,t.width=d-f,t.height=m-p},t.transformObb=function(t,e,i,n,r,s,o){void 0===o&&(o=!0);var a=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,_=s.d*r.height;o?(e.x=a,e.y=h,i.x=u+a,i.y=l+h,t.x=c+a,t.y=_+h,n.x=u+c+a,n.y=l+_+h):(t.x=a,t.y=h,n.x=u+a,n.y=l+h,e.x=c+a,e.y=_+h,i.x=u+c+a,i.y=l+_+h)},t}());v.AffineTransform=qn;var Kn=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.toFixed(2)+", "+this.height.toFixed(2)+")"},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}(De));function Qn(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),new Kn(t,e)}Yn=Kn,Kn.ZERO=Object.freeze(new Yn(0,0)),Kn.ONE=Object.freeze(new Yn(1,1)),Ei.fastDefine("cc.Size",Kn,{width:0,height:0}),v.size=Qn,v.Size=Kn;var Zn=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=Math.min(e.x,i.x),r=Math.min(e.y,i.y),s=Math.max(e.x,i.x),o=Math.max(e.y,i.y);return t.x=n,t.y=r,t.width=s-n,t.height=o-r,t},e.lerp=function(t,e,i,n){var r=e.x,s=e.y,o=e.width,a=e.height;return t.x=r+(i.x-r)*n,t.y=s+(i.y-s)*n,t.width=o+(i.width-o)*n,t.height=a+(i.height-a)*n,t},e.intersection=function(t,e,i){var n=e.x,r=e.y,s=e.x+e.width,o=e.y+e.height,a=i.x,h=i.y,u=i.x+i.width,l=i.y+i.height;return t.x=Math.max(n,a),t.y=Math.max(r,h),t.width=Math.min(s,u)-t.x,t.height=Math.min(o,l)-t.y,t},e.union=function(t,e,i){var n=e.x,r=e.y,s=e.width,o=e.height,a=i.x,h=i.y,u=i.width,l=i.height;return t.x=Math.min(n,a),t.y=Math.min(r,h),t.width=Math.max(n+s,a+u)-t.x,t.height=Math.max(r+o,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){return"object"==typeof t?(this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height):(this.x=t||0,this.y=e||0,this.width=i||0,this.height=n||0),this},i.equals=function(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.width,s=this.height;return this.x=i+(t.x-i)*e,this.y=n+(t.y-n)*e,this.width=r+(t.width-r)*e,this.height=s+(t.height-s)*e,this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},i.intersects=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,r=t.y+t.height;return!(e<t.x||n<this.x||i<t.y||r<this.y)},i.contains=function(t){return this.x<=t.x&&this.x+this.width>=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,o=t.m01*e+t.m05*i+t.m13,a=t.m00*n+t.m04*i+t.m12,h=t.m01*n+t.m05*i+t.m13,u=t.m00*e+t.m04*r+t.m12,l=t.m01*e+t.m05*r+t.m13,c=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,f=Math.min(s,a,u,c),d=Math.max(s,a,u,c),p=Math.min(o,h,l,_),m=Math.max(o,h,l,_);return this.x=f,this.y=p,this.width=d-f,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,o=this.y,a=s+this.width,h=o+this.height;e.x=t.m00*s+t.m04*o+t.m12,e.y=t.m01*s+t.m05*o+t.m13,r.x=t.m00*a+t.m04*o+t.m12,r.y=t.m01*a+t.m05*o+t.m13,i.x=t.m00*s+t.m04*h+t.m12,i.y=t.m01*s+t.m05*h+t.m13,n.x=t.m00*a+t.m04*h+t.m12,n.y=t.m01*a+t.m05*h+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 jn(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 jn(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new Kn(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}(De));function Jn(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 Zn(t,e,i,n)}Ei.fastDefine("cc.Rect",Zn,{x:0,y:0,width:0,height:0}),v.Rect=Zn,v.rect=Jn;var $n=t("bw",Float64Array),tr=t("bx",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.createFloatArray=function(t){return new $n(t)},n(e,[{key:"array",get:function(){return this._array}}]),e}(De)),er=Object.freeze({__proto__:null,bits:I,Vec2:jn,v2:Xn,Vec3:mn,v3:gn,Vec4:ln,v4:cn,Quat:In,quat:Fn,Mat3:xn,Mat4:Vn,mat4:Hn,AffineTransform:qn,Size:Kn,size:Qn,Rect:Zn,rect:Jn,Color:bn,color:En,preTransforms:kn,HALF_PI:Mi,TWO_PI:Pi,EPSILON:Bi,equals:Oi,approx:Li,clamp:Ni,clamp01:Fi,lerp:ki,toRadian:Vi,toDegree:Gi,random:Ui,setRandGenerator:zi,randomRange:Hi,randomRangeInt:Wi,pseudoRandom:ji,pseudoRandomRange:Xi,pseudoRandomRangeInt:Yi,nextPow2:qi,repeat:Ki,pingPong:Qi,inverseLerp:Zi,absMaxComponent:Ji,absMax:$i,enumerableProps:tn,floatToHalf:an,halfToFloat:hn,MATH_FLOAT_ARRAY:$n,MathBase:tr});t("aJ",er);var ir=new mn,nr=new mn,rr=new mn,sr=new mn,or=new mn,ar=new mn,hr=new Array(3),ur=new Array(3);function lr(t,e){return mn.dot(e.n,t)-e.d}function cr(t,e,i){return mn.copy(t,e),mn.subtract(or,i.center,i.halfExtents),mn.add(ar,i.center,i.halfExtents),t.x=t.x<or.x?or.x:t.x,t.y=t.y<or.y?or.y:t.y,t.z=t.z<or.z?or.z:t.z,t.x=t.x>ar.x?ar.x:t.x,t.y=t.y>ar.y?ar.y:t.y,t.z=t.z>ar.z?ar.z:t.z,t}function _r(t,e,i){mn.set(ir,i.orientation.m00,i.orientation.m01,i.orientation.m02),mn.set(nr,i.orientation.m03,i.orientation.m04,i.orientation.m05),mn.set(rr,i.orientation.m06,i.orientation.m07,i.orientation.m08),hr[0]=ir,hr[1]=nr,hr[2]=rr,ur[0]=i.halfExtents.x,ur[1]=i.halfExtents.y,ur[2]=i.halfExtents.z,mn.subtract(sr,e,i.center),mn.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=mn.dot(sr,hr[n]);r>ur[n]&&(r=ur[n]),r<-ur[n]&&(r=-ur[n]),t.x+=r*hr[n].x,t.y+=r*hr[n].y,t.z+=r*hr[n].z}return t}var fr=Object.freeze({__proto__:null,point_plane:lr,pt_point_plane:function(t,e,i){var n=lr(e,i);return mn.subtract(t,e,mn.multiplyScalar(t,i.n,n))},pt_point_aabb:cr,pt_point_obb:_r,pt_point_line:function(t,e,i,n){mn.subtract(ir,i,n);var r=ir.clone(),s=mn.lengthSqr(r);if(0===s)mn.copy(t,i);else{mn.subtract(ir,e,i);var o=mn.dot(ir,r)/s;o<0?mn.copy(t,i):o>1?mn.copy(t,n):mn.scaleAndAdd(t,i,r,o)}}}),dr={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},pr=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=dr.SHAPE_LINE,this.s=new mn(t,e,i),this.e=new mn(n,r,s)}return t.create=function(e,i,n,r,s,o){return new t(e,i,n,r,s,o)},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 mn.copy(t.s,e.s),mn.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return mn.copy(t.s,e),mn.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,o){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=o,t},t.len=function(t){return mn.distance(t.s,t.e)},t.prototype.length=function(){return mn.distance(this.s,this.e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),mr=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=dr.SHAPE_RAY,this.o=new mn(t,e,i),this.d=new mn(n,r,s)}return t.create=function(e,i,n,r,s,o){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===o&&(o=1),new t(e,i,n,r,s,o)},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 mn.copy(t.o,e.o),mn.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return mn.copy(t.o,e),mn.normalize(t.d,mn.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,o){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=o,t},t.prototype.computeHit=function(t,e){mn.normalize(t,this.d),mn.scaleAndAdd(t,this.o,t,e)},n(t,[{key:"type",get:function(){return this._type}}]),t}(),gr=new mn,yr=new mn,vr=new mn,Sr=new mn;function Ar(t){return Math.max(Math.max(t.x,t.y),t.z)}var Tr,br,Er,Cr,wr,Dr=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=dr.SHAPE_SPHERE,this._center=new mn(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 mn.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return mn.multiplyScalar(t.center,mn.add(gr,e,i),.5),t.radius=.5*mn.subtract(gr,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){mn.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),mn.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){mn.transformMat4(r.center,this.center,t),r.radius=this.radius*Ar(n)},e.translateAndRotate=function(t,e,i){mn.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*Ar(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),mn.subtract(yr,t,this.center);var e=yr.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,mn.multiplyScalar(yr,yr,i/e),mn.add(this.center,this.center,yr)}},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(vr,Sr),this.mergePoint(vr),this.mergePoint(Sr)},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}(),Rr=function(t,e){var i=mn.dot(t.d,e.n);if(Math.abs(i)<Number.EPSILON)return 0;var n=-lr(t.o,e)/i;return n<0?0:n},Ir=(Tr=new mn(0,0,0),br=new mn(0,0,0),Er=new mn(0,0,0),Cr=new mn(0,0,0),wr=new mn(0,0,0),function(t,e,i){mn.subtract(Tr,e.b,e.a),mn.subtract(br,e.c,e.a),mn.cross(Er,t.d,br);var n=mn.dot(Tr,Er);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;mn.subtract(Cr,t.o,e.a);var s=mn.dot(Cr,Er)*r;if(s<0||s>1)return 0;mn.cross(wr,Cr,Tr);var o=mn.dot(t.d,wr)*r;if(o<0||s+o>1)return 0;var a=mn.dot(br,wr)*r;return a<0?0:a}),Mr=function(){var t=new mn(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,o=e.d,a=n*n;mn.subtract(t,r,s);var h=t.lengthSqr(),u=mn.dot(t,o),l=a-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),_=h<a?u+c:u-c;return _<0?0:_}}(),Pr=function(){var t=new mn,e=new mn;return function(i,n){return mn.subtract(t,n.center,n.halfExtents),mn.add(e,n.center,n.halfExtents),function(t,e,i){var n=t.o,r=t.d,s=1/r.x,o=1/r.y,a=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,l=(e.y-n.y)*o,c=(i.y-n.y)*o,_=(e.z-n.z)*a,f=(i.z-n.z)*a,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}(i,t,e)}}(),Br=function(){var t=new mn,e=new mn,i=new mn,n=new mn,r=new mn,s=new mn,o=new mn,a=new Array(3),h=new Array(3),u=new Array(3),l=new Array(6);return function(c,_){a[0]=_.halfExtents.x,a[1]=_.halfExtents.y,a[2]=_.halfExtents.z,t=_.center,e=c.o,i=c.d,mn.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),mn.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),mn.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),mn.subtract(o,t,e),h[0]=mn.dot(n,i),h[1]=mn.dot(r,i),h[2]=mn.dot(s,i),u[0]=mn.dot(n,o),u[1]=mn.dot(r,o),u[2]=mn.dot(s,o);for(var f=0;f<3;++f){if(0===h[f]){if(-u[f]-a[f]>0||-u[f]+a[f]<0)return 0;h[f]=1e-7}l[2*f+0]=(u[f]+a[f])/h[f],l[2*f+1]=(u[f]-a[f])/h[f]}var d=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||d>p?0:d>0?d:p}}(),Or=function(){var t=new mn,e=new mn,i=new mn,n=new mn,r=new mn,s=new mn,o=new mn,a=new Dr;return function(h,u){var l=u.ellipseCenter0,c=u.ellipseCenter1,_=mn.subtract(e,c,l);if(_.length()<Bi)return a.radius=u.radius,a.center.set(u.ellipseCenter0),gs.raySphere(h,a);var f=h.o,d=mn.subtract(i,f,l),p=mn.normalize(t,h.d),m=mn.cross(n,p,_),g=m.lengthSqr();if(0===g){a.radius=u.radius;var y=mn.subtract(r,c,f);return d.lengthSqr()<y.lengthSqr()?a.center.set(l):a.center.set(c),gs.raySphere(h,a)}var v=mn.cross(r,d,_),S=_.lengthSqr(),A=2*mn.dot(m,v),T=u.radius*u.radius,b=A*A-4*g*(v.lengthSqr()-T*S);if(b<0)return 0;var E=(-A-Math.sqrt(b))/(2*g);if(E<0){a.radius=u.radius;var C=mn.subtract(s,c,f);return d.lengthSqr()<C.lengthSqr()?a.center.set(u.ellipseCenter0):a.center.set(u.ellipseCenter1),gs.raySphere(h,a)}var x=mn.scaleAndAdd(s,h.o,p,E),w=mn.subtract(o,x,l),D=mn.dot(w,_)/S;return D>=0&&D<=1?E:D<0?(a.radius=u.radius,a.center.set(u.ellipseCenter0),gs.raySphere(h,a)):D>1?(a.radius=u.radius,a.center.set(u.ellipseCenter1),gs.raySphere(h,a)):0}}(),Lr=function(){var t=new mn(0,0,0);return function(e,i){mn.subtract(t,e.e,e.s);var n=-lr(e.s,i)/mn.dot(t,i.n);return n<0||n>1?0:n}}(),Nr=function(){var t=new mn(0,0,0),e=new mn(0,0,0),i=new mn(0,0,0),n=new mn(0,0,0),r=new mn(0,0,0),s=new mn(0,0,0);return function(o,a,h){mn.subtract(t,a.b,a.a),mn.subtract(e,a.c,a.a),mn.subtract(i,o.s,o.e),mn.cross(r,t,e);var u=mn.dot(i,r);if(u<=0)return 0;mn.subtract(n,o.s,a.a);var l=mn.dot(n,r);if(l<0||l>u)return 0;mn.cross(s,i,n);var c=mn.dot(e,s);if(c<0||c>u)return 0;var _=-mn.dot(t,s);if(_<0||c+_>u)return 0;if(h){var f=1/u,d=1-(c*=f)-(_*=f);mn.set(h,a.a.x*d+a.b.x*c+a.c.x*_,a.a.y*d+a.b.y*c+a.c.y*_,a.a.z*d+a.b.z*c+a.c.z*_)}return 1}}(),Fr=new mr;function kr(t,e){Fr.o.set(t.s),mn.subtract(Fr.d,t.e,t.s),Fr.d.normalize();var i=Pr(Fr,e);return i<=t.length()?i:0}function Vr(t,e){Fr.o.set(t.s),mn.subtract(Fr.d,t.e,t.s),Fr.d.normalize();var i=Br(Fr,e);return i<=t.length()?i:0}function Gr(t,e){Fr.o.set(t.s),mn.subtract(Fr.d,t.e,t.s),Fr.d.normalize();var i=Mr(Fr,e);return i<=t.length()?i:0}var Ur,zr,Hr,Wr,jr=(Ur=new mn,zr=new mn,Hr=new mn,Wr=new mn,function(t,e){return mn.subtract(Ur,t.center,t.halfExtents),mn.add(zr,t.center,t.halfExtents),mn.subtract(Hr,e.center,e.halfExtents),mn.add(Wr,e.center,e.halfExtents),Ur.x<=Wr.x&&zr.x>=Hr.x&&Ur.y<=Wr.y&&zr.y>=Hr.y&&Ur.z<=Wr.z&&zr.z>=Hr.z});function Xr(t,e,i,n,r,s){mn.set(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),mn.set(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),mn.set(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),mn.set(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),mn.set(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),mn.set(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),mn.set(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),mn.set(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 Yr(t,e){for(var i=mn.dot(e,t[0]),n=i,r=1;r<8;++r){var s=mn.dot(e,t[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var qr,Kr,Qr,Zr,Jr,$r=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new mn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new mn(0,0,0),n[r]=new mn(0,0,0);var s=new mn,o=new mn;return function(e,r){mn.set(t[0],1,0,0),mn.set(t[1],0,1,0),mn.set(t[2],0,0,1),mn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),mn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),mn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var a=0;a<3;++a)mn.cross(t[6+3*a],t[a],t[3]),mn.cross(t[7+3*a],t[a],t[4]),mn.cross(t[7+3*a],t[a],t[5]);mn.subtract(s,e.center,e.halfExtents),mn.add(o,e.center,e.halfExtents),function(t,e,i){mn.set(i[0],t.x,e.y,e.z),mn.set(i[1],t.x,e.y,t.z),mn.set(i[2],t.x,t.y,e.z),mn.set(i[3],t.x,t.y,t.z),mn.set(i[4],e.x,e.y,e.z),mn.set(i[5],e.x,e.y,t.z),mn.set(i[6],e.x,t.y,e.z),mn.set(i[7],e.x,t.y,t.z)}(s,o,i),Xr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=Yr(i,t[h]),l=Yr(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),ts=function(t,e){var i=t.halfExtents.x*Math.abs(e.n.x)+t.halfExtents.y*Math.abs(e.n.y)+t.halfExtents.z*Math.abs(e.n.z),n=mn.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1},es=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===ts(t,e.planes[i]))return 0;return 1},is=function(){for(var t=new Array(8),e=0,i=0,n=0;n<t.length;n++)t[n]=new mn(0,0,0);return function(n,r){for(var s=0,o=!1,a=0;a<r.planes.length;a++){if(-1===(s=ts(n,r.planes[a])))return 0;1===s&&(o=!0)}if(!o)return 1;for(var h=0;h<r.vertices.length;h++)mn.subtract(t[h],r.vertices[h],n.center);e=0,i=0;for(var u=0;u<r.vertices.length;u++)t[u].x>n.halfExtents.x?e++:t[u].x<-n.halfExtents.x&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var l=0;l<r.vertices.length;l++)t[l].y>n.halfExtents.y?e++:t[l].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var c=0;c<r.vertices.length;c++)t[c].z>n.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),ns=(qr=new mn(0,0,0),Kr=new xn,function(t,e){return mn.subtract(qr,e,t.center),mn.transformMat3(qr,qr,xn.transpose(Kr,t.orientation)),i=qr,n=t.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),rs=(Qr=function(t,e,i,n){return Math.abs(t.x*e+t.y*i+t.z*n)},function(t,e){var i=t.halfExtents.x*Qr(e.n,t.orientation.m00,t.orientation.m01,t.orientation.m02)+t.halfExtents.y*Qr(e.n,t.orientation.m03,t.orientation.m04,t.orientation.m05)+t.halfExtents.z*Qr(e.n,t.orientation.m06,t.orientation.m07,t.orientation.m08),n=mn.dot(e.n,t.center);return n+i<e.d?-1:n-i>e.d?0:1}),ss=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===rs(t,e.planes[i]))return 0;return 1},os=function(){for(var t=new Array(8),e=0,i=0,n=0,r=0;r<t.length;r++)t[r]=new mn(0,0,0);var s=function(t,e,i,n){return t.x*e+t.y*i+t.z*n};return function(r,o){for(var a=0,h=!1,u=0;u<o.planes.length;u++){if(-1===(a=rs(r,o.planes[u])))return 0;1===a&&(h=!0)}if(!h)return 1;for(var l=0;l<o.vertices.length;l++)mn.subtract(t[l],o.vertices[l],r.center);i=0,n=0;for(var c=0;c<o.vertices.length;c++)(e=s(t[c],r.orientation.m00,r.orientation.m01,r.orientation.m02))>r.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var _=0;_<o.vertices.length;_++)(e=s(t[_],r.orientation.m03,r.orientation.m04,r.orientation.m05))>r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===o.vertices.length||n===o.vertices.length)return 0;i=0,n=0;for(var f=0;f<o.vertices.length;f++)(e=s(t[f],r.orientation.m06,r.orientation.m07,r.orientation.m08))>r.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===o.vertices.length||n===o.vertices.length?0:1}}(),as=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new mn(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new mn(0,0,0),n[r]=new mn(0,0,0);return function(e,r){mn.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),mn.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),mn.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),mn.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),mn.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),mn.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)mn.cross(t[6+3*s],t[s],t[3]),mn.cross(t[7+3*s],t[s],t[4]),mn.cross(t[8+3*s],t[s],t[5]);Xr(e.center,e.halfExtents,t[0],t[1],t[2],i),Xr(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var o=0;o<15;++o){var a=Yr(i,t[o]),h=Yr(n,t[o]);if(h[0]>a[1]||a[0]>h[1])return 0}return 1}}(),hs=function(){for(var t=new Dr,e=new mn,i=new mn,n=new mn,r=new Array(8),s=0;s<8;s++)r[s]=new mn;for(var o=new Array(8),a=0;a<8;a++)o[a]=new mn;return function(s,a){if(0===mn.squaredDistance(a.ellipseCenter0,a.ellipseCenter1))return t.radius=a.radius,t.center.set(a.ellipseCenter0),gs.sphereOBB(t,s);e.x=s.orientation.m00,e.y=s.orientation.m01,e.z=s.orientation.m02,i.x=s.orientation.m03,i.y=s.orientation.m04,i.z=s.orientation.m05,n.x=s.orientation.m06,n.y=s.orientation.m07,n.z=s.orientation.m08,Xr(s.center,s.halfExtents,e,i,n,r);var h=o,u=mn.copy(h[0],e),l=mn.copy(h[1],i),c=mn.copy(h[2],n);mn.subtract(h[3],a.center,s.center).normalize();var _=mn.subtract(h[4],a.ellipseCenter0,a.ellipseCenter1);_.normalize(),mn.cross(h[5],u,_),mn.cross(h[6],l,_),mn.cross(h[7],c,_);for(var f=0;f<8;++f){var d=Yr(r,h[f]),p=mn.dot(h[f],a.ellipseCenter0),m=mn.dot(h[f],a.ellipseCenter1),g=Math.max(p,m),y=Math.min(p,m)-a.radius,v=g+a.radius;if(y>d[1]||d[0]>v)return 0}return 1}}(),us=function(t,e){var i=mn.dot(e.n,t.center),n=t.radius*e.n.length();return i+n<e.d?-1:i-n>e.d?0:1},ls=function(t,e){for(var i=0;i<e.planes.length;i++)if(-1===us(t,e.planes[i]))return 0;return 1},cs=(Zr=new mn(0,0,0),Jr=[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,o=n.n,a=n.d,h=mn.dot(o,s);if(h+r<a)return 0;if(!(h-r>a)){mn.add(Zr,s,mn.multiplyScalar(Zr,o,r));for(var u=0;u<6;u++)if(u!==i&&u!==i+Jr[i]){var l=e.planes[u];if(mn.dot(l.n,Zr)<l.d)return 0}}}return 1}),_s=function(t,e){var i=t.radius+e.radius;return mn.squaredDistance(t.center,e.center)<i*i},fs=function(){var t=new mn;return function(e,i){return cr(t,e.center,i),mn.squaredDistance(e.center,t)<e.radius*e.radius}}(),ds=function(){var t=new mn;return function(e,i){return _r(t,e.center,i),mn.squaredDistance(e.center,t)<e.radius*e.radius}}(),ps=function(){var t=new mn,e=new mn;return function(i,n){var r=i.radius+n.radius,s=r*r,o=mn.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===o)return mn.squaredDistance(i.center,n.center)<s;mn.subtract(t,i.center,n.ellipseCenter0),mn.subtract(e,n.ellipseCenter1,n.ellipseCenter0);var a=mn.dot(t,e)/o;return a<0?mn.squaredDistance(i.center,n.ellipseCenter0)<s:a>1?mn.squaredDistance(i.center,n.ellipseCenter1)<s:(mn.scaleAndAdd(t,n.ellipseCenter0,e,a),mn.squaredDistance(i.center,t)<s)}}(),ms=function(){var t=new mn,e=new mn,i=new mn,n=new mn,r=new mn,s=new mn;return function(o,a){var h,u,l=mn.subtract(t,o.ellipseCenter1,o.ellipseCenter0),c=mn.subtract(e,a.ellipseCenter1,a.ellipseCenter0),_=mn.subtract(i,o.ellipseCenter0,a.ellipseCenter0),f=mn.dot(l,l),d=mn.dot(l,c),p=mn.dot(c,c),m=mn.dot(l,_),g=mn.dot(c,_),y=f*p-d*d,v=y,S=y;y<Bi?(h=0,v=1,u=g,S=p):(u=f*g-d*m,(h=d*g-p*m)<0?(h=0,u=g,S=p):h>v&&(h=v,u=g+d,S=p)),u<0?(u=0,-m<0?h=0:-m>f?h=v:(h=-m,v=f)):u>S&&(u=S,-m+d<0?h=0:-m+d>f?h=v:(h=-m+d,v=f));var A=Math.abs(h)<Bi?0:h/v,T=Math.abs(u)<Bi?0:u/S,b=n;b.set(_),b.add(mn.multiplyScalar(r,l,A)),b.subtract(mn.multiplyScalar(s,c,T));var E=o.radius+a.radius;return b.lengthSqr()<E*E}}(),gs={raySphere:Mr,rayAABB:Pr,rayOBB:Br,rayPlane:Rr,rayTriangle:Ir,rayCapsule:Or,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:Gr,lineAABB:kr,lineOBB:Vr,linePlane:Lr,lineTriangle:Nr,sphereWithSphere:_s,sphereAABB:fs,sphereOBB:ds,spherePlane:us,sphereFrustum:ls,sphereFrustumAccurate:cs,sphereCapsule:ps,aabbWithAABB:jr,aabbWithOBB:$r,aabbPlane:ts,aabbFrustum:es,aabbFrustumAccurate:is,obbWithOBB:as,obbPlane:rs,obbFrustum:ss,obbFrustumAccurate:os,obbPoint:ns,obbCapsule:hs,aabbFrustumCompletelyInside:function(t,e){for(var i=0;i<e.planes.length;i++)if(0!==ts(t,e.planes[i]))return 0;return 1},capsuleWithCapsule:ms,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)}};gs[dr.SHAPE_RAY|dr.SHAPE_SPHERE]=Mr,gs[dr.SHAPE_RAY|dr.SHAPE_AABB]=Pr,gs[dr.SHAPE_RAY|dr.SHAPE_OBB]=Br,gs[dr.SHAPE_RAY|dr.SHAPE_PLANE]=Rr,gs[dr.SHAPE_RAY|dr.SHAPE_TRIANGLE]=Ir,gs[dr.SHAPE_RAY|dr.SHAPE_CAPSULE]=Or,gs[dr.SHAPE_LINE|dr.SHAPE_SPHERE]=Gr,gs[dr.SHAPE_LINE|dr.SHAPE_AABB]=kr,gs[dr.SHAPE_LINE|dr.SHAPE_OBB]=Vr,gs[dr.SHAPE_LINE|dr.SHAPE_PLANE]=Lr,gs[dr.SHAPE_LINE|dr.SHAPE_TRIANGLE]=Nr,gs[dr.SHAPE_SPHERE]=_s,gs[dr.SHAPE_SPHERE|dr.SHAPE_AABB]=fs,gs[dr.SHAPE_SPHERE|dr.SHAPE_OBB]=ds,gs[dr.SHAPE_SPHERE|dr.SHAPE_PLANE]=us,gs[dr.SHAPE_SPHERE|dr.SHAPE_FRUSTUM]=ls,gs[dr.SHAPE_SPHERE|dr.SHAPE_FRUSTUM_ACCURATE]=cs,gs[dr.SHAPE_SPHERE|dr.SHAPE_CAPSULE]=ps,gs[dr.SHAPE_AABB]=jr,gs[dr.SHAPE_AABB|dr.SHAPE_OBB]=$r,gs[dr.SHAPE_AABB|dr.SHAPE_PLANE]=ts,gs[dr.SHAPE_AABB|dr.SHAPE_FRUSTUM]=es,gs[dr.SHAPE_AABB|dr.SHAPE_FRUSTUM_ACCURATE]=is,gs[dr.SHAPE_OBB]=as,gs[dr.SHAPE_OBB|dr.SHAPE_PLANE]=rs,gs[dr.SHAPE_OBB|dr.SHAPE_FRUSTUM]=ss,gs[dr.SHAPE_OBB|dr.SHAPE_FRUSTUM_ACCURATE]=os,gs[dr.SHAPE_OBB|dr.SHAPE_CAPSULE]=hs,gs[dr.SHAPE_CAPSULE]=ms,ht(pr.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),ut(gs,"intersect",[{name:"line_quad"}]);var ys,vs,Ss,As,Ts,bs,Es,Cs=new mn(0,0,0),xs=new mn(0,0,0),ws=v.mat4(),Ds=v.v4(),Rs=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=dr.SHAPE_PLANE,this.n=new mn(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 mn.copy(t.n,e.n),t.d=e.d,t},t.fromPoints=function(t,e,i,n){return mn.subtract(Cs,i,e),mn.subtract(xs,n,e),mn.normalize(t.n,mn.cross(t.n,Cs,xs)),t.d=mn.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 mn.copy(t.n,e),t.d=mn.dot(e,i),t},t.normalize=function(t,e){var i=e.n.length();return mn.normalize(t.n,e.n),i>0&&(t.d=e.d/i),t},t.prototype.transform=function(t){Vn.invert(ws,t),Vn.transpose(ws,ws),ln.set(Ds,this.n.x,this.n.y,this.n.z,-this.d),ln.transformMat4(Ds,Ds,ws),mn.set(this.n,Ds.x,Ds.y,Ds.z),this.d=-Ds.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}(),Is=function(){function t(t,e,i,n,r,s,o,a,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===o&&(o=0),void 0===a&&(a=1),void 0===h&&(h=0),this._type=dr.SHAPE_TRIANGLE,this.a=new mn(t,e,i),this.b=new mn(n,r,s),this.c=new mn(o,a,h)}return t.create=function(e,i,n,r,s,o,a,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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=1),new t(e,i,n,r,s,o,a,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 mn.copy(t.a,e.a),mn.copy(t.b,e.b),mn.copy(t.c,e.c),t},t.fromPoints=function(t,e,i,n){return mn.copy(t.a,e),mn.copy(t.b,i),mn.copy(t.c,n),t},t.set=function(t,e,i,n,r,s,o,a,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=o,t.c.x=a,t.c.y=h,t.c.z=u,t},n(t,[{key:"type",get:function(){return this._type}}]),t}();St({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 Ms,Ps,Bs={};Ms=Bs,Ps=wx,Object.keys(Ps).forEach((function(t){"function"!=typeof Ps[t]?Ms[t]=Ps[t]:Ms[t]=Ps[t].bind(Ps)})),Bs.wx={},Bs.wx.onKeyDown=null===(ys=wx.onKeyDown)||void 0===ys?void 0:ys.bind(wx),Bs.wx.onKeyUp=null===(vs=wx.onKeyUp)||void 0===vs?void 0:vs.bind(wx),Bs.wx.onMouseDown=null===(Ss=wx.onMouseDown)||void 0===Ss?void 0:Ss.bind(wx),Bs.wx.onMouseMove=null===(As=wx.onMouseMove)||void 0===As?void 0:As.bind(wx),Bs.wx.onMouseUp=null===(Ts=wx.onMouseUp)||void 0===Ts?void 0:Ts.bind(wx),Bs.wx.onWheel=null===(bs=wx.onWheel)||void 0===bs?void 0:bs.bind(wx);var Os,Ls,Ns=wx.getSystemInfoSync();Os=0,Ls=null,Ls=setInterval((function(){var t=wx.getSystemInfoSync();Ns.screenWidth===t.screenWidth&&Ns.screenHeight===t.screenHeight?++Os>=10&&null!==Ls&&(clearInterval(Ls),Ls=null):Os=0,Ns=t}),500),null===(Es=Bs.onWindowResize)||void 0===Es||Es.call(Bs,(function(){Ns=wx.getSystemInfoSync()})),Bs.getSystemInfoSync=function(){return Ns};var Fs=Bs.getSystemInfoSync();Bs.isDevTool="devtools"===Fs.platform,Object.defineProperty(Bs,"isLandscape",{get:function(){var t=wx.getSystemInfoSync();return"string"==typeof t.deviceOrientation?t.deviceOrientation.startsWith("landscape"):t.screenWidth>t.screenHeight}});var ks,Vs,Gs,Us,zs=Ie.LANDSCAPE_RIGHT;if("android"!==Fs.platform.toLocaleLowerCase()&&wx.onDeviceOrientationChange((function(t){"landscape"===t.value?zs=Ie.LANDSCAPE_RIGHT:"landscapeReverse"===t.value&&(zs=Ie.LANDSCAPE_LEFT)})),Object.defineProperty(Bs,"orientation",{get:function(){return Bs.isLandscape?zs:Ie.PORTRAIT}}),Bs.onAccelerometerChange=function(t){Bs.offAccelerometerChange(),ks=function(e){var i=e.x,n=e.y;if(Bs.isLandscape){var r=zs===Ie.LANDSCAPE_RIGHT?1:-1,s=i;i=-n*r,n=s*r}var o={x:i,y:n,z:e.z};t(o)}},Bs.offAccelerometerChange=function(){ks&&(wx.offAccelerometerChange(ks),ks=void 0)},Bs.startAccelerometer=function(t){ks&&wx.onAccelerometerChange(ks),wx.startAccelerometer(t)},Bs.createInnerAudioContext=(Vs=wx,Gs={onPlay:!0,onPause:!0,onStop:!0,onSeek:!1},void 0===(Us=!0)&&(Us=!1),function(){var t=Vs.createInnerAudioContext();if(Gs.onPlay){var e=t.play,i=null;Object.defineProperty(t,"onPlay",{configurable:!0,value:function(t){i=t}}),Object.defineProperty(t,"play",{configurable:!0,value:function(){e.call(t),i&&(Us?setTimeout(i,0):i())}})}if(Gs.onPause){var n=t.pause,r=null;Object.defineProperty(t,"onPause",{configurable:!0,value:function(t){r=t}}),Object.defineProperty(t,"pause",{configurable:!0,value:function(){n.call(t),r&&(Us?setTimeout(r,0):r())}})}if(Gs.onStop){var s=t.stop,o=null;Object.defineProperty(t,"onStop",{configurable:!0,value:function(t){o=t}}),Object.defineProperty(t,"stop",{configurable:!0,value:function(){s.call(t),o&&(Us?setTimeout(o,0):o())}})}if(Gs.onSeek){var a=t.seek,h=null;Object.defineProperty(t,"onSeeked",{configurable:!0,value:function(t){h=t}}),Object.defineProperty(t,"seek",{configurable:!0,value:function(e){a.call(t,e),h&&(Us?setTimeout(h,0):h())}})}return t}),Bs.getSafeArea=function(){return wx.getSystemInfoSync().safeArea},"windows"===Fs.platform&&function(t,e){var i=/\d+\.\d+\.\d+/;if(!i.test(t)||!i.test(e))return $(16356),0;for(var n=t.split(".").map((function(t){return Number.parseInt(t)})),r=e.split(".").map((function(t){return Number.parseInt(t)})),s=0;s<3;++s){var o=n[s],a=r[s];if(o!==a)return o-a}return 0}(Fs.SDKVersion,"2.16.0")<0){var Hs=canvas;if(Hs){var Ws=Hs.getContext("webgl"),js=Ws.useProgram.bind(Ws);Ws.useProgram=function(t){t&&js(t)}}}var Xs=function(){function t(){this._poolHandle=-1,Ys.addContainer(this)}return t.prototype.destroy=function(){Ys.removeContainer(this)},t}(),Ys=new(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,_e(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}()),qs=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?E(r,1):s._elementsPerBatch,s._nextAvail=s._elementsPerBatch-1;for(var o=0;o<s._elementsPerBatch;++o)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&&$(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}(Xs)),Ks=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}(Xs)),Qs=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}(Xs));t("aK",Object.freeze({__proto__:null,Pool:qs,RecyclePool:Ks,CachedArray:Qs}));var Zs=t("b$","__editorExtras__"),Js=[],$s=t("bV",function(){function t(t){void 0===t&&(t=""),this._objFlags=0,this._name=t}t._deferredDestroy=function(){for(var t=Js.length,e=0;e<t;++e){var i=Js[e];1&i._objFlags||i._destroyImmediate()}t===Js.length?Js.length=0:Js.splice(0,t)};var e=t.prototype;return e.destroy=function(){return 1&this._objFlags?($(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,Js.push(this),0))},e._destruct=function(){var t,e=this.constructor;Object.prototype.hasOwnProperty.call(e,"__destruct__")?t=e.__destruct__:(t=function(t,e){var i,n=t instanceof v.Node||t instanceof v.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(Ei._isCCClass(e))for(var o=v.Class.Attr.getClassAttrs(e),a=e.__props__,h=0;h<a.length;h++){var u=""+(i=a[h]);if(u in o){if(n&&"_id"===i)continue;switch(typeof o[u]){case"string":s[i]="";break;case"object":case"function":s[i]=null;break;case"undefined":s[i]=void 0}}}return function(t){for(var e in s)t[e]=s[e]}}(this,e),It(e,"__destruct__",t,!0)),t(this)},e._destroyImmediate=function(){var t;1&this._objFlags?et(5e3):(null===(t=this._onPreDestroy)||void 0===t||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 this._objFlags&t.Flags.AllHideMasks},set:function(e){var i=e&t.Flags.AllHideMasks;this._objFlags=this._objFlags&~t.Flags.AllHideMasks|i}},{key:"isValid",get:function(){return!(1&this._objFlags)}}]),t}());function to(t){return t instanceof $s}function eo(t,e){return"object"==typeof t?!(!t||t._objFlags&(e?5:1)):void 0!==t}$s.prototype._deserialize=null,Ei.fastDefine("cc.Object",$s,{_name:"",_objFlags:0}),It($s,"Flags",{Destroyed:1,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,AllHideMasks:1560,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20}),v.isValid=eo,v.Object=$s;var io=_e;function no(){}var ro=function(){function t(){this.callback=no,this.target=void 0,this.once=!1}var e=t.prototype;return e.set=function(t,e,i){this.callback=t||no,this.target=e,this.once=!!i},e.reset=function(){this.target=void 0,this.callback=no,this.once=!1},e.check=function(){return!(to(this.target)&&!eo(this.target,!0))},t}(),so=new qs((function(){return new ro}),32),oo=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(),so.free(i),io(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(),so.free(i),io(this.callbackInfos,e),--e)}},e.cancel=function(t){var e=this.callbackInfos[t];e&&(e.reset(),this.isInvoking?this.callbackInfos[t]=null:io(this.callbackInfos,t),so.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(),so.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]||io(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),ao=new qs((function(){return new oo}),16),ho=t("d2",function(){function t(){this._callbackTable=Ot(!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]=ao.alloc());var s=so.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 o=0;o<r.length;++o){var a=r[o];if(a&&a.check()&&a.callback===e&&a.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(),ao.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,o=0;o<s.length;++o){var a=s[o];a&&a.target===t&&r.cancel(o)}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 o=0;o<s.length;++o){var a=s[o];if(a&&a.callback===e&&a.target===i){r.cancel(o);break}}else this.removeAll(t)}null===(n=this._offCallback)||void 0===n||n.call(this)},e.emit=function(t,e,i,n,r,s){var o=this._callbackTable&&this._callbackTable[t];if(o){var a=!o.isInvoking;o.isInvoking=!0;for(var h=o.callbackInfos,u=0,l=h.length;u<l;++u){var c=h[u];if(c){var _=c.callback,f=c.target;c.once&&this.off(t,_,f),c.check()?f?_.call(f,e,i,n,r,s):_(e,i,n,r,s):this.off(t,_,f)}}a&&(o.isInvoking=!1,o.containCanceled&&o.purgeCanceled())}},e.clear=function(){for(var t in this._callbackTable){var e=this._callbackTable[t];e&&(e.clear(),ao.free(e),delete this._callbackTable[t])}},e._registerOffCallback=function(t){this._offCallback=t},t}());function uo(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=Ot(!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=ho.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var o=n[r];if(!(o in e.prototype)){var a=Object.getOwnPropertyDescriptor(i,o);a&&Object.defineProperty(e.prototype,o,a)}}return e}var lo=t("c4",uo((function(){})));v.EventTarget=lo;var co,_o,fo,po,mo,go,yo,vo=t("c6",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){de(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"}(co||(co={})),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"}(_o||(_o={})),function(t){t[t.NONE=0]="NONE",t[t.LAN=1]="LAN",t[t.WWAN=2]="WWAN"}(fo||(fo={})),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"}(po||(po={})),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.BAIDU_MINI_GAME="BAIDU_MINI_GAME",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.COCOSPLAY="COCOSPLAY",t.LINKSURE_MINI_GAME="LINKSURE_MINI_GAME",t.QTT_MINI_GAME="QTT_MINI_GAME"}(mo||(mo={})),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"}(go||(go={})),yo=mo.WECHAT_GAME;var So=new(function(t){function e(){var e,i;(i=t.call(this)||this)._initPromise=[];var n,r=Bs.getSystemInfoSync();switch(i.networkType=fo.LAN,i.isNative=!1,i.isBrowser=!1,i.isLittleEndian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),i.nativeLanguage=r.language,i.language=r.language.substr(0,2),r.platform.toLocaleLowerCase()){case"android":i.os=po.ANDROID;break;case"ios":i.os=po.IOS;break;case"windows":i.os=po.WINDOWS;break;case"mac":i.os=po.OSX;break;default:i.os=po.UNKNOWN}var s=r.system.toLowerCase();"android p"===s&&(s="android p 9.0");var o=/[\d.]+/.exec(s);i.osVersion=o?o[0]:s,i.osMainVersion=parseInt(i.osVersion),i.platform=yo,i.isMobile=i.os===po.ANDROID||i.os===po.IOS,i.browserType=co.UNKNOWN,i.browserVersion="",i.isXR=!1;var a=i.os===po.WINDOWS&&!Bs.isDevTool;return i._featureMap=((e={})[go.WEBP]=!1,e[go.IMAGE_BITMAP]=!1,e[go.WEB_VIEW]=!1,e[go.VIDEO_PLAYER]=!0,e[go.SAFE_AREA]=!0,e[go.HPE]=!1,e[go.INPUT_TOUCH]=!a,e[go.EVENT_KEYBOARD]=a,e[go.EVENT_MOUSE]=a,e[go.EVENT_TOUCH]=!0,e[go.EVENT_ACCELEROMETER]=!a,e[go.EVENT_GAMEPAD]=!1,e[go.EVENT_HANDLE]=i.isXR,e[go.EVENT_HMD]=i.isXR,e[go.EVENT_HANDHELD]=!1,e[go.WASM]=!0,e),i._initPromise.push(i._supportsWebpPromise()),i._registerEvent(),i}s(e,t);var i=e.prototype;return i._supportsWebpPromise=function(){var t=this;return this._supportsWebp().then((function(e){t._setFeature(go.WEBP,e)}))},i._supportsWebp=function(){var t=this;return new Promise((function(e){if(t.os!==po.ANDROID)try{var i=document.createElement("img"),n=setTimeout((function(){e(!1)}),500);i.onload=function(){clearTimeout(n);var t=i.width>0&&i.height>0;e(t)},i.onerror=function(){clearTimeout(n),e(!1)},i.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"}catch(t){e(!1)}else e(!1)}))},i._registerEvent=function(){var t=this;Bs.onHide((function(){t.emit("hide")})),Bs.onShow((function(){t.emit("show")}))},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 Bs.getBatteryInfoSync().level/100},i.triggerGC=function(){var t;null===(t=Bs.triggerGC)||void 0===t||t.call(Bs)},i.openURL=function(){},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.exit=function(){var t;null===(t=Bs.exitMiniProgram)||void 0===t||t.call(Bs)},i.close=function(){this.exit()},e}(lo)),Ao=/(\.[^\.\/\?\\]*)(\?.*)?$/,To=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,bo=/[^\.\/]+\/\.\.\//;function Eo(){for(var t="",e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];for(var r=0,s=i;r<s.length;r++){var o=s[r];t=(t+(""===t?"":"/")+o).replace(/(\/|\\\\)$/,"")}return t}function Co(t){var e=Ao.exec(t);return e?e[1]:""}function xo(t){if(t){var e=t.lastIndexOf(".");if(-1!==e)return t.substring(0,e)}return t}function wo(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 Do(t){var e=To.exec(t);return e?e[2]:""}function Ro(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 Io(t,e,i){if(0===e.indexOf("."))return Ro(t,e);var n=t.indexOf("?"),r="",s=i?Co(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 Mo(t){var e=t=String(t);do{e=t,t=t.replace(bo,"")}while(e.length!==t.length);return t}function Po(t){return t.replace(/[\/\\]$/,"")}function Bo(){return So.os===po.WINDOWS?"\\":"/"}t("bH",Object.freeze({__proto__:null,join:Eo,extname:Co,mainFileName:xo,basename:wo,dirname:Do,changeExtname:Ro,changeBasename:Io,_normalize:Mo,stripSep:Po,getSeperator:Bo}));var Oo=new mn;function Lo(t,e,i,n){n||(n=new mn),t.convertToUINode(e,i,n);var r=i.position;return n.add(r),n}function No(t,e,i){return i||(i=new mn),t.worldToScreen(e,i),i.x/=v.view.getScaleX(),i.y/=v.view.getScaleY(),i}var Fo=t("bR",{WorldNode3DToLocalNodeUI:Lo,WorldNode3DToWorldNodeUI:No});v.pipelineUtils=Fo,ht(v.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]||Oo;return n.convertToUINode(e[1],e[2],r),r.add(e[2].position),e[3]||r.clone()}}]);var ko=new(function(t){function e(){var e,i;return(i=t.call(this)||this).isFrameRotated=!1,i.handleResizeEvent=!0,i._cbToUpdateFrameBuffer=void 0,i._resolutionScale=1,i._isProportionalToFrame=!1,null===(e=Bs.onWindowResize)||void 0===e||e.call(Bs,(function(){i.emit("window-resize",i.windowSize.width,i.windowSize.height)})),i}s(e,t);var i=e.prototype;return i.init=function(t,e){this._cbToUpdateFrameBuffer=e,this._cbToUpdateFrameBuffer()},i.requestFullScreen=function(){return Promise.reject(new Error("request fullscreen is not supported on this platform."))},i.exitFullScreen=function(){return Promise.reject(new Error("exit fullscreen is not supported on this platform."))},n(e,[{key:"supportFullScreen",get:function(){return!1}},{key:"isFullScreen",get:function(){return!1}},{key:"devicePixelRatio",get:function(){return Bs.getSystemInfoSync().pixelRatio}},{key:"windowSize",get:function(){var t=Bs.getSystemInfoSync(),e=this.devicePixelRatio,i=t.windowWidth,n=t.windowHeight;return new Kn(i*e,n*e)},set:function(){$(1221)}},{key:"resolution",get:function(){var t=this.windowSize,e=this.resolutionScale;return new Kn(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)||void 0===e||e.call(this))}},{key:"orientation",get:function(){return Bs.orientation},set:function(){$(1221)}},{key:"safeAreaEdge",get:function(){var t=Bs.getSafeArea(),e=this.windowSize,i=this.devicePixelRatio;return{top:t.top*i,bottom:e.height-t.bottom*i,left:t.left*i,right:e.width-t.right*i}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(){}}]),e}(lo)),Vo=function(){function t(){}var e=t.prototype;return e.init=function(){var t,e,i=null===(t=Me.querySettings(Re.Category.SCREEN,"exactFitScreen"))||void 0===t||t,n=null!==(e=Me.querySettings(Re.Category.SCREEN,"orientation"))&&void 0!==e?e:"auto",r=3===Me.querySettings(Re.Category.RENDERING,"renderMode");ko.init({exactFitScreen:i,configOrientation:n,isHeadlessMode:r},(function(){var t,e=v.director;null!==(t=e.root)&&void 0!==t&&t.pipeline?e.root.pipeline.shadingScale=ko.resolutionScale:$(1220)}))},e.fullScreen=function(){return ko.isFullScreen},e.requestFullScreen=function(t,e,i){return arguments.length>0&&$(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),ko.requestFullScreen().then((function(){null==e||e.call(document)})).catch((function(t){z(t),null==i||i.call(document)}))},e.exitFullScreen=function(){return ko.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(t){U(t)}))},e.disableAutoFullScreen=function(){},e.on=function(t,e,i){ko.on(t,e,i)},e.once=function(t,e,i){ko.once(t,e,i)},e.off=function(t,e,i){ko.off(t,e,i)},n(t,[{key:"devicePixelRatio",get:function(){return ko.devicePixelRatio}},{key:"windowSize",get:function(){return ko.windowSize},set:function(t){ko.windowSize=t}},{key:"resolution",get:function(){return ko.resolution}},{key:"supportsFullScreen",get:function(){return ko.supportFullScreen}}]),t}(),Go=t("cl",new Vo);v.screen=Go;var Uo=t("cm",{Feature:go,hasFeature:function(t){return So.hasFeature(t)},NetworkType:fo,Language:_o,OS:po,Platform:mo,BrowserType:co,isNative:So.isNative,isBrowser:So.isBrowser,isMobile:So.isMobile,isLittleEndian:So.isLittleEndian,platform:So.platform,language:So.language,languageCode:So.nativeLanguage,os:So.os,osVersion:So.osVersion,osMainVersion:So.osMainVersion,browserType:So.browserType,browserVersion:So.browserVersion,isXR:So.isXR,windowPixelResolution:Go.windowSize,capabilities:{canvas:!0,opengl:!0,webp:So.hasFeature(go.WEBP),imageBitmap:So.hasFeature(go.IMAGE_BITMAP),touches:So.hasFeature(go.INPUT_TOUCH),mouse:So.hasFeature(go.EVENT_MOUSE),keyboard:So.hasFeature(go.EVENT_KEYBOARD),accelerometer:So.hasFeature(go.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return So.networkType},getBatteryLevel:function(){return So.getBatteryLevel()},garbageCollect:function(){So.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: "+Uo.hasFeature(go.WEBP)+"\r\n",t+="supports bitmap: "+Uo.hasFeature(go.IMAGE_BITMAP)+"\r\n",t+="supports touches: "+Uo.hasFeature(go.INPUT_TOUCH)+"\r\n",t+="supports mouse: "+Uo.hasFeature(go.EVENT_MOUSE)+"\r\n",t+="supports keyboard: "+Uo.hasFeature(go.EVENT_KEYBOARD)+"\r\n",t+="supports accelerometer: "+Uo.hasFeature(go.EVENT_ACCELEROMETER)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",G(t+="Using "+(v.game.renderType===v.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){So.openURL(t)},init:function(){var t=this;return Promise.resolve().then((function(){return So.init()})).then((function(){try{var e=Uo.localStorage=window.localStorage;e.setItem("storage",""),e.removeItem("storage"),e=null}catch(e){var i=function(){$(5200)};t.localStorage={getItem:i,setItem:i,clear:i,removeItem:i,key:i,length:0}}var n;t.__isWebIOS14OrIPadOS14Env=(Uo.os===po.IOS||Uo.os===po.OSX)&&(null===(n=GameGlobal)||void 0===n?void 0:n.isIOSHighPerformanceMode)&&/(OS 1((4\.[0-9])|(5\.[0-3])))|(Version\/1((4\.[0-9])|(5\.[0-3])))/.test(window.navigator.userAgent)}))},now:function(){return So.now()},restartVM:function(){So.restartJSVM()},getSafeAreaRect:function(t){void 0===t&&(t=!0);var e=v.view,i=ko.safeAreaEdge;t&&(ko.orientation===Pe.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=ko.windowSize,r=new jn(i.left,i.bottom),s=new jn(n.width-i.right,n.height-i.top);e._convertToUISpace(r),e._convertToUISpace(s);var o=r.x,a=r.y,h=s.x-r.x,u=s.y-r.y;return new Zn(o,a,h,u)}});v.sys=Uo,lt(v,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),lt(Uo,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),ht(Uo,"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:Uo.Language,targetName:"sys.Language"}}))),ht(Uo,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(t){return{name:"OS_"+t,newName:t,target:Uo.OS,targetName:"sys.OS"}}))),ht(Uo,"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:Uo.BrowserType,targetName:"sys.BrowserType"}}))),ht(Uo,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Uo.BrowserType,targetName:"sys.BrowserType"}]),ht(Uo,"sys",["UNKNOWN","EDITOR_PAGE","EDITOR_CORE","MOBILE_BROWSER","DESKTOP_BROWSER","WIN32","MACOS","IOS","ANDROID","OHOS","WECHAT_GAME","BAIDU_MINI_GAME","XIAOMI_QUICK_GAME","ALIPAY_MINI_GAME","BYTEDANCE_MINI_GAME","OPPO_MINI_GAME","VIVO_MINI_GAME","HUAWEI_QUICK_GAME","COCOSPLAY","LINKSURE_MINI_GAME","QTT_MINI_GAME"].map((function(t){return{name:t,target:Uo.Platform,targetName:"sys.Platform"}}))),ht(Uo,"sys",[{name:"IPHONE",newName:"IOS",target:Uo.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Uo.Platform,targetName:"sys.Platform"}]),ut(Uo,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(t){return{name:t}}))),ht(Uo,"sys",[{name:"windowPixelResolution",target:Go,targetName:"screen",newName:"windowSize"}]),lt(Go,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var zo=t("co",{topLeft:v.v2(0,0),topRight:v.v2(0,0),top:v.v2(0,0),bottomLeft:v.v2(0,0),bottomRight:v.v2(0,0),bottom:v.v2(0,0),center:v.v2(0,0),left:v.v2(0,0),right:v.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,o=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=o,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=o,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=o,this.right.y=r+i/2}});v.visibleRect=zo;var Ho=new mn,Wo=new mn,jo=new mn,Xo=new mn,Yo=new xn,qo=function(t,e,i){Yo.m00=Math.abs(i.m00),Yo.m01=Math.abs(i.m01),Yo.m02=Math.abs(i.m02),Yo.m03=Math.abs(i.m04),Yo.m04=Math.abs(i.m05),Yo.m05=Math.abs(i.m06),Yo.m06=Math.abs(i.m08),Yo.m07=Math.abs(i.m09),Yo.m08=Math.abs(i.m10),mn.transformMat3(t,e,Yo)},Ko=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=dr.SHAPE_AABB,this.center=new mn(t,e,i),this.halfExtents=new mn(n,r,s)}t.create=function(e,i,n,r,s,o){return new t(e,i,n,r,s,o)},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 mn.copy(t.center,e.center),mn.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return mn.add(Ho,i,e),mn.subtract(Wo,i,e),mn.multiplyScalar(t.center,Ho,.5),mn.multiplyScalar(t.halfExtents,Wo,.5),t},t.set=function(t,e,i,n,r,s,o){return t.center.set(e,i,n),t.halfExtents.set(r,s,o),t},t.merge=function(e,i,n){return mn.subtract(Ho,i.center,i.halfExtents),mn.subtract(Wo,n.center,n.halfExtents),mn.add(jo,i.center,i.halfExtents),mn.add(Xo,n.center,n.halfExtents),mn.max(Xo,jo,Xo),mn.min(jo,Ho,Wo),t.fromPoints(e,jo,Xo)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return mn.transformMat4(t.center,e.center,i),qo(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){mn.subtract(t,this.center,this.halfExtents),mn.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){mn.transformMat4(r.center,this.center,t),qo(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 mn.copy(this.center,t.center),mn.copy(this.halfExtents,t.halfExtents),this},e.mergePoint=function(t){this.getBoundary(Ho,Wo),t.x<Ho.x&&(Ho.x=t.x),t.y<Ho.y&&(Ho.y=t.y),t.z<Ho.z&&(Ho.z=t.z),t.x>Wo.x&&(Wo.x=t.x),t.y>Wo.y&&(Wo.y=t.y),t.z>Wo.z&&(Wo.z=t.z),mn.add(jo,Ho,Wo),this.center.set(mn.multiplyScalar(jo,jo,.5)),this.halfExtents.set(Wo.x-jo.x,Wo.y-jo.y,Wo.z-jo.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}(),Qo=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=dr.SHAPE_CAPSULE,this.radius=t,this.halfHeight=e,this.axis=i,this.center=new mn,this.rotation=new In,this.ellipseCenter0=new mn(0,e,0),this.ellipseCenter1=new mn(0,-e,0),this.updateCache()}var e=t.prototype;return e.transform=function(t,e,i,n,r){var s=n,o=Ji(s);r.radius=this.radius*Math.abs(o);var a=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;a<0&&(a=0),r.halfHeight=a,mn.transformMat4(r.center,this.center,t),In.multiply(r.rotation,this.rotation,i),r.updateCache()},e.updateCache=function(){this.updateLocalCenter(),mn.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),mn.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}(),Zo=new Array(8);Zo[0]=new mn(1,1,1),Zo[1]=new mn(-1,1,1),Zo[2]=new mn(-1,-1,1),Zo[3]=new mn(1,-1,1),Zo[4]=new mn(1,1,-1),Zo[5]=new mn(-1,1,-1),Zo[6]=new mn(-1,-1,-1),Zo[7]=new mn(1,-1,-1);var Jo,$o=new mn,ta=new mn,ea=new mn,ia=function(){e.createOrthographic=function(t,e,i,n,r,s){var o=e/2,a=i/2;mn.set(ea,o,a,-n),mn.transformMat4(t.vertices[0],ea,s),mn.set(ea,-o,a,-n),mn.transformMat4(t.vertices[1],ea,s),mn.set(ea,-o,-a,-n),mn.transformMat4(t.vertices[2],ea,s),mn.set(ea,o,-a,-n),mn.transformMat4(t.vertices[3],ea,s),mn.set(ea,o,a,-r),mn.transformMat4(t.vertices[4],ea,s),mn.set(ea,-o,a,-r),mn.transformMat4(t.vertices[5],ea,s),mn.set(ea,-o,-a,-r),mn.transformMat4(t.vertices[6],ea,s),mn.set(ea,o,-a,-r),mn.transformMat4(t.vertices[7],ea,s),t.updatePlanes()},e.createOrtho=function(t,i,n,r,s,o){return e.createOrthographic(t,i,n,r,s,o)},e.createPerspective=function(t,e,i,n,r,s){var o=Math.tan(.5*i),a=o*e;$o.set(n*a,n*o,n),ta.set(r*a,r*o,r);var h=t.vertices;ea.set($o.x,$o.y,-$o.z),mn.transformMat4(h[0],ea,s),ea.set(-$o.x,$o.y,-$o.z),mn.transformMat4(h[1],ea,s),ea.set(-$o.x,-$o.y,-$o.z),mn.transformMat4(h[2],ea,s),ea.set($o.x,-$o.y,-$o.z),mn.transformMat4(h[3],ea,s),ea.set(ta.x,ta.y,-ta.z),mn.transformMat4(h[4],ea,s),ea.set(-ta.x,ta.y,-ta.z),mn.transformMat4(h[5],ea,s),ea.set(-ta.x,-ta.y,-ta.z),mn.transformMat4(h[6],ea,s),ea.set(ta.x,-ta.y,-ta.z),mn.transformMat4(h[7],ea,s),t.updatePlanes()},e.createFromAABB=function(t,e){var i=new mn,n=new mn;return mn.subtract(i,e.center,e.halfExtents),mn.add(n,e.center,e.halfExtents),t.vertices[0].set(n.x,n.y,-i.z),t.vertices[1].set(i.x,n.y,-i.z),t.vertices[2].set(i.x,i.y,-i.z),t.vertices[3].set(n.x,i.y,-i.z),t.vertices[4].set(n.x,n.y,-n.z),t.vertices[5].set(i.x,n.y,-n.z),t.vertices[6].set(i.x,i.y,-n.z),t.vertices[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=dr.SHAPE_FRUSTUM,this.planes=new Array(6);for(var t=0;t<6;++t)this.planes[t]=Rs.create(0,0,0,0);this.vertices=new Array(8);for(var e=0;e<8;++e)this.vertices[e]=new mn}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)Rs.copy(t.planes[i],e.planes[i]);for(var n=0;n<8;++n)mn.copy(t.vertices[n],e.vertices[n]);return t},t.update=function(t,e){mn.set(this.planes[0].n,t.m03+t.m00,t.m07+t.m04,t.m11+t.m08),this.planes[0].d=-(t.m15+t.m12),mn.set(this.planes[1].n,t.m03-t.m00,t.m07-t.m04,t.m11-t.m08),this.planes[1].d=-(t.m15-t.m12),mn.set(this.planes[2].n,t.m03+t.m01,t.m07+t.m05,t.m11+t.m09),this.planes[2].d=-(t.m15+t.m13),mn.set(this.planes[3].n,t.m03-t.m01,t.m07-t.m05,t.m11-t.m09),this.planes[3].d=-(t.m15-t.m13),mn.set(this.planes[4].n,t.m03+t.m02,t.m07+t.m06,t.m11+t.m10),this.planes[4].d=-(t.m15+t.m14),mn.set(this.planes[5].n,t.m03-t.m02,t.m07-t.m06,t.m11-t.m10),this.planes[5].d=-(t.m15-t.m14);for(var i=0;i<6;i++){var n=this.planes[i],r=1/n.n.length();mn.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)mn.transformMat4(this.vertices[s],Zo[s],e)},t.transform=function(t){for(var e=0;e<8;e++)mn.transformMat4(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++)Rs.set(this.planes[e],0,0,0,0)},t.updatePlanes=function(){Rs.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),Rs.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),Rs.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),Rs.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),Rs.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),Rs.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},n(e,[{key:"accurate",set:function(t){this._type=t?dr.SHAPE_FRUSTUM_ACCURATE:dr.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),e}(),na=new mn,ra=new mn,sa=new xn,oa=function(){function t(t,e,i,n,r,s,o,a,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===o&&(o=1),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=dr.SHAPE_OBB,this.center=new mn(t,e,i),this.halfExtents=new mn(n,r,s),this.orientation=new xn(o,a,h,u,l,c,_,f,d)}t.create=function(e,i,n,r,s,o,a,h,u,l,c,_,f,d,p){return new t(e,i,n,r,s,o,a,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 mn.copy(t.center,e.center),mn.copy(t.halfExtents,e.halfExtents),xn.copy(t.orientation,e.orientation),t},t.fromPoints=function(t,e,i){return mn.multiplyScalar(t.center,mn.add(na,e,i),.5),mn.multiplyScalar(t.halfExtents,mn.subtract(ra,i,e),.5),xn.identity(t.orientation),t},t.set=function(t,e,i,n,r,s,o,a,h,u,l,c,_,f,d,p){return mn.set(t.center,e,i,n),mn.set(t.halfExtents,r,s,o),xn.set(t.orientation,a,h,u,l,c,_,f,d,p),t};var e=t.prototype;return e.getBoundary=function(t,e){!function(t,e,i){sa.m00=Math.abs(i.m00),sa.m01=Math.abs(i.m01),sa.m02=Math.abs(i.m02),sa.m03=Math.abs(i.m03),sa.m04=Math.abs(i.m04),sa.m05=Math.abs(i.m05),sa.m06=Math.abs(i.m06),sa.m07=Math.abs(i.m07),sa.m08=Math.abs(i.m08),mn.transformMat3(t,e,sa)}(na,this.halfExtents,this.orientation),mn.subtract(t,this.center,na),mn.add(e,this.center,na)},e.transform=function(t,e,i,n,r){mn.transformMat4(r.center,this.center,t),xn.fromQuat(r.orientation,i),mn.multiply(r.halfExtents,this.halfExtents,n)},e.translateAndRotate=function(t,e,i){mn.transformMat4(i.center,this.center,t),xn.fromQuat(i.orientation,e)},e.setScale=function(t,e){mn.multiply(e.halfExtents,this.halfExtents,t)},n(t,[{key:"type",get:function(){return this._type}}]),t}();function aa(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 o=t[s];if(o>e+i)r=s-1;else{if(!(o<e-i))return s;n=s+1}}return~n}Jo=Symbol.iterator;var ha,ua,la,ca=function(){function t(){this._times=[],this._values=[]}var e=t.prototype;return e[Jo]=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 aa(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 aa(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,function(t){t.every((function(t,e,i){return 0===e||t>i[e-1]||Li(t,i[e-1],1e-6)}))}(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=aa(i,t);if(s>=0)return s;var o=~s;return 0===o?(i.unshift(t),n.unshift(e)):o===r?(i.push(t),n.push(e)):(i.splice(o-1,0,t),n.splice(o-1,0,e)),o},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 _a(t){return t>-1e-9&&t<1e-9}function fa(t,e,i,n){return i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),n)}Ei.fastDefine("cc.KeyframeCurve",ca,{_times:[],_values:[]}),t("cr",ha),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}(ha||t("cr",ha={})),t("cs",ua),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(ua||t("cs",ua={})),t("ct",la),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(la||t("ct",la={}));var da=function(){},pa=function(){return da},ma=ga((function(){}));function ga(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function ya(t){return function(e){return function(i){!function(t,e,i){var n=Sa(t);if(n){var r=Aa(n,"proto");Aa(r,"editor")[e]=i}}(i,t,e)}}}var va="__ccclassCache__";function Sa(t){return Aa(t,va)}function Aa(t,e){return t[e]||(t[e]={})}var Ta=ga((function(t,e){var i=Yt(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[va];if(r){var s=r.proto;s&&jt(n,s),t[va]=void 0}return Ei(n)})),ba=ya("requireComponent"),Ea=ya("executionOrder"),Ca=ma;function xa(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var o,a=s&&"function"!=typeof s&&(s.get||s.set);r&&(o=ci(r,a));var h=jt(e,o||r||{});a?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):Ra(t,h,i,n,s)}(function(t){return Sa(t.constructor)}(t),function(t,e){var i,n,r=Aa(Sa(t.constructor),"proto"),s=Aa(r,"properties");return null!==(n=s[i=e])&&void 0!==n?n:s[i]={}}(t,e),t.constructor,e,n,i)}return void 0===t?xa({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function wa(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}function Da(t,e,i){var n,r,s=Sa(t.constructor),o=Aa(s,"proto"),a=Aa(o,"properties"),h=null!==(r=a[n=e])&&void 0!==r?r:a[n]={};return h.__internalFlags|=_i.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):Ra(s,h,t.constructor,e,i),h}function Ra(t,e,i,n,r){if(void 0!==r)"function"==typeof r?e.default=wa(r):null===r||r.initializer&&(e.default=wa(r.initializer));else{var s=t.default||(t.default=function(t){var e;try{e=new t}catch(t){return{}}return e}(i));s.hasOwnProperty(n)&&(e.default=s[n])}}var Ia=Symbol("cc:SerializationMetadata"),Ma=t("cT",(function(t,e,i){Oa(Da(t,e,i))}));function Pa(t){return function(e,i,n){var r=Da(e,i,n);r.formerlySerializedAs=t,Oa(r)}}var Ba=function(t,e,i){var n=Da(t,e,i);n.editorOnly=!0,Oa(n)};function Oa(t){t.__internalFlags|=_i.IMPLICIT_SERIALIZABLE}var La=da,Na=ma,Fa=pa,ka=ma,Va=pa,Ga=pa,Ua=pa,za=t("cI",da),Ha=t("cK",pa),Wa=t("cL",pa),ja=t("cJ",pa),Xa=t("cN",pa),Ya=t("cO",pa),qa=t("cP",da),Ka=t("cM",pa),Qa=t("cQ",da),Za=eh(ei),Ja=eh(ii),$a=eh(ni),th=eh(ri);function eh(t){return xa({type:t})}var ih,nh,rh,sh,oh,ah,hh,uh,lh,ch,_h=t("cR",(function(t,e,i){Da(t,e,i).override=!0})),fh=t("c3",(function(){})),dh=Object.freeze({__proto__:null,uniquelyReferenced:La,ccclass:Ta,property:xa,requireComponent:ba,executionOrder:Ea,disallowMultiple:Ca,executeInEditMode:Na,menu:Fa,playOnFocus:ka,inspector:Va,icon:Ga,help:Ua,type:eh,integer:Za,float:Ja,boolean:$a,string:th,editable:za,tooltip:ja,visible:Ha,displayName:Wa,displayOrder:Ka,range:Xa,rangeStep:Ya,slide:qa,disallowAnimation:Qa,override:_h,formerlySerializedAs:Pa,serializable:Ma});function ph(t,e){return(e<<3)+t}function mh(t){return yh[t]}function gh(t){switch(t){case lh.Uint8:return Uint8Array;case lh.Uint16:return Uint16Array;case lh.Uint32:return Uint32Array;case lh.Int8:return Int8Array;case lh.Int16:return Int16Array;case lh.Int32:return Int32Array;case lh.Float32:return Float32Array;case lh.Float64:return Float64Array}}t("bS",dh),function(t){t[t.Uint8=0]="Uint8",t[t.Uint16=1]="Uint16",t[t.Uint32=2]="Uint32",t[t.Int8=3]="Int8",t[t.Int16=4]="Int16",t[t.Int32=5]="Int32",t[t.Float32=6]="Float32",t[t.Float64=7]="Float64"}(lh||(lh={})),function(t){t[t.Scalar=0]="Scalar",t[t.Vec2=1]="Vec2",t[t.Vec3=2]="Vec3",t[t.Vec4=3]="Vec4",t[t.Quat=4]="Quat",t[t.Mat4=5]="Mat4"}(ch||(ch={})),t("b_",Ta("cc.CompactValueTypeArray")(((hh=function(){function t(){this._byteOffset=rh&&rh(),this._unitCount=sh&&sh(),this._unitElement=oh&&oh(),this._length=ah&&ah()}return t.lengthFor=function(t,e,i){return mh(e).requiredUnits*t.length*gh(i).BYTES_PER_ELEMENT},t.compress=function(e,i,n,r,s,o){for(var a=mh(i),h=gh(n),u=a.requiredUnits*e.length,l=new h(r,s,u),c=0;c<e.length;++c)a.compress(l,c,e[c]);var _=new t;return _._unitElement=ph(n,i),_._byteOffset=o,_._unitCount=u,_._length=e.length,_},t.prototype.decompress=function(t){for(var e,i={storageUnit:7&(e=this._unitElement),elementType:e>>3},n=i.storageUnit,r=mh(i.elementType),s=new(gh(n))(t,this._byteOffset,this._unitCount),o=new Array(this._length),a=0;a<this._length;++a)o[a]=r.decompress(s,a);return o},t}()).StorageUnit=lh,hh.ElementType=ch,rh=fa((nh=hh).prototype,"_byteOffset",[Ma],(function(){return 0})),sh=fa(nh.prototype,"_unitCount",[Ma],(function(){return 0})),oh=fa(nh.prototype,"_unitElement",[Ma],(function(){return ph(lh.Uint8,ch.Scalar)})),ah=fa(nh.prototype,"_length",[Ma],(function(){return 0})),ih=nh))||ih);var yh=((uh={})[ch.Scalar]={requiredUnits:1,compress:function(t,e,i){t[e]=i},decompress:function(t,e){return t[e]}},uh[ch.Vec2]={requiredUnits:2,compress:function(t,e,i){t[2*e]=i.x,t[2*e+1]=i.y},decompress:function(t,e){return new mn(t[2*e],t[2*e+1])}},uh[ch.Vec3]={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 mn(t[3*e],t[3*e+1],t[3*e+2])}},uh[ch.Vec4]={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 ln(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},uh[ch.Quat]={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 In(t[4*e],t[4*e+1],t[4*e+2],t[4*e+3])}},uh[ch.Mat4]={requiredUnits:16,compress:function(t,e,i){Vn.toArray(t,i,16*e)},decompress:function(t,e){return Vn.fromArray(new Vn,t,16*e)}},uh),vh=t("c1",Symbol("[[Serialize]]")),Sh=t("c0",Symbol("[[Deserialize]]"));function Ah(){return 0}function Th(t){return t}function bh(t){return t*t}function Eh(t){return t*(2-t)}function Ch(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}function xh(t){return t*t*t}function wh(t){return--t*t*t+1}function Dh(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}function Rh(t){return t*t*t*t}function Ih(t){return 1- --t*t*t*t}function Mh(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}function Ph(t){return t*t*t*t*t}function Bh(t){return--t*t*t*t*t+1}function Oh(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}function Lh(t){return 1===t?1:1-Math.cos(t*Math.PI/2)}function Nh(t){return Math.sin(t*Math.PI/2)}function Fh(t){return.5*(1-Math.cos(Math.PI*t))}function kh(t){return 0===t?0:Math.pow(1024,t-1)}function Vh(t){return 1===t?1:1-Math.pow(2,-10*t)}function Gh(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 Uh(t){return 1-Math.sqrt(1-t*t)}function zh(t){return Math.sqrt(1- --t*t)}function Hh(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}function Wh(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 jh(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 Xh(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 Yh(t){if(1===t)return 1;var e=1.70158;return t*t*((e+1)*t-e)}function qh(t){if(0===t)return 0;var e=1.70158;return--t*t*((e+1)*t+e)+1}function Kh(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 Qh(t){return 1-Zh(1-t)}function Zh(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 Jh(t){return t<.5?.5*Qh(2*t):.5*Zh(2*t-1)+.5}function $h(t){return t<=0?0:t>=1?1:t*t*(3-2*t)}function tu(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}v._decorator=dh;var eu=cu(bh,Eh),iu=cu(xh,wh),nu=cu(Rh,Ih),ru=cu(Ph,Bh),su=cu(Lh,Nh),ou=cu(kh,Vh),au=cu(Uh,zh),hu=cu(Wh,jh),uu=cu(Yh,qh),lu=cu(Qh,Zh);function cu(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var _u,fu,du=Object.freeze({__proto__:null,constant:Ah,linear:Th,quadIn:bh,quadOut:Eh,quadInOut:Ch,cubicIn:xh,cubicOut:wh,cubicInOut:Dh,quartIn:Rh,quartOut:Ih,quartInOut:Mh,quintIn:Ph,quintOut:Bh,quintInOut:Oh,sineIn:Lh,sineOut:Nh,sineInOut:Fh,expoIn:kh,expoOut:Vh,expoInOut:Gh,circIn:Uh,circOut:zh,circInOut:Hh,elasticIn:Wh,elasticOut:jh,elasticInOut:Xh,backIn:Yh,backOut:qh,backInOut:Kh,bounceIn:Qh,bounceOut:Zh,bounceInOut:Jh,smooth:$h,fade:tu,quadOutIn:eu,cubicOutIn:iu,quartOutIn:nu,quintOutIn:ru,sineOutIn:su,expoOutIn:ou,circOutIn:au,elasticOutIn:hu,backOutIn:uu,bounceOutIn:lu});t("cD",du),t("d1",fu),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.QUAD_IN=2]="QUAD_IN",t[t.QUAD_OUT=3]="QUAD_OUT",t[t.QUAD_IN_OUT=4]="QUAD_IN_OUT",t[t.QUAD_OUT_IN=5]="QUAD_OUT_IN",t[t.CUBIC_IN=6]="CUBIC_IN",t[t.CUBIC_OUT=7]="CUBIC_OUT",t[t.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",t[t.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",t[t.QUART_IN=10]="QUART_IN",t[t.QUART_OUT=11]="QUART_OUT",t[t.QUART_IN_OUT=12]="QUART_IN_OUT",t[t.QUART_OUT_IN=13]="QUART_OUT_IN",t[t.QUINT_IN=14]="QUINT_IN",t[t.QUINT_OUT=15]="QUINT_OUT",t[t.QUINT_IN_OUT=16]="QUINT_IN_OUT",t[t.QUINT_OUT_IN=17]="QUINT_OUT_IN",t[t.SINE_IN=18]="SINE_IN",t[t.SINE_OUT=19]="SINE_OUT",t[t.SINE_IN_OUT=20]="SINE_IN_OUT",t[t.SINE_OUT_IN=21]="SINE_OUT_IN",t[t.EXPO_IN=22]="EXPO_IN",t[t.EXPO_OUT=23]="EXPO_OUT",t[t.EXPO_IN_OUT=24]="EXPO_IN_OUT",t[t.EXPO_OUT_IN=25]="EXPO_OUT_IN",t[t.CIRC_IN=26]="CIRC_IN",t[t.CIRC_OUT=27]="CIRC_OUT",t[t.CIRC_IN_OUT=28]="CIRC_IN_OUT",t[t.CIRC_OUT_IN=29]="CIRC_OUT_IN",t[t.ELASTIC_IN=30]="ELASTIC_IN",t[t.ELASTIC_OUT=31]="ELASTIC_OUT",t[t.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",t[t.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",t[t.BACK_IN=34]="BACK_IN",t[t.BACK_OUT=35]="BACK_OUT",t[t.BACK_IN_OUT=36]="BACK_IN_OUT",t[t.BACK_OUT_IN=37]="BACK_OUT_IN",t[t.BOUNCE_IN=38]="BOUNCE_IN",t[t.BOUNCE_OUT=39]="BOUNCE_OUT",t[t.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",t[t.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",t[t.SMOOTH=42]="SMOOTH",t[t.FADE=43]="FADE"}(fu||t("d1",fu={}));var pu,mu=((_u={})[fu.CONSTANT]=Ah,_u[fu.LINEAR]=Th,_u[fu.QUAD_IN]=bh,_u[fu.QUAD_OUT]=Eh,_u[fu.QUAD_IN_OUT]=Ch,_u[fu.QUAD_OUT_IN]=eu,_u[fu.CUBIC_IN]=xh,_u[fu.CUBIC_OUT]=wh,_u[fu.CUBIC_IN_OUT]=Dh,_u[fu.CUBIC_OUT_IN]=iu,_u[fu.QUART_IN]=Rh,_u[fu.QUART_OUT]=Ih,_u[fu.QUART_IN_OUT]=Mh,_u[fu.QUART_OUT_IN]=nu,_u[fu.QUINT_IN]=Ph,_u[fu.QUINT_OUT]=Bh,_u[fu.QUINT_IN_OUT]=Oh,_u[fu.QUINT_OUT_IN]=ru,_u[fu.SINE_IN]=Lh,_u[fu.SINE_OUT]=Nh,_u[fu.SINE_IN_OUT]=Fh,_u[fu.SINE_OUT_IN]=su,_u[fu.EXPO_IN]=kh,_u[fu.EXPO_OUT]=Vh,_u[fu.EXPO_IN_OUT]=Gh,_u[fu.EXPO_OUT_IN]=ou,_u[fu.CIRC_IN]=Uh,_u[fu.CIRC_OUT]=zh,_u[fu.CIRC_IN_OUT]=Hh,_u[fu.CIRC_OUT_IN]=au,_u[fu.ELASTIC_IN]=Wh,_u[fu.ELASTIC_OUT]=jh,_u[fu.ELASTIC_IN_OUT]=Xh,_u[fu.ELASTIC_OUT_IN]=hu,_u[fu.BACK_IN]=Yh,_u[fu.BACK_OUT]=qh,_u[fu.BACK_IN_OUT]=Kh,_u[fu.BACK_OUT_IN]=uu,_u[fu.BOUNCE_IN]=Qh,_u[fu.BOUNCE_OUT]=Zh,_u[fu.BOUNCE_IN_OUT]=Jh,_u[fu.BOUNCE_OUT_IN]=lu,_u[fu.SMOOTH]=$h,_u[fu.FADE]=tu,_u);function gu(t){return mu[t]}x(255),x(65280);var yu,vu,Su,Au=ha.LINEAR<<0|la.NONE<<8|fu.LINEAR<<16,Tu=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=Au,e}return s(e,t),n(e,[{key:"interpolationMode",get:function(){return(255&this._flags)>>0},set:function(t){this._flags&=-256,this._flags|=t<<0}},{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}(fh);function bu(t){var e=new Tu;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,o=t.rightTangentWeight,a=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,l=t[Zs];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=o?o:e.rightTangentWeight,e.leftTangent=null!=a?a: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[Zs]=l)}return e}Ei.fastDefine("cc.RealKeyframeValue",Tu,((pu={interpolationMode:ha.LINEAR,tangentWeightMode:la.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:fu.LINEAR})[Zs]=void 0,pu)),Ei.Attr.setClassAttr(Tu,Zs,"editorOnly",!0),(yu=Tu,null!==(Su=(vu=yu)[Ia])&&void 0!==Su?Su:vu[Ia]={}).uniquelyReferenced=!0;var Eu,Cu=t("cq",function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=ua.CLAMP,e.postExtrapolation=ua.CLAMP,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 o=this.preExtrapolation,a=i[0];if(o===ua.CLAMP||n<2)return a.value;switch(o){case ua.LINEAR:return Uu(r,i[0].value,e[1],i[1].value,t);case ua.LOOP:t=Vu(t,r,s);break;case ua.PING_PONG:t=Gu(t,r,s);break;default:return a.value}}else if(t>s){var h=this.postExtrapolation,u=i[n-1];if(h===ua.CLAMP||n<2)return u.value;switch(h){case ua.LINEAR:return Uu(s,u.value,e[n-2],i[n-2].value,t);case ua.LOOP:t=Vu(t,r,s);break;case ua.PING_PONG:t=Gu(t,r,s);break;default:return u.value}}var l=aa(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,f=e[_],d=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case ha.CONSTANT:return e.value;case ha.LINEAR:var o=e.easingMethod===fu.LINEAR?r:gu(e.easingMethod)(r);return ki(e.value,n.value,o);case ha.CUBIC:var a=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=0!=(e.tangentWeightMode&la.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&la.LEFT);if(l||f){var d=0;if(l)d=u;else{var p=s,m=s*h;d=Math.sqrt(p*p+m*m)*a}var g=Math.atan(h),y=Math.cos(g)*d+t,v=Math.sin(g)*d+e.value,S=0;if(f)S=_;else{var A=s,T=s*c;S=Math.sqrt(A*A+T*T)*a}var b=Math.atan(c),E=(y-t)/s,C=(-Math.cos(b)*S+i-t)/s,x=v,w=-Math.sin(b)*S+n.value,D=[0,0,0],R=function(t,e,i,n,r){var s=i/n,o=e/n,a=s*s,h=1/3*(-1/3*a+o),u=.5*(2/27*s*a-1/3*s*o+t/n),l=h*h*h,c=u*u+l,_=0;if(_a(c)){if(_a(u))return r[0]=0,1;var f=Math.cbrt(-u);return r[0]=2*f,r[1]=-f,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),_=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),y=-Math.cbrt(m+u);r[0]=g+y,_=1}for(var v=1/3*s,S=0;S<_;++S)r[S]-=v;return _}(0-r,3*E,3*C-6*E,3*(E-C)+1,D),I=function(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}(D,R,r);return zu(e.value,x,w,n.value,I)}var M=e.value+a*h*s,P=n.value-a*c*s;return zu(e.value,M,P,n.value,r)}}(f,d,p,i[c],(t-f)/(p-f))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,bu(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return bu(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return bu(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 Li(i.value,e,t)}))},i[vh]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+xu+xu+wu+Du*r+Nu*r)),o=0;s.setUint8(o,this.preExtrapolation),o+=xu,s.setUint8(o,this.postExtrapolation),o+=xu,s.setUint32(o,r,!0),o+=wu,i.forEach((function(t,e){return s.setFloat32(o+Du*e,t,!0)})),o+=Du*r;for(var a,h=f(n);!(a=h()).done;){var u=a.value;o=Fu(s,u,o)}var l=new Uint8Array(s.buffer,0,o);t.writeProperty("bytes",l);var c=n.map((function(t){return t[Zs]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Sh]=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+=xu,this.postExtrapolation=n.getUint8(r),r+=xu;var s=n.getUint32(r,!0);r+=wu;var o=Array.from({length:s},(function(t,e){return n.getFloat32(r+Du*e,!0)}));r+=Du*s;for(var a=new Array(s),h=0;h<s;++h){var u=bu({});r=ku(n,u,r),a[h]=u}i.byteLength;var l=t.readProperty("keyframeValueEditorExtras");l&&(l.length,l.forEach((function(t,e){return a[e][Zs]=t}))),this._times=o,this._values=a}else t.readThis()},e}(ca));Ei.fastDefine("cc.RealCurve",Cu,{_times:[],_values:[],preExtrapolation:ua.CLAMP,postExtrapolation:ua.CLAMP}),function(t){t[t.VALUE=1]="VALUE",t[t.INTERPOLATION_MODE=2]="INTERPOLATION_MODE",t[t.TANGENT_WEIGHT_MODE=4]="TANGENT_WEIGHT_MODE",t[t.LEFT_TANGENT=8]="LEFT_TANGENT",t[t.LEFT_TANGENT_WEIGHT=16]="LEFT_TANGENT_WEIGHT",t[t.RIGHT_TANGENT=32]="RIGHT_TANGENT",t[t.RIGHT_TANGENT_WEIGHT=64]="RIGHT_TANGENT_WEIGHT"}(Eu||(Eu={}));var xu=1,wu=4,Du=4,Ru=bu({}),Iu=Ru.interpolationMode,Mu=Ru.tangentWeightMode,Pu=Ru.leftTangent,Bu=Ru.leftTangentWeight,Ou=Ru.rightTangent,Lu=Ru.rightTangentWeight,Nu=26;function Fu(t,e,i){var n=0,r=i,s=r;r+=4;var o=e.value,a=e.interpolationMode,h=e.tangentWeightMode,u=e.rightTangent,l=e.rightTangentWeight,c=e.leftTangent,_=e.leftTangentWeight,f=e.easingMethod;return t.setFloat32(r,o,!0),r+=4,a!==Iu&&(n|=Eu.INTERPOLATION_MODE,t.setUint8(r,a),r+=1),h!==Mu&&(n|=Eu.TANGENT_WEIGHT_MODE,t.setUint8(r,h),r+=1),c!==Pu&&(n|=Eu.LEFT_TANGENT,t.setFloat32(r,c,!0),r+=4),_!==Bu&&(n|=Eu.LEFT_TANGENT_WEIGHT,t.setFloat32(r,_,!0),r+=4),u!==Ou&&(n|=Eu.RIGHT_TANGENT,t.setFloat32(r,u,!0),r+=4),l!==Lu&&(n|=Eu.RIGHT_TANGENT_WEIGHT,t.setFloat32(r,l,!0),r+=4),n|=f<<8,t.setUint32(s,n,!0),r}function ku(t,e,i){var n=i,r=t.getUint32(n,!0);n+=4,e.value=t.getFloat32(n,!0),n+=4,r&Eu.INTERPOLATION_MODE&&(e.interpolationMode=t.getUint8(n),n+=1),r&Eu.TANGENT_WEIGHT_MODE&&(e.tangentWeightMode=t.getUint8(n),n+=1),r&Eu.LEFT_TANGENT&&(e.leftTangent=t.getFloat32(n,!0),n+=4),r&Eu.LEFT_TANGENT_WEIGHT&&(e.leftTangentWeight=t.getFloat32(n,!0),n+=4),r&Eu.RIGHT_TANGENT&&(e.rightTangent=t.getFloat32(n,!0),n+=4),r&Eu.RIGHT_TANGENT_WEIGHT&&(e.rightTangentWeight=t.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return e.easingMethod=s,n}function Vu(t,e,i){return e+Ki(t-e,i-e)}function Gu(t,e,i){return e+Qi(t-e,i-e)}function Uu(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function zu(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 Hu(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}v.bezier=Hu;var Wu,ju,Xu,Yu,qu,Ku,Qu,Zu,Ju,$u,tl=Math.cos,el=Math.acos,il=Math.max,nl=2*Math.PI,rl=Math.sqrt;function sl(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function ol(t,e){var i=function(t,e){var i,n,r,s,o=e-0,a=e-t[0],h=3*o,u=3*a,l=3*(e-t[2]),c=1/(-o+u-l+(e-1)),_=1/3,f=(h-6*a+l)*c,d=f*_,p=(-h+u)*c,m=(3*p-f*f)*_,g=m*_,y=(2*f*f*f-9*f*p+o*c*27)/27,v=y/2,S=v*v+g*g*g;if(S<0){var A=-m*_,T=rl(A*A*A),b=-y/(2*T),E=el(b<-1?-1:b>1?1:b),C=2*sl(T);return n=C*tl(E*_)-d,r=C*tl((E+nl)*_)-d,s=C*tl((E+2*nl)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?il(n,r,s):il(n,r):s>=0&&s<=1?il(n,s):n:r>=0&&r<=1?s>=0&&s<=1?il(r,s):r:s}if(0===S)return r=-(i=v<0?sl(-v):-sl(v))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?il(n,r):n:r;var x=rl(S);return(i=sl(-v+x))-sl(v+x)-d}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}v.bezierByTime=ol,t("cv",$u),function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}($u||t("cv",$u={}));var al=Ta("cc.QuatKeyframeValue")(Wu=La((ju=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;this.interpolationMode=Xu&&Xu(),this.value=Yu&&Yu(),this.easingMethod=qu&&qu(),this.value=i?In.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},Xu=fa(ju.prototype,"interpolationMode",[Ma],(function(){return $u.SLERP})),Yu=fa(ju.prototype,"value",[Ma],(function(){return In.clone(In.IDENTITY)})),qu=fa(ju.prototype,"easingMethod",[Ma],(function(){return fu.LINEAR})),Wu=ju))||Wu)||Wu;function hl(t){return new al(t)}var ul,ll=t("cu",Ta("cc.QuatCurve")((Qu=function(t){function e(){var e;return(e=t.call(this)||this).preExtrapolation=Zu&&Zu(),e.postExtrapolation=Ju&&Ju(),e}s(e,t);var i=e.prototype;return i.evaluate=function(t,e){var i;null!==(i=e)&&void 0!==i||(e=new In);var n=this._times,r=this._values,s=this.postExtrapolation,o=this.preExtrapolation,a=n.length;if(0===a)return e;var h=n[0],u=n[a-1];if(t<h){var l=r[0];switch(o){case ua.LOOP:t=h+Ki(t-h,u-h);break;case ua.PING_PONG:t=h+Qi(t-h,u-h);break;case ua.CLAMP:default:return In.copy(e,l.value)}}else if(t>u){var c=r[a-1];switch(s){case ua.LOOP:t=h+Ki(t-h,u-h);break;case ua.PING_PONG:t=h+Qi(t-h,u-h);break;case ua.CLAMP:default:return In.copy(e,c.value)}}var _=aa(n,t);if(_>=0)return In.copy(e,r[_].value);var f=~_,d=f-1,p=n[d],m=r[d],g=n[f],y=r[f],v=(t-p)/(g-p);switch(m.interpolationMode){default:case $u.CONSTANT:return In.copy(e,m.value);case $u.SLERP:var S=m.easingMethod,A=S===fu.LINEAR?v:Array.isArray(S)?ol(S,v):gu(S)(v);return In.slerp(e,m.value,y.value,A)}},i.addKeyFrame=function(e,i){var n=new al(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 hl(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return hl(t[1])})))}},i[vh]=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,o=ml*(r?1:s),a=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?gl+4*vl:gl)}),0),h=0,u=new DataView(new ArrayBuffer(h+=_l+fl+dl*s+4*pl*s+a+o+0)),l=0,c=0;r&&(c|=ul.INTERPOLATION_MODE),u.setUint32(l,c,!0),l+=_l,u.setUint32(l,s,!0),l+=fl,i.forEach((function(t,e){return u.setFloat32(l+dl*e,t,!0)})),l+=dl*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,o=i.w,a=l+4*pl*e;u.setFloat32(a+0*pl,n,!0),u.setFloat32(a+1*pl,r,!0),u.setFloat32(a+2*pl,s,!0),u.setFloat32(a+3*pl,o,!0)})),l+=4*pl*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,yl),++l,u.setFloat32(l+0*vl,e[0],!0),u.setFloat32(l+1*vl,e[1],!0),u.setFloat32(l+2*vl,e[2],!0),u.setFloat32(l+3*vl,e[3],!0),l+=4*vl):(u.setUint8(l,e),++l)}));var _=l;l+=o;var f=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(f,e),r||(f+=ml)}));var d=new Uint8Array(u.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[Sh]=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+=_l;var o=s&ul.INTERPOLATION_MODE,a=n.getUint32(r,!0);r+=fl;var h=Array.from({length:a},(function(t,e){return n.getFloat32(r+dl*e,!0)})),u=r+=dl*a;r+=4*pl*a;var l=Array.from({length:a},(function(t,e){var i=u+4*pl*e,s=n.getFloat32(i+0*pl,!0),o=n.getFloat32(i+1*pl,!0),a=n.getFloat32(i+2*pl,!0),h=n.getFloat32(i+3*pl,!0),l=n.getUint8(r);++r;var c=hl({value:{x:s,y:o,z:a,w:h}});return l!==yl?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*vl,!0),n.getFloat32(r+1*vl,!0),n.getFloat32(r+2*vl,!0),n.getFloat32(r+3*vl,!0)],r+=4*vl),c}));if(o){var c=n.getUint8(r);++r;for(var _=0;_<a;++_)l[_].interpolationMode=c}else{for(var f=0;f<a;++f){var d=n.getUint8(r+f);l[f].interpolationMode=d}r+=a}this._times=h,this._values=l}else t.readThis()},e}(ca),Zu=fa(Qu.prototype,"preExtrapolation",[Ma],(function(){return ua.CLAMP})),Ju=fa(Qu.prototype,"postExtrapolation",[Ma],(function(){return ua.CLAMP})),Ku=Qu))||Ku);!function(t){t[t.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(ul||(ul={}));var cl,_l=1,fl=4,dl=4,pl=4,ml=1,gl=1,yl=255,vl=4,Sl=t("cw",Ta("cc.ObjectCurve")(cl=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=Ni(~e-1,0,this._values.length-1);return this._values[i]},e}(ca))||cl),Al=be({Blend:0,Fixed:1}),Tl=t("cx",(function(){this.color=bn.WHITE.clone(),this.time=0}));Ei.fastDefine("cc.ColorKey",Tl,{color:bn.WHITE.clone(),time:0}),Ei.Attr.setClassAttr(Tl,"color","visible",!0),Ei.Attr.setClassAttr(Tl,"time","visible",!0);var bl=t("cy",(function(){this.alpha=1,this.time=0}));Ei.fastDefine("cc.AlphaKey",bl,{alpha:1,time:0}),Ei.Attr.setClassAttr(bl,"alpha","visible",!0),Ei.Attr.setClassAttr(bl,"time","visible",!0);var El=t("cz",function(){function t(){this.colorKeys=[],this.alphaKeys=[],this.mode=Al.Blend}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 bn,t)},e.evaluateFast=function(t,e){return this.getRGB(t,e),t.a=this.getAlpha(e),t},e.randomColor=function(){return this.getRandomColor(new bn)},e.getRandomColor=function(t){var e=this.colorKeys[Math.trunc(Ui()*this.colorKeys.length)],i=this.alphaKeys[Math.trunc(Ui()*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=Ki(e,1+Bi);for(var r=1;r<n;++r){var s=i[r-1].time,o=i[r].time;if(e>=s&&e<o){if(this.mode===Al.Fixed)return bn.copy(t,i[r].color),t;var a=(e-s)/(o-s);return bn.lerp(t,i[r-1].color,i[r].color,a),t}}var h=n-1;Li(e,i[h].time,Bi)?bn.copy(t,i[h].color):e<i[0].time?bn.lerp(t,bn.BLACK,i[0].color,e/i[0].time):e>i[h].time&&bn.lerp(t,i[h].color,bn.BLACK,(e-i[h].time)/(1-i[h].time))}else 1===n?bn.copy(t,i[0].color):bn.copy(t,bn.WHITE);return t},e.getAlpha=function(t){var e=this.alphaKeys,i=e.length;if(i>1){t=Ki(t,1+Bi);for(var n=1;n<i;++n){var r=e[n-1].time,s=e[n].time;if(t>=r&&t<s){if(this.mode===Al.Fixed)return e[n].alpha;var o=(t-r)/(s-r);return ki(e[n-1].alpha,e[n].alpha,o)}}var a=i-1;return Li(t,e[a].time,Bi)?e[a].alpha:t<e[0].time?ki(0,e[0].alpha,t/e[0].time):t>e[a].time?ki(e[a].alpha,0,(t-e[a].time)/(1-e[a].time)):255}return 1===i?e[0].alpha:255},t}());El.Mode=Al,Ei.fastDefine("cc.Gradient",El,{colorKeys:[],alphaKeys:[],mode:Al.Blend}),Ei.Attr.setClassAttr(El,"colorKeys","visible",!0),Ei.Attr.setClassAttr(El,"alphaKeys","visible",!0),Ei.Attr.setClassAttr(El,"mode","visible",!0);var Cl=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};Ei.fastDefine("cc.Keyframe",Cl,{time:0,value:0,inTangent:0,outTangent:0});var xl=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 wl(t-this.time,this.coefficient)},t}();function wl(t,e){return t*(t*(t*e[0]+e[1])+e[2])+e[3]}var Dl,Rl,Il=function(){function t(t){if(void 0===t&&(t=null),this._curve=void 0,this.cachedKey=void 0,t instanceof Cu)this._curve=t;else{var e=new Cu;this._curve=e,e.preExtrapolation=ua.LOOP,e.postExtrapolation=ua.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:ha.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:ha.CUBIC,value:1}],[1,{interpolationMode:ha.CUBIC,value:1}]])}this.cachedKey=new xl}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:ha.CUBIC,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,o=i.getKeyframeTime(0),a=i.getKeyframeTime(n);switch(s){case ua.LOOP:r=Ki(t-o,a-o)+o;break;case ua.PING_PONG:r=Qi(t-o,a-o)+o;break;case ua.CLAMP:default:r=Ni(t,o,a)}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),o=s.value,a=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,_=u-o,f=1/(c*c),d=a*c,p=l*c;t.coefficient[0]=(d+p-_-_)*f/c,t.coefficient[1]=(_+_+_-d-d-p)*f,t.coefficient[2]=a,t.coefficient[3]=o},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 o=r+s;if(o+1<n&&i.getKeyframeTime(o+1)>e)return o}else for(var a=0;a<3;a++){var h=r-a;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 Cl;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:ha.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Pl(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=Ml(t)}},{key:"postWrapMode",get:function(){return Pl(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=Ml(t)}}]),t}();function Ml(t){switch(t){default:case Dl.Default:case Dl.Normal:case Dl.Clamp:return ua.CLAMP;case Dl.PingPong:return ua.PING_PONG;case Dl.Loop:return ua.LOOP}}function Pl(t){switch(t){default:case ua.LINEAR:case ua.CLAMP:return Dl.Clamp;case ua.PING_PONG:return Dl.PingPong;case ua.LOOP:return Dl.Loop}}function Bl(){var t=new Cu;return t.assignSorted([[0,{interpolationMode:ha.CUBIC,value:1}],[1,{interpolationMode:ha.CUBIC,value:1}]]),t}Il.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],Ei.fastDefine("cc.AnimationCurve",Il,{_curve:null}),function(t){t[t.Default=0]="Default",t[t.Normal=1]="Normal",t[t.Loop=2]="Loop",t[t.ShouldWrap=4]="ShouldWrap",t[t.Clamp=8]="Clamp",t[t.PingPong=22]="PingPong",t[t.Reverse=36]="Reverse"}(Dl||(Dl={})),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Rl||(Rl={}));var Ol,Ll=4294967295,Nl=new mn,Fl=new mn,kl=new mn,Vl=new mn,Gl=function(){function t(t,e){void 0===t&&(t=Rl.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Rl.CATMULL_ROM,this._knots=[],this._type=dr.SHAPE_SPLINE,this._mode=t;for(var i=0;i<e.length;i++)this._knots[i]=new mn(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]=new mn(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]=new mn(e[i])},e.clearKnots=function(){this._knots.length=0},e.getKnotCount=function(){return this._knots.length},e.addKnot=function(t){this._knots.push(new mn(t))},e.insertKnot=function(t,e){var i=new mn(e);t>=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){t>=0&&this._knots.length,this._knots.splice(t,1)},e.setKnot=function(t,e){t>=0&&this._knots.length,this._knots[t].set(e)},e.getKnot=function(t){return t>=0&&this._knots.length,this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=Ll),e=Ni(e,0,1);var n=this.getSegments();if(0===n)return new mn(0,0,0);if(i===Ll){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new mn(this._knots[this._knots.length-1]);switch(this._mode){case Rl.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Rl.BEZIER:return t.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],e);case Rl.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],o=i+2<this._knots.length?this._knots[i+2]:this._knots[i+1];return t.calcCatmullRom(s,this._knots[i],this._knots[i+1],o,e);default:return new mn(0,0,0)}},e.getPoints=function(t,e){if(void 0===e&&(e=Ll),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,o=this.getPoint(s,e);i.push(o)}return i},e.getSegments=function(){var t=this._knots.length;switch(this._mode){case Rl.LINEAR:case Rl.CATMULL_ROM:return t<2?($(14300),0):t-1;case Rl.BEZIER:return t<4||t%4!=0?($(14301),0):t/4}},t.calcLinear=function(t,e,i){var n=new mn;return mn.multiplyScalar(Nl,t,1-i),mn.multiplyScalar(Fl,e,i),mn.add(n,Nl,Fl),n},t.calcBezier=function(t,e,i,n,r){var s=new mn,o=1-r;return mn.multiplyScalar(Nl,t,o*o*o),mn.multiplyScalar(Fl,e,3*r*o*o),mn.multiplyScalar(kl,i,3*r*r*o),mn.multiplyScalar(Vl,n,r*r*r),mn.add(Nl,Nl,Fl),mn.add(kl,kl,Vl),mn.add(s,Nl,kl),s},t.calcCatmullRom=function(t,e,i,n,r){var s=new mn,o=r*r,a=o*r;return mn.multiplyScalar(Nl,t,-.5*a+o-.5*r),mn.multiplyScalar(Fl,e,1.5*a-2.5*o+1),mn.multiplyScalar(kl,i,-1.5*a+2*o+.5*r),mn.multiplyScalar(Vl,n,.5*a-.5*o),mn.add(Nl,Nl,Fl),mn.add(kl,kl,Vl),mn.add(s,Nl,kl),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 Ul(t,e){U(t+" is deprecated, please use "+e+" instead.")}!function(t){t[t.ALL=0]="ALL",t[t.CLOSEST=1]="CLOSEST",t[t.ANY=2]="ANY"}(Ol||(Ol={})),ht(gs,"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 zl=function(t){function e(){var e;return e=t.call(this)||this,Ul("line","Line"),e}return s(e,t),e}(pr),Hl=function(t){function e(){var e;return e=t.call(this)||this,Ul("plane","Plane"),e}return s(e,t),e}(Rs),Wl=function(t){function e(){var e;return e=t.call(this)||this,Ul("ray","Ray"),e}return s(e,t),e}(mr),jl=function(t){function e(){var e;return e=t.call(this)||this,Ul("triangle","Triangle"),e}return s(e,t),e}(Is),Xl=function(t){function e(){var e;return e=t.call(this)||this,Ul("sphere","Sphere"),e}return s(e,t),e}(Dr),Yl=function(t){function e(){var e;return e=t.call(this)||this,Ul("aabb","AABB"),e}return s(e,t),e}(Ko),ql=function(t){function e(){var e;return e=t.call(this)||this,Ul("obb","OBB"),e}return s(e,t),e}(oa),Kl=function(t){function e(){var e;return e=t.call(this)||this,Ul("capsule","Capsule"),e}return s(e,t),e}(Qo),Ql=function(t){function e(){var e;return e=t.call(this)||this,Ul("frustum","Frustum"),e}return s(e,t),e}(ia),Zl=Object.freeze({__proto__:null,distance:fr,enums:dr,intersect:gs,Line:pr,Plane:Rs,Ray:mr,Triangle:Is,Sphere:Dr,AABB:Ko,OBB:oa,Capsule:Qo,Frustum:ia,Keyframe:Cl,AnimationCurve:Il,get WrapModeMask(){return Dl},get SplineMode(){return Rl},Spline:Gl,constructLegacyCurveAndConvert:Bl,OptimizedKey:xl,evalOptCurve:wl,get ERaycastMode(){return Ol},line:zl,plane:Hl,ray:Wl,triangle:jl,sphere:Xl,aabb:Yl,obb:ql,capsule:Kl,frustum:Ql});t("aL",Zl);var Jl=t("cC",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}());Jl.Priority=be({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var $l=new Tt("Scheduler"),tc=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}();tc._listEntries=[];var ec=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}();ec._hashUpdateEntries=[];var ic=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,o){var a=t._hashTimerEntries.pop();return a?(a.timers=e,a.target=i,a.timerIndex=n,a.currentTimer=r,a.currentTimerSalvaged=s,a.paused=o):a=new t(e,i,n,r,s,o),a},t.put=function(e){t._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,t._hashTimerEntries.push(e))},t}();ic._hashTimerEntries=[];var nc=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===v.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}();nc._timers=[];var rc=t("cp",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=Ot(!0),e._hashForTimers=Ot(!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=$l.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++){var o,a;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(o=(a=r.target).update)||void 0===o||o.call(a,t)}for(e=0,n=(i=this._updates0List).length;e<n;e++){var h,u;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(h=(u=r.target).update)||void 0===h||h.call(u,t)}for(e=0,n=(i=this._updatesPosList).length;e<n;e++){var l,c;(r=i[e]).paused||r.markedForDeletion||!r.target||null===(l=(c=r.target).update)||void 0===l||l.call(c,t)}var _=this._arrayForTimers;for(e=0;e<_.length;e++){var f;if(s=_[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===(f=this._currentTarget.timers)||void 0===f?void 0:f.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 o,a,h,u;"function"!=typeof t?($(1514),h=e,u=t):(h=t,u=e),3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=v.macro.REPEAT_FOREVER,r=0),rt(Boolean(u),1502);var l=u.uuid||u.id;if(l){var c,_,f=this._hashForTimers[l];if(f?f.paused!==s&&$(1511):(f=ic.get(null,u,0,null,!1,Boolean(s)),this._arrayForTimers.push(f),this._hashForTimers[l]=f),null==f.timers)f.timers=[];else for(_=0;_<f.timers.length;++_)if((c=f.timers[_])&&h===c.getCallback())return K(1507,c.getInterval(),i),void c.setInterval(i);(c=nc.get()).initWithCallback(this,h,u,i,null!==(o=n)&&void 0!==o?o:0,null!==(a=r)&&void 0!==a?a:0),f.timers.push(c),this._currentTarget===f&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else et(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 K(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(t)}var s,o=tc.get(t,e,i,!1);0===e?(s=this._updates0List,this._appendIn(s,o)):(s=e<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,o,e)),this._hashForUpdates[n]=ec.get(s,o,t,null)}else et(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,o=r.length;s<o;s++){var a=r[s];if(t===a.getCallback())return a!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),nc.put(a),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}}else et(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 o=r[s];if(o===t)return r.splice(s,1),nc.put(o),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 et(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++)nc.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(t)}else et(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(Jl.Priority.SCHEDULER)},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 o;s=this._updatesNegList.length,null!==(o=n=this._updatesNegList[e])&&void 0!==o&&o.target&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++}if(t<=0)for(e=0;e<this._updates0List.length;){var a;s=this._updates0List.length,null!==(a=n=this._updates0List[e])&&void 0!==a&&a.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])&&void 0!==h&&h.target&&n.priority>=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++}},i.isScheduled=function(t,e){rt(Boolean(t),1508),rt(Boolean(e),1509);var i=e.uuid||e.id;if(!i)return et(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(Jl.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(t){var e,i,n,r,s=[],o=this._arrayForTimers;for(i=0,n=o.length;i<n;i++){var a;null!==(a=e=o[i])&&void 0!==a&&a.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])&&void 0!==h&&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])&&void 0!==u&&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])&&void 0!==l&&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){rt(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 et(1510)},i.resumeTarget=function(t){rt(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 et(1510)},i.isTargetPaused=function(t){rt(Boolean(t),1505);var e=t.uuid||t.id;if(!e)return et(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}ic.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,o=n.length;s<o;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[e],r&&tc.put(r),ec.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}(Jl));rc.ID="scheduler",v.Scheduler=rc;var sc={};ht(sc,"vmath",[{name:"vec2",newName:"Vec2",target:er,targetName:"math"},{name:"vec3",newName:"Vec3",target:er,targetName:"math"},{name:"vec4",newName:"Vec4",target:er,targetName:"math"},{name:"quat",newName:"Quat",target:er,targetName:"math"},{name:"mat3",newName:"Mat3",target:er,targetName:"math"},{name:"mat4",newName:"Mat4",target:er,targetName:"math"},{name:"color4",newName:"Color",target:er,targetName:"math"},{name:"rect",newName:"Rect",target:er,targetName:"math"},{name:"approx",newName:"approx",target:er,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:er,targetName:"math"},{name:"equals",newName:"equals",target:er,targetName:"math"},{name:"clamp",newName:"clamp",target:er,targetName:"math"},{name:"clamp01",newName:"clamp01",target:er,targetName:"math"},{name:"lerp",newName:"lerp",target:er,targetName:"math"},{name:"toRadian",newName:"toRadian",target:er,targetName:"math"},{name:"toDegree",newName:"toDegree",target:er,targetName:"math"},{name:"random",newName:"random",target:er,targetName:"math"},{name:"randomRange",newName:"randomRange",target:er,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:er,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:er,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:er,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:er,targetName:"math"},{name:"repeat",newName:"repeat",target:er,targetName:"math"},{name:"pingPong",newName:"pingPong",target:er,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:er,targetName:"math"}]),v.vmath=sc,ht(rc.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:rc,targetName:"Scheduler"}]),ht(rc,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return Jl.Priority.SCHEDULER}}]),ut(rc,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),lt(ve,"js",[{name:"js",suggest:"'js.js' is deprecated since v3.7.0, please access 'js' directly instead."}]);var oc=String.prototype.charCodeAt;function ac(t){return this[t]}function hc(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?oc:ac;i>=4;){var o=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>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 uc(){}function lc(t,e,i){if(Ae(t,e),Ae(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}v.easing=du,uc.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},uc.prototype.targetOff=function(t){this.removeAll(t)},t("cH",Object.freeze({__proto__:null,syncNodeValues:function(t){var e=t._lpos;t.setPositionForJS(e.x,e.y,e.z);var i=t._lscale;t.setScaleForJS(i.x,i.y,i.z);var n=t._lrot;t.setRotationForJS(n.x,n.y,n.z,n.w);var r=t._euler;t.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function t(e){if(e){var i=e.children;if(i){var n=i.length;if(n){e._setChildren(i);for(var r=0;r<n;++r)t(i[r])}}}},ExtraEventMethods:uc}));var cc=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(t){var e=this._gcObjects.get(t);e&&(this._gcObjects.delete(t),e.destroy()),this._finalizationRegistry.unregister(t)},e.destroy=function(){},t}(),_c=t("cV",new cc),fc=t("cW",function(){function t(){return _c.registerGCObject(this)}return t.prototype.destroy=function(){},t}());function dc(t,e){for(var i,n=f(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?dc(t,r):t.push(r)}}function pc(t){var e=[];return dc(e,t),e.join("")}v.math=er,v.geometry=Zl;var mc,gc,yc,vc,Sc,Ac,Tc,bc,Ec,Cc,xc,wc,Dc,Rc,Ic,Mc,Pc,Bc,Oc,Lc,Nc,Fc,kc,Vc,Gc,Uc,zc,Hc,Wc,jc,Xc,Yc,qc,Kc,Qc,Zc,Jc,$c,t_,e_,i_,n_,r_,s_,o_=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};!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.SWAPCHAIN=1]="SWAPCHAIN",t[t.BUFFER=2]="BUFFER",t[t.TEXTURE=3]="TEXTURE",t[t.RENDER_PASS=4]="RENDER_PASS",t[t.FRAMEBUFFER=5]="FRAMEBUFFER",t[t.SAMPLER=6]="SAMPLER",t[t.SHADER=7]="SHADER",t[t.DESCRIPTOR_SET_LAYOUT=8]="DESCRIPTOR_SET_LAYOUT",t[t.PIPELINE_LAYOUT=9]="PIPELINE_LAYOUT",t[t.PIPELINE_STATE=10]="PIPELINE_STATE",t[t.DESCRIPTOR_SET=11]="DESCRIPTOR_SET",t[t.INPUT_ASSEMBLER=12]="INPUT_ASSEMBLER",t[t.COMMAND_BUFFER=13]="COMMAND_BUFFER",t[t.QUEUE=14]="QUEUE",t[t.QUERY_POOL=15]="QUERY_POOL",t[t.GLOBAL_BARRIER=16]="GLOBAL_BARRIER",t[t.TEXTURE_BARRIER=17]="TEXTURE_BARRIER",t[t.BUFFER_BARRIER=18]="BUFFER_BARRIER",t[t.COUNT=19]="COUNT"}(mc||(mc={})),function(t){t[t.UNREADY=0]="UNREADY",t[t.FAILED=1]="FAILED",t[t.SUCCESS=2]="SUCCESS"}(gc||(gc={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.GLES2=1]="GLES2",t[t.GLES3=2]="GLES3",t[t.METAL=3]="METAL",t[t.VULKAN=4]="VULKAN",t[t.NVN=5]="NVN",t[t.WEBGL=6]="WEBGL",t[t.WEBGL2=7]="WEBGL2",t[t.WEBGPU=8]="WEBGPU"}(yc||(yc={})),function(t){t[t.IDENTITY=0]="IDENTITY",t[t.ROTATE_90=1]="ROTATE_90",t[t.ROTATE_180=2]="ROTATE_180",t[t.ROTATE_270=3]="ROTATE_270"}(vc||(vc={})),function(t){t[t.ELEMENT_INDEX_UINT=0]="ELEMENT_INDEX_UINT",t[t.INSTANCED_ARRAYS=1]="INSTANCED_ARRAYS",t[t.MULTIPLE_RENDER_TARGETS=2]="MULTIPLE_RENDER_TARGETS",t[t.BLEND_MINMAX=3]="BLEND_MINMAX",t[t.COMPUTE_SHADER=4]="COMPUTE_SHADER",t[t.INPUT_ATTACHMENT_BENEFIT=5]="INPUT_ATTACHMENT_BENEFIT",t[t.SUBPASS_COLOR_INPUT=6]="SUBPASS_COLOR_INPUT",t[t.SUBPASS_DEPTH_STENCIL_INPUT=7]="SUBPASS_DEPTH_STENCIL_INPUT",t[t.RASTERIZATION_ORDER_COHERENT=8]="RASTERIZATION_ORDER_COHERENT",t[t.MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL=9]="MULTI_SAMPLE_RESOLVE_DEPTH_STENCIL",t[t.COUNT=10]="COUNT"}(Sc||(Sc={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A8=1]="A8",t[t.L8=2]="L8",t[t.LA8=3]="LA8",t[t.R8=4]="R8",t[t.R8SN=5]="R8SN",t[t.R8UI=6]="R8UI",t[t.R8I=7]="R8I",t[t.R16F=8]="R16F",t[t.R16UI=9]="R16UI",t[t.R16I=10]="R16I",t[t.R32F=11]="R32F",t[t.R32UI=12]="R32UI",t[t.R32I=13]="R32I",t[t.RG8=14]="RG8",t[t.RG8SN=15]="RG8SN",t[t.RG8UI=16]="RG8UI",t[t.RG8I=17]="RG8I",t[t.RG16F=18]="RG16F",t[t.RG16UI=19]="RG16UI",t[t.RG16I=20]="RG16I",t[t.RG32F=21]="RG32F",t[t.RG32UI=22]="RG32UI",t[t.RG32I=23]="RG32I",t[t.RGB8=24]="RGB8",t[t.SRGB8=25]="SRGB8",t[t.RGB8SN=26]="RGB8SN",t[t.RGB8UI=27]="RGB8UI",t[t.RGB8I=28]="RGB8I",t[t.RGB16F=29]="RGB16F",t[t.RGB16UI=30]="RGB16UI",t[t.RGB16I=31]="RGB16I",t[t.RGB32F=32]="RGB32F",t[t.RGB32UI=33]="RGB32UI",t[t.RGB32I=34]="RGB32I",t[t.RGBA8=35]="RGBA8",t[t.BGRA8=36]="BGRA8",t[t.SRGB8_A8=37]="SRGB8_A8",t[t.RGBA8SN=38]="RGBA8SN",t[t.RGBA8UI=39]="RGBA8UI",t[t.RGBA8I=40]="RGBA8I",t[t.RGBA16F=41]="RGBA16F",t[t.RGBA16UI=42]="RGBA16UI",t[t.RGBA16I=43]="RGBA16I",t[t.RGBA32F=44]="RGBA32F",t[t.RGBA32UI=45]="RGBA32UI",t[t.RGBA32I=46]="RGBA32I",t[t.R5G6B5=47]="R5G6B5",t[t.R11G11B10F=48]="R11G11B10F",t[t.RGB5A1=49]="RGB5A1",t[t.RGBA4=50]="RGBA4",t[t.RGB10A2=51]="RGB10A2",t[t.RGB10A2UI=52]="RGB10A2UI",t[t.RGB9E5=53]="RGB9E5",t[t.DEPTH=54]="DEPTH",t[t.DEPTH_STENCIL=55]="DEPTH_STENCIL",t[t.BC1=56]="BC1",t[t.BC1_ALPHA=57]="BC1_ALPHA",t[t.BC1_SRGB=58]="BC1_SRGB",t[t.BC1_SRGB_ALPHA=59]="BC1_SRGB_ALPHA",t[t.BC2=60]="BC2",t[t.BC2_SRGB=61]="BC2_SRGB",t[t.BC3=62]="BC3",t[t.BC3_SRGB=63]="BC3_SRGB",t[t.BC4=64]="BC4",t[t.BC4_SNORM=65]="BC4_SNORM",t[t.BC5=66]="BC5",t[t.BC5_SNORM=67]="BC5_SNORM",t[t.BC6H_UF16=68]="BC6H_UF16",t[t.BC6H_SF16=69]="BC6H_SF16",t[t.BC7=70]="BC7",t[t.BC7_SRGB=71]="BC7_SRGB",t[t.ETC_RGB8=72]="ETC_RGB8",t[t.ETC2_RGB8=73]="ETC2_RGB8",t[t.ETC2_SRGB8=74]="ETC2_SRGB8",t[t.ETC2_RGB8_A1=75]="ETC2_RGB8_A1",t[t.ETC2_SRGB8_A1=76]="ETC2_SRGB8_A1",t[t.ETC2_RGBA8=77]="ETC2_RGBA8",t[t.ETC2_SRGB8_A8=78]="ETC2_SRGB8_A8",t[t.EAC_R11=79]="EAC_R11",t[t.EAC_R11SN=80]="EAC_R11SN",t[t.EAC_RG11=81]="EAC_RG11",t[t.EAC_RG11SN=82]="EAC_RG11SN",t[t.PVRTC_RGB2=83]="PVRTC_RGB2",t[t.PVRTC_RGBA2=84]="PVRTC_RGBA2",t[t.PVRTC_RGB4=85]="PVRTC_RGB4",t[t.PVRTC_RGBA4=86]="PVRTC_RGBA4",t[t.PVRTC2_2BPP=87]="PVRTC2_2BPP",t[t.PVRTC2_4BPP=88]="PVRTC2_4BPP",t[t.ASTC_RGBA_4X4=89]="ASTC_RGBA_4X4",t[t.ASTC_RGBA_5X4=90]="ASTC_RGBA_5X4",t[t.ASTC_RGBA_5X5=91]="ASTC_RGBA_5X5",t[t.ASTC_RGBA_6X5=92]="ASTC_RGBA_6X5",t[t.ASTC_RGBA_6X6=93]="ASTC_RGBA_6X6",t[t.ASTC_RGBA_8X5=94]="ASTC_RGBA_8X5",t[t.ASTC_RGBA_8X6=95]="ASTC_RGBA_8X6",t[t.ASTC_RGBA_8X8=96]="ASTC_RGBA_8X8",t[t.ASTC_RGBA_10X5=97]="ASTC_RGBA_10X5",t[t.ASTC_RGBA_10X6=98]="ASTC_RGBA_10X6",t[t.ASTC_RGBA_10X8=99]="ASTC_RGBA_10X8",t[t.ASTC_RGBA_10X10=100]="ASTC_RGBA_10X10",t[t.ASTC_RGBA_12X10=101]="ASTC_RGBA_12X10",t[t.ASTC_RGBA_12X12=102]="ASTC_RGBA_12X12",t[t.ASTC_SRGBA_4X4=103]="ASTC_SRGBA_4X4",t[t.ASTC_SRGBA_5X4=104]="ASTC_SRGBA_5X4",t[t.ASTC_SRGBA_5X5=105]="ASTC_SRGBA_5X5",t[t.ASTC_SRGBA_6X5=106]="ASTC_SRGBA_6X5",t[t.ASTC_SRGBA_6X6=107]="ASTC_SRGBA_6X6",t[t.ASTC_SRGBA_8X5=108]="ASTC_SRGBA_8X5",t[t.ASTC_SRGBA_8X6=109]="ASTC_SRGBA_8X6",t[t.ASTC_SRGBA_8X8=110]="ASTC_SRGBA_8X8",t[t.ASTC_SRGBA_10X5=111]="ASTC_SRGBA_10X5",t[t.ASTC_SRGBA_10X6=112]="ASTC_SRGBA_10X6",t[t.ASTC_SRGBA_10X8=113]="ASTC_SRGBA_10X8",t[t.ASTC_SRGBA_10X10=114]="ASTC_SRGBA_10X10",t[t.ASTC_SRGBA_12X10=115]="ASTC_SRGBA_12X10",t[t.ASTC_SRGBA_12X12=116]="ASTC_SRGBA_12X12",t[t.COUNT=117]="COUNT"}(Ac||(Ac={})),function(t){t[t.NONE=0]="NONE",t[t.UNORM=1]="UNORM",t[t.SNORM=2]="SNORM",t[t.UINT=3]="UINT",t[t.INT=4]="INT",t[t.UFLOAT=5]="UFLOAT",t[t.FLOAT=6]="FLOAT"}(Tc||(Tc={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.BOOL=1]="BOOL",t[t.BOOL2=2]="BOOL2",t[t.BOOL3=3]="BOOL3",t[t.BOOL4=4]="BOOL4",t[t.INT=5]="INT",t[t.INT2=6]="INT2",t[t.INT3=7]="INT3",t[t.INT4=8]="INT4",t[t.UINT=9]="UINT",t[t.UINT2=10]="UINT2",t[t.UINT3=11]="UINT3",t[t.UINT4=12]="UINT4",t[t.FLOAT=13]="FLOAT",t[t.FLOAT2=14]="FLOAT2",t[t.FLOAT3=15]="FLOAT3",t[t.FLOAT4=16]="FLOAT4",t[t.MAT2=17]="MAT2",t[t.MAT2X3=18]="MAT2X3",t[t.MAT2X4=19]="MAT2X4",t[t.MAT3X2=20]="MAT3X2",t[t.MAT3=21]="MAT3",t[t.MAT3X4=22]="MAT3X4",t[t.MAT4X2=23]="MAT4X2",t[t.MAT4X3=24]="MAT4X3",t[t.MAT4=25]="MAT4",t[t.SAMPLER1D=26]="SAMPLER1D",t[t.SAMPLER1D_ARRAY=27]="SAMPLER1D_ARRAY",t[t.SAMPLER2D=28]="SAMPLER2D",t[t.SAMPLER2D_ARRAY=29]="SAMPLER2D_ARRAY",t[t.SAMPLER3D=30]="SAMPLER3D",t[t.SAMPLER_CUBE=31]="SAMPLER_CUBE",t[t.SAMPLER=32]="SAMPLER",t[t.TEXTURE1D=33]="TEXTURE1D",t[t.TEXTURE1D_ARRAY=34]="TEXTURE1D_ARRAY",t[t.TEXTURE2D=35]="TEXTURE2D",t[t.TEXTURE2D_ARRAY=36]="TEXTURE2D_ARRAY",t[t.TEXTURE3D=37]="TEXTURE3D",t[t.TEXTURE_CUBE=38]="TEXTURE_CUBE",t[t.IMAGE1D=39]="IMAGE1D",t[t.IMAGE1D_ARRAY=40]="IMAGE1D_ARRAY",t[t.IMAGE2D=41]="IMAGE2D",t[t.IMAGE2D_ARRAY=42]="IMAGE2D_ARRAY",t[t.IMAGE3D=43]="IMAGE3D",t[t.IMAGE_CUBE=44]="IMAGE_CUBE",t[t.SUBPASS_INPUT=45]="SUBPASS_INPUT",t[t.COUNT=46]="COUNT"}(bc||(bc={})),function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.INDEX=4]="INDEX",t[t.VERTEX=8]="VERTEX",t[t.UNIFORM=16]="UNIFORM",t[t.STORAGE=32]="STORAGE",t[t.INDIRECT=64]="INDIRECT"}(Ec||(Ec={})),function(t){t[t.NONE=0]="NONE"}(Cc||(Cc={})),function(t){t[t.NONE=0]="NONE",t[t.READ_ONLY=1]="READ_ONLY",t[t.WRITE_ONLY=2]="WRITE_ONLY",t[t.READ_WRITE=3]="READ_WRITE"}(xc||(xc={})),function(t){t[t.NONE=0]="NONE",t[t.DEVICE=1]="DEVICE",t[t.HOST=2]="HOST"}(wc||(wc={})),function(t){t[t.TEX1D=0]="TEX1D",t[t.TEX2D=1]="TEX2D",t[t.TEX3D=2]="TEX3D",t[t.CUBE=3]="CUBE",t[t.TEX1D_ARRAY=4]="TEX1D_ARRAY",t[t.TEX2D_ARRAY=5]="TEX2D_ARRAY"}(Dc||(Dc={})),function(t){t[t.NONE=0]="NONE",t[t.TRANSFER_SRC=1]="TRANSFER_SRC",t[t.TRANSFER_DST=2]="TRANSFER_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT"}(Rc||(Rc={})),function(t){t[t.NONE=0]="NONE",t[t.GEN_MIPMAP=1]="GEN_MIPMAP",t[t.GENERAL_LAYOUT=2]="GENERAL_LAYOUT",t[t.EXTERNAL_OES=4]="EXTERNAL_OES",t[t.EXTERNAL_NORMAL=8]="EXTERNAL_NORMAL",t[t.LAZILY_ALLOCATED=16]="LAZILY_ALLOCATED",t[t.MUTABLE_VIEW_FORMAT=64]="MUTABLE_VIEW_FORMAT",t[t.MUTABLE_STORAGE=128]="MUTABLE_STORAGE"}(Ic||(Ic={})),function(t){t[t.NONE=0]="NONE",t[t.RENDER_TARGET=1]="RENDER_TARGET",t[t.SAMPLED_TEXTURE=2]="SAMPLED_TEXTURE",t[t.LINEAR_FILTER=4]="LINEAR_FILTER",t[t.STORAGE_TEXTURE=8]="STORAGE_TEXTURE",t[t.VERTEX_ATTRIBUTE=16]="VERTEX_ATTRIBUTE"}(Mc||(Mc={})),function(t){t[t.X1=1]="X1",t[t.X2=2]="X2",t[t.X4=4]="X4",t[t.X8=8]="X8",t[t.X16=16]="X16",t[t.X32=32]="X32",t[t.X64=64]="X64"}(Pc||(Pc={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON",t[t.RELAXED=2]="RELAXED",t[t.MAILBOX=3]="MAILBOX",t[t.HALF=4]="HALF"}(Bc||(Bc={})),function(t){t[t.NONE=0]="NONE",t[t.POINT=1]="POINT",t[t.LINEAR=2]="LINEAR",t[t.ANISOTROPIC=3]="ANISOTROPIC"}(Oc||(Oc={})),function(t){t[t.WRAP=0]="WRAP",t[t.MIRROR=1]="MIRROR",t[t.CLAMP=2]="CLAMP",t[t.BORDER=3]="BORDER"}(Lc||(Lc={})),function(t){t[t.NEVER=0]="NEVER",t[t.LESS=1]="LESS",t[t.EQUAL=2]="EQUAL",t[t.LESS_EQUAL=3]="LESS_EQUAL",t[t.GREATER=4]="GREATER",t[t.NOT_EQUAL=5]="NOT_EQUAL",t[t.GREATER_EQUAL=6]="GREATER_EQUAL",t[t.ALWAYS=7]="ALWAYS"}(Nc||(Nc={})),function(t){t[t.ZERO=0]="ZERO",t[t.KEEP=1]="KEEP",t[t.REPLACE=2]="REPLACE",t[t.INCR=3]="INCR",t[t.DECR=4]="DECR",t[t.INVERT=5]="INVERT",t[t.INCR_WRAP=6]="INCR_WRAP",t[t.DECR_WRAP=7]="DECR_WRAP"}(Fc||(Fc={})),function(t){t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=2]="SRC_ALPHA",t[t.DST_ALPHA=3]="DST_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=4]="ONE_MINUS_SRC_ALPHA",t[t.ONE_MINUS_DST_ALPHA=5]="ONE_MINUS_DST_ALPHA",t[t.SRC_COLOR=6]="SRC_COLOR",t[t.DST_COLOR=7]="DST_COLOR",t[t.ONE_MINUS_SRC_COLOR=8]="ONE_MINUS_SRC_COLOR",t[t.ONE_MINUS_DST_COLOR=9]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=10]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=11]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=12]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=13]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=14]="ONE_MINUS_CONSTANT_ALPHA"}(kc||(kc={})),function(t){t[t.ADD=0]="ADD",t[t.SUB=1]="SUB",t[t.REV_SUB=2]="REV_SUB",t[t.MIN=3]="MIN",t[t.MAX=4]="MAX"}(Vc||(Vc={})),function(t){t[t.NONE=0]="NONE",t[t.R=1]="R",t[t.G=2]="G",t[t.B=4]="B",t[t.A=8]="A",t[t.ALL=15]="ALL"}(Gc||(Gc={})),function(t){t[t.NONE=0]="NONE",t[t.VERTEX=1]="VERTEX",t[t.CONTROL=2]="CONTROL",t[t.EVALUATION=4]="EVALUATION",t[t.GEOMETRY=8]="GEOMETRY",t[t.FRAGMENT=16]="FRAGMENT",t[t.COMPUTE=32]="COMPUTE",t[t.ALL=63]="ALL"}(Uc||(Uc={})),function(t){t[t.LOAD=0]="LOAD",t[t.CLEAR=1]="CLEAR",t[t.DISCARD=2]="DISCARD"}(zc||(zc={})),function(t){t[t.STORE=0]="STORE",t[t.DISCARD=1]="DISCARD"}(Hc||(Hc={})),function(t){t[t.NONE=0]="NONE",t[t.INDIRECT_BUFFER=1]="INDIRECT_BUFFER",t[t.INDEX_BUFFER=2]="INDEX_BUFFER",t[t.VERTEX_BUFFER=4]="VERTEX_BUFFER",t[t.VERTEX_SHADER_READ_UNIFORM_BUFFER=8]="VERTEX_SHADER_READ_UNIFORM_BUFFER",t[t.VERTEX_SHADER_READ_TEXTURE=16]="VERTEX_SHADER_READ_TEXTURE",t[t.VERTEX_SHADER_READ_OTHER=32]="VERTEX_SHADER_READ_OTHER",t[t.FRAGMENT_SHADER_READ_UNIFORM_BUFFER=64]="FRAGMENT_SHADER_READ_UNIFORM_BUFFER",t[t.FRAGMENT_SHADER_READ_TEXTURE=128]="FRAGMENT_SHADER_READ_TEXTURE",t[t.FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT=256]="FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT",t[t.FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT=512]="FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT",t[t.FRAGMENT_SHADER_READ_OTHER=1024]="FRAGMENT_SHADER_READ_OTHER",t[t.COLOR_ATTACHMENT_READ=2048]="COLOR_ATTACHMENT_READ",t[t.DEPTH_STENCIL_ATTACHMENT_READ=4096]="DEPTH_STENCIL_ATTACHMENT_READ",t[t.COMPUTE_SHADER_READ_UNIFORM_BUFFER=8192]="COMPUTE_SHADER_READ_UNIFORM_BUFFER",t[t.COMPUTE_SHADER_READ_TEXTURE=16384]="COMPUTE_SHADER_READ_TEXTURE",t[t.COMPUTE_SHADER_READ_OTHER=32768]="COMPUTE_SHADER_READ_OTHER",t[t.TRANSFER_READ=65536]="TRANSFER_READ",t[t.HOST_READ=131072]="HOST_READ",t[t.PRESENT=262144]="PRESENT",t[t.VERTEX_SHADER_WRITE=524288]="VERTEX_SHADER_WRITE",t[t.FRAGMENT_SHADER_WRITE=1048576]="FRAGMENT_SHADER_WRITE",t[t.COLOR_ATTACHMENT_WRITE=2097152]="COLOR_ATTACHMENT_WRITE",t[t.DEPTH_STENCIL_ATTACHMENT_WRITE=4194304]="DEPTH_STENCIL_ATTACHMENT_WRITE",t[t.COMPUTE_SHADER_WRITE=8388608]="COMPUTE_SHADER_WRITE",t[t.TRANSFER_WRITE=16777216]="TRANSFER_WRITE",t[t.HOST_PREINITIALIZED=33554432]="HOST_PREINITIALIZED",t[t.HOST_WRITE=67108864]="HOST_WRITE"}(Wc||(Wc={})),function(t){t[t.NONE=0]="NONE",t[t.SAMPLE_ZERO=1]="SAMPLE_ZERO",t[t.AVERAGE=2]="AVERAGE",t[t.MIN=3]="MIN",t[t.MAX=4]="MAX"}(jc||(jc={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.RAY_TRACING=2]="RAY_TRACING"}(Xc||(Xc={})),function(t){t[t.POINT_LIST=0]="POINT_LIST",t[t.LINE_LIST=1]="LINE_LIST",t[t.LINE_STRIP=2]="LINE_STRIP",t[t.LINE_LOOP=3]="LINE_LOOP",t[t.LINE_LIST_ADJACENCY=4]="LINE_LIST_ADJACENCY",t[t.LINE_STRIP_ADJACENCY=5]="LINE_STRIP_ADJACENCY",t[t.ISO_LINE_LIST=6]="ISO_LINE_LIST",t[t.TRIANGLE_LIST=7]="TRIANGLE_LIST",t[t.TRIANGLE_STRIP=8]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=9]="TRIANGLE_FAN",t[t.TRIANGLE_LIST_ADJACENCY=10]="TRIANGLE_LIST_ADJACENCY",t[t.TRIANGLE_STRIP_ADJACENCY=11]="TRIANGLE_STRIP_ADJACENCY",t[t.TRIANGLE_PATCH_ADJACENCY=12]="TRIANGLE_PATCH_ADJACENCY",t[t.QUAD_PATCH_LIST=13]="QUAD_PATCH_LIST"}(Yc||(Yc={})),function(t){t[t.FILL=0]="FILL",t[t.POINT=1]="POINT",t[t.LINE=2]="LINE"}(qc||(qc={})),function(t){t[t.GOURAND=0]="GOURAND",t[t.FLAT=1]="FLAT"}(Kc||(Kc={})),function(t){t[t.NONE=0]="NONE",t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK"}(Qc||(Qc={})),function(t){t[t.NONE=0]="NONE",t[t.LINE_WIDTH=1]="LINE_WIDTH",t[t.DEPTH_BIAS=2]="DEPTH_BIAS",t[t.BLEND_CONSTANTS=4]="BLEND_CONSTANTS",t[t.DEPTH_BOUNDS=8]="DEPTH_BOUNDS",t[t.STENCIL_WRITE_MASK=16]="STENCIL_WRITE_MASK",t[t.STENCIL_COMPARE_MASK=32]="STENCIL_COMPARE_MASK"}(Zc||(Zc={})),function(t){t[t.FRONT=1]="FRONT",t[t.BACK=2]="BACK",t[t.ALL=3]="ALL"}(Jc||(Jc={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.UNIFORM_BUFFER=1]="UNIFORM_BUFFER",t[t.DYNAMIC_UNIFORM_BUFFER=2]="DYNAMIC_UNIFORM_BUFFER",t[t.STORAGE_BUFFER=4]="STORAGE_BUFFER",t[t.DYNAMIC_STORAGE_BUFFER=8]="DYNAMIC_STORAGE_BUFFER",t[t.SAMPLER_TEXTURE=16]="SAMPLER_TEXTURE",t[t.SAMPLER=32]="SAMPLER",t[t.TEXTURE=64]="TEXTURE",t[t.STORAGE_IMAGE=128]="STORAGE_IMAGE",t[t.INPUT_ATTACHMENT=256]="INPUT_ATTACHMENT"}($c||($c={})),function(t){t[t.GRAPHICS=0]="GRAPHICS",t[t.COMPUTE=1]="COMPUTE",t[t.TRANSFER=2]="TRANSFER"}(t_||(t_={})),function(t){t[t.OCCLUSION=0]="OCCLUSION",t[t.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",t[t.TIMESTAMP=2]="TIMESTAMP"}(e_||(e_={})),function(t){t[t.PRIMARY=0]="PRIMARY",t[t.SECONDARY=1]="SECONDARY"}(i_||(i_={})),function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.DEPTH=2]="DEPTH",t[t.STENCIL=4]="STENCIL",t[t.DEPTH_STENCIL=6]="DEPTH_STENCIL",t[t.ALL=7]="ALL"}(n_||(n_={})),function(t){t[t.FULL=0]="FULL",t[t.SPLIT_BEGIN=1]="SPLIT_BEGIN",t[t.SPLIT_END=2]="SPLIT_END"}(r_||(r_={})),function(t){t[t.RASTER=0]="RASTER",t[t.COMPUTE=1]="COMPUTE",t[t.COPY=2]="COPY",t[t.MOVE=3]="MOVE",t[t.RAYTRACE=4]="RAYTRACE",t[t.PRESENT=5]="PRESENT"}(s_||(s_={}));var a_,h_=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}(),u_=function(){function t(t,e,i,n,r,s,o,a,h,u,l,c,_,f,d,p,m,g,y,v,S,A,T,b){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===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=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 h_),void 0===v&&(v=new h_),void 0===S&&(S=!1),void 0===A&&(A=-1),void 0===T&&(T=1),void 0===b&&(b=1),this.maxVertexAttributes=t,this.maxVertexUniformVectors=e,this.maxFragmentUniformVectors=i,this.maxTextureUnits=n,this.maxImageUnits=r,this.maxVertexTextureUnits=s,this.maxColorRenderTargets=o,this.maxShaderStorageBufferBindings=a,this.maxShaderStorageBlockSize=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSize=l,this.maxTextureSize=c,this.maxCubeMapTextureSize=_,this.maxArrayTextureLayers=f,this.max3DTextureSize=d,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=m,this.maxComputeWorkGroupInvocations=g,this.maxComputeWorkGroupSize=y,this.maxComputeWorkGroupCount=v,this.supportQuery=S,this.clipSpaceMinZ=A,this.screenSpaceSignY=T,this.clipSpaceSignY=b}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.clipSpaceMinZ=t.clipSpaceMinZ,this.screenSpaceSignY=t.screenSpaceSignY,this.clipSpaceSignY=t.clipSpaceSignY,this},t}(),l_=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}(),c_=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}(),__=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}(),f_=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}(),d_=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}(),p_=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}(),m_=function(){function t(t,e,i,n,r){void 0===t&&(t=new d_),void 0===e&&(e=new c_),void 0===i&&(i=new d_),void 0===n&&(n=new c_),void 0===r&&(r=new f_),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}(),g_=function(){function t(t,e,i,n,r,s){void 0===t&&(t=new d_),void 0===e&&(e=new c_),void 0===i&&(i=new f_),void 0===n&&(n=new d_),void 0===r&&(r=new c_),void 0===s&&(s=new f_),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}(),y_=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 c_),void 0===r&&(r=new f_),void 0===s&&(s=new d_),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}(),v_=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}(),S_=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}(),A_=function(){function t(t,e,i,n,r,s,o,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===o&&(o=[0]),void 0===a&&(a=[0]),this.maxBlockCounts=t,this.maxSamplerTextureCounts=e,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=o,this.setIndices=a}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}(),T_=function(){function t(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=Bc.ON),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}(),b_=function(){function t(t){void 0===t&&(t=new A_),this.bindingMappingInfo=t}return t.prototype.copy=function(t){return this.bindingMappingInfo.copy(t.bindingMappingInfo),this},t}(),E_=function(){function t(t,e,i,n,r){void 0===t&&(t=Ec.NONE),void 0===e&&(e=wc.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=Cc.NONE),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}(),C_=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}(),x_=function(){function t(t,e,i,n,r,s,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===o&&(o=0),this.vertexCount=t,this.firstVertex=e,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=o}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}(),w_=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 o_(this.drawInfos,t.drawInfos,x_),this},t}(),R_=function(){function t(t,e,i,n,r,s,o,a,h,u,l){void 0===t&&(t=Dc.TEX2D),void 0===e&&(e=Rc.NONE),void 0===i&&(i=Ac.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=Ic.NONE),void 0===o&&(o=1),void 0===a&&(a=1),void 0===h&&(h=Pc.X1),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=o,this.levelCount=a,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}(),I_=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=null),void 0===e&&(e=Dc.TEX2D),void 0===i&&(i=Ac.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===o&&(o=1),this.texture=t,this.type=e,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=o}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},t}(),M_=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=Oc.LINEAR),void 0===e&&(e=Oc.LINEAR),void 0===i&&(i=Oc.NONE),void 0===n&&(n=Lc.WRAP),void 0===r&&(r=Lc.WRAP),void 0===s&&(s=Lc.WRAP),void 0===o&&(o=0),void 0===a&&(a=Nc.ALWAYS),this.minFilter=t,this.magFilter=e,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=o,this.cmpFunc=a}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}(),P_=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=bc.UNKNOWN),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}(),B_=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,o_(this.members,t.members,P_),this.count=t.count,this.flattened=t.flattened,this},t}(),O_=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=bc.UNKNOWN),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}(),L_=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}(),N_=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=bc.UNKNOWN),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}(),F_=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=""),void 0===n&&(n=bc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=xc.READ_WRITE),void 0===o&&(o=0),this.set=t,this.binding=e,this.name=i,this.type=n,this.count=r,this.memoryAccess=s,this.flattened=o}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}(),k_=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=xc.READ_WRITE),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}(),V_=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}(),G_=function(){function t(t,e){void 0===t&&(t=Uc.NONE),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}(),U_=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=Ac.UNKNOWN),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}(),z_=function(){function t(t,e,i,n,r,s,o,a,h,u){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===o&&(o=[]),void 0===a&&(a=[]),void 0===h&&(h=[]),void 0===u&&(u=[]),this.name=t,this.stages=e,this.attributes=i,this.blocks=n,this.buffers=r,this.samplerTextures=s,this.samplers=o,this.textures=a,this.images=h,this.subpassInputs=u}return t.prototype.copy=function(t){return this.name=t.name,o_(this.stages,t.stages,G_),o_(this.attributes,t.attributes,U_),o_(this.blocks,t.blocks,B_),o_(this.buffers,t.buffers,k_),o_(this.samplerTextures,t.samplerTextures,O_),o_(this.samplers,t.samplers,L_),o_(this.textures,t.textures,N_),o_(this.images,t.images,F_),o_(this.subpassInputs,t.subpassInputs,V_),this},t}(),H_=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 o_(this.attributes,t.attributes,U_),this.vertexBuffers=t.vertexBuffers.slice(),this.indexBuffer=t.indexBuffer,this.indirectBuffer=t.indirectBuffer,this},t}(),W_=function(){function t(t,e,i,n,r){void 0===t&&(t=Ac.UNKNOWN),void 0===e&&(e=Pc.X1),void 0===i&&(i=zc.CLEAR),void 0===n&&(n=Hc.STORE),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}(),j_=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=Ac.UNKNOWN),void 0===e&&(e=Pc.X1),void 0===i&&(i=zc.CLEAR),void 0===n&&(n=Hc.STORE),void 0===r&&(r=zc.CLEAR),void 0===s&&(s=Hc.STORE),void 0===o&&(o=null),this.format=t,this.sampleCount=e,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=o}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}(),X_=function(){function t(t,e,i,n,r,s,o,a){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===o&&(o=jc.NONE),void 0===a&&(a=jc.NONE),this.inputs=t,this.colors=e,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.depthResolveMode=o,this.stencilResolveMode=a}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.depthResolveMode=t.depthResolveMode,this.stencilResolveMode=t.stencilResolveMode,this},t}(),Y_=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=[Wc.NONE]),void 0===r&&(r=[Wc.NONE]),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.slice(),this.nextAccesses=t.nextAccesses.slice(),this},t}(),q_=function(){function t(t,e,i,n,r){void 0===t&&(t=[]),void 0===e&&(e=null),void 0===i&&(i=null),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 o_(this.colorAttachments,t.colorAttachments,W_),t.depthStencilAttachment&&this.depthStencilAttachment&&this.depthStencilAttachment.copy(t.depthStencilAttachment),t.depthStencilResolveAttachment&&this.depthStencilResolveAttachment&&this.depthStencilResolveAttachment.copy(t.depthStencilResolveAttachment),o_(this.subpasses,t.subpasses,X_),o_(this.dependencies,t.dependencies,Y_),this},t}(),K_=function(){function t(t,e,i){void 0===t&&(t=Wc.NONE),void 0===e&&(e=Wc.NONE),void 0===i&&(i=r_.FULL),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}(),Q_=function(){function t(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=Wc.NONE),void 0===e&&(e=Wc.NONE),void 0===i&&(i=r_.FULL),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===o&&(o=1),void 0===a&&(a=!1),void 0===h&&(h=null),void 0===u&&(u=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.baseMipLevel=n,this.levelCount=r,this.baseSlice=s,this.sliceCount=o,this.discardContents=a,this.srcQueue=h,this.dstQueue=u}return t.prototype.copy=function(t){return this.prevAccesses=t.prevAccesses,this.nextAccesses=t.nextAccesses,this.type=t.type,this.baseMipLevel=t.baseMipLevel,this.levelCount=t.levelCount,this.baseSlice=t.baseSlice,this.sliceCount=t.sliceCount,this.discardContents=t.discardContents,this.srcQueue=t.srcQueue,this.dstQueue=t.dstQueue,this},t}(),Z_=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=Wc.NONE),void 0===e&&(e=Wc.NONE),void 0===i&&(i=r_.FULL),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=!1),void 0===o&&(o=null),void 0===a&&(a=null),this.prevAccesses=t,this.nextAccesses=e,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=o,this.dstQueue=a}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}(),J_=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}(),$_=function(){function t(t,e,i,n,r){void 0===t&&(t=-1),void 0===e&&(e=$c.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=Uc.NONE),void 0===r&&(r=[]),this.binding=t,this.descriptorType=e,this.count=i,this.stageFlags=n,this.immutableSamplers=r}return t.prototype.copy=function(t){return this.binding=t.binding,this.descriptorType=t.descriptorType,this.count=t.count,this.stageFlags=t.stageFlags,this.immutableSamplers=t.immutableSamplers.slice(),this},t}(),tf=function(){function t(t){void 0===t&&(t=[]),this.bindings=t}var e=t.prototype;return e.copy=function(t){return o_(this.bindings,t.bindings,$_),this},e.reset=function(){this.bindings.length=0},t}(),ef=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}(),nf=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}(),rf=function(){function t(t){void 0===t&&(t=[]),this.attributes=t}return t.prototype.copy=function(t){return o_(this.attributes,t.attributes,U_),this},t}(),sf=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=i_.PRIMARY),this.queue=t,this.type=e}return t.prototype.copy=function(t){return this.queue=t.queue,this.type=t.type,this},t}(),of=function(){function t(t){void 0===t&&(t=t_.GRAPHICS),this.type=t}return t.prototype.copy=function(t){return this.type=t.type,this},t}(),af=function(){function t(t,e,i){void 0===t&&(t=e_.OCCLUSION),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}(),hf=function(t,e,i,n,r,s,o,a){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=Tc.NONE),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),this.name=t,this.size=e,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=o,this.isCompressed=a},uf=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}(),lf=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}(),cf=function(){function t(t,e,i,n,r,s,o,a,h,u,l){void 0===t&&(t=new v_),void 0===e&&(e=new __),void 0===i&&(i=new S_),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=new lf),void 0===l&&(l=new lf),this.viewport=t,this.scissor=e,this.blendConstant=i,this.lineWidth=n,this.depthBiasConstant=r,this.depthBiasClamp=s,this.depthBiasSlope=o,this.depthMinBounds=a,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}(),_f=function(t){function e(i){var n;return(n=t.call(this)||this)._objectType=mc.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=e._idTable[mc.UNKNOWN]++,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}(fc);_f._idTable=Array(mc.COUNT).fill(65536),function(t){t.ATTR_POSITION="a_position",t.ATTR_NORMAL="a_normal",t.ATTR_TANGENT="a_tangent",t.ATTR_BITANGENT="a_bitangent",t.ATTR_WEIGHTS="a_weights",t.ATTR_JOINTS="a_joints",t.ATTR_COLOR="a_color",t.ATTR_COLOR1="a_color1",t.ATTR_COLOR2="a_color2",t.ATTR_TEX_COORD="a_texCoord",t.ATTR_TEX_COORD1="a_texCoord1",t.ATTR_TEX_COORD2="a_texCoord2",t.ATTR_TEX_COORD3="a_texCoord3",t.ATTR_TEX_COORD4="a_texCoord4",t.ATTR_TEX_COORD5="a_texCoord5",t.ATTR_TEX_COORD6="a_texCoord6",t.ATTR_TEX_COORD7="a_texCoord7",t.ATTR_TEX_COORD8="a_texCoord8",t.ATTR_BATCH_ID="a_batch_id",t.ATTR_BATCH_UV="a_batch_uv"}(a_||(a_={}));var ff=Object.freeze([new hf("UNKNOWN",0,0,Tc.NONE,!1,!1,!1,!1),new hf("A8",1,1,Tc.UNORM,!0,!1,!1,!1),new hf("L8",1,1,Tc.UNORM,!1,!1,!1,!1),new hf("LA8",1,2,Tc.UNORM,!0,!1,!1,!1),new hf("R8",1,1,Tc.UNORM,!1,!1,!1,!1),new hf("R8SN",1,1,Tc.SNORM,!1,!1,!1,!1),new hf("R8UI",1,1,Tc.UINT,!1,!1,!1,!1),new hf("R8I",1,1,Tc.INT,!1,!1,!1,!1),new hf("R16F",2,1,Tc.FLOAT,!1,!1,!1,!1),new hf("R16UI",2,1,Tc.UINT,!1,!1,!1,!1),new hf("R16I",2,1,Tc.INT,!1,!1,!1,!1),new hf("R32F",4,1,Tc.FLOAT,!1,!1,!1,!1),new hf("R32UI",4,1,Tc.UINT,!1,!1,!1,!1),new hf("R32I",4,1,Tc.INT,!1,!1,!1,!1),new hf("RG8",2,2,Tc.UNORM,!1,!1,!1,!1),new hf("RG8SN",2,2,Tc.SNORM,!1,!1,!1,!1),new hf("RG8UI",2,2,Tc.UINT,!1,!1,!1,!1),new hf("RG8I",2,2,Tc.INT,!1,!1,!1,!1),new hf("RG16F",4,2,Tc.FLOAT,!1,!1,!1,!1),new hf("RG16UI",4,2,Tc.UINT,!1,!1,!1,!1),new hf("RG16I",4,2,Tc.INT,!1,!1,!1,!1),new hf("RG32F",8,2,Tc.FLOAT,!1,!1,!1,!1),new hf("RG32UI",8,2,Tc.UINT,!1,!1,!1,!1),new hf("RG32I",8,2,Tc.INT,!1,!1,!1,!1),new hf("RGB8",3,3,Tc.UNORM,!1,!1,!1,!1),new hf("SRGB8",3,3,Tc.UNORM,!1,!1,!1,!1),new hf("RGB8SN",3,3,Tc.SNORM,!1,!1,!1,!1),new hf("RGB8UI",3,3,Tc.UINT,!1,!1,!1,!1),new hf("RGB8I",3,3,Tc.INT,!1,!1,!1,!1),new hf("RGB16F",6,3,Tc.FLOAT,!1,!1,!1,!1),new hf("RGB16UI",6,3,Tc.UINT,!1,!1,!1,!1),new hf("RGB16I",6,3,Tc.INT,!1,!1,!1,!1),new hf("RGB32F",12,3,Tc.FLOAT,!1,!1,!1,!1),new hf("RGB32UI",12,3,Tc.UINT,!1,!1,!1,!1),new hf("RGB32I",12,3,Tc.INT,!1,!1,!1,!1),new hf("RGBA8",4,4,Tc.UNORM,!0,!1,!1,!1),new hf("BGRA8",4,4,Tc.UNORM,!0,!1,!1,!1),new hf("SRGB8_A8",4,4,Tc.UNORM,!0,!1,!1,!1),new hf("RGBA8SN",4,4,Tc.SNORM,!0,!1,!1,!1),new hf("RGBA8UI",4,4,Tc.UINT,!0,!1,!1,!1),new hf("RGBA8I",4,4,Tc.INT,!0,!1,!1,!1),new hf("RGBA16F",8,4,Tc.FLOAT,!0,!1,!1,!1),new hf("RGBA16UI",8,4,Tc.UINT,!0,!1,!1,!1),new hf("RGBA16I",8,4,Tc.INT,!0,!1,!1,!1),new hf("RGBA32F",16,4,Tc.FLOAT,!0,!1,!1,!1),new hf("RGBA32UI",16,4,Tc.UINT,!0,!1,!1,!1),new hf("RGBA32I",16,4,Tc.INT,!0,!1,!1,!1),new hf("R5G6B5",2,3,Tc.UNORM,!1,!1,!1,!1),new hf("R11G11B10F",4,3,Tc.FLOAT,!1,!1,!1,!1),new hf("RGB5A1",2,4,Tc.UNORM,!0,!1,!1,!1),new hf("RGBA4",2,4,Tc.UNORM,!0,!1,!1,!1),new hf("RGB10A2",2,4,Tc.UNORM,!0,!1,!1,!1),new hf("RGB10A2UI",2,4,Tc.UINT,!0,!1,!1,!1),new hf("RGB9E5",2,4,Tc.FLOAT,!0,!1,!1,!1),new hf("DEPTH",4,1,Tc.FLOAT,!1,!0,!1,!1),new hf("DEPTH_STENCIL",5,2,Tc.FLOAT,!1,!0,!0,!1),new hf("BC1",1,3,Tc.UNORM,!1,!1,!1,!0),new hf("BC1_ALPHA",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC1_SRGB",1,3,Tc.UNORM,!1,!1,!1,!0),new hf("BC1_SRGB_ALPHA",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC2",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC2_SRGB",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC3",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC3_SRGB",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC4",1,1,Tc.UNORM,!1,!1,!1,!0),new hf("BC4_SNORM",1,1,Tc.SNORM,!1,!1,!1,!0),new hf("BC5",1,2,Tc.UNORM,!1,!1,!1,!0),new hf("BC5_SNORM",1,2,Tc.SNORM,!1,!1,!1,!0),new hf("BC6H_UF16",1,3,Tc.UFLOAT,!1,!1,!1,!0),new hf("BC6H_SF16",1,3,Tc.FLOAT,!1,!1,!1,!0),new hf("BC7",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("BC7_SRGB",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ETC_RGB8",1,3,Tc.UNORM,!1,!1,!1,!0),new hf("ETC2_RGB8",1,3,Tc.UNORM,!1,!1,!1,!0),new hf("ETC2_SRGB8",1,3,Tc.UNORM,!1,!1,!1,!0),new hf("ETC2_RGB8_A1",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ETC2_SRGB8_A1",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ETC2_RGBA8",2,4,Tc.UNORM,!0,!1,!1,!0),new hf("ETC2_SRGB8_A8",2,4,Tc.UNORM,!0,!1,!1,!0),new hf("EAC_R11",1,1,Tc.UNORM,!1,!1,!1,!0),new hf("EAC_R11SN",1,1,Tc.SNORM,!1,!1,!1,!0),new hf("EAC_RG11",2,2,Tc.UNORM,!1,!1,!1,!0),new hf("EAC_RG11SN",2,2,Tc.SNORM,!1,!1,!1,!0),new hf("PVRTC_RGB2",2,3,Tc.UNORM,!1,!1,!1,!0),new hf("PVRTC_RGBA2",2,4,Tc.UNORM,!0,!1,!1,!0),new hf("PVRTC_RGB4",2,3,Tc.UNORM,!1,!1,!1,!0),new hf("PVRTC_RGBA4",2,4,Tc.UNORM,!0,!1,!1,!0),new hf("PVRTC2_2BPP",2,4,Tc.UNORM,!0,!1,!1,!0),new hf("PVRTC2_4BPP",2,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_4x4",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_5x4",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_5x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_6x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_6x6",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_8x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_8x6",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_8x8",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_10x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_10x6",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_10x8",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_10x10",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_12x10",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_RGBA_12x12",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_4x4",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_5x4",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_5x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_6x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_6x6",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_8x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_8x6",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_8x8",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_10x5",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_10x6",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_10x8",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_10x10",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_12x10",1,4,Tc.UNORM,!0,!1,!1,!0),new hf("ASTC_SRGBA_12x12",1,4,Tc.UNORM,!0,!1,!1,!0)]),df=$c.UNIFORM_BUFFER|$c.DYNAMIC_UNIFORM_BUFFER|$c.STORAGE_BUFFER|$c.DYNAMIC_STORAGE_BUFFER,pf=$c.SAMPLER_TEXTURE|$c.SAMPLER|$c.TEXTURE|$c.STORAGE_IMAGE|$c.INPUT_ATTACHMENT,mf=$c.DYNAMIC_STORAGE_BUFFER|$c.DYNAMIC_UNIFORM_BUFFER;function gf(t){return t>0&&0==(t&t-1)}function yf(t,e,i,n){if(!ff[t].isCompressed)return e*i*n*ff[t].size;switch(t){case Ac.BC1:case Ac.BC1_ALPHA:case Ac.BC1_SRGB:case Ac.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case Ac.BC2:case Ac.BC2_SRGB:case Ac.BC3:case Ac.BC3_SRGB:case Ac.BC4:case Ac.BC4_SNORM:case Ac.BC6H_SF16:case Ac.BC6H_UF16:case Ac.BC7:case Ac.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case Ac.BC5:case Ac.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case Ac.ETC_RGB8:case Ac.ETC2_RGB8:case Ac.ETC2_SRGB8:case Ac.ETC2_RGB8_A1:case Ac.EAC_R11:case Ac.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case Ac.ETC2_RGBA8:case Ac.ETC2_SRGB8_A1:case Ac.EAC_RG11:case Ac.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case Ac.PVRTC_RGB2:case Ac.PVRTC_RGBA2:case Ac.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case Ac.PVRTC_RGB4:case Ac.PVRTC_RGBA4:case Ac.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case Ac.ASTC_RGBA_4X4:case Ac.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case Ac.ASTC_RGBA_5X4:case Ac.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case Ac.ASTC_RGBA_5X5:case Ac.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case Ac.ASTC_RGBA_6X5:case Ac.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case Ac.ASTC_RGBA_6X6:case Ac.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case Ac.ASTC_RGBA_8X5:case Ac.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case Ac.ASTC_RGBA_8X6:case Ac.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case Ac.ASTC_RGBA_8X8:case Ac.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case Ac.ASTC_RGBA_10X5:case Ac.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case Ac.ASTC_RGBA_10X6:case Ac.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case Ac.ASTC_RGBA_10X8:case Ac.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case Ac.ASTC_RGBA_10X10:case Ac.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case Ac.ASTC_RGBA_12X10:case Ac.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case Ac.ASTC_RGBA_12X12:case Ac.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function vf(t,e,i,n,r){for(var s=0,o=0;o<r;++o)s+=yf(t,e,i,n),e=Math.max(e>>1,1),i=Math.max(i>>1,1);return s}var Sf=[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 Af(t){return Sf[t]||0}function Tf(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case Tc.UNORM:case Tc.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Tc.SNORM:case Tc.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Tc.FLOAT:switch(e){case 2:return Uint16Array;case 4:default:return Float32Array}}return Float32Array}function bf(t){switch(t){case Ac.BC1:case Ac.BC1_ALPHA:case Ac.BC1_SRGB:case Ac.BC1_SRGB_ALPHA:case Ac.BC2:case Ac.BC2_SRGB:case Ac.BC3:case Ac.BC3_SRGB:case Ac.BC4:case Ac.BC4_SNORM:case Ac.BC6H_SF16:case Ac.BC6H_UF16:case Ac.BC7:case Ac.BC7_SRGB:case Ac.BC5:case Ac.BC5_SNORM:case Ac.ETC_RGB8:case Ac.ETC2_RGB8:case Ac.ETC2_SRGB8:case Ac.ETC2_RGB8_A1:case Ac.EAC_R11:case Ac.EAC_R11SN:case Ac.ETC2_RGBA8:case Ac.ETC2_SRGB8_A1:case Ac.EAC_RG11:case Ac.EAC_RG11SN:return{width:4,height:4};case Ac.PVRTC_RGB2:case Ac.PVRTC_RGBA2:case Ac.PVRTC2_2BPP:return{width:8,height:4};case Ac.PVRTC_RGB4:case Ac.PVRTC_RGBA4:case Ac.PVRTC2_4BPP:return{width:4,height:4};case Ac.ASTC_RGBA_4X4:case Ac.ASTC_SRGBA_4X4:return{width:4,height:4};case Ac.ASTC_RGBA_5X4:case Ac.ASTC_SRGBA_5X4:return{width:5,height:4};case Ac.ASTC_RGBA_5X5:case Ac.ASTC_SRGBA_5X5:return{width:5,height:5};case Ac.ASTC_RGBA_6X5:case Ac.ASTC_SRGBA_6X5:return{width:6,height:5};case Ac.ASTC_RGBA_6X6:case Ac.ASTC_SRGBA_6X6:return{width:6,height:6};case Ac.ASTC_RGBA_8X5:case Ac.ASTC_SRGBA_8X5:return{width:8,height:5};case Ac.ASTC_RGBA_8X6:case Ac.ASTC_SRGBA_8X6:return{width:8,height:6};case Ac.ASTC_RGBA_8X8:case Ac.ASTC_SRGBA_8X8:return{width:8,height:8};case Ac.ASTC_RGBA_10X5:case Ac.ASTC_SRGBA_10X5:return{width:10,height:5};case Ac.ASTC_RGBA_10X6:case Ac.ASTC_SRGBA_10X6:return{width:10,height:6};case Ac.ASTC_RGBA_10X8:case Ac.ASTC_SRGBA_10X8:return{width:10,height:8};case Ac.ASTC_RGBA_10X10:case Ac.ASTC_SRGBA_10X10:return{width:10,height:10};case Ac.ASTC_RGBA_12X10:case Ac.ASTC_SRGBA_12X10:return{width:12,height:10};case Ac.ASTC_RGBA_12X12:case Ac.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function Ef(t,e){return Math.ceil(t/e)*e}var Cf=Object.freeze({__proto__:null,get ObjectType(){return mc},get Status(){return gc},get API(){return yc},get SurfaceTransform(){return vc},get Feature(){return Sc},get Format(){return Ac},get FormatType(){return Tc},get Type(){return bc},get BufferUsageBit(){return Ec},get BufferFlagBit(){return Cc},get MemoryAccessBit(){return xc},get MemoryUsageBit(){return wc},get TextureType(){return Dc},get TextureUsageBit(){return Rc},get TextureFlagBit(){return Ic},get FormatFeatureBit(){return Mc},get SampleCount(){return Pc},get VsyncMode(){return Bc},get Filter(){return Oc},get Address(){return Lc},get ComparisonFunc(){return Nc},get StencilOp(){return Fc},get BlendFactor(){return kc},get BlendOp(){return Vc},get ColorMask(){return Gc},get ShaderStageFlagBit(){return Uc},get LoadOp(){return zc},get StoreOp(){return Hc},get AccessFlagBit(){return Wc},get ResolveMode(){return jc},get PipelineBindPoint(){return Xc},get PrimitiveMode(){return Yc},get PolygonMode(){return qc},get ShadeModel(){return Kc},get CullMode(){return Qc},get DynamicStateFlagBit(){return Zc},get StencilFace(){return Jc},get DescriptorType(){return $c},get QueueType(){return t_},get QueryType(){return e_},get CommandBufferType(){return i_},get ClearFlagBit(){return n_},get BarrierType(){return r_},get PassType(){return s_},Size:h_,DeviceCaps:u_,DeviceOptions:l_,Offset:c_,Rect:__,Extent:f_,TextureSubresLayers:d_,TextureSubresRange:p_,TextureCopy:m_,TextureBlit:g_,BufferTextureCopy:y_,Viewport:v_,Color:S_,BindingMappingInfo:A_,SwapchainInfo:T_,DeviceInfo:b_,BufferInfo:E_,BufferViewInfo:C_,DrawInfo:x_,DispatchInfo:w_,IndirectBuffer:D_,TextureInfo:R_,TextureViewInfo:I_,SamplerInfo:M_,Uniform:P_,UniformBlock:B_,UniformSamplerTexture:O_,UniformSampler:L_,UniformTexture:N_,UniformStorageImage:F_,UniformStorageBuffer:k_,UniformInputAttachment:V_,ShaderStage:G_,Attribute:U_,ShaderInfo:z_,InputAssemblerInfo:H_,ColorAttachment:W_,DepthStencilAttachment:j_,SubpassInfo:X_,SubpassDependency:Y_,RenderPassInfo:q_,GeneralBarrierInfo:K_,TextureBarrierInfo:Q_,BufferBarrierInfo:Z_,FramebufferInfo:J_,DescriptorSetLayoutBinding:$_,DescriptorSetLayoutInfo:tf,DescriptorSetInfo:ef,PipelineLayoutInfo:nf,InputState:rf,CommandBufferInfo:sf,QueueInfo:of,QueryPoolInfo:af,FormatInfo:hf,MemoryStatus:uf,DynamicStencilStates:lf,DynamicStates:cf,GFXObject:_f,get AttributeName(){return a_},FormatInfos:ff,DESCRIPTOR_BUFFER_TYPE:df,DESCRIPTOR_SAMPLER_TYPE:pf,DESCRIPTOR_DYNAMIC_TYPE:mf,DRAW_INFO_SIZE:28,IsPowerOf2:gf,FormatSize:yf,FormatSurfaceSize:vf,GetTypeSize:Af,getTypedArrayConstructor:Tf,formatAlignment:bf,alignTo:Ef}),xf=function(t){function e(){var e;return(e=t.call(this,mc.BUFFER)||this)._usage=Ec.NONE,e._memUsage=wc.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Cc.NONE,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}(_f),wf=function(t){function e(){var e;return(e=t.call(this,mc.COMMAND_BUFFER)||this)._queue=null,e._type=i_.PRIMARY,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}(_f),Df=function(){function t(){this._gfxAPI=yc.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Sc.COUNT),this._formatFeatures=new Array(Ac.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new uf,this._caps=new u_,this._bindingMappingInfo=new A_,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map,this._swapchainFormat=Ac.RGBA8}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 Pc.X1},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}();Df.canvas=void 0;var Rf=function(){function t(t){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var e=new Uint8Array(64);if(e.fill(255),t.capabilities.maxTextureSize>=2){this._texture2D=t.createTexture(new R_(Dc.TEX2D,Rc.STORAGE|Rc.SAMPLED,Ac.RGBA8,2,2,Ic.NONE));var i=new y_(0,0,0,new c_(0,0,0),new f_(2,2,1));t.copyBuffersToTexture([e],this._texture2D,[i])}if(t.capabilities.maxTextureSize>=2){this._textureCube=t.createTexture(new R_(Dc.CUBE,Rc.STORAGE|Rc.SAMPLED,Ac.RGBA8,2,2,Ic.NONE,6));var n=new y_(0,0,0,new c_(0,0,0),new f_(2,2,1));t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=2,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=3,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=4,t.copyBuffersToTexture([e],this._textureCube,[n]),n.texSubres.baseArrayLayer=5,t.copyBuffersToTexture([e],this._textureCube,[n])}if(t.capabilities.max3DTextureSize>=2){this._texture3D=t.createTexture(new R_(Dc.TEX3D,Rc.STORAGE|Rc.SAMPLED,Ac.RGBA8,2,2,Ic.NONE,1,1,Pc.X1,2));var r=new y_(0,0,0,new c_(0,0,0),new f_(2,2,2),new d_(0,0,1));t.copyBuffersToTexture([e],this._texture3D,[r])}if(t.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=t.createTexture(new R_(Dc.TEX2D_ARRAY,Rc.STORAGE|Rc.SAMPLED,Ac.RGBA8,2,2,Ic.NONE,2));var s=new y_(0,0,0,new c_(0,0,0),new f_(2,2,1),new d_(0,0,1));t.copyBuffersToTexture([e],this._texture2DArray,[s]),s.texSubres.baseArrayLayer=1,t.copyBuffersToTexture([e],this._texture2DArray,[s])}}return t.prototype.getTexture=function(t){switch(t){case Dc.TEX2D:return this._texture2D;case Dc.TEX3D:return this._texture3D;case Dc.CUBE:return this._textureCube;case Dc.TEX2D_ARRAY:return this._texture2DArray;default:return null}},t}(),If=function(t){function e(){var e;return(e=t.call(this,mc.SWAPCHAIN)||this)._transform=vc.IDENTITY,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}(_f),Mf=function(t){function e(){var e;return(e=t.call(this,mc.FRAMEBUFFER)||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(){return this.colorTextures.length>0?this.colorTextures[0].width:this.depthStencilTexture?this.depthStencilTexture.width:this._width}},{key:"height",get:function(){return this.colorTextures.length>0?this.colorTextures[0].height:this.depthStencilTexture?this.depthStencilTexture.height:this._height}},{key:"needRebuild",get:function(){return!1}}]),e}(_f),Pf=function(t){function e(){var e;return(e=t.call(this,mc.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new x_,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 hc(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}(_f),Bf=function(t){function e(){var e;return(e=t.call(this,mc.DESCRIPTOR_SET)||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&df){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&pf){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,n){void 0===i&&(i=0),void 0===n&&(n=Wc.NONE);var r=this._layout.bindingIndices[t],s=this._layout.bindings[r];if(s&&s.descriptorType&pf){var o=this._layout.descriptorIndices[t];this._textures[o+i]!==e&&(this._textures[o+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}(_f),Of=function(t){function e(){var e;return(e=t.call(this,mc.DESCRIPTOR_SET_LAYOUT)||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}(_f),Lf=function(t){function e(){var e;return(e=t.call(this,mc.PIPELINE_LAYOUT)||this)._setLayouts=[],e}return s(e,t),n(e,[{key:"setLayouts",get:function(){return this._setLayouts}}]),e}(_f),Nf=function(){function t(t,e,i,n,r,s,o,a,h,u,l,c){void 0===t&&(t=!1),void 0===e&&(e=qc.FILL),void 0===i&&(i=Kc.GOURAND),void 0===n&&(n=Qc.BACK),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===o&&(o=0),void 0===a&&(a=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=o,this.depthBiasClamp=a,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=qc.FILL,this.shadeModel=Kc.GOURAND,this.cullMode=Qc.BACK,this.isFrontFaceCCW=!0,this.depthBiasEnabled=!1,this.depthBias=0,this.depthBiasClamp=0,this.depthBiasSlop=0,this.isDepthClip=!0,this.isMultisample=!1,this.lineWidth=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),Ff=function(){function t(t,e,i,n,r,s,o,a,h,u,l,c,_,f,d,p,m,g,y){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=Nc.LESS),void 0===n&&(n=!1),void 0===r&&(r=Nc.ALWAYS),void 0===s&&(s=65535),void 0===o&&(o=65535),void 0===a&&(a=Fc.KEEP),void 0===h&&(h=Fc.KEEP),void 0===u&&(u=Fc.KEEP),void 0===l&&(l=1),void 0===c&&(c=!1),void 0===_&&(_=Nc.ALWAYS),void 0===f&&(f=65535),void 0===d&&(d=65535),void 0===p&&(p=Fc.KEEP),void 0===m&&(m=Fc.KEEP),void 0===g&&(g=Fc.KEEP),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=o,this.stencilFailOpFront=a,this.stencilZFailOpFront=h,this.stencilPassOpFront=u,this.stencilRefFront=l,this.stencilTestBack=c,this.stencilFuncBack=_,this.stencilReadMaskBack=f,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=Nc.LESS,this.stencilTestFront=!1,this.stencilFuncFront=Nc.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=Fc.KEEP,this.stencilZFailOpFront=Fc.KEEP,this.stencilPassOpFront=Fc.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=Nc.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=Fc.KEEP,this.stencilZFailOpBack=Fc.KEEP,this.stencilPassOpBack=Fc.KEEP,this.stencilRefBack=1},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},n(t,[{key:"native",get:function(){return this}}]),t}(),kf=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=!1),void 0===e&&(e=kc.ONE),void 0===i&&(i=kc.ZERO),void 0===n&&(n=Vc.ADD),void 0===r&&(r=kc.ONE),void 0===s&&(s=kc.ZERO),void 0===o&&(o=Vc.ADD),void 0===a&&(a=Gc.ALL),this.blend=t,this.blendSrc=e,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=o,this.blendColorMask=a}var e=t.prototype;return e.reset=function(){this.blend=!1,this.blendSrc=kc.ONE,this.blendDst=kc.ZERO,this.blendEq=Vc.ADD,this.blendSrcAlpha=kc.ONE,this.blendDstAlpha=kc.ZERO,this.blendAlphaEq=Vc.ADD,this.blendColorMask=Gc.ALL},e.assign=function(t){Object.assign(this,t)},e.destroy=function(){},t}(),Vf=function(){function t(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=new S_),void 0===n&&(n=[new kf]),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 kf),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}(),Gf=function(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=new rf),void 0===r&&(r=new Nf),void 0===s&&(s=new Ff),void 0===o&&(o=new Vf),void 0===a&&(a=Yc.TRIANGLE_LIST),void 0===h&&(h=Zc.NONE),void 0===u&&(u=Xc.GRAPHICS),this.shader=t,this.pipelineLayout=e,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=o,this.primitive=a,this.dynamicStates=h,this.bindPoint=u},Uf=function(t){function e(){var e;return(e=t.call(this,mc.PIPELINE_STATE)||this)._shader=null,e._pipelineLayout=null,e._primitive=Yc.TRIANGLE_LIST,e._is=null,e._rs=new Nf,e._dss=new Ff,e._bs=new Vf,e._dynamicStates=Zc.NONE,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}(_f),zf=function(t){function e(){var e;return(e=t.call(this,mc.QUEUE)||this)._type=t_.GRAPHICS,e}return s(e,t),n(e,[{key:"type",get:function(){return this._type}}]),e}(_f),Hf=function(t){function e(){var e;return(e=t.call(this,mc.RENDER_PASS)||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.inputs.length;++s){var o=this._colorInfos[i.inputs[s]];t+=","+o.format+","+o.sampleCount}}if(i.depthStencil>=0){var a=this._colorInfos[i.depthStencil];t+="ds,"+a.format+","+a.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 hc(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}(_f),Wf=function(t){function e(e,i){var n;return(n=t.call(this,mc.SAMPLER)||this)._info=new M_,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|=t.maxAnisotropy<<12)|t.cmpFunc<<16},e.unpackFromHash=function(t){var e=new M_;return e.minFilter=(3&t)>>0,e.magFilter=(3&t)>>2,e.mipFilter=(3&t)>>4,e.addressU=(3&t)>>6,e.addressV=(3&t)>>8,e.addressW=(3&t)>>10,e.maxAnisotropy=(15&t)>>12,e.cmpFunc=(7&t)>>16,e},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(_f),jf=function(t){function e(){var e;return(e=t.call(this,mc.SHADER)||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}(_f),Xf=function(t){function e(){var e;return(e=t.call(this,mc.TEXTURE)||this)._info=new R_,e._viewInfo=new I_,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}(_f),Yf=function(t){function e(e,i){var n;return(n=t.call(this,mc.GLOBAL_BARRIER)||this)._info=new K_,n._hash=0,n._info.copy(e),n._hash=i,n}return s(e,t),e.computeHash=function(t){return hc(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},n(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(_f),qf=function(t){function e(e,i){var n;return(n=t.call(this,mc.TEXTURE_BARRIER)||this)._info=new Q_,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.baseMipLevel,e+=t.levelCount,e+=t.baseSlice,e+=t.sliceCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,hc(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}(_f),Kf=function(t){function e(e,i){var n;return(n=t.call(this,mc.BUFFER_BARRIER)||this)._info=new Z_,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,hc(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}(_f),Qf={Device:Df,Swapchain:If,Buffer:xf,Texture:Xf,Sampler:Wf,Shader:jf,InputAssembler:Pf,RenderPass:Hf,Framebuffer:Mf,DescriptorSet:Bf,DescriptorSetLayout:Of,PipelineLayout:Lf,PipelineState:Uf,CommandBuffer:wf,Queue:zf,GeneralBarrier:Yf,TextureBarrier:qf,BufferBarrier:Kf,RasterizerState:Nf,BlendState:Vf,BlendTarget:kf,DepthStencilState:Ff,PipelineStateInfo:Gf};Object.assign(Qf,Cf),v.gfx=Qf;var Zf,Jf,$f={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 td in $f){var ed=$f[td];!0===ed?ed=td.slice(3):!1===ed&&(ed=td),ht(v,"cc",[{name:td,newName:ed,target:v.gfx,targetName:"cc.gfx"}])}ut(v,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),ut(Sc,"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;"}]),ut(W_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),ut(j_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),ht(Df.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]),function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS",t[t.WEBGPU=4]="WEBGPU"}(Zf||(Zf={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.OPENGL=3]="OPENGL",t[t.HEADLESS=4]="HEADLESS"}(Jf||(Jf={}));var id=function(){function t(){this.initialized=!1,this._gfxDevice=void 0,this._canvas=null,this._swapchain=void 0,this._renderType=Jf.UNKNOWN,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=Me.querySettings(Re.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 b_(e);if(this._renderType===Jf.WEBGL||this._renderType===Jf.WEBGPU){var s=!!globalThis.WebGL2RenderingContext;if(globalThis.navigator.userAgent.toLowerCase(),Uo.browserType===co.UC&&(s=!1),Df.canvas=t,this._renderType===Jf.WEBGPU&&v.WebGPUDevice)return new Promise((function(t,e){i._tryInitializeWebGPUDevice(v.WebGPUDevice,r).then((function(e){i._initSwapchain(),t(e)})).catch((function(t){e(t)}))}));s&&v.WebGL2Device&&this._tryInitializeDeviceSync(v.WebGL2Device,r),v.WebGLDevice&&this._tryInitializeDeviceSync(v.WebGLDevice,r),v.EmptyDevice&&this._tryInitializeDeviceSync(v.EmptyDevice,r),this._initSwapchain()}else this._renderType===Jf.HEADLESS&&v.EmptyDevice&&(this._tryInitializeDeviceSync(v.EmptyDevice,r),this._initSwapchain());return!!this._gfxDevice||(et(16337),this._renderType=Jf.UNKNOWN,!1)},e._initSwapchain=function(){var t=new T_(1,this._canvas),e=Go.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>Zf.WEBGPU||t<Zf.AUTO)&&(t=Zf.AUTO);var e=Jf.CANVAS,i=!1;if(t===Zf.CANVAS?(e=Jf.CANVAS,i=!0):t===Zf.AUTO||t===Zf.WEBGPU?(e=this._supportWebGPU()?Jf.WEBGPU:Jf.WEBGL,i=!0):t===Zf.WEBGL?(e=Jf.WEBGL,i=!0):t===Zf.HEADLESS&&(e=Jf.HEADLESS,i=!0),!i)throw new Error(st(3820,t));return e},n(t,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),t}(),nd=new id;t("aG",Object.freeze({__proto__:null,DescriptorSet:Bf,Buffer:xf,CommandBuffer:wf,get ObjectType(){return mc},get Status(){return gc},get API(){return yc},get SurfaceTransform(){return vc},get Feature(){return Sc},get Format(){return Ac},get FormatType(){return Tc},get Type(){return bc},get BufferUsageBit(){return Ec},get BufferFlagBit(){return Cc},get MemoryAccessBit(){return xc},get MemoryUsageBit(){return wc},get TextureType(){return Dc},get TextureUsageBit(){return Rc},get TextureFlagBit(){return Ic},get FormatFeatureBit(){return Mc},get SampleCount(){return Pc},get VsyncMode(){return Bc},get Filter(){return Oc},get Address(){return Lc},get ComparisonFunc(){return Nc},get StencilOp(){return Fc},get BlendFactor(){return kc},get BlendOp(){return Vc},get ColorMask(){return Gc},get ShaderStageFlagBit(){return Uc},get LoadOp(){return zc},get StoreOp(){return Hc},get AccessFlagBit(){return Wc},get ResolveMode(){return jc},get PipelineBindPoint(){return Xc},get PrimitiveMode(){return Yc},get PolygonMode(){return qc},get ShadeModel(){return Kc},get CullMode(){return Qc},get DynamicStateFlagBit(){return Zc},get StencilFace(){return Jc},get DescriptorType(){return $c},get QueueType(){return t_},get QueryType(){return e_},get CommandBufferType(){return i_},get ClearFlagBit(){return n_},get BarrierType(){return r_},get PassType(){return s_},Size:h_,DeviceCaps:u_,DeviceOptions:l_,Offset:c_,Rect:__,Extent:f_,TextureSubresLayers:d_,TextureSubresRange:p_,TextureCopy:m_,TextureBlit:g_,BufferTextureCopy:y_,Viewport:v_,Color:S_,BindingMappingInfo:A_,SwapchainInfo:T_,DeviceInfo:b_,BufferInfo:E_,BufferViewInfo:C_,DrawInfo:x_,DispatchInfo:w_,IndirectBuffer:D_,TextureInfo:R_,TextureViewInfo:I_,SamplerInfo:M_,Uniform:P_,UniformBlock:B_,UniformSamplerTexture:O_,UniformSampler:L_,UniformTexture:N_,UniformStorageImage:F_,UniformStorageBuffer:k_,UniformInputAttachment:V_,ShaderStage:G_,Attribute:U_,ShaderInfo:z_,InputAssemblerInfo:H_,ColorAttachment:W_,DepthStencilAttachment:j_,SubpassInfo:X_,SubpassDependency:Y_,RenderPassInfo:q_,GeneralBarrierInfo:K_,TextureBarrierInfo:Q_,BufferBarrierInfo:Z_,FramebufferInfo:J_,DescriptorSetLayoutBinding:$_,DescriptorSetLayoutInfo:tf,DescriptorSetInfo:ef,PipelineLayoutInfo:nf,InputState:rf,CommandBufferInfo:sf,QueueInfo:of,QueryPoolInfo:af,FormatInfo:hf,MemoryStatus:uf,DynamicStencilStates:lf,DynamicStates:cf,GFXObject:_f,get AttributeName(){return a_},FormatInfos:ff,DESCRIPTOR_BUFFER_TYPE:df,DESCRIPTOR_SAMPLER_TYPE:pf,DESCRIPTOR_DYNAMIC_TYPE:mf,DRAW_INFO_SIZE:28,IsPowerOf2:gf,FormatSize:yf,FormatSurfaceSize:vf,GetTypeSize:Af,getTypedArrayConstructor:Tf,formatAlignment:bf,alignTo:Ef,Device:Df,DefaultResource:Rf,Swapchain:If,Framebuffer:Mf,InputAssembler:Pf,DescriptorSetLayout:Of,PipelineLayout:Lf,BlendState:Vf,BlendTarget:kf,RasterizerState:Nf,DepthStencilState:Ff,PipelineStateInfo:Gf,PipelineState:Uf,Queue:zf,RenderPass:Hf,Sampler:Wf,Shader:jf,Texture:Xf,GeneralBarrier:Yf,TextureBarrier:qf,get LegacyRenderMode(){return Zf},get RenderType(){return Jf},DeviceManager:id,deviceManager:nd}));var rd=new ln;function sd(t,e,i,n){var r=i.chunk,s=i.data,o=r.vb,a=i.vertexCount,h=t.worldMatrix,u=h.m00,l=h.m01,c=h.m02,_=h.m03,f=h.m04,d=h.m05,p=h.m06,m=h.m07,g=h.m12,y=h.m13,v=h.m14,S=h.m15;rd.set(n.r/255,n.g/255,n.b/255,n.a/255);for(var A=0,T=0;T<a;++T){var b=s[T],E=b.x,C=b.y,x=_*E+m*C+S;x=x?1/x:1,o[A+0]=(u*E+f*C+g)*x,o[A+1]=(l*E+d*C+y)*x,o[A+2]=(c*E+p*C+v)*x,ln.toArray(o,rd,A+5),A+=9}r.bufferId;for(var w=r.vertexOffset,D=r.meshBuffer,R=r.meshBuffer.iData,I=D.indexOffset,M=0,P=a/4;M<P;M++){var B=w+4*M;R[I++]=B,R[I++]=B+1,R[I++]=B+2,R[I++]=B+1,R[I++]=B+3,R[I++]=B+2}D.indexOffset+=i.indexCount,D.setDirty()}var od=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=Ot(!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=Ot(!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}(),ad=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?($(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}();ad._pipelineId=0,function(){function t(t){if(this._weakMap={},void 0===window.WeakRef)throw new Error("this platform does not support WeakRef!");if(t)for(var e in t)this._weakMap[e]=new WeakRef(t[e])}var e=t.prototype;e.add=function(t,e){return this._weakMap[t]=new WeakRef(e),e},e.has=function(t){return t in this._weakMap&&!!this._weakMap[t].deref()},e.get=function(t){return this._weakMap[t]&&this._weakMap[t].deref()},e.remove=function(t){var e=this._weakMap[t];return delete this._weakMap[t],e&&e.deref()},e.clear=function(){this._weakMap=Ot(!0)},e.forEach=function(t){for(var e in this._weakMap){var i=this.get(e);i&&t(i,e)}},e.find=function(t){for(var e in this._weakMap){var i=this.get(e);if(i&&t(i,e))return this._weakMap[e].deref()}return null},e.destroy=function(){this._weakMap={}},n(t,[{key:"count",get:function(){return Object.values(this._weakMap).filter((function(t){return t.deref()})).length}}])}();var hd,ud=new od,ld=new od,cd=new od,_d=new od,fd=new ad("normal load",[]),dd=new ad("fetch",[]),pd=new ad("transform url",[]),md=new Map;!function(t){t.UUID="uuid",t.PATH="path",t.DIR="dir",t.URL="url",t.SCENE="scene"}(hd||(hd={}));var gd,yd={default:{priority:0},preload:{maxConcurrency:6,maxRequestsPerFrame:2,priority:-1},scene:{maxConcurrency:20,maxRequestsPerFrame:20,priority:1},bundle:{maxConcurrency:20,maxRequestsPerFrame:20,priority:2},remote:{maxRetryCount:4}};!function(t){t.INTERNAL="internal",t.RESOURCES="resources",t.MAIN="main",t.START_SCENE="start-scene"}(gd||(gd={}));var vd=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.substr(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}();vd.MAX_DEAD_NUM=500,vd._taskId=0,vd._deadPool=[];var Sd="0123456789abcdef".split(""),Ad=["","","",""],Td=Ad.concat(Ad,"-",Ad,"-",Ad,"-",Ad,"-",Ad,Ad,Ad),bd=Td.map((function(t,e){return"-"===t?NaN:e})).filter(Number.isFinite);function Ed(t){var e=t.split("@")[0];if(22!==e.length)return t;Td[0]=t[0],Td[1]=t[1];for(var i=2,n=2;i<22;i+=2){var r=ke[t.charCodeAt(i)],s=ke[t.charCodeAt(i+1)];Td[bd[n++]]=Sd[r>>2],Td[bd[n++]]=Sd[(3&r)<<2|s>>4],Td[bd[n++]]=Sd[15&s]}return t.replace(e,Td.join(""))}var Cd=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function xd(t){var e=Cd.exec(t);return e?e[1]:""}function wd(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=_d.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),Id(t,e)}function Dd(t){return!!t&&(t instanceof v.SceneAsset||t instanceof v.Scene)}function Rd(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 Id(t,e){var i=vd.create({input:t,options:e}),n=[];try{for(var r,s=f(pd.sync(i));!(r=s()).done;){var o=r.value,a=o.url;o.recycle(),n.push(a)}}catch(t){for(var h,u=f(i.output);!(h=u()).done;)h.value.recycle();z(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Md,Pd,Bd,Od=Object.freeze({__proto__:null,getUuidFromURL:xd,getUrlWithUuid:wd,isScene:Dd,normalize:Rd,transform:Id,decodeUuid:Ed}),Ld=Ma,Nd=xa,Fd=t("dX",Ta("cc.Asset")((Pd=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).loaded=!0,e._native=Bd&&Bd(),e._nativeUrl="",e._file=null,e._ref=0,Object.defineProperty(c(e),"_uuid",{value:"",writable:!0}),e}s(e,t),e.deserialize=function(t){return v.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&&v.assetManager._releaseManager.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 W(st(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=wd(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=wd(this._uuid,{__nativeName__:t,nativeExt:Co(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}(uo($s)),Bd=fa(Pd.prototype,"_native",[Ld],(function(){return""})),m(Pd.prototype,"_nativeAsset",[Nd],Object.getOwnPropertyDescriptor(Pd.prototype,"_nativeAsset"),Pd.prototype),Md=Pd))||Md);Fd.prototype.createNode=null,v.Asset=Fd;var kd,Vd,Gd,Ud,zd,Hd;!function(t){t[t.RGB565=Ac.R5G6B5]="RGB565",t[t.RGB5A1=Ac.RGB5A1]="RGB5A1",t[t.RGBA4444=Ac.RGBA4]="RGBA4444",t[t.RGB888=Ac.RGB8]="RGB888",t[t.RGB32F=Ac.RGB32F]="RGB32F",t[t.RGBA8888=Ac.RGBA8]="RGBA8888",t[t.BGRA8888=Ac.BGRA8]="BGRA8888",t[t.RGBA32F=Ac.RGBA32F]="RGBA32F",t[t.A8=Ac.A8]="A8",t[t.I8=Ac.L8]="I8",t[t.AI8=Ac.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=Ac.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=Ac.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=Ac.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=Ac.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=Ac.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=Ac.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=Ac.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=Ac.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=Ac.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=Ac.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=Ac.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=Ac.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=Ac.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=Ac.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=Ac.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=Ac.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=Ac.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=Ac.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=Ac.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=Ac.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=Ac.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(kd||(kd={})),function(t){t[t.REPEAT=Lc.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=Lc.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=Lc.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=Lc.BORDER]="CLAMP_TO_BORDER"}(Vd||(Vd={})),function(t){t[t.NONE=Oc.NONE]="NONE",t[t.LINEAR=Oc.LINEAR]="LINEAR",t[t.NEAREST=Oc.POINT]="NEAREST"}(Gd||(Gd={}));var Wd=1346981187,jd=be({PVR:0,PKM:1,ASTC:2});function Xd(t,e){return t[e]<<8|t[e+1]}function Yd(t){return!!(Uo.hasFeature(Uo.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}var qd,Kd,Qd,Zd,Jd,$d,tp,ep,ip,np,rp,sp=t("e1",Ta("cc.ImageAsset")(((Hd=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=f(t);!(i=s()).done;)r+=i.value.byteLength;r+=n,e=new Uint8Array(r);var o=new DataView(e.buffer,e.byteOffset,e.byteLength);o.setUint32(0,Wd,!0),o.setUint32(4,t.length,!0);for(var a=n,h=0;h<t.length;h++){var u=t[h];if(o.setUint32(8+4*h,u.byteLength,!0),u instanceof ArrayBuffer){var l=new Uint8Array(u);e.set(l,a)}else{var c=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);e.set(c,a)}a+=u.byteLength}}catch(t){U(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)===Wd){var o=s.getUint32(4,!0),a=s.getUint32(8,!0),h=8+4*o;i.parseCompressedTexture(t,0,h,a,e,n);for(var u=h+a,l=1;l<o;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,o){switch(s){case jd.PVR:i.parsePVRTexture(t,e,n,r,o);break;case jd.PKM:i.parsePKMTexture(t,e,n,r,o);break;case jd.ASTC:i.parseASTCTexture(t,e,n,r,o)}},i.parsePVRTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Int32Array(s,i,13);if(55727696===o[0]){var a=i+o[12]+52,h=n-o.byteLength;if(n>0){var u=new Uint8Array(s,a,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,a);r.width=e>0?r.width:o[7],r.height=e>0?r.height:o[6]}else{if(559044176!==o[11])throw new Error("Invalid magic number in PVR header");var c=i+o[0],_=n-o.byteLength;if(n>0){var f=new Uint8Array(s,c,_),d=new Uint8Array(r._data.byteLength+f.byteLength);d.set(r._data),d.set(f,r._data.byteLength),r._data=d,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:o[1],r.height=e>0?r.height:o[2]}},i.parsePKMTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Uint8Array(s,i,16),a=Xd(o,6);if(0!==a&&1!==a&&3!==a)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:Xd(o,12),r.height=e>0?r.height:Xd(o,14)},i.parseASTCTexture=function(t,e,i,n,r){var s=t instanceof ArrayBuffer?t:t.buffer,o=new Uint8Array(s,i,16);if(1554098963!==o[0]+(o[1]<<8)+(o[2]<<16)+(o[3]<<24))throw new Error("Invalid magic number in ASTC header");var a=o[4],h=o[5],u=o[6];if((a<3||a>6||h<3||h>6||u<3||u>6)&&(a<4||7===a||9===a||11===a||a>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var l=function(t,e){return 4===t?kd.RGBA_ASTC_4x4:5===t?4===e?kd.RGBA_ASTC_5x4:kd.RGBA_ASTC_5x5:6===t?5===e?kd.RGBA_ASTC_6x5:kd.RGBA_ASTC_6x6:8===t?5===e?kd.RGBA_ASTC_8x5:6===e?kd.RGBA_ASTC_8x6:kd.RGBA_ASTC_8x8:10===t?5===e?kd.RGBA_ASTC_10x5:6===e?kd.RGBA_ASTC_10x6:8===e?kd.RGBA_ASTC_10x8:kd.RGBA_ASTC_10x10:10===e?kd.RGBA_ASTC_12x10:kd.RGBA_ASTC_12x12}(a,h),c=i+16,_=n-16;if(n>0){var f=new Uint8Array(s,c,_),d=new Uint8Array(r._data.byteLength+f.byteLength);d.set(r._data),d.set(f,r._data.byteLength),r._data=d,r.mipmapLevelDataSize[e]=_}else r._data=new Uint8Array(s,c);r.width=e>0?r.width:o[7]+(o[8]<<8)+(o[9]<<16),r.height=e>0?r.height:o[10]+(o[11]<<8)+(o[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=kd.RGBA8888,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,o=this.height,a=this.width,h=f(n);!(e=h()).done;){var u=e.value,l=new i({_data:new Uint8Array(r.buffer,s,u),_compressed:!0,width:a,height:o,format:this.format,mipmapLevelDataSize:[]});s+=u,l._uuid=""+this._uuid,a=Math.max(a>>1,1),o=Math.max(o>>1,1),t.push(l)}else t.push(this);return t},e.reset=function(t){Yd(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(Yd(this.data)){var e;null===(e=this.data)||void 0===e||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=nd.gfxDevice,s=e.split("_"),o=Number.MAX_VALUE,a=this._format,h="",u=Pe.SUPPORT_TEXTURE_FORMATS,l=f(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),d=i.extnames[_]||c[0],p=u.indexOf(d);if(-1!==p&&p<o){var m=c[1]?parseInt(c[1]):this._format;if(!(".astc"!==d||r&&r.getFormatFeatures(Ac.ASTC_RGBA_4X4)&Mc.SAMPLED_TEXTURE))continue;if(!(".pvr"!==d||r&&r.getFormatFeatures(Ac.PVRTC_RGBA4)&Mc.SAMPLED_TEXTURE))continue;if(!(m!==kd.RGB_ETC1&&m!==kd.RGBA_ETC1||r&&r.getFormatFeatures(Ac.ETC_RGB8)&Mc.SAMPLED_TEXTURE))continue;if(!(m!==kd.RGB_ETC2&&m!==kd.RGBA_ETC2||r&&r.getFormatFeatures(Ac.ETC2_RGB8)&Mc.SAMPLED_TEXTURE))continue;if(".webp"===d&&!Uo.hasFeature(Uo.Feature.WEBP))continue;o=p,h=d,a=m}}h?(this._setRawAsset(h),this._format=a):$(3121)},e.initDefault=function(e){if(t.prototype.initDefault.call(this,e),i._sharedPlaceHolderCanvas)this.reset(i._sharedPlaceHolderCanvas);else{var n=A.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||Yd(t)||(t.format=t.format||this._format),this.reset(t)}},{key:"data",get:function(){return(t=this._nativeData)instanceof HTMLImageElement||t instanceof HTMLCanvasElement||Yd(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>=kd.RGB_ETC1&&this._format<=kd.RGBA_ASTC_12x12||this._format>=kd.RGB_A_PVRTC_2BPPV1&&this._format<=kd.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),i}(Fd)).extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],Hd._sharedPlaceHolderCanvas=null,m((zd=Hd).prototype,"_nativeAsset",[_h],Object.getOwnPropertyDescriptor(zd.prototype,"_nativeAsset"),zd.prototype),Ud=zd))||Ud);v.ImageAsset=sp,xe(Ac);var op,ap,hp,up=new Tt("Tex"),lp=Ta("cc.TextureBase")(((rp=function(t){function e(){var e;return(e=t.call(this)||this)._format=Qd&&Qd(),e._minFilter=Zd&&Zd(),e._magFilter=Jd&&Jd(),e._mipFilter=$d&&$d(),e._wrapS=tp&&tp(),e._wrapT=ep&&ep(),e._wrapR=ip&&ip(),e._anisotropy=np&&np(),e._width=1,e._height=1,e._samplerInfo=new M_,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=up.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=hc(e._id,666),e}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){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=v.director.root)&&void 0!==e&&e.batcher2D&&v.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):et(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 nd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?kd.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===kd.RGBA_ETC1?t=kd.RGB_ETC1:t===kd.RGB_A_PVRTC_4BPPV1?t=kd.RGB_PVRTC_4BPPV1:t===kd.RGB_A_PVRTC_2BPPV1&&(t=kd.RGB_PVRTC_2BPPV1),t},n(e,[{key:"isCompressed",get:function(){return this._format>=kd.RGB_ETC1&&this._format<=kd.RGBA_ASTC_12x12||this._format>=kd.RGB_A_PVRTC_2BPPV1&&this._format<=kd.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(Fd)).PixelFormat=kd,rp.WrapMode=Vd,rp.Filter=Gd,Qd=fa((Kd=rp).prototype,"_format",[Ma],(function(){return kd.RGBA8888})),Zd=fa(Kd.prototype,"_minFilter",[Ma],(function(){return Gd.LINEAR})),Jd=fa(Kd.prototype,"_magFilter",[Ma],(function(){return Gd.LINEAR})),$d=fa(Kd.prototype,"_mipFilter",[Ma],(function(){return Gd.NONE})),tp=fa(Kd.prototype,"_wrapS",[Ma],(function(){return Vd.REPEAT})),ep=fa(Kd.prototype,"_wrapT",[Ma],(function(){return Vd.REPEAT})),ip=fa(Kd.prototype,"_wrapR",[Ma],(function(){return Vd.REPEAT})),np=fa(Kd.prototype,"_anisotropy",[Ma],(function(){return 0})),qd=Kd))||qd;v.TextureBase=lp;var cp=t("e7",Ta("cc.Script")(op=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Fd))||op);v._Script=cp;var _p=t("e8",Ta("cc.JavaScript")(ap=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(cp))||ap);v._JavaScript=_p;var fp,dp,pp,mp,gp,yp,vp,Sp=t("e9",Ta("cc.TypeScript")(hp=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(cp))||hp);v._TypeScript=Sp;var Ap,Tp,bp,Ep,Cp,xp,wp,Dp,Rp,Ip,Mp,Pp=t("dq",Ta("cc.ClickEvent")((dp=function(){function t(){this.target=pp&&pp(),this.component=mp&&mp(),this._componentId=gp&&gp(),this.handler=yp&&yp(),this.customEventData=vp&&vp()}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,o=e.length;s<o;s++){var a=e[s];a instanceof t&&a.emit(n)}};var e=t.prototype;return e.emit=function(t){var e=this.target;if(v.isValid(e)){this._genCompIdIfNeeded();var i=v.js.getClassById(this._componentId),n=e.getComponent(i);if(v.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=v.js.getClassByName(t);return v.js.getClassId(e)},e._compId2Name=function(t){var e=v.js.getClassById(t);return v.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}(),pp=fa(dp.prototype,"target",[Ma],(function(){return null})),mp=fa(dp.prototype,"component",[Ma],(function(){return""})),gp=fa(dp.prototype,"_componentId",[Ma],(function(){return""})),yp=fa(dp.prototype,"handler",[Ma],(function(){return""})),vp=fa(dp.prototype,"customEventData",[Ma],(function(){return""})),fp=dp))||fp),Bp=new Tt("Comp"),Op=$s.Flags.IsOnLoadCalled,Lp=t("dr",(Ap=Ta("cc.Component"),Tp=eh(cp),Ap(((Dp=function(t){function e(){var e;return(e=t.call(this)||this).node=Cp&&Cp(),e._enabled=xp&&xp(),e.__prefab=wp&&wp(),e._sceneGetter=null,e._id=Bp.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&&v.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),v.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(t){return t||(t=v.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=v.macro.REPEAT_FOREVER),void 0===n&&(n=0),rt(Boolean(t),1619),rt((e=e||0)>=0,1620),i=Number.isNaN(i)?v.macro.REPEAT_FOREVER:i,n=n||0;var r=v.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(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&&v.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){v.director.getScheduler().unscheduleAllForTarget(this)},n(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Lt(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=v.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 this._objFlags&Op}},{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}($s)).EventHandler=Pp,Dp._executionOrder=0,Dp._requireComponent=null,Dp.system=null,m((Ep=Dp).prototype,"__scriptAsset",[Tp],Object.getOwnPropertyDescriptor(Ep.prototype,"__scriptAsset"),Ep.prototype),Cp=fa(Ep.prototype,"node",[Ma],(function(){return null})),xp=fa(Ep.prototype,"_enabled",[Ma],(function(){return!0})),wp=fa(Ep.prototype,"__prefab",[Ma],(function(){return null})),bp=Ep))||bp));It(Lp,"_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)})),v.Component=Lp;var Np=t("dO",Ta("cc.MissingScript")((Ip=function(t){function e(){var e;return(e=t.call(this)||this)._$erialized=Mp&&Mp(),e}return s(e,t),e.safeFindClass=function(t){var e=se(t);if(e)return e;v.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){$(4600,this.node.name)},e}(Lp),Mp=fa(Ip.prototype,"_$erialized",[Ma,Ba],(function(){return null})),Rp=Ip))||Rp);v._MissingScript=Np;try{var Fp=Np.__values__;0!==Fp.length&&"_$erialized"===Fp[Fp.length-1]||(et(16338),et(16339,Fp.join(", ")))}catch(ur){et(16340,""+ur)}var kp=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 Vp(t){var e=t;return{chunks:e.chunks,document:e.document}}function Gp(t){if(t.length<16)throw new Up(st(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Up(st(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Up(st(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Up(st(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var o,a=function(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(st(13104))}(s);try{o=JSON.parse(a)}catch(t){throw new Up(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 Up(st(13102));return new kp(o,h)}var Up=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(l(Error));!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}}])}(),v.internal.parseCCONJson=Vp,v.internal.decodeCCONBinary=Gp,v.internal.CCON=kp;var zp=Ei.Attr.DELIMETER,Hp=zp+"type",Wp=zp+"default",jp=zp+"formerlySerializedAs";function Xp(t,e){if(void 0===t)return e instanceof Ei.Attr.PrimitiveType||e===vi||e===Si;var i=typeof t;return"string"===i||"number"===i||"boolean"===i}var Yp=function(t){function e(){return t.call(this,(function(t){t.clear()}),1)||this}return s(e,t),e}(ue);Yp.prototype.get=function(t,e,i,n,r){var s=this._get();return s?(s.reset(t,e,i,n,r),s):new qp(t,e,i,n,r)};var qp=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 kp?(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__,o=this._classFinder(s,t,i,n);if(!o)return this._classFinder===se&&this._reportMissingClass(s),null;var a=function(t){var i=new t;return e>=0&&(r.deserializedList[e]=i),i}(o);return this._deserializeInto(t,a,o),a},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[Sh]?e._deserialize?e._deserialize(t.content,this):v.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=Yt(i);r&&n._deserializeInto(t,e,r)}};e[Sh](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){var i=function(t){return Oe.test(he(t))}(e),n=qt(e,v.Node)||qt(e,v.Component),r=!1,s=[],o=s,a=[],h=a,u=[];return function(){var t=e.__values__;r="_$erialized"===t[t.length-1];for(var n=Ei.Attr.getClassAttrs(e),l=0;l<t.length;l++){var c=t[l],_=c;n[c+jp]&&(_=n[c+jp]);var f=Ei.getDefault(n[c+Wp]),d=n[c+Hp],p=!1;i&&(void 0!==f||d)&&(p=Xp(f,d)),p?(_!==c&&o===s&&(o=s.slice()),s.push(c),o!==s&&o.push(_)):(_!==c&&h===a&&(h=a.slice()),a.push(c),h!==a&&h.push(_),u.push(f instanceof v.ValueType&&f.constructor))}}(),function(t,e,l){for(var c=0;c<s.length;++c){var _=l[o[c]];void 0!==_&&(e[s[c]]=_)}for(var f=0;f<a.length;++f){var d=a[f],p=l[h[f]];if(void 0!==p)if(i||"object"==typeof p){var m=u[f];m?i||p?t._deserializeFastDefinedObject(e[d],p,m):e[d]=null:p?t._deserializeAndAssignField(e,p,d):e[d]=null}else e[d]=p}n&&l._id&&(e._id=l._id),r&&(e._$erialized=JSON.parse(JSON.stringify(l)),t._fillPlainObject(e._$erialized,l))}}(0,i);try{if(i===Np){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(et(16341),et(16342,r.join(", ")));var s=n;n=function(t,e,i,n){s(t,e,i,n),e._$erialized||et(16343,JSON.stringify(i))}}}catch(t){et(16344,""+t)}It(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,o=this._serializedData[n];t[i]=this._deserializeObject(o,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,t,i)}}else{var a=e.__uuid__;if(a){var h=e.__expectedType__;this.result.push(t,i,a,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===v.Vec2)return t.x=e.x||0,void(t.y=e.y||0);if(i===v.Vec3)return t.x=e.x||0,t.y=e.y||0,void(t.z=e.z||0);if(i!==v.Color){if(i===v.Size)return t.width=e.width||0,void(t.height=e.height||0);for(var n=Ei.Attr.getClassAttrs(i),r=i.__values__,s=0;s<r.length;s++){var o=r[s],a=e[o];void 0!==a||e.hasOwnProperty(o)||(a=Ei.getDefault(n[o+Wp])),"object"!=typeof a?t[o]=a:a?this._deserializeAndAssignField(t,a,o):t[o]=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}();qp.pool=new Yp;var Kp=[jn,mn,ln,In,bn,Kn,Zn,Vn];function Qp(t,e){t.x=e[1],t.y=e[2],t.z=e[3],t.w=e[4]}var Zp=[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]},Qp,Qp,function(t,e){bn.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){Vn.fromArray(t,e,1)}],Jp=t("dV",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 $p(t,e){for(var i=t[4][e[0]],n=i[0],r=new(0,n[0]),s=n[1],o=n[2],a=i[i.length-1],h=1;h<a;++h)r[s[i[h]]]=e[h];for(;h<e.length;++h){var u=s[i[h]],l=n[i[h]+o];(0,sm[l])(t,r,u,e[h])}return r}function tm(t,e,i){var n=new e;return n._deserialize?n._deserialize(i,t[0]):et(5303,Lt(e)),n}function em(t,e,i,n){n>=0?e[i]=t[5][n]:t[7][3*~n]=e}function im(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 nm(t,e,i,n){e[i]=null,t[8][n]=e}function rm(t,e,i,n){e[i]=$p(t,n)}Jp.pool=new ue((function(t){t.reset()}),5),Jp.pool.get=function(){return this._get()||new Jp};var sm=new Array(13);function om(t,e,i){return t||i(e),Object}function am(t,e,i,n,r,s,o){var a=t(e);if(!a){if(r)return void(i[n]=function(e,i,n){return function(){var r=t(n)||om(s,n,o);return e[i]=r,new r}}(i,n,e));a=om(s,e,o)}i[n]=a}function hm(t,e,i,n){for(var r=i||se,s=t[3],o=0;o<s.length;++o){var a=s[o];"string"!=typeof a?am(r,a[0],a,0,e,i,n):am(r,a,s,o,e,i,n)}}function um(t){var e=t[4];if(e)for(var i=t[3],n=0;n<e.length;++n){var r=e[n];r[0]=i[r[0]]}}function lm(t,e,i){"string"==typeof t&&(t=JSON.parse(t));var n,r=!1;if(e||(e=Jp.pool.get(),r=!0),function(t){if(Array.isArray(t)){var e=t[0];return"number"==typeof e||e instanceof cm}return!1}(t)){!function(t,e,i){var n;e.init(t),null!==(n=i)&&void 0!==n||(i={});var r=t[0],s=!1;if("object"==typeof r&&(s=r.preprocessed,r=r.version),r<1)throw new Error(st(5304,r));var o,a=i;a._version=r,a.result=e,t[0]=a,s||(hm(t,!1,i.classFinder,null!==(o=i.reportMissingClass)&&void 0!==o?o:lm.reportMissingClass),um(t))}(t,e,i);var s=t;v.game._isCloning=!0;var o=s[5],a=function(t){var e=t[5],i=t[6],n=0===i?0:i.length,r=e[e.length-1],s=e.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var o=0;o<s;++o)e[o]=$p(t,e[o]);for(var a=t[3],h=0;h<n;++h,++o){var u=i[h],l=e[o];if(u>=0){var c=a[u];e[o]=tm(t,c,l)}else(0,sm[u=~u])(t,e,o,l)}return r}(s);v.game._isCloning=!1,s[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r<s;r+=3){var o=t[r],a=e[t[r+2]],h=t[r+1];h>=0?o[i[h]]=a:o[~h]=a}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}}(s[7],o,s[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],o=t[10],a=0;a<r.length;++a){var h=r[a];"number"==typeof h&&(r[a]=e[h]);var u=s[a];"number"==typeof u&&(u=u>=0?i[u]:~u,s[a]=u);var l=o[a];"number"==typeof l&&(o[a]=n[l])}}(s),n=o[a]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||se,s=i.createAssetRefs||Uo.platform===mo.EDITOR_CORE,o=i.customEnv,a=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:v.deserialize.reportMissingClass;e.init();var u=qp.pool.get(e,r,h,o,a);v.game._isCloning=!0;var l=u.deserialize(t);return v.game._isCloning=!1,qp.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&Jp.pool.put(e),n}sm[0]=function(t,e,i,n){e[i]=n},sm[1]=em,sm[2]=im(em),sm[3]=im(nm),sm[4]=rm,sm[5]=function(t,e,i,n){var r=n[0],s=e[i];(0,Zp[r])(s,n)},sm[6]=nm,sm[7]=function(t,e,i,n){e[i].set(n)},sm[8]=function(t,e,i,n){var r=n[0],s=new Kp[r];(0,Zp[r])(s,n),e[i]=s},sm[9]=im(rm),sm[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=tm(t,r,n[1])},sm[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s<n.length;s+=3){var o=n[s],a=n[s+1],h=n[s+2];(0,sm[a])(t,r,o,h)}},sm[12]=function(t,e,i,n){for(var r=n[0],s=0;s<r.length;++s){var o=r[s],a=n[s+1];0!==a&&(0,sm[a])(t,r,s,o)}e[i]=r},lm.Details=Jp,lm.reportMissingClass=function(t){et(5302,t)};var cm=function(t){this.preprocessed=!0,this.version=t};function _m(t,e,i){return[1,0,0,[t],0,i?[e,-1]:[e],[0],0,[],[],[]]}v.deserialize=lm;var fm=new WeakMap,dm=new WeakSet,pm=new WeakSet;function mm(t,e){var i;i=Np.safeFindClass;var n,r=Jp.pool.get();try{n=lm(t,r,{classFinder:i,customEnv:e})}catch(t){throw z(t),Jp.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,o=r.uuidObjList,a=r.uuidPropList,h=r.uuidTypeList||[],u=[],l=0;l<s.length;l++){var c=s[l];u[l]={uuid:Ed(c),owner:o[l],prop:a[l],type:se(h[l])}}return fm.set(n,u),n._native&&dm.add(n),Jp.pool.put(r),n}var gm=function(){function t(){this._depends=new od}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 kp){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=mm(e,{__uuid__:t});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=t),cd.add(t+"@import",s)}catch(e){ld.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=fm.get(t),n=0,r=i.length;n<r;n++)e.deps.push(i[n].uuid);return dm.has(t)&&(e.nativeDep=t._nativeDep),e},e._parseDepsFromJson=function(t){var e=function(t){return i=(e=t)[1],e[10].map((function(t){return i[t]}));var e,i}(t);return e.forEach((function(t,i){return e[i]=Ed(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}();gm._instance=void 0;var ym,vm=gm.instance,Sm=[new y_];function Am(t){return t&&0==(t&t-1)}var Tm,bm,Em,Cm,xm,wm=Ta("cc.SimpleTexture")(ym=function(t){function e(){var e;return(e=t.call(this)||this)._gfxTexture=null,e._gfxTextureView=null,e._mipmapLevel=1,e._textureWidth=0,e._textureHeight=0,e._baseLevel=0,e._maxLevel=1e3,e}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=Sm[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,Sm):n.copyTexImagesToTexture([t],this._gfxTexture,Sm)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Pe.CLEANUP_IMAGE_CACHE)){var r=vm.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(_e(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){rt(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=Ic.NONE;this._mipFilter!==Gd.NONE&&function(t,e,i){return!(t.gfxAPI===yc.WEBGL)||Am(e)&&Am(i)}(t,this._width,this._height)&&(this._mipmapLevel=function(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(e=Ic.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Rc.SAMPLED|Rc.TRANSFER_DST|Rc.COLOR_ATTACHMENT,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}(lp))||ym;v.SimpleTexture=wm;var Dm=t("e2",(Tm=Ta("cc.Texture2D"),bm=eh([sp]),Tm((Cm=function(t){function e(){var e;return(e=t.call(this)||this)._mipmaps=xm&&xm(),e._generatedMipmaps=[],e}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=kd.RGBA8888),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 sp,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,he(sp))}},i._getGfxTextureCreateInfo=function(t){var e=new R_(Dc.TEX2D);return e.width=this._width,e.height=this._height,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new I_;return e.type=Dc.TEX2D,Object.assign(e,t),e},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new sp;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}(wm),xm=fa(Cm.prototype,"_mipmaps",[bm],(function(){return[]})),Em=Cm))||Em));v.Texture2D=Dm;var Rm=t("A",function(){function t(t,e){this._innerTextureInfos={},this._innerSpriteFrames=[],this._count=0;var i=new Im;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 o=i.width,a=i.height;if(this._x+o+2>this._width&&(this._x=2,this._y=this._nextY),this._y+a+2>this._nextY&&(this._nextY=this._y+a+2),this._nextY>this._height)return null;v.internal.dynamicAtlasManager.textureBleeding&&((o<=8||a<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,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+=o+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.removeSpriteFrame=function(t){de(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}()),Im=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=kd.RGBA8888),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 y_;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 $(16363)}},e}(Dm),Mm={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},Pm=t("dn",function(){function t(){}return t.init=function(){var e=Me.querySettings(Re.Category.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){for(var e,i=0,n=f(t);!(e=n()).done;)i|=e.value;return i},t.makeMaskExclude=function(e){return~t.makeMaskInclude(e)},t.addLayer=function(e,i){if(void 0!==i)if(i>19||i<0)$(16365);else{var n=1<<i;t.Enum[e],st(2104,e),t.Enum[e]=n,It(t.Enum,String(n),e),t.BitMask[e]=n,It(t.BitMask,String(n),e),Se.update(t.BitMask),be.update(t.Enum)}else $(16364)},t.deleteLayer=function(e){if(e>19||e<0)$(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],Se.update(t.BitMask),be.update(t.Enum)}},t.nameToLayer=function(e){return void 0===e?($(16367),-1):C(t.Enum[e])},t.layerToName=function(e){return e>31||e<0?($(16368),""):t.Enum[1<<e]},t}());Pm.Enum=be(Mm),Pm.BitMask=Se(r({},Mm)),v.Layers=Pm;var Bm,Om,Lm=function(){var t=e.prototype;function e(t){this._uiComp=null,this._opacity=1,this._localOpacity=1,this.colorDirty=!0,this._uiTransformComp=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?$(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}();$s.Flags.Destroying,v.GAME_VIEW,t("du",Bm),function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(Bm||t("du",Bm={})),t("dv",Om),function(t){t[t.NONE=0]="NONE",t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.RS=t.ROTATION|t.SCALE]="RS",t[t.TRS=t.POSITION|t.ROTATION|t.SCALE]="TRS",t[t.TRS_MASK=~t.TRS]="TRS_MASK"}(Om||t("dv",Om={})),v.internal.TransformBit=Om;var Nm,Fm,km,Vm,Gm,Um,zm,Hm,Wm,jm,Xm,Ym,qm,Km,Qm,Zm,Jm,$m,tg=t("dw",be({Static:0,Stationary:1,Movable:2}));t("dx",Nm),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.MOUSE_ENTER="mouse-enter",t.MOUSE_LEAVE="mouse-leave",t.KEY_DOWN="keydown",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.TRANSFORM_CHANGED="transform-changed",t.MOBILITY_CHANGED="mobility-changed",t.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",t.SIZE_CHANGED="size-changed",t.ANCHOR_CHANGED="anchor-changed",t.COLOR_CHANGED="color-changed",t.CHILD_ADDED="child-added",t.CHILD_REMOVED="child-removed",t.PARENT_CHANGED="parent-changed",t.NODE_DESTROYED="node-destroyed",t.LAYER_CHANGED="layer-changed",t.SIBLING_ORDER_CHANGED="sibling-order-changed",t.CHILDREN_ORDER_CHANGED="sibling-order-changed",t.ACTIVE_IN_HIERARCHY_CHANGED="active-in-hierarchy-changed",t.COMPONENT_ADDED="component-added",t.COMPONENT_REMOVED="component-removed",t.LIGHT_PROBE_CHANGED="light-probe-changed",t.LIGHT_PROBE_BAKING_CHANGED="light-probe-baking-changed",t.ACTIVE_CHANGED="active-changed"}(Nm||t("dx",Nm={}));var eg=$s.Flags.Destroying,ig=$s.Flags.DontDestroy,ng=$s.Flags.Deactivating,rg=new Tt("Node");function sg(t){return t?"string"==typeof t?oe(t):t:(et(3804),null)}var og,ag,hg,ug,lg,cg,_g,fg,dg,pg=gn(),mg=gn(),gg=Fn(),yg=Fn(),vg=Fn(),Sg=new xn,Ag=Hn(),Tg=Hn(),bg=[],Eg=Symbol("ReserveContentsForAllSyncablePrefab"),Cg=0,xg=t("dl",(Fm=Ta("cc.Node"),km=eh(mn),Vm=eh(tg),Fm((($m=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=zm&&zm(),i._children=Hm&&Hm(),i._active=Wm&&Wm(),i._components=jm&&jm(),i._prefab=Xm&&Xm(),i._scene=null,i._activeInHierarchy=!1,i._id=rg.getNewId(),i._eventProcessor=new v.NodeEventProcessor(c(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Lm(c(i)),i._static=!1,i._lpos=Ym&&Ym(),i._lrot=qm&&qm(),i._lscale=Km&&Km(),i._mobility=Qm&&Qm(),i._layer=Zm&&Zm(),i._euler=Jm&&Jm(),i._transformFlags=Om.TRS,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new mn,i._rot=new In,i._scale=new mn(1,1,1),i._mat=new Vn,i}return e._setActiveInHierarchy=function(t){this._activeInHierarchy=t},i._setScene=function(t){t._updateScene()},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 o=0;o<n.length;++o){var a=n[o];if(a instanceof e)return a}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 o=r[s];o.constructor===e&&i.push(o)}else for(var a=0;a<r.length;++a){var h=r[a];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?et(1640,this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){jt(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(Nm.PARENT_CHANGED,i),i&&!(i._objFlags&eg)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(Nm.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(Nm.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return G("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 G("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(this._parent._objFlags&ng)et(3821);else{var e=this._parent._children;t=-1!==t?t:e.length-1;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,o=0,a=i._stacks[i._stackId];a||(a=[],i._stacks.push(a)),i._stackId++,a.length=0,a[0]=this;for(var h=null,u=!1;n;)if(s=a[--n])if(!u&&t?t(s):u&&e&&e(s),a[n]=null,u){if(h===this._parent)break;if(u=!1,r)if(r[++o])a[n]=r[o],n++;else if(h&&(a[n]=h,n++,u=!0,h._parent?(o=(r=h._parent._children).indexOf(h),h=h._parent):(h=null,r=null),o<0))break}else s._children.length>0?(h=s,r=s._children,o=0,a[n]=r[o],n++):(a[n]=s,n++,u=!0);a.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=sg(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=sg(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=sg(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=sg(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=oe(t)))throw v._RF.peek()&&et(3808,t),TypeError(st(3807,t))}else{if(!t)throw TypeError(st(3804));e=t}if("function"!=typeof e)throw TypeError(st(3809));if(!qt(e,v.Component))throw TypeError(st(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 o=new e;return o.node=this,this._components.push(o),this.emit(Nm.COMPONENT_ADDED,o),this._activeInHierarchy&&v.director._nodeActivator.activateComp(o),o},e.removeComponent=function(t){if(t){var e=null;(e=t instanceof Lp?t:this.getComponent(t))&&e.destroy()}else et(3813)},e.on=function(t,e,i,n){switch(void 0===n&&(n=!1),t){case Nm.TRANSFORM_CHANGED:this._eventMask|=1;break;case Nm.ACTIVE_CHANGED: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 Nm.TRANSFORM_CHANGED:this._eventMask&=-2;break;case Nm.ACTIVE_CHANGED: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(Nm.TRANSFORM_CHANGED)&&(this._eventMask&=-2),2&this._eventMask&&!this._eventProcessor.hasEventListener(Nm.ACTIVE_CHANGED)&&(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&eg)){var e=this._components.indexOf(t);-1!==e?(this._components.splice(e,1),this.emit(Nm.COMPONENT_REMOVED,t)):t.node!==this&&et(3815)}}else et(3814)},e._updateSiblingIndex=function(){for(var t=0;t<this._children.length;++t)this._children[t]._siblingIndex=t;this.emit(Nm.CHILDREN_ORDER_CHANGED)},e._instantiate=function(t,e){return void 0===e&&(e=!1),t||(t=v.instantiate._clone(this,this)),t._prefab,t._parent=null,t._onBatchCreated(e),t},e._onHierarchyChangedBase=function(){var t=this._parent;!this._persistNode||t instanceof v.Scene||v.game.removePersistRootNode(this);var e=this._active&&!(!t||!t._activeInHierarchy);this._activeInHierarchy!==e&&v.director._nodeActivator.activateNode(this,e)},e._onPreDestroyBase=function(){this._objFlags|=eg;var t=this._parent,e=!!t&&0!=(t._objFlags&eg);if(this._persistNode&&v.game.removePersistRootNode(this),!e&&t){this.emit(Nm.PARENT_CHANGED,this);var i=t._children.indexOf(this);t._children.splice(i,1),this._siblingIndex=0,t._updateSiblingIndex(),t.emit&&t.emit(Nm.CHILD_REMOVED,this)}this.emit(Nm.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,o=0;o<s.length;++o)s[o]._destroyImmediate();return e},i.isNode=function(t){return t instanceof i&&(t.constructor===i||!(t instanceof v.Scene))},e._onPreDestroy=function(){return this._onPreDestroyBase()},e[vh]=function(t){t.writeThis()},e._onSetParent=function(t,e){if(void 0===e&&(e=!1),this._parent&&(null!=t&&t._scene===this._parent._scene||null==this._parent._scene||this.walk(i._setScene)),e){var n=this._parent;n?(n.updateWorldTransform(),Li(Vn.determinant(n._mat),0,Bi)?($(14300),this._transformFlags|=Om.TRS,this.updateWorldTransform()):(Vn.multiply(Ag,Vn.invert(Ag,n._mat),this._mat),Vn.toRTS(Ag,this._lrot,this._lpos,this._lscale))):(mn.copy(this._lpos,this._pos),In.copy(this._lrot,this._rot),mn.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(Om.TRS)},e._onHierarchyChanged=function(t){this.eventProcessor.reattach(),this._onHierarchyChangedBase(t)},e._onBatchCreated=function(t){2&this._eventMask&&(this._activeInHierarchy||this.emit(Nm.ACTIVE_CHANGED,this,!1)),this.hasChangedFlags=Om.TRS;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(t)},e._onBeforeSerialize=function(){this.eulerAngles},e._onPostActivated=function(t){2&this._eventMask&&this.emit(Nm.ACTIVE_CHANGED,this,t),this._eventProcessor.setEnabled(t),t&&(this.invalidateChildren(Om.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData()))},e.translate=function(t,e){var i=e||Bm.LOCAL;if(i===Bm.LOCAL)mn.transformQuat(pg,t,this._lrot),this._lpos.x+=pg.x,this._lpos.y+=pg.y,this._lpos.z+=pg.z;else if(i===Bm.WORLD)if(this._parent){In.invert(gg,this._parent.worldRotation),mn.transformQuat(pg,t,gg);var n=this.worldScale;this._lpos.x+=pg.x/n.x,this._lpos.y+=pg.y/n.y,this._lpos.z+=pg.z/n.z}else this._lpos.x+=t.x,this._lpos.y+=t.y,this._lpos.z+=t.z;this.invalidateChildren(Om.POSITION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.POSITION)},e.rotate=function(t,e){var i=e||Bm.LOCAL;if(In.normalize(gg,t),i===Bm.LOCAL)In.multiply(this._lrot,this._lrot,gg);else if(i===Bm.WORLD){var n=this.worldRotation;In.multiply(yg,gg,n),In.invert(gg,n),In.multiply(yg,gg,yg),In.multiply(this._lrot,this._lrot,yg)}this._eulerDirty=!0,this.invalidateChildren(Om.ROTATION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.ROTATION)},e.lookAt=function(t,e){this.getWorldPosition(pg),mn.subtract(pg,pg,t),mn.normalize(pg,pg),In.fromViewUp(gg,pg,e),this.setWorldRotation(gg)},e.invalidateChildren=function(t){var e,i,n=0,r=0,s=0,o=0,a=t|Om.POSITION;for(bg[0]=this;n>=0;){if(o=(e=bg[n--]).hasChangedFlags,e.isValid&&(e._transformFlags&o&t)!==t)for(e._transformFlags|=t,e.hasChangedFlags=o|t,s=(i=e._children).length,r=0;r<s;r++)bg[++n]=i[r];t=a}},e.updateWorldTransform=function(){if(this._transformFlags){for(var t,e=this,i=0;e&&e._transformFlags;)bg[i++]=e,e=e._parent;for(var n=0;i;){if(n|=(t=bg[--i])._transformFlags,e){if(n&Om.POSITION&&(mn.transformMat4(t._pos,t._lpos,e._mat),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&Om.RS){Vn.fromRTS(t._mat,t._lrot,t._lpos,t._lscale),Vn.multiply(t._mat,e._mat,t._mat);var r=n&Om.ROTATION?t._rot:null;Vn.toRTS(t._mat,r,null,t._scale)}}else n&Om.POSITION&&(mn.copy(t._pos,t._lpos),t._mat.m12=t._pos.x,t._mat.m13=t._pos.y,t._mat.m14=t._pos.z),n&Om.RS&&(n&Om.ROTATION&&In.copy(t._rot,t._lrot),n&Om.SCALE&&mn.copy(t._scale,t._lscale),Vn.fromRTS(t._mat,t._rot,t._pos,t._scale));t._transformFlags=Om.NONE,e=t}}},e.setPosition=function(t,e,i){var n=this._lpos;if(void 0===e){if(n.equals(t))return;mn.copy(n,t)}else{if(void 0===i&&(i=n.z),n.equals(pg.set(t,e,i)))return;mn.copy(n,pg)}this.invalidateChildren(Om.POSITION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.POSITION)},e.getPosition=function(t){return t?mn.set(t,this._lpos.x,this._lpos.y,this._lpos.z):mn.copy(new mn,this._lpos)},e.setRotation=function(t,e,i,n){var r=this._lrot;if(void 0===e){if(r.equals(t))return;In.copy(r,t)}else{if(r.equals(gg.set(t,e,i,n)))return;In.copy(r,gg)}this._eulerDirty=!0,this.invalidateChildren(Om.ROTATION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.ROTATION)},e.setRotationFromEuler=function(t,e,i){var n=this._euler;if(void 0===e){if(n.equals(t))return;mn.copy(n,t),In.fromEuler(this._lrot,t.x,t.y,t.z)}else{var r=void 0===i?this._euler.z:i;if(mn.set(pg,t,e,r),n.equals(pg))return;mn.copy(n,pg),In.fromEuler(this._lrot,t,e,r)}this._eulerDirty=!1,this.invalidateChildren(Om.ROTATION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.ROTATION)},e.getRotation=function(t){return t?In.set(t,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):In.copy(new In,this._lrot)},e.setScale=function(t,e,i){var n=this._lscale;if(void 0===e){if(n.equals(t))return;mn.copy(n,t)}else{if(void 0===i&&(i=n.z),mn.set(pg,t,e,i),n.equals(pg))return;mn.copy(n,pg)}this.invalidateChildren(Om.SCALE),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.SCALE)},e.getScale=function(t){return t?mn.set(t,this._lscale.x,this._lscale.y,this._lscale.z):mn.copy(new mn,this._lscale)},e.inverseTransformPoint=function(t,e){mn.copy(t,e);for(var i=this,n=0;i._parent;)bg[n++]=i,i=i._parent;for(;n>=0;)mn.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=bg[--n];return t},e.setWorldPosition=function(t,e,i){var n=this._pos,r=this._parent&&(this._transformFlags&Om.POSITION)!==Om.NONE;if(void 0===e){if(!r&&n.equals(t))return;mn.copy(n,t)}else{if(mn.set(pg,t,e,i),!r&&n.equals(pg))return;mn.copy(n,pg)}var s=this._parent,o=this._lpos;s?(s.updateWorldTransform(),mn.transformMat4(o,n,Vn.invert(Ag,s._mat))):mn.copy(o,n),this.invalidateChildren(Om.POSITION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.POSITION)},e.getWorldPosition=function(t){return this.updateWorldTransform(),t?mn.copy(t,this._pos):mn.copy(new mn,this._pos)},e.setWorldRotation=function(t,e,i,n){var r=this._rot,s=this._parent&&(this._transformFlags&Om.ROTATION)!==Om.NONE;if(void 0===e){if(!s&&r.equals(t))return;In.copy(r,t)}else{if(In.set(gg,t,e,i,n),!s&&r.equals(gg))return;In.copy(r,gg)}this._parent?(this._parent.updateWorldTransform(),In.multiply(this._lrot,In.conjugate(this._lrot,this._parent._rot),r)):In.copy(this._lrot,r),this._eulerDirty=!0,this.invalidateChildren(Om.ROTATION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.ROTATION)},e.setWorldRotationFromEuler=function(t,e,i){In.fromEuler(gg,t,e,i),this.setWorldRotation(gg)},e.getWorldRotation=function(t){return this.updateWorldTransform(),t?In.copy(t,this._rot):In.copy(new In,this._rot)},e.setWorldScale=function(t,e,i){var n=this._scale,r=this._parent&&(this._transformFlags&Om.SCALE)!==Om.NONE,s=this._parent;if(s&&this.updateWorldTransform(),void 0===e){if(!r&&n.equals(t))return;mn.copy(n,t)}else{if(mn.set(pg,t,e,i),!r&&n.equals(pg))return;mn.copy(n,pg)}s?(pg.x=n.x/mn.set(mg,this._mat.m00,this._mat.m01,this._mat.m02).length(),pg.y=n.y/mn.set(mg,this._mat.m04,this._mat.m05,this._mat.m06).length(),pg.z=n.z/mn.set(mg,this._mat.m08,this._mat.m09,this._mat.m10).length(),Vn.scale(Ag,this._mat,pg),Vn.multiply(Tg,Vn.invert(Tg,s._mat),Ag),xn.fromQuat(Sg,In.conjugate(vg,this._lrot)),xn.multiplyMat4(Sg,Sg,Tg),this._lscale.x=mn.set(pg,Sg.m00,Sg.m01,Sg.m02).length(),this._lscale.y=mn.set(pg,Sg.m03,Sg.m04,Sg.m05).length(),this._lscale.z=mn.set(pg,Sg.m06,Sg.m07,Sg.m08).length()):mn.copy(this._lscale,n),this.invalidateChildren(Om.SCALE),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.SCALE)},e.getWorldScale=function(t){return this.updateWorldTransform(),t?mn.copy(t,this._scale):mn.copy(new mn,this._scale)},e.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new Vn;return Vn.copy(e,this._mat)},e.getWorldRS=function(t){this.updateWorldTransform();var e=t||new Vn;return Vn.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},e.getWorldRT=function(t){this.updateWorldTransform();var e=t||new Vn;return Vn.fromRT(e,this._rot,this._pos)},e.setRTS=function(t,e,i){var n=0;t&&(n|=Om.ROTATION,void 0!==t.w?(In.copy(this._lrot,t),this._eulerDirty=!0):(mn.copy(this._euler,t),In.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(mn.copy(this._lpos,e),n|=Om.POSITION),i&&(mn.copy(this._lscale,i),n|=Om.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,n))},e.isTransformDirty=function(){return this._transformFlags!==Om.NONE},e.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},e.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},i.resetHasChangedFlags=function(){Cg+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound?i.ClearFrame++:(i.ClearFrame=0,bg.length=0)},e.getPathInHierarchy=function(){for(var t=this.name,e=this.parent;e&&!(e instanceof v.Scene);)t=e.name+"/"+t,e=e.parent;return t},n(i,[{key:"components",get:function(){return this._components}},{key:"_persistNode",get:function(){return(this._objFlags&ig)>0},set:function(t){t?this._objFlags|=ig:this._objFlags&=~ig}},{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&&v.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:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(t){this.setWorldPosition(t)}},{key:"rotation",get:function(){return this._lrot},set:function(t){this.setRotation(t)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(In.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){this._euler.equals(pg.set(0,0,t))||(mn.set(this._euler,0,0,t),In.fromAngleZ(this._lrot,t),this._eulerDirty=!1,this.invalidateChildren(Om.ROTATION),1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.ROTATION))}},{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){Vn.toRTS(t,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Om.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(Nm.TRANSFORM_CHANGED,Om.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return mn.transformQuat(new mn,mn.FORWARD,this.worldRotation)},set:function(t){var e=t.length();mn.multiplyScalar(pg,t,-1/e),In.fromViewUp(gg,pg),this.setWorldRotation(gg)}},{key:"up",get:function(){return mn.transformQuat(new mn,mn.UP,this.worldRotation)}},{key:"right",get:function(){return mn.transformQuat(new mn,mn.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(t){this._mobility!==t&&(this._mobility=t,this.emit(Nm.MOBILITY_CHANGED))}},{key:"layer",get:function(){return this._layer},set:function(t){this._layer!==t&&(this._layer=t,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(Nm.LAYER_CHANGED,this._layer))}},{key:"flagChangedVersion",get:function(){return this._flagChangeVersion}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Cg?this._hasChangedFlags:0},set:function(t){this._flagChangeVersion=Cg,this._hasChangedFlags=t}}]),i}($s)).idGenerator=rg,$m._stacks=[[]],$m._stackId=0,$m.EventType=Nm,$m.NodeSpace=Bm,$m.TransformDirtyBit=Om,$m.TransformBit=Om,$m.reserveContentsForAllSyncablePrefabTag=Eg,$m.ClearFrame=0,$m.ClearRound=1e3,m((Um=$m).prototype,"_persistNode",[xa],Object.getOwnPropertyDescriptor(Um.prototype,"_persistNode"),Um.prototype),zm=fa(Um.prototype,"_parent",[Ma],(function(){return null})),Hm=fa(Um.prototype,"_children",[Ma],(function(){return[]})),Wm=fa(Um.prototype,"_active",[Ma],(function(){return!0})),jm=fa(Um.prototype,"_components",[Ma],(function(){return[]})),Xm=fa(Um.prototype,"_prefab",[Ma],(function(){return null})),Ym=fa(Um.prototype,"_lpos",[Ma],(function(){return new mn})),qm=fa(Um.prototype,"_lrot",[Ma],(function(){return new In})),Km=fa(Um.prototype,"_lscale",[Ma],(function(){return new mn(1,1,1)})),Qm=fa(Um.prototype,"_mobility",[Ma],(function(){return tg.Static})),Zm=fa(Um.prototype,"_layer",[Ma],(function(){return Pm.Enum.DEFAULT})),Jm=fa(Um.prototype,"_euler",[Ma],(function(){return new mn})),m(Um.prototype,"eulerAngles",[km],Object.getOwnPropertyDescriptor(Um.prototype,"eulerAngles"),Um.prototype),m(Um.prototype,"mobility",[Vm],Object.getOwnPropertyDescriptor(Um.prototype,"mobility"),Um.prototype),Gm=Um))||Gm));v.Node=xg,function(t){t[t.right=0]="right",t[t.left=1]="left",t[t.top=2]="top",t[t.bottom=3]="bottom",t[t.front=4]="front",t[t.back=5]="back"}(fg||(fg={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(dg||(dg={}));var wg=t("e3",Ta("cc.TextureCube")(((_g=function(t){function e(){var e;return(e=t.call(this)||this).isRGBE=hg&&hg(),e._mipmapAtlas=ug&&ug(),e._mipmapMode=lg&&lg(),e._mipmaps=cg&&cg(),e._generatedMipmaps=[],e}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){Dg(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 this._mipmapMode===dg.BAKED_CONVOLUTION_MAP},e.fromTexture2DArray=function(t,i){for(var n=[],r=t.length/6,s=0;s<r;s++){var o=6*s;n.push({front:t[o+fg.front].image,back:t[o+fg.back].image,left:t[o+fg.left].image,right:t[o+fg.right].image,top:t[o+fg.top].image,bottom:t[o+fg.bottom].image})}return(i=i||new e).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===dg.BAKED_CONVOLUTION_MAP?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;Dg(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,this._mipmapMode===dg.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new sp,back:new sp,left:new sp,right:new sp,top:new sp,bottom:new sp};var o=he(sp);i.result.push(this._mipmapAtlas.atlas,"front",r.front,o),i.result.push(this._mipmapAtlas.atlas,"back",r.back,o),i.result.push(this._mipmapAtlas.atlas,"left",r.left,o),i.result.push(this._mipmapAtlas.atlas,"right",r.right,o),i.result.push(this._mipmapAtlas.atlas,"top",r.top,o),i.result.push(this._mipmapAtlas.atlas,"bottom",r.bottom,o)}else{this._mipmaps=new Array(n.mipmaps.length);for(var a=0;a<n.mipmaps.length;++a){this._mipmaps[a]={front:new sp,back:new sp,left:new sp,right:new sp,top:new sp,bottom:new sp};var h=n.mipmaps[a],u=he(sp);i.result.push(this._mipmaps[a],"front",h.front,u),i.result.push(this._mipmaps[a],"back",h.back,u),i.result.push(this._mipmaps[a],"left",h.left,u),i.result.push(this._mipmaps[a],"right",h.right,u),i.result.push(this._mipmaps[a],"top",h.top,u),i.result.push(this._mipmaps[a],"bottom",h.bottom,u)}}},i._getGfxTextureCreateInfo=function(t){var e=new R_(Dc.CUBE);return e.width=this._width,e.height=this._height,e.layerCount=6,Object.assign(e,t),e},i._getGfxTextureViewCreateInfo=function(t){var e=new I_;return e.type=Dc.CUBE,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}),Dg(this._mipmapAtlas.atlas,(function(i,n){var r=new Dm;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 o=e[s],a=r.getGFXTexture().size,h=new Uint8Array(a),u=new y_;u.texOffset.x=o.left,u.texOffset.y=o.top,u.texExtent.width=o.width,u.texExtent.height=o.height,t._getGFXDevice().copyTextureToBuffers(r.getGFXTexture(),[h],[u]);var l=new sp({_data:h,_compressed:i.isCompressed,width:o.width,height:o.height,format:i.format});t._assignImage(l,o.level,n)}}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new sp;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===dg.BAKED_CONVOLUTION_MAP){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(),o=i.right.extractMipmaps(),a=i.top.extractMipmaps(),h=i.bottom.extractMipmaps();if(n.length!==r.length||n.length!==s.length||n.length!==o.length||n.length!==a.length||n.length!==h.length)return et(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:o[l],top:a[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)if(Uo.os!==po.IOS){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],o=Object.assign(A.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 a=function(){var t=r[h];Dg(n,(function(n,r){o.clearRect(0,0,i.width,i.height);var s=n.data;o.drawImage(s,0,0);var a=o.getImageData(t.left,t.top,t.width,t.height),h=new sp({_data:a.data,_compressed:n.isCompressed,width:a.width,height:a.height,format:n.format});e._assignImage(h,t.level,r)}))},h=0;h<r.length;h++)a()}else this._uploadAtlas()}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}(wm)).FaceIndex=fg,hg=fa((ag=_g).prototype,"isRGBE",[Ma],(function(){return!1})),ug=fa(ag.prototype,"_mipmapAtlas",[Ma],(function(){return null})),lg=fa(ag.prototype,"_mipmapMode",[Ma],(function(){return dg.NONE})),cg=fa(ag.prototype,"_mipmaps",[Ma],(function(){return[]})),og=ag))||og);function Dg(t,e){e(t.front,fg.front),e(t.back,fg.back),e(t.left,fg.left),e(t.right,fg.right),e(t.top,fg.top),e(t.bottom,fg.bottom)}v.TextureCube=wg;var Rg,Ig,Mg,Pg,Bg,Og,Lg,Ng,Fg,kg,Vg,Gg,Ug,zg,Hg,Wg,jg=function(){function t(){this._groundAlbedoHDR=new ln(.2,.2,.2,1),this._skyColorHDR=new ln(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new ln(.2,.2,.2,1),this._skyColorLDR=new ln(.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t)}},{key:"skyIllum",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t}},{key:"groundAlbedo",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t)}}]),t}();jg.SUN_ILLUM=65e3,jg.SKY_ILLUM=2e4,v.Ambient=jg,function(t){t[t.DEFAULT=100]="DEFAULT",t[t.UI=200]="UI"}(Hg||(Hg={})),v.RenderPassStage=Hg,function(t){t[t.MIN=0]="MIN",t[t.MAX=255]="MAX",t[t.DEFAULT=128]="DEFAULT"}(Wg||(Wg={}));var Xg,Yg={bindings:[],layouts:{}},qg={bindings:[],layouts:{}};!function(t){t[t.UBO_GLOBAL=0]="UBO_GLOBAL",t[t.UBO_CAMERA=1]="UBO_CAMERA",t[t.UBO_SHADOW=2]="UBO_SHADOW",t[t.UBO_CSM=3]="UBO_CSM",t[t.SAMPLER_SHADOWMAP=4]="SAMPLER_SHADOWMAP",t[t.SAMPLER_ENVIRONMENT=5]="SAMPLER_ENVIRONMENT",t[t.SAMPLER_SPOT_SHADOW_MAP=6]="SAMPLER_SPOT_SHADOW_MAP",t[t.SAMPLER_DIFFUSEMAP=7]="SAMPLER_DIFFUSEMAP",t[t.COUNT=8]="COUNT"}(Xg||(Xg={}));var Kg,Qg=Xg.SAMPLER_SHADOWMAP,Zg=Xg.COUNT-Qg;!function(t){t[t.UBO_LOCAL=0]="UBO_LOCAL",t[t.UBO_FORWARD_LIGHTS=1]="UBO_FORWARD_LIGHTS",t[t.UBO_SKINNING_ANIMATION=2]="UBO_SKINNING_ANIMATION",t[t.UBO_SKINNING_TEXTURE=3]="UBO_SKINNING_TEXTURE",t[t.UBO_MORPH=4]="UBO_MORPH",t[t.UBO_UI_LOCAL=5]="UBO_UI_LOCAL",t[t.UBO_SH=6]="UBO_SH",t[t.SAMPLER_JOINTS=7]="SAMPLER_JOINTS",t[t.SAMPLER_MORPH_POSITION=8]="SAMPLER_MORPH_POSITION",t[t.SAMPLER_MORPH_NORMAL=9]="SAMPLER_MORPH_NORMAL",t[t.SAMPLER_MORPH_TANGENT=10]="SAMPLER_MORPH_TANGENT",t[t.SAMPLER_LIGHTMAP=11]="SAMPLER_LIGHTMAP",t[t.SAMPLER_SPRITE=12]="SAMPLER_SPRITE",t[t.SAMPLER_REFLECTION=13]="SAMPLER_REFLECTION",t[t.STORAGE_REFLECTION=14]="STORAGE_REFLECTION",t[t.SAMPLER_REFLECTION_PROBE_CUBE=15]="SAMPLER_REFLECTION_PROBE_CUBE",t[t.SAMPLER_REFLECTION_PROBE_PLANAR=16]="SAMPLER_REFLECTION_PROBE_PLANAR",t[t.SAMPLER_REFLECTION_PROBE_DATA_MAP=17]="SAMPLER_REFLECTION_PROBE_DATA_MAP",t[t.SAMPLER_REFLECTION_PROBE_BLEND_CUBE=18]="SAMPLER_REFLECTION_PROBE_BLEND_CUBE",t[t.COUNT=19]="COUNT"}(Kg||(Kg={}));var Jg,$g=Kg.SAMPLER_JOINTS,ty=Kg.STORAGE_REFLECTION-$g,ey=Kg.COUNT-$g-ty;!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.MATERIAL=1]="MATERIAL",t[t.LOCAL=2]="LOCAL",t[t.COUNT=3]="COUNT"}(Jg||(Jg={}));var iy=new A_([Qg,0,$g,0],[Zg,0,ty,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,ey,0],[0,0,0,0],[0,2,1,3]),ny=function(){};Rg=ny,ny.TIME_OFFSET=0,ny.SCREEN_SIZE_OFFSET=Rg.TIME_OFFSET+4,ny.NATIVE_SIZE_OFFSET=Rg.SCREEN_SIZE_OFFSET+4,ny.PROBE_INFO_OFFSET=Rg.NATIVE_SIZE_OFFSET+4,ny.DEBUG_VIEW_MODE_OFFSET=Rg.PROBE_INFO_OFFSET+4,ny.COUNT=Rg.DEBUG_VIEW_MODE_OFFSET+4,ny.SIZE=4*Rg.COUNT,ny.NAME="CCGlobal",ny.BINDING=Xg.UBO_GLOBAL,ny.DESCRIPTOR=new $_(Rg.BINDING,$c.UNIFORM_BUFFER,1,Uc.ALL),ny.LAYOUT=new B_(Jg.GLOBAL,Rg.BINDING,Rg.NAME,[new P_("cc_time",bc.FLOAT4,1),new P_("cc_screenSize",bc.FLOAT4,1),new P_("cc_nativeSize",bc.FLOAT4,1),new P_("cc_probeInfo",bc.FLOAT4,1),new P_("cc_debug_view_mode",bc.FLOAT4,1)],1),Yg.layouts[ny.NAME]=ny.LAYOUT,Yg.bindings[ny.BINDING]=ny.DESCRIPTOR;var ry=function(){};Ig=ry,ry.MAT_VIEW_OFFSET=0,ry.MAT_VIEW_INV_OFFSET=Ig.MAT_VIEW_OFFSET+16,ry.MAT_PROJ_OFFSET=Ig.MAT_VIEW_INV_OFFSET+16,ry.MAT_PROJ_INV_OFFSET=Ig.MAT_PROJ_OFFSET+16,ry.MAT_VIEW_PROJ_OFFSET=Ig.MAT_PROJ_INV_OFFSET+16,ry.MAT_VIEW_PROJ_INV_OFFSET=Ig.MAT_VIEW_PROJ_OFFSET+16,ry.CAMERA_POS_OFFSET=Ig.MAT_VIEW_PROJ_INV_OFFSET+16,ry.SURFACE_TRANSFORM_OFFSET=Ig.CAMERA_POS_OFFSET+4,ry.SCREEN_SCALE_OFFSET=Ig.SURFACE_TRANSFORM_OFFSET+4,ry.EXPOSURE_OFFSET=Ig.SCREEN_SCALE_OFFSET+4,ry.MAIN_LIT_DIR_OFFSET=Ig.EXPOSURE_OFFSET+4,ry.MAIN_LIT_COLOR_OFFSET=Ig.MAIN_LIT_DIR_OFFSET+4,ry.AMBIENT_SKY_OFFSET=Ig.MAIN_LIT_COLOR_OFFSET+4,ry.AMBIENT_GROUND_OFFSET=Ig.AMBIENT_SKY_OFFSET+4,ry.GLOBAL_FOG_COLOR_OFFSET=Ig.AMBIENT_GROUND_OFFSET+4,ry.GLOBAL_FOG_BASE_OFFSET=Ig.GLOBAL_FOG_COLOR_OFFSET+4,ry.GLOBAL_FOG_ADD_OFFSET=Ig.GLOBAL_FOG_BASE_OFFSET+4,ry.NEAR_FAR_OFFSET=Ig.GLOBAL_FOG_ADD_OFFSET+4,ry.VIEW_PORT_OFFSET=Ig.NEAR_FAR_OFFSET+4,ry.COUNT=Ig.VIEW_PORT_OFFSET+4,ry.SIZE=4*Ig.COUNT,ry.NAME="CCCamera",ry.BINDING=Xg.UBO_CAMERA,ry.DESCRIPTOR=new $_(Ig.BINDING,$c.UNIFORM_BUFFER,1,Uc.ALL),ry.LAYOUT=new B_(Jg.GLOBAL,Ig.BINDING,Ig.NAME,[new P_("cc_matView",bc.MAT4,1),new P_("cc_matViewInv",bc.MAT4,1),new P_("cc_matProj",bc.MAT4,1),new P_("cc_matProjInv",bc.MAT4,1),new P_("cc_matViewProj",bc.MAT4,1),new P_("cc_matViewProjInv",bc.MAT4,1),new P_("cc_cameraPos",bc.FLOAT4,1),new P_("cc_surfaceTransform",bc.FLOAT4,1),new P_("cc_screenScale",bc.FLOAT4,1),new P_("cc_exposure",bc.FLOAT4,1),new P_("cc_mainLitDir",bc.FLOAT4,1),new P_("cc_mainLitColor",bc.FLOAT4,1),new P_("cc_ambientSky",bc.FLOAT4,1),new P_("cc_ambientGround",bc.FLOAT4,1),new P_("cc_fogColor",bc.FLOAT4,1),new P_("cc_fogBase",bc.FLOAT4,1),new P_("cc_fogAdd",bc.FLOAT4,1),new P_("cc_nearFar",bc.FLOAT4,1),new P_("cc_viewPort",bc.FLOAT4,1)],1),Yg.layouts[ry.NAME]=ry.LAYOUT,Yg.bindings[ry.BINDING]=ry.DESCRIPTOR;var sy=function(){};Mg=sy,sy.MAT_LIGHT_VIEW_OFFSET=0,sy.MAT_LIGHT_VIEW_PROJ_OFFSET=Mg.MAT_LIGHT_VIEW_OFFSET+16,sy.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=Mg.MAT_LIGHT_VIEW_PROJ_OFFSET+16,sy.SHADOW_PROJ_DEPTH_INFO_OFFSET=Mg.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+4,sy.SHADOW_PROJ_INFO_OFFSET=Mg.SHADOW_PROJ_DEPTH_INFO_OFFSET+4,sy.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=Mg.SHADOW_PROJ_INFO_OFFSET+4,sy.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=Mg.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+4,sy.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=Mg.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+4,sy.SHADOW_COLOR_OFFSET=Mg.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+4,sy.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=Mg.SHADOW_COLOR_OFFSET+4,sy.COUNT=Mg.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+4,sy.SIZE=4*Mg.COUNT,sy.NAME="CCShadow",sy.BINDING=Xg.UBO_SHADOW,sy.DESCRIPTOR=new $_(Mg.BINDING,$c.UNIFORM_BUFFER,1,Uc.ALL),sy.LAYOUT=new B_(Jg.GLOBAL,Mg.BINDING,Mg.NAME,[new P_("cc_matLightView",bc.MAT4,1),new P_("cc_matLightViewProj",bc.MAT4,1),new P_("cc_shadowInvProjDepthInfo",bc.FLOAT4,1),new P_("cc_shadowProjDepthInfo",bc.FLOAT4,1),new P_("cc_shadowProjInfo",bc.FLOAT4,1),new P_("cc_shadowNFLSInfo",bc.FLOAT4,1),new P_("cc_shadowWHPBInfo",bc.FLOAT4,1),new P_("cc_shadowLPNNInfo",bc.FLOAT4,1),new P_("cc_shadowColor",bc.FLOAT4,1),new P_("cc_planarNDInfo",bc.FLOAT4,1)],1),Yg.layouts[sy.NAME]=sy.LAYOUT,Yg.bindings[sy.BINDING]=sy.DESCRIPTOR;var oy=function(){};Pg=oy,oy.CSM_LEVEL_COUNT=4,oy.CSM_VIEW_DIR_0_OFFSET=0,oy.CSM_VIEW_DIR_1_OFFSET=Pg.CSM_VIEW_DIR_0_OFFSET+4*Pg.CSM_LEVEL_COUNT,oy.CSM_VIEW_DIR_2_OFFSET=Pg.CSM_VIEW_DIR_1_OFFSET+4*Pg.CSM_LEVEL_COUNT,oy.CSM_ATLAS_OFFSET=Pg.CSM_VIEW_DIR_2_OFFSET+4*Pg.CSM_LEVEL_COUNT,oy.MAT_CSM_VIEW_PROJ_OFFSET=Pg.CSM_ATLAS_OFFSET+4*Pg.CSM_LEVEL_COUNT,oy.CSM_PROJ_DEPTH_INFO_OFFSET=Pg.MAT_CSM_VIEW_PROJ_OFFSET+16*Pg.CSM_LEVEL_COUNT,oy.CSM_PROJ_INFO_OFFSET=Pg.CSM_PROJ_DEPTH_INFO_OFFSET+4*Pg.CSM_LEVEL_COUNT,oy.CSM_SPLITS_INFO_OFFSET=Pg.CSM_PROJ_INFO_OFFSET+4*Pg.CSM_LEVEL_COUNT,oy.COUNT=Pg.CSM_SPLITS_INFO_OFFSET+4,oy.SIZE=4*Pg.COUNT,oy.NAME="CCCSM",oy.BINDING=Xg.UBO_CSM,oy.DESCRIPTOR=new $_(Pg.BINDING,$c.UNIFORM_BUFFER,1,Uc.FRAGMENT),oy.LAYOUT=new B_(Jg.GLOBAL,Pg.BINDING,Pg.NAME,[new P_("cc_csmViewDir0",bc.FLOAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_csmViewDir1",bc.FLOAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_csmViewDir2",bc.FLOAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_csmAtlas",bc.FLOAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_matCSMViewProj",bc.MAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_csmProjDepthInfo",bc.FLOAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_csmProjInfo",bc.FLOAT4,Pg.CSM_LEVEL_COUNT),new P_("cc_csmSplitsInfo",bc.FLOAT4,1)],1),Yg.layouts[oy.NAME]=oy.LAYOUT,Yg.bindings[oy.BINDING]=oy.DESCRIPTOR;var ay=Xg.SAMPLER_SHADOWMAP,hy=new $_(ay,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),uy=new O_(Jg.GLOBAL,ay,"cc_shadowMap",bc.SAMPLER2D,1);Yg.layouts.cc_shadowMap=uy,Yg.bindings[ay]=hy;var ly=Xg.SAMPLER_ENVIRONMENT,cy=new $_(ly,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),_y=new O_(Jg.GLOBAL,ly,"cc_environment",bc.SAMPLER_CUBE,1);Yg.layouts.cc_environment=_y,Yg.bindings[ly]=cy;var fy=Xg.SAMPLER_DIFFUSEMAP,dy=new $_(fy,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),py=new O_(Jg.GLOBAL,fy,"cc_diffuseMap",bc.SAMPLER_CUBE,1);Yg.layouts.cc_diffuseMap=py,Yg.bindings[fy]=dy;var my=Xg.SAMPLER_SPOT_SHADOW_MAP,gy=new $_(my,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),yy=new O_(Jg.GLOBAL,my,"cc_spotShadowMap",bc.SAMPLER2D,1);Yg.layouts.cc_spotShadowMap=yy,Yg.bindings[my]=gy;var vy=function(){};Bg=vy,vy.MAT_WORLD_OFFSET=0,vy.MAT_WORLD_IT_OFFSET=Bg.MAT_WORLD_OFFSET+16,vy.LIGHTINGMAP_UVPARAM=Bg.MAT_WORLD_IT_OFFSET+16,vy.LOCAL_SHADOW_BIAS=Bg.LIGHTINGMAP_UVPARAM+4,vy.REFLECTION_PROBE_DATA1=Bg.LOCAL_SHADOW_BIAS+4,vy.REFLECTION_PROBE_DATA2=Bg.REFLECTION_PROBE_DATA1+4,vy.REFLECTION_PROBE_BLEND_DATA1=Bg.REFLECTION_PROBE_DATA2+4,vy.REFLECTION_PROBE_BLEND_DATA2=Bg.REFLECTION_PROBE_BLEND_DATA1+4,vy.COUNT=Bg.REFLECTION_PROBE_BLEND_DATA2+4,vy.SIZE=4*Bg.COUNT,vy.NAME="CCLocal",vy.BINDING=Kg.UBO_LOCAL,vy.DESCRIPTOR=new $_(Bg.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX|Uc.FRAGMENT|Uc.COMPUTE),vy.LAYOUT=new B_(Jg.LOCAL,Bg.BINDING,Bg.NAME,[new P_("cc_matWorld",bc.MAT4,1),new P_("cc_matWorldIT",bc.MAT4,1),new P_("cc_lightingMapUVParam",bc.FLOAT4,1),new P_("cc_localShadowBias",bc.FLOAT4,1),new P_("cc_reflectionProbeData1",bc.FLOAT4,1),new P_("cc_reflectionProbeData2",bc.FLOAT4,1),new P_("cc_reflectionProbeBlendData1",bc.FLOAT4,1),new P_("cc_reflectionProbeBlendData2",bc.FLOAT4,1)],1),qg.layouts[vy.NAME]=vy.LAYOUT,qg.bindings[vy.BINDING]=vy.DESCRIPTOR;var Sy=function(){};Og=Sy,Sy.WORLD_BOUND_CENTER=0,Sy.WORLD_BOUND_HALF_EXTENTS=Og.WORLD_BOUND_CENTER+4,Sy.COUNT=Og.WORLD_BOUND_HALF_EXTENTS+4,Sy.SIZE=4*Og.COUNT,Sy.NAME="CCWorldBound",Sy.BINDING=Kg.UBO_LOCAL,Sy.DESCRIPTOR=new $_(Og.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX|Uc.COMPUTE),Sy.LAYOUT=new B_(Jg.LOCAL,Og.BINDING,Og.NAME,[new P_("cc_worldBoundCenter",bc.FLOAT4,1),new P_("cc_worldBoundHalfExtents",bc.FLOAT4,1)],1),qg.layouts[Sy.NAME]=Sy.LAYOUT,qg.bindings[Sy.BINDING]=Sy.DESCRIPTOR;var Ay="a_matWorld0",Ty="a_sh_linear_const_r",by=function(){};Lg=by,by.BATCHING_COUNT=10,by.MAT_WORLDS_OFFSET=0,by.COUNT=16*Lg.BATCHING_COUNT,by.SIZE=4*Lg.COUNT,by.NAME="CCLocalBatched",by.BINDING=Kg.UBO_LOCAL,by.DESCRIPTOR=new $_(Lg.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX|Uc.COMPUTE),by.LAYOUT=new B_(Jg.LOCAL,Lg.BINDING,Lg.NAME,[new P_("cc_matWorlds",bc.MAT4,Lg.BATCHING_COUNT)],1),qg.layouts[by.NAME]=by.LAYOUT,qg.bindings[by.BINDING]=by.DESCRIPTOR;var Ey=function(){};Ng=Ey,Ey.LIGHTS_PER_PASS=1,Ey.LIGHT_POS_OFFSET=0,Ey.LIGHT_COLOR_OFFSET=Ng.LIGHT_POS_OFFSET+4*Ng.LIGHTS_PER_PASS,Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET=Ng.LIGHT_COLOR_OFFSET+4*Ng.LIGHTS_PER_PASS,Ey.LIGHT_DIR_OFFSET=Ng.LIGHT_SIZE_RANGE_ANGLE_OFFSET+4*Ng.LIGHTS_PER_PASS,Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET=Ng.LIGHT_DIR_OFFSET+4*Ng.LIGHTS_PER_PASS,Ey.COUNT=Ng.LIGHT_BOUNDING_SIZE_VS_OFFSET+4*Ng.LIGHTS_PER_PASS,Ey.SIZE=4*Ng.COUNT,Ey.NAME="CCForwardLight",Ey.BINDING=Kg.UBO_FORWARD_LIGHTS,Ey.DESCRIPTOR=new $_(Ng.BINDING,$c.DYNAMIC_UNIFORM_BUFFER,1,Uc.FRAGMENT),Ey.LAYOUT=new B_(Jg.LOCAL,Ng.BINDING,Ng.NAME,[new P_("cc_lightPos",bc.FLOAT4,Ng.LIGHTS_PER_PASS),new P_("cc_lightColor",bc.FLOAT4,Ng.LIGHTS_PER_PASS),new P_("cc_lightSizeRangeAngle",bc.FLOAT4,Ng.LIGHTS_PER_PASS),new P_("cc_lightDir",bc.FLOAT4,Ng.LIGHTS_PER_PASS),new P_("cc_lightBoundingSizeVS",bc.FLOAT4,Ng.LIGHTS_PER_PASS)],1),qg.layouts[Ey.NAME]=Ey.LAYOUT,qg.bindings[Ey.BINDING]=Ey.DESCRIPTOR;var Cy=function(){};Cy.LIGHTS_PER_PASS=10;var xy=function(){};Fg=xy,xy.JOINTS_TEXTURE_INFO_OFFSET=0,xy.COUNT=Fg.JOINTS_TEXTURE_INFO_OFFSET+4,xy.SIZE=4*Fg.COUNT,xy.NAME="CCSkinningTexture",xy.BINDING=Kg.UBO_SKINNING_TEXTURE,xy.DESCRIPTOR=new $_(Fg.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX),xy.LAYOUT=new B_(Jg.LOCAL,Fg.BINDING,Fg.NAME,[new P_("cc_jointTextureInfo",bc.FLOAT4,1)],1),qg.layouts[xy.NAME]=xy.LAYOUT,qg.bindings[xy.BINDING]=xy.DESCRIPTOR;var wy=function(){};kg=wy,wy.JOINTS_ANIM_INFO_OFFSET=0,wy.COUNT=kg.JOINTS_ANIM_INFO_OFFSET+4,wy.SIZE=4*kg.COUNT,wy.NAME="CCSkinningAnimation",wy.BINDING=Kg.UBO_SKINNING_ANIMATION,wy.DESCRIPTOR=new $_(kg.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX),wy.LAYOUT=new B_(Jg.LOCAL,kg.BINDING,kg.NAME,[new P_("cc_jointAnimInfo",bc.FLOAT4,1)],1),qg.layouts[wy.NAME]=wy.LAYOUT,qg.bindings[wy.BINDING]=wy.DESCRIPTOR;var Dy="a_jointAnimInfo",Ry=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 Iy(t){Ry.initLayout(t),qg.layouts[Ry.NAME]=Ry.LAYOUT,qg.bindings[Ry.BINDING]=Ry.DESCRIPTOR}Vg=Ry,Ry._jointUniformCapacity=0,Ry._count=0,Ry._size=0,Ry.NAME="CCSkinning",Ry.BINDING=Kg.UBO_SKINNING_TEXTURE,Ry.DESCRIPTOR=new $_(Vg.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX),Ry.LAYOUT=new B_(Jg.LOCAL,Vg.BINDING,Vg.NAME,[new P_("cc_joints",bc.FLOAT4,1)],1);var My=function(){};Gg=My,My.MAX_MORPH_TARGET_COUNT=60,My.OFFSET_OF_WEIGHTS=0,My.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*Gg.MAX_MORPH_TARGET_COUNT,My.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=Gg.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH+4,My.OFFSET_OF_VERTICES_COUNT=Gg.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT+4,My.COUNT_BASE_4_BYTES=4*Math.ceil(Gg.MAX_MORPH_TARGET_COUNT/4)+4,My.SIZE=4*Gg.COUNT_BASE_4_BYTES,My.NAME="CCMorph",My.BINDING=Kg.UBO_MORPH,My.DESCRIPTOR=new $_(Gg.BINDING,$c.UNIFORM_BUFFER,1,Uc.VERTEX),My.LAYOUT=new B_(Jg.LOCAL,Gg.BINDING,Gg.NAME,[new P_("cc_displacementWeights",bc.FLOAT4,Gg.MAX_MORPH_TARGET_COUNT/4),new P_("cc_displacementTextureInfo",bc.FLOAT4,1)],1),qg.layouts[My.NAME]=My.LAYOUT,qg.bindings[My.BINDING]=My.DESCRIPTOR;var Py=function(){};Ug=Py,Py.NAME="CCUILocal",Py.BINDING=Kg.UBO_UI_LOCAL,Py.DESCRIPTOR=new $_(Ug.BINDING,$c.DYNAMIC_UNIFORM_BUFFER,1,Uc.VERTEX),Py.LAYOUT=new B_(Jg.LOCAL,Ug.BINDING,Ug.NAME,[new P_("cc_local_data",bc.FLOAT4,1)],1),qg.layouts[Py.NAME]=Py.LAYOUT,qg.bindings[Py.BINDING]=Py.DESCRIPTOR;var By=function(){};zg=By,By.SH_LINEAR_CONST_R_OFFSET=0,By.SH_LINEAR_CONST_G_OFFSET=zg.SH_LINEAR_CONST_R_OFFSET+4,By.SH_LINEAR_CONST_B_OFFSET=zg.SH_LINEAR_CONST_G_OFFSET+4,By.SH_QUADRATIC_R_OFFSET=zg.SH_LINEAR_CONST_B_OFFSET+4,By.SH_QUADRATIC_G_OFFSET=zg.SH_QUADRATIC_R_OFFSET+4,By.SH_QUADRATIC_B_OFFSET=zg.SH_QUADRATIC_G_OFFSET+4,By.SH_QUADRATIC_A_OFFSET=zg.SH_QUADRATIC_B_OFFSET+4,By.COUNT=zg.SH_QUADRATIC_A_OFFSET+4,By.SIZE=4*zg.COUNT,By.NAME="CCSH",By.BINDING=Kg.UBO_SH,By.DESCRIPTOR=new $_(zg.BINDING,$c.UNIFORM_BUFFER,1,Uc.FRAGMENT),By.LAYOUT=new B_(Jg.LOCAL,zg.BINDING,zg.NAME,[new P_("cc_sh_linear_const_r",bc.FLOAT4,1),new P_("cc_sh_linear_const_g",bc.FLOAT4,1),new P_("cc_sh_linear_const_b",bc.FLOAT4,1),new P_("cc_sh_quadratic_r",bc.FLOAT4,1),new P_("cc_sh_quadratic_g",bc.FLOAT4,1),new P_("cc_sh_quadratic_b",bc.FLOAT4,1),new P_("cc_sh_quadratic_a",bc.FLOAT4,1)],1),qg.layouts[By.NAME]=By.LAYOUT,qg.bindings[By.BINDING]=By.DESCRIPTOR;var Oy=Kg.SAMPLER_JOINTS,Ly=new $_(Oy,$c.SAMPLER_TEXTURE,1,Uc.VERTEX),Ny=new O_(Jg.LOCAL,Oy,"cc_jointTexture",bc.SAMPLER2D,1);qg.layouts.cc_jointTexture=Ny,qg.bindings[Oy]=Ly;var Fy=Kg.SAMPLER_JOINTS,ky=new $_(Fy,$c.SAMPLER_TEXTURE,1,Uc.VERTEX),Vy=new O_(Jg.LOCAL,Fy,"cc_realtimeJoint",bc.SAMPLER2D,1);qg.layouts.cc_realtimeJoint=Vy,qg.bindings[Fy]=ky;var Gy=Kg.SAMPLER_MORPH_POSITION,Uy=new $_(Gy,$c.SAMPLER_TEXTURE,1,Uc.VERTEX),zy=new O_(Jg.LOCAL,Gy,"cc_PositionDisplacements",bc.SAMPLER2D,1);qg.layouts.cc_PositionDisplacements=zy,qg.bindings[Gy]=Uy;var Hy=Kg.SAMPLER_MORPH_NORMAL,Wy=new $_(Hy,$c.SAMPLER_TEXTURE,1,Uc.VERTEX),jy=new O_(Jg.LOCAL,Hy,"cc_NormalDisplacements",bc.SAMPLER2D,1);qg.layouts.cc_NormalDisplacements=jy,qg.bindings[Hy]=Wy;var Xy=Kg.SAMPLER_MORPH_TANGENT,Yy=new $_(Xy,$c.SAMPLER_TEXTURE,1,Uc.VERTEX),qy=new O_(Jg.LOCAL,Xy,"cc_TangentDisplacements",bc.SAMPLER2D,1);qg.layouts.cc_TangentDisplacements=qy,qg.bindings[Xy]=Yy;var Ky=Kg.SAMPLER_LIGHTMAP,Qy=new $_(Ky,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),Zy=new O_(Jg.LOCAL,Ky,"cc_lightingMap",bc.SAMPLER2D,1);qg.layouts.cc_lightingMap=Zy,qg.bindings[Ky]=Qy;var Jy=Kg.SAMPLER_SPRITE,$y=new $_(Jy,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),tv=new O_(Jg.LOCAL,Jy,"cc_spriteTexture",bc.SAMPLER2D,1);qg.layouts.cc_spriteTexture=tv,qg.bindings[Jy]=$y;var ev=Kg.SAMPLER_REFLECTION,iv=new $_(ev,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),nv=new O_(Jg.LOCAL,ev,"cc_reflectionTexture",bc.SAMPLER2D,1);qg.layouts.cc_reflectionTexture=nv,qg.bindings[ev]=iv;var rv=Kg.STORAGE_REFLECTION,sv=new $_(rv,$c.STORAGE_IMAGE,1,Uc.COMPUTE),ov=new F_(Jg.LOCAL,rv,"cc_reflectionStorage",bc.IMAGE2D,1);qg.layouts.cc_reflectionStorage=ov,qg.bindings[rv]=sv;var av=Kg.SAMPLER_REFLECTION_PROBE_CUBE,hv=new $_(av,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),uv=new O_(Jg.LOCAL,av,"cc_reflectionProbeCubemap",bc.SAMPLER_CUBE,1);qg.layouts.cc_reflectionProbeCubemap=uv,qg.bindings[av]=hv;var lv=Kg.SAMPLER_REFLECTION_PROBE_PLANAR,cv=new $_(lv,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),_v=new O_(Jg.LOCAL,lv,"cc_reflectionProbePlanarMap",bc.SAMPLER2D,1);qg.layouts.cc_reflectionProbePlanarMap=_v,qg.bindings[lv]=cv;var fv=Kg.SAMPLER_REFLECTION_PROBE_DATA_MAP,dv=new $_(fv,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),pv=new O_(Jg.LOCAL,fv,"cc_reflectionProbeDataMap",bc.SAMPLER2D,1);qg.layouts.cc_reflectionProbeDataMap=pv,qg.bindings[fv]=dv;var mv=Kg.SAMPLER_REFLECTION_PROBE_BLEND_CUBE,gv=new $_(mv,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT),yv=new O_(Jg.LOCAL,mv,"cc_reflectionProbeBlendCubemap",bc.SAMPLER_CUBE,1);qg.layouts.cc_reflectionProbeBlendCubemap=yv,qg.bindings[mv]=gv;var vv,Sv,Av,Tv,bv=Pm.makeMaskExclude([Pm.BitMask.UI_2D,Pm.BitMask.GIZMOS,Pm.BitMask.EDITOR,Pm.BitMask.SCENE_GIZMO,Pm.BitMask.PROFILER]),Ev=Pm.makeMaskExclude([Pm.BitMask.UI_2D,Pm.BitMask.PROFILER]),Cv=Pm.Enum.ALL;function xv(t){if(vv)return vv;var e=new R_(Dc.TEX2D,Rc.NONE,wv(t)?Ac.R32F:Ac.RGBA8,16,16,Ic.NONE,1,1,Pc.X1,1);return vv=t.createTexture(e)}function wv(t){return(t.getFormatFeatures(Ac.R32F)&(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE))==(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE)&&!(t.gfxAPI===yc.WEBGL)}function Dv(t){return(t.getFormatFeatures(Ac.RGBA16F)&(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE))==(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE)}function Rv(){return!(!v.rendering||!v.rendering.enableEffectImport)}t("dc",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:"MainFlow",PIPELINE_FLOW_FORWARD:"ForwardFlow",PIPELINE_FLOW_SHADOW:"ShadowFlow",PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return Hg},get RenderPriority(){return Wg},globalDescriptorSetLayout:Yg,localDescriptorSetLayout:qg,get PipelineGlobalBindings(){return Xg},get ModelLocalBindings(){return Kg},get SetIndex(){return Jg},bindingMappingInfo:iy,UBOGlobal:ny,UBOCamera:ry,UBOShadow:sy,UBOCSM:oy,UNIFORM_SHADOWMAP_BINDING:ay,UNIFORM_ENVIRONMENT_BINDING:ly,UNIFORM_DIFFUSEMAP_BINDING:fy,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:my,UBOLocal:vy,UBOWorldBound:Sy,INST_MAT_WORLD:Ay,INST_SH:Ty,UBOLocalBatched:by,UBOForwardLight:Ey,UBODeferredLight:Cy,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:xy,UBOSkinningAnimation:wy,INST_JOINT_ANIM_INFO:Dy,UBOSkinning:Ry,localDescriptorSetLayout_ResizeMaxJoints:Iy,UBOMorph:My,UBOUILocal:Py,UBOSH:By,UNIFORM_JOINT_TEXTURE_BINDING:Oy,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:Fy,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:Gy,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:Hy,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:Xy,UNIFORM_LIGHTMAP_TEXTURE_BINDING:Ky,UNIFORM_SPRITE_TEXTURE_BINDING:Jy,UNIFORM_REFLECTION_TEXTURE_BINDING:ev,UNIFORM_REFLECTION_STORAGE_BINDING:rv,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:av,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:lv,UNIFORM_REFLECTION_PROBE_DATA_MAP_BINDING:fv,UNIFORM_REFLECTION_PROBE_BLEND_CUBEMAP_BINDING:mv,CAMERA_DEFAULT_MASK:bv,CAMERA_EDITOR_MASK:Ev,MODEL_ALWAYS_MASK:Cv,supportsR16HalfFloatTexture:function(t){return(t.getFormatFeatures(Ac.R16F)&(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE))==(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE)},getDefaultShadowTexture:xv,supportsR32FloatTexture:wv,supportsRGBA16HalfFloatTexture:Dv,supportsRGBA32FloatTexture:function(t){return(t.getFormatFeatures(Ac.RGBA32F)&(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE))==(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE)},isEnableEffect:Rv}));var Iv=4227858432,Mv=66060288,Pv=1044480,Bv=function(t,e,i,n){return void 0===n&&(n=0),e<<26&Iv|t<<20&Mv|i<<12&Pv|4095&n},Ov=function(t){return(t&Iv)>>>26},Lv=function(t){return(t&Mv)>>>20},Nv=function(t){return(t&Pv)>>>12},Fv=function(t){return 4095&t},kv=function(t,e){return 67108863&t|e<<26&Iv},Vv=((Sv={})[bc.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),$(12010,i)},Sv[bc.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},Sv[bc.INT2]=function(t,e,i){return void 0===i&&(i=0),jn.fromArray(e,t,i)},Sv[bc.INT3]=function(t,e,i){return void 0===i&&(i=0),mn.fromArray(e,t,i)},Sv[bc.INT4]=function(t,e,i){return void 0===i&&(i=0),ln.fromArray(e,t,i)},Sv[bc.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},Sv[bc.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),jn.fromArray(e,t,i)},Sv[bc.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),mn.fromArray(e,t,i)},Sv[bc.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),ln.fromArray(e,t,i)},Sv[bc.MAT3]=function(t,e,i){return void 0===i&&(i=0),xn.fromArray(e,t,i)},Sv[bc.MAT4]=function(t,e,i){return void 0===i&&(i=0),Vn.fromArray(e,t,i)},Sv),Gv=((Av={})[bc.UNKNOWN]=function(t,e,i){return void 0===i&&(i=0),$(12010,i)},Av[bc.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Av[bc.INT2]=function(t,e,i){return void 0===i&&(i=0),jn.toArray(t,e,i)},Av[bc.INT3]=function(t,e,i){return void 0===i&&(i=0),mn.toArray(t,e,i)},Av[bc.INT4]=function(t,e,i){return void 0===i&&(i=0),ln.toArray(t,e,i)},Av[bc.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},Av[bc.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),jn.toArray(t,e,i)},Av[bc.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),mn.toArray(t,e,i)},Av[bc.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),ln.toArray(t,e,i)},Av[bc.MAT3]=function(t,e,i){return void 0===i&&(i=0),xn.toArray(t,e,i)},Av[bc.MAT4]=function(t,e,i){return void 0===i&&(i=0),Vn.toArray(t,e,i)},Av),Uv=((Tv={})[bc.INT]=function(t){return"number"==typeof t},Tv[bc.FLOAT]=function(t){return"number"==typeof t},Tv[bc.INT2]=function(t){return!!(t instanceof jn)},Tv[bc.FLOAT2]=function(t){return!!(t instanceof jn)},Tv[bc.INT3]=function(t){return!!(t instanceof mn)},Tv[bc.FLOAT3]=function(t){return!!(t instanceof mn)},Tv[bc.INT4]=function(t){return!!(t instanceof ln)},Tv[bc.FLOAT4]=function(t){return!!(t instanceof ln||t instanceof bn||t instanceof In)},Tv[bc.MAT3]=function(t){return!!(t instanceof xn)},Tv[bc.MAT4]=function(t){return!!(t instanceof Vn)},Tv),zv=[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 Hv(t){switch(t){case bc.BOOL:case bc.INT:case bc.UINT:case bc.FLOAT:return zv[0];case bc.BOOL2:case bc.INT2:case bc.UINT2:case bc.FLOAT2:return zv[1];case bc.BOOL4:case bc.INT4:case bc.UINT4:case bc.FLOAT4:return zv[2];case bc.MAT4:return zv[3];case bc.SAMPLER2D:return"default-texture";case bc.SAMPLER_CUBE:return"default-cube-texture";case bc.SAMPLER2D_ARRAY:return"default-array-texture";case bc.SAMPLER3D:return"default-3d-texture"}return zv[0]}function Wv(t){switch(t){case bc.SAMPLER2D:return"-texture";case bc.SAMPLER_CUBE:return"-cube-texture";case bc.SAMPLER2D_ARRAY:return"-array-texture";case bc.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function jv(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 Xv(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 $(16369),"-1"}}function Yv(t,e){for(var i=[],n=0;n<e.length;n++){var r=e[n],s=r.name,o=t[s],a=Xv(r,o),h=!o||"0"===o;i.push({name:s,value:a,isDefault:h})}return i}function qv(t,e){return t+e.reduce((function(t,e){return e.isDefault?t:t+"|"+e.name+e.value}),"")}function Kv(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 Qv(t,e,i){for(var n=[],r=t.attributes,s=0;s<r.length;s++)Kv(r[s].defines,i)&&n.push(e[s]);return n}function Zv(t,e){var i=t.defines;if(t.uber){for(var n="",r=0;r<i.length;r++){var s=i[r],o=e[s.name];if(o&&s._map){var a=s._map(o);n+=""+s._offset+a+"|"}}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 Jv=new Map;function $v(t,e){if(e.count)return t+Af(e.type)*e.count;var i=Jv.get(e.name);return void 0!==i?t+Af(e.type)*i:(et(16345,e.name),t)}function tS(t){return t.reduce($v,0)}function eS(t){for(var e={},i=0;i<t.blocks.length;i++)for(var n=t.blocks[i],r=n.members,s=0,o=0;o<r.length;o++){var a=r[o];e[a.name]=Bv(n.binding,a.type,a.count,s),s+=(Af(a.type)>>2)*a.count}for(var h=0;h<t.samplerTextures.length;h++){var u=t.samplerTextures[h];e[u.name]=Bv(u.binding,u.type,u.count)}return e}function iS(t){return Math.ceil(Math.log2(Math.max(t,2)))}function nS(t){for(var e=0,i=function(){var i=t.defines[n],r=1;if("number"===i.type){var s=i.range;r=iS(s[1]-s[0]+1),i._map=function(t){return t-s[0]}}else"string"===i.type?(r=iS(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 rS(t){return Object.keys(t).reduce((function(e,i){return e.reduce((function(e,n){for(var s=t[i],o=0;o<s.length;++o){var a=r({},n);a[i]=s[o],e.push(a)}return e}),[])}),[{}])}Jv.set("cc_joints",Ry.LAYOUT.members[0].count),Jv.set("cc_lightPos",Ey.LIGHTS_PER_PASS),Jv.set("cc_lightColor",Ey.LIGHTS_PER_PASS),Jv.set("cc_lightSizeRangeAngle",Ey.LIGHTS_PER_PASS),Jv.set("cc_lightDir",Ey.LIGHTS_PER_PASS),Jv.set("cc_lightBoundingSizeVS",Ey.LIGHTS_PER_PASS);var sS=new tf;function oS(t,e,i,n,r){for(var s=t.builtins[n],o=[],a=function(){var t=s.blocks[h],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&df))return $(16348,t.name),1;o.push(e),r&&!r.includes(n)&&r.push(n)},h=0;h<s.blocks.length;h++)a();Array.prototype.unshift.apply(e.shaderInfo.blocks,o);for(var u=[],l=function(){var t=s.samplerTextures[c],e=i.layouts[t.name],n=e&&i.bindings.find((function(t){return t.binding===e.binding}));if(!(e&&n&&n.descriptorType&pf))return $(16349,t.name),1;u.push(e),r&&!r.includes(n)&&r.push(n)},c=0;c<s.samplerTextures.length;c++)l();Array.prototype.unshift.apply(e.shaderInfo.samplerTextures,u),r&&r.sort((function(t,e){return t.binding-e.binding}))}function aS(t){switch(t.gfxAPI){case yc.GLES2:case yc.WEBGL:return"glsl1";case yc.GLES3:case yc.WEBGL2:return"glsl3";default:return"glsl4"}}var hS,uS,lS,cS,_S,fS,dS,pS=new(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(nS(i),this._templates[t.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new z_,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var o=i.blocks[s];n.blockSizes.push(tS(o.members)),n.bindings.push(new $_(o.binding,$c.UNIFORM_BUFFER,1,o.stageFlags)),n.shaderInfo.blocks.push(new B_(Jg.MATERIAL,o.binding,o.name,o.members.map((function(t){return new P_(t.name,t.type,t.count)})),1))}for(var a=0;a<i.samplerTextures.length;a++){var h=i.samplerTextures[a];n.bindings.push(new $_(h.binding,$c.SAMPLER_TEXTURE,h.count,h.stageFlags)),n.shaderInfo.samplerTextures.push(new O_(Jg.MATERIAL,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 $_(l.binding,$c.SAMPLER,l.count,l.stageFlags)),n.shaderInfo.samplers.push(new L_(Jg.MATERIAL,l.binding,l.name,l.count))}for(var c=0;c<i.textures.length;c++){var _=i.textures[c];n.bindings.push(new $_(_.binding,$c.TEXTURE,_.count,_.stageFlags)),n.shaderInfo.textures.push(new N_(Jg.MATERIAL,_.binding,_.name,_.type,_.count))}for(var f=0;f<i.buffers.length;f++){var d=i.buffers[f];n.bindings.push(new $_(d.binding,$c.STORAGE_BUFFER,1,d.stageFlags)),n.shaderInfo.buffers.push(new k_(Jg.MATERIAL,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 $_(m.binding,$c.STORAGE_IMAGE,m.count,m.stageFlags)),n.shaderInfo.images.push(new F_(Jg.MATERIAL,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 $_(y.binding,$c.INPUT_ATTACHMENT,y.count,y.stageFlags)),n.shaderInfo.subpassInputs.push(new V_(Jg.MATERIAL,y.binding,y.name,y.count))}n.gfxAttributes=[];for(var v=0;v<i.attributes.length;v++){var S=i.attributes[v];n.gfxAttributes.push(new U_(S.name,S.format,S.isNormalized,0,S.isInstanced,S.location))}oS(i,n,qg,"locals"),n.shaderInfo.stages.push(new G_(Uc.VERTEX,"")),n.shaderInfo.stages.push(new G_(Uc.FRAGMENT,"")),n.handleMap=eS(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||(sS.bindings=r.bindings,r.setLayouts[Jg.MATERIAL]=t.createDescriptorSetLayout(sS),sS.bindings=qg.bindings,r.setLayouts[Jg.LOCAL]=t.createDescriptorSetLayout(sS)),r.setLayouts[i?Jg.LOCAL:Jg.MATERIAL]},e.hasProgram=function(t){return void 0!==this._templates[t]},e.getKey=function(t,e){return Zv(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 o=r[s],a=this._cache[o];W("destroyed shader "+a.name),a.destroy(),delete this._cache[o]}},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 o=this._templates[e],a=this._templateInfos[o.hash];a.pipelineLayout||(this.getDescriptorSetLayout(t,e),oS(o,a,Yg,"globals"),a.setLayouts[Jg.GLOBAL]=n.descriptorSetLayout,a.pipelineLayout=t.createPipelineLayout(new nf(a.setLayouts)));var h=Yv(i,o.defines),u=n.constantMacros+o.constantMacros+h.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),l=o.glsl3,c=aS(t);c?l=o[c]:et(16346),a.shaderInfo.stages[0].source=u+l.vert,a.shaderInfo.stages[1].source=u+l.frag,a.shaderInfo.attributes=Qv(o,a.gfxAttributes,i),a.shaderInfo.name=qv(e,h);var _=a.shaderInfo;return this._cache[r]=t.createShader(_)},t}());v.programLib=pS;var mS=["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"],gS=t("e4",Ta("cc.EffectAsset")(((dS=function(t){function e(){var e;return(e=t.call(this)||this).techniques=lS&&lS(),e.shaders=cS&&cS(),e.combinations=_S&&_S(),e.hideInEditor=fS&&fS(),e}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 mS.includes(t)&&$(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(v.rendering&&v.rendering.enableEffectImport){!function(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)}}(this);var t=v.rendering.programLib;t.addEffect(this),t.init(nd.gfxDevice)}else pS.register(this);e.register(this),v.game.once(v.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){var t=this;if(v.rendering&&v.rendering.enableEffectImport)v.rendering.programLib.precompileEffect(nd.gfxDevice,this);else for(var e=v.director.root,i=function(){var i=t.shaders[n],r=t.combinations[n];if(!r)return 1;rS(r).forEach((function(t){return pS.getGFXShader(nd.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}(Fd))._effects={},dS._layoutValid=!0,lS=fa((uS=dS).prototype,"techniques",[Ma],(function(){return[]})),cS=fa(uS.prototype,"shaders",[Ma],(function(){return[]})),_S=fa(uS.prototype,"combinations",[Ma],(function(){return[]})),fS=fa(uS.prototype,"hideInEditor",[Ma,Ba],(function(){return!1})),hS=uS))||hS);v.EffectAsset=gS;var yS=function(){function t(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new od,this.scenes=new od,this.paths=new od}var e=t.prototype;return e.init=function(t){var e=this;!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 o=0,a=e.length;o<a;o++)e[o]=Ed(e[o]);for(var h in i){var u=i[h],l=u[1];u[1]=n[l]}}else{for(var c=Object.create(null),_=0,f=e.length;_<f;_++){var d=e[_];e[_]=c[d]=Ed(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 S=t.packs;for(var A in S)for(var T=S[A],b=0;b<T.length;++b)T[b]=e[T[b]];var E=t.versions;if(E)for(var C in E)for(var x=E[C],w=0;w<x.length;w+=2){var D=x[w];x[w]=e[D]||D}var R=t.redirect;if(R)for(var I=0;I<R.length;I+=2)R[I]=e[R[I]],R[I+1]=r[R[I+1]];if(t.extensionMap){var M=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 P in t.extensionMap)M(P)}}(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=Rd(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(qt(s.ctor,e))return s}}return null},e.getDirWithPath=function(t,e,i){"/"===(t=Rd(t))[t.length-1]&&(t=t.slice(0,-1));var n=i||[];return this.paths.forEach((function(i,r){if(r.startsWith(t)&&function(t,e){return!(t.length>e.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,o=i.length;s<o;s++){var a=i[s];e&&!qt(a.ctor,e)||n.push(a)}})),n},e.getAssetInfo=function(t){return this.assetInfos.get(t)||null},e.getSceneInfo=function(t){return t.endsWith(".scene")||(t+=".scene"),"/"===t[0]||t.startsWith("db://")||(t="/"+t),this.scenes.find((function(e,i){return i.endsWith(t)}))},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],o=3===n.length,a=this.assetInfos.get(i);a.path=r,a.ctor=se(s),e.has(r)?o?e.get(r).push(a):e.get(r).unshift(a):e.add(r,[a])}}},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,o=n.length;s<o;s++){var a=n[s],h=e.get(a),u=h.packs;u?1===o?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 o=0,a=i.length;o<a;o+=2){var h=i[o];e.get(h).nativeVer=i[o+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 vS(t,e){t._uuid&&e.push(t._uuid)}function SS(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 o=0;o<s.length;o++){var a=s[o];a instanceof Fd&&vS(a,e)}else if(s.constructor&&s.constructor!==Object)s instanceof Fd&&vS(s,e);else for(var h=Object.getOwnPropertyNames(s),u=0;u<h.length;u++){var l=s[h[u]];l instanceof Fd&&vS(l,e)}}}}function AS(t,e){for(var i=0;i<t._components.length;i++)SS(t._components[i],e);for(var n=0;n<t._children.length;n++)AS(t._children[n],e)}function TS(t,e,i,n){i.push(t._uuid);for(var r=vm.getDeps(t._uuid),s=0,o=r.length;s<o;s++){var a=ud.get(r[s]);if(a){var h=a._uuid;h in e?e[h]+=n:e[h]=a.refCount+n,i.includes(h)||TS(a,e,i,n)}}}var bS=[],ES=new(function(){function t(){this._persistNodeDeps=new od,this._toDelete=new od,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=[];AS(t,e);for(var i=0,n=e.length;i<n;i++){var r=ud.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=ud.get(e[i]);r&&r.decRef()}this._persistNodeDeps.remove(t.uuid)}},e._autoRelease=function(t,e,i){if(t){for(var n=vm.getDeps(t.uuid),r=0,s=n.length;r<s;r++){var o=ud.get(n[r]);o&&o.decRef(t.autoReleaseAssets)}var a=vm._depends.get(t.uuid);if(a&&a.persistDeps)for(var h=a.persistDeps,u=0,l=h.length;u<l;u++){var c=ud.get(h[u]);c&&c.decRef(t.autoReleaseAssets)}t.uuid!==e.uuid&&vm.remove(t.uuid)}var _=vm._depends.get(e.uuid);for(var d in _&&(_.persistDeps=[]),i){for(var p,m,g=i[d],y=this._persistNodeDeps.get(g.uuid),v=f(y);!(m=v()).done;){var S=m.value,A=ud.get(S);A&&A.addRef()}_&&(p=_.persistDeps).push.apply(p,y)}},e.tryRelease=function(t,e){void 0===e&&(e=!1),t instanceof Fd&&(e?this._free(t,e):(this._toDelete.add(t._uuid,t),this._eventListener||(this._eventListener=!0,He(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),eo(t,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!e&&t.refCount>0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,TS(t,e,bS,-1),bS.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&TS(ud.get(i),e,bS,1);return bS.length=0,e[t._uuid]}(t)>0)){ud.remove(i);for(var n=vm.getDeps(i),r=0,s=n.length;r<s;r++){var o=ud.get(n[r]);o&&(o.decRef(!1),this._free(o,!1))}t.destroy(),vm.remove(i)}},t}()),CS=null;function xS(t,e){for(var i=0,n=t.input.length;i<n;i++){var r=t.input[i];e&&!r.isNative&&r.content instanceof Fd&&r.content.decRef(!1),r.recycle()}t.input=null}function wS(t,e){return e?/\?/.test(t)?t+"&_t="+Date.now():t+"?_t="+Date.now():t}function DS(t,e,i,n,r){void 0===r&&(r=0),t(r,(function(s,o){r++,!s||r>e?n&&n(s,o):setTimeout((function(){DS(t,e,i,n,r)}),i)}))}function RS(t,e,i,n,s){try{for(var o=vm.parse(t,e),a=0,h=o.deps.length;a<h;a++){var u=o.deps[a];u in i||(i[u]=!0,n.push({uuid:u,bundle:s&&s.name}))}o.nativeDep&&(s&&(o.nativeDep.bundle=s.name),n.push(r({},o.nativeDep)))}catch(t){z(t.message,t.stack)}}function IS(t,e,i){e&&(i=void 0!==i?i:v.assetManager.cacheAsset,Dd(e)||!i||e.isDefault||ud.add(t,e))}function MS(t,e,i){var n=0,r=[],s=t.length;0===s&&i&&i(r);for(var o=function(t){t&&r.push(t),++n===s&&i&&i(r)},a=0;a<s;a++)e(t[a],o)}function PS(t,e,i){var n=t,r=e,s=i;if(void 0===i){var o="function"==typeof t;e?(s=e,o||(r=null)):void 0===e&&o&&(s=t,n=null,r=null),void 0!==e&&o&&(r=t,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function BS(t,e,i){var n=t,r=e,s=i;if(void 0===i){var o=qt(t,Fd);e?(s=e,o&&(r=null)):void 0!==e||o||(s=t,r=null,n=null),void 0===e||o||(r=t,n=null)}return{type:n,onProgress:r||CS,onComplete:s}}function OS(t,e,i,n){if(void 0===n&&(n={}),!i[e]||n[e])return!1;n[e]=!0;var r=!1,s=vm.getDeps(e);if(s)for(var o=0,a=s.length;o<a;o++){var h=s[o];if(h===t||OS(t,h,i,n)){r=!0;break}}return r}function LS(t){return function(e,i){if(t){var n=[];Array.isArray(i)?i.forEach((function(t){return t instanceof Fd&&n.push(t.addRef())})):i instanceof Fd&&n.push(i.addRef()),He((function(){n.forEach((function(t){return t.decRef(!1)})),t(e,i)}))}}}var NS=function(){function t(){this._config=new yS}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),_d.add(t.name,this)},e.load=function(t,e,i,n){var r=BS(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete,h={__requestType__:hd.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(t)};v.assetManager.loadAny(t,h,o,a)},e.preload=function(t,e,i,n){var r=BS(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;v.assetManager.preloadAny(t,{__requestType__:hd.PATH,type:s,bundle:this.name},o,a)},e.loadDir=function(t,e,i,n){var r=BS(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;v.assetManager.loadAny(t,{__requestType__:hd.DIR,type:s,bundle:this.name,__outputAsArray__:!0},o,a)},e.preloadDir=function(t,e,i,n){var r=BS(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;v.assetManager.preloadAny(t,{__requestType__:hd.DIR,type:s,bundle:this.name},o,a)},e.loadScene=function(t,e,i,n){var r=PS(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,v.assetManager.loadAny({scene:t},s,o,(function(t,e){if(t)z(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");a&&a(t,e)}))},e.preloadScene=function(t,e,i,n){var r=PS(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.bundle=this.name,v.assetManager.preloadAny({scene:t},s,o,(function(e){e&&et(1210,t,e.message),a&&a(e)}))},e.get=function(t,e){var i=this.getInfoWithPath(t,e);return i&&ud.get(i.uuid)||null},e.release=function(t,e){var i=this.get(t,e);i&&ES.tryRelease(i,!0)},e.releaseUnusedAssets=function(){var t=this;ud.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&ES.tryRelease(e)}))},e.releaseAll=function(){var t=this;ud.forEach((function(e){var i=t.getAssetInfo(e._uuid);i&&!i.redirect&&ES.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}(),FS=t("ec",new NS);function kS(t,e,i){var n=new A.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(st(4930,t)))}return"file:"!==A.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=t,n}function VS(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 o in e.xhrHeader)r.setRequestHeader(o,e.xhrHeader[o]);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}v.resources=FS;var GS=A.document,US={};function zS(t,e,i){if(US[t])return i&&i(null),null;var n=GS.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),US[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(st(4928,t)))}return"file:"!==A.location.protocol&&(n.crossOrigin="anonymous"),n.async=e.scriptAsyncLoading||!1,n.src=t,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),GS.body.appendChild(n),n}var HS=/^(?:\w+:\/\/|\.+\/).+/,WS=function(t,e,i){(Uo.hasFeature(Uo.Feature.IMAGE_BITMAP)&&v.assetManager.allowImageBitmap?jS:kS)(t,e,i)},jS=function(t,e,i){e.xhrResponseType="blob",VS(t,e,e.onFileProgress,i)},XS=function(t,e,i){e.xhrResponseType="json",VS(t,e,e.onFileProgress,i)},YS=function(t,e,i){e.xhrResponseType="arraybuffer",VS(t,e,e.onFileProgress,i)},qS=function(t,e,i){sA._downloadJson(t,e,(function(e,n){if(e)i(e);else{var r=Vp(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){sA._downloadArrayBuffer(""+xo(t)+i,{},(function(t,i){e?r(e):n(new Uint8Array(i))}))}))}))).then((function(t){var e=new kp(r.document,t);i(null,e)})).catch((function(t){i(t)}))}}))},KS=function(t,e,i){sA._downloadArrayBuffer(t,e,(function(t,e){if(t)i(t);else try{var n=Gp(new Uint8Array(e));i(null,n)}catch(t){i(t)}}))},QS=function(t,e,i){e.xhrResponseType="text",VS(t,e,e.onFileProgress,i)},ZS=function(t,e,i){var n=wo(t),r=t;HS.test(r)||(r=-1!==sA.remoteBundles.indexOf(n)?sA.remoteServerAddress+"remote/"+n:"assets/"+n);var s=e.version||sA.bundleVers[n],o=0,a=null,h=null;XS(r+"/config."+(s?s+".":"")+"json",e,(function(t,e){h=t||h,(a=e)&&(a.base=r+"/"),2==++o&&i(h,a)})),zS(r+"/index."+(s?s+".":"")+"js",e,(function(t){h=t||h,2==++o&&i(h,a)}))},JS=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=kS,this.downloadDomAudio=null,this.downloadFile=VS,this.downloadScript=zS,this._downloadArrayBuffer=YS,this._downloadJson=XS,this._downloaders={".png":WS,".jpg":WS,".bmp":WS,".jpeg":WS,".gif":WS,".ico":WS,".tiff":WS,".webp":WS,".image":WS,".pvr":YS,".pkm":YS,".astc":YS,".txt":QS,".xml":QS,".vsh":QS,".fsh":QS,".atlas":QS,".tmx":QS,".tsx":QS,".json":XS,".ExportJson":XS,".plist":QS,".ccon":qS,".cconb":KS,".fnt":QS,".binary":YS,".bin":YS,".dbbin":YS,".skel":YS,".js":zS,bundle:ZS,default:QS},this._downloading=new od,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?jt(this._downloaders,t):this._downloaders[t]=e},t.download=function(t,e,i,n,r){var s=this,o=ld.get(t);if(o)r(null,o);else{var a=this._downloading.get(t);if(a){a.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,_=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,f=this._downloaders[i]||this._downloaders.default;DS((function(i,o){if(0===i&&s._downloading.add(t,[r]),s.limited){s._updateTime();var a=function(t,e){s._totalNum--,s._handleQueueInNextFrame(c,_),o(t,e)};s._totalNum<c&&s._totalNumThisPeriod<_?(f(wS(e,s.appendTimeStamp),n,a),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:t,priority:n.priority||0,url:e,options:n,done:a,handler:f}),s._queueDirty=!0,s._totalNum<c&&s._handleQueueInNextFrame(c,_))}else f(wS(e,s.appendTimeStamp),n,o)}),l,this.retryInterval,(function(e,i){e||ld.add(t,i);for(var n=s._downloading.remove(t),r=0,o=n.length;r<o;r++)n[r](e,i)}))}}},t.loadSubpackage=function(t,e){v.assetManager.loadBundle(t,null,e)},t._updateTime=function(){var t=performance.now(),e=v.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(wS(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(t,e)},t._handleQueueInNextFrame=function(t,e){!this._checkNextPeriod&&this._queue.length>0&&(He(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},n(e,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}],[{key:"instance",get:function(){return e._instance||(e._instance=new e),e._instance}}]),e}();JS._instance=void 0;var $S,tA,eA,iA,nA,rA,sA=JS.instance,oA=JS.instance,aA=t("e0",Ta("cc.JsonAsset")((tA=function(t){function e(){var e;return(e=t.call(this)||this).json=eA&&eA(),e}return s(e,t),e}(Fd),eA=fa(tA.prototype,"json",[Ma],(function(){return null})),$S=tA))||$S);v.JsonAsset=aA;var hA,uA,lA=t("d$",Ta("cc.TextAsset")((nA=function(t){function e(){var e;return(e=t.call(this)||this).text=rA&&rA(),e}return s(e,t),e.prototype.toString=function(){return this.text},e}(Fd),rA=fa(nA.prototype,"text",[Ma],(function(){return""})),iA=nA))||iA);v.TextAsset=lA;var cA=t("dY",Ta("cc.BufferAsset")((m((uA=function(t){function e(){var e;return(e=t.call(this)||this)._buffer=null,e}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}(Fd)).prototype,"_nativeAsset",[_h],Object.getOwnPropertyDescriptor(uA.prototype,"_nativeAsset"),uA.prototype),hA=uA))||hA);function _A(t,e,i,n){var r=null,s=null;try{(r=new sp)._nativeUrl=t,r._nativeAsset=e}catch(t){s=t}n(s,r)}function fA(t,e,i,n){var r=new aA;r.json=e,n(null,r)}function dA(t,e,i,n){var r=new lA;r.text=e,n(null,r)}function pA(t,e,i,n){var r=new cA;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function mA(t,e,i,n){var r=new Fd;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}function gA(t,i,n,r){var s=_d.get(i.name);s||(s=i.name===gd.RESOURCES?FS:new NS,i.base=i.base||t+"/",s.init(i)),e.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}v.BufferAsset=cA;var yA=new(function(){function t(){this._creating=new od,this._producers={".png":_A,".jpg":_A,".bmp":_A,".jpeg":_A,".gif":_A,".ico":_A,".tiff":_A,".webp":_A,".image":_A,".pvr":_A,".pkm":_A,".astc":_A,".txt":dA,".xml":dA,".vsh":dA,".fsh":dA,".atlas":dA,".tmx":dA,".tsx":dA,".fnt":dA,".json":fA,".ExportJson":fA,".binary":pA,".bin":pA,".dbbin":pA,".skel":pA,bundle:gA,default:mA}}var e=t.prototype;return e.register=function(t,e){"object"==typeof t?jt(this._producers,t):this._producers[t]=e},e.create=function(t,e,i,n,r){var s=this,o=this._producers[i]||this._producers.default,a=ud.get(t);if(n.reloadAsset||!a){var h=this._creating.get(t);h?h.push(r):(this._creating.add(t,[r]),o(t,e,n,(function(e,i){!e&&i instanceof Fd&&(i._uuid=t,IS(t,i,n.cacheAsset));for(var r=s._creating.remove(t),o=0,a=r.length;o<a;o++)r[o](e,i)})))}else r(null,a)},t}()),vA=new(function(){function t(){this._loading=new od,this._unpackers={".json":this.unpackJson}}var e=t.prototype;return e.unpackJson=function(t,e,i,n){var r=Ot(!0),s=null;if(Array.isArray(e)){(e=function(t){if(t[0]<1)throw new Error(st(5304,t[0]));hm(t,!0,void 0,lm.reportMissingClass),um(t);for(var e=new cm(t[0]),i=t[1],n=t[2],r=t[3],s=t[4],o=t[5],a=0;a<o.length;++a)o[a].unshift(e,i,n,r,s);return o}(e)).length!==t.length&&et(4915);for(var o=0;o<t.length;o++)r[t[o]+"@import"]=e[o]}else{var a=he(Dm),h=he(sp);if(e.type===a&&e.data){var u=e.data;u.length!==t.length&&et(4915);for(var l=0;l<t.length;l++)r[t[l]+"@import"]=_m(a,{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&&et(4915);for(var _=0;_<t.length;_++)r[t[_]+"@import"]=c[_]}}n(s,r)},e.init=function(){this._loading.clear()},e.register=function(t,e){"object"==typeof t?jt(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(ld.has(t.id))i(null,ld.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 o=r[0];this._loading.add(o.uuid,[{onComplete:i,id:t.id}]),t.config;var a=Id(o.uuid,{ext:o.ext,bundle:t.config.name});oA.download(o.uuid,a,o.ext,t.options,(function(e,i){ld.remove(o.uuid),e&&z(e.message,e.stack),n.unpack(o.packedUuids,i,o.ext,t.options,(function(t,i){if(!t)for(var r in i)ld.add(r,i[r]);for(var s=n._loading.remove(o.uuid),a=0,h=s.length;a<h;a++){var u=s[a];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 oA.download(t.id,t.url,t.ext,t.options,i)},t}());function SA(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=[],o=r.total,a=n.__exclude__=n.__exclude__||Object.create(null);t.output=[],MS(t.input,(function(n,h){if(!n.isNative&&ud.has(n.uuid)){var u=ud.get(n.uuid);return n.content=u.addRef(),t.output.push(n),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n),void h()}vA.load(n,t.options,(function(u,l){u?t.isFinished||(!v.assetManager.force||i?(z(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||(a[n.uuid]=!0,RS(n.uuid,l,a,s,n.config),r.total=o+s.length),r.canInvoke&&t.dispatch("progress",++r.finish,r.total,n)),h()}))}),(function(){if(t.isFinished)return xS(t,!0),void t.dispatch("error");if(s.length>0){var o=vd.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:vd.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,o.output),o.recycle()),i&&AA(t),e(n)}});dd.async(o)}else i&&AA(t),e()}))}function AA(t){for(var e=t.output,i=0,n=e.length;i<n;i++)e[i].content&&e[i].content.decRef(!1)}var TA=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}(),bA=new(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 $(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}(TA)),EA=function(){function t(){this._parsing=new od,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=sp.parseCompressedTextures(t,0)}catch(t){U(n=t)}i(n,r)},e.parsePKMTex=function(t,e,i){var n=null,r=null;try{r=sp.parseCompressedTextures(t,1)}catch(t){U(n=t)}i(n,r)},e.parseASTCTex=function(t,e,i){var n=null,r=null;try{r=sp.parseCompressedTextures(t,2)}catch(t){U(n=t)}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=bA.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=mm(t,e)}catch(t){r=t}i(r,n)}else i(new Error("The json file of asset "+e.__uuid__+" is empty or missing"))},e.init=function(){this._parsing.clear()},e.register=function(t,e){"object"==typeof t?jt(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,o=cd.get(t);if(o)r(null,o);else{var a=this._parsing.get(t);if(a)a.push(r);else{var h=this._parsers[i];h?(this._parsing.add(t,[r]),h(e,n,(function(e,i){e?ld.remove(t):Dd(i)||cd.add(t,i);for(var n=s._parsing.remove(t),r=0,o=n.length;r<o;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}();EA._instance=void 0;var CA=EA.instance;function xA(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=[],MS(t.input,(function(s,o){var a=vd.create({input:s,onProgress:t.onProgress,options:n,progress:r,onComplete:function(n,h){n&&!t.isFinished&&(!v.assetManager.force||i?(z(n.message,n.stack),r.canInvoke=!1,e(n)):r.canInvoke&&t.dispatch("progress",++r.finish,r.total,s)),t.output.push(h),a.recycle(),o(null)}});wA.async(a)}),(function(){if(n.__exclude__=null,t.isFinished)return xS(t,!0),void t.dispatch("error");!function(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}(t),xS(t,!0),e()}))}var wA=new ad("loadOneAsset",[function(t,e){var i=t.output=t.input,n=i.options,r=i.isNative,s=i.uuid,o=i.file,a=n.reloadAsset;o||!a&&!r&&ud.has(s)?e():vA.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,o=i.file,a=i.options;if(i.isNative)CA.parse(s,o,i.ext,a,(function(r,o){r?e(r):(i.content=o,n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),ld.remove(s),cd.remove(s),e())}));else{var h=i.uuid;if(h in r){var u=r[h],l=u.finish,c=u.content,_=u.err,d=u.callbacks;n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),l||OS(h,h,r)?(c&&c.addRef(),i.content=c,e(_)):d.push({done:e,item:i})}else if(!a.reloadAsset&&ud.has(h)){var p=ud.get(h);i.content=p.addRef(),n.canInvoke&&t.dispatch("progress",++n.finish,n.total,i),e()}else a.__uuid__=h,CA.parse(s,o,"import",a,(function(i,n){i?e(i):function(t,e,i){var n=t.input,r=t.progress,s=n,o=s.uuid,a=s.id,h=s.options,u=s.config,l=h.cacheAsset,c=[];e.addRef&&e.addRef(),RS(o,e,Object.create(null),c,u),r.canInvoke&&t.dispatch("progress",++r.finish,r.total+=c.length,n);var _=t.options.__exclude__[o]={content:e,finish:!1,callbacks:[{done:i,item:n}]},d=vd.create({input:c,options:t.options,onProgress:t.onProgress,onError:vd.prototype.recycle,progress:r,onComplete:function(t){if(e.decRef&&e.decRef(!1),_.finish=!0,_.err=t,!t){for(var i,n=Array.isArray(d.output)?d.output:[d.output],r=Object.create(null),s=f(n);!(i=s()).done;){var h=i.value;h&&(r[h instanceof Fd?h._uuid+"@import":o+"@native"]=h)}!function(t,e,i){var n=fm.get(e);if(n){for(var r=0,s=n.length;r<s;r++){var o=n[r],a=i[o.uuid+"@import"];if(a)o.owner[o.prop]=a.addRef();else{if(et(16350,o.uuid),v.assetManager.dispatchAssetMissing(e,o.owner,o.prop,o.uuid),o.type&&o.type!==Fd){var h=new o.type;h.initDefault(o.uuid),o.owner[o.prop]=h}!0}}fm.delete(e)}dm.has(e)&&(i[t+"@native"]?e._nativeAsset=i[t+"@native"]:(!0,et(16351,t)),dm.delete(e))}(o,e,r);try{"function"!=typeof e.onLoaded||pm.has(e)||dm.has(e)||(e.onLoaded(),pm.add(e))}catch(t){et(16352,o,t.message,t.stack)}ld.remove(a),cd.remove(a),IS(o,e,l),d.recycle()}for(var u=_.callbacks,c=0,p=u.length;c<p;c++){var m=u[c];e.addRef&&e.addRef(),m.item.content=e,m.done(t)}u.length=0}});fd.async(d)}(t,n,e)}))}}]);function DA(t,e){var i=t.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case hd.PATH:case hd.UUID:case hd.DIR:case hd.SCENE:case hd.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 o=vd.create({input:t.input,options:n}),a=null;try{t.output=t.source=pd.sync(o)}catch(t){a=t;for(var h=0,u=o.output.length;h<u;h++)o.output[h].recycle()}o.recycle(),e(a)}var RA=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}();RA.MAX_DEAD_NUM=500,RA._deadPool=[];var IA=[];function MA(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=RA.create(),o=null,a=null;if("string"==typeof n&&((n=Object.create(null))[e.__requestType__||hd.UUID]=i[r]),"object"==typeof n){Wt(n,e),n.preset&&Wt(n,yd[n.preset]);var h=function(){var t;switch(u){case hd.UUID:var e,r=s.uuid=Ed(n.uuid);if(!n.bundle){var h=_d.find((function(t){return!!t.getAssetInfo(r)}));n.bundle=h&&h.name}if(_d.has(n.bundle)){if(o=_d.get(n.bundle).config,(a=o.getAssetInfo(r))&&a.redirect){if(!_d.has(a.redirect))throw new Error("Please load bundle "+a.redirect+" first");o=_d.get(a.redirect).config,a=o.getAssetInfo(r)}s.config=o,s.info=a}s.ext=n.ext||(null===(e=a)||void 0===e?void 0:e.extension)||".json";break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case hd.DIR:if(_d.has(n.bundle)){_d.get(n.bundle).config.getDirWithPath(n.dir,n.type,IA);for(var l,c=f(IA);!(l=c()).done;){var _=l.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:n.bundle})}IA.length=0}s.recycle(),s=null;break;case hd.PATH:if(_d.has(n.bundle)){if(o=_d.get(n.bundle).config,(a=o.getInfoWithPath(n.path,n.type))&&a.redirect){if(!_d.has(a.redirect))throw new Error("you need to load bundle "+a.redirect+" first");o=_d.get(a.redirect).config,a=o.getAssetInfo(a.uuid)}if(!a)throw s.recycle(),new Error("Bundle "+n.bundle+" doesn't contain "+n.path);s.config=o,s.uuid=a.uuid,s.info=a}s.ext=n.ext||(null===(t=a)||void 0===t?void 0:t.extension)||".json";break;case hd.SCENE:if(!n.bundle){var d=_d.find((function(t){return!!t.getSceneInfo(n.scene)}));n.bundle=d&&d.name}if(_d.has(n.bundle)){if(o=_d.get(n.bundle).config,(a=o.getSceneInfo(n.scene))&&a.redirect){if(!_d.has(a.redirect))throw new Error("you need to load bundle "+a.redirect+" first");o=_d.get(a.redirect).config,a=o.getAssetInfo(a.uuid)}if(!a)throw s.recycle(),new Error("Bundle "+o.name+" doesn't contain scene "+n.scene);s.config=o,s.uuid=a.uuid,s.info=a}break;case"__isNative__":s.isNative=n.__isNative__;break;case hd.URL:s.url=n.url,s.uuid=n.uuid||n.url,s.ext=n.ext||Co(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 PA(t){for(var e=t.output=t.input,i=function(){var t=e[n];if(md.has(t.uuid)){var i=md.get(t.uuid),r=_d.find((function(t){return!!t.getAssetInfo(i)}));if(r){var s;t.overrideUuid=i;var o=r.config,a=o.getAssetInfo(i);if(a&&a.redirect){if(!_d.has(a.redirect))throw new Error("Please load bundle "+a.redirect+" first");a=(o=_d.get(a.redirect).config).getAssetInfo(i)}t.config=o,t.info=a,t.ext=t.isNative?t.ext:(null===(s=a)||void 0===s?void 0:s.extension)||".json"}else $(16201,i,t.uuid)}},n=0;n<e.length;n++)i()}function BA(t){for(var e=t.output=t.input,i=0;i<e.length;i++){var n=e[i];if(!n.url){var r,s,o=n.config;s=n.isNative?o&&o.nativeBase?o.base+o.nativeBase:v.assetManager.generalNativeBase:o&&o.importBase?o.base+o.importBase:v.assetManager.generalImportBase;var a=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+"/"+a.slice(0,2)+"/"+a+h+"/"+n.options.__nativeName__:s+"/"+a.slice(0,2)+"/"+a+h+n.ext,n.url=r}}return null}var OA="asset-missing",LA=t("eb",function(){function t(){this.pipeline=fd.append(DA).append(xA),this.fetchPipeline=dd.append(DA).append(SA),this.transformPipeline=pd.append(MA).append(PA).append(BA),this.bundles=_d,this.assets=ud,this.assetsOverrideMap=md,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=vm,this.force=!1,this.allowImageBitmap=!1,this.utils=Od,this.downloader=oA,this.parser=CA,this.packManager=vA,this.cacheAsset=!0,this.cacheManager=null,this.presets=yd,this.factory=yA,this.preprocessPipe=DA,this.fetchPipe=SA,this.loadPipe=xA,this.references=null,this._releaseManager=ES,this._files=ld,this._parsed=cd,this._parsePipeline=null,this._projectBundles=[],this._eventTarget=new lo}var e=t.prototype;return e.onAssetMissing=function(t,e){this._eventTarget.on(OA,t,e)},e.offAssetMissing=function(t,e){this._eventTarget.off(OA,t,e)},e.dispatchAssetMissing=function(t,e,i,n){this._eventTarget.emit(OA,t,e,i,n)},e.init=function(t){void 0===t&&(t={});var e=t.server||Me.querySettings(Re.Category.ASSETS,"server")||"",i=t.bundleVers||Me.querySettings(Re.Category.ASSETS,"bundleVers")||{},n=t.remoteBundles||Me.querySettings(Re.Category.ASSETS,"remoteBundles")||[],r=t.downloadMaxConcurrency||Me.querySettings(Re.Category.ASSETS,"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||Me.querySettings(Re.Category.ASSETS,"importBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1));var o=t.nativeBase||Me.querySettings(Re.Category.ASSETS,"nativeBase")||"";o&&o.endsWith("/")&&(o=o.substr(0,o.length-1)),this.generalImportBase=s,this.generalNativeBase=o,this._projectBundles=Me.querySettings(Re.Category.ASSETS,"projectBundles")||[];var a=Me.querySettings(Re.Category.ASSETS,"assetsOverrides")||{};for(var h in a)this.assetsOverrideMap.set(h,a[h])},e.getBundle=function(t){return _d.get(t)||null},e.removeBundle=function(t){t._destroy(),_d.remove(t.name)},e.loadAny=function(t,e,i,n){var r=PS(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"default",t=Array.isArray(t)?t.slice():t;var h=vd.create({input:t,onProgress:o,onComplete:LS(a),options:s});fd.async(h)},e.preloadAny=function(t,e,i,n){var r=PS(e,i,n),s=r.options,o=r.onProgress,a=r.onComplete;s.preset=s.preset||"preload",t=Array.isArray(t)?t.slice():t;var h=vd.create({input:t,onProgress:o,onComplete:LS(a),options:s});dd.async(h)},e.loadRemote=function(t,e,i){var n=PS(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?(z(e.message,e.stack),s&&s(e,i)):yA.create(t,i,r.ext||Co(t),r,(function(t,e){s&&s(t,e)}))}))):LS(s)(null,this.assets.get(t))},e.loadBundle=function(t,e,i){var n=PS(e,void 0,i),r=n.options,s=n.onComplete,o=wo(t);this.bundles.has(o)?LS(s)(null,this.getBundle(o)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:t},r,null,(function(e,i){e?(z(e.message,e.stack),s&&s(e,i)):yA.create(t,i,"bundle",r,(function(t,e){s&&s(t,e)}))})))},e.releaseAsset=function(t){ES.tryRelease(t,!0)},e.releaseUnusedAssets=function(){ud.forEach((function(t){ES.tryRelease(t)}))},e.releaseAll=function(){ud.forEach((function(t){ES.tryRelease(t,!0)}))},e.loadWithJson=function(){throw new Error("Only valid in Editor")},n(t,[{key:"main",get:function(){return _d.get(gd.MAIN)||null}},{key:"resources",get:function(){return _d.get(gd.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}());LA._instance=void 0,LA.Pipeline=ad,LA.Task=vd,LA.Cache=od,LA.RequestItem=RA,LA.Bundle=NS,LA.BuiltinBundleName=gd,LA.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},LA.Downloader=JS,LA.Parser=EA,LA.DependUtil=gm;var NA=t("ea",v.assetManager=LA.instance);v.AssetManager=LA;var FA,kA,VA,GA=t("eh",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),o=0,a=0;a<4;a++)e[o]=0,e[o+1]=0,e[o+2]=0,e[o+3]=255,i[o]=0,i[o+1]=0,i[o+2]=0,i[o+3]=0,n[o]=119,n[o+1]=119,n[o+2]=119,n[o+3]=255,r[o]=255,r[o+1]=255,r[o+2]=255,r[o+3]=255,s[o]=127,s[o+1]=127,s[o+2]=255,s[o+3]=255,o+=4;var h=new Uint8Array(1024);o=0;for(var u=0;u<256;u++)h[o]=221,h[o+1]=221,h[o+2]=221,h[o+3]=255,o+=4;o=0;for(var l=0;l<8;l++){for(var c=0;c<8;c++)h[o]=85,h[o+1]=85,h[o+2]=85,h[o+3]=255,o+=4;o+=32}o+=32;for(var _=0;_<8;_++){for(var f=0;f<8;f++)h[o]=85,h[o+1]=85,h[o+2]=85,h[o+3]=255,o+=4;o+=32}var d={width:2,height:2,_data:e,_compressed:!1,format:Dm.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Dm.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:Dm.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:Dm.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:Dm.PixelFormat.RGBA8888},S={width:16,height:16,_data:h,_compressed:!1,format:Dm.PixelFormat.RGBA8888},A=new sp(d),T=new Dm;T._uuid="black-texture",T.image=A,t[T._uuid]=T;var b=new sp(p),E=new Dm;E._uuid="empty-texture",E.image=b,t[E._uuid]=E;var C=new wg;C._uuid="black-cube-texture",C.setMipFilter(wg.Filter.NEAREST),C.image={front:new sp(d),back:new sp(d),left:new sp(d),right:new sp(d),top:new sp(d),bottom:new sp(d)},t[C._uuid]=C;var x=new sp(m),w=new Dm;w._uuid="grey-texture",w.image=x,t[w._uuid]=w;var D=new wg;D._uuid="grey-cube-texture",D.setMipFilter(wg.Filter.NEAREST),D.image={front:new sp(m),back:new sp(m),left:new sp(m),right:new sp(m),top:new sp(m),bottom:new sp(m)},t[D._uuid]=D;var R=new sp(g),I=new Dm;I._uuid="white-texture",I.image=R,t[I._uuid]=I;var M=new wg;M._uuid="white-cube-texture",M.setMipFilter(wg.Filter.NEAREST),M.image={front:new sp(g),back:new sp(g),left:new sp(g),right:new sp(g),top:new sp(g),bottom:new sp(g)},t[M._uuid]=M;var P=new sp(y),B=new Dm;B._uuid="normal-texture",B.image=P,t[B._uuid]=B;var O=new sp(S),L=new Dm;L._uuid="default-texture",L.image=O,t[L._uuid]=L;var N=new wg;if(N.setMipFilter(wg.Filter.NEAREST),N._uuid="default-cube-texture",N.image={front:new sp(S),back:new sp(S),left:new sp(S),right:new sp(S),top:new sp(S),bottom:new sp(S)},t[N._uuid]=N,v.SpriteFrame){var F=new v.SpriteFrame,k=A,V=new Dm;V.image=k,F.texture=V,F._uuid="default-spriteframe",t[F._uuid]=F}},e.addAsset=function(t,e){this._resources[t]=e},e.get=function(t){return this._resources[t]},e.loadBuiltinAssets=function(){var t=this,e=Me.querySettings(Re.Category.ENGINE,"builtinAssets");if(!e)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){NA.loadBundle(gd.INTERNAL,(function(s){s?r(s):NA.loadAny(e,(function(e,s){e?r(e):(s.forEach((function(e){i[e.name]=e,ES.addIgnoredAsset(e),e instanceof v.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}()),UA=t("ei",v.builtinResMgr=new GA),zA=t("dj",(FA=new Map,kA=0,function(t){return"number"==typeof t?t:(FA.has(t)||(FA.set(t,1<<kA),kA++),FA.get(t))})),HA=t("de",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(){for(var t=0;t<this.instances.length;++t){var e=this.instances[t];e.vb.destroy(),e.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,o=t.descriptorSet.getTexture(Ky),a=t.descriptorSet.getTexture(av),h=t.descriptorSet.getTexture(lv),u=t.descriptorSet.getTexture(mv),l=t.useReflectionProbeType,c=i;c||(c=t.shaders[e]);for(var _=t.descriptorSet,f=0;f<this.instances.length;++f){var d,p,m=this.instances[f];if(!((null===(d=m.ia.indexBuffer)||void 0===d?void 0:d.objectID)!==(null===(p=s.indexBuffer)||void 0===p?void 0:p.objectID)||m.count>=1024)&&m.lightingMap.objectID===o.objectID&&m.useReflectionProbeType===l&&m.reflectionProbeCubemap.objectID===a.objectID&&m.reflectionProbePlanarMap.objectID===h.objectID&&m.reflectionProbeBlendCubemap.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=_,m.data.set(n.buffer,m.stride*m.count++),void(this.hasPendingModels=!0)}}for(var v=this._device.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,32*r,r)),S=new Uint8Array(32*r),A=s.vertexBuffers.slice(),T=s.attributes.slice(),b=s.indexBuffer,E=0;E<n.attributes.length;E++){var C=n.attributes[E],x=new U_(C.name,C.format,C.isNormalized,A.length,!0);T.push(x)}S.set(n.buffer),A.push(v);var w=new H_(T,A,b),D=this._device.createInputAssembler(w);this.instances.push({count:1,capacity:32,vb:v,data:S,ia:D,stride:r,shader:c,descriptorSet:_,lightingMap:o,reflectionProbeCubemap:a,reflectionProbePlanarMap:h,useReflectionProbeType:l,reflectionProbeBlendCubemap:u}),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(){for(var t=0;t<this.instances.length;++t)this.instances[t].count=0;this.hasPendingModels=!1},t}()),WA=new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.DEVICE),jA=new C_(null),XA=new ef(null);!function(t){t[t.NONE=0]="NONE",t[t.INSTANCING=1]="INSTANCING"}(VA||(VA={}));var YA=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 Vf,this._dss=new Ff,this._rs=new Nf,this._priority=Wg.DEFAULT,this._stage=Hg.DEFAULT,this._phase=zA("default"),this._passID=4294967295,this._subpassID=4294967295,this._phaseID=4294967295,this._primitive=Yc.TRIANGLE_LIST,this._batchingScheme=VA.NONE,this._dynamicStates=Zc.NONE,this._instancedBuffers={},this._hash=0,this._rootBufferDirty=!1,this._root=t,this._device=nd.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=zA(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(v.rendering&&v.rendering.enableEffectImport){var i=v.rendering.programLib.getKey(t._phaseID,t.program,t.defines);e=t._phaseID.toString()+","+i}else e=pS.getKey(t.program,t.defines);var n,r=e+","+t._primitive+","+t._dynamicStates;return r+=function(t){for(var e,i=",bs,"+t.isA2C,n=f(t.targets);!(e=n()).done;){var r=e.value;i+=",bt,"+r.blend+","+r.blendEq+","+r.blendAlphaEq+","+r.blendColorMask,i+=","+r.blendSrc+","+r.blendDst+","+r.blendSrcAlpha+","+r.blendDstAlpha}return i}(t._bs),r+=function(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}(t._dss),hc(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=bc.UNKNOWN);var n=this._propertyHandleMap[t];return n?(i?n=kv(n,i):e&&(n=kv(n,Ov(n)-e)),n+e):0},e.getBinding=function(e){var i=this.getHandle(e);return i?t.getBindingFromHandle(i):-1},e.setUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),o=this._getBlockView(r,n);Gv[r](o,i,s),this._rootBufferDirty=!0},e.getUniform=function(e,i){var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=t.getOffsetFromHandle(e),o=this._getBlockView(r,n);return Vv[r](o,i,s)},e.setUniformArray=function(e,i){for(var n=t.getBindingFromHandle(e),r=t.getTypeFromHandle(e),s=Af(r)>>2,o=this._getBlockView(r,n),a=t.getOffsetFromHandle(e),h=0;h<i.length;h++,a+=s)null!==i[h]&&Gv[r](o,i[h],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(){$(12102)},e.update=function(){this._descriptorSet?(this._rootBuffer&&this._rootBufferDirty&&(this._rootBuffer.update(this._rootBlock),this._rootBufferDirty=!1),this._descriptorSet.update()):et(12006)},e.getInstancedBuffer=function(t){return void 0===t&&(t=0),this._instancedBuffers[t]||(this._instancedBuffers[t]=new HA(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(e){var i=this.getHandle(e);if(i){for(var n=t.getTypeFromHandle(i),r=t.getBindingFromHandle(i),s=t.getOffsetFromHandle(i),o=t.getCountFromHandle(i),a=this._getBlockView(n,r),h=this._properties[e],u=h&&h.value||Hv(n),l=(Af(n)>>2)*o,c=0;c+u.length<=l;c+=u.length)a.set(u,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r,s=t.getTypeFromHandle(n),o=t.getBindingFromHandle(n),a=this._properties[e],h=a&&a.value,u=(r="string"==typeof h?UA.get(""+h+Wv(s)):h||UA.get(Hv(s)))&&r.getGFXTexture(),l=a&&void 0!==a.samplerHash?Wf.unpackFromHash(a.samplerHash):r&&r.getSamplerInfo(),c=this._device.getSampler(l);this._descriptorSet.bindSampler(o,c,i||0),this._descriptorSet.bindTexture(o,u,i||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),o=this._properties[r.name],a=o&&o.value||Hv(r.type),h=(Af(r.type)>>2)*r.count,u=0;u+a.length<=h;u+=a.length)s.set(a,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){if(v.rendering)for(var t,e=f(this._shaderInfo.descriptors[Jg.MATERIAL].samplerTextures);!(t=e()).done;)for(var i=t.value,n=0;n<i.count;++n)this.resetTexture(i.name,n);else for(var r=0;r<this._shaderInfo.samplerTextures.length;r++)for(var s=this._shaderInfo.samplerTextures[r],o=0;o<s.count;o++)this.resetTexture(s.name,o)},e.tryCompile=function(){var e=this._root.pipeline;if(!e)return!1;if(this._syncBatchingScheme(),v.rendering&&v.rendering.enableEffectImport){var i=v.rendering.programLib,n=i.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);if(!n)return $(12103,this._programName),!1;this._shader=n.shader,this._pipelineLayout=i.getPipelineLayout(this.device,this._phaseID,this._programName)}else{var r=pS.getGFXShader(this._device,this._programName,this._defines,e);if(!r)return $(12104,this._programName),!1;this._shader=r,this._pipelineLayout=pS.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 $(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(v.rendering&&v.rendering.enableEffectImport){var s=v.rendering.programLib.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);s&&(r=s.shader)}else r=pS.getGFXShader(this._device,this._programName,this._defines,e);for(var o=0;o<t.length;o++){var a=t[o];delete this._defines[a.name]}return r},e.beginChangeStatesSilently=function(){},e.endChangeStatesSilently=function(){},e._doInit=function(e,i){if(void 0===i&&(i=!1),this._priority=Wg.DEFAULT,this._stage=Hg.DEFAULT,v.rendering&&v.rendering.enableEffectImport){var n=v.rendering;if("number"==typeof e.phase?(this._passID=e._passID,this._subpassID=e._subpassID,this._phaseID=e._phaseID):(this._passID=n.getPassID(e.pass),this._passID!==n.INVALID_ID&&(e.subpass?(this._subpassID=n.getSubpassID(this._passID,e.subpass),this._phaseID=n.getPhaseID(this._subpassID,e.phase)):this._phaseID=n.getPhaseID(this._passID,e.phase))),this._passID===n.INVALID_ID)return void et(12107,e.program);if(this._phaseID===n.INVALID_ID)return void et(12108,e.program)}this._phase=zA("default"),this._primitive=Yc.TRIANGLE_LIST,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,v.rendering&&v.rendering.enableEffectImport?this._shaderInfo=v.rendering.programLib.getProgramInfo(this._phaseID,this._programName):this._shaderInfo=pS.getTemplate(e.program),this._properties=e.properties||this._properties;var s=this._device;t.fillPipelineInfo(this,e),e.stateOverrides&&t.fillPipelineInfo(this,e.stateOverrides),v.rendering&&v.rendering.enableEffectImport?XA.layout=v.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,e.program):XA.layout=pS.getDescriptorSetLayout(this._device,e.program),this._descriptorSet=this._device.createDescriptorSet(XA);var o,a,h=this._shaderInfo.blocks;if(v.rendering&&v.rendering.enableEffectImport){var u=v.rendering.programLib;o=u.getBlockSizes(this._phaseID,this._programName),a=u.getHandleMap(this._phaseID,this._programName)}else{var l=pS.getTemplateInfo(e.program);o=l.blockSizes,a=l.handleMap}if(v.rendering&&v.rendering.enableEffectImport){var c=v.rendering.programLib.getShaderInfo(this._phaseID,this.program);this._buildMaterialUniformBlocks(s,c.blocks,o)}else this._buildUniformBlocks(s,h,o);var _=this._propertyHandleMap=a,f={};for(var d in this._properties){var p=this._properties[d];p.handleInfo&&(f[d]=this.getHandle.apply(this,p.handleInfo))}Object.assign(_,f)},e._buildUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,o=0,a=0;a<e.length;a++){var h=i[a];r.push(o),o+=Math.ceil(h/n)*n,s=h}var u=r[r.length-1]+s;u&&(WA.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(WA),this._rootBlock=new ArrayBuffer(u));for(var l=0,c=0;l<e.length;l++){var _=e[l].binding,f=i[l];jA.buffer=this._rootBuffer,jA.offset=r[c++],jA.range=16*Math.ceil(f/16);var d=this._buffers[_]=t.createBuffer(jA);this._blocks[_]=new Float32Array(this._rootBlock,jA.offset,f/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,d)}},e._buildMaterialUniformBlocks=function(t,e,i){for(var n=t.capabilities.uboOffsetAlignment,r=[],s=0,o=0,a=0;a<e.length;a++)if(1===e[a].set){var h=i[a];r.push(o),o+=Math.ceil(h/n)*n,s=h}if(0!==s){var u=r[r.length-1]+s;u&&(WA.size=16*Math.ceil(u/16),this._rootBuffer=t.createBuffer(WA),this._rootBlock=new ArrayBuffer(u))}for(var l=0,c=0;l<e.length;l++)if(1===e[l].set){var _=e[l].binding,f=i[l];jA.buffer=this._rootBuffer,jA.offset=r[c++],jA.range=16*Math.ceil(f/16);var d=this._buffers[_]=t.createBuffer(jA);this._blocks[_]=new Float32Array(this._rootBlock,jA.offset,f/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,d)}},e._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(Sc.INSTANCED_ARRAYS)?this._batchingScheme=VA.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=VA.NONE):this._batchingScheme=VA.NONE},e._getBlockView=function(t,e){return t<bc.FLOAT?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,v.rendering&&v.rendering.enableEffectImport?this._pipelineLayout=v.rendering.programLib.getPipelineLayout(this.device,this._phaseID,this._programName):this._pipelineLayout=pS.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(){for(var t,e=!1,i=f(this.blendState.targets);!(t=i()).done;)t.value.blend&&(e=!0);return e}},{key:"root",get:function(){return this._root}},{key:"device",get:function(){return this._device}},{key:"shaderInfo",get:function(){return this._shaderInfo}},{key:"localSetLayout",get:function(){return v.rendering&&v.rendering.enableEffectImport?v.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):pS.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}();YA.getTypeFromHandle=Ov,YA.getBindingFromHandle=Lv,YA.getCountFromHandle=Nv,YA.getOffsetFromHandle=Fv;var qA,KA,QA,ZA,JA,$A,tT,eT,iT,nT=t("df",function(){function t(){}return t.getOrCreatePipelineState=function(t,e,i,n,r){var s=e.hash^n.hash^r.attributesHash^i.typedID,o=this._PSOHashMap.get(s);if(!o){var a=e.pipelineLayout,h=new rf(r.attributes),u=new Gf(i,a,n,h,e.rasterizerState,e.depthStencilState,e.blendState,e.primitive,e.dynamicStates);o=t.createPipelineState(u),this._PSOHashMap.set(s,o)}return o},t}());function rT(t,e){t.x=e.x*e.x,t.y=e.y*e.y,t.z=e.z*e.z}nT._PSOHashMap=new Map,new v_,new __;var sT=new ln,oT=t("e5",(qA=Ta("cc.Material"),KA=eh(gS),qA((ZA=function(t){function e(){var e;return(e=t.call(this)||this)._effectAsset=JA&&JA(),e._techIdx=$A&&$A(),e._defines=tT&&tT(),e._states=eT&&eT(),e._props=iT&&iT(),e._passes=[],e._hash=0,e}s(e,t),e.getHash=function(t){for(var e,i=0,n=f(t.passes);!(e=n()).done;)i^=e.value.hash;return i};var i=e.prototype;return i.initialize=function(t){this._passes.length?$(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(){$(16370,this.name)},i.overridePipelineStates=function(){$(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=f(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,o=0;o<s;o++){var a=r[o];this._uploadProperty(a,t,e)&&(this._props[a.propertyIndex][t]=e,n=!0)}else{i>=this._passes.length&&$(16372,i);var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||$(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 $(16372,e),null;var o=this._props[this._passes[e].propertyIndex];if(t in o)return o[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=gS.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,o=r.defines=this._defines[s]||(this._defines[s]={});if(r.stateOverrides=this._states[s]||(this._states[s]={}),void 0!==r.propertyIndex&&Object.assign(o,this._defines[r.propertyIndex]),void 0!==r.embeddedMacros&&Object.assign(o,r.embeddedMacros),!r.switch||o[r.switch]){var a=new YA(v.director.root);a.initialize(r),i.push(a)}}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=t.getHandle(e);if(!n)return!1;if(YA.getTypeFromHandle(n)<bc.SAMPLER1D)if(Array.isArray(i))t.setUniformArray(n,i);else if(null!==i){var r;if(null!==(r=t.properties[e])&&void 0!==r&&r.linear){var s=i;rT(sT,s),sT.w=s.w,i=sT}t.setUniform(n,i)}else t.resetUniform(e);else if(Array.isArray(i))for(var o=0;o<i.length;o++)this._bindTexture(t,n,i[o],o);else i?this._bindTexture(t,n,i):t.resetTexture(e);return!0},i._bindTexture=function(t,e,i,n){var r=YA.getBindingFromHandle(e);if(i instanceof Xf)t.bindTexture(r,i,n);else if(i instanceof lp){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=f(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 bn("#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}(Fd),JA=fa(ZA.prototype,"_effectAsset",[KA],(function(){return null})),$A=fa(ZA.prototype,"_techIdx",[Ma],(function(){return 0})),tT=fa(ZA.prototype,"_defines",[Ma],(function(){return[]})),eT=fa(ZA.prototype,"_states",[Ma],(function(){return[]})),iT=fa(ZA.prototype,"_props",[Ma],(function(){return[]})),QA=ZA))||QA));v.Material=oT;var aT=be({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048}),hT=be({Planar:0,ShadowMap:1}),uT=be({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3}),lT=be({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4}),cT=be({NONE:1,RemoveDuplicates:2,DisableRotationFix:3}),_T=hT.ShadowMap+1,fT=function(){function t(){this.fixedSphere=new Dr(0,0,0,.01),this.maxReceived=4,this._matLight=new Vn,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=_T,this._distance=0,this._planeBias=1,this._normal=new mn(0,1,0),this._shadowColor=new bn(0,0,0,76),this._size=new jn(1024,1024),this._shadowMapDirty=!1}var e=t.prototype;return e.getPlanarShader=function(t){this._material||(this._material=new oT,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:_T,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===hT.Planar)this._updatePlanarInfo();else{var t=v.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new oT,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=v.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:_T,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){mn.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}();fT.MAX_FAR=2e3,fT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),v.Shadows=fT;var dT=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);for(var r=0;r<n._shaderInfo.blocks.length;r++){var s=n._shaderInfo.blocks[r],o=n._blocks[s.binding],a=n._parent.blocks[s.binding];o.set(a)}n._rootBufferDirty=!0;for(var h=n._parent,u=0;u<n._shaderInfo.samplerTextures.length;u++)for(var l=n._shaderInfo.samplerTextures[u],_=0;_<l.count;_++){var f=h._descriptorSet.getSampler(l.binding,_),d=h._descriptorSet.getTexture(l.binding,_);n._descriptorSet.bindSampler(l.binding,f,_),n._descriptorSet.bindTexture(l.binding,d,_)}return t.prototype.tryCompile.call(c(n)),n}s(e,t);var i=e.prototype;return i.overridePipelineStates=function(t,e){this._bs.reset(),this._rs.reset(),this._dss.reset(),YA.fillPipelineInfo(this,t),YA.fillPipelineInfo(this,e),this._onStateChange()},i.tryCompile=function(e){if(e&&!jv(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=VA.NONE},i._onStateChange=function(){this._hash=YA.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(e,[{key:"parent",get:function(){return this._parent}}]),e}(YA),pT=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){if(this._passes&&this.effectAsset)if(void 0===e)for(var i,n=f(this._passes);!(i=n()).done;)i.value.tryCompile(t);else 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 o in t)s[o]=t[o];r.overridePipelineStates(i[r.passIndex],s)}else{var a=this._states[e]||(this._states[e]={});for(var h in t)a[h]=t[h];this._passes[e].overridePipelineStates(i[e],a)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(t){this._hash=oT.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 dT(e[i],this));return t},n(e,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),e}(oT),mT=null,gT=null,yT=be({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),vT=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 pT({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=v.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=UA.get("default-cube-texture"),this._model||(this._model=v.director.root.createModel(v.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!gT){var i=new oT;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),gT=new pT({parent:i})}this.enabled&&(mT||(mT=v.utils.createMesh(v.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,mT.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,mT.renderingSubMeshes[0],gT)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=v.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 o=this.envmap?this.envmap:this._default,a=this._editableMaterial?this._editableMaterial:gT;a&&(a.setProperty("environmentMap",o),a.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,a),this._updateSubModes())}},e._updateGlobalBinding=function(){if(this._globalDSManager){var t=nd.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(ly,i),this._globalDSManager.bindTexture(ly,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(ly,s),this._globalDSManager.bindTexture(ly,r)}}var o=this.diffuseMap?this.diffuseMap:this._default;if(o){var a=o.getGFXTexture(),h=t.getSampler(o.getSamplerInfo());this._globalDSManager.bindSampler(fy,h),this._globalDSManager.bindTexture(fy,a)}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 v.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(t,this._envmapLDR):this.setEnvMaps(this._envmapHDR,t)}},{key:"diffuseMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(t,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,t)}},{key:"reflectionMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}},{key:"editableMaterial",get:function(){return this._editableMaterial}}]),t}();v.Skybox=vT;var ST=new ln,AT=be({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3}),TT=AT.LAYERED+1,bT=function(){function t(){this._fogColor=new bn("#C8C8C8"),this._colorArray=new ln(.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:TT,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=v.director.root,e=this.enabled?this.type:TT,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=TT,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),ST.set(t.x,t.y,t.z,t.w),rT(this._colorArray,ST)}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:TT,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}();v.Fog=bT;var ET,CT,xT,wT,DT,RT,IT,MT,PT,BT,OT,LT,NT,FT,kT,VT,GT,UT,zT,HT,WT,jT,XT,YT,qT,KT,QT,ZT,JT,$T,tb,eb,ib,nb,rb,sb,ob,ab,hb,ub,lb,cb,_b,fb,db,pb,mb,gb,yb,vb,Sb,Ab,Tb,bb,Eb,Cb,xb,wb,Db,Rb,Ib,Mb,Pb,Bb,Ob,Lb,Nb,Fb,kb,Vb,Gb,Ub,zb,Hb,Wb,jb,Xb,Yb,qb,Kb,Qb,Zb,Jb,$b,tE,eE,iE,nE,rE,sE,oE,aE,hE,uE,lE,cE,_E,fE,dE,pE,mE,gE,yE,vE,SE,AE,TE,bE,EE,CE,xE,wE,DE,RE,IE,ME,PE,BE,OE,LE,NE,FE,kE,VE,GE,UE,zE,HE,WE,jE,XE=be({DEFAULT:0,LINEAR:1}),YE=function(){function t(){this._toneMappingType=XE.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=v.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}(),qE=new mn(0,1,0),KE=new mn,QE=new ln,ZE=new bn,JE=new In,$E=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)},tC=t("dy",(ET=Ta("cc.AmbientInfo"),CT=eh(ii),xT=Pa("_skyColor"),wT=Pa("_skyIllum"),DT=Pa("_groundAlbedo"),ET((m((IT=function(){function t(){this._skyColorHDR=MT&&MT(),this._skyIllumHDR=PT&&PT(),this._groundAlbedoHDR=BT&&BT(),this._skyColorLDR=OT&&OT(),this._skyIllumLDR=LT&<(),this._groundAlbedoLDR=NT&&NT(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.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=v.director.root.pipeline.pipelineSceneData.isHDR;return QE.set(t?this._skyColorHDR:this._skyColorLDR),$E(QE),ZE.set(255*QE.x,255*QE.y,255*QE.z,255)},set:function(t){QE.set(t.x,t.y,t.z,t.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(QE):this._skyColorLDR.set(QE),this._resource&&this._resource.skyColor.set(QE)}},{key:"skyColor",set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(t):this._skyColorLDR.set(t),this._resource&&this._resource.skyColor.set(t)}},{key:"skyIllum",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=t:this._skyIllumLDR=t,this._resource&&(this._resource.skyIllum=t)}},{key:"groundLightingColor",get:function(){var t=v.director.root.pipeline.pipelineSceneData.isHDR;return QE.set(t?this._groundAlbedoHDR:this._groundAlbedoLDR),$E(QE),ZE.set(255*QE.x,255*QE.y,255*QE.z,255)},set:function(t){QE.set(t.x,t.y,t.z,t.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(QE):this._groundAlbedoLDR.set(QE),this._resource&&this._resource.groundAlbedo.set(QE)}},{key:"groundAlbedo",set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(t):this._groundAlbedoLDR.set(t),this._resource&&this._resource.groundAlbedo.set(t)}}]),t}()).prototype,"skyIllum",[CT],Object.getOwnPropertyDescriptor(IT.prototype,"skyIllum"),IT.prototype),MT=fa(IT.prototype,"_skyColorHDR",[Ma,xT],(function(){return new ln(.2,.5,.8,1)})),PT=fa(IT.prototype,"_skyIllumHDR",[Ma,wT],(function(){return jg.SKY_ILLUM})),BT=fa(IT.prototype,"_groundAlbedoHDR",[Ma,DT],(function(){return new ln(.2,.2,.2,1)})),OT=fa(IT.prototype,"_skyColorLDR",[Ma],(function(){return new ln(.2,.5,.8,1)})),LT=fa(IT.prototype,"_skyIllumLDR",[Ma],(function(){return jg.SKY_ILLUM})),NT=fa(IT.prototype,"_groundAlbedoLDR",[Ma],(function(){return new ln(.2,.2,.2,1)})),RT=IT))||RT));v.AmbientInfo=tC;var eC=t("dz",(FT=Ta("cc.SkyboxInfo"),kT=eh(yT),VT=eh(wg),GT=eh(ii),UT=eh(wg),zT=eh(wg),HT=eh(oT),WT=eh(wg),jT=Pa("_envmap"),XT=eh(wg),YT=eh(wg),qT=eh(wg),KT=eh(oT),QT=eh(wg),ZT=eh(wg),FT((m(($T=function(){function t(){this._envLightingType=tb&&tb(),this._envmapHDR=eb&&eb(),this._envmapLDR=ib&&ib(),this._diffuseMapHDR=nb&&nb(),this._diffuseMapLDR=rb&&rb(),this._enabled=sb&&sb(),this._useHDR=ob&&ob(),this._editableMaterial=ab&&ab(),this._reflectionHDR=hb&&hb(),this._reflectionLDR=ub&&ub(),this._rotationAngle=lb&&lb(),this._resource=null}var e=t.prototype;return e.activate=function(t){this.envLightingType=this._envLightingType,this._resource=t,this._resource.initialize(this),this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setSkyboxMaterial(this._editableMaterial),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.setRotationAngle(this._rotationAngle),this._resource.activate()},e.updateEnvMap=function(t){t||(this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=yT.HEMISPHERE_DIFFUSE,$(15001)),this._resource&&(this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.useDiffuseMap=this.applyDiffuseMap,this._resource.envmap=t)},e.setMaterialProperty=function(t,e,i){this._resource&&this._resource.enabled&&this._resource.editableMaterial&&(this._resource.editableMaterial.setProperty(t,e,i),this._resource.editableMaterial.passes.forEach((function(t){t.update()})))},n(t,[{key:"applyDiffuseMap",get:function(){return yT.DIFFUSEMAP_WITH_REFLECTION===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||yT.HEMISPHERE_DIFFUSE===t?(yT.HEMISPHERE_DIFFUSE===t?(this.useIBL=!1,this.applyDiffuseMap=!1):yT.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===t?(this.useIBL=!0,this.applyDiffuseMap=!1):yT.DIFFUSEMAP_WITH_REFLECTION===t&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=t):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=yT.HEMISPHERE_DIFFUSE,$(15001))}},{key:"useIBL",get:function(){return yT.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(t){this._resource&&(this._resource.useIBL=t)}},{key:"useHDR",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR=t,this._useHDR=t,this._resource&&this.envLightingType===yT.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=yT.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION,$(15e3)):this.diffuseMap.isDefault&&$(15002)),this._resource&&(this._resource.useHDR=this._useHDR,this._resource.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(t){var e=v.director.root.pipeline.pipelineSceneData.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=yT.HEMISPHERE_DIFFUSE,$(15001)),this._resource&&(this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.useDiffuseMap=this.applyDiffuseMap,this._resource.envmap=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 v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR=t:this._diffuseMapLDR=t,this._resource&&this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR)}},{key:"reflectionMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}()).prototype,"envLightingType",[kT],Object.getOwnPropertyDescriptor($T.prototype,"envLightingType"),$T.prototype),m($T.prototype,"envmap",[VT],Object.getOwnPropertyDescriptor($T.prototype,"envmap"),$T.prototype),m($T.prototype,"rotationAngle",[GT],Object.getOwnPropertyDescriptor($T.prototype,"rotationAngle"),$T.prototype),m($T.prototype,"diffuseMap",[UT],Object.getOwnPropertyDescriptor($T.prototype,"diffuseMap"),$T.prototype),m($T.prototype,"reflectionMap",[zT],Object.getOwnPropertyDescriptor($T.prototype,"reflectionMap"),$T.prototype),m($T.prototype,"skyboxMaterial",[HT],Object.getOwnPropertyDescriptor($T.prototype,"skyboxMaterial"),$T.prototype),tb=fa($T.prototype,"_envLightingType",[Ma],(function(){return yT.HEMISPHERE_DIFFUSE})),eb=fa($T.prototype,"_envmapHDR",[Ma,WT,jT],(function(){return null})),ib=fa($T.prototype,"_envmapLDR",[Ma,XT],(function(){return null})),nb=fa($T.prototype,"_diffuseMapHDR",[Ma,YT],(function(){return null})),rb=fa($T.prototype,"_diffuseMapLDR",[Ma,qT],(function(){return null})),sb=fa($T.prototype,"_enabled",[Ma],(function(){return!1})),ob=fa($T.prototype,"_useHDR",[Ma],(function(){return!0})),ab=fa($T.prototype,"_editableMaterial",[Ma,KT],(function(){return null})),hb=fa($T.prototype,"_reflectionHDR",[Ma,QT],(function(){return null})),ub=fa($T.prototype,"_reflectionLDR",[Ma,ZT],(function(){return null})),lb=fa($T.prototype,"_rotationAngle",[Ma],(function(){return 0})),JT=$T))||JT));v.SkyboxInfo=eC;var iC=t("dA",(cb=Ta("cc.FogInfo"),_b=eh(AT),fb=eh(ii),db=eh(ii),pb=eh(ii),mb=eh(ii),gb=eh(ii),yb=eh(ii),cb(((Mb=function(){function t(){this._type=Ab&&Ab(),this._fogColor=Tb&&Tb(),this._enabled=bb&&bb(),this._fogDensity=Eb&&Eb(),this._fogStart=Cb&&Cb(),this._fogEnd=xb&&xb(),this._fogAtten=wb&&wb(),this._fogTop=Db&&Db(),this._fogRange=Rb&&Rb(),this._accurate=Ib&&Ib(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t,t&&(this._resource.type=this._type)))}},{key:"accurate",get:function(){return this._accurate},set:function(t){this._accurate!==t&&(this._accurate=t,this._resource&&(this._resource.accurate=t,t&&(this._resource.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}()).FogType=AT,m((Sb=Mb).prototype,"type",[_b],Object.getOwnPropertyDescriptor(Sb.prototype,"type"),Sb.prototype),m(Sb.prototype,"fogDensity",[fb],Object.getOwnPropertyDescriptor(Sb.prototype,"fogDensity"),Sb.prototype),m(Sb.prototype,"fogStart",[db],Object.getOwnPropertyDescriptor(Sb.prototype,"fogStart"),Sb.prototype),m(Sb.prototype,"fogEnd",[pb],Object.getOwnPropertyDescriptor(Sb.prototype,"fogEnd"),Sb.prototype),m(Sb.prototype,"fogAtten",[mb],Object.getOwnPropertyDescriptor(Sb.prototype,"fogAtten"),Sb.prototype),m(Sb.prototype,"fogTop",[gb],Object.getOwnPropertyDescriptor(Sb.prototype,"fogTop"),Sb.prototype),m(Sb.prototype,"fogRange",[yb],Object.getOwnPropertyDescriptor(Sb.prototype,"fogRange"),Sb.prototype),Ab=fa(Sb.prototype,"_type",[Ma],(function(){return AT.LINEAR})),Tb=fa(Sb.prototype,"_fogColor",[Ma],(function(){return new bn("#C8C8C8")})),bb=fa(Sb.prototype,"_enabled",[Ma],(function(){return!1})),Eb=fa(Sb.prototype,"_fogDensity",[Ma],(function(){return.3})),Cb=fa(Sb.prototype,"_fogStart",[Ma],(function(){return.5})),xb=fa(Sb.prototype,"_fogEnd",[Ma],(function(){return 300})),wb=fa(Sb.prototype,"_fogAtten",[Ma],(function(){return 5})),Db=fa(Sb.prototype,"_fogTop",[Ma],(function(){return 1.5})),Rb=fa(Sb.prototype,"_fogRange",[Ma],(function(){return 1.2})),Ib=fa(Sb.prototype,"_accurate",[Ma],(function(){return!1})),vb=Sb))||vb)),nC=t("dB",(Pb=Ta("cc.ShadowsInfo"),Bb=eh(hT),Ob=eh(ii),Lb=eh(ii),Nb=eh(ei),Fb=eh(aT),Pb((m((Vb=function(){function t(){this._enabled=Gb&&Gb(),this._type=Ub&&Ub(),this._normal=zb&&zb(),this._distance=Hb&&Hb(),this._planeBias=Wb&&Wb(),this._shadowColor=jb&&jb(),this._maxReceived=Xb&&Xb(),this._size=Yb&&Yb(),this._resource=null}var e=t.prototype;return e.setPlaneFromNode=function(t){t.getWorldRotation(JE),this.planeDirection=mn.transformQuat(KE,qE,JE),t.getWorldPosition(KE),this.planeHeight=mn.dot(this._normal,KE)},e.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},n(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t,this._resource&&(this._resource.enabled=t,t&&(this._resource.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){mn.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){this._size.set(t,t),this._resource&&(this._resource.size.set(t,t),this._resource.shadowMapDirty=!0)}}]),t}()).prototype,"type",[Bb],Object.getOwnPropertyDescriptor(Vb.prototype,"type"),Vb.prototype),m(Vb.prototype,"planeHeight",[Ob],Object.getOwnPropertyDescriptor(Vb.prototype,"planeHeight"),Vb.prototype),m(Vb.prototype,"planeBias",[Lb],Object.getOwnPropertyDescriptor(Vb.prototype,"planeBias"),Vb.prototype),m(Vb.prototype,"maxReceived",[Nb],Object.getOwnPropertyDescriptor(Vb.prototype,"maxReceived"),Vb.prototype),m(Vb.prototype,"shadowMapSize",[Fb],Object.getOwnPropertyDescriptor(Vb.prototype,"shadowMapSize"),Vb.prototype),Gb=fa(Vb.prototype,"_enabled",[Ma],(function(){return!1})),Ub=fa(Vb.prototype,"_type",[Ma],(function(){return hT.Planar})),zb=fa(Vb.prototype,"_normal",[Ma],(function(){return new mn(0,1,0)})),Hb=fa(Vb.prototype,"_distance",[Ma],(function(){return 0})),Wb=fa(Vb.prototype,"_planeBias",[Ma],(function(){return 1})),jb=fa(Vb.prototype,"_shadowColor",[Ma],(function(){return new bn(0,0,0,76)})),Xb=fa(Vb.prototype,"_maxReceived",[Ma],(function(){return 4})),Yb=fa(Vb.prototype,"_size",[Ma],(function(){return new jn(1024,1024)})),kb=Vb))||kb));v.ShadowsInfo=nC;var rC=t("dC",new mn(-1024,-1024,-1024)),sC=t("dD",new mn(1024,1024,1024)),oC=t("dE",8),aC=t("dF",(qb=Ta("cc.OctreeInfo"),Kb=eh(ei),qb((m((Zb=function(){function t(){this._enabled=Jb&&Jb(),this._minPos=$b&&$b(),this._maxPos=tE&&tE(),this._depth=eE&&eE(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.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}()).prototype,"depth",[Kb],Object.getOwnPropertyDescriptor(Zb.prototype,"depth"),Zb.prototype),Jb=fa(Zb.prototype,"_enabled",[Ma],(function(){return!1})),$b=fa(Zb.prototype,"_minPos",[Ma],(function(){return new mn(rC)})),tE=fa(Zb.prototype,"_maxPos",[Ma],(function(){return new mn(sC)})),eE=fa(Zb.prototype,"_depth",[Ma],(function(){return oC})),Qb=Zb))||Qb));v.OctreeInfo=aC;var hC=t("dG",(iE=Ta("cc.SkinInfo"),nE=eh(ii),rE=eh(ii),iE((m((oE=function(){function t(){this._enabled=aE&&aE(),this._blurRadius=hE&&hE(),this._sssIntensity=uE&&uE(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.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}()).prototype,"blurRadius",[nE],Object.getOwnPropertyDescriptor(oE.prototype,"blurRadius"),oE.prototype),m(oE.prototype,"sssIntensity",[rE],Object.getOwnPropertyDescriptor(oE.prototype,"sssIntensity"),oE.prototype),aE=fa(oE.prototype,"_enabled",[Ma],(function(){return!0})),hE=fa(oE.prototype,"_blurRadius",[Ma],(function(){return.01})),uE=fa(oE.prototype,"_sssIntensity",[Ma],(function(){return 3})),sE=oE))||sE));v.SkinInfo=hC;var uC=t("dH",(lE=Ta("cc.PostSettingsInfo"),cE=eh(XE),lE((m((fE=function(){function t(){this._toneMappingType=dE&&dE(),this._resource=null}return t.prototype.activate=function(t){this._resource=t,this._resource.initialize(this),this._resource.activate()},n(t,[{key:"toneMappingType",get:function(){return this._toneMappingType},set:function(t){this._toneMappingType=t,this._resource&&(this._resource.toneMappingType=t)}}]),t}()).prototype,"toneMappingType",[cE],Object.getOwnPropertyDescriptor(fE.prototype,"toneMappingType"),fE.prototype),dE=fa(fE.prototype,"_toneMappingType",[Ma],(function(){return XE.DEFAULT})),_E=fE))||_E));v.PostSettingsInfo=uC;var lC,cC,_C,fC,dC,pC,mC,gC,yC,vC,SC,AC,TC,bC,EC,CC,xC,wC,DC,RC,IC,MC,PC,BC,OC,LC,NC,FC,kC,VC,GC,UC,zC,HC,WC,jC,XC,YC,qC,KC,QC,ZC,JC,$C,tx,ex,ix,nx,rx,sx,ox,ax,hx,ux,lx,cx,_x,fx,dx,px,mx,gx,yx,vx,Sx,Ax,Tx,bx,Ex,Cx=t("dI",(pE=Ta("cc.LightProbeInfo"),mE=eh(ii),gE=eh(ei),yE=eh(ei),vE=eh(ii),SE=eh(ii),pE((m((TE=function(){function t(){this._giScale=bE&&bE(),this._giSamples=EE&&EE(),this._bounces=CE&&CE(),this._reduceRinging=xE&&xE(),this._showProbe=wE&&wE(),this._showWireframe=DE&&DE(),this._showConvex=RE&&RE(),this._data=IE&&IE(),this._lightProbeSphereVolume=ME&&ME(),this._nodes=[],this._scene=null,this._resource=null}var e=t.prototype;return e.activate=function(t,e){this._scene=t,this._resource=e,this._resource.initialize(this)},e.onProbeBakeFinished=function(){this.onProbeBakingChanged(this._scene)},e.onProbeBakeCleared=function(){this.clearSHCoefficients(),this.onProbeBakingChanged(this._scene)},e.onProbeBakingChanged=function(t){if(t){t.emit(Nm.LIGHT_PROBE_BAKING_CHANGED);for(var e=0;e<t.children.length;e++){var i=t.children[e];this.onProbeBakingChanged(i)}}},e.clearSHCoefficients=function(){if(this._data){for(var t=this._data.probes,e=0;e<t.length;e++)t[e].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),v.internal.LightProbesData){this._data||(this._data=new v.internal.LightProbesData,this._resource&&(this._resource.data=this._data));for(var e=[],i=0;i<this._nodes.length;i++){var n=this._nodes[i].node,r=this._nodes[i].probes,s=n.worldPosition;if(r)for(var o=0;o<r.length;o++){var a=new mn(0,0,0);mn.add(a,r[o],s),e.push(a)}}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;if(t)for(var e=t.models,i=0;i<e.length;i++)e[i].clearSHUBOs()}},e.resetAllTetraIndices=function(){if(this._scene){var t=this._scene.renderScene;if(t)for(var e=t.models,i=0;i<e.length;i++)e[i].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}()).prototype,"giScale",[mE],Object.getOwnPropertyDescriptor(TE.prototype,"giScale"),TE.prototype),m(TE.prototype,"giSamples",[gE],Object.getOwnPropertyDescriptor(TE.prototype,"giSamples"),TE.prototype),m(TE.prototype,"bounces",[yE],Object.getOwnPropertyDescriptor(TE.prototype,"bounces"),TE.prototype),m(TE.prototype,"reduceRinging",[vE],Object.getOwnPropertyDescriptor(TE.prototype,"reduceRinging"),TE.prototype),m(TE.prototype,"lightProbeSphereVolume",[SE],Object.getOwnPropertyDescriptor(TE.prototype,"lightProbeSphereVolume"),TE.prototype),bE=fa(TE.prototype,"_giScale",[Ma],(function(){return 1})),EE=fa(TE.prototype,"_giSamples",[Ma],(function(){return 1024})),CE=fa(TE.prototype,"_bounces",[Ma],(function(){return 2})),xE=fa(TE.prototype,"_reduceRinging",[Ma],(function(){return 0})),wE=fa(TE.prototype,"_showProbe",[Ma],(function(){return!0})),DE=fa(TE.prototype,"_showWireframe",[Ma],(function(){return!0})),RE=fa(TE.prototype,"_showConvex",[Ma],(function(){return!1})),IE=fa(TE.prototype,"_data",[Ma],(function(){return null})),ME=fa(TE.prototype,"_lightProbeSphereVolume",[Ma],(function(){return 1})),AE=TE))||AE)),xx=t("dJ",(PE=Ta("cc.SceneGlobals"),BE=eh(eC),PE((LE=function(){function t(){this.ambient=NE&&NE(),this.shadows=FE&&FE(),this._skybox=kE&&kE(),this.fog=VE&&VE(),this.octree=GE&&GE(),this.skin=UE&&UE(),this.lightProbeInfo=zE&&zE(),this.postSettings=HE&&HE(),this.bakedWithStationaryMainLight=WE&&WE(),this.bakedWithHighpLightmap=jE&&jE(),this.disableLightmap=!1}return t.prototype.activate=function(t){var e=v.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),v.director.root.onGlobalPipelineStateChanged()},n(t,[{key:"skybox",get:function(){return this._skybox},set:function(t){this._skybox=t}}]),t}(),NE=fa(LE.prototype,"ambient",[Ma],(function(){return new tC})),FE=fa(LE.prototype,"shadows",[Ma],(function(){return new nC})),kE=fa(LE.prototype,"_skybox",[Ma],(function(){return new eC})),VE=fa(LE.prototype,"fog",[Ma],(function(){return new iC})),m(LE.prototype,"skybox",[BE],Object.getOwnPropertyDescriptor(LE.prototype,"skybox"),LE.prototype),GE=fa(LE.prototype,"octree",[Ma],(function(){return new aC})),UE=fa(LE.prototype,"skin",[Ma],(function(){return new hC})),zE=fa(LE.prototype,"lightProbeInfo",[Ma],(function(){return new Cx})),HE=fa(LE.prototype,"postSettings",[Ma],(function(){return new uC})),WE=fa(LE.prototype,"bakedWithStationaryMainLight",[Ma],(function(){return!1})),jE=fa(LE.prototype,"bakedWithHighpLightmap",[Ma],(function(){return!1})),OE=LE))||OE));v.SceneGlobals=xx;var Dx=(lC=Ta("cc.TargetInfo"),cC=eh([ri]),lC((fC=function(){this.localID=dC&&dC()},dC=fa(fC.prototype,"localID",[Ma,cC],(function(){return[]})),_C=fC))||_C),Rx=(pC=Ta("cc.TargetOverrideInfo"),mC=eh($s),gC=eh(Dx),yC=eh([ri]),vC=eh(xg),SC=eh(Dx),pC((TC=function(){this.source=bC&&bC(),this.sourceInfo=EC&&EC(),this.propertyPath=CC&&CC(),this.target=xC&&xC(),this.targetInfo=wC&&wC()},bC=fa(TC.prototype,"source",[Ma,mC],(function(){return null})),EC=fa(TC.prototype,"sourceInfo",[Ma,gC],(function(){return null})),CC=fa(TC.prototype,"propertyPath",[Ma,yC],(function(){return[]})),xC=fa(TC.prototype,"target",[Ma,vC],(function(){return null})),wC=fa(TC.prototype,"targetInfo",[Ma,SC],(function(){return null})),AC=TC))||AC),Ix=Ta("cc.CompPrefabInfo")((RC=function(){this.fileId=IC&&IC()},IC=fa(RC.prototype,"fileId",[Ma],(function(){return""})),DC=RC))||DC,Mx=(MC=Ta("CCPropertyOverrideInfo"),PC=eh(Dx),BC=eh([ri]),MC((LC=function(){function t(){this.targetInfo=NC&&NC(),this.propertyPath=FC&&FC(),this.value=kC&&kC()}return t.prototype.isTarget=function(){},t}(),NC=fa(LC.prototype,"targetInfo",[Ma,PC],(function(){return null})),FC=fa(LC.prototype,"propertyPath",[Ma,BC],(function(){return[]})),kC=fa(LC.prototype,"value",[Ma],null),OC=LC))||OC),Px=(VC=Ta("cc.MountedChildrenInfo"),GC=eh(Dx),UC=eh([xg]),VC((HC=function(){function t(){this.targetInfo=WC&&WC(),this.nodes=jC&&jC()}return t.prototype.isTarget=function(){},t}(),WC=fa(HC.prototype,"targetInfo",[Ma,GC],(function(){return null})),jC=fa(HC.prototype,"nodes",[Ma,UC],(function(){return[]})),zC=HC))||zC),Bx=(XC=Ta("cc.MountedComponentsInfo"),YC=eh(Dx),qC=eh([Lp]),XC((QC=function(){function t(){this.targetInfo=ZC&&ZC(),this.components=JC&&JC()}return t.prototype.isTarget=function(){},t}(),ZC=fa(QC.prototype,"targetInfo",[Ma,YC],(function(){return null})),JC=fa(QC.prototype,"components",[Ma,qC],(function(){return[]})),KC=QC))||KC),Ox=($C=Ta("cc.PrefabInstance"),tx=eh(xg),ex=eh([Px]),ix=eh([Bx]),nx=eh([Mx]),rx=eh([Dx]),$C((ox=function(){function t(){this.fileId=ax&&ax(),this.prefabRootNode=hx&&hx(),this.mountedChildren=ux&&ux(),this.mountedComponents=lx&&lx(),this.propertyOverrides=cx&&cx(),this.removedComponents=_x&&_x(),this.targetMap={},this.expanded=!1}var e=t.prototype;return e.findPropertyOverride=function(){},e.removePropertyOverride=function(){},t}(),ax=fa(ox.prototype,"fileId",[Ma],(function(){return""})),hx=fa(ox.prototype,"prefabRootNode",[Ma,tx],null),ux=fa(ox.prototype,"mountedChildren",[Ma,ex],(function(){return[]})),lx=fa(ox.prototype,"mountedComponents",[Ma,ix],(function(){return[]})),cx=fa(ox.prototype,"propertyOverrides",[Ma,nx],(function(){return[]})),_x=fa(ox.prototype,"removedComponents",[Ma,rx],(function(){return[]})),sx=ox))||sx),Lx=(fx=Ta("cc.PrefabInfo"),dx=eh(xg),px=eh(Ox),mx=eh([Rx]),fx((yx=function(){this.root=vx&&vx(),this.asset=Sx&&Sx(),this.fileId=Ax&&Ax(),this.instance=Tx&&Tx(),this.targetOverrides=bx&&bx(),this.nestedPrefabInstanceRoots=Ex&&Ex()},vx=fa(yx.prototype,"root",[Ma,dx],null),Sx=fa(yx.prototype,"asset",[Ma],null),Ax=fa(yx.prototype,"fileId",[Ma],(function(){return""})),Tx=fa(yx.prototype,"instance",[Ma,px],null),bx=fa(yx.prototype,"targetOverrides",[Ma,mx],null),Ex=fa(yx.prototype,"nestedPrefabInstanceRoots",[Ma],null),gx=yx))||gx);function Nx(t){var e=null==t?void 0:t.prefab;if(e&&e.instance){if(!e.asset)return et(3701,t.name),void(e.instance=void 0);var i=t._objFlags,n=t.getParent(),r=t.uuid;t[Zs],v.game._isCloning=!0;var s=e.asset.data;s._iN$t=t,v.instantiate._clone(s,s),v.game._isCloning=!1,t._objFlags=i,t.modifyParent(n),t.id=r,t.prefab&&(t.prefab.instance=e.instance)}}function Fx(t,e,i){var n;if(e&&t){var r=e,s=null===(n=t.prefab)||void 0===n?void 0:n.instance;!i&&s&&(e[s.fileId]={},r=e[s.fileId]);var o=t.prefab;o&&(r[o.fileId]=t);for(var a=t.components,h=0;h<a.length;h++){var u=a[h];u.__prefab&&(r[u.__prefab.fileId]=u)}for(var l=0;l<t.children.length;l++)Fx(t.children[l],r,!1)}}function kx(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 Vx(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=kx(r.targetInfo.localID,i);if(!s)continue;var o=i,a=r.targetInfo.localID;if(a.length>0)for(var h=0;h<a.length-1;h++)o=o[a[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),Fx(l,o,!1),l.siblingIndex=s.children.length-1,Wx(l,!0))}}}}function Gx(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r&&r.targetInfo){var s=kx(r.targetInfo.localID,i);if(!s)continue;if(r.components)for(var o=0;o<r.components.length;o++){var a=r.components[o];a&&(a.node=s,s.getWritableComponents().push(a))}}}}function Ux(t,e,i){if(e)for(var n=0;n<e.length;n++){var r=e[n];if(r){var s=kx(r.localID,i);if(!s||!s.node)continue;var o=s.node.components.indexOf(s);o>=0&&s.node.getWritableComponents().splice(o,1)}}}function zx(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=kx(s.targetInfo.localID,i)))continue;var o=n,a=s.propertyPath.slice();if(a.length>0){var h=a.pop();if(!h)continue;for(var u=0;u<a.length&&(o=o[a[u]]);u++);if(!o)continue;if(Array.isArray(o))if("length"===h)o[h]=s.value;else{var l=Number.parseInt(h);Number.isInteger(l)&&l<o.length&&(o[h]=s.value)}else o[h]instanceof De?o[h].set(s.value):o[h]=s.value}}}}function Hx(t){var e,i=null===(e=t.prefab)||void 0===e?void 0:e.targetOverrides;if(i)for(var n=0;n<i.length;n++){var r,s=i[n],o=s.source,a=s.sourceInfo;if(a){var h,u=s.source,l=null==u||null===(h=u.prefab)||void 0===h?void 0:h.instance;l&&l.targetMap&&(o=kx(a.localID,l.targetMap))}if(o){var c,_=s.targetInfo;if(_){var f=s.target,d=null==f||null===(r=f.prefab)||void 0===r?void 0:r.instance;if(d&&d.targetMap&&(c=kx(_.localID,d.targetMap))){var p=s.propertyPath.slice(),m=o;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 Wx(t,e){var i;void 0===e&&(e=!1);var n=null==t||null===(i=t.prefab)||void 0===i?void 0:i.instance;if(n&&!n.expanded){Nx(t),e&&t&&t.children&&t.children.forEach((function(t){Wx(t,!0)}));var r={};n.targetMap=r,Fx(t,r,!0),Vx(0,n.mountedChildren,r),Ux(0,n.removedComponents,r),Gx(0,n.mountedComponents,r),zx(0,n.propertyOverrides,r),n.expanded=!0}else e&&t&&t.children&&t.children.forEach((function(t){Wx(t,!0)}))}function jx(t){var e=t.prefab;e&&e.nestedPrefabInstanceRoots&&e.nestedPrefabInstanceRoots.forEach((function(t){Wx(t)}))}v._PrefabInfo=Lx;var Xx,Yx,qx,Kx,Qx,Zx,Jx,$x=Object.freeze({__proto__:null,createNodeWithPrefab:Nx,generateTargetMap:Fx,getTarget:kx,applyMountedChildren:Vx,applyMountedComponents:Gx,applyRemovedComponents:Ux,applyPropertyOverrides:zx,applyTargetOverrides:Hx,expandPrefabInstanceNode:Wx,expandNestedPrefabInstanceNode:jx,applyNodeAndComponentId:function t(e,i){for(var n=e.components,r=e.children,s=0;s<n.length;s++){var o,a,h=n[s],u=null!==(o=null===(a=h.__prefab)||void 0===a?void 0:a.fileId)&&void 0!==o?o:"";h._id=""+i+u}for(var l=0;l<r.length;l++){var c=r[l],_=c.prefab,f=null!=_&&_.instance?_.instance.fileId:null==_?void 0:_.fileId;f&&(c.id=""+i+f,null!=_&&_.instance||t(c,i))}},TargetInfo:Dx,TargetOverrideInfo:Rx,CompPrefabInfo:Ix,PropertyOverrideInfo:Mx,MountedChildrenInfo:Px,MountedComponentsInfo:Bx,PrefabInstance:Ox,PrefabInfo:Lx}),tw=t("dm",Ta("cc.Scene")((Yx=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this,e)||this).autoReleaseAssets=qx&&qx(),i._globals=Kx&&Kx(),i.dependAssets=null,i._renderScene=null,i._prefabSyncedInLiveReload=!1,i._activeInHierarchy=!1,v.director&&v.director.root&&(i._renderScene=v.director.root.createScene({})),i._inited=!v.game||!v.game._isCloning,i}return e._updateScene=function(){this._scene=this},e.destroy=function(){var t=$s.prototype.destroy.call(this);if(t)for(var e=this._children,i=0;i<e.length;++i)e[i].active=!1;return this._renderScene&&v.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,t},e.addComponent=function(){throw new Error(st(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||(jx(this),Hx(this),this._onBatchCreated(false),this._inited=!0),this.walk(xg._setScene)},e._activate=function(t){void 0===t&&(t=!0),v.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}(xg),qx=fa(Yx.prototype,"autoReleaseAssets",[Ma],(function(){return!1})),Kx=fa(Yx.prototype,"_globals",[Ma],(function(){return new xx})),Xx=Yx))||Xx);v.Scene=tw;var ew=t("d_",Ta("cc.SceneAsset")((Zx=function(t){function e(){var e;return(e=t.call(this)||this).scene=Jx&&Jx(),e}s(e,t);var i=e.prototype;return i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.scene=new tw("New Scene")},i.validate=function(){return!!this.scene},e}(Fd),Jx=fa(Zx.prototype,"scene",[Ma],(function(){return null})),Qx=Zx))||Qx);v.SceneAsset=ew,St({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),St({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var iw,nw,rw=t("el",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}());rw.NO_TYPE="no_type",rw.TOUCH="touch",rw.MOUSE="mouse",rw.KEYBOARD="keyboard",rw.ACCELERATION="acceleration",rw.NONE=0,rw.CAPTURING_PHASE=1,rw.AT_TARGET=2,rw.BUBBLING_PHASE=3,v.Event=rw,t("ek",iw),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_WHEEL="mouse-wheel",t.MOUSE_ENTER="mouse-enter",t.MOUSE_LEAVE="mouse-leave",t.KEY_DOWN="keydown",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.TRANSFORM_CHANGED="transform-changed",t.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",t.SIZE_CHANGED="size-changed",t.ANCHOR_CHANGED="anchor-changed",t.COLOR_CHANGED="color-changed",t.CHILD_ADDED="child-added",t.CHILD_REMOVED="child-removed",t.PARENT_CHANGED="parent-changed",t.NODE_DESTROYED="node-destroyed",t.LAYER_CHANGED="layer-changed",t.SIBLING_ORDER_CHANGED="sibling-order-changed"}(iw||t("ek",iw={})),function(t){t.TOUCH_START="touch-start",t.TOUCH_MOVE="touch-move",t.TOUCH_END="touch-end",t.TOUCH_CANCEL="touch-cancel",t.MOUSE_DOWN="mouse-down",t.MOUSE_MOVE="mouse-move",t.MOUSE_UP="mouse-up",t.MOUSE_LEAVE="mouse-leave-window",t.MOUSE_ENTER="mouse-enter-window",t.MOUSE_WHEEL="mouse-wheel",t.KEY_DOWN="keydown",t.KEY_PRESSING="key-pressing",t.KEY_UP="keyup",t.DEVICEMOTION="devicemotion",t.GAMEPAD_INPUT="gamepad-input",t.GAMEPAD_CHANGE="gamepad-change",t.HANDLE_INPUT="handle-input",t.HANDLE_POSE_INPUT="handle-pose-input",t.HMD_POSE_INPUT="hmd-pose-input",t.HANDHELD_POSE_INPUT="handheld-pose-input"}(nw||(nw={})),v.SystemEventType=iw;var sw=t("em",function(t){function e(e,i){var n;return(n=t.call(this,iw.DEVICEMOTION,i)||this).acc=e,n}return s(e,t),e}(rw));rw.EventAcceleration=sw;var ow=t("en",function(t){function e(e,i,n){var r;return"boolean"==typeof i&&(i=i?iw.KEY_DOWN:iw.KEY_UP),(r=t.call(this,i,n)||this).rawEvent=void 0,r._isPressed=i!==iw.KEY_UP,"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}(rw));rw.EventKeyboard=ow;var aw=t("eo",function(t){function e(i,n,r,s){var o;return(o=t.call(this,i,n)||this).movementX=0,o.movementY=0,o.windowId=0,o.preventSwallow=!1,o._button=e.BUTTON_MISSING,o._x=0,o._y=0,o._prevX=0,o._prevY=0,o._scrollX=0,o._scrollY=0,o._eventType=i,r&&(o._prevX=r.x,o._prevY=r.y),o.windowId=null!=s?s:o.windowId,o}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 jn),jn.set(t,this._x,this._y),t},i.getLocationInView=function(t){return t||(t=new jn),jn.set(t,this._x,v.view._designResolutionSize.height-this._y),t},i.getUILocation=function(t){return t||(t=new jn),jn.set(t,this._x,this._y),v.view._convertToUISpace(t),t},i.getPreviousLocation=function(t){return t||(t=new jn),jn.set(t,this._prevX,this._prevY),t},i.getUIPreviousLocation=function(t){return t||(t=new jn),jn.set(t,this._prevX,this._prevY),v.view._convertToUISpace(t),t},i.getDelta=function(t){return t||(t=new jn),jn.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){return t||(t=new jn),jn.set(t,(this._x-this._prevX)/v.view.getScaleX(),(this._y-this._prevY)/v.view.getScaleY()),t},i.getUIDeltaX=function(){return(this._x-this._prevX)/v.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/v.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=v.view.getViewportRect();return(this._x-t.x)/v.view.getScaleX()},i.getUILocationY=function(){var t=v.view.getViewportRect();return(this._y-t.y)/v.view.getScaleY()},n(e,[{key:"eventType",get:function(){return this._eventType}}]),e}(rw));aw.BUTTON_MISSING=-1,aw.BUTTON_LEFT=0,aw.BUTTON_RIGHT=2,aw.BUTTON_MIDDLE=1,aw.BUTTON_4=3,aw.BUTTON_5=4,aw.BUTTON_6=5,aw.BUTTON_7=6,aw.BUTTON_8=7,rw.EventMouse=aw;var hw=new jn,uw=t("ep",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 jn},i.getUILocation=function(t){return this.touch?this.touch.getUILocation(t):new jn},i.getLocationInView=function(t){return this.touch?this.touch.getLocationInView(t):new jn},i.getPreviousLocation=function(t){return this.touch?this.touch.getPreviousLocation(t):new jn},i.getStartLocation=function(t){return this.touch?this.touch.getStartLocation(t):new jn},i.getUIStartLocation=function(t){return this.touch?this.touch.getUIStartLocation(t):new jn},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(t){return this.touch?this.touch.getDelta(t):new jn},i.getUIDelta=function(t){return this.touch?this.touch.getUIDelta(t):new jn},i.getDeltaX=function(){return this.touch?this.touch.getDelta(hw).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(hw).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},e}(rw));uw.MAX_TOUCHES=5,rw.EventTouch=uw;var lw,cw=t("eq",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).gamepad=i,n}return s(e,t),e}(rw)),_w=t("er",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handleInputDevice=i,n}return s(e,t),e}(rw)),fw=(t("es",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).hmdInputDevice=i,n}return s(e,t),e}(rw)),t("et",function(t){function e(e,i){var n;return(n=t.call(this,e,!1)||this).handheldInputDevice=i,n}return s(e,t),e}(rw)),t("eu",(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})));t("ev",lw),function(t){t[t.NONE=0]="NONE",t[t.MOBILE_BACK=6]="MOBILE_BACK",t[t.BACKSPACE=8]="BACKSPACE",t[t.TAB=9]="TAB",t[t.ENTER=13]="ENTER",t[t.SHIFT_LEFT=16]="SHIFT_LEFT",t[t.CTRL_LEFT=17]="CTRL_LEFT",t[t.ALT_LEFT=18]="ALT_LEFT",t[t.PAUSE=19]="PAUSE",t[t.CAPS_LOCK=20]="CAPS_LOCK",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.PAGE_UP=33]="PAGE_UP",t[t.PAGE_DOWN=34]="PAGE_DOWN",t[t.END=35]="END",t[t.HOME=36]="HOME",t[t.ARROW_LEFT=37]="ARROW_LEFT",t[t.ARROW_UP=38]="ARROW_UP",t[t.ARROW_RIGHT=39]="ARROW_RIGHT",t[t.ARROW_DOWN=40]="ARROW_DOWN",t[t.INSERT=45]="INSERT",t[t.DELETE=46]="DELETE",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_1=49]="DIGIT_1",t[t.DIGIT_2=50]="DIGIT_2",t[t.DIGIT_3=51]="DIGIT_3",t[t.DIGIT_4=52]="DIGIT_4",t[t.DIGIT_5=53]="DIGIT_5",t[t.DIGIT_6=54]="DIGIT_6",t[t.DIGIT_7=55]="DIGIT_7",t[t.DIGIT_8=56]="DIGIT_8",t[t.DIGIT_9=57]="DIGIT_9",t[t.KEY_A=65]="KEY_A",t[t.KEY_B=66]="KEY_B",t[t.KEY_C=67]="KEY_C",t[t.KEY_D=68]="KEY_D",t[t.KEY_E=69]="KEY_E",t[t.KEY_F=70]="KEY_F",t[t.KEY_G=71]="KEY_G",t[t.KEY_H=72]="KEY_H",t[t.KEY_I=73]="KEY_I",t[t.KEY_J=74]="KEY_J",t[t.KEY_K=75]="KEY_K",t[t.KEY_L=76]="KEY_L",t[t.KEY_M=77]="KEY_M",t[t.KEY_N=78]="KEY_N",t[t.KEY_O=79]="KEY_O",t[t.KEY_P=80]="KEY_P",t[t.KEY_Q=81]="KEY_Q",t[t.KEY_R=82]="KEY_R",t[t.KEY_S=83]="KEY_S",t[t.KEY_T=84]="KEY_T",t[t.KEY_U=85]="KEY_U",t[t.KEY_V=86]="KEY_V",t[t.KEY_W=87]="KEY_W",t[t.KEY_X=88]="KEY_X",t[t.KEY_Y=89]="KEY_Y",t[t.KEY_Z=90]="KEY_Z",t[t.NUM_0=96]="NUM_0",t[t.NUM_1=97]="NUM_1",t[t.NUM_2=98]="NUM_2",t[t.NUM_3=99]="NUM_3",t[t.NUM_4=100]="NUM_4",t[t.NUM_5=101]="NUM_5",t[t.NUM_6=102]="NUM_6",t[t.NUM_7=103]="NUM_7",t[t.NUM_8=104]="NUM_8",t[t.NUM_9=105]="NUM_9",t[t.NUM_MULTIPLY=106]="NUM_MULTIPLY",t[t.NUM_PLUS=107]="NUM_PLUS",t[t.NUM_SUBTRACT=109]="NUM_SUBTRACT",t[t.NUM_DECIMAL=110]="NUM_DECIMAL",t[t.NUM_DIVIDE=111]="NUM_DIVIDE",t[t.F1=112]="F1",t[t.F2=113]="F2",t[t.F3=114]="F3",t[t.F4=115]="F4",t[t.F5=116]="F5",t[t.F6=117]="F6",t[t.F7=118]="F7",t[t.F8=119]="F8",t[t.F9=120]="F9",t[t.F10=121]="F10",t[t.F11=122]="F11",t[t.F12=123]="F12",t[t.NUM_LOCK=144]="NUM_LOCK",t[t.SCROLL_LOCK=145]="SCROLL_LOCK",t[t.SEMICOLON=186]="SEMICOLON",t[t.EQUAL=187]="EQUAL",t[t.COMMA=188]="COMMA",t[t.DASH=189]="DASH",t[t.PERIOD=190]="PERIOD",t[t.SLASH=191]="SLASH",t[t.BACK_QUOTE=192]="BACK_QUOTE",t[t.BRACKET_LEFT=219]="BRACKET_LEFT",t[t.BACKSLASH=220]="BACKSLASH",t[t.BRACKET_RIGHT=221]="BRACKET_RIGHT",t[t.QUOTE=222]="QUOTE",t[t.SHIFT_RIGHT=2e3]="SHIFT_RIGHT",t[t.CTRL_RIGHT=2001]="CTRL_RIGHT",t[t.ALT_RIGHT=2002]="ALT_RIGHT",t[t.NUM_ENTER=2003]="NUM_ENTER"}(lw||t("ev",lw={}));var dw=new jn,pw=t("ew",function(){function t(t,e,i){void 0===i&&(i=0),this._point=new jn,this._prevPoint=new jn,this._lastModified=0,this._id=0,this._startPoint=new jn,this._startPointCaptured=!1,this.setTouchInfo(i,t,e)}var e=t.prototype;return e.getLocation=function(t){return t||(t=new jn),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 jn),t.set(this._point.x,this._point.y),v.view._convertToUISpace(t),t},e.getUILocationX=function(){var t=v.view.getViewportRect();return(this._point.x-t.x)/v.view.getScaleX()},e.getUILocationY=function(){var t=v.view.getViewportRect();return(this._point.y-t.y)/v.view.getScaleY()},e.getPreviousLocation=function(t){return t||(t=new jn),t.set(this._prevPoint.x,this._prevPoint.y),t},e.getUIPreviousLocation=function(t){return t||(t=new jn),t.set(this._prevPoint.x,this._prevPoint.y),v.view._convertToUISpace(t),t},e.getStartLocation=function(t){return t||(t=new jn),t.set(this._startPoint.x,this._startPoint.y),t},e.getUIStartLocation=function(t){return t||(t=new jn),t.set(this._startPoint.x,this._startPoint.y),v.view._convertToUISpace(t),t},e.getDelta=function(t){return t||(t=new jn),t.set(this._point),t.subtract(this._prevPoint),t},e.getUIDelta=function(t){return t||(t=new jn),dw.set(this._point),dw.subtract(this._prevPoint),t.set(v.view.getScaleX(),v.view.getScaleY()),jn.divide(t,dw,t),t},e.getLocationInView=function(t){return t||(t=new jn),t.set(this._point.x,v.view._designResolutionSize.height-this._point.y),t},e.getPreviousLocationInView=function(t){return t||(t=new jn),t.set(this._prevPoint.x,v.view._designResolutionSize.height-this._prevPoint.y),t},e.getStartLocationInView=function(t){return t||(t=new jn),t.set(this._startPoint.x,v.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 jn(e||0,i||0),this._id=t,this._startPointCaptured||(this._startPoint=new jn(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=v.game.frameStartTime},e.setPrevPoint=function(t,e){this._prevPoint="object"==typeof t?new jn(t.x,t.y):new jn(t||0,e||0),this._lastModified=v.game.frameStartTime},e.clone=function(){var e=this.getID();this.getStartLocation(dw);var i=new t(dw.x,dw.y,e);return this.getLocation(dw),i.setPoint(dw.x,dw.y),this.getPreviousLocation(dw),i.setPrevPoint(dw),i},n(t,[{key:"lastModified",get:function(){return this._lastModified}}]),t}());v.Touch=pw;var mw=function(){function t(){this._isStarted=!1,this._accelMode="normal",this._eventTarget=new lo,this._didAccelerateFunc=this._didAccelerate.bind(this)}var e=t.prototype;return e._registerEvent=function(){Bs.onAccelerometerChange(this._didAccelerateFunc)},e._unregisterEvent=function(){Bs.offAccelerometerChange(this._didAccelerateFunc)},e._didAccelerate=function(t){var e=performance.now(),i=new fw(t.x,t.y,t.z,e),n=new sw(i);this._eventTarget.emit(nw.DEVICEMOTION,n)},e.start=function(){var t=this;this._registerEvent(),Bs.startAccelerometer({interval:this._accelMode,success:function(){t._isStarted=!0}})},e.stop=function(){var t=this;Bs.stopAccelerometer({success:function(){t._isStarted=!1},fail:function(){et(16305)}}),this._unregisterEvent()},e.setInterval=function(t){this._accelMode=t>=200?"normal":t>=60?"ui":"game",this._isStarted&&(this.stop(),this.start())},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),gw=function(){},yw=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}(gw),vw=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}(gw),Sw=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}(gw),Aw=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}(gw),Tw=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}(yw),bw=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 Tw({positive:i.right,negative:i.left}),i.yAxis=new Tw({positive:i.up,negative:i.down}),i}return s(e,t),e.prototype.getValue=function(){return new jn(this.xAxis.getValue(),this.yAxis.getValue())},e}(vw);!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 Tw({positive:i.right,negative:i.left}),i.yAxis=new Tw({positive:i.up,negative:i.down}),i.zAxis=new Tw({positive:i.forward,negative:i.backward}),i}s(e,t),e.prototype.getValue=function(){return new mn(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(Sw);var Ew=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}(yw),Cw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(bw),xw=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(bw),ww=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}(Aw),Dw=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}(Sw),Rw=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}(yw),Iw=function(){function t(t){this._deviceId=-1,this._connected=!1,this._deviceId=t,this._initInputSource()}return t._init=function(){},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t.prototype._initInputSource=function(){this._buttonNorth=new Ew,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new Ew,this._buttonEast.getValue=function(){return 0},this._buttonWest=new Ew,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new Ew,this._buttonSouth.getValue=function(){return 0},this._buttonL1=new Ew,this._buttonL1.getValue=function(){return 0},this._buttonL2=new Ew,this._buttonL2.getValue=function(){return 0},this._buttonL3=new Ew,this._buttonL3.getValue=function(){return 0},this._buttonR1=new Ew,this._buttonR1.getValue=function(){return 0},this._buttonR2=new Ew,this._buttonR2.getValue=function(){return 0},this._buttonR3=new Ew,this._buttonR3.getValue=function(){return 0},this._buttonShare=new Ew,this._buttonShare.getValue=function(){return 0},this._buttonOptions=new Ew,this._buttonOptions.getValue=function(){return 0};var t=new Ew;t.getValue=function(){return 0};var e=new Ew;e.getValue=function(){return 0};var i=new Ew;i.getValue=function(){return 0};var n=new Ew;n.getValue=function(){return 0},this._dpad=new Cw({up:t,down:e,left:i,right:n});var r=new Ew;r.getValue=function(){return 0};var s=new Ew;s.getValue=function(){return 0};var o=new Ew;o.getValue=function(){return 0};var a=new Ew;a.getValue=function(){return 0},this._leftStick=new xw({up:r,down:s,left:o,right:a});var h=new Ew;h.getValue=function(){return 0};var u=new Ew;u.getValue=function(){return 0};var l=new Ew;l.getValue=function(){return 0};var c=new Ew;c.getValue=function(){return 0},this._rightStick=new xw({up:h,down:u,left:l,right:c}),this._buttonStart=new Ew,this._buttonStart.getValue=function(){return 0},this._gripLeft=new Ew,this._gripLeft.getValue=function(){return 0},this._gripRight=new Ew,this._gripRight.getValue=function(){return 0},this._handLeftPosition=new Dw,this._handLeftPosition.getValue=function(){return mn.ZERO},this._handLeftOrientation=new ww,this._handLeftOrientation.getValue=function(){return In.IDENTITY},this._handRightPosition=new Dw,this._handRightPosition.getValue=function(){return mn.ZERO},this._handRightOrientation=new ww,this._handRightOrientation.getValue=function(){return In.IDENTITY},this._aimLeftPosition=new Dw,this._aimLeftPosition.getValue=function(){return mn.ZERO},this._aimLeftOrientation=new ww,this._aimLeftOrientation.getValue=function(){return In.IDENTITY},this._aimRightPosition=new Dw,this._aimRightPosition.getValue=function(){return mn.ZERO},this._aimRightOrientation=new ww,this._aimRightOrientation.getValue=function(){return In.IDENTITY}},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}();Iw.all=[],Iw.xr=null,Iw._eventTarget=new lo;var Mw=function(){function t(){this._eventTarget=new lo,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._buttonNorth=new Ew,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new Ew,this._buttonEast.getValue=function(){return 0},this._buttonWest=new Ew,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new Ew,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new Ew,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new Ew,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new Ew,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new Ew,this._triggerRight.getValue=function(){return 0},this._gripLeft=new Ew,this._gripLeft.getValue=function(){return 0},this._gripRight=new Ew,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new Ew,this._buttonLeftStick.getValue=function(){return 0};var t=new Ew;t.getValue=function(){return 0};var e=new Ew;e.getValue=function(){return 0};var i=new Ew;i.getValue=function(){return 0};var n=new Ew;n.getValue=function(){return 0},this._leftStick=new xw({up:t,down:e,left:i,right:n}),this._buttonRightStick=new Ew,this._buttonRightStick.getValue=function(){return 0};var r=new Ew;r.getValue=function(){return 0};var s=new Ew;s.getValue=function(){return 0};var o=new Ew;o.getValue=function(){return 0};var a=new Ew;a.getValue=function(){return 0},this._rightStick=new xw({up:r,down:s,left:o,right:a}),this._buttonOptions=new Ew,this._buttonOptions.getValue=function(){return 0},this._buttonStart=new Ew,this._buttonStart.getValue=function(){return 0},this._handLeftPosition=new Dw,this._handLeftPosition.getValue=function(){return mn.ZERO},this._handLeftOrientation=new ww,this._handLeftOrientation.getValue=function(){return In.IDENTITY},this._handRightPosition=new Dw,this._handRightPosition.getValue=function(){return mn.ZERO},this._handRightOrientation=new ww,this._handRightOrientation.getValue=function(){return In.IDENTITY},this._aimLeftPosition=new Dw,this._aimLeftPosition.getValue=function(){return mn.ZERO},this._aimLeftOrientation=new ww,this._aimLeftOrientation.getValue=function(){return In.IDENTITY},this._aimRightPosition=new Dw,this._aimRightPosition.getValue=function(){return mn.ZERO},this._aimRightOrientation=new ww,this._aimRightOrientation.getValue=function(){return In.IDENTITY},this._touchButtonA=new Rw,this._touchButtonA.getValue=function(){return 0},this._touchButtonB=new Rw,this._touchButtonB.getValue=function(){return 0},this._touchButtonX=new Rw,this._touchButtonX.getValue=function(){return 0},this._touchButtonY=new Rw,this._touchButtonY.getValue=function(){return 0},this._touchButtonTriggerLeft=new Rw,this._touchButtonTriggerLeft.getValue=function(){return 0},this._touchButtonTriggerRight=new Rw,this._touchButtonTriggerRight.getValue=function(){return 0},this._touchButtonThumbStickLeft=new Rw,this._touchButtonThumbStickLeft.getValue=function(){return 0},this._touchButtonThumbStickRight=new Rw,this._touchButtonThumbStickRight.getValue=function(){return 0}},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}(),Pw=function(){function t(){this._eventTarget=new lo,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._viewLeftPosition=new Dw,this._viewLeftPosition.getValue=function(){return mn.ZERO},this._viewLeftOrientation=new ww,this._viewLeftOrientation.getValue=function(){return In.IDENTITY},this._viewRightPosition=new Dw,this._viewRightPosition.getValue=function(){return mn.ZERO},this._viewRightOrientation=new ww,this._viewRightOrientation.getValue=function(){return In.IDENTITY},this._headMiddlePosition=new Dw,this._headMiddlePosition.getValue=function(){return mn.ZERO},this._headMiddleOrientation=new ww,this._headMiddleOrientation.getValue=function(){return In.IDENTITY}},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}(),Bw=function(){function t(){this._eventTarget=new lo,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 Dw,this._handheldPosition.getValue=function(){return mn.ZERO},this._handheldOrientation=new ww,this._handheldOrientation.getValue=function(){return In.IDENTITY}},n(t,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),t}(),Ow={Backspace:lw.BACKSPACE,Tab:lw.TAB,Enter:lw.ENTER,ShiftLeft:lw.SHIFT_LEFT,ControlLeft:lw.CTRL_LEFT,AltLeft:lw.ALT_LEFT,ShiftRight:lw.SHIFT_RIGHT,ControlRight:lw.CTRL_RIGHT,AltRight:lw.ALT_RIGHT,Pause:lw.PAUSE,CapsLock:lw.CAPS_LOCK,Escape:lw.ESCAPE,Space:lw.SPACE,PageUp:lw.PAGE_UP,PageDown:lw.PAGE_DOWN,End:lw.END,Home:lw.HOME,ArrowLeft:lw.ARROW_LEFT,ArrowUp:lw.ARROW_UP,ArrowRight:lw.ARROW_RIGHT,ArrowDown:lw.ARROW_DOWN,Insert:lw.INSERT,Delete:lw.DELETE,Digit0:lw.DIGIT_0,Digit1:lw.DIGIT_1,Digit2:lw.DIGIT_2,Digit3:lw.DIGIT_3,Digit4:lw.DIGIT_4,Digit5:lw.DIGIT_5,Digit6:lw.DIGIT_6,Digit7:lw.DIGIT_7,Digit8:lw.DIGIT_8,Digit9:lw.DIGIT_9,KeyA:lw.KEY_A,KeyB:lw.KEY_B,KeyC:lw.KEY_C,KeyD:lw.KEY_D,KeyE:lw.KEY_E,KeyF:lw.KEY_F,KeyG:lw.KEY_G,KeyH:lw.KEY_H,KeyI:lw.KEY_I,KeyJ:lw.KEY_J,KeyK:lw.KEY_K,KeyL:lw.KEY_L,KeyM:lw.KEY_M,KeyN:lw.KEY_N,KeyO:lw.KEY_O,KeyP:lw.KEY_P,KeyQ:lw.KEY_Q,KeyR:lw.KEY_R,KeyS:lw.KEY_S,KeyT:lw.KEY_T,KeyU:lw.KEY_U,KeyV:lw.KEY_V,KeyW:lw.KEY_W,KeyX:lw.KEY_X,KeyY:lw.KEY_Y,KeyZ:lw.KEY_Z,Numpad0:lw.NUM_0,Numpad1:lw.NUM_1,Numpad2:lw.NUM_2,Numpad3:lw.NUM_3,Numpad4:lw.NUM_4,Numpad5:lw.NUM_5,Numpad6:lw.NUM_6,Numpad7:lw.NUM_7,Numpad8:lw.NUM_8,Numpad9:lw.NUM_9,NumpadMultiply:lw.NUM_MULTIPLY,NumpadAdd:lw.NUM_PLUS,NumpadSubtract:lw.NUM_SUBTRACT,NumpadDecimal:lw.NUM_DECIMAL,NumpadDivide:lw.NUM_DIVIDE,NumpadEnter:lw.NUM_ENTER,F1:lw.F1,F2:lw.F2,F3:lw.F3,F4:lw.F4,F5:lw.F5,F6:lw.F6,F7:lw.F7,F8:lw.F8,F9:lw.F9,F10:lw.F10,F11:lw.F11,F12:lw.F12,NumLock:lw.NUM_LOCK,ScrollLock:lw.SCROLL_LOCK,Semicolon:lw.SEMICOLON,Equal:lw.EQUAL,Comma:lw.COMMA,Minus:lw.DASH,Period:lw.PERIOD,Slash:lw.SLASH,Backquote:lw.BACK_QUOTE,BracketLeft:lw.BRACKET_LEFT,Backslash:lw.BACKSLASH,BracketRight:lw.BRACKET_RIGHT,Quote:lw.QUOTE};function Lw(t){return Ow[t]||lw.NONE}var Nw,Fw,kw=function(){function t(){this._eventTarget=new lo,this._keyStateMap={},So.hasFeature(go.EVENT_KEYBOARD)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n,r=this;null===(t=Bs.wx)||void 0===t||null===(e=t.onKeyDown)||void 0===e||e.call(t,(function(t){var e=Lw(t.code);if(r._keyStateMap[e]){var i=r._getInputEvent(t,nw.KEY_PRESSING);r._eventTarget.emit(nw.KEY_PRESSING,i)}else{var n=r._getInputEvent(t,nw.KEY_DOWN);r._eventTarget.emit(nw.KEY_DOWN,n)}r._keyStateMap[e]=!0})),null===(i=Bs.wx)||void 0===i||null===(n=i.onKeyUp)||void 0===n||n.call(i,(function(t){var e=Lw(t.code),i=r._getInputEvent(t,nw.KEY_UP);r._keyStateMap[e]=!1,r._eventTarget.emit(nw.KEY_UP,i)}))},e._getInputEvent=function(t,e){var i=Lw(t.code);return new ow(i,e)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Vw=function(){function t(){this._eventTarget=new lo,this._isPressed=!1,this._preMousePos=new jn,So.hasFeature(go.EVENT_MOUSE)&&this._registerEvent()}var e=t.prototype;return e._getLocation=function(t){var e=ko.windowSize,i=ko.devicePixelRatio,n=t.x*i,r=e.height-t.y*i;return new jn(n,r)},e._registerEvent=function(){var t,e,i,n,r,s,o,a;null===(t=Bs.wx)||void 0===t||null===(e=t.onMouseDown)||void 0===e||e.call(t,this._createCallback(nw.MOUSE_DOWN)),null===(i=Bs.wx)||void 0===i||null===(n=i.onMouseMove)||void 0===n||n.call(i,this._createCallback(nw.MOUSE_MOVE)),null===(r=Bs.wx)||void 0===r||null===(s=r.onMouseUp)||void 0===s||s.call(r,this._createCallback(nw.MOUSE_UP)),null===(o=Bs.wx)||void 0===o||null===(a=o.onWheel)||void 0===a||a.call(o,this._handleMouseWheel.bind(this))},e._createCallback=function(t){var e=this;return function(i){var n=e._getLocation(i),r=i.button;switch(t){case nw.MOUSE_DOWN:e._isPressed=!0;break;case nw.MOUSE_UP:e._isPressed=!1;break;case nw.MOUSE_MOVE:e._isPressed||(r=aw.BUTTON_MISSING)}var s=new aw(t,!1,e._preMousePos);s.setLocation(n.x,n.y),s.setButton(r),s.movementX=n.x-e._preMousePos.x,s.movementY=e._preMousePos.y-n.y,e._preMousePos.set(n.x,n.y),e._eventTarget.emit(t,s)}},e._handleMouseWheel=function(t){var e=nw.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new aw(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=i.x-this._preMousePos.x,r.movementY=this._preMousePos.y-i.y,r.setScrollData(t.deltaX,-t.deltaY),this._preMousePos.set(i.x,i.y),this._eventTarget.emit(nw.MOUSE_WHEEL,r)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}(),Gw=new jn,Uw=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))G("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new pw(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),n}G("The touches is more than MAX_TOUCHES.")}},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 Uw._touchMap.size},e._updateTouch=function(t,e,i){t.getLocation(Gw),t.setPrevPoint(Gw),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Pe.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>Pe.TOUCH_TIMEOUT&&(G("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),zw=function(){function t(){this._eventTarget=new lo,So.hasFeature(go.INPUT_TOUCH)&&this._registerEvent()}var e=t.prototype;return e._registerEvent=function(){Bs.onTouchStart(this._createCallback(nw.TOUCH_START)),Bs.onTouchMove(this._createCallback(nw.TOUCH_MOVE)),Bs.onTouchEnd(this._createCallback(nw.TOUCH_END)),Bs.onTouchCancel(this._createCallback(nw.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n=[],r=ko.windowSize,s=ko.devicePixelRatio,o=i.changedTouches.length,a=0;a<o;++a){var h=i.changedTouches[a],u=h.identifier;if(null!==u){var l=e._getLocation(h,r,s),c=Uw.getOrCreateTouch(u,l.x,l.y);c&&(t!==nw.TOUCH_END&&t!==nw.TOUCH_CANCEL||Uw.releaseTouch(u),n.push(c))}}if(n.length>0){var _=new uw(n,!1,t,Uw.getAllTouches());e._eventTarget.emit(t,_)}}},e._getLocation=function(t,e,i){var n=t.clientX*i,r=e.height-t.clientY*i;return new jn(n,r)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(Fw||(Fw={}));var Hw=function(){function t(t){this.priority=Fw.GLOBAL,this._inputEventTarget=t}var e=t.prototype;return e.onThrowException=function(){},e.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),Ww=((Nw={})[nw.MOUSE_DOWN]=nw.TOUCH_START,Nw[nw.MOUSE_MOVE]=nw.TOUCH_MOVE,Nw[nw.MOUSE_UP]=nw.TOUCH_END,Nw),jw=t("ey",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new lo,this._touchInput=new zw,this._mouseInput=new Vw,this._keyboardInput=new kw,this._accelerometerInput=new mw,this._handleInput=new Mw,this._hmdInput=new Pw,this._handheldInput=new Bw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Hw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),Iw._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||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 Uw.getTouch(t)},e.getAllTouches=function(){return Uw.getAllTouches()},e.getTouchCount=function(){return Uw.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=Ww[t.type],i=Uw.getOrCreateTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new uw(n,!1,e,e===nw.TOUCH_END?[]:n);r.windowId=t.windowId,e===nw.TOUCH_END&&Uw.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},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;if(Uo.hasFeature(Uo.Feature.INPUT_TOUCH)){var e=this._eventTouchList;this._touchInput.on(nw.TOUCH_START,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(nw.TOUCH_MOVE,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(nw.TOUCH_END,(function(i){t._dispatchOrPushEventTouch(i,e)})),this._touchInput.on(nw.TOUCH_CANCEL,(function(i){t._dispatchOrPushEventTouch(i,e)}))}if(Uo.hasFeature(Uo.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(nw.MOUSE_DOWN,(function(e){t._needSimulateTouchMoveEvent=!0,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(nw.MOUSE_MOVE,(function(e){t._needSimulateTouchMoveEvent&&t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(nw.MOUSE_UP,(function(e){t._needSimulateTouchMoveEvent=!1,t._simulateEventTouch(e),t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(nw.MOUSE_WHEEL,(function(e){t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(nw.MOUSE_LEAVE,(function(e){t._dispatchOrPushEvent(e,i)})),this._mouseInput.on(nw.MOUSE_ENTER,(function(e){t._dispatchOrPushEvent(e,i)}))}if(Uo.hasFeature(Uo.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(nw.KEY_DOWN,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(nw.KEY_PRESSING,(function(e){t._dispatchOrPushEvent(e,n)})),this._keyboardInput.on(nw.KEY_UP,(function(e){t._dispatchOrPushEvent(e,n)}))}if(Uo.hasFeature(Uo.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(nw.DEVICEMOTION,(function(e){t._dispatchOrPushEvent(e,r)}))}if(Uo.hasFeature(Uo.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;Iw._on(nw.GAMEPAD_CHANGE,(function(e){t._dispatchOrPushEvent(e,s)})),Iw._on(nw.GAMEPAD_INPUT,(function(e){t._dispatchOrPushEvent(e,s)})),Iw._on(nw.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,s)}))}if(Uo.hasFeature(Uo.Feature.EVENT_HANDLE)){var o=this._eventHandleList;this._handleInput._on(nw.HANDLE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)})),this._handleInput._on(nw.HANDLE_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,o)}))}if(Uo.hasFeature(Uo.Feature.EVENT_HMD)){var a=this._eventHMDList;this._hmdInput._on(nw.HMD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,a)}))}if(Uo.hasFeature(Uo.Feature.EVENT_HANDHELD)){var h=this._eventHandheldList;this._handheldInput._on(nw.HANDHELD_POSE_INPUT,(function(e){t._dispatchOrPushEvent(e,h)}))}},e._clearEvents=function(){this._eventMouseList.length=0,this._eventTouchList.length=0,this._eventKeyboardList.length=0,this._eventAccelerationList.length=0,this._eventGamepadList.length=0,this._eventHandleList.length=0,this._eventHMDList.length=0},e._dispatchOrPushEvent=function(t,e){this._dispatchImmediately?this._emitEvent(t):e.push(t)},e._dispatchOrPushEventTouch=function(t,e){if(this._dispatchImmediately)for(var i=t.getTouches(),n=i.length,r=0;r<n;++r)t.touch=i[r],t.propagationStopped=t.propagationImmediateStopped=!1,this._emitEvent(t);else e.push(t)},e._frameDispatchEvents=function(){for(var t=this._eventHMDList,e=0,i=t.length;e<i;++e){var n=t[e];this._emitEvent(n)}for(var r=this._eventHandheldList,s=0,o=r.length;s<o;++s){var a=r[s];this._emitEvent(a)}for(var h=this._eventMouseList,u=0,l=h.length;u<l;++u){var c=h[u];this._emitEvent(c)}for(var _=this._eventTouchList,f=0,d=_.length;f<d;++f)for(var p=_[f],m=p.getTouches(),g=m.length,y=0;y<g;++y)p.touch=m[y],p.propagationStopped=p.propagationImmediateStopped=!1,this._emitEvent(p);for(var v=this._eventKeyboardList,S=0,A=v.length;S<A;++S){var T=v[S];this._emitEvent(T)}for(var b=this._eventAccelerationList,E=0,C=b.length;E<C;++E){var x=b[E];this._emitEvent(x)}for(var w=this._eventGamepadList,D=0,R=w.length;D<R;++D){var I=w[D];this._emitEvent(I)}for(var M=this._eventHandleList,P=0,B=M.length;P<B;++P){var O=M[P];this._emitEvent(O)}this._clearEvents()},t}());jw.EventType=nw;var Xw=t("ex",new jw),Yw=t("eA",function(t){function e(){var e;return e=t.call(this)||this,Xw.on(nw.MOUSE_DOWN,(function(t){e.emit(iw.MOUSE_DOWN,t)})),Xw.on(nw.MOUSE_MOVE,(function(t){e.emit(iw.MOUSE_MOVE,t)})),Xw.on(nw.MOUSE_UP,(function(t){e.emit(iw.MOUSE_UP,t)})),Xw.on(nw.MOUSE_WHEEL,(function(t){e.emit(iw.MOUSE_WHEEL,t)})),Xw.on(nw.TOUCH_START,(function(t){e.emit(iw.TOUCH_START,t.touch,t)})),Xw.on(nw.TOUCH_MOVE,(function(t){e.emit(iw.TOUCH_MOVE,t.touch,t)})),Xw.on(nw.TOUCH_END,(function(t){e.emit(iw.TOUCH_END,t.touch,t)})),Xw.on(nw.TOUCH_CANCEL,(function(t){e.emit(iw.TOUCH_CANCEL,t.touch,t)})),Xw.on(nw.KEY_DOWN,(function(t){e.emit(iw.KEY_DOWN,t)})),Xw.on(nw.KEY_PRESSING,(function(t){e.emit(iw.KEY_DOWN,t)})),Xw.on(nw.KEY_UP,(function(t){e.emit(iw.KEY_UP,t)})),Xw.on(nw.DEVICEMOTION,(function(t){e.emit(iw.DEVICEMOTION,t)})),e}s(e,t);var i=e.prototype;return i.setAccelerometerEnabled=function(t){Xw.setAccelerometerEnabled(t)},i.setAccelerometerInterval=function(t){Xw.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}(lo));Yw.EventType=iw,v.SystemEvent=Yw;var qw=t("ez",new Yw);v.systemEvent=qw,ht(iw,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),ht(rw,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),lt(rw,"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"}]),ht(aw,"EventMouse",["DOWN","UP","MOVE"].map((function(t){return{name:t,newName:"MOUSE_"+t,target:Yw.EventType,targetName:"SystemEvent.EventType"}}))),ht(aw,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),lt(aw.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),ht(uw,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),ht(uw,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),ht(uw,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),ht(uw,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),lt(uw.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),ht(uw.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:uw,targetName:"EventTouch"}]),lt(Pe.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}}))),lt(Pe.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),lt(Pe.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),lt(Pe.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),lt(Pe,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]);var Kw,Qw,Zw,Jw,$w,tD,eD,iD,nD=t("di",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 0!=(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=v.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}());!function(t){t[t.VERTICAL=0]="VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL"}(Kw||(Kw={})),function(t){t[t.ORTHO=0]="ORTHO",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(Qw||(Qw={})),function(t){t[t.F1_8=0]="F1_8",t[t.F2_0=1]="F2_0",t[t.F2_2=2]="F2_2",t[t.F2_5=3]="F2_5",t[t.F2_8=4]="F2_8",t[t.F3_2=5]="F3_2",t[t.F3_5=6]="F3_5",t[t.F4_0=7]="F4_0",t[t.F4_5=8]="F4_5",t[t.F5_0=9]="F5_0",t[t.F5_6=10]="F5_6",t[t.F6_3=11]="F6_3",t[t.F7_1=12]="F7_1",t[t.F8_0=13]="F8_0",t[t.F9_0=14]="F9_0",t[t.F10_0=15]="F10_0",t[t.F11_0=16]="F11_0",t[t.F13_0=17]="F13_0",t[t.F14_0=18]="F14_0",t[t.F16_0=19]="F16_0",t[t.F18_0=20]="F18_0",t[t.F20_0=21]="F20_0",t[t.F22_0=22]="F22_0"}(Zw||(Zw={})),function(t){t[t.ISO100=0]="ISO100",t[t.ISO200=1]="ISO200",t[t.ISO400=2]="ISO400",t[t.ISO800=3]="ISO800"}(Jw||(Jw={})),function(t){t[t.D1=0]="D1",t[t.D2=1]="D2",t[t.D4=2]="D4",t[t.D8=3]="D8",t[t.D15=4]="D15",t[t.D30=5]="D30",t[t.D60=6]="D60",t[t.D125=7]="D125",t[t.D250=8]="D250",t[t.D500=9]="D500",t[t.D1000=10]="D1000",t[t.D2000=11]="D2000",t[t.D4000=12]="D4000"}($w||($w={})),function(t){t[t.DEFAULT=-1]="DEFAULT",t[t.LEFT_EYE=0]="LEFT_EYE",t[t.RIGHT_EYE=1]="RIGHT_EYE",t[t.MAIN=2]="MAIN"}(tD||(tD={})),function(t){t[t.NO_TRACKING=0]="NO_TRACKING",t[t.POSITION_AND_ROTATION=1]="POSITION_AND_ROTATION",t[t.POSITION=2]="POSITION",t[t.ROTATION=3]="ROTATION"}(eD||(eD={})),function(t){t[t.EDITOR=0]="EDITOR",t[t.GAME_VIEW=1]="GAME_VIEW",t[t.SCENE_VIEW=2]="SCENE_VIEW",t[t.PREVIEW=3]="PREVIEW",t[t.GAME=100]="GAME"}(iD||(iD={}));var rD,sD=[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],oD=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],aD=[100,200,400,800],hD=new mn,uD=new mn,lD=new Vn,cD=n_.STENCIL<<1,_D=[],fD=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=Kw.VERTICAL,this._fov=Vi(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new S_(.2,.2,.2,1),this._viewport=new Zn(0,0,1,1),this._orientedViewport=new Zn(0,0,1,1),this._curTransform=vc.IDENTITY,this._isProjDirty=!0,this._matView=new Vn,this._matProj=new Vn,this._matProjInv=new Vn,this._matViewProj=new Vn,this._matViewProjInv=new Vn,this._frustum=new ia,this._forward=new mn,this._position=new mn,this._priority=0,this._aperture=Zw.F16_0,this._shutter=$w.D125,this._shutterValue=0,this._iso=Jw.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=n_.NONE,this._clearDepth=1,this._visibility=bv,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=tD.DEFAULT,this._trackingType=eD.NO_TRACKING,this._usage=iD.GAME,this._device=t,this._apertureValue=sD[this._aperture],this._shutterValue=oD[this._shutter],this._isoValue=aD[this._iso],this._frustum.accurate=!0,!_D.length){var e=t.capabilities.clipSpaceSignY;_D[vc.IDENTITY]=new Vn(1,0,0,0,0,e),_D[vc.ROTATE_90]=new Vn(0,1,0,0,-e,0),_D[vc.ROTATE_180]=new Vn(-1,0,0,0,0,-e),_D[vc.ROTATE_270]=new Vn(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||vc.IDENTITY)%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=n_.NONE,this.clearDepth=1,this.visibility=bv,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)||void 0===t||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=globalThis.__globalXR;if(n&&n.isWebXR&&n.webXRWindowMap&&n.updateViewport){var r=n.webXRMatProjs?1/n.webXRMatProjs.length:1,s=n.webXRWindowMap.get(this._window);this.setViewportInOrientedSpace(new Zn(r*s,0,r,1))}(this._node.hasChangedFlags||t)&&(Vn.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,Vn.multiply(this._matView,(new Vn).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var o=null===(e=this.window)||void 0===e?void 0:e.swapchain,a=o&&o.surfaceTransform||vc.IDENTITY;if(this._isProjDirty||this._curTransform!==a){this._curTransform=a;var h=this._device.capabilities.clipSpaceSignY;if(this._proj===Qw.PERSPECTIVE)if(n&&n.isWebXR&&n.webXRWindowMap&&n.webXRMatProjs){var u=n.webXRWindowMap.get(this._window);this._matProj.set(n.webXRMatProjs[u])}else Vn.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===Kw.VERTICAL,this._device.capabilities.clipSpaceMinZ,h,a);else{var l=this._orthoHeight*this._aspect,c=this._orthoHeight;Vn.ortho(this._matProj,-l,l,-c,c,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,h,a)}Vn.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(Vn.multiply(this._matViewProj,this._matProj,this._matView),Vn.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,o=null===(e=this.window)||void 0===e?void 0:e.swapchain;switch(o&&o.surfaceTransform||vc.IDENTITY){case vc.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case vc.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case vc.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case vc.IDENTITY:this._viewport.x=i,this._viewport.y=s,this._viewport.width=n,this._viewport.height=r}this._orientedViewport.x=i,this._orientedViewport.y=s,this._orientedViewport.width=n,this._orientedViewport.height=r,this.resize(this.width,this.height)},e.initGeometryRenderer=function(){var t;this._geometryRenderer||(this._geometryRenderer=v.internal.GeometryRenderer?new v.internal.GeometryRenderer:null,null===(t=this._geometryRenderer)||void 0===t||t.activate(this._device))},e.changeTargetWindow=function(t){void 0===t&&(t=null),this._window&&this._window.detachCamera(this);var e=t||v.director.root.mainWindow;if(e){e.attachCamera(this),this.window=e;var i=e.swapchain;(i&&i.surfaceTransform||vc.IDENTITY)%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,o=this._orientedViewport.y*r,a=this._orientedViewport.width*n,h=this._orientedViewport.height*r,u=this._proj===Qw.PERSPECTIVE,l=this._device.capabilities.clipSpaceSignY,c=kn[this._curTransform];mn.set(hD,(e-s)/a*2-1,(i-o)/h*2-1,u?1:-1);var _=hD.x,f=hD.y;return hD.x=_*c[0]+f*c[2]*l,hD.y=_*c[1]+f*c[3]*l,mn.transformMat4(u?hD:t.o,hD,this._matViewProjInv),u?(this._node.getWorldPosition(uD),mr.fromPoints(t,uD,hD)):mn.transformQuat(t.d,mn.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,o=this._orientedViewport.width*i,a=this._orientedViewport.height*n,h=this._device.capabilities.clipSpaceSignY,u=kn[this._curTransform];if(this._proj===Qw.PERSPECTIVE){mn.set(t,(e.x-r)/o*2-1,(e.y-s)/a*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,mn.transformMat4(t,t,this._matViewProjInv),this._node&&this._node.getWorldPosition(hD),mn.lerp(t,hD,t,ki(this._nearClip/this._farClip,1,e.z))}else{mn.set(t,(e.x-r)/o*2-1,(e.y-s)/a*2-1,2*e.z-1);var _=t.x,f=t.y;t.x=_*u[0]+f*u[2]*h,t.y=_*u[1]+f*u[3]*h,mn.transformMat4(t,t,this._matViewProjInv)}return t},e.worldToScreen=function(t,e){var i=this._device.capabilities.clipSpaceSignY,n=kn[this._curTransform];mn.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 o=this.width,a=this.height,h=this._orientedViewport.x*o,u=this._orientedViewport.y*a,l=this._orientedViewport.width*o,c=this._orientedViewport.height*a;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){Vn.multiply(t,this._matViewProj,e),Vn.multiply(t,_D[this._curTransform],t);var r=i/2,s=n/2;return Vn.identity(lD),Vn.transform(lD,lD,mn.set(hD,r,s,0)),Vn.scale(lD,lD,mn.set(hD,r,s,1)),Vn.multiply(t,lD,t),t},e.calculateObliqueMat=function(t){var e=new ln(Math.sign(t.x),Math.sign(t.y),1,1).transformMat4(this._matProjInv),i=new ln(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/ln.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=iD.GAME},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=sD[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=oD[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=aD[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){$(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:"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}(),dD=new ef(null),pD=function(){function t(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=Wg.DEFAULT,this._inputAssembler=null,this._descriptorSet=null,this._worldBoundDescriptorSet=null,this._reflectionTex=null,this._reflectionSampler=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);var n=v.director.root;this._device=nd.gfxDevice,dD.layout=e[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._descriptorSet=this._device.createDescriptorSet(dD);var r=v.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new ef(null);s.layout=r.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(s)}this._subMesh=t,this._patches=i?i.sort():null,this._passes=e,this._flushPassInfo(),this.priority=Wg.DEFAULT;var o=v.rendering;if((!o||!o.enableEffectImport)&&e[0].phase===zA("reflection")||Rv()&&e[0].phaseID===o.getPhaseID(o.getPassID("default"),"reflection")){var a=n.mainWindow.width,h=n.mainWindow.height,u=512;h<a?(a=u*a/h,h=u):h=u*h/(a=u),this._reflectionTex=this._device.createTexture(new R_(Dc.TEX2D,Rc.STORAGE|Rc.TRANSFER_SRC|Rc.SAMPLED,Ac.RGBA8,a,h)),this.descriptorSet.bindTexture(ev,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP)),this.descriptorSet.bindSampler(ev,this._reflectionSampler),this.descriptorSet.bindTexture(rv,this._reflectionTex)}},e.destroy=function(){var t;this._descriptorSet.destroy(),this._descriptorSet=null,this._inputAssembler.destroy(),this._inputAssembler=null,null===(t=this._worldBoundDescriptorSet)||void 0===t||t.destroy(),this._worldBoundDescriptorSet=null,this.priority=Wg.DEFAULT,this._patches=null,this._subMesh=null,this._passes=null,this._shaders=null,this._reflectionTex&&this._reflectionTex.destroy(),this._reflectionTex=null,this._reflectionSampler=null},e.update=function(){for(var t,e=0;e<this._passes.length;++e)this._passes[e].update();this._descriptorSet.update(),null===(t=this._worldBoundDescriptorSet)||void 0===t||t.update()},e.onPipelineStateChanged=function(){var t=this._passes;if(t){for(var e=0;e<t.length;e++){var i=t[e];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}this._flushPassInfo()}},e.onMacroPatchesStateChanged=function(t){if((t||this._patches)&&(!t||(t=t.sort(),!this._patches||t.length!==this._patches.length||JSON.stringify(t)!==JSON.stringify(this._patches)))){this._patches=t;var e=this._passes;if(e){for(var i=0;i<e.length;i++){var n=e[i];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}this._flushPassInfo()}}},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=(By.SH_QUADRATIC_R_OFFSET-By.SH_LINEAR_CONST_R_OFFSET)/4,r=0,s=e;s<e+n;s++)for(var o=0;o<4;o++)i[s][o]=t[r++]},e.UpdateInstancedAttributes=function(t){this.instancedWorldMatrixIndex=-1,this.instancedSHIndex=-1;var e=this.passes[0];if(e.device.hasFeature(Sc.INSTANCED_ARRAYS)){for(var i=0,n=0;n<t.length;n++){var r=t[n];r.isInstanced&&(i+=ff[r.format].size)}var s=this.instancedAttributeBlock;s.buffer=new Uint8Array(i),s.views.length=s.attributes.length=0;for(var o=0,a=0;a<t.length;a++){var h=t[a];if(h.isInstanced){var u=new U_;u.format=h.format,u.name=h.name,u.isNormalized=h.isNormalized,u.location=h.location,s.attributes.push(u);var l=ff[h.format],c=new(Tf(l))(s.buffer.buffer,o,l.count);s.views.push(c),o+=l.size}}e.batchingScheme===VA.INSTANCING&&e.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(Ay),this.instancedSHIndex=this.getInstancedAttributeIndex(Ty)}},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?et(12004,8):(this._passes=t,this._flushPassInfo(),this._descriptorSet&&(this._descriptorSet.destroy(),dD.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(dD)))}},{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}(),mD=new W_;mD.format=Ac.RGBA8;var gD=new j_;gD.format=Ac.DEPTH_STENCIL;var yD,vD,SD=new q_([mD],gD),AD={width:1,height:1,renderPassInfo:SD},TD=t("e6",Ta("cc.RenderTexture")(rD=function(t){function e(){var e;return(e=t.call(this)||this)._window=null,e}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=v.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(Ni(t,1,2048)),this._height=Math.floor(Ni(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=v.director.root;AD.title=this._name,AD.width=this._width,AD.height=this._height,AD.renderPassInfo=t&&t.passInfo?t.passInfo:SD,AD.externalResLow=t&&t.externalResLow?t.externalResLow:0,AD.externalResHigh=t&&t.externalResHigh?t.externalResHigh:0,AD.externalFlag=t&&t.externalFlag?t.externalFlag:Ic.NONE,AD.renderPassInfo.colorAttachments.forEach((function(t){t.format=e.device.swapchainFormat})),mD.barrier=nd.gfxDevice.getGeneralBarrier(new K_(Wc.FRAGMENT_SHADER_READ_TEXTURE,Wc.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(nd.gfxDevice,AD)):this._window=e.createWindow(AD)},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 et(7606),null;var o=4*i*n;if(void 0===r)r=new Uint8Array(o);else if(r.length<o)return et(7607,o),null;var a=this._getGFXDevice(),h=[],u=[],l=new y_;return l.texOffset.x=t,l.texOffset.y=e,l.texExtent.width=i,l.texExtent.height=n,u.push(l),h.push(r),null==a||a.copyTextureToBuffers(s,h,u),r},n(e,[{key:"window",get:function(){return this._window}}]),e}(lp))||rD);v.RenderTexture=TD,function(t){t[t.SKYBOX=cD|n_.DEPTH_STENCIL]="SKYBOX",t[t.SOLID_COLOR=n_.ALL]="SOLID_COLOR"}(yD||(yD={})),function(t){t[t.CUBE=0]="CUBE",t[t.PLANAR=1]="PLANAR"}(vD||(vD={}));var bD,ED=[new mn(0,-90,0),new mn(0,90,0),new mn(90,0,0),new mn(-90,0,0),new mn(0,0,0),new mn(0,180,0)],CD=function(){function t(t){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=256,this._clearFlag=yD.SKYBOX,this._backgroundColor=new bn(0,0,0,255),this._visibility=bv,this._probeType=vD.CUBE,this._cubemap=null,this._size=new mn(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=new mn,this._cameraWorldRotation=new In,this._forward=new mn,this._up=new mn,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;var i=this.node.getWorldPosition();this._boundingBox=Ko.create(i.x,i.y,i.z,this._size.x,this._size.y,this._size.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=v.view.getDesignResolutionSize();this.realtimePlanarTexture=this._createTargetTexture(e.width,e.height),v.internal.reflectionProbeManager.updatePlanarMap(this,this.realtimePlanarTexture.getGFXTexture())}this._syncCameraParams(t),this._transformReflectionCamera(t),this._needRender=!0}},e.switchProbeType=function(t,e){t===vD.CUBE?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 this._probeType===vD.PLANAR?new jn(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new jn(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(ED[t]),this.camera.update(!0)},e.updateBoundingBox=function(){if(this.node){var t=this.node.getWorldPosition();Ko.set(this._boundingBox,t.x,t.y,t.z,this._size.x,this._size.y,this._size.z)}},e.hasFrameBuffer=function(t){if(this.probeType===vD.PLANAR){var e;if(!this.realtimePlanarTexture)return!1;if((null===(e=this.realtimePlanarTexture.window)||void 0===e?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?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=v.director.root;if(!this._camera){if(this._camera=e.createCamera(),!this._camera)return null;this._camera.initialize({name:t.name,node:t,projection:Qw.PERSPECTIVE,window:e&&e.tempWindow,priority:0,cameraType:tD.DEFAULT,trackingType:eD.NO_TRACKING})}return this._camera.setViewportInOrientedSpace(new Zn(0,0,1,1)),this._camera.fovAxis=Kw.VERTICAL,this._camera.fov=Vi(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=Zw.F16_0,this._camera.shutter=$w.D125,this._camera.iso=Jw.ISO100,this._camera},e._resetCameraParams=function(){this.camera.projectionType=Qw.PERSPECTIVE,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=Vi(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 TD;return i.reset({width:t,height:e}),i},e._transformReflectionCamera=function(t){var e=mn.dot(this.node.worldPosition,this.node.up);this._reflect(this._cameraWorldPos,t.node.worldPosition,this.node.up,e),this.cameraNode.worldPosition=this._cameraWorldPos,mn.transformQuat(this._forward,mn.FORWARD,t.node.worldRotation),this._reflect(this._forward,this._forward,this.node.up,0),this._forward.normalize(),this._forward.negative(),mn.transformQuat(this._up,mn.UP,t.node.worldRotation),this._reflect(this._up,this._up,this.node.up,0),this._up.normalize(),In.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new ln(this.node.up.x,this.node.up.y,this.node.up.z,-mn.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=mn.clone(i);r.normalize();var s=mn.dot(r,e)-n;return r.multiplyScalar(2*s),mn.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);var e=this.node.getWorldPosition();Ko.set(this._boundingBox,e.x,e.y,e.z,this._size.x,this._size.y,this._size.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}();t("aq",bD),function(t){t[t.NONE=0]="NONE",t[t.BAKED_CUBEMAP=1]="BAKED_CUBEMAP",t[t.PLANAR_REFLECTION=2]="PLANAR_REFLECTION",t[t.BLEND_PROBES=3]="BLEND_PROBES",t[t.BLEND_PROBES_AND_SKYBOX=4]="BLEND_PROBES_AND_SKYBOX"}(bD||t("aq",bD={}));var xD,wD=new Vn,DD=[{name:"CC_RECEIVE_SHADOW",value:!0}],RD=[{name:"CC_USE_LIGHTMAP",value:1}],ID=[{name:"CC_USE_LIGHTMAP",value:2}],MD=[{name:"CC_LIGHT_MAP_VERSION",value:2}],PD=[{name:"CC_USE_LIGHT_PROBE",value:!0}];!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.SKINNING=1]="SKINNING",t[t.BAKED_SKINNING=2]="BAKED_SKINNING",t[t.BATCH_2D=3]="BATCH_2D",t[t.PARTICLE_BATCH=4]="PARTICLE_BATCH",t[t.LINE=5]="LINE"}(xD||(xD={}));var BD,OD=new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP),LD=new M_(Oc.LINEAR,Oc.LINEAR,Oc.LINEAR,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP),ND=function(){function t(){this.type=xD.DEFAULT,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(vy.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new ln,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new mn(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=Pm.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=bD.NONE,this._device=nd.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Pm.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=bD.NONE)},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.enabled&&this.node.scene.globals.shadows.type===hT.Planar;if(this._localDataUpdated){this._localDataUpdated=!1;for(var r=this.transform._mat,s=!1,o=0;o<e.length;o++){var a=e[o],h=a.instancedWorldMatrixIndex;h>=0?a.updateInstancedWorldMatrix(r,h):s=!0}(s||n)&&this._localBuffer&&(Vn.toArray(this._localData,r,vy.MAT_WORLD_OFFSET),Vn.invert(wD,r),Vn.transpose(wD,wD),Vn.toArray(this._localData,wD,vy.MAT_WORLD_IT_OFFSET),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=v.director.root.pipeline.pipelineSceneData.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<By.COUNT;t++)this._localSHData[t]=0;this.updateSHBuffer()}},e.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var t=this._worldBounds.center;if(!t.equals(this._lastWorldBoundCenter,Bi)){var e=[],i=new ln(0,0,0,0),n=v.director.root.pipeline.pipelineSceneData.lightProbes;this._lastWorldBoundCenter.set(t),this._tetrahedronIndex=n.data.getInterpolationWeights(t,this._tetrahedronIndex,i),n.data.getInterpolationSHCoefficients(this._tetrahedronIndex,i,e)&&this._localSHData&&(v.internal.SH.reduceRinging(e,n.reduceRinging),v.internal.SH.updateUBOData(this._localSHData,By.SH_LINEAR_CONST_R_OFFSET,e),this.updateSHBuffer())}}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds||(this._modelBounds=Ko.create()),this._worldBounds||(this._worldBounds=Ko.create()),Ko.fromPoints(this._modelBounds,t,e),this._worldBounds.copy(this._modelBounds))},e._createSubModel=function(){return new pD},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){ln.toArray(this._localData,e,vy.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=t,this._lightmapUVParam=e,this.onMacroPatchesStateChanged(),t||(t=UA.get("empty-texture"));var i=t.getGFXTexture();if(i)for(var n=this._device.getSampler(t.mipmaps.length>1?LD:OD),r=this._subModels,s=0;s<r.length;s++){var o=r[s].descriptorSet;o.bindTexture(Ky,i),o.bindSampler(Ky,n),o.update()}},e.updateReflectionProbeCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=UA.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(av,i),s.bindTexture(av,e),s.update())}},e.updateReflectionProbeBlendCubemap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=UA.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(mv,i),s.bindTexture(mv,e),s.update())}},e.updateReflectionProbePlanarMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var e=this._device.getSampler(new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP));if(t||(t=UA.get("empty-texture").getGFXTexture()),t)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r&&(r.bindTexture(lv,t),r.bindSampler(lv,e),r.update())}},e.updateReflectionProbeDataMap=function(t){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),t||(t=UA.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(fv,e),r.bindSampler(fv,t.getGFXSampler()),r.update())}},e.updateLocalShadowBias=function(){var t=this._localData;t[vy.LOCAL_SHADOW_BIAS+0]=this._shadowBias,t[vy.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,this._localDataUpdated=!0},e.updateReflectionProbeId=function(){var t=this._localData;t[vy.LOCAL_SHADOW_BIAS+2]=this._reflectionProbeId,t[vy.LOCAL_SHADOW_BIAS+3]=this._reflectionProbeBlendId;var e=null,i=null;if(v.internal.reflectionProbeManager&&(e=v.internal.reflectionProbeManager.getProbeById(this._reflectionProbeId),i=v.internal.reflectionProbeManager.getProbeById(this._reflectionProbeBlendId)),e){if(e.probeType===vD.PLANAR)t[vy.REFLECTION_PROBE_DATA1]=e.node.up.x,t[vy.REFLECTION_PROBE_DATA1+1]=e.node.up.y,t[vy.REFLECTION_PROBE_DATA1+2]=e.node.up.z,t[vy.REFLECTION_PROBE_DATA1+3]=1,t[vy.REFLECTION_PROBE_DATA2]=1,t[vy.REFLECTION_PROBE_DATA2+1]=0,t[vy.REFLECTION_PROBE_DATA2+2]=0,t[vy.REFLECTION_PROBE_DATA2+3]=1;else{t[vy.REFLECTION_PROBE_DATA1]=e.node.worldPosition.x,t[vy.REFLECTION_PROBE_DATA1+1]=e.node.worldPosition.y,t[vy.REFLECTION_PROBE_DATA1+2]=e.node.worldPosition.z,t[vy.REFLECTION_PROBE_DATA1+3]=0,t[vy.REFLECTION_PROBE_DATA2]=e.size.x,t[vy.REFLECTION_PROBE_DATA2+1]=e.size.y,t[vy.REFLECTION_PROBE_DATA2+2]=e.size.z;var n=e.isRGBE()?1e3:0;t[vy.REFLECTION_PROBE_DATA2+3]=e.cubemap?e.cubemap.mipmapLevel+n:1+n}if(this._reflectionProbeType===bD.BLEND_PROBES||this._reflectionProbeType===bD.BLEND_PROBES_AND_SKYBOX)if(i){t[vy.REFLECTION_PROBE_BLEND_DATA1]=i.node.worldPosition.x,t[vy.REFLECTION_PROBE_BLEND_DATA1+1]=i.node.worldPosition.y,t[vy.REFLECTION_PROBE_BLEND_DATA1+2]=i.node.worldPosition.z,t[vy.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight,t[vy.REFLECTION_PROBE_BLEND_DATA2]=i.size.x,t[vy.REFLECTION_PROBE_BLEND_DATA2+1]=i.size.y,t[vy.REFLECTION_PROBE_BLEND_DATA2+2]=i.size.z;var r=i.isRGBE()?1e3:0;t[vy.REFLECTION_PROBE_BLEND_DATA2+3]=i.cubemap?i.cubemap.mipmapLevel+r:1+r}else this._reflectionProbeType===bD.BLEND_PROBES_AND_SKYBOX&&(t[vy.REFLECTION_PROBE_BLEND_DATA1+3]=this.reflectionProbeBlendWeight)}this._localDataUpdated=!0},e.getMacroPatches=function(){var t=this.receiveShadow?DD:null;if(null!=this._lightmap&&this.node&&this.node.scene&&!this.node.scene.globals.disableLightmap){var e=this.node.scene.globals.bakedWithStationaryMainLight?ID:RD;t=t?t.concat(e):e,this.node.scene.globals.bakedWithHighpLightmap&&(t=t.concat(MD))}this._useLightProbe&&(t=t?t.concat(PD):PD);var i=[{name:"CC_USE_REFLECTION_PROBE",value:this._reflectionProbeType}];t=t?t.concat(i):i;var n=[{name:"CC_DISABLE_DIRECTIONAL_LIGHT",value:!this._receiveDirLight}];return t?t.concat(n):n},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);for(var i,n=[],r=new Set,s=f(e.passes);!(i=s()).done;)for(var o,a=f(i.value.getShaderVariant(e.patches).attributes);!(o=a()).done;){var h=o.value;r.has(h.name)||(n.push(h),r.add(h.name))}this._updateInstancedAttributes(n,e)}},e._updateInstancedAttributes=function(t,e){e.UpdateInstancedAttributes(t),this._localDataUpdated=!0},e._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.DEVICE,vy.SIZE,vy.SIZE)))},e._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(By.COUNT)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.DEVICE,By.SIZE,By.SIZE))))},e._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.DEVICE,Sy.SIZE,Sy.SIZE)))},e._updateLocalDescriptors=function(t,e){this._localBuffer&&e.bindBuffer(vy.BINDING,this._localBuffer)},e._updateLocalSHDescriptors=function(t,e){this._localSHBuffer&&e.bindBuffer(By.BINDING,this._localSHBuffer)},e._updateWorldBoundDescriptors=function(t,e){this._worldBoundBuffer&&e.bindBuffer(Sy.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}(),FD=function(){function t(){this._enabled=!1,this._minPos=new mn(0,0,0),this._maxPos=new mn(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}(),kD=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 VD(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,o=3*n/s,a=2*r/s,h=1/a*o,u=1/a*(1-o-a);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}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.POINT=3]="POINT",t[t.RANGED_DIRECTIONAL=4]="RANGED_DIRECTIONAL",t[t.UNKNOWN=5]="UNKNOWN"}(BD||(BD={}));var GD,UD,zD=function(t){return 4*Math.PI*Math.PI*t*t},HD=function(){function t(){this._baked=!1,this._color=new mn(1,1,1),this._colorTemp=6550,this._colorTempRGB=new mn(1,1,1),this._finalColor=new mn(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=BD.UNKNOWN,this._visibility=bv}var e=t.prototype;return e.initialize=function(){this.color=new mn(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&&mn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t,t&&mn.multiply(this._finalColor,this._color,this._colorTempRGB)}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,VD(this._colorTempRGB,this._colorTemp),this._useColorTemperature&&mn.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|=Om.ROTATION)}},{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}(),WD=new mn(0,0,-1),jD=new mn,XD=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new mn(1,-1,-1),e._illuminanceHDR=jg.SUN_ILLUM,e._illuminanceLDR=1,e._shadowEnabled=!1,e._shadowPcf=uT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._shadowSaturation=1,e._shadowDistance=50,e._shadowInvisibleOcclusionRange=200,e._csmLevel=lT.LEVEL_4,e._csmNeedUpdate=!1,e._csmLayerLambda=.75,e._csmOptimizationMode=cT.DisableRotationFix,e._csmLayersTransition=!1,e._csmTransitionRange=.05,e._shadowFixedArea=!1,e._shadowNear=.1,e._shadowFar=10,e._shadowOrthoSize=5,e._type=BD.DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=jg.SUN_ILLUM,this.direction=new mn(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=mn.transformQuat(jD,WD,this._node.worldRotation))},i.activate=function(){var t=v.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){mn.normalize(this._dir,t)}},{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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,fT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,fT.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,fT.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}(HD),YD=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 mn,e._aabb=Ko.create(),e._type=BD.SPHERE,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/zD(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Ko.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}(HD),qD=new mn(0,0,-1),KD=new In,QD=new Vn,ZD=new Vn,JD=new Vn,$D=new Vn,tR=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new mn(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._angleAttenuationStrength=0,e._pos=new mn,e._aabb=Ko.create(),e._frustum=ia.create(),e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=uT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._type=BD.SPOT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/zD(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new mn(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),mn.transformQuat(this._dir,qD,this._node.getWorldRotation(KD)),mn.normalize(this._dir,this._dir),Ko.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(QD),Vn.invert(QD,QD),Vn.perspective(ZD,this._angle,1,.001,this._range),Vn.multiply(JD,ZD,QD),this._frustum.update(JD,$D),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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}(HD),eR=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=new mn,e._aabb=Ko.create(),e._type=BD.POINT,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.range=1,this.luminanceHDR=1700/zD(1),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Ko.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}(HD),iR=new mn(0,0,-1),nR=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new mn(0,0,-1),e._pos=new mn(0,0,0),e._scale=new mn(1,1,1),e._right=new mn(1,0,0),e._illuminanceHDR=jg.SUN_ILLUM,e._illuminanceLDR=1,e._type=BD.RANGED_DIRECTIONAL,e}s(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.illuminance=jg.SUN_ILLUM},i.update=function(){this._node&&this._node.hasChangedFlags&&(this._node.getWorldPosition(this._pos),this._node.getWorldScale(this._scale),mn.transformQuat(this._dir,iR,this._node.worldRotation),mn.transformQuat(this._right,mn.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 v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}(HD),rR=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}(),sR=function(){function t(){this.scene=void 0,this.node=null,this.enabled=!0,this._localBoundaryCenter=new mn(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=nd.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?(t.projectionType===Qw.PERSPECTIVE&&(e=mn.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 t.projectionType===Qw.PERSPECTIVE?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}(),oR=Object.freeze({__proto__:null,get CameraFOVAxis(){return Kw},get CameraProjection(){return Qw},get CameraAperture(){return Zw},get CameraISO(){return Jw},get CameraShutter(){return $w},get CameraType(){return tD},get TrackingType(){return eD},get CameraUsage(){return iD},SKYBOX_FLAG:cD,Camera:fD,get ModelType(){return xD},Model:ND,SubModel:pD,Ambient:jg,EnvironmentLightingType:yT,Skybox:vT,ShadowSize:aT,ShadowType:hT,PCFType:uT,CSMLevel:lT,CSMOptimizationMode:cT,Shadows:fT,FogType:AT,FOG_TYPE_NONE:TT,Fog:bT,Octree:FD,Skin:kD,ColorTemperatureToRGB:VD,get LightType(){return BD},nt2lm:zD,Light:HD,DirectionalLight:XD,SphereLight:YD,SpotLight:tR,PointLight:eR,RangedDirectionalLight:nR,get ProbeClearFlag(){return yD},get ProbeType(){return vD},ReflectionProbe:CD,LODData:rR,LODGroup:sR,ToneMappingType:XE,PostSettings:YE}),aR=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 uR(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 o=this._pointLights,a=0;a<o.length;a++)o[a].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 _=l[c];_.enabled&&(_.updateTransform(t),_.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(){for(var t,e=f(this._cameras);!(t=e()).done;){var i=t.value;i.detachFromScene(),this._lodStateCache.removeCamera(i)}this._cameras.splice(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|=Om.ROTATION));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(){for(var t,e=f(this._models);!(t=e()).done;){var i=t.value;this._lodStateCache.removeModel(i),i.detachFromScene(),i.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(){for(var t,e=f(this._lodGroups);!(t=e()).done;){var i=t.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},e.onGlobalPipelineStateChanged=function(){for(var t,e=f(this._models);!(t=e()).done;)t.value.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}(),hR=function(){this.usedLevel=-1,this.lastUsedLevel=-1,this.transformDirty=!0},uR=function(){function t(t){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._levelModels=new Map,this._renderScene=t}var e=t.prototype;return e.addCamera=function(t){for(var e,i=f(this._renderScene.lodGroups);!(e=i()).done;){var n=e.value.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,i=f(this._renderScene.cameras);!(e=i()).done;){var n=e.value;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=0;e<t.lodCount;e++)for(var i,n=f(t.lodDataArray[e].models);!(i=n()).done;){var r=i.value;this._modelsInLODGroup.delete(r)}for(var s,o=f(this._lodStateInCamera);!(s=o()).done;)s.value[1].delete(t);this._levelModels.delete(t)},e.removeModel=function(t){this._modelsInLODGroup.has(t)&&this._modelsInLODGroup.delete(t)},e.updateLodState=function(){for(var t,e=this,i=f(this._newAddedLodGroupVec);!(t=i()).done;){var n=t.value,r=this._levelModels.get(n);r||(r=new Map,this._levelModels.set(n,r));for(var s=0;s<n.lodCount;s++){var o=r.get(s);o||(o=new Array);for(var a,h=f(n.lodDataArray[s].models);!(a=h()).done;){var u=a.value,l=this._modelsInLODGroup.get(u);l||(l=new Map),this._modelsInLODGroup.set(u,l),o.push(u)}r.set(s,o)}}this._newAddedLodGroupVec.length=0;for(var c,_=function(){var t=c.value;if(t.enabled){var i=t.getLockedLODLevels();if(i.length>0){if(t.node.hasChangedFlags>0)for(var n,r=f(e._lodStateInCamera);!(n=r()).done;){var s=n.value,o=s[1].get(t);o||(o=new hR,s[1].set(t,o)),o.transformDirty=!0}if(t.isLockLevelChanged()){t.resetLockChangeFlag();var a=e._levelModels.get(t);if(a){a.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}));for(var h,u=f(i);!(h=u()).done;){var l=h.value,_=a.get(l);_&&_.forEach((function(t){var i=e._modelsInLODGroup.get(t);if(i&&t.node&&t.node.active)for(var n,r=f(e._lodStateInCamera);!(n=r()).done;){var s=n.value;i.set(s[0],!0)}}))}}}return 0}for(var d,p=!1,m=f(e._lodStateInCamera);!(d=m()).done;){var g=d.value,y=g[1].get(t);y||(y=new hR,g[1].set(t,y));var v=g[0].node.hasChangedFlags,S=t.node.hasChangedFlags;if(v>0||S>0||y.transformDirty){y.transformDirty&&(y.transformDirty=!1);var A=t.getVisibleLODLevel(g[0]);A!==y.usedLevel&&(y.lastUsedLevel=y.usedLevel,y.usedLevel=A,p=!0)}}var T=e._levelModels.get(t);if(!T)return 0;t.isLockLevelChanged()?(t.resetLockChangeFlag(),T.forEach((function(t){t.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))})),p=!0):p&&e._lodStateInCamera.forEach((function(i){var n=i.get(t);if(n&&n.usedLevel!==n.lastUsedLevel){var r=T.get(n.lastUsedLevel);r&&r.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&i.clear()}))}})),p&&e._lodStateInCamera.forEach((function(i,n){var r=i.get(t);if(r){var s=r.usedLevel,o=T.get(s);o&&o.forEach((function(t){var i=e._modelsInLODGroup.get(t);i&&t.node&&t.node.active&&i.set(n,!0)}))}}))}},d=f(this._renderScene.lodGroups);!(c=d()).done;)_()},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}(),lR=((GD={})[Ie.PORTRAIT]=vc.IDENTITY,GD[Ie.LANDSCAPE_RIGHT]=vc.ROTATE_90,GD[Ie.PORTRAIT_UPSIDE_DOWN]=vc.ROTATE_180,GD[Ie.LANDSCAPE_LEFT]=vc.ROTATE_270,GD),cR=0,_R=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=cR++,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 R_(Dc.TEX2D,Rc.COLOR_ATTACHMENT|Rc.SAMPLED|Rc.TRANSFER_SRC,e.renderPassInfo.colorAttachments[i].format,this._width,this._height);e.externalFlag&&(e.externalFlag&Ic.EXTERNAL_NORMAL||e.externalFlag&Ic.EXTERNAL_OES)&&(n.flags|=e.externalFlag,n.externalRes=e.externalResLow?e.externalResLow:0),this._colorTextures.push(t.createTexture(n))}e.renderPassInfo.depthStencilAttachment&&e.renderPassInfo.depthStencilAttachment.format!==Ac.UNKNOWN&&(this._depthStencilTexture=t.createTexture(new R_(Dc.TEX2D,Rc.DEPTH_STENCIL_ATTACHMENT|Rc.SAMPLED,e.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=t.createFramebuffer(new J_(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,lR[ko.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 J_(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=f(this._cameras);!(n=r()).done;)n.value.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}();t("dh",UD),function(t){t.RENDER_FRAME_BEGIN="render-frame-begin",t.RENDER_FRAME_END="render-frame-end",t.RENDER_CAMERA_BEGIN="render-camera-begin",t.RENDER_CAMERA_END="render-camera-end",t.ATTACHMENT_SCALE_CAHNGED="attachment-scale-changed"}(UD||t("dh",UD={}));var fR,dR,pR,mR=t("dg",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}(lo));!function(t){t[t.NONE=-1]="NONE",t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT"}(fR||(fR={})),function(t){t[t.SESSION_RUNNING=2]="SESSION_RUNNING",t[t.VIEW_COUNT=6]="VIEW_COUNT",t[t.SWAPCHAIN_WIDTH=7]="SWAPCHAIN_WIDTH",t[t.SWAPCHAIN_HEIGHT=8]="SWAPCHAIN_HEIGHT",t[t.DEVICE_IPD=37]="DEVICE_IPD",t[t.SPLIT_AR_GLASSES=42]="SPLIT_AR_GLASSES"}(dR||(dR={})),function(t){t[t.VIEW_LEFT=0]="VIEW_LEFT",t[t.HAND_LEFT=1]="HAND_LEFT",t[t.AIM_LEFT=2]="AIM_LEFT",t[t.VIEW_RIGHT=3]="VIEW_RIGHT",t[t.HAND_RIGHT=4]="HAND_RIGHT",t[t.AIM_RIGHT=5]="AIM_RIGHT",t[t.HEAD_MIDDLE=6]="HEAD_MIDDLE"}(pR||(pR={}));var gR=t("aI",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 mR,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 nD,this._fpsTime=0,this._frameCount=0,this._fps=0,this._fixedFPS=0,this._useDeferredPipeline=!1,this._fixedFPSFrameTime=0,this._cumulativeTime=0,this._frameTime=0,this._cameraList=[],this._device=t,this._dataPoolMgr=v.internal.DataPoolManager&&new v.internal.DataPoolManager(t),aR.registerCreateFunc(this),_R.registerCreateFunc(this),this._cameraPool=new qs((function(){return new fD(e._device)}),4,(function(t){return t.destroy()}))}var e=t.prototype;return e.initialize=function(){var t,e=nd.swapchain,i=new W_;i.format=e.colorTexture.format;var n=new j_;n.format=e.depthStencilTexture.format,n.depthStoreOp=Hc.DISCARD,n.stencilStoreOp=Hc.DISCARD;var r=new q_([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:e.width,height:e.height,renderPassInfo:r,swapchain:e}),this._curWindow=this._mainWindow;var s=Me.querySettings(Re.Category.ANIMATION,"customJointTextureLayouts")||[];null===(t=this._dataPoolMgr)||void 0===t||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(),v.rendering&&v.rendering.destroy()},e.resize=function(t,e){for(var i,n=f(this._windows);!(i=n()).done;){var r=i.value;r.swapchain&&r.resize(t,e)}},e.setRenderPipeline=function(t){var e=v.internal,i=v.director,n=v.rendering,r=v.legacy_rendering;if(void 0===n&&void 0===r)return et(1223),!1;var s=!1;if(t)this._customPipeline=n.createCustomPipeline(),s=!0,this._pipeline=this._customPipeline,G("Using custom pipeline: "+Pe.CUSTOM_PIPELINE_NAME);else{var o=r.createDefaultPipeline();s=!0,G("Using legacy pipeline"),this._classicPipeline=o,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1}if((Me.querySettings(Re.Category.RENDERING,"renderMode")!==Zf.HEADLESS||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 a=i.getScene();return a&&a.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();this._pipeline.pipelineSceneData.skybox.enabled&&this._pipeline.pipelineSceneData.skybox.model.onGlobalPipelineStateChanged(),this._pipeline.onGlobalPipelineStateChanged()},e.activeWindow=function(t){this._curWindow=t},e.resetCumulativeTime=function(){this._cumulativeTime=0},e.frameMove=function(t){var e;this._frameTime=t,++this._frameCount,this._cumulativeTime+=t,this._fpsTime+=t,this._fpsTime>1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0),null!==(e=globalThis.__globalXR)&&void 0!==e&&e.isWebXR?this._doWebXRFrameMove():(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(){for(var t,e=f(this._windows);!(t=e()).done;)t.value.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(){for(var t,e=f(this._scenes);!(t=e()).done;)t.value.destroy();this._scenes.length=0},e.createModel=function(t){var e=this._modelPools.get(t);e||(this._modelPools.set(t,new qs((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)):$(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 qs((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 BD.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case BD.SPHERE:t.scene.removeSphereLight(t);break;case BD.SPOT:t.scene.removeSpotLight(t);break;case BD.POINT:t.scene.removePointLight(t);break;case BD.RANGED_DIRECTIONAL: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 BD.DIRECTIONAL:t.scene.removeDirectionalLight(t);break;case BD.SPHERE:t.scene.removeSphereLight(t);break;case BD.SPOT:t.scene.removeSpotLight(t);break;case BD.POINT:t.scene.removePointLight(t);break;case BD.RANGED_DIRECTIONAL:t.scene.removeRangedDirLight(t)}},e._doWebXRFrameMove=function(){var t=globalThis.__globalXR;if(t){var e=this._windows,i=this._cameraList,n=t.webXRMatProjs?t.webXRMatProjs.length:1;t.webXRWindowMap||(t.webXRWindowMap=new Map);for(var r=[],s=t.webxrHmdPoseInfos,o=0;o<n;o++){for(var a,h=f(e);!(a=h()).done;){var u=a.value;r=r.concat(u.cameras),u.swapchain&&t.webXRWindowMap.set(u,o)}if(s){for(var l=[0,0,0],c=0;c<s.length;c++){var _=s[c];if(_.code===pR.VIEW_LEFT&&o===fR.LEFT||_.code===pR.VIEW_RIGHT&&o===fR.RIGHT){l[0]=_.position.x,l[1]=_.position.y,l[2]=_.position.z;break}}for(var d,p=f(r);!(d=p()).done;){var m=d.value;m.trackingType!==eD.NO_TRACKING&&m.node&&(m.trackingType===eD.ROTATION&&(l=[0,0,0]),m.node.setPosition(l[0],l[1],l[2]))}}r.length=0,this._frameMoveBegin(),this._frameMoveProcess();for(var g=i.length-1;g>=0;g--){var y=i[g];(o===fR.LEFT&&y.cameraType===tD.RIGHT_EYE||o===fR.RIGHT&&y.cameraType===tD.LEFT_EYE)&&i.splice(g,1)}this._frameMoveEnd()}}},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=v.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([nd.swapchain]);var r=this._scenes,s=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o<r.length;o++)r[o].update(s)}},e._frameMoveEnd=function(){var t=v.director,e=v.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)||void 0===r||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((ny.COUNT+ry.COUNT+sy.COUNT+vy.COUNT+Sy.COUNT)/4,100),e=Math.floor((nd.gfxDevice.capabilities.maxVertexUniformVectors-t)/3);Iy(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,this._fixedFPSFrameTime=1e3/t):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),t}());v.Root=gR,Ei.Attr.setClassAttr(Pp,"target","type","Object"),Ei.Attr.setClassAttr(Pp,"target","ctor",xg);var yR,vR=new qs((function(){return new Array(16)}),3),SR=null,AR=new jn,TR=[Nm.TOUCH_START,Nm.TOUCH_MOVE,Nm.TOUCH_END,Nm.TOUCH_CANCEL],bR=[Nm.MOUSE_DOWN,Nm.MOUSE_ENTER,Nm.MOUSE_MOVE,Nm.MOUSE_LEAVE,Nm.MOUSE_UP,Nm.MOUSE_WHEEL];!function(t){t[t.ADD_POINTER_EVENT_PROCESSOR=0]="ADD_POINTER_EVENT_PROCESSOR",t[t.REMOVE_POINTER_EVENT_PROCESSOR=1]="REMOVE_POINTER_EVENT_PROCESSOR",t[t.MARK_LIST_DIRTY=2]="MARK_LIST_DIRTY"}(yR||(yR={}));var ER,CR=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(e,i){if(void 0===i&&(i=!1),this._isEnabled!==e){this._isEnabled=e;var n=this.node.children;if(e&&this._attachMask(),t.callbacksInvoker.emit(yR.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r].eventProcessor.setEnabled(e,!0)}},e.reattach=function(){var e,i=this;this.node.walk((function(n){e||(e=i._searchComponentsInParent(t._maskComp)),n.eventProcessor.maskList=e}))},e.destroy=function(){if(SR===this._node&&(SR=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),t.callbacksInvoker.emit(yR.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var e=new uw([this._dispatchingTouch],!0,nw.TOUCH_CANCEL);e.touch=this._dispatchingTouch,this.dispatchEvent(e),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)||void 0===r||r.off(t,e,i)},e.targetOff=function(e){var i,n;null===(i=this.capturingTarget)||void 0===i||i.removeAll(e),null===(n=this.bubblingTarget)||void 0===n||n.removeAll(e),this.shouldHandleEventTouch&&!this._hasTouchListeners()&&(this.shouldHandleEventTouch=!1),this.shouldHandleEventMouse&&!this._hasMouseListeners()&&(this.shouldHandleEventMouse=!1),this._hasPointerListeners()||t.callbacksInvoker.emit(yR.REMOVE_POINTER_EVENT_PROCESSOR,this)},e.emit=function(t,e,i,n,r,s){var o;null===(o=this.bubblingTarget)||void 0===o||o.emit(t,e,i,n,r,s)},e.dispatchEvent=function(t){var e,i=this.node,n=0;t.target=i;var r=vR.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 vR.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 vR.free(r);vR.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)&&void 0!==n&&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)&&void 0!==n&&n.hasEventListener(t)&&e.push(i),i=i.parent}},e.onUpdatingSiblingIndex=function(){t.callbacksInvoker.emit(yR.MARK_LIST_DIRTY)},e._searchComponentsInParent=function(t){var e=this.node;if(t){for(var i=0,n=[],r=e;r&&xg.isNode(r);r=r.parent,++i){var s=r.getComponent(t);if(s){var o={index:i,comp:s};n?n.push(o):n=[o]}}return n.length>0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==TR.indexOf(t)},e._isMouseEvent=function(t){return-1!==bR.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t<TR.length;++t){var e=TR[t];if(this.hasEventListener(e))return!0}return!1},e._hasMouseListeners=function(){for(var t=0;t<bR.length;++t){var e=bR[t];if(this.hasEventListener(e))return!0}return!1},e._hasPointerListeners=function(){return!!this._hasTouchListeners()||this._hasMouseListeners()},e._tryEmittingAddEvent=function(e){var i=this._isTouchEvent(e),n=this._isMouseEvent(e);i?this.shouldHandleEventTouch=!0:n&&(this.shouldHandleEventMouse=!0),!i&&!n||this._hasPointerListeners()||t.callbacksInvoker.emit(yR.ADD_POINTER_EVENT_PROCESSOR,this)},e._newCallbacksInvoker=function(){var e=this,i=new ho;return i._registerOffCallback((function(){e.shouldHandleEventTouch&&!e._hasTouchListeners()&&(e.shouldHandleEventTouch=!1),e.shouldHandleEventMouse&&!e._hasMouseListeners()&&(e.shouldHandleEventMouse=!1),e._hasPointerListeners()||t.callbacksInvoker.emit(yR.REMOVE_POINTER_EVENT_PROCESSOR,e)})),i},e._handleEventMouse=function(t){switch(t.type){case nw.MOUSE_DOWN:return this._handleMouseDown(t);case nw.MOUSE_MOVE:return this._handleMouseMove(t);case nw.MOUSE_UP:return this._handleMouseUp(t);case nw.MOUSE_WHEEL:return this._handleMouseWheel(t);case nw.MOUSE_LEAVE:return this._handleMouseLeave(t);case nw.MOUSE_ENTER:return this._handleMouseEnter(t);default:return!1}},e._handleMouseDown=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AR),!e._uiProps.uiTransformComp.hitTest(AR,t.windowId)||(t.type=Nm.MOUSE_DOWN,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseMove=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||this._isMouseLeaveWindow||(t.getLocation(AR),e._uiProps.uiTransformComp.hitTest(AR,t.windowId)?(this.previousMouseIn||(SR&&SR!==e&&(t.type=Nm.MOUSE_LEAVE,SR.dispatchEvent(t),SR.eventProcessor.previousMouseIn=!1),SR=e,t.type=Nm.MOUSE_ENTER,e.dispatchEvent(t),this.previousMouseIn=!0),t.type=Nm.MOUSE_MOVE,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0):(this.previousMouseIn&&(t.type=Nm.MOUSE_LEAVE,e.dispatchEvent(t),this.previousMouseIn=!1,SR=null),1)))},e._handleMouseUp=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AR),!e._uiProps.uiTransformComp.hitTest(AR,t.windowId)||(t.type=Nm.MOUSE_UP,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseWheel=function(t){var e=this._node;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AR),!e._uiProps.uiTransformComp.hitTest(AR,t.windowId)||(t.type=Nm.MOUSE_WHEEL,t.bubbles=!0,e.dispatchEvent(t),t.propagationStopped=!0,0)))},e._handleMouseLeave=function(t){return this._isMouseLeaveWindow=!0,this.previousMouseIn&&(t.type=Nm.MOUSE_LEAVE,this._node.dispatchEvent(t),this.previousMouseIn=!1,SR=null),!1},e._handleMouseEnter=function(){return this._isMouseLeaveWindow=!1,!1},e._handleEventTouch=function(t){try{switch(t.type){case nw.TOUCH_START:return this._handleTouchStart(t);case nw.TOUCH_MOVE:return this._handleTouchMove(t);case nw.TOUCH_END:return this._handleTouchEnd(t);case nw.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;return!(!e||!e._uiProps.uiTransformComp||(t.getLocation(AR),!e._uiProps.uiTransformComp.hitTest(AR,t.windowId)||(t.type=Nm.TOUCH_START,t.bubbles=!0,this._dispatchingTouch=t.touch,e.dispatchEvent(t),0)))},e._handleTouchMove=function(t){var e=this.node;return!(!e||!e._uiProps.uiTransformComp||(t.type=Nm.TOUCH_MOVE,t.bubbles=!0,this._dispatchingTouch=t.touch,e.dispatchEvent(t),0))},e._handleTouchEnd=function(t){var e=this.node;e&&e._uiProps.uiTransformComp&&(t.getLocation(AR),e._uiProps.uiTransformComp.hitTest(AR,t.windowId)?t.type=Nm.TOUCH_END:t.type=Nm.TOUCH_CANCEL,t.bubbles=!0,e.dispatchEvent(t),this._dispatchingTouch=null)},e._handleTouchCancel=function(t){var e=this.node;e&&e._uiProps.uiTransformComp&&(t.type=Nm.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}();CR._maskComp=null,CR.callbacksInvoker=new ho,v.NodeEventProcessor=CR,ht(xg.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),ht(xg.prototype,"Node",[{name:"width",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.width},customSetter:function(t){this._uiProps.uiTransformComp.width=t}},{name:"height",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.height},customSetter:function(t){this._uiProps.uiTransformComp.height=t}},{name:"anchorX",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorX},customSetter:function(t){this._uiProps.uiTransformComp.anchorX=t}},{name:"anchorY",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorY},customSetter:function(t){this._uiProps.uiTransformComp.anchorY=t}},{name:"getAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(t){return t||(t=new jn),t.set(this._uiProps.uiTransformComp.anchorPoint),t}},{name:"setAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(t,e){this._uiProps.uiTransformComp.setAnchorPoint(t,e)}},{name:"getContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(t){return t||(t=new Kn),t.set(this._uiProps.uiTransformComp.contentSize),t}},{name:"setContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(t,e){"number"==typeof t?this._uiProps.uiTransformComp.setContentSize(t,e):this._uiProps.uiTransformComp.setContentSize(t)}}]),ut(xx.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"}]),ht(xx.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),ut(xg.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),ht(Lm.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),ut(Pm,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),ht(Pm,"Layers",[{name:"Default",newName:"DEFAULT",target:Pm.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Pm.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Pm.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Pm.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Pm.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Pm.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Pm.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Pm.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Pm,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Pm,targetName:"Layers"}]),ut(Pm.Enum,"Layers.Enum",[{name:"ALWAYS"}]),ut(Pm.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var xR=$s.Flags.HideInHierarchy,wR=$s.Flags.DontSave,DR=t("dK",Ta("cc.PrivateNode")(ER=function(t){function e(e){var i;return $(12003,(i=t.call(this,e)||this).name),i.hideFlags|=wR|xR,i}return s(e,t),e}(xg))||ER);function RR(t,e){if(!e){var i=v.director.getScene();if(!i)return null;e=i}return e.getChildByPath(t)}ht(iw,"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:xg.EventType,targetName:"Node.EventType"}}))),ht(xg.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:Yw.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:Yw.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:Yw.EventType,targetName:"SystemEvent.EventType"}]),v.PrivateNode=DR,St({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),v.find=RR;var IR=_e,MR=$s.Flags.IsStartCalled,PR=$s.Flags.IsOnEnableCalled;function BR(t,e){for(var i=e.constructor._executionOrder,n=e._id,r=0,s=t.length-1,o=s>>>1;r<=s;o=r+s>>>1){var a=t[o],h=a.constructor._executionOrder;if(h>i)s=o-1;else if(h<i)r=o+1;else{var u=a._id;if(u>n)s=o-1;else{if(!(u<n))return o;r=o+1}}}return~r}function OR(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))}}$s.Flags.IsEditorOnEnableCalled;var LR=function(){function t(t){var e=le;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 NR(t,e){return t.constructor._executionOrder-e.constructor._executionOrder}LR.stableRemoveInactive=OR;var FR=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){OR(this._zero,t),OR(this._neg,t),OR(this._pos,t)},i.invoke=function(){var t=this._neg;t.array.length>0&&(t.array.sort(NR),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(NR),this._invoke(e),e.array.length=0)},e}(LR),kR=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;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=BR(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=BR(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}(LR);function VR(t,e,i){return function(n,r){try{e(n,r)}catch(e){v._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){v._throw(t),i&&(s[n.i]._objFlags|=i)}}}}var GR=VR((function(t){t.start(),t._objFlags|=MR}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i=e[t.i];i.start(),i._objFlags|=MR}}),MR),UR=VR((function(t,e){t.update(e)}),(function(t,e){var i=t.array;for(t.i=0;t.i<i.length;++t.i)i[t.i].update(e)})),zR=VR((function(t,e){t.lateUpdate(e)}),(function(t,e){var i=t.array;for(t.i=0;t.i<i.length;++t.i)i[t.i].lateUpdate(e)})),HR=function(t){var e=v.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))}},WR=function(){function t(){this._deferredComps=[],this.unscheduleAll()}var e=t.prototype;return e.unscheduleAll=function(){this.startInvoker=new FR(GR),this.updateInvoker=new kR(UR),this.lateUpdateInvoker=new kR(zR),this._updating=!1},e._onEnabled=function(t){v.director.getScheduler().resumeTarget(t),t._objFlags|=PR,this._updating?this._deferredComps.push(t):this._scheduleImmediate(t)},e._onDisabled=function(t){v.director.getScheduler().pauseTarget(t),t._objFlags&=~PR;var e=this._deferredComps.indexOf(t);e>=0?IR(this._deferredComps,e):(!t.internalStart||t._objFlags&MR||this.startInvoker.remove(t),t.internalUpdate&&this.updateInvoker.remove(t),t.internalLateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&PR)){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&PR&&(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&MR||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}(),jR=$s.Flags.IsPreloadStarted,XR=$s.Flags.IsOnLoadStarted,YR=$s.Flags.IsOnLoadCalled,qR=$s.Flags.IsOnEnableCalled,KR=$s.Flags.Deactivating,QR=function(t){function e(){return t.apply(this,arguments)||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){LR.stableRemoveInactive(this._zero,t)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},e}(LR),ZR=VR((function(t){var e;null===(e=t.internalPreload)||void 0===e||e.call(t)}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i,n;null===(i=(n=e[t.i]).internalPreload)||void 0===i||i.call(n)}})),JR=VR((function(t){var e;null===(e=t.internalOnLoad)||void 0===e||e.call(t),t._objFlags|=YR}),(function(t){var e=t.array;for(t.i=0;t.i<e.length;++t.i){var i,n=e[t.i];null===(i=n.internalOnLoad)||void 0===i||i.call(n),n._objFlags|=YR}}),YR),$R=new ue(4);function tI(t,e,i){et(3817,t.name,i),console.log("Corrupted component value:",e),e?t._removeComponent(e):ce(t.getWritableComponents(),i)}$R.get=function(){var t=this._get()||{preload:new QR(ZR),onLoad:new FR(JR),onEnable:new FR(HR)};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 eI=t("ds",function(){function t(){this.reset()}var e=t.prototype;return e.reset=function(){this._activatingStack=[]},e.activateNode=function(t,e){if(e){var i=$R.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(),$R.put(i))}else{this._deactivateNodeRecursively(t);for(var n,r=f(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(jR),s.onLoad.cancelInactive(XR),s.onEnable.cancelInactive(qR)}}t.emit(Nm.ACTIVE_IN_HIERARCHY_CHANGED,t)},e.activateComp=function(t,e,i,n){if(eo(t,!0)&&(t._objFlags&jR||(t._objFlags|=jR,t.internalPreload&&(e?e.add(t):t.internalPreload())),t._objFlags&XR||(t._objFlags|=XR,t.internalOnLoad?i?i.add(t):(t.internalOnLoad(),t._objFlags|=YR):t._objFlags|=YR),t._enabled)){if(!t.node.activeInHierarchy)return;v.director._compScheduler.enableComp(t,n)}},e.destroyComp=function(t){v.director._compScheduler.disableComp(t),t.internalOnDestroy&&t._objFlags&YR&&t.internalOnDestroy()},e._activateNodeRecursively=function(t,e,i,n){if(t._objFlags&KR)et(3816,t.name);else{t._setActiveInHierarchy(!0);for(var r=t.components.length,s=0;s<r;++s){var o=t.components[s];o instanceof v.Component?this.activateComp(o,e,i,n):(tI(t,o,s),--s,--r)}for(var a=0,h=t.children.length;a<h;++a){var u=t.children[a];u.active&&this._activateNodeRecursively(u,e,i,n)}t._onPostActivated(!0)}},e._deactivateNodeRecursively=function(t){t._objFlags|=KR,t._setActiveInHierarchy(!1);for(var e=t.components.length,i=0;i<e;++i){var n=t.components[i];if(n._enabled&&(v.director._compScheduler.disableComp(n),t.activeInHierarchy))return void(t._objFlags&=~KR)}for(var r=0,s=t.children.length;r<s;++r){var o=t.children[r];if(o.activeInHierarchy&&(this._deactivateNodeRecursively(o),t.activeInHierarchy))return void(t._objFlags&=~KR)}t._onPostActivated(!1),t._objFlags&=~KR},t}()),iI=$s.Flags.Destroyed,nI=$s.Flags.PersistentMask,rI=Ei.Attr.DELIMETER+"default",sI=Ei.IDENTIFIER_RE,oI="var ",aI="o",hI={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},uI=Ei.escapeForJS,lI=function(){function t(t,e){this.varName=t,this.expression=e}return t.prototype.toString=function(){return oI+this.varName+"="+this.expression+";"},t}();function cI(t,e){return e instanceof lI?new lI(e.varName,t+e.expression):t+e}function _I(t,e,i){Array.isArray(i)?(i[0]=cI(e,i[0]),t.push(i)):t.push(cI(e,i)+";")}var fI=function(){function t(t){this._exps=[],this._targetExp=t}var e=t.prototype;return 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];_I(t,e+dI(n[0])+"=",n[1])}},t}();function dI(t){return sI.test(t)?"."+t:"["+uI(t)+"]"}fI.pool=void 0,fI.pool=new ue((function(t){t._exps.length=0,t._targetExp=null}),1),fI.pool.get=function(t){var e=this._get()||new fI;return e._targetExp=t,e};var pI,mI,gI,yI,vI,SI,AI=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=Ot(),jt(this.funcModuleCache,hI),this.codeArray.push("var o,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=oI+this.globalVariables.join(",")+";");var n=pc(["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=Lt(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 o="F["+s+"]";return e&&(o="("+o+")"),this.funcModuleCache[i]=o,o},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=fI.pool.get(n),s=e.constructor.__props__;s||(s=Object.keys(e));for(var o=0;o<s.length;o++){var a=s[o],h=i[a];if(e[a]!==h){var u=this.enumerateField(i,a,h);r.append(a,u)}}r.writeCode(t),fI.pool.put(r)},e.enumerateCCClass=function(t,e,i){for(var n=i.__values__,r=Ei.Attr.getClassAttrs(i),s=0;s<n.length;s++){var o=n[s],a=e[o],h=r[o+rI];if(!TI(h,a))if("object"==typeof a&&a instanceof v.ValueType&&(h=Ei.getDefault(h))&&h.constructor===a.constructor){var u=aI+dI(o);this.setValueType(t,h,a,u)}else this.setObjProp(t,e,o,a)}},e.instantiateArray=function(t){if(0===t.length)return"[]";var e="a"+ ++this.localVariableId,i=[new lI(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)_I(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 lI(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]&&_I(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]=cI(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?uI(i):("_objFlags"===e&&to(t)&&(i&=nI),i)},e.setObjProp=function(t,e,i,n){_I(t,aI+dI(i)+"=",this.enumerateField(e,i,n))},e.enumerateObject=function(t,e){var i=e.constructor;if(Ci(i))this.enumerateCCClass(t,e,i);else for(var n in e)if(e.hasOwnProperty(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 v.ValueType)return Ei.getNewValueTypeCode(t);if(t instanceof v.Asset)return this.getObjRef(t);if(t._objFlags&iI)return null;var e,i=t.constructor;if(Ci(i)){if(this.parent)if(this.parent instanceof v.Component){if(t instanceof v.Node||t instanceof v.Component)return this.getObjRef(t)}else if(this.parent instanceof v.Node)if(t instanceof v.Node){if(!t.isChildOf(this.parent))return this.getObjRef(t)}else if(t instanceof v.Component){var n;if(null===(n=t.node)||void 0===n||!n.isChildOf(this.parent))return this.getObjRef(t)}e=new lI(aI,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)e=new lI(aI,"{}");else{if(i)return this.getObjRef(t);e=new lI(aI,"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 TI(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 v.ValueType){if(t.equals(e))return!0}else{if(Array.isArray(t))return 0===t.length&&0===e.length;if(t.constructor===Object)return Dt(t)&&Dt(e)}return!1}var bI=be({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),EI=t("dt",Ta("cc.Prefab")(((SI=function(t){function e(){var e;return(e=t.call(this)||this).data=gI&&gI(),e.optimizationPolicy=yI&&yI(),e.persistent=vI&&vI(),e._createFunction=null,e._instantiatedTimes=0,e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=v.instantiate(this);e.name=this.name,t(null,e)},i.compileCreateFunction=function(){var t,e;this._createFunction=(e=(t=this.data)instanceof v.Node&&t,new AI(t,e).result)},i._doInstantiate=function(t){return this.data._prefab||$(3700),this._createFunction||this.compileCreateFunction(),this._createFunction(t)},i._instantiate=function(){var t;return t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new xg,this.data.name="(Missing Node)";var i=new v._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;jx(t),Hx(t)},e}(Fd)).OptimizationPolicy=bI,SI.OptimizationPolicyThreshold=3,gI=fa((mI=SI).prototype,"data",[Ma],(function(){return null})),yI=fa(mI.prototype,"optimizationPolicy",[Ma],(function(){return bI.AUTO})),vI=fa(mI.prototype,"persistent",[Ma],(function(){return!1})),pI=mI))||pI);It(EI,"_utils",$x),v.Prefab=EI,Nt(v,"cc._Prefab","Prefab");var CI=new(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,_e(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(de(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}()),xI=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],wI=[".mp3",".ogg",".wav",".m4a"];function DI(){return!0}var RI={transformURL:function(t){var e=xd(t);if(!e)return t;var i=_d.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"===Co(t)&&(s=!0),s){var o=Do(t),a=wo(t);t=o+"."+n+"/"+a}else t=t.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/,(function(t){return t+"."+n}));return t}},II=t("ed",function(){function t(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=BS}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 o=[],a=[];NA.loadAny(n,null,(function(t,i,n){n.content&&(xI.includes(n.ext)?o.push(n.content):wI.includes(n.ext)&&a.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 Fd)){var r=i,s=n[t].url;o.includes(r)?yA.create(s,i,".png",{},(function(i,n){r=e[t]=n})):a.includes(r)&&yA.create(s,i,".mp3",{},(function(i,n){r=e[t]=n})),ud.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:DI,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return NA.assets.has(t)?{content:NA.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete,h=Co(t);h&&!FS.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),FS.load(t,s,o,a)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;t.forEach((function(e,i){var n=Co(e);n&&!FS.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),FS.load(t,s,o,a)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,o=r.onProgress,a=r.onComplete;FS.loadDir(t,s,o,(function(e,i){var n=[];e||(n=FS.getDirWithPath(t,s).map((function(t){return t.path}))),a&&a(e,i,n)}))},e.getRes=function(t,e){return ud.has(t)?ud.get(t):FS.get(t,e)},e.getResCount=function(){return ud.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return vm.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();oA.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();CA.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=ud.get(i)),NA.releaseAsset(i)}else t&&("string"==typeof t&&(t=ud.get(t)),NA.releaseAsset(t))},e.releaseAsset=function(t){NA.releaseAsset(t)},e.releaseRes=function(t,e){FS.release(t,e)},e.releaseAll=function(){NA.releaseAll(),ud.clear()},e.removeItem=function(t){return!!ud.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=vm.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){CS=t}},{key:"_cache",get:function(){if(ud instanceof od)return ud.map;var t={};return ud.forEach((function(e,i){t[i]=e})),t}},{key:"md5Pipe",get:function(){return RI}},{key:"downloader",get:function(){return oA}},{key:"loader",get:function(){return NA.parser}}]),t}()),MI=t("ee",new II),PI=t("ef",{init:function(t){t.importBase=t.libraryPath,t.nativeBase=t.rawAssetsBase,NA.init(t),t.rawAssets&&FS.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:gd.RESOURCES,importBase:t.importBase,nativeBase:t.nativeBase,paths:t.rawAssets.assets,uuids:Object.keys(t.rawAssets.assets),extensionMap:{}})},loadAsset:function(t,e){NA.loadAny(t,e)}}),BI=t("eg",{});ht(BI,"url",[{name:"normalize",target:NA.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(t){return t.startsWith("resources/")?Id({path:Ro(t.substr(10)),bundle:gd.RESOURCES,__isNative__:!0,ext:Co(t)}):""}}]),ut(PI,"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"}]),ut(MI,"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"}]),ht(v,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return MI}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return PI}},{name:"Pipeline",target:LA,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return BI}}]),ut(v,"cc",[{name:"LoadingItems",suggest:st(1400,"LoadingItems","AssetManager.Task")}]),ht(Pe,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:oA,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var OI=ES._autoRelease;ES._autoRelease=function(t,e,i){OI.call(ES,t,e,i);for(var n=MI._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var o=r[s];if(!0===n[o]){var a=ud.get(o);a&&ES.tryRelease(a)}}};var LI=t("dQ",function(t){function e(){var e;return(e=t.call(this)||this)._compScheduler=new WR,e._nodeActivator=new eI,e._invalid=!1,e._paused=!1,e._root=null,e._loadingScene="",e._scene=null,e._totalFrames=0,e._scheduler=new rc,e._systems=[],e._persistRootNodes={},e}s(e,t);var i=e.prototype;return i.end=function(){var t=this;this.once(e.EVENT_END_FRAME,(function(){t.purgeDirector()}))},i.pause=function(){this._paused=!0},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),eo(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),NA.releaseAll()},i.reset=function(){var t;for(var i in this.purgeDirector(),this._persistRootNodes)this.removePersistRootNode(this._persistRootNodes[i]);null===(t=this.getScene())||void 0===t||t.destroy(),this.emit(e.EVENT_RESET),this.startAnimation()},i.runSceneImmediate=function(t,i,n){var r=this;t instanceof ew&&(t=t.scene),rt(t instanceof tw,1216),t._load();for(var s=Object.keys(this._persistRootNodes).map((function(t){return r._persistRootNodes[t]})),o=0;o<s.length;o++){var a=s[o];a.emit(xg.EventType.SCENE_CHANGED_FOR_PERSISTS,t.renderScene);var h=t.uuid===a._originalSceneId&&t.getChildByUuid(a.uuid);if(h){var u=h.getSiblingIndex();a.hideFlags&=~$s.Flags.DontSave,a.hideFlags|=$s.Flags.DontSave&h.hideFlags,h._destroyImmediate(),t.insertChild(a,u)}else a.hideFlags|=$s.Flags.DontSave,a.parent=t}var l=this._scene;eo(l)&&l.destroy(),ES._autoRelease(l,t,this._persistRootNodes),this._scene=null,$s._deferredDestroy(),i&&i(),this.emit(e.EVENT_BEFORE_SCENE_LAUNCH,t),this._scene=t,t._activate(),this._root&&this._root.resetCumulativeTime(),this.startAnimation(),n&&n(null,t),this.emit(e.EVENT_AFTER_SCENE_LAUNCH,t)},i.runScene=function(t,i,n){var r=this;t instanceof ew&&(t=t.scene),rt(Boolean(t),1205),rt(t instanceof tw,1216),this.once(e.EVENT_END_FRAME,(function(){r.runSceneImmediate(t,i,n)}))},i.loadScene=function(t,i,n){var r=this;if(this._loadingScene)return $(1208,t,this._loadingScene),!1;var s=NA.bundles.find((function(e){return!!e.getSceneInfo(t)}));return s?(this.emit(e.EVENT_BEFORE_SCENE_LOADING,t),this._loadingScene=t,console.time("LoadScene "+t),s.loadScene(t,(function(e,s){console.timeEnd("LoadScene "+t),r._loadingScene="",e?(z(e),i&&i(e)):r.runSceneImmediate(s,n,i)})),!0):(et(1209,t),!1)},i.preloadScene=function(t,e,i){var n=NA.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)),z("preloadScene: "+r)}},i.resume=function(){this._paused=!1},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return v.game.deltaTime},i.getTotalTime=function(){return v.game.totalTime},i.getCurrentTime=function(){return v.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(rc.ID,t,200))},i.registerSystem=function(t,e,i){e.id=t,e.priority=i,this._systems.push(e),this._systems.sort(Jl.sortByPriority)},i.unregisterSystem=function(t){de(this._systems,t),this._systems.sort(Jl.sortByPriority)},i.getSystem=function(t){return this._systems.find((function(e){return e.id===t}))},i.getAnimationManager=function(){return this.getSystem(v.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(t){var e;e=v.game._calculateDT(t),this.tick(e)},i.tick=function(t){if(!this._invalid){if(this.emit(e.EVENT_BEGIN_FRAME),Xw._frameDispatchEvents(),!this._paused){this.emit(e.EVENT_BEFORE_UPDATE),this._compScheduler.startPhase(),this._compScheduler.updatePhase(t);for(var i=0;i<this._systems.length;++i)this._systems[i].update(t);this._compScheduler.lateUpdatePhase(t),this.emit(e.EVENT_AFTER_UPDATE),$s._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(t)}this.emit(e.EVENT_BEFORE_DRAW),CI.updateAllDirtyRenderers(),this._root.frameMove(t),this.emit(e.EVENT_AFTER_DRAW),xg.resetHasChangedFlags(),xg.clearNodeArray(),Ys.update(t),this.emit(e.EVENT_END_FRAME),this._totalFrames++}},i.buildRenderPipeline=function(){if(this._root){var t=this._root.customPipeline,e=this._root.cameraList;t.beginSetup();var i=v.rendering.getCustomPipeline(Pe.CUSTOM_PIPELINE_NAME);v.rendering.dispatchResizeEvents(e,i,t),i.setup(e,t),t.endSetup()}},i.setupRenderPipelineBuilder=function(){""!==Pe.CUSTOM_PIPELINE_NAME&&v.rendering&&this._root&&this._root.usesCustomPipeline&&(this.on(e.EVENT_BEFORE_RENDER,this.buildRenderPipeline,this),this.on(e.EVENT_BEFORE_SCENE_LAUNCH,v.rendering.forceResizeAllWindows,v.rendering))},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(rc.ID,this._scheduler,200),this._root=new gR(nd.gfxDevice),this._root.initialize({}),this.setupRenderPipelineBuilder();for(var t=0;t<this._systems.length;t++)this._systems[t].init();this.emit(e.EVENT_INIT)},i.addPersistRootNode=function(t){if(xg.isNode(t)&&t.uuid){var e=t.uuid;if(!this._persistRootNodes[e]){var i=this._scene;if(eo(i))if(t.parent){if(!(t.parent instanceof tw))return void $(3801);if(t.parent!==i)return void $(3802);t._originalSceneId=i.uuid}else t.parent=i,t._originalSceneId=i.uuid;this._persistRootNodes[e]=t,t._persistNode=!0,ES._addPersistNodeRef(t)}}else $(3800)},i.removePersistRootNode=function(t){var e=t.uuid||"";t===this._persistRootNodes[e]&&(delete this._persistRootNodes[e],t._persistNode=!1,t._originalSceneId="",ES._removePersistNodeRef(t))},i.isPersistRootNode=function(t){return!!t._persistNode},n(e,[{key:"root",get:function(){return this._root}}]),e}(lo));LI.EVENT_INIT="director_init",LI.EVENT_RESET="director_reset",LI.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",LI.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",LI.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",LI.EVENT_BEFORE_UPDATE="director_before_update",LI.EVENT_AFTER_UPDATE="director_after_update",LI.EVENT_BEFORE_DRAW="director_before_draw",LI.EVENT_AFTER_DRAW="director_after_draw",LI.EVENT_BEFORE_COMMIT="director_before_commit",LI.EVENT_BEFORE_RENDER="director_before_render",LI.EVENT_AFTER_RENDER="director_after_render",LI.EVENT_BEFORE_PHYSICS="director_before_physics",LI.EVENT_AFTER_PHYSICS="director_after_physics",LI.EVENT_BEGIN_FRAME="director_begin_frame",LI.EVENT_END_FRAME="director_end_frame",LI.instance=void 0,v.Director=LI;var NI,FI=t("dR",LI.instance=v.director=new LI),kI=function(){function t(){var t=this;this._rafHandle=0,this._onTick=null,this._targetFrameRate=60,this._isPlaying=!1,this._updateCallback=function(){t._isPlaying&&(t._rafHandle=requestAnimationFrame(t._updateCallback)),t._onTick&&t._onTick()}}var e=t.prototype;return e.start=function(){this._isPlaying||(this._rafHandle=requestAnimationFrame(this._updateCallback),this._isPlaying=!0)},e.stop=function(){this._isPlaying&&(cancelAnimationFrame(this._rafHandle),this._rafHandle=0,this._isPlaying=!1)},n(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,Bs.setPreferredFramesPerSecond(this._targetFrameRate),this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),VI=t("dk",(function(){this.quadIB=null,this.quadVB=null,this.quadIA=null}));ut(lp.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),ht(TD.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this.window}}]);var GI=((NI={})[Tc.UNORM]="Uint",NI[Tc.SNORM]="Int",NI[Tc.UINT]="Uint",NI[Tc.INT]="Int",NI[Tc.UFLOAT]="Float",NI[Tc.FLOAT]="Float",NI.default="Uint",NI);function UI(t){return""+(GI[t.type]||GI.default)+t.size/t.count*8}function zI(t,e,i,n,r){void 0===i&&(i=Ac.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=ff[i];r||(r=s.size);for(var o="set"+UI(s),a=s.size/s.count,h=Math.floor(e.length/s.count),u=Uo.isLittleEndian,l=0;l<h;++l)for(var c=n+r*l,_=0;_<s.count;++_){var f=c+a*_;t[o](f,e[s.count*l+_],u)}}function HI(t,e,i,n,r,s){void 0===e&&(e=Ac.R32F),void 0===i&&(i=0),void 0===n&&(n=t.byteLength-i),void 0===r&&(r=0),void 0===s&&(s=[]);var o=ff[e];r||(r=o.size);for(var a="get"+UI(o),h=o.size/o.count,u=Math.floor(n/r),l=Uo.isLittleEndian,c=0;c<u;++c)for(var _=i+r*c,f=0;f<o.count;++f){var d=_+h*f;s[o.count*c+f]=t[a](d,l)}return s}function WI(t,e,i,n,r,s,o){void 0===i&&(i=Ac.R32F),void 0===n&&(n=0),void 0===r&&(r=t.byteLength-n),void 0===s&&(s=0),o||(o=new DataView(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)));var a=ff[i];s||(s=a.size);for(var h="set"+UI(a),u="get"+UI(a),l=a.size/a.count,c=Math.floor(r/s),_=Uo.isLittleEndian,f=0;f<c;++f)for(var d=n+s*f,p=0;p<a.count;++p){var m=d+l*p,g=t[u](m,_);o[h](m,e(g,p,t),_)}return o}var jI=t("dZ",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 H_(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],o=i.indexView?i.indexView.count:s.view.count,a=s.view.stride,h=a*o,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),_=0;_<e;++_)for(var f=_*a,d=c[_]*a,p=0;p<a;++p)l[f+p]=u[d+p];this._flatBuffers.push({stride:a,count:o,buffer:l})}else l.set(t.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:a,count:o,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 U_("a_vertexId",Ac.R32F,!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 E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,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 t.EMPTY_GEOMETRIC_INFO;if(void 0===this.subMeshIdx)return t.EMPTY_GEOMETRIC_INFO;var e,i=this.mesh,n=this.subMeshIdx,r=this.attributes.find((function(t){return t.name===a_.ATTR_POSITION}));if(!r)return t.EMPTY_GEOMETRIC_INFO;switch(r.format){case Ac.RG32F:case Ac.RGB32F:if(!(e=i.readAttribute(n,a_.ATTR_POSITION)))return t.EMPTY_GEOMETRIC_INFO;break;case Ac.RGBA32F:var s=i.readAttribute(n,a_.ATTR_POSITION);if(!s)return t.EMPTY_GEOMETRIC_INFO;var o=s.length/4;e=new Float32Array(3*o);for(var a=0;a<o;++a){var h=3*a,u=4*a;e[h]=s[u],e[h+1]=s[u+1],e[h+2]=s[u+2]}break;case Ac.RG16F:case Ac.RGB16F:var l=i.readAttribute(n,a_.ATTR_POSITION);if(!l)return t.EMPTY_GEOMETRIC_INFO;e=new Float32Array(l.length);for(var c=0;c<l.length;++c)e[c]=hn(l[c]);break;case Ac.RGBA16F:var _=i.readAttribute(n,a_.ATTR_POSITION);if(!_)return t.EMPTY_GEOMETRIC_INFO;var f=_.length/4;e=new Float32Array(3*f);for(var d=0;d<f;++d){var p=3*d,m=4*d;e[p]=hn(_[m]),e[p+1]=hn(_[m+1]),e[p+2]=hn(_[m+2])}break;default:return t.EMPTY_GEOMETRIC_INFO}var g=i.readIndices(n)||void 0,y=new mn,v=new mn,S=ff[r.format].count;2===S?(y.set(e[0],e[1],0),v.set(e[0],e[1],0)):(y.set(e[0],e[1],e[2]),v.set(e[0],e[1],e[2]));for(var A=0;A<e.length;A+=S)2===S?(y.x=e[A]>y.x?e[A]:y.x,y.y=e[A+1]>y.y?e[A+1]:y.y,v.x=e[A]<v.x?e[A]:v.x,v.y=e[A+1]<v.y?e[A+1]:v.y):(y.x=e[A]>y.x?e[A]:y.x,y.y=e[A+1]>y.y?e[A+1]:y.y,y.z=e[A+2]>y.z?e[A+2]:y.z,v.x=e[A]<v.x?e[A]:v.x,v.y=e[A+1]<v.y?e[A+1]:v.y,v.z=e[A+2]<v.z?e[A+2]:v.z);return this._geometricInfo={positions:e,indices:g,boundingBox:{max:y,min:v}},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,o=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===o.jointMapIndex||!s.jointMaps[o.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var a=v.director.root.device,h=function(){var h=s.vertexBundles[o.vertexBundelIndices[u]];r=0,n=Ac.UNKNOWN;for(var l=0;l<h.attributes.length;l++){var c=h.attributes[l];if(c.name===a_.ATTR_JOINTS){n=c.format;break}r+=ff[c.format].size}if(n){var _=new Uint8Array(t.mesh.data.buffer,h.view.offset,h.view.length),f=new DataView(_.slice().buffer),d=s.jointMaps[o.jointMapIndex];WI(f,(function(t){return d.indexOf(t)}),n,r,h.view.length,h.view.stride,f);var p=a.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,h.view.length,h.view.stride));p.update(f.buffer),e.push(p),i.push(u)}else e.push(t.vertexBuffers[o.vertexBundelIndices[u]])},u=0;u<o.vertexBundelIndices.length;u++)h();return this._vertexIdChannel&&e.push(this._allocVertexIdBuffer(a)),e}},{key:"iaInfo",get:function(){return this._iaInfo}}]),t}());jI.EMPTY_GEOMETRIC_INFO={positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:mn.ZERO,max:mn.ZERO}};var XI,YI=new Vn,qI=new Vn,KI=new Vn,QI=new Vn,ZI=new Vn,JI=new Vn,$I=new Vn,tM=new mn(0,0,0),eM=new mn,iM=new jn,nM=new mn,rM=new mn,sM=new mn(1e7,1e7,1e7),oM=new mn(-1e7,-1e7,-1e7),aM=new mn,hM=0,uM=0,lM=function(){function t(t){this._shadowObjects=[],this._shadowCameraFar=0,this._matShadowView=new Vn,this._matShadowProj=new Vn,this._matShadowViewProj=new Vn,this._validFrustum=new ia,this._splitFrustum=new ia,this._lightViewFrustum=new ia,this._castLightViewBoundingBox=new Ko,this._level=t,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var e=t.prototype;return e.copyToValidFrustum=function(t){ia.copy(this._validFrustum,t)},e.calculateValidFrustumOrtho=function(t,e,i,n,r){ia.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=v.director.root.device,r=t.shadowInvisibleOcclusionRange;ia.copy(this._lightViewFrustum,this._splitFrustum),Vn.fromRT(qI,t.node.rotation,tM),Vn.invert(KI,qI);var s,o,a=KI.clone();this._lightViewFrustum.transform(KI),Ko.fromPoints(this._castLightViewBoundingBox,sM,oM),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),t.csmOptimizationMode===cT.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,o=2*this._castLightViewBoundingBox.halfExtents.y):s=o=mn.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var h=v.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1;if(h>1&&t.csmOptimizationMode===cT.RemoveDuplicates)if(this._level>=h-1)uM=this._castLightViewBoundingBox.halfExtents.z,hM=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-hM)+uM;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(aM.set(c.x,c.y,c.z+l+r),mn.transformMat4(aM,aM,qI),Vn.fromRT(qI,t.node.rotation,aM),Vn.invert(KI,qI),!i){var _=.5*s,f=.5*o;Vn.ortho(QI,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),Vn.multiply(JI,QI,a),mn.transformMat4(eM,aM,JI);var d=2/e;iM.set(d,d);var p=eM.x%iM.x,m=eM.y%iM.y;nM.set(eM.x-p,eM.y-m,eM.z),Vn.invert($I,JI),mn.transformMat4(rM,nM,$I),Vn.fromRT(qI,t.node.rotation,rM),Vn.invert(KI,qI),Vn.multiply(ZI,QI,KI),Vn.copy(this._matShadowView,KI),Vn.copy(this._matShadowProj,QI),Vn.copy(this._matShadowViewProj,ZI)}ia.createOrtho(this._validFrustum,s,o,.1,this._shadowCameraFar,qI)},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}(),cM=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new ln,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=v.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}(lM),_M=function(){function t(){this._castShadowObjects=[],this._layerObjects=new Qs(64),this._layers=[],this._levelCount=0,this._specialLayer=new lM(1),this._shadowDistance=0;for(var t=0;t<lT.LEVEL_4;t++)this._layers[t]=new cM(t)}var e=t.prototype;return e.update=function(t,e){var i=e.scene.mainLight;if(null!==i){var n=t.shadows,r=v.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=v.director.root.device,i=t.shadowOrthoSize,n=t.shadowOrthoSize,r=t.shadowNear,s=t.shadowFar;Vn.fromRT(qI,t.node.getWorldRotation(),t.node.getWorldPosition()),Vn.invert(KI,qI),Vn.ortho(QI,-i,i,-n,n,r,s,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY),Vn.multiply(ZI,QI,KI),this._specialLayer.matShadowView=KI,this._specialLayer.matShadowProj=QI,this._specialLayer.matShadowViewProj=ZI,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,qI)},e._splitFrustumLevels=function(t){var e=.1,i=t.shadowDistance,n=i/e,r=v.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,s=t.csmLayerLambda;this._layers[0].splitCameraNear=e;for(var o=1;o<r;o++){var a=o/r,h=s*e*Math.pow(n,a)+(1-s)*(e+(i-e)*a),u=1.005*h;this._layers[o].splitCameraNear=h,this._layers[o-1].splitCameraFar=u}this._layers[r-1].splitCameraFar=i,t.csmNeedUpdate=!1},e._calculateCSM=function(t,e,i){var n=v.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(YI,t);for(var s=n-1;s>=0;s--){var o=this._layers[s],a=o.splitCameraNear,h=o.splitCameraFar;o.calculateSplitFrustum(t,YI,a,h),o.createMatrix(e,r,!1)}n===lT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,Vn.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),Vn.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),Vn.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,YI,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.getWorldPosition(),r=i.getWorldRotation();Vn.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}(),fM=t("dd",function(){function t(){this.fog=new bT,this.ambient=new jg,this.skybox=new vT,this.shadows=new fT,this.csmLayers=new _M,this.octree=new FD,this.skin=new kD,this.postSettings=new YE,this.lightProbes=v.internal.LightProbes?new v.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._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=0;e<6;e++){this._geometryRendererMaterials[e]=new oT,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"internal/builtin-geometry-renderer",technique:e});for(var i=0;i<this._geometryRendererMaterials[e].passes.length;++i)this._geometryRendererPasses[t]=this._geometryRendererMaterials[e].passes[i],this._geometryRendererShaders[t]=this._geometryRendererMaterials[e].passes[i].getShaderVariant(),t++}},e.initOcclusionQuery=function(){if(this._occlusionQueryInputAssembler||(this._occlusionQueryInputAssembler=this._createOcclusionQueryIA()),!this._occlusionQueryMaterial){var t=new oT;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)||void 0===t||t.destroy(),this._occlusionQueryInputAssembler=null,null===(e=this._occlusionQueryVertexBuffer)||void 0===e||e.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||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]),i=3*Float32Array.BYTES_PER_ELEMENT,n=8*i;this._occlusionQueryVertexBuffer=t.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,o=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,o,s)),this._occlusionQueryIndicesBuffer.update(r);var a=[new U_("a_position",Ac.RGB32F)],h=new H_(a,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(h)},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}()),dM=Qn(),pM=((XI={})[Pe.ORIENTATION_AUTO]=Ie.AUTO,XI[Pe.ORIENTATION_LANDSCAPE]=Ie.LANDSCAPE,XI[Pe.ORIENTATION_PORTRAIT]=Ie.PORTRAIT,XI),mM=t("h2",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=Qn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=Jn(),e._visibleRect=Jn(),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null;var i=gM,n=yM;return e._rpExactFit=new xM(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new xM(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new xM(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new xM(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new xM(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=Go.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,dM.width=this._visibleRect.width,dM.height=this._visibleRect.height,zo&&zo.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=Me.querySettings(Re.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||xM.FIXED_HEIGHT),Go.on("window-resize",this._updateAdaptResult,this),Go.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){ko.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){ko.orientation=pM[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&&Go.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){ko.resolutionScale=1;var i=ko.devicePixelRatio,n=new Kn(t*i,e*i);Go.windowSize=n},i.getCanvasSize=function(){return Go.windowSize},i.getFrameSize=function(){var t=ko.devicePixelRatio,e=Go.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=ko.devicePixelRatio;Go.windowSize=new Kn(t*i,e*i)},i.getVisibleSize=function(){return new Kn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new Kn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new jn(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new jn(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof xM)this._resolutionPolicy=t;else{var e=xM;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=wM.getDesignResolutionSize();wM.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,o=this._visibleRect,a=r.viewport;s.x=a.x,s.y=a.y,s.width=a.width,s.height=a.height,o.x=0,o.y=0,o.width=a.width/this._scaleX,o.height=a.height/this._scaleY}n.postApply(this),dM.width=this._visibleRect.width,dM.height=this._visibleRect.height,zo&&zo.init(this._visibleRect),this.emit("design-resolution-changed")}else et(2200)},i.getDesignResolutionSize=function(){return new Kn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){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 ko.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new jn);var r=ko.devicePixelRatio*(t-i.left),s=ko.devicePixelRatio*(i.top+i.height-e);return ko.isFrameRotated?(n.x=Go.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){var n;v.director.root.resize(t,e,void 0===i||0===i?1:i);var r=this._designResolutionSize.width,s=this._designResolutionSize.height;t>0&&e>0?this.setDesignResolutionSize(r,s,this._resolutionPolicy):H(!1,"_updateAdaptResult Invalid size."),this.emit("canvas-resize"),null===(n=this._resizeCallback)||void 0===n||n.call(this)},e}(uo(Jl)));mM.instance=void 0;var gM=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=v.game.canvas;if(t){var e=Go.windowSize;t.width!==e.width&&(t.width=e.width),t.height!==e.height&&(t.height=e.height)}},t}();gM.EQUAL_TO_FRAME=void 0,gM.PROPORTION_TO_FRAME=void 0;var yM=function(){function t(){this.name="ContentStrategy",this._result={scale:[1,1],viewport:null},this._strategy=xM.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 o=new Zn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=o,this._result},n(t,[{key:"strategy",get:function(){return this._strategy}}]),t}(),vM=function(t){function e(){var e;return(e=t.call(this)||this).name="EqualToFrame",e}return s(e,t),e.prototype.apply=function(){ko.isProportionalToFrame=!1,this._setupCanvas()},e}(gM),SM=function(t){function e(){var e;return(e=t.call(this)||this).name="ProportionalToFrame",e}return s(e,t),e.prototype.apply=function(){ko.isProportionalToFrame=!0,this._setupCanvas()},e}(gM);gM.EQUAL_TO_FRAME=new vM,gM.PROPORTION_TO_FRAME=new SM;var AM=function(t){function e(){var e;return(e=t.call(this)||this).name="ExactFit",e._strategy=xM.EXACT_FIT,e}return s(e,t),e.prototype.apply=function(t,e){var i=Go.windowSize,n=i.width,r=i.height,s=n/e.width,o=r/e.height;return this._buildResult(n,r,n,r,s,o)},e}(yM),TM=function(t){function e(){var e;return(e=t.call(this)||this).name="ShowAll",e._strategy=xM.SHOW_ALL,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r=Go.windowSize,s=r.width,o=r.height,a=e.width,h=e.height,u=s/a,l=o/h,c=0;return u<l?(i=s,n=h*(c=u)):(i=a*(c=l),n=o),this._buildResult(s,o,i,n,c,c)},e}(yM),bM=function(t){function e(){var e;return(e=t.call(this)||this).name="NoBorder",e._strategy=xM.NO_BORDER,e}return s(e,t),e.prototype.apply=function(t,e){var i,n,r,s=Go.windowSize,o=s.width,a=s.height,h=e.width,u=e.height,l=o/h,c=a/u;return l<c?(n=h*(i=c),r=a):(n=o,r=u*(i=l)),this._buildResult(o,a,n,r,i,i)},e}(yM),EM=function(t){function e(){var e;return(e=t.call(this)||this).name="FixedHeight",e._strategy=xM.FIXED_HEIGHT,e}return s(e,t),e.prototype.apply=function(t,e){var i=Go.windowSize,n=i.width,r=i.height,s=r/e.height,o=n,a=r;return this._buildResult(n,r,o,a,s,s)},e}(yM),CM=function(t){function e(){var e;return(e=t.call(this)||this).name="FixedWidth",e._strategy=xM.FIXED_WIDTH,e}return s(e,t),e.prototype.apply=function(t,e){var i=Go.windowSize,n=i.width,r=i.height,s=n/e.width,o=n,a=r;return this._buildResult(n,r,o,a,s,s)},e}(yM),xM=t("h3",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 Go.windowSize}}]),t}());xM.EXACT_FIT=0,xM.NO_BORDER=1,xM.SHOW_ALL=2,xM.FIXED_HEIGHT=3,xM.FIXED_WIDTH=4,xM.UNKNOWN=5,xM.ContainerStrategy=gM,xM.ContentStrategy=yM,v.ResolutionPolicy=xM,yM.EXACT_FIT=new AM,yM.SHOW_ALL=new TM,yM.NO_BORDER=new bM,yM.FIXED_HEIGHT=new EM,yM.FIXED_WIDTH=new CM;var wM=t("h4",mM.instance=v.view=new mM);FI.registerSystem("view",wM,0),v.winSize=dM,new jn,new ef(null);var DM=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(){return Promise.resolve([])},t.preInit=function(){},t.initLayout=function(){},t.initScale=function(){},t.update=function(){},t.initBG=function(){},t.initLogo=function(){},t.initWaterMark=function(){},t.frame=function(){},t.destroy=function(){},n(e,[{key:"isFinished",get:function(){return!0}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();DM._ins=void 0,v.internal.SplashScreen=DM;var RM=new(function(){function t(){this._data=null}return t.prototype.init=function(t){var e=this;return void 0===t&&(t=""),v.rendering&&v.rendering.enableEffectImport&&t?new Promise((function(i,n){if(t.startsWith("http")){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)}else globalThis.fsUtils.readArrayBuffer(t,(function(t,r){t?n(t):(e._data=r,i())}))})):Promise.resolve()},n(t,[{key:"data",get:function(){return this._data}}]),t}());v.effectSettings=RM;var IM=t("dS",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 vo,e.onPostBaseInitDelegate=new vo,e.onPreInfrastructureInitDelegate=new vo,e.onPostInfrastructureInitDelegate=new vo,e.onPreSubsystemInitDelegate=new vo,e.onPostSubsystemInitDelegate=new vo,e.onPreProjectInitDelegate=new vo,e.onPostProjectInitDelegate=new vo,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(){FI.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)||void 0===t||t.stop(),this.emit(i.EVENT_PAUSE))},r.resume=function(){var t;this._paused&&(Xw._clearEvents(),this._paused=!1,null===(t=this._pacer)||void 0===t||t.start(),this.emit(i.EVENT_RESUME))},r.isPaused=function(){return this._paused},r.restart=function(){var t=this;return new Promise((function(t){FI.once(LI.EVENT_END_FRAME,(function(){return t()}))})).then((function(){FI.reset(),v.Object._deferredDestroy(),t.pause(),t.resume(),t._shouldLoadLaunchScene=!0,DM.instance.curTime=0,t._safeEmit(i.EVENT_RESTART)}))},r.end=function(){So.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(){j(t.debugMode||it.NONE)})).then((function(){return Uo.init()})).then((function(){n._initEvents()})).then((function(){return Me.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(){Pe.init(),n._initXR();var t,e={frame:t=document.createElement("div"),canvas:window.canvas,container:t};return e&&(n.canvas=e.canvas,n.frame=e.frame,n.container=e.container),Go.init(),_c.init(),nd.init(n.canvas,iy)})).then((function(){if(Me.querySettings(Re.Category.RENDERING,"customPipeline")){if(!v.rendering)return void et(12109);Pe.CUSTOM_PIPELINE_NAME||(Pe.CUSTOM_PIPELINE_NAME="Builtin")}else v.rendering=void 0;NA.init(),UA.init(),Pm.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 RM.init(Me.querySettings(Re.Category.RENDERING,"effectSettingsPath"))})).then((function(){if(v.rendering&&v.rendering.enableEffectImport)if(Me.querySettings(Re.Category.RENDERING,"renderMode")!==Zf.HEADLESS){var t=RM.data;null!==t?v.rendering.init(nd.gfxDevice,t):et(1102)}else v.rendering.init(nd.gfxDevice,null)})).then((function(){var t=Me.querySettings(Re.Category.SCRIPTING,"scriptPackages");return t?Promise.all(t.map((function(t){return e.import(t)}))):Promise.resolve([])})).then((function(){return FI.init(),UA.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){G("Cocos Creator v"+S),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=Me.querySettings(Re.Category.PLUGINS,"jsList"),e=Promise.resolve();return t&&t.forEach((function(t){e=e.then((function(){return __wxRequire("src/"+t)}))})),e})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return UA.compileBuiltinMaterial(),DM.instance.init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},r._initXR=function(){var t;if(void 0===globalThis.__globalXR&&(globalThis.__globalXR={}),globalThis.__globalXR.webxrCompatible=null!==(t=Me.querySettings(Re.Category.XR,"webxrCompatible"))&&void 0!==t&&t,Uo.isXR){var e,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(e=Me.querySettings(Re.Category.RENDERING,"msaa"))&&void 0!==e?e:1,r=null!==(i=Me.querySettings(Re.Category.RENDERING,"renderingScale"))&&void 0!==i?i:1;xr.entry.setMultisamplesRTT(n),xr.entry.setRenderingScale(r)}},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=Me.querySettings(Re.Category.ASSETS,"preloadAssets");return t?Promise.all(t.map((function(t){return new Promise((function(e,i){NA.loadAny(t,(function(t){t?i(t):e()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(t){t()}))},r._loadProjectBundles=function(){var t=Me.querySettings(Re.Category.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),NA.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(DM.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=Me.querySettings(Re.Category.LAUNCH,"launchScene");i?FI.loadScene(i,(function(){var e;K(1103,i),t._initTime=performance.now(),FI.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),FI.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else FI.tick(this._calculateDT(!1));else DM.instance.update(this._calculateDT(!1))},r.initPacer=function(){var t,e=null!==(t=Me.querySettings(Re.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;H("number"==typeof e),this._pacer=new kI,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},r._initEvents=function(){So.on("show",this._onShow,this),So.on("hide",this._onHide,this),So.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),So.exit()},r.addPersistRootNode=function(t){FI.addPersistRootNode(t)},r.removePersistRootNode=function(t){FI.removePersistRootNode(t)},r.isPersistRootNode=function(t){return FI.isPersistRootNode(t)},r._setupRenderPipeline=function(){var t=Me.querySettings(Re.Category.RENDERING,"customPipeline");return this._setRenderPipeline(!!t)},r._setRenderPipeline=function(t){FI.root.setRenderPipeline(t)?(this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)):et(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}(lo));IM.EVENT_HIDE="game_on_hide",IM.EVENT_SHOW="game_on_show",IM.EVENT_LOW_MEMORY="game_on_low_memory",IM.EVENT_GAME_INITED="game_inited",IM.EVENT_ENGINE_INITED="engine_inited",IM.EVENT_RENDERER_INITED="renderer_inited",IM.EVENT_PRE_BASE_INIT="pre_base_init",IM.EVENT_POST_BASE_INIT="post_base_init",IM.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",IM.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",IM.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",IM.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",IM.EVENT_PRE_PROJECT_INIT="pre_project_init",IM.EVENT_POST_PROJECT_INIT="post_project_init",IM.EVENT_RESTART="game_on_restart",IM.EVENT_PAUSE="game_on_pause",IM.EVENT_RESUME="game_on_resume",IM.EVENT_CLOSE="game_on_close",IM.RENDER_TYPE_CANVAS=0,IM.RENDER_TYPE_WEBGL=1,IM.RENDER_TYPE_OPENGL=2,IM.RENDER_TYPE_HEADLESS=3,IM.DEBUG_DT_THRESHOLD=1,v.Game=IM;var MM=t("dT",v.game=new IM);lt(LI.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"}]),ut(LI.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"}]),ht(FI,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(t){var e;return NA.main?null===(e=NA.main.getSceneInfo(t))||void 0===e?void 0:e.uuid:""}}]),lt(MM,"game",[{name:"collisionMatrix"},{name:"groupList"}]),ht(MM,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var t=[];return NA.main&&NA.main.config.scenes.forEach((function(e){t.push(e)})),t}}]);var PM=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 Rm(this._textureSize,this._textureSize),this._atlases.push(t)),t},i.beforeSceneLoad=function(){this.reset()},i.init=function(){this.enabled=!Pe.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(e.minFilter!==Oc.LINEAR||e.magFilter!==Oc.LINEAR||e.mipFilter!==Oc.NONE)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(),v.director.on(v.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),v.director.off(v.Director.EVENT_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}(Jl));PM.instance=void 0;var BM,OM=t("a5",PM.instance=new PM);FI.registerSystem("dynamicAtlasManager",OM,0),v.internal.dynamicAtlasManager=OM,function(t){t[t.positions=a_.ATTR_POSITION]="positions",t[t.normals=a_.ATTR_NORMAL]="normals",t[t.uvs=a_.ATTR_TEX_COORD]="uvs",t[t.colors=a_.ATTR_COLOR]="colors"}(BM||(BM={}));var LM,NM=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}(),FM=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>My.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new VM(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new kM(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?void 0:s.createInstance())&&void 0!==r?r:null}return{setWeights:function(t,e){var n;null===(n=i[t])||void 0===n||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_.ATTR_POSITION)&&s.push({name:"CC_MORPH_TARGET_HAS_POSITION",value:!0}),n.attributes.includes(a_.ATTR_NORMAL)&&s.push({name:"CC_MORPH_TARGET_HAS_NORMAL",value:!0}),n.attributes.includes(a_.ATTR_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])||void 0===n||n.adaptPipelineState(e)},destroy:function(){for(var t=0,e=i;t<e.length;t++){var n=e[t];null==n||n.destroy()}}}},t}(),kM=function(){function t(t,e,i,n){this._gfxDevice=n;var r=i.subMeshMorphs[e];this._subMeshMorph=r,HM(t,e,n);var s=t.struct.vertexBundles[t.struct.primitives[e].vertexBundelIndices[0]].view.count;this._verticesCount=s;var o=r.targets.length,a=zM(n,s*o);this._textureInfo={width:a.width,height:a.height},this._attributes=r.attributes.map((function(e,i){var n=a.create(),o=n.valueView;return r.targets.forEach((function(e,n){for(var r=e.displacements[i],a=new Float32Array(t.data.buffer,t.data.byteOffset+r.offset,r.count),h=s*n*4,u=0;u<s;++u)o[h+4*u+0]=a[3*u+0],o[h+4*u+1]=a[3*u+1],o[h+4*u+2]=a[3*u+2]})),n.updatePixels(),{name:e,morphTexture:n}}))}var e=t.prototype;return e.destroy=function(){for(var t,e=f(this._attributes);!(t=e()).done;)t.value.morphTexture.destroy()},e.createInstance=function(){var t=this,e=new UM(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,r=f(t._attributes);!(n=r()).done;){var s=n.value,o=void 0;switch(s.name){case a_.ATTR_POSITION:o=Gy;break;case a_.ATTR_NORMAL:o=Hy;break;case a_.ATTR_TANGENT:o=Xy;break;default:$(16374)}void 0!==o&&(i.bindSampler(o,s.morphTexture.sampler),i.bindTexture(o,s.morphTexture.texture))}i.bindBuffer(My.BINDING,e.buffer),i.update()},destroy:function(){}}},t}(),VM=function(){function t(t,e,i,n){this._attributes=[],this._gfxDevice=n;var r=i.subMeshMorphs[e];HM(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 GM(this,this._attributes[0].targets[0].displacements.length/3,this._gfxDevice)},n(t,[{key:"data",get:function(){return this._attributes}}]),t}(),GM=function(){function t(t,e,i){this._owner=t,this._morphUniforms=new UM(i,0);var n=zM(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 o=r.targets[s].displacements,a=t[s],h=o.length/3;if(0===s)for(var u=0;u<h;++u)n[4*u+0]=o[3*u+0]*a,n[4*u+1]=o[3*u+1]*a,n[4*u+2]=o[3*u+2]*a;else if(0!==a)for(var l=0;l<h;++l)n[4*l+0]+=o[3*l+0]*a,n[4*l+1]+=o[3*l+1]*a,n[4*l+2]+=o[3*l+2]*a}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,i=f(this._attributes);!(e=i()).done;){var n=e.value,r=void 0;switch(n.attributeName){case a_.ATTR_POSITION:r=Gy;break;case a_.ATTR_NORMAL:r=Hy;break;case a_.ATTR_TANGENT:r=Xy;break;default:$(16374)}void 0!==r&&(t.bindSampler(r,n.morphTexture.sampler),t.bindTexture(r,n.morphTexture.texture))}t.bindBuffer(My.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}(),UM=function(){function t(t,e){this._targetCount=e,this._localBuffer=new DataView(new ArrayBuffer(My.SIZE)),this._remoteBuffer=t.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,My.SIZE,My.SIZE))}var e=t.prototype;return e.destroy=function(){this._remoteBuffer.destroy()},e.setWeights=function(t){t.length,this._targetCount;for(var e=v.sys.isLittleEndian,i=0;i<t.length;++i)this._localBuffer.setFloat32(My.OFFSET_OF_WEIGHTS+4*i,t[i],e)},e.setMorphTextureInfo=function(t,e){var i=v.sys.isLittleEndian;this._localBuffer.setFloat32(My.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH,t,i),this._localBuffer.setFloat32(My.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT,e,i)},e.setVerticesCount=function(t){var e=v.sys.isLittleEndian;this._localBuffer.setFloat32(My.OFFSET_OF_VERTICES_COUNT,t,e)},e.commit=function(){this._remoteBuffer.update(this._localBuffer.buffer)},n(t,[{key:"buffer",get:function(){return this._remoteBuffer}}]),t}();function zM(t,e){var i,n,r,s;t.getFormatFeatures(Ac.RGBA32F)&Mc.SAMPLED_TEXTURE?(i=e,r=16,n=Dm.PixelFormat.RGBA32F,s=Float32Array):(i=4*e,r=4,n=Dm.PixelFormat.RGBA8888,s=Uint8Array);var o=function(t){t<5&&(t=5);var e=C(qi(t)),i=e>>1;return{width:1<<(1&e?i+1:i),height:1<<i}}(i),a=o.width,h=o.height;return{width:a,height:h,create:function(){var e=new ArrayBuffer(a*h*r),i=new Float32Array(e),o=s===Float32Array?i:new s(e),u=new sp({width:a,height:h,_data:o,_compressed:!1,format:n}),l=new Dm;l.setFilters(Dm.Filter.NEAREST,Dm.Filter.NEAREST),l.setMipFilter(Dm.Filter.NONE),l.setWrapMode(Dm.WrapMode.CLAMP_TO_EDGE,Dm.WrapMode.CLAMP_TO_EDGE,Dm.WrapMode.CLAMP_TO_EDGE),l.image=u,l.getGFXTexture()||$(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(o)}}}}}function HM(t,e,i){t.renderingSubMeshes[e].enableVertexIdChannel(i)}function WM(t,e){return(i=t,new Promise((function(t){t("cocos-js/"+i)}))).then((function(t){return CCWebAssembly.instantiate(t,e)}));var i}function jM(){return LM||(LM=new Promise((function(t){t()})))}var XM={};MM.onPostInfrastructureInitDelegate.add((function(){return jM().then((function(){return Promise.all([e.import("./meshopt_decoder.wasm-ebbcb6df.js"),e.import("./meshopt_decoder.wasm-43855155.js")]).then((function(t){var e,i,n=t[0].default,r=t[1].default;return e=n,i=r,Promise.all([e.ready((function(t){return WM(i,t)}))]).then((function(){XM.supported=e.supported,XM.ready=Promise.resolve(),XM.decodeVertexBuffer=e.decodeVertexBuffer,XM.decodeIndexBuffer=e.decodeIndexBuffer,XM.decodeIndexSequence=e.decodeIndexSequence,XM.decodeGltfBuffer=e.decodeGltfBuffer,XM.useWorkers=e.useWorkers,XM.decodeGltfBufferAsync=e.decodeGltfBufferAsync,K(14203)}))}))})).catch((function(t){z(t)}))}));
- /** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */
- var YM={};(function(){function t(t){throw t}var e=void 0,i=!0,n=this;function r(t,i){var r,s=t.split("."),o=n;!(s[0]in o)&&o.execScript&&o.execScript("var "+s[0]);for(;s.length&&(r=s.shift());)s.length||i===e?o=o[r]?o[r]:o[r]={}:o[r]=i}var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;function o(t){if("string"==typeof t){var e,i,n=t.split("");for(e=0,i=n.length;e<i;e++)n[e]=(255&n[e].charCodeAt(0))>>>0;t=n}for(var r,s=1,o=0,a=t.length,h=0;0<a;){a-=r=1024<a?1024:a;do{o+=s+=t[h++]}while(--r);s%=65521,o%=65521}return(o<<16|s)>>>0}function a(e,i){this.index="number"==typeof i?i:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}a.prototype.f=function(){var t,e=this.buffer,i=e.length,n=new(s?Uint8Array:Array)(i<<1);if(s)n.set(e);else for(t=0;t<i;++t)n[t]=e[t];return this.buffer=n},a.prototype.d=function(t,e,i){var n,r=this.buffer,s=this.index,o=this.i,a=r[s];if(i&&1<e&&(t=8<e?(f[255&t]<<24|f[t>>>8&255]<<16|f[t>>>16&255]<<8|f[t>>>24&255])>>32-e:f[t]>>8-e),8>e+o)a=a<<e|t,o+=e;else for(n=0;n<e;++n)a=a<<1|t>>e-n-1&1,8==++o&&(o=0,r[s++]=f[a],a=0,s===r.length&&(r=this.f()));r[s]=a,this.buffer=r,this.i=o,this.index=s},a.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0<this.i&&(e[i]<<=8-this.i,e[i]=f[e[i]],i++),s?t=e.subarray(0,i):(e.length=i,t=e),t};var h,u=new(s?Uint8Array:Array)(256);for(h=0;256>h;++h){for(var l=_=h,c=7,_=_>>>1;_;_>>>=1)l<<=1,l|=1&_,--c;u[h]=(l<<c&255)>>>0}var f=u;function d(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,o,a,h,u,l,c=t.length,_=0,f=Number.POSITIVE_INFINITY;for(u=0;u<c;++u)t[u]>_&&(_=t[u]),t[u]<f&&(f=t[u]);for(e=1<<_,i=new(s?Uint32Array:Array)(e),n=1,r=0,o=2;n<=_;){for(u=0;u<c;++u)if(t[u]===n){for(a=0,h=r,l=0;l<n;++l)a=a<<1|1&h,h>>=1;for(l=a;l<e;l+=o)i[l]=n<<16|u;++r}++n,r<<=1,o<<=1}return[i,_,f]}function m(t,e){this.h=y,this.w=0,this.input=t,this.b=0,e&&(e.lazy&&(this.w=e.lazy),"number"==typeof e.compressionType&&(this.h=e.compressionType),e.outputBuffer&&(this.a=s&&e.outputBuffer instanceof Array?new Uint8Array(e.outputBuffer):e.outputBuffer),"number"==typeof e.outputIndex&&(this.b=e.outputIndex)),this.a||(this.a=new(s?Uint8Array:Array)(32768))}d.prototype.getParent=function(t){return 2*((t-2)/4|0)},d.prototype.push=function(t,e){var i,n,r,s=this.buffer;for(i=this.length,s[this.length++]=e,s[this.length++]=t;0<i&&(n=this.getParent(i),s[i]>s[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},d.prototype.pop=function(){var t,e,i,n,r,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;!((n=2*r+2)>=this.length)&&(n+2<this.length&&s[n+2]>s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:t,value:e,length:this.length}};var g,y=2,v={NONE:0,r:1,j:y,N:3},S=[];for(g=0;288>g;g++)switch(i){case 143>=g:S.push([g+48,8]);break;case 255>=g:S.push([g-144+400,9]);break;case 279>=g:S.push([g-256+0,7]);break;case 287>=g:S.push([g-280+192,8]);break;default:t("invalid literal: "+g)}function A(t,e){this.length=t,this.G=e}function T(){var e=b;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}m.prototype.n=function(){var n,r,o,h,u=this.input;switch(this.h){case 0:for(o=0,h=u.length;o<h;){var l,c,_,f=r=s?u.subarray(o,o+65535):u.slice(o,o+65535),d=(o+=r.length)===h,p=e,m=e,g=this.a,v=this.b;if(s){for(g=new Uint8Array(this.a.buffer);g.length<=v+f.length+5;)g=new Uint8Array(g.length<<1);g.set(this.a)}if(l=d?1:0,g[v++]=0|l,_=65536+~(c=f.length)&65535,g[v++]=255&c,g[v++]=c>>>8&255,g[v++]=255&_,g[v++]=_>>>8&255,s)g.set(f,v),v+=f.length,g=g.subarray(0,v);else{for(p=0,m=f.length;p<m;++p)g[v++]=f[p];g.length=v}this.b=v,this.a=g}break;case 1:var A=new a(new Uint8Array(this.a.buffer),this.b);A.d(1,1,i),A.d(1,2,i);var T,b,E,C=w(this,u);for(T=0,b=C.length;T<b;T++)if(E=C[T],a.prototype.d.apply(A,S[E]),256<E)A.d(C[++T],C[++T],i),A.d(C[++T],5),A.d(C[++T],C[++T],i);else if(256===E)break;this.a=A.finish(),this.b=this.a.length;break;case y:var x,I,M,P,B,O,L,N,F,k,V,G,U,z,H,W=new a(new Uint8Array(this.a),this.b),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=Array(19);for(x=y,W.d(1,1,i),W.d(x,2,i),I=w(this,u),L=R(O=D(this.L,15)),F=R(N=D(this.K,7)),M=286;257<M&&0===O[M-1];M--);for(P=30;1<P&&0===N[P-1];P--);var Y,q,K,Q,Z,J,$=M,tt=P,et=new(s?Uint32Array:Array)($+tt),it=new(s?Uint32Array:Array)(316),nt=new(s?Uint8Array:Array)(19);for(Y=q=0;Y<$;Y++)et[q++]=O[Y];for(Y=0;Y<tt;Y++)et[q++]=N[Y];if(!s)for(Y=0,Q=nt.length;Y<Q;++Y)nt[Y]=0;for(Y=Z=0,Q=et.length;Y<Q;Y+=q){for(q=1;Y+q<Q&&et[Y+q]===et[Y];++q);if(K=q,0===et[Y])if(3>K)for(;0<K--;)it[Z++]=0,nt[0]++;else for(;0<K;)(J=138>K?K:138)>K-3&&J<K&&(J=K-3),10>=J?(it[Z++]=17,it[Z++]=J-3,nt[17]++):(it[Z++]=18,it[Z++]=J-11,nt[18]++),K-=J;else if(it[Z++]=et[Y],nt[et[Y]]++,3>--K)for(;0<K--;)it[Z++]=et[Y],nt[et[Y]]++;else for(;0<K;)(J=6>K?K:6)>K-3&&J<K&&(J=K-3),it[Z++]=16,it[Z++]=J-3,nt[16]++,K-=J}for(n=s?it.subarray(0,Z):it.slice(0,Z),k=D(nt,7),z=0;19>z;z++)X[z]=k[j[z]];for(B=19;4<B&&0===X[B-1];B--);for(V=R(k),W.d(M-257,5,i),W.d(P-1,5,i),W.d(B-4,4,i),z=0;z<B;z++)W.d(X[z],3,i);for(z=0,H=n.length;z<H;z++)if(G=n[z],W.d(V[G],k[G],i),16<=G){switch(z++,G){case 16:U=2;break;case 17:U=3;break;case 18:U=7;break;default:t("invalid code: "+G)}W.d(n[z],U,i)}var rt,st,ot,at,ht,ut,lt,ct,_t=[L,O],ft=[F,N];for(ht=_t[0],ut=_t[1],lt=ft[0],ct=ft[1],rt=0,st=I.length;rt<st;++rt)if(ot=I[rt],W.d(ht[ot],ut[ot],i),256<ot)W.d(I[++rt],I[++rt],i),at=I[++rt],W.d(lt[at],ct[at],i),W.d(I[++rt],I[++rt],i);else if(256===ot)break;this.a=W.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var b,E,C=[];for(b=3;258>=b;b++)E=T(),C[b]=E[2]<<24|E[1]<<16|E[0];var x=s?new Uint32Array(C):C;function w(n,r){function o(e,n){var r,s,o,a,h=e.G,u=[],l=0;switch(r=x[e.length],u[l++]=65535&r,u[l++]=r>>16&255,u[l++]=r>>24,i){case 1===h:s=[0,h-1,0];break;case 2===h:s=[1,h-2,0];break;case 3===h:s=[2,h-3,0];break;case 4===h:s=[3,h-4,0];break;case 6>=h:s=[4,h-5,1];break;case 8>=h:s=[5,h-7,1];break;case 12>=h:s=[6,h-9,2];break;case 16>=h:s=[7,h-13,2];break;case 24>=h:s=[8,h-17,3];break;case 32>=h:s=[9,h-25,3];break;case 48>=h:s=[10,h-33,4];break;case 64>=h:s=[11,h-49,4];break;case 96>=h:s=[12,h-65,5];break;case 128>=h:s=[13,h-97,5];break;case 192>=h:s=[14,h-129,6];break;case 256>=h:s=[15,h-193,6];break;case 384>=h:s=[16,h-257,7];break;case 512>=h:s=[17,h-385,7];break;case 768>=h:s=[18,h-513,8];break;case 1024>=h:s=[19,h-769,8];break;case 1536>=h:s=[20,h-1025,9];break;case 2048>=h:s=[21,h-1537,9];break;case 3072>=h:s=[22,h-2049,10];break;case 4096>=h:s=[23,h-3073,10];break;case 6144>=h:s=[24,h-4097,11];break;case 8192>=h:s=[25,h-6145,11];break;case 12288>=h:s=[26,h-8193,12];break;case 16384>=h:s=[27,h-12289,12];break;case 24576>=h:s=[28,h-16385,13];break;case 32768>=h:s=[29,h-24577,13];break;default:t("invalid distance")}for(r=s,u[l++]=r[0],u[l++]=r[1],u[l++]=r[2],o=0,a=u.length;o<a;++o)g[y++]=u[o];S[u[0]]++,T[u[3]]++,v=e.length+n-1,d=null}var a,h,u,l,c,_,f,d,p,m={},g=s?new Uint16Array(2*r.length):[],y=0,v=0,S=new(s?Uint32Array:Array)(286),T=new(s?Uint32Array:Array)(30),b=n.w;if(!s){for(u=0;285>=u;)S[u++]=0;for(u=0;29>=u;)T[u++]=0}for(S[256]=1,a=0,h=r.length;a<h;++a){for(u=c=0,l=3;u<l&&a+u!==h;++u)c=c<<8|r[a+u];if(m[c]===e&&(m[c]=[]),_=m[c],!(0<v--)){for(;0<_.length&&32768<a-_[0];)_.shift();if(a+3>=h){for(d&&o(d,-1),u=0,l=h-a;u<l;++u)p=r[a+u],g[y++]=p,++S[p];break}if(0<_.length){var E=e,C=e,w=0,D=e,R=e,I=e,M=r.length,P=(R=0,_.length);t:for(;R<P;R++){if(E=_[P-R-1],D=3,3<w){for(I=w;3<I;I--)if(r[E+I-1]!==r[a+I-1])continue t;D=w}for(;258>D&&a+D<M&&r[E+D]===r[a+D];)++D;if(D>w&&(C=E,w=D),258===D)break}f=new A(w,a-C),d?d.length<f.length?(p=r[a-1],g[y++]=p,++S[p],o(f,0)):o(d,-1):f.length<b?d=f:o(f,0)}else d?o(d,-1):(p=r[a],g[y++]=p,++S[p])}_.push(a)}return g[y++]=256,S[256]++,n.L=S,n.K=T,s?g.subarray(0,y):g}function D(t,e){function i(t){var e=b[t][E[t]];e===y?(i(t+1),i(t+1)):--A[e],++E[t]}var n,r,o,a,h,u=t.length,l=new d(572),c=new(s?Uint8Array:Array)(u);if(!s)for(a=0;a<u;a++)c[a]=0;for(a=0;a<u;++a)0<t[a]&&l.push(a,t[a]);if(n=Array(l.length/2),r=new(s?Uint32Array:Array)(l.length/2),1===n.length)return c[l.pop().index]=1,c;for(a=0,h=l.length/2;a<h;++a)n[a]=l.pop(),r[a]=n[a].value;var _,f,p,m,g,y=r.length,v=new(s?Uint16Array:Array)(e),S=new(s?Uint8Array:Array)(e),A=new(s?Uint8Array:Array)(y),T=Array(e),b=Array(e),E=Array(e),C=(1<<e)-y,x=1<<e-1;for(v[e-1]=y,f=0;f<e;++f)C<x?S[f]=0:(S[f]=1,C-=x),C<<=1,v[e-2-f]=(v[e-1-f]/2|0)+y;for(v[0]=S[0],T[0]=Array(v[0]),b[0]=Array(v[0]),f=1;f<e;++f)v[f]>2*v[f-1]+S[f]&&(v[f]=2*v[f-1]+S[f]),T[f]=Array(v[f]),b[f]=Array(v[f]);for(_=0;_<y;++_)A[_]=e;for(p=0;p<v[e-1];++p)T[e-1][p]=r[p],b[e-1][p]=p;for(_=0;_<e;++_)E[_]=0;for(1===S[e-1]&&(--A[0],++E[e-1]),f=e-2;0<=f;--f){for(m=_=0,g=E[f+1],p=0;p<v[f];p++)(m=T[f+1][g]+T[f+1][g+1])>r[_]?(T[f][p]=m,b[f][p]=y,g+=2):(T[f][p]=r[_],b[f][p]=_,++_);E[f]=0,1===S[f]&&i(f)}for(o=A,a=0,h=n.length;a<h;++a)c[n[a].index]=o[a];return c}function R(e){var i,n,r,o,a=new(s?Uint16Array:Array)(e.length),h=[],u=[],l=0;for(i=0,n=e.length;i<n;i++)h[e[i]]=1+(0|h[e[i]]);for(i=1,n=16;i<=n;i++)u[i]=l,(l+=0|h[i])>1<<i&&t("overcommitted"),l<<=1;for(65536>l&&t("undercommitted"),i=0,n=e.length;i<n;i++)for(l=u[e[i]],u[e[i]]+=1,r=a[i]=0,o=e[i];r<o;r++)a[i]=a[i]<<1|1&l,l>>>=1;return a}function I(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=M.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new m(this.input,n)}var M=v;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=O,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case B:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case O:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}I.prototype.n=function(){var e,i,n,r,a,h,u,l=0;switch(u=this.a,e=lt){case lt:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,u[l++]=n,e){case lt:switch(this.h){case M.NONE:a=0;break;case M.r:a=1;break;case M.j:a=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=a<<6|0,u[l++]=r|31-(256*n+r)%31,h=o(this.input),this.z.b=l,l=(u=this.z.n()).length,s&&((u=new Uint8Array(u.buffer)).length<=l+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,l+4)),u[l++]=h>>24&255,u[l++]=h>>16&255,u[l++]=h>>8&255,u[l++]=255&h,u},r("Zlib.Deflate",I),r("Zlib.Deflate.compress",(function(t,e){return new I(t,e).n()})),r("Zlib.Deflate.CompressionType",M),r("Zlib.Deflate.CompressionType.NONE",M.NONE),r("Zlib.Deflate.CompressionType.FIXED",M.r),r("Zlib.Deflate.CompressionType.DYNAMIC",M.j);var B=0,O=1,L={D:B,C:O};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,o=this.c,a=this.a,h=this.b,u=e,l=e,c=e,_=a.length,f=e;switch(this.e=this.g=0,(u=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),l=u,(u=r[o++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),l|=u<<8,(u=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),c=u,(u=r[o++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),l===~(c|=u<<8)&&t(Error("invalid uncompressed block header: length verify")),o+l>r.length&&t(Error("input buffer is broken")),this.m){case B:for(;h+l>a.length;){if(l-=f=_-h,s)a.set(r.subarray(o,o+f),h),h+=f,o+=f;else for(;f--;)a[h++]=r[o++];this.b=h,a=this.f(),h=this.b}break;case O:for(;h+l>a.length;)a=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)a.set(r.subarray(o,o+l),h),h+=l,o+=l;else for(;l--;)a[h++]=r[o++];this.c=o,this.b=h,this.a=a;break;case 1:this.o(Z,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var N,F,k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=s?new Uint16Array(k):k,G=[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],U=s?new Uint16Array(G):G,z=[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],H=s?new Uint8Array(z):z,W=[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],j=s?new Uint16Array(W):W,X=[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],Y=s?new Uint8Array(X):X,q=new(s?Uint8Array:Array)(288);for(N=0,F=q.length;N<F;++N)q[N]=143>=N?8:255>=N?9:279>=N?7:8;var K,Q,Z=p(q),J=new(s?Uint8Array:Array)(30);for(K=0,Q=J.length;K<Q;++K)J[K]=5;var $=p(J);function tt(i,n){for(var r,s=i.g,o=i.e,a=i.input,h=i.c;o<n;)(r=a[h++])===e&&t(Error("input buffer is broken")),s|=r<<o,o+=8;return r=s&(1<<n)-1,i.g=s>>>n,i.e=o-n,i.c=h,r}function et(i,n){for(var r,s,o,a=i.g,h=i.e,u=i.input,l=i.c,c=n[0],_=n[1];h<_;)(r=u[l++])===e&&t(Error("input buffer is broken")),a|=r<<h,h+=8;return o=(s=c[a&(1<<_)-1])>>>16,i.g=a>>o,i.e=h-o,i.c=l,65535&s}function it(t){function e(t,e,i){var n,r,s,o;for(o=0;o<t;)switch(n=et(this,e),n){case 16:for(s=3+tt(this,2);s--;)i[o++]=r;break;case 17:for(s=3+tt(this,3);s--;)i[o++]=0;r=0;break;case 18:for(s=11+tt(this,7);s--;)i[o++]=0;r=0;break;default:r=i[o++]=n}return i}var i,n,r,o,a=tt(t,5)+257,h=tt(t,5)+1,u=tt(t,4)+4,l=new(s?Uint8Array:Array)(V.length);for(o=0;o<u;++o)l[V[o]]=tt(t,3);i=p(l),n=new(s?Uint8Array:Array)(a),r=new(s?Uint8Array:Array)(h),t.o(p(e.call(t,a,i,n)),p(e.call(t,h,i,r)))}function nt(e,i){var n,r;switch(this.input=e,this.c=0,!i&&(i={})||(i.index&&(this.c=i.index),i.verify&&(this.M=i.verify)),n=e[this.c++],r=e[this.c++],15&n){case lt:this.method=lt;break;default: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.A=new P(e,{index:this.c,bufferSize:i.bufferSize,bufferType:i.bufferType,resize:i.resize})}P.prototype.o=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,o,a,h=i.length-258;256!==(r=et(this,t));)if(256>r)n>=h&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(a=U[s=r-257],0<H[s]&&(a+=tt(this,H[s])),r=et(this,e),o=j[r],0<Y[r]&&(o+=tt(this,Y[r])),n>=h&&(this.b=n,i=this.f(),n=this.b);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,o,a,h=i.length;256!==(r=et(this,t));)if(256>r)n>=h&&(h=(i=this.f()).length),i[n++]=r;else for(a=U[s=r-257],0<H[s]&&(a+=tt(this,H[s])),r=et(this,e),o=j[r],0<Y[r]&&(o+=tt(this,Y[r])),n+a>h&&(h=(i=this.f()).length);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;t<e;++t)i[t]=r[t+32768];if(this.k.push(i),this.q+=i.length,s)r.set(r.subarray(n,n+32768));else for(t=0;32768>t;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,o=this.input,a=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),i=2>r?(n=(o.length-this.c)/this.u[2]/2*258|0)<a.length?a.length+n:a.length<<1:a.length*r,s?(e=new Uint8Array(i)).set(a):e=a,this.a=e},P.prototype.t=function(){var t,e,i,n,r,o=0,a=this.a,h=this.k,u=new(s?Uint8Array:Array)(this.q+(this.b-32768));if(0===h.length)return s?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);for(e=0,i=h.length;e<i;++e)for(n=0,r=(t=h[e]).length;n<r;++n)u[o++]=t[n];for(e=32768,i=this.b;e<i;++e)u[o++]=a[e];return this.k=[],this.buffer=u},P.prototype.H=function(){var t,e=this.b;return s?this.B?(t=new Uint8Array(e)).set(this.a.subarray(0,e)):t=this.a.subarray(0,e):(this.a.length>e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&(i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==o(e)&&t(Error("invalid adler-32 checksum")),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",L),L.ADAPTIVE=L.C,L.BLOCK=L.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);var rt,st,ot=new(s?Uint8Array:Array)(288);for(rt=0,st=ot.length;rt<st;++rt)ot[rt]=143>=rt?8:255>=rt?9:279>=rt?7:8;p(ot);var at,ht,ut=new(s?Uint8Array:Array)(30);for(at=0,ht=ut.length;at<ht;++at)ut[at]=5;p(ut);var lt=8}).call(YM);var qM,KM,QM,ZM,JM,$M=YM.Zlib;function tP(t){switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}}$M.Deflate=$M.Deflate,$M.Deflate.compress=$M.Deflate.compress,$M.Inflate=$M.Inflate,$M.Inflate.BufferType=$M.Inflate.BufferType,$M.Inflate.prototype.decompress=$M.Inflate.prototype.decompress;var eP=new mn,iP=new mn,nP=new Uint8Array,rP=t("aa",Ta("cc.Mesh")((KM=function(t){function e(){var e;return(e=t.call(this)||this).morphRendering=null,e._struct=QM&&QM(),e._hash=ZM&&ZM(),e._data=nP,e._initialized=!1,e._allowDataAccess=JM&&JM(),e._isMeshDataUploaded=!1,e._renderingSubMeshes=null,e._boneSpaceBounds=new Map,e._jointBufferIndices=null,e}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=cP(t)),this.struct.encoded&&(t=lP(t)),!this.struct.quantized||nd.gfxDevice.getFormatFeatures(Ac.RGB16F)&Mc.VERTEX_ATTRIBUTE||(t=function(t){var e=JSON.parse(JSON.stringify(t.struct)),i=new NM;function n(t,e,i,n,r,s,o){for(var a=0;a<i;a++)for(var h=0;h<n;h++)e(o*a+r*h,t(s*a+r*h))}function r(t,e,i,n,r,s){for(var o=0;o<i;o++)for(var a=0;a<n;a++)e(s*o+4*a,hn(t(r*o+2*a)))}i.setNextAlignment(0);for(var s=0;s<e.vertexBundles.length;++s){for(var o=e.vertexBundles[s],a=o.view,h=o.attributes,u=t.struct.vertexBundles[s].attributes,l=[],c=[],_=[],d=0;d<h.length;++d){var p=h[d],m=hP(new DataView(t.data.buffer,a.offset+sP(u,d)),p.format),g=!0;switch(p.format){case Ac.R16F:p.format=Ac.R32F;break;case Ac.RG16F:p.format=Ac.RG32F;break;case Ac.RGB16F:p.format=Ac.RGB32F;break;case Ac.RGBA16F:p.format=Ac.RGBA32F;break;default:g=!1}l.push(ff[p.format].size),c.push(g),_.push(m)}for(var y=l.reduce((function(t,e){return t+e}),0),v=new Uint8Array(y*a.count),S=0;S<h.length;++S){var A=h[S],T=_[S],b=uP(new DataView(v.buffer,sP(h,S)),A.format),E=c[S],C=ff[A.format];E?r(T,b,a.count,C.count,a.stride,y):n(T,b,a.count,C.count,C.size/C.count,a.stride,y)}i.setNextAlignment(y);var x={offset:i.getLength(),length:v.byteLength,count:a.count,stride:y};o.view=x,i.addBuffer(v)}for(var w,D=f(e.primitives);!(w=D()).done;){var R=w.value;if(void 0!==R.indexView){var I=R.indexView,M=new Uint8Array(t.data.buffer,I.offset,I.length);i.setNextAlignment(I.stride);var P={offset:i.getLength(),length:M.byteLength,count:I.count,stride:I.stride};R.indexView=P,i.addBuffer(M)}}var B=new Uint8Array(i.getCombined());return e.quantized=!1,{struct:e,data:B}}(t)),this._struct=t.struct,this._data=t.data,this._struct.dynamic){for(var e=nd.gfxDevice,i=[],n=[],r=0;r<this._struct.vertexBundles.length;r++){var s=this._struct.vertexBundles[r],o=e.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,s.view.length,s.view.stride));i.push(o)}for(var a=0;a<this._struct.primitives.length;a++){var h=this._struct.primitives[a],u=h.indexView,l=null;u&&(l=e.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,u.length,u.stride)));for(var c=[],_=0;_<h.vertexBundelIndices.length;_++){var d=h.vertexBundelIndices[_];c.push(i[d])}for(var p=[],m=0;m<h.vertexBundelIndices.length;m++)for(var g,y=h.vertexBundelIndices[m],v=f(this._struct.vertexBundles[y].attributes);!(g=v()).done;){var S=g.value,A=new U_;A.copy(S),p.push(A)}var T=new jI(c,p,h.primitiveMode,l);T.drawInfo=new x_,T.mesh=this,T.subMeshIdx=a,n.push(T)}this._renderingSubMeshes=n}else{for(var b=this._data.buffer,E=nd.gfxDevice,C=this._createVertexBuffers(E,b),x=[],w=[],D=0;D<this._struct.primitives.length;D++){var R=this._struct.primitives[D];if(0!==R.vertexBundelIndices.length){var I=null,M=void 0;if(R.indexView){var P=R.indexView,B=P.stride,O=P.length;if(4===B&&!E.hasFeature(Sc.ELEMENT_INDEX_UINT)){var L=this._struct.vertexBundles[R.vertexBundelIndices[0]].view.count;if(L>=65536){$(10001,L,65536);continue}B>>=1,O>>=1}I=E.createBuffer(new E_(Ec.INDEX,wc.DEVICE,O,B)),x.push(I),M=new(tP(P.stride))(b,P.offset,P.count),P.stride!==B&&(M=tP(B).from(M)),I.update(M)}var N=R.vertexBundelIndices.map((function(t){return C[t]})),F=[];if(R.vertexBundelIndices.length>0)for(var k=R.vertexBundelIndices[0],V=this._struct.vertexBundles[k].attributes,G=0;G<V.length;++G){var U=V[G];F[G]=new U_(U.name,U.format,U.isNormalized,U.stream,U.isInstanced,U.location)}var z=new jI(N,F,R.primitiveMode,I);z.mesh=this,z.subMeshIdx=D,w.push(z)}}this._renderingSubMeshes=w,this._struct.morph&&(this.morphRendering=function(t,e){return new FM(t,e)}(this,E)),this._isMeshDataUploaded=!0,this._allowDataAccess||this.releaseData()}}},i.updateSubMesh=function(t,e){if(this._struct.dynamic)if(t>=this._struct.primitives.length)$(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,o=this._struct.primitives[t],a=this._renderingSubMeshes[t],h=a.drawInfo,u=0;u<i.length;u++){var l=i[u],c=this._struct.vertexBundles[o.vertexBundelIndices[u]],_=c.view.stride,d=l.byteLength/_,p=l.byteLength,m=new Uint8Array(this._data.buffer,c.view.offset,p),g=new Uint8Array(l.buffer,l.byteOffset,p),y=a.vertexBuffers[u];s.maxSubMeshVertices,p>0&&(m.set(g),y.update(g,p)),c.view.count=d,h.vertexCount=d}if(o.indexView){var v=o.indexView,S=v.stride,A=2===S?e.indices16.length:e.indices32.length,T=A*S,b=new Uint8Array(this._data.buffer,v.offset,T),E=2===S?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,T):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,T),C=a.indexBuffer;s.maxSubMeshIndices,T>0&&(b.set(E),C.update(E,T)),v.count=A,h.indexCount=A}if(e.minPos&&e.maxPos){var x=new mn(e.minPos.x,e.minPos.y,e.minPos.z),w=new mn(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Ko),Ko.fromPoints(r.bounds[t],x,w);for(var D,R=new mn,I=new mn,M=f(r.bounds);!(D=M()).done;){var P=D.value;P&&(P.getBoundary(R,I),mn.min(x,R,x),mn.max(w,I,w))}this._struct.minPosition=new mn(x.x,x.y,x.z),this._struct.maxPosition=new mn(w.x,w.y,w.z)}a.invalidateGeometricInfo()}else $(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 Ko(1/0,1/0,1/0,-1/0,-1/0,-1/0)),i.push(!1);for(var s=this._struct.primitives,o=0;o<s.length;o++){var a=this.readAttribute(o,a_.ATTR_JOINTS),h=this.readAttribute(o,a_.ATTR_WEIGHTS),u=this.readAttribute(o,a_.ATTR_POSITION);if(a&&h&&u)for(var l=Math.min(a.length/4,h.length/4,u.length/3),c=0;c<l;c++){mn.set(eP,u[3*c+0],u[3*c+1],u[3*c+2]);for(var _=0;_<4;++_){var f=4*c+_,d=a[f];if(!(0===h[f]||d>=n.length)){mn.transformMat4(iP,eP,n[d]),i[d]=!0;var p=e[d];mn.min(p.center,p.center,iP),mn.max(p.halfExtents,p.halfExtents,iP)}}}}for(var m=0;m<n.length;m++){var g=e[m];i[m]?Ko.fromPoints(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 mn,r=e&&new In,s=e&&new Ko;if(r&&e.getRotation(r),!this._initialized){var o=JSON.parse(JSON.stringify(t._struct)),a=t._data.slice();if(e){o.maxPosition&&o.minPosition&&(mn.add(s.center,o.maxPosition,o.minPosition),mn.multiplyScalar(s.center,s.center,.5),mn.subtract(s.halfExtents,o.maxPosition,o.minPosition),mn.multiplyScalar(s.halfExtents,s.halfExtents,.5),Ko.transform(s,s,e),mn.add(o.maxPosition,s.center,s.halfExtents),mn.subtract(o.minPosition,s.center,s.halfExtents));for(var h=0;h<o.vertexBundles.length;h++)for(var u=o.vertexBundles[h],l=0;l<u.attributes.length;l++)if(u.attributes[l].name===a_.ATTR_POSITION||u.attributes[l].name===a_.ATTR_NORMAL){var c=u.attributes[l].format,_=new DataView(a.buffer,u.view.offset+sP(u.attributes,l)),d=hP(_,c),p=uP(_,c);if(!d||!p)continue;for(var m=u.view.count,g=u.view.stride,y=aP(c),v=0;v<m;v++){var S=v*g,A=S+y,T=A+y;switch(n.set(d(S),d(A),d(T)),u.attributes[l].name){case a_.ATTR_POSITION:n.transformMat4(e);break;case a_.ATTR_NORMAL:mn.transformQuat(n,n,r)}p(S,n.x),p(A,n.y),p(T,n.z)}}}return this.reset({struct:o,data:a}),this.initialize(),!0}for(var b,E,C,x,w,D=new NM,R=0,I=0,M=0,P=0,B=0,O=0,L=0,N=0,F=!1,k=new Array(this._struct.vertexBundles.length),V=0;V<this._struct.vertexBundles.length;++V){var G=this._struct.vertexBundles[V],U=t._struct.vertexBundles[V];M=G.view.offset,P=U.view.offset,I=G.view.stride,R=G.view.count+U.view.count,b=new ArrayBuffer(R*I),E=new Uint8Array(b),M+=(C=this._data.subarray(M,M+G.view.length)).length,P+=(x=t._data.subarray(P,P+U.view.length)).length,E.set(C),B=0;for(var z,H=f(G.attributes);!(z=H()).done;){var W=z.value;L=0,F=!1;for(var j,X=f(U.attributes);!(j=X()).done;){var Y=j.value;if(W.name===Y.name&&W.format===Y.format){F=!0;break}L+=ff[Y.format].size}if(F){N=ff[W.format].size,O=G.view.length+B;for(var q=0;q<U.view.count;++q){if(w=x.subarray(L,L+N),E.set(w,O),(W.name===a_.ATTR_POSITION||W.name===a_.ATTR_NORMAL)&&e){var K=new Float32Array(E.buffer,O,3);switch(n.set(K[0],K[1],K[2]),W.name){case a_.ATTR_POSITION:n.transformMat4(e);break;case a_.ATTR_NORMAL:mn.transformQuat(n,n,r)}K[0]=n.x,K[1]=n.y,K[2]=n.z}O+=G.view.stride,L+=U.view.stride}}B+=ff[W.format].size}k[V]={attributes:G.attributes,view:{offset:D.getLength(),length:b.byteLength,count:R,stride:I}},D.addBuffer(b)}for(var Q,Z,J,$=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,ot=0,at=f(nt.vertexBundelIndices);!(st=at()).done;){var ht=st.value;ot=Math.max(ot,this._struct.vertexBundles[ht].view.count)}if(nt.indexView&&rt.indexView){$=nt.indexView.count,$+=rt.indexView.count,M=nt.indexView.offset,P=rt.indexView.offset,tt=$<256?1:$<65536?2:4;var ut=new ArrayBuffer($*tt);if(Q=2===tt?new Uint16Array(ut):1===tt?new Uint8Array(ut):new Uint32Array(ut),Z=2===nt.indexView.stride?new Uint16Array(this._data.buffer,M,nt.indexView.count):1===nt.indexView.stride?new Uint8Array(this._data.buffer,M,nt.indexView.count):new Uint32Array(this._data.buffer,M,nt.indexView.count),tt===nt.indexView.stride)Q.set(Z);else for(var lt=0;lt<nt.indexView.count;++lt)Q[lt]=Z[lt];M+=nt.indexView.length,J=2===rt.indexView.stride?new Uint16Array(t._data.buffer,P,rt.indexView.count):1===rt.indexView.stride?new Uint8Array(t._data.buffer,P,rt.indexView.count):new Uint32Array(t._data.buffer,P,rt.indexView.count);for(var ct=0;ct<rt.indexView.count;++ct)Q[nt.indexView.count+ct]=ot+J[ct];P+=rt.indexView.length,et[it].indexView={offset:D.getLength(),length:ut.byteLength,count:$,stride:tt},D.setNextAlignment(tt),D.addBuffer(ut)}}var _t={vertexBundles:k,primitives:et,minPosition:this._struct.minPosition,maxPosition:this._struct.maxPosition};return _t.minPosition&&t._struct.minPosition&&_t.maxPosition&&t._struct.maxPosition&&(e?(mn.add(s.center,t._struct.maxPosition,t._struct.minPosition),mn.multiplyScalar(s.center,s.center,.5),mn.subtract(s.halfExtents,t._struct.maxPosition,t._struct.minPosition),mn.multiplyScalar(s.halfExtents,s.halfExtents,.5),Ko.transform(s,s,e),mn.add(n,s.center,s.halfExtents),mn.max(_t.maxPosition,_t.maxPosition,n),mn.subtract(n,s.center,s.halfExtents),mn.min(_t.minPosition,_t.minPosition,n)):(mn.min(_t.minPosition,_t.minPosition,t._struct.minPosition),mn.max(_t.maxPosition,_t.maxPosition,t._struct.maxPosition))),this.reset({struct:_t,data:new Uint8Array(D.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 o=this._struct.primitives[s],a=t._struct.primitives[s];if(o.vertexBundelIndices.length!==a.vertexBundelIndices.length)return!1;for(var h=0;h<o.vertexBundelIndices.length;++h)if(o.vertexBundelIndices[h]!==a.vertexBundelIndices[h])return!1;if(o.primitiveMode!==a.primitiveMode)return!1;if(o.indexView){if(void 0===a.indexView)return!1}else if(a.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,o=Tf(ff[s]);if(0!==r){var a=new DataView(i._data.buffer,t.view.offset+sP(t.attributes,e)),h=ff[s],u=hP(a,s);if(o&&u){for(var l=h.count,c=new o(r*l),_=t.view.stride,f=0;f<r;++f)for(var d=0;d<l;++d)c[l*f+d]=u(_*f+c.BYTES_PER_ELEMENT*d);n=c}}})),n},i.copyAttribute=function(t,e,i,n,r){var s=this,o=!1;return this._accessAttribute(t,e,(function(t,e){var a=t.view.count;if(0!==a){var h=t.attributes[e].format,u=new DataView(s._data.buffer,t.view.offset+sP(t.attributes,e)),l=new DataView(i,r),c=ff[h],_=hP(u,h),f=uP(l,h);if(_&&f){for(var d=c.count,p=t.view.stride,m=aP(h),g=n,y=m,v=0;v<a;++v)for(var S=0;S<d;++S)f(g*v+y*S,_(p*v+m*S));o=!0}}else o=!0})),o},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?Ac.R8UI:2===i.indexView.stride?Ac.R16UI:Ac.R32UI,s=hP(new DataView(this._data.buffer),r),o=0;o<n;++o)e[o]=s(i.indexView.offset+ff[r].size*o);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=ff[n]})),i},i._accessAttribute=function(t,e,i){if(!(t>=this._struct.primitives.length))for(var n,r=f(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,o=this._struct.vertexBundles[s],a=o.attributes.findIndex((function(t){return t.name===e}));if(!(a<0)){i(o,a);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new E_(Ec.VERTEX,wc.DEVICE,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:nP})},i.releaseData=function(){this._data=nP},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=hc(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}(Fd),QM=fa(KM.prototype,"_struct",[Ma],(function(){return{vertexBundles:[],primitives:[]}})),ZM=fa(KM.prototype,"_hash",[Ma],(function(){return 0})),JM=fa(KM.prototype,"_allowDataAccess",[Ma],(function(){return!0})),qM=KM))||qM);function sP(t,e){for(var i=0,n=0;n<e;++n){var r=t[n];i+=ff[r.format].size}return i}v.Mesh=rP;var oP=Uo.isLittleEndian;function aP(t){var e=ff[t];return e.size/e.count}function hP(t,e){var i=ff[e],n=i.size/i.count;switch(i.type){case Tc.UNORM:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,oP)};case 4:return function(e){return t.getUint32(e,oP)}}break;case Tc.SNORM:case Tc.INT:switch(n){case 1:return function(e){return t.getInt8(e)};case 2:return function(e){return t.getInt16(e,oP)};case 4:return function(e){return t.getInt32(e,oP)}}break;case Tc.UINT:switch(n){case 1:return function(e){return t.getUint8(e)};case 2:return function(e){return t.getUint16(e,oP)};case 4:return function(e){return t.getUint32(e,oP)}}break;case Tc.FLOAT:switch(n){case 2:return function(e){return t.getUint16(e,oP)};case 4:return function(e){return t.getFloat32(e,oP)}}}return null}function uP(t,e){var i=ff[e],n=i.size/i.count;switch(i.type){case Tc.UNORM:switch(n){case 1:return function(e,i){return t.setUint8(e,i)};case 2:return function(e,i){return t.setUint16(e,i,oP)};case 4:return function(e,i){return t.setUint32(e,i,oP)}}break;case Tc.SNORM:case Tc.INT:switch(n){case 1:return function(e,i){return t.setInt8(e,i)};case 2:return function(e,i){return t.setInt16(e,i,oP)};case 4:return function(e,i){return t.setInt32(e,i,oP)}}break;case Tc.UINT:switch(n){case 1:return function(e,i){return t.setUint8(e,i)};case 2:return function(e,i){return t.setUint16(e,i,oP)};case 4:return function(e,i){return t.setUint32(e,i,oP)}}break;case Tc.FLOAT:switch(n){case 2:return function(e,i){return t.setUint16(e,i,oP)};case 4:return function(e,i){return t.setFloat32(e,i,oP)}}}return null}function lP(t){if(!t.struct.encoded)return t;var e=function(t){t<0&&et(14204,t)},i=JSON.parse(JSON.stringify(t.struct)),n=new NM;n.setNextAlignment(0);for(var r,s=f(i.vertexBundles);!(r=s()).done;){var o=r.value,a=o.view,h=a.count*a.stride,u=new Uint8Array(h),l=new Uint8Array(t.data.buffer,a.offset,a.length);e(XM.decodeVertexBuffer(u,a.count,a.stride,l)),n.setNextAlignment(a.stride);var c={offset:n.getLength(),length:u.byteLength,count:a.count,stride:a.stride};o.view=c,n.addBuffer(u)}for(var _,d=f(i.primitives);!(_=d()).done;){var p=_.value;if(void 0!==p.indexView){var m=p.indexView,g=m.count*m.stride,y=new Uint8Array(g),v=new Uint8Array(t.data.buffer,m.offset,m.length);e(XM.decodeIndexBuffer(y,m.count,m.stride,v)),n.setNextAlignment(m.stride);var S={offset:n.getLength(),length:y.byteLength,count:m.count,stride:m.stride};p.indexView=S,n.addBuffer(y)}}return{struct:i,data:new Uint8Array(n.getCombined())}}function cP(t){var e=new $M.Inflate(t.data).decompress();return t.data=e,t.struct.compressed=!1,t}var _P=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_NORMAL,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F),new U_(a_.ATTR_TANGENT,Ac.RGBA32F),new U_(a_.ATTR_COLOR,Ac.RGBA32F)],fP=new mn;function dP(t,e,i){i=i||{};var n,r=[],s=0,o=[],a=0,h=t.positions.slice();if(h.length>0){if(n=null,t.attributes)for(var u,l=f(t.attributes);!(u=l()).done;){var c=u.value;if(c.name===a_.ATTR_POSITION){n=c;break}}n||(n=_P[0]),r.push(n);var _=ff[n.format];a=Math.max(a,Math.floor(h.length/_.count)),o.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var d,p=f(t.attributes);!(d=p()).done;){var m=d.value;if(m.name===a_.ATTR_NORMAL){n=m;break}}n||(n=_P[1]);var g=ff[n.format];r.push(n),a=Math.max(a,Math.floor(t.normals.length/g.count)),o.push({offset:s,data:t.normals,attribute:n}),s+=g.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var y,v=f(t.attributes);!(y=v()).done;){var S=y.value;if(S.name===a_.ATTR_TEX_COORD){n=S;break}}n||(n=_P[2]);var A=ff[n.format];r.push(n),a=Math.max(a,Math.floor(t.uvs.length/A.count)),o.push({offset:s,data:t.uvs,attribute:n}),s+=A.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var T,b=f(t.attributes);!(T=b()).done;){var E=T.value;if(E.name===a_.ATTR_TANGENT){n=E;break}}n||(n=_P[3]);var C=ff[n.format];r.push(n),a=Math.max(a,Math.floor(t.tangents.length/C.count)),o.push({offset:s,data:t.tangents,attribute:n}),s+=C.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var x,w=f(t.attributes);!(x=w()).done;){var D=x.value;if(D.name===a_.ATTR_COLOR){n=D;break}}n||(n=_P[4]);var R=ff[n.format];r.push(n),a=Math.max(a,Math.floor(t.colors.length/R.count)),o.push({offset:s,data:t.colors,attribute:n}),s+=R.size}if(t.customAttributes)for(var I=0;I<t.customAttributes.length;I++){var M=t.customAttributes[I],P=ff[M.attr.format];r.push(M.attr),a=Math.max(a,Math.floor(M.values.length/P.count)),o.push({offset:s,data:M.values,attribute:M.attr}),s+=P.size}for(var B=new NM,O=new ArrayBuffer(a*s),L=new DataView(O),N=0,F=o;N<F.length;N++){var k=F[N];zI(L,k.data,k.attribute.format,k.offset,s)}B.setNextAlignment(0);var V={attributes:r,view:{offset:B.getLength(),length:O.byteLength,count:a,stride:s}};B.addBuffer(O);var G=null,U=0;if(t.indices){var z=t.indices;U=z.length,G=new ArrayBuffer(2*U),zI(new DataView(G),z,Ac.R16UI)}var H={primitiveMode:t.primitiveMode||Yc.TRIANGLE_LIST,vertexBundelIndices:[0]};G&&(B.setNextAlignment(2),H.indexView={offset:B.getLength(),length:G.byteLength,count:U,stride:2},B.addBuffer(G));var W=t.minPos;if(!W&&i.calculateBounds){W=mn.set(new mn,1/0,1/0,1/0);for(var j=0;j<a;++j)mn.set(fP,h[3*j+0],h[3*j+1],h[3*j+2]),mn.min(W,W,fP)}var X=t.maxPos;if(!X&&i.calculateBounds){X=mn.set(new mn,-1/0,-1/0,-1/0);for(var Y=0;Y<a;++Y)mn.set(fP,h[3*Y+0],h[3*Y+1],h[3*Y+2]),mn.max(X,X,fP)}var q={vertexBundles:[V],primitives:[H]};return W&&(q.minPosition=new mn(W.x,W.y,W.z)),X&&(q.maxPosition=new mn(X.x,X.y,X.z)),e||(e=new rP),e.reset({struct:q,data:new Uint8Array(B.getCombined())}),e}function pP(t,e){if(e>0){var i=t%e;if(0!==i)return e-i}return 0}var mP,gP,yP=function(){function t(){}return t.createMesh=function(t,e,i){return dP(t,e,i)},t.createDynamicMesh=function(t,e,i,n){return function(t,e,i,n){n=n||{maxSubMeshes:1,maxSubMeshVertices:1024,maxSubMeshIndices:1024};var r=[],s=0;if(e.positions.length>0&&r.push(new U_(a_.ATTR_POSITION,Ac.RGB32F,!1,s++,!1,0)),e.normals&&e.normals.length>0&&r.push(new U_(a_.ATTR_NORMAL,Ac.RGB32F,!1,s++,!1,0)),e.uvs&&e.uvs.length>0&&r.push(new U_(a_.ATTR_TEX_COORD,Ac.RG32F,!1,s++,!1,0)),e.tangents&&e.tangents.length>0&&r.push(new U_(a_.ATTR_TANGENT,Ac.RGBA32F,!1,s++,!1,0)),e.colors&&e.colors.length>0&&r.push(new U_(a_.ATTR_COLOR,Ac.RGBA32F,!1,s++,!1,0)),e.customAttributes)for(var o=0;o<e.customAttributes.length;o++){var a=e.customAttributes[o],h=new U_;h.copy(a.attr),h.stream=s++,r.push(h)}for(var u=[],l=[],c=0,_=0;_<n.maxSubMeshes;_++){for(var d,p={vertexBundelIndices:[],primitiveMode:e.primitiveMode||Yc.TRIANGLE_LIST},m=f(r);!(d=m()).done;){var g=d.value,y=ff[g.format],v=n.maxSubMeshVertices*y.size,S={view:{offset:c,length:v,count:0,stride:y.size},attributes:[g]},A=u.length;p.vertexBundelIndices.push(A),u.push(S),c+=v}var T=0;if(e.indices16&&e.indices16.length>0?T=2:e.indices32&&e.indices32.length>0&&(T=4),T>0){c+=pP(c,T);var b=n.maxSubMeshIndices*T,E={offset:c,length:b,count:0,stride:T};p.indexView=E,c+=b}l.push(p)}var C={info:{maxSubMeshes:n.maxSubMeshes,maxSubMeshVertices:n.maxSubMeshVertices,maxSubMeshIndices:n.maxSubMeshIndices},bounds:[]};C.bounds.length=n.maxSubMeshes;var x={struct:{vertexBundles:u,primitives:l,dynamic:C},data:new Uint8Array(c)};return i||(i=new rP),i.reset(x),i.initialize(),i.updateSubMesh(t,e),i}(t,e,i,n)},t.decodeMesh=function(t){return lP(t)},t.inflateMesh=function(t){return cP(t)},t}(),vP=Object.freeze({__proto__:null,find:RR,toPPM:function(t,e,i){return"P3 "+e+" "+i+" 255\n"+t.filter((function(t,e){return e%4<3})).toString()+"\n"},readMesh:function(t,e){void 0===e&&(e=0);for(var i,n={positions:[]},r=new DataView(t.data.buffer,t.data.byteOffset,t.data.byteLength),s=t.struct,o=s.primitives[e],a=f(o.vertexBundelIndices);!(i=a()).done;)for(var h,u=i.value,l=s.vertexBundles[u],c=l.view.offset,_=l.view,d=_.length,p=_.stride,m=f(l.attributes);!(h=m()).done;){var g=h.value,y=BM[g.name];y&&(n[y]=(n[y]||[]).concat(HI(r,g.format,c,d,p))),c+=ff[g.format].size}var v=o.indexView;return n.indices=HI(r,Ac["R"+8*v.stride+"UI"],v.offset,v.length),n},createMesh:dP,MeshUtils:yP,readBuffer:HI,writeBuffer:zI,mapBuffer:WI});t("a8",vP);var SP,AP=gn(),TP=Hn();!function(t){t[t.RECT=0]="RECT",t[t.POLYGON=1]="POLYGON"}(SP||(SP={}));var bP,EP,CP,xP=[{u:0,v:0},{u:0,v:0},{u:0,v:0},{u:0,v:0}],wP=t("b",Ta("cc.SpriteFrame")(((gP=function(t){function e(){var e;return(e=t.call(this)||this).vertices=null,e.uv=[],e.unbiasUV=[],e.uvSliced=[],e._rect=Jn(),e._trimmedBorder=cn(),e._offset=Xn(),e._originalSize=Qn(),e._rotated=!1,e._capInsets=[0,0,0,0],e._atlasUuid="",e._texture=void 0,e._isFlipUVY=!1,e._isFlipUVX=!1,e._original=null,e._packable=!0,e._pixelsToUnit=100,e._pivot=Xn(.5,.5),e._meshType=SP.RECT,e._extrude=0,e._customOutLine=[],e._mesh=null,e._minPos=gn(),e._maxPos=gn(),e}s(e,t),e.createWithImage=function(t){var i=t instanceof sp?t:new sp(t),n=new Dm;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=!1;e&&(this._originalSize.set(0,0),this._rect.set(0,0,0,0),this._offset.set(0,0),this._capInsets=[0,0,0,0],this._rotated=!1,i=!0),t&&(t.texture&&(this._rect.x=this._rect.y=0,this._rect.width=t.texture.width,this._rect.height=t.texture.height,this._refreshTexture(t.texture),this.checkRect(this._texture)),t.originalSize&&this._originalSize.set(t.originalSize),t.rect&&this._rect.set(t.rect),t.offset&&this._offset.set(t.offset),void 0!==t.borderTop&&(this._capInsets[1]=t.borderTop),void 0!==t.borderBottom&&(this._capInsets[3]=t.borderBottom),void 0!==t.borderLeft&&(this._capInsets[0]=t.borderLeft),void 0!==t.borderRight&&(this._capInsets[2]=t.borderRight),void 0!==t.isRotate&&(this._rotated=!!t.isRotate),void 0!==t.isFlipUv&&(this._isFlipUVY=!!t.isFlipUv),i=!0),i&&this.texture&&this._calculateUV(),this._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?(et(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(et(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&OM&&OM.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],o=this._capInsets[2],a=t.width-s-o,h=this._capInsets[1],u=this._capInsets[3],l=t.height-h-u,c=this.uvSliced;if(c.length=0,this._rotated){xP[0].u=t.x/n,xP[1].u=(t.x+u)/n,xP[2].u=(t.x+u+l)/n,xP[3].u=(t.x+t.height)/n,xP[3].v=t.y/r,xP[2].v=(t.y+s)/r,xP[1].v=(t.y+s+a)/r,xP[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var f=xP[_],d=0;d<4;++d){var p=xP[3-d];c.push({u:f.u,v:p.v})}}else{xP[0].u=t.x/n,xP[1].u=(t.x+s)/n,xP[2].u=(t.x+s+a)/n,xP[3].u=(t.x+t.width)/n,xP[3].v=t.y/r,xP[2].v=(t.y+h)/r,xP[1].v=(t.y+h+l)/r,xP[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=xP[m],y=0;y<4;++y){var v=xP[y];c.push({u:v.u,v:g.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var o=0===r?0:t.x/r,a=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):this._isFlipUVX?(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u):this._isFlipUVY?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u);var l=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,_=0===s?0:t.y/s,f=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=f,i[2]=c,i[3]=_,i[4]=l,i[5]=f,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=f,i[4]=l,i[5]=_,i[6]=l,i[7]=f):this._isFlipUVY?(i[0]=l,i[1]=f,i[2]=l,i[3]=_,i[4]=c,i[5]=f,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=f,i[4]=c,i[5]=_,i[6]=c,i[7]=f)}else{var d=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=d,e[3]=g,e[4]=p,e[5]=m,e[6]=d,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=d,e[3]=m,e[4]=p,e[5]=g,e[6]=d,e[7]=g):this._isFlipUVY?(e[0]=d,e[1]=g,e[2]=p,e[3]=g,e[4]=d,e[5]=m,e[6]=p,e[7]=m):(e[0]=d,e[1]=m,e[2]=p,e[3]=m,e[4]=d,e[5]=g,e[6]=p,e[7]=g);var y=0===r?0:t.x/r,v=0===r?1:(t.x+t.width)/r,S=0===s?1:(t.y+t.height)/s,A=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=v,i[1]=A,i[2]=y,i[3]=A,i[4]=v,i[5]=S,i[6]=y,i[7]=S):this._isFlipUVX?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,i[4]=v,i[5]=A,i[6]=y,i[7]=A):this._isFlipUVY?(i[0]=y,i[1]=A,i[2]=v,i[3]=A,i[4]=y,i[5]=S,i[6]=v,i[7]=S):(i[0]=y,i[1]=S,i[2]=v,i[3]=S,i[4]=y,i[5]=A,i[6]=v,i[7]=A)}this._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=OM;if(t){var e=this._texture;if(e instanceof Dm&&!e.isCompressed){var i=this.width,n=this.height;if(!e.image||i>t.maxFrameSize||n>t.maxFrameSize)this._packable=!1;else{var r=A.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=t,i=e.rect;i&&(this._rect=new Zn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=Xn(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=Qn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=Xn(s.x,s.y)),this._meshType=e.meshType;var o=e.capInsets;o&&(this._capInsets[0]=o[0],this._capInsets[1]=o[1],this._capInsets[2]=o[2],this._capInsets[3]=o[3]);var a=e.vertices;if(a){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:a.indexes,uv:a.uv,nuv:a.nuv,minPos:gn(a.minPos.x,a.minPos.y,a.minPos.z),maxPos:gn(a.maxPos.x,a.maxPos.y,a.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=a.rawPosition,u=0;u<h.length;u+=3)this.vertices.rawPosition.push(gn(h[u],h[u+1],h[u+2]));this._updateMeshVertices()}},i.clone=function(){var t,i,n,r,s,o=new e,a=this.vertices;return o.vertices=a?{rawPosition:a.rawPosition.slice(0),positions:a.positions.slice(0),indexes:a.indexes.slice(0),uv:a.uv.slice(0),nuv:a.nuv.slice(0),minPos:a.minPos.clone(),maxPos:a.maxPos.clone()}:null,(t=o.uv).splice.apply(t,[0,o.uv.length].concat(this.uv)),(i=o.unbiasUV).splice.apply(i,[0,o.unbiasUV.length].concat(this.unbiasUV)),(n=o.uvSliced).splice.apply(n,[0,o.uvSliced.length].concat(this.uvSliced)),o._rect.set(this._rect),o._trimmedBorder.set(this._trimmedBorder),o._offset.set(this._offset),o._originalSize.set(this._originalSize),o._rotated=this._rotated,(r=o._capInsets).splice.apply(r,[0,o._capInsets.length].concat(this._capInsets)),o._atlasUuid=this._atlasUuid,o._texture=this._texture,o._isFlipUVX=this._isFlipUVX,o._isFlipUVY=this._isFlipUVY,this._original?o._original={_texture:this._original._texture,_x:this._original._x,_y:this._original._y}:o._original=null,o._packable=this._packable,o._pixelsToUnit=this._pixelsToUnit,o._pivot.set(this._pivot),o._meshType=this._meshType,o._extrude=this._extrude,(s=o._customOutLine).splice.apply(s,[0,o._customOutLine.length].concat(this._customOutLine)),o._minPos=this._minPos,o._maxPos=this._maxPos,this._mesh&&o._createMesh(),o},i._refreshTexture=function(t){this._texture=t;var e=this._texture,i={},n=!1;0!==this._rect.width&&0!==this._rect.height&&this.checkRect(e)||(i.rect=Jn(0,0,e.width,e.height),n=!0),(0===this._originalSize.width||0===this._originalSize.height||n)&&(i.originalSize=Qn(e.width,e.height),n=!0),n&&this.reset(i),this._checkPackable(),this._mesh&&this._updateMesh()},i.onLoaded=function(){this._calcTrimmedBorder()},i.initDefault=function(e){t.prototype.initDefault.call(this,e);var i=new Dm;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(){if(this.vertices?(this.vertices.rawPosition.length=0,this.vertices.positions.length=0,this.vertices.indexes.length=0,this.vertices.uv.length=0,this.vertices.nuv.length=0,this.vertices.minPos.set(0,0,0),this.vertices.maxPos.set(0,0,0)):this.vertices={rawPosition:[],positions:[],indexes:[],uv:[],nuv:[],minPos:gn(),maxPos:gn()},this._meshType===SP.POLYGON);else{var t=this.texture,e=t.width,i=t.height,n=this.rect,r=n.width,s=n.height,o=n.x,a=i-n.y-s,h=r/2,u=s/2,l=0===e?0:o/e,c=0===e?1:(o+r)/e,_=0===i?1:(a+s)/i,f=0===i?0:a/i;AP.set(-h,-u,0),this.vertices.rawPosition.push(AP.clone()),this.vertices.uv.push(o),this.vertices.uv.push(a+s),this.vertices.nuv.push(l),this.vertices.nuv.push(f),this.vertices.minPos.set(AP),AP.set(h,-u,0),this.vertices.rawPosition.push(AP.clone()),this.vertices.uv.push(o+r),this.vertices.uv.push(a+s),this.vertices.nuv.push(c),this.vertices.nuv.push(f),AP.set(-h,u,0),this.vertices.rawPosition.push(AP.clone()),this.vertices.uv.push(o),this.vertices.uv.push(a),this.vertices.nuv.push(l),this.vertices.nuv.push(_),AP.set(h,u,0),this.vertices.rawPosition.push(AP.clone()),this.vertices.uv.push(o+r),this.vertices.uv.push(a),this.vertices.nuv.push(c),this.vertices.nuv.push(_),this.vertices.maxPos.set(AP),this.vertices.indexes.push(0),this.vertices.indexes.push(1),this.vertices.indexes.push(2),this.vertices.indexes.push(2),this.vertices.indexes.push(1),this.vertices.indexes.push(3)}this._updateMeshVertices()},i._updateMeshVertices=function(){TP.identity();var t=1/this._pixelsToUnit,e=gn(-(this._pivot.x-.5)*this.rect.width*t,-(this._pivot.y-.5)*this.rect.height*t,0);TP.transform(e),e.set(t,t,1),TP.scale(e);for(var i=this.vertices,n=0;n<i.rawPosition.length;n++){var r=i.rawPosition[n];mn.transformMat4(e,r,TP),mn.toArray(i.positions,e,3*n)}mn.transformMat4(this._minPos,i.minPos,TP),mn.transformMat4(this._maxPos,i.maxPos,TP)},i._createMesh=function(){this._mesh=dP({primitiveMode:Yc.TRIANGLE_LIST,positions:this.vertices.positions,uvs:this.vertices.nuv,indices:this.vertices.indexes,minPos:this._minPos,maxPos:this._maxPos,attributes:[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F)]})},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):$(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}(Fd)).EVENT_UV_UPDATED="uv_updated",gP.MeshType=SP,mP=gP))||mP);v.SpriteFrame=wP;var DP,RP=t("a",Ta("cc.SpriteAtlas")((EP=function(t){function e(){var e;return(e=t.call(this)||this).spriteFrames=CP&&CP(),e}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(){for(var t=[],e=this.spriteFrames,i=0,n=Object.keys(e);i<n.length;i++){var r=n[i];t.push(e[r])}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=Ot();for(var r=0;r<n.length;r+=2)e.result.push(this.spriteFrames,n[r],n[r+1],he(wP))},e}(Fd),CP=fa(EP.prototype,"spriteFrames",[Ma],(function(){return Ot()})),bP=EP))||bP);v.SpriteAtlas=RP;var IP,MP,PP,BP=t("F",Ta("cc.Font")(DP=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Fd))||DP);v.Font=BP;var OP=t("T",Ta("cc.TTFFont")((MP=function(t){function e(){var e;return(e=t.call(this)||this)._fontFamily=PP&&PP(),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:Co(this._native),__isNative__:!0}}}]),e}(BP),PP=fa(MP.prototype,"_fontFamily",[Ma],(function(){return null})),m(MP.prototype,"_nativeAsset",[_h,th],Object.getOwnPropertyDescriptor(MP.prototype,"_nativeAsset"),MP.prototype),m(MP.prototype,"_nativeDep",[_h],Object.getOwnPropertyDescriptor(MP.prototype,"_nativeDep"),MP.prototype),IP=MP))||IP);v.TTFFont=OP;var LP=t("D",.26),NP=t("E",(LP+1)/2-LP);var FP=new ue(2);FP.get=function(){return this._get()||{key:"",value:0,prev:null,next:null}};var kP=new(t("K",function(){function t(t){this.count=0,this.limit=0,this.datas={},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=FP.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,FP.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}()))(100),VP=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,GP=/^[!,.:;'}\]%\?>、‘“》?。,!]/,UP=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,zP=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,HP=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function WP(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 jP(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 XP(t,e,i){var n=(i||t.font)+"🎮"+e,r=kP.get(n);if(null!==r)return r;var s=t.measureText(e),o=s&&s.width||0;return kP.put(n,o),o}function YP(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 qP(t,e){for(var i=t.length,n=0,r=0,s=0,o=0,a=0;a<i;a++)if(8205!==(o=t.charCodeAt(a)))if(o>=55296&&o<=56319&&(n++,(o=t.charCodeAt(a+1))>=56320&&o<=57343)){if(n++,a+2>=i||8205!==t.charCodeAt(a+2)){if(e===r)return t.slice(s,s+n);s+=n,r++,n=0}a++}else{if(e===r)return t.charAt(a);s=a+1,r++,n=0}else n++;return""}function KP(t,e){var i=qP(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 QP(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 ZP(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 JP(t,e,i){var n=QP(t,e);n<e&&(n=ZP(t,e)+1);var r=i;if(void 0!==i){r=ZP(t,i=Math.max(0,i-1));var s=QP(t,i);s<n||s===n&&e>n?r=n:r+=1}return t.substring(n,r)}function $P(t){return HP.exec(t)}function tB(t){return zP.exec(t)}function eB(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 o=s.length*(i/e)|0,a=JP(s,o),h=e-n(a),u=a,l=0,c=0;h>i&&c++<100;)o*=i/h,h=e-n(a=JP(s,o|=0));for(c=0;a&&h<=i&&c++<100;){var _=VP.exec(a);u=a,h=e-n(a=JP(s,o+=l=_?_[0].length:1))}0==(o-=l)?(o=1,u=JP(s,1)):1===o&&s[0]>="\ud800"&&s[0]<="\udbff"&&(o=2,u=JP(s,2));var f=JP(s,0,o),d=void 0;GP.test(u||a)&&(0==(o-=(d=UP.exec(f))?d[0].length:0)&&(o=1),u=JP(s,o),f=JP(s,0,o)),HP.test(u)&&(d=zP.exec(f))&&f!==d[0]&&(u=JP(s,o-=d[0].length),f=JP(s,0,o)),(0===r.length||(f=f.trim()).length>0)&&r.push(f),e=n(s=u||a)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var iB,nB=A.document,rB=null,sB=-1,oB="BES bswy:->@123丁ぁᄁ",aB=Object.create(null),hB=[],uB=3e3;function lB(){for(var t=!0,e=Date.now(),i=hB.length-1;i>=0;i--){var n=hB[i],r=n.fontFamilyName;if(e-n.startTime>uB)$(4933,r),n.onComplete(null,r),hB.splice(i,1);else{var s=n.refWidth,o="40px "+r;rB.font=o,s!==XP(rB,oB,o)?(hB.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(sB),sB=-1)}function cB(t,e,i){var n=function(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}(t);if(aB[n])i(null,n);else{if(!rB){var r=nB.createElement("canvas");r.width=100,r.height=100,rB=r.getContext("2d")}var s="40px "+n,o=nB.createElement("style");o.type="text/css";var a="";Number.isNaN(n)?a+="@font-face { font-family:"+n+"; src:":a+='@font-face { font-family:"'+n+'"; src:',a+='url("'+t+'");',o.textContent=a+"}",nB.body.appendChild(o);var h=nB.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",nB.body.appendChild(h),function(){if(void 0===iB)if("FontFace"in A){var t=/Gecko.*Firefox\/(\d+)/.exec(A.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(A.navigator.userAgent)&&/Apple/.exec(A.navigator.vendor);iB=t?parseInt(t[1],10)>42:!e}else iB=!1;return iB}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=uB?n():nB.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,uB)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){$(4933,e),i(null,e)}))}(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:XP(rB,oB,s),onComplete:i,startTime:Date.now()};hB.push(l),-1===sB&&(sB=setInterval(lB,100))}aB[n]=o}}function _B(t,e,i,n){var r=new OP;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}oA.register({".font":cB,".eot":cB,".ttf":cB,".woff":cB,".svg":cB,".ttc":cB}),yA.register({".font":_B,".eot":_B,".ttf":_B,".woff":_B,".svg":_B,".ttc":_B});var fB,dB,pB,mB,gB,yB,vB,SB,AB,TB=/^(click)(\s)*=|(param)(\s)*=/,bB=/(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/,EB=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),o=t.substring(r+1,n);""===o&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(o),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 o="",a=-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=bB.exec(t);for(var u=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),o=t.substring(l).trim(),a="src"===n?this.getRightQuotationIndex(o):-1,h=(r=o.indexOf(" ",a+1>=o.length?-1:a+1))>-1?o.substr(0,r):o,t=o.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=bB.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("outline".length).trim()){var _,f=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=f.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(o=t.substring(n.length).trim()).indexOf(" "))>-1?o.substr(0,r):o,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=o.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=f.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=TB.exec(t);r;){var s=r[0],o="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(o=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(o=t.substring(1,i).trim(),n=!0),i++;else{var a=/(\S)+/.exec(t);i=(o=a?a[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=o),t=t.substring(i).trim(),r=TB.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=f(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),CB=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},xB=function(){function t(t){this.letterDefinitions={},this.texture=t}var e=t.prototype;return e.addLetterDefinitions=function(t,e){this.letterDefinitions[t]=e},e.cloneLetterDefinition=function(){for(var t={},e=0,i=Object.keys(this.letterDefinitions);e<i.length;e++){var n=i[e],r=new CB;jt(r,this.letterDefinitions[n]),t[n]=r}return t},e.getTexture=function(){return this.texture},e.getLetter=function(t){return this.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t){var e=KP(t,0),i=null;return Object.prototype.hasOwnProperty.call(this.letterDefinitions,e)&&(i=this.letterDefinitions[e]),i},e.clear=function(){this.letterDefinitions={}},t}(),wB=t("B",(fB=Ta("cc.BitmapFont"),dB=eh(wP),fB((mB=function(t){function e(){var e;return(e=t.call(this)||this).fntDataStr=gB&&gB(),e.spriteFrame=yB&&yB(),e.fontSize=vB&&vB(),e.fntConfig=SB&&SB(),e}return s(e,t),e.prototype.onLoaded=function(){var t=this.spriteFrame;!this.fontDefDictionary&&t&&(this.fontDefDictionary=new xB(t.texture));var e=this.fntConfig;if(e){var i=e.fontDefDictionary;for(var n in i){var r=i[n],s=new CB,o=r.rect;s.offsetX=r.xOffset,s.offsetY=r.yOffset,s.w=o.width,s.h=o.height,s.u=o.x,s.v=o.y,s.valid=!0,s.xAdvance=r.xAdvance,this.fontDefDictionary.addLetterDefinitions(n,s)}}else $(16376)},e}(BP),gB=fa(mB.prototype,"fntDataStr",[Ma],(function(){return""})),yB=fa(mB.prototype,"spriteFrame",[dB],(function(){return null})),vB=fa(mB.prototype,"fontSize",[Ma],(function(){return-1})),SB=fa(mB.prototype,"fntConfig",[Ma],(function(){return null})),pB=mB))||pB));v.BitmapFont=wB;var DB,RB=t("L",Ta("cc.LabelAtlas")(AB=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(wB))||AB);v.LabelAtlas=RB;var IB,MB=function(){function t(){this.pool=[]}t.getInstance=function(){return DB||(DB=new t),DB};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=A.document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Pe.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}(),PB=bn.WHITE.clone(),BB="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",OB=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=""+KP(t,0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,MB.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=MB.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=XP(this.context,this.char,this.labelInfo.fontDesc),i=2*this.labelInfo.margin+2;this.width=parseFloat(e.toFixed(2))*t+i,this.height=(1+LP)*this.labelInfo.fontSize*t+i,this.offsetY=-this.labelInfo.fontSize*LP*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 sp),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=BB,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,o=i/2,a=n/2+s*NP+0*s,h=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+h.r+", "+h.g+", "+h.b+", 1)",e.isOutlined){var u=e.out||PB;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin*r,t.strokeText(this.char,o,a)}t.fillText(this.char,o,a)}},t}(),LB=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=kd.RGBA8888),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 y_;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 $(16363)}},e}(Dm),NB=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 LB;i.initWithSize(t,e),this.fontDefDictionary=new xB(i),this._halfBleed=1,this._width=t,this._height=e,FI.on(LI.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=FI.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 $(12100),null;if(!this.fontDefDictionary.texture)return null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new CB;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.destroy(),t.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new LB;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=KP(t,0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new OB(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}(),FB={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:bn.WHITE.clone(),isOutlined:!1,out:bn.WHITE.clone(),margin:0,fontScale:1},kB=[new U_(a_.ATTR_POSITION,Ac.RGB32F)],VB=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA32F)],GB=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F),new U_(a_.ATTR_COLOR,Ac.RGBA32F)],UB=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0)],zB=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F),new U_(a_.ATTR_COLOR,Ac.RGBA32F),new U_(a_.ATTR_COLOR2,Ac.RGBA32F)],HB=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0),new U_(a_.ATTR_COLOR2,Ac.RGBA8,!0)];function WB(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=ff[n.format].count}return e}function jB(t){for(var e=0,i=0;i<t.length;i++){var n=t[i];e+=ff[n.format].size}return e}v.internal.vfmtPosUvColor=GB,v.internal.vfmtPosUvTwoColor=zB,v.internal.vfmtPosUvColor4B=UB,v.internal.vfmtPosUvTwoColor4B=HB,t("w",Object.freeze({__proto__:null,vfmt:kB,vfmtPosColor:VB,vfmtPosUvColor:GB,vfmtPosUvColor4B:UB,vfmtPosUvTwoColor:zB,vfmtPosUvTwoColor4B:HB,getComponentPerVertex:WB,getAttributeStride:jB})),function(t){t[t.byteOffset=0]="byteOffset",t[t.vertexOffset=1]="vertexOffset",t[t.indexOffset=2]="indexOffset",t[t.dirty=3]="dirty",t[t.count=4]="count"}(IB||(IB={}));var XB,YB,qB,KB,QB=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=jB(e)>>2,this._initVDataCount,this._floatsPerVertex,st(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];e.vertexBuffers[0]&&e.vertexBuffers[0].destroy(),e.indexBuffer&&e.indexBuffer.destroy(),e.ia.destroy()}this._iaPool.length=0},t.setDirty=function(){this.dirty=!0},t.request=function(){return $(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=Uo.__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,o=this.indexOffset,a=0;a<e;++a){var h=this._iaPool[a],u=new Float32Array(this.vData.buffer,0,s>>2),l=new Uint16Array(this.iData.buffer,0,o),c=h.vertexBuffers[0];s>c.size&&c.resize(s),c.update(u),2*o>h.indexBuffer.size&&h.indexBuffer.resize(2*o),h.indexBuffer.update(l)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Uo.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,o=t.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,r,r));n=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,s,s)),i=[o],this._iaInfo=new H_(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}()),ZB=function(){function t(t,e){this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=jB(e)>>2,this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT}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}(),JB=new qs((function(){return{offset:0,length:0}}),32),$B=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}(),tO=function(t){function e(i,n,r,s){var o;return(o=t.call(this,i,n)||this)._freeLists=[],o._vCount=0,o._iCount=0,o._id=0,o._vCount=r||Math.floor(1024*Pe.BATCHER2D_MEM_INCREMENT/o._vertexFormatBytes),o._iCount=s||o._vCount*e.IB_SCALE,o._id=e.generateID(),o._allocateBuffer(),o}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)JB.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 et(9004,i),null;for(var n,r=null,s=0,o=-1,a=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){a=n[u],s=h,o=u;break}if(a)break}if(a||(s=this._allocateBuffer(),(r=this._buffers[s])&&(o=0,a=this._freeLists[s][o])),a){var l=a.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,a.offset,i>>2).fill(0);return this._allocateChunkFromEntry(s,o,a,i),new $B(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,o=0,a=null,h=e[o];h&&h.offset<n;)a=h,h=e[++o];if(a&&0==n-(a.offset+a.length)&&(a.length+=r,n=a.offset,r=a.length,h&&h.offset-(n+r)==0&&(a.length+=h.length,e.splice(o,1),JB.free(h),h=null),s=!0),!s&&h){if(0==h.offset-(n+r))h.offset=n,h.length+=r;else{var u=JB.alloc();u.offset=n,u.length=r,e.splice(o,0,u)}s=!0}if(s)n+r===i.byteOffset&&(i.byteOffset=n);else{var l=JB.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,o=this._buffers[t];o.byteOffset<s&&(o.byteOffset=s),rt(r>=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),JB.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){rt(this._buffers.length===this._freeLists.length,9003);var t=new QB,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=JB.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),FI.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}(ZB);tO.IB_SCALE=4,tO.ID_COUNT=0,function(t){t[t.DrawInfoType=0]="DrawInfoType",t[t.VertDirty=1]="VertDirty",t[t.IsMeshBuffer=2]="IsMeshBuffer",t[t.Stride=3]="Stride",t[t.Count=4]="Count"}(XB||(XB={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(YB||(YB={})),function(t){t[t.VertexOffset=0]="VertexOffset",t[t.IndexOffset=1]="IndexOffset",t[t.VBCount=2]="VBCount",t[t.IBCount=3]="IBCount",t[t.DataHash=4]="DataHash",t[t.Count=5]="Count"}(qB||(qB={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(KB||(KB={}));var eO,iO,nO=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=KB.COMP,this._subNode=null,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,XB.Count),i+=XB.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,YB.Count),i+=YB.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,qB.Count)}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.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}();!function(t){t[t.DISABLED=0]="DISABLED",t[t.CLEAR=1]="CLEAR",t[t.ENTER_LEVEL=2]="ENTER_LEVEL",t[t.ENABLED=3]="ENABLED",t[t.EXIT_LEVEL=4]="EXIT_LEVEL",t[t.CLEAR_INVERTED=5]="CLEAR_INVERTED",t[t.ENTER_LEVEL_INVERTED=6]="ENTER_LEVEL_INVERTED"}(eO||(eO={})),function(t){t[t.stencilTest=0]="stencilTest",t[t.func=1]="func",t[t.stencilMask=2]="stencilMask",t[t.writeMask=3]="writeMask",t[t.failOp=4]="failOp",t[t.zFailOp=5]="zFailOp",t[t.passOp=6]="passOp",t[t.ref=7]="ref",t[t.count=8]="count"}(iO||(iO={}));var rO,sO,oO,aO,hO,uO=t("S",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Nc.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Fc.KEEP,zFailOp:Fc.KEEP,passOp:Fc.KEEP,ref:1},this._stage=eO.DISABLED,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 t.stencilStage!==eO.ENTER_LEVEL?eO.CLEAR_INVERTED:eO.CLEAR},e.enableMask=function(){this.stage=eO.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=eO.DISABLED:this.stage=eO.ENABLED)},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=eO.DISABLED},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=Nc.LESS,o=this.stencilStateMap;if(e&&e.passes[0]){var a=e.passes[0].depthStencilState,h=0,u=0;a.depthTest&&(h=1),a.depthWrite&&(u=1),i=h|u<<1|a.depthFunc<<2|t<<6|this._maskStack.length<<9,n=a.depthTest,r=a.depthWrite,s=a.depthFunc,o=this.stencilStateMapWithDepth}else i=t<<16|this._maskStack.length;if(o&&o.has(i))return o.get(i);this.setStateFromStage(t);var l=new Ff(n,r,s,this._stencilPattern.stencilTest,this._stencilPattern.func,this._stencilPattern.stencilMask,this._stencilPattern.writeMask,this._stencilPattern.failOp,this._stencilPattern.zFailOp,this._stencilPattern.passOp,this._stencilPattern.ref,this._stencilPattern.stencilTest,this._stencilPattern.func,this._stencilPattern.stencilMask,this._stencilPattern.writeMask,this._stencilPattern.failOp,this._stencilPattern.zFailOp,this._stencilPattern.passOp,this._stencilPattern.ref);return o.set(i,l),l},e.getStencilHash=function(t){return t<<8|this._maskStack.length},e.setStateFromStage=function(t){var e=this._stencilPattern;t===eO.DISABLED?(e.stencilTest=!1,e.func=Nc.ALWAYS,e.failOp=Fc.KEEP,e.stencilMask=e.writeMask=65535,e.ref=1):(e.stencilTest=!0,t===eO.ENABLED?(e.func=Nc.EQUAL,e.failOp=Fc.KEEP,e.stencilMask=e.ref=this.getStencilRef(),e.writeMask=this.getWriteMask()):t===eO.CLEAR?(e.func=Nc.NEVER,e.failOp=Fc.ZERO,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===eO.CLEAR_INVERTED||t===eO.ENTER_LEVEL?(e.func=Nc.NEVER,e.failOp=Fc.REPLACE,e.writeMask=e.stencilMask=e.ref=this.getWriteMask()):t===eO.ENTER_LEVEL_INVERTED&&(e.func=Nc.NEVER,e.failOp=Fc.ZERO,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}());uO.sharedManager=null,uO.sharedManager=new uO,function(t){t[t.STATIC=0]="STATIC",t[t.DYNAMIC=1]="DYNAMIC",t[t.CROSSED=2]="CROSSED"}(rO||(rO={})),function(t){t[t.localOpacity=0]="localOpacity",t[t.count=1]="count"}(sO||(sO={})),function(t){t[t.colorR=0]="colorR",t[t.colorG=1]="colorG",t[t.colorB=2]="colorB",t[t.colorA=3]="colorA",t[t.maskMode=4]="maskMode",t[t.count=5]="count"}(oO||(oO={})),function(t){t[t.colorDirty=0]="colorDirty",t[t.enabled=1]="enabled",t[t.useLocal=2]="useLocal",t[t.count=3]="count"}(aO||(aO={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.MASK_INVERTED=2]="MASK_INVERTED",t[t.MASK_NODE=3]="MASK_NODE",t[t.MASK_NODE_INVERTED=4]="MASK_NODE_INVERTED"}(hO||(hO={}));var lO,cO,_O,fO,dO,pO,mO,gO,yO,vO,SO,AO=function(){function t(){this._renderEntityType=rO.STATIC,this._dynamicDrawInfoArr=[],this._node=null,this._renderTransform=null,this._stencilStage=eO.DISABLED,this._useLocal=!1,this._maskMode=hO.NONE,this._color=bn.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}(),TO=jB(GB)>>2,bO=t("t",function(){function t(t){void 0===t&&(t=GB),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=GB,this._drawInfoType=KB.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===GB?TO:jB(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(t,e){void 0===e&&(e=KB.COMP)},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,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=FI.root.batcher2D),this._batcher}}]),t}()),EO=t("u",function(t){function e(e,i){var n;return void 0===e&&(e=GB),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=GB),void 0===i&&(i=null);var n=new e(t,i);return i||(i=FI.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=hc(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._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),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._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},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=FI.root.device;return new tO(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:bn.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,this._renderDrawInfo&&t&&this._renderDrawInfo.setVertDirty(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,this._renderDrawInfo&&(this._frame?(this._renderDrawInfo.setTexture(this._frame.getGFXTexture()),this._renderDrawInfo.setSampler(this._frame.getGFXSampler())):(this._renderDrawInfo.setTexture(null),this._renderDrawInfo.setSampler(null)))}},{key:"accessor",get:function(){return this._accessor}}]),e}(bO)),CO=t("v",function(t){function e(e){var i;return void 0===e&&(e=GB),(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=GB);var i=new e;return i._floatStride=t===GB?TO:jB(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,o=this.vData.length,a=this.iData.length;if(i>r||n>s){for(;r<i||s<n;)r=4*(o*=2),s=a*=2;this._reallocBuffer(o,a)}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 E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,r,r))),this._iaInfo=new H_(this._vertexFormat,n,this._indexBuffer),this._iaPool=new Ks((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}(bO)),xO=new jn,wO=new jn,DO=new mn,RO=new Vn,IO=new Vn,MO=new Vn,PO=new Vn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),BO=new Zn,OO=t("e",Ta("cc.UITransform")(lO=Ea(110)(lO=Ca(((dO=function(t){function e(){var e;return(e=t.call(this)||this)._priority=0,e._contentSize=_O&&_O(),e._anchorPoint=fO&&fO(),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(Nm.PARENT_CHANGED,this._parentChanged,this),this._markRenderDataDirty()},i.onDisable=function(){this.node.off(Nm.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(Li((t=t).width,r.width,Bi)&&Li(t.height,r.height,Bi))return;i=t.width,n=t.height}else{if(Li(t=t,r.width,Bi)&&Li(e,r.height,Bi))return;i=t,n=e}r.width=i,r.height=n,this.node.emit(Nm.SIZE_CHANGED),this._markRenderDataDirty()},i.setAnchorPoint=function(t,e){var i=this._anchorPoint;if(void 0===e){if((t=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(Nm.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty()},i.isHit=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=xO,r=wO,s=this._getRenderScene().cameras,o=0;o<s.length;o++){var a=s[o];if(a.visibility&this.node.layer){a.node.getWorldRT(RO);var h=RO.m12,u=RO.m13,l=zo.center;if(RO.m12=l.x-(RO.m00*h+RO.m04*u),RO.m13=l.y-(RO.m01*h+RO.m05*u),Vn.invert(RO,RO),jn.transformMat4(n,t,RO),this.node.getWorldMatrix(MO),Vn.invert(RO,MO),!Vn.strictEquals(RO,PO)){jn.transformMat4(r,n,RO),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=DO,s=xO,o=wO,a=this._getRenderScene().cameras,h=0;h<a.length;h++){var u=a[h];if(u.visibility&this.node.layer&&(!u.window||u.window.swapchain)&&u.systemWindowId===e&&(mn.set(r,t.x,t.y,0),u.screenToWorld(r,r),jn.set(s,r.x,r.y),this.node.getWorldMatrix(MO),Vn.invert(RO,MO),!Vn.strictEquals(RO,PO))){jn.transformMat4(o,s,RO),o.x+=this._anchorPoint.x*i,o.y+=this._anchorPoint.y*n;var l=!1;if(o.x>=0&&o.y>=0&&o.x<=i&&o.y<=n&&(l=this._maskTest(s)),l)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,o=0,a=0;r&&a<s;++o,r=r.parent){var h=n[a];if(o===h.index){if(r!==h.comp.node){n.length=a;break}var u=h.comp;if(u&&u._enabled&&!u.isHit(t))return!1;a++}else if(o>h.index){n.length=a;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(MO),Vn.invert(RO,MO),e||(e=new mn),mn.transformMat4(e,t,RO)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(MO),e||(e=new mn),mn.transformMat4(e,t,MO)},i.getBoundingBox=function(){var t=new Zn;return this._selfBoundingBox(t),Vn.fromSRT(IO,this.node.rotation,this.node.position,this.node.scale),t.transformMat4(IO),t},i.getBoundingBoxToWorld=function(){for(var t=new Zn,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(BO),BO.transformMat4(r.worldMatrix),0===t.width?t.set(BO):Zn.union(t,t,BO))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(BO),BO.transformMat4(this.node.worldMatrix),0===t.width?t.set(BO):Zn.union(t,t,BO)),t},i.getBoundingBoxTo=function(t){var i=new Zn,n=this.node.children;Vn.invert(RO,t);for(var r=0;r<n.length;++r){var s=n[r];if(s&&s.active){var o=s.getComponent(e);o&&o.contentSize.width&&o.contentSize.height&&(o._selfBoundingBox(BO),Vn.multiply(IO,s.worldMatrix,RO),BO.transformMat4(IO),0===i.width?i.set(BO):Zn.union(i,i,BO))}}return this._contentSize.width&&this._contentSize.height&&(this._selfBoundingBox(BO),Vn.multiply(IO,this.node.worldMatrix,RO),BO.transformMat4(IO),0===i.width?i.set(BO):Zn.union(i,i,BO)),i},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;BO.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),BO.transformMat4(this.node.worldMatrix);var n=BO.x+.5*BO.width,r=BO.y+.5*BO.height,s=this.node.worldPosition.z,o=BO.width/2,a=BO.height/2;return null!=t?(Ko.set(t,n,r,s,o,a,.001),t):new Ko(n,r,s,o,a,.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._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp,r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.getSiblingIndex()-e.getSiblingIndex():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(Nm.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(Nm.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(Nm.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(Nm.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(Nm.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(Nm.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?$(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=FI.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=FI.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(Lp)).EventType=Nm,dO.priorityChangeNodeMap=new Map,_O=fa((cO=dO).prototype,"_contentSize",[Ma],(function(){return new Kn(100,100)})),fO=fa(cO.prototype,"_anchorPoint",[Ma],(function(){return new jn(.5,.5)})),lO=cO))||lO)||lO)||lO);FI.on(LI.EVENT_AFTER_UPDATE,OO._sortSiblings),FI.on(LI.EVENT_BEFORE_SCENE_LAUNCH,OO._cleanChangeMap);var LO,NO,FO,kO,VO,GO,UO,zO,HO,WO,jO,XO,YO,qO={parent:null,owner:null,subModelIdx:0},KO=Ca,QO=eh,ZO=t("dN",(pO=Ta("cc.Renderer"),mO=QO(oT),gO=QO([oT]),pO(yO=KO((m((vO=function(t){function e(){var e;return(e=t.call(this)||this)._materials=SO&&SO(),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){t&&t instanceof pT&&et(12012),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]){qO.parent=this._materials[t],qO.owner=this,qO.subModelIdx=t;var e=new pT(qO);qO.parent=null,qO.owner=null,qO.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){$(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}(Lp)).prototype,"sharedMaterials",[mO],Object.getOwnPropertyDescriptor(vO.prototype,"sharedMaterials"),vO.prototype),SO=fa(vO.prototype,"_materials",[gO],(function(){return[]})),yO=vO))||yO)||yO));xe(kc),xe(Vc),xe(Gc),t("I",YO),function(t){t[t.ADD_COLOR=0]="ADD_COLOR",t[t.ADD_COLOR_AND_TEXTURE=1]="ADD_COLOR_AND_TEXTURE",t[t.GRAYSCALE=2]="GRAYSCALE",t[t.USE_ALPHA_SEPARATED=3]="USE_ALPHA_SEPARATED",t[t.USE_ALPHA_SEPARATED_AND_GRAY=4]="USE_ALPHA_SEPARATED_AND_GRAY"}(YO||t("I",YO={}));var JO=t("d",(LO=Ta("cc.UIRenderer"),NO=ba(OO),FO=eh(oT),kO=eh(oT),LO(VO=NO(((XO=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,e._materials=UO&&UO(),e._customMaterial=zO&&zO(),e._srcBlendFactor=HO&&HO(),e._dstBlendFactor=WO&&WO(),e._color=jO&&jO(),e._stencilStage=eO.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._instanceMaterialType=-1,e._srcBlendFactorCache=kc.SRC_ALPHA,e._dstBlendFactorCache=kc.ONE_MINUS_SRC_ALPHA,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(Nm.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(Nm.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(Nm.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),CI.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(Nm.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(Nm.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(Nm.PARENT_CHANGED,this._colorDirty,this),CI.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){if(void 0===t&&(t=!0),t){var e=this._renderData;e&&(e.vertDirty=!0),CI.markDirtyRenderer(this)}},i.requestRenderData=function(t){void 0===t&&(t=KB.COMP);var e=EO.add();return e.initRenderDrawInfo(this,t),this._renderData=e,e},i.destroyRenderData=function(){this._renderData&&(this._renderData.removeRenderDrawInfo(this),EO.remove(this._renderData),this._renderData=null)},i.updateRenderer=function(){this._assembler&&this._assembler.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),this.stencilStage!==eO.ENTER_LEVEL&&this.stencilStage!==eO.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){if(this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler){this._assembler.updateColor(this);var t=this._renderFlag;if(this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag),t!==this._renderFlag){var e=this.renderData;e&&(e.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=kc.ONE_MINUS_SRC_ALPHA,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 YO.ADD_COLOR:t=UA.get("ui-base-material");break;case YO.GRAYSCALE:t=UA.get("ui-sprite-gray-material");break;case YO.USE_ALPHA_SEPARATED:t=UA.get("ui-sprite-alpha-sep-material");break;case YO.USE_ALPHA_SEPARATED_AND_GRAY:t=UA.get("ui-sprite-gray-alpha-sep-material");break;default:t=UA.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 AO(rO.STATIC)},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 FI.root.batcher2D}},{key:"renderEntity",get:function(){return this._renderEntity}}]),e}(ZO)).BlendState=kc,XO.Assembler=null,XO.PostAssembler=null,m((GO=XO).prototype,"sharedMaterials",[_h],Object.getOwnPropertyDescriptor(GO.prototype,"sharedMaterials"),GO.prototype),m(GO.prototype,"customMaterial",[FO],Object.getOwnPropertyDescriptor(GO.prototype,"customMaterial"),GO.prototype),UO=fa(GO.prototype,"_materials",[_h],(function(){return[]})),zO=fa(GO.prototype,"_customMaterial",[kO],(function(){return null})),HO=fa(GO.prototype,"_srcBlendFactor",[Ma],(function(){return kc.SRC_ALPHA})),WO=fa(GO.prototype,"_dstBlendFactor",[Ma],(function(){return kc.ONE_MINUS_SRC_ALPHA})),jO=fa(GO.prototype,"_color",[Ma],(function(){return bn.WHITE.clone()})),VO=GO))||VO)||VO));v.internal.UIRenderer=JO;var $O,tL,eL,iL,nL,rL,sL,oL,aL,hL,uL,lL,cL,_L,fL,dL,pL,mL,gL,yL,vL,SL,AL,TL,bL,EL,CL,xL,wL,DL,RL,IL,ML,PL,BL,OL,LL,NL,FL=function(){function t(){this.isBold=!1,this.isItalic=!1,this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineColor=bn.WHITE.clone(),this.outlineWidth=1,this.hasShadow=!1,this.shadowColor=bn.BLACK.clone(),this.shadowBlur=2,this.shadowOffsetX=0,this.shadowOffsetY=0,this.color=bn.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}(),kL=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 Kn,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}(),VL=function(){function t(){this.parsedString=[],this.nodeContentSize=Kn.ZERO.clone(),this.canvasSize=new Kn,this.canvasPadding=new Zn,this.contentSizeExtend=Kn.ZERO.clone(),this.startPosition=jn.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}(),GL=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}();bn.WHITE.clone(),t("H",BL),function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT"}(BL||t("H",BL={})),xe(BL),t("V",OL),function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM"}(OL||t("V",OL={})),xe(OL),t("O",LL),function(t){t[t.NONE=0]="NONE",t[t.CLAMP=1]="CLAMP",t[t.SHRINK=2]="SHRINK",t[t.RESIZE_HEIGHT=3]="RESIZE_HEIGHT"}(LL||t("O",LL={})),xe(LL),t("q",NL),function(t){t[t.NONE=0]="NONE",t[t.BITMAP=1]="BITMAP",t[t.CHAR=2]="CHAR"}(NL||t("q",NL={})),xe(NL);var UL=t("r",($O=Ta("cc.Label"),tL=Ea(110),eL=eh(BL),iL=eh(OL),nL=eh(LL),rL=eh(BP),sL=eh(NL),$O(oL=tL(((PL=function(t){function e(){var e;return(e=t.call(this)||this)._string=hL&&hL(),e._horizontalAlign=uL&&uL(),e._verticalAlign=lL&&lL(),e._actualFontSize=cL&&cL(),e._fontSize=_L&&_L(),e._fontFamily=fL&&fL(),e._lineHeight=dL&&dL(),e._overflow=pL&&pL(),e._enableWrapText=mL&&mL(),e._font=gL&&gL(),e._isSystemFontUsed=yL&&yL(),e._spacingX=vL&&vL(),e._isItalic=SL&&SL(),e._isBold=AL&&AL(),e._isUnderline=TL&&TL(),e._underlineHeight=bL&&bL(),e._cacheMode=EL&&EL(),e._enableOutline=CL&&CL(),e._outlineColor=xL&&xL(),e._outlineWidth=wL&&wL(),e._enableShadow=DL&&DL(),e._shadowColor=RL&&RL(),e._shadowOffset=IL&&IL(),e._shadowBlur=ML&&ML(),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 FL,e._textLayout=new kL,e._textLayoutData=new VL,e._textRenderData=new GL,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._letterTexture=null,t.prototype.onDestroy.call(this)},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 wB){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 wB){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(this.cacheMode===NL.CHAR)this._letterTexture=this._assembler.getAssemblerData(),this._texture=this._letterTexture;else if(!this._ttfSpriteFrame){this._ttfSpriteFrame=new wP,this._assemblerData=this._assembler.getAssemblerData();var i=new sp(this._assemblerData.canvas),n=new Dm;n.image=i,this._ttfSpriteFrame.texture=n}this.cacheMode!==NL.CHAR&&(this._texture=this._ttfSpriteFrame),this.changeMaterialForDefine()}},i.changeMaterialForDefine=function(){if(this._texture){var t=!1;if(this.cacheMode!==NL.CHAR){var e=this._texture.texture;if(e instanceof lp){var i=e.getPixelFormat();t=i===kd.RGBA_ETC1||i===kd.RGB_A_PVRTC_4BPPV1||i===kd.RGB_A_PVRTC_2BPPV1}}this._instanceMaterialType=t?YO.USE_ALPHA_SEPARATED:YO.ADD_COLOR_AND_TEXTURE,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){this._cacheMode!==t&&(this._cacheMode!==NL.BITMAP||this._font instanceof wB||!this._ttfSpriteFrame||this._ttfSpriteFrame._resetDynamicAtlasFrame(),this._cacheMode===NL.CHAR&&(this._ttfSpriteFrame=null),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 wB?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}(JO)).HorizontalAlign=BL,PL.VerticalAlign=OL,PL.Overflow=LL,PL.CacheMode=NL,PL._canvasPool=MB.getInstance(),m((aL=PL).prototype,"horizontalAlign",[eL],Object.getOwnPropertyDescriptor(aL.prototype,"horizontalAlign"),aL.prototype),m(aL.prototype,"verticalAlign",[iL],Object.getOwnPropertyDescriptor(aL.prototype,"verticalAlign"),aL.prototype),m(aL.prototype,"overflow",[nL],Object.getOwnPropertyDescriptor(aL.prototype,"overflow"),aL.prototype),m(aL.prototype,"font",[rL],Object.getOwnPropertyDescriptor(aL.prototype,"font"),aL.prototype),m(aL.prototype,"cacheMode",[sL],Object.getOwnPropertyDescriptor(aL.prototype,"cacheMode"),aL.prototype),hL=fa(aL.prototype,"_string",[Ma],(function(){return"label"})),uL=fa(aL.prototype,"_horizontalAlign",[Ma],(function(){return BL.CENTER})),lL=fa(aL.prototype,"_verticalAlign",[Ma],(function(){return OL.CENTER})),cL=fa(aL.prototype,"_actualFontSize",[Ma],(function(){return 0})),_L=fa(aL.prototype,"_fontSize",[Ma],(function(){return 40})),fL=fa(aL.prototype,"_fontFamily",[Ma],(function(){return"Arial"})),dL=fa(aL.prototype,"_lineHeight",[Ma],(function(){return 40})),pL=fa(aL.prototype,"_overflow",[Ma],(function(){return LL.NONE})),mL=fa(aL.prototype,"_enableWrapText",[Ma],(function(){return!0})),gL=fa(aL.prototype,"_font",[Ma],(function(){return null})),yL=fa(aL.prototype,"_isSystemFontUsed",[Ma],(function(){return!0})),vL=fa(aL.prototype,"_spacingX",[Ma],(function(){return 0})),SL=fa(aL.prototype,"_isItalic",[Ma],(function(){return!1})),AL=fa(aL.prototype,"_isBold",[Ma],(function(){return!1})),TL=fa(aL.prototype,"_isUnderline",[Ma],(function(){return!1})),bL=fa(aL.prototype,"_underlineHeight",[Ma],(function(){return 2})),EL=fa(aL.prototype,"_cacheMode",[Ma],(function(){return NL.NONE})),CL=fa(aL.prototype,"_enableOutline",[Ma],(function(){return!1})),xL=fa(aL.prototype,"_outlineColor",[Ma],(function(){return new bn(0,0,0,255)})),wL=fa(aL.prototype,"_outlineWidth",[Ma],(function(){return 2})),DL=fa(aL.prototype,"_enableShadow",[Ma],(function(){return!1})),RL=fa(aL.prototype,"_shadowColor",[Ma],(function(){return new bn(0,0,0,255)})),IL=fa(aL.prototype,"_shadowOffset",[Ma],(function(){return new jn(2,2)})),ML=fa(aL.prototype,"_shadowBlur",[Ma],(function(){return 2})),oL=aL))||oL)||oL));v.Label=UL;var zL,HL,WL=0,jL={};function XL(t){return--t,t|=t>>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function YL(t,e){return Math.ceil(t/e)*e}!function(t){t[t.OPAQUE=0]="OPAQUE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OVERLAY=2]="OVERLAY"}(zL||(zL={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(HL||(HL={}));var qL,KL,QL,ZL,JL,$L,tN,eN,iN,nN=function(){function t(t){this._format=Ac.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new y_,this._region1=new y_,this._region2=new y_,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=ff[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=Tf(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=YL(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 o={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(o),o}var a=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,XL(a)),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;W("TextureBufferPool: Allocate chunk "+this._chunkCount+", size: "+e+", format: "+this._format);var i={texture:this._device.createTexture(new R_(Dc.TEX2D,Rc.SAMPLED|Rc.TRANSFER_DST,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,o=r%t.texture.width,a=Math.floor(r/t.texture.width),h=Math.min(t.texture.width-o,s),u=0;o>0&&(this._region0.texOffset.x=o,this._region0.texOffset.y=a,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),o=0,a+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=o,this._region1.texOffset.y=a,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),o=0,a+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=o,this._region2.texOffset.y=a,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})),o=0;o<s.length;o++){var a=s[o];if(r+t<=a.start){n=!0;break}r=a.end}!n&&r+t<=i.size&&(n=!0)}return n?r:-1},e._McDonaldAlloc=function(t){t=YL(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 o=Math.sqrt(t/this._formatSize),a=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,XL(o)),h=this._chunks[this.createChunk(a)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),rN=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=i*(1<<e)}return t.prototype.allocateNewChunk=function(){return new ArrayBuffer(this._chunkSize)},t}();!function(t){t[t.UINT32=0]="UINT32",t[t.FLOAT32=1]="FLOAT32",t[t.NEVER=2]="NEVER"}(iN||(iN={}));var sN,oN,aN=function(){function t(t,e,i,n,r){void 0===r&&(r=8),this._arrayBuffers=[],this._freeLists=[],this._uint32BufferViews=[],this._float32BufferViews=[],this._hasUint32=!1,this._hasFloat32=!1,this._elementCount=n.COUNT,this._entryBits=r,this._dataType=e,this._dataMembers=i,this._stride=4*this._elementCount,this._entriesPerChunk=1<<r,this._entryMask=this._entriesPerChunk-1,this._poolFlag=1<<30,this._chunkMask=~(this._entryMask|this._poolFlag),this._nativePool=new rN(t,r,this._stride);var s=iN.NEVER,o=!1,a=!1;for(var h in e){if(o=this._hasFloat32,(a=this._hasUint32)&&o)break;s=e[h],o||s!==iN.FLOAT32?a||s!==iN.UINT32||(this._hasUint32=!0):this._hasFloat32=!0}}var e=t.prototype;return e.alloc=function(){for(var t=0;t<this._freeLists.length;t++){var e=this._freeLists[t];if(e.length){var i=e[e.length-1];return e.length--,(t<<this._entryBits)+i+this._poolFlag}}for(var n=this._nativePool.allocateNewChunk(),r=[],s=[],o=[],a=this._hasFloat32,h=this._hasUint32,u=0;u<this._entriesPerChunk;u++)a&&r.push(new Float32Array(n,this._stride*u,this._elementCount)),h&&s.push(new Uint32Array(n,this._stride*u,this._elementCount)),u&&o.push(u);return h&&this._uint32BufferViews.push(s),a&&this._float32BufferViews.push(r),this._freeLists.push(o),this._arrayBuffers.push(n),(t<<this._entryBits)+this._poolFlag},e.getBuffer=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===iN.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],o=this._dataMembers[e];return s.subarray(r,r+o)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(sN||(sN={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(oN||(oN={}));var hN,uN=((qL={})[oN.POSITION]=iN.FLOAT32,qL[oN.UV]=iN.FLOAT32,qL[oN.COLOR]=iN.UINT32,qL[oN.COUNT]=iN.NEVER,qL),lN=((KL={})[oN.POSITION]=oN.UV-oN.POSITION,KL[oN.UV]=oN.COLOR-oN.UV,KL[oN.COLOR]=oN.COUNT-oN.COLOR,KL[oN.COUNT]=1,KL),cN=new aN(sN.RENDER2D,uN,lN,oN);!function(t){t[t.DIRTY_FLAG=0]="DIRTY_FLAG",t[t.LAYER=1]="LAYER",t[t.WORLD_SCALE=2]="WORLD_SCALE",t[t.WORLD_POSITION=5]="WORLD_POSITION",t[t.WORLD_ROTATION=8]="WORLD_ROTATION",t[t.WORLD_MATRIX=12]="WORLD_MATRIX",t[t.LOCAL_SCALE=28]="LOCAL_SCALE",t[t.LOCAL_POSITION=31]="LOCAL_POSITION",t[t.LOCAL_ROTATION=34]="LOCAL_ROTATION",t[t.COUNT=38]="COUNT"}(hN||(hN={}));var _N,fN=((QL={})[hN.DIRTY_FLAG]=iN.UINT32,QL[hN.LAYER]=iN.UINT32,QL[hN.WORLD_SCALE]=iN.FLOAT32,QL[hN.WORLD_POSITION]=iN.FLOAT32,QL[hN.WORLD_ROTATION]=iN.FLOAT32,QL[hN.WORLD_MATRIX]=iN.FLOAT32,QL[hN.LOCAL_SCALE]=iN.FLOAT32,QL[hN.LOCAL_POSITION]=iN.FLOAT32,QL[hN.LOCAL_ROTATION]=iN.FLOAT32,QL[hN.COUNT]=iN.NEVER,QL),dN=((ZL={})[hN.DIRTY_FLAG]=hN.LAYER-hN.DIRTY_FLAG,ZL[hN.LAYER]=hN.WORLD_SCALE-hN.LAYER,ZL[hN.WORLD_SCALE]=hN.WORLD_POSITION-hN.WORLD_SCALE,ZL[hN.WORLD_POSITION]=hN.WORLD_ROTATION-hN.WORLD_POSITION,ZL[hN.WORLD_ROTATION]=hN.WORLD_MATRIX-hN.WORLD_ROTATION,ZL[hN.WORLD_MATRIX]=hN.LOCAL_SCALE-hN.WORLD_MATRIX,ZL[hN.LOCAL_SCALE]=hN.LOCAL_POSITION-hN.LOCAL_SCALE,ZL[hN.LOCAL_POSITION]=hN.LOCAL_ROTATION-hN.LOCAL_POSITION,ZL[hN.LOCAL_ROTATION]=hN.COUNT-hN.LOCAL_ROTATION,ZL[hN.COUNT]=1,ZL),pN=new aN(sN.NODE,fN,dN,hN);!function(t){t[t.PRIORITY=0]="PRIORITY",t[t.STAGE=1]="STAGE",t[t.PHASE=2]="PHASE",t[t.PRIMITIVE=3]="PRIMITIVE",t[t.BATCHING_SCHEME=4]="BATCHING_SCHEME",t[t.DYNAMIC_STATE=5]="DYNAMIC_STATE",t[t.HASH=6]="HASH",t[t.COUNT=7]="COUNT"}(_N||(_N={}));var mN,gN=((JL={})[_N.PRIORITY]=iN.UINT32,JL[_N.STAGE]=iN.UINT32,JL[_N.PHASE]=iN.UINT32,JL[_N.PRIMITIVE]=iN.UINT32,JL[_N.BATCHING_SCHEME]=iN.UINT32,JL[_N.DYNAMIC_STATE]=iN.UINT32,JL[_N.HASH]=iN.UINT32,JL[_N.COUNT]=iN.NEVER,JL),yN=(($L={})[_N.PRIORITY]=_N.STAGE-_N.PRIORITY,$L[_N.STAGE]=_N.PHASE-_N.STAGE,$L[_N.PHASE]=_N.PRIMITIVE-_N.PHASE,$L[_N.PRIMITIVE]=_N.BATCHING_SCHEME-_N.PRIMITIVE,$L[_N.BATCHING_SCHEME]=_N.DYNAMIC_STATE-_N.BATCHING_SCHEME,$L[_N.DYNAMIC_STATE]=_N.HASH-_N.DYNAMIC_STATE,$L[_N.HASH]=_N.COUNT-_N.HASH,$L[_N.COUNT]=1,$L),vN=new aN(sN.PASS,gN,yN,_N);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(mN||(mN={}));var SN=((tN={})[mN.CENTER]=iN.FLOAT32,tN[mN.HALFEXTENTS]=iN.FLOAT32,tN[mN.COUNT]=iN.NEVER,tN),AN=((eN={})[mN.CENTER]=mN.HALFEXTENTS-mN.CENTER,eN[mN.HALFEXTENTS]=mN.COUNT-mN.HALFEXTENTS,eN[mN.COUNT]=1,eN),TN=new aN(sN.AABB,SN,AN,mN);ut(aR.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),ut(aR.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"}]),ut(ND.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var bN={};ut(bN,"CameraVisFlags",[{name:"GENERAL"}]),ht(bN,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Pm.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Pm.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Pm.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Pm.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Pm.BitMask,targetName:"UI_2D"}]),v.CameraVisFlags=bN;var EN={};ut(EN,"VisibilityFlags",[{name:"GENERAL"}]),ht(EN,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Pm.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Pm.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Pm.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Pm.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Pm.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Pm.Enum,targetName:"UI_2D"}]),v.VisibilityFlags=EN,ht(YA.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),ut(fD.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),ut(fT.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"}]),ut(tR.prototype,"SpotLight.prototype",[{name:"aspect"}]),ht(pD.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),ut(pD.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]);var CN,xN,wN,DN=function(t){if(void 0===jL[t]){var e=1<<WL;jL[t]=e,WL+=1}},RN=Object.freeze({__proto__:null,addStage:DN,scene:oR,createIA:function(t,e){if(!e.positions)return et(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 U_(a_.ATTR_POSITION,Ac.RGB32F)),e.normals&&s.push(new U_(a_.ATTR_NORMAL,Ac.RGB32F)),e.uvs&&s.push(new U_(a_.ATTR_TEX_COORD,Ac.RG32F)),e.colors&&s.push(new U_(a_.ATTR_COLOR,Ac.RGB32F));var o=t.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,4*i.length,4*i.length/n));o.update(new Float32Array(i));var a=null;return e.indices&&(a=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,2*e.indices.length,2))).update(new Uint16Array(e.indices)),t.createInputAssembler(new H_(s,[o],a))},programLib:pS,getDeviceShaderVersion:aS,RenderWindow:_R,get RenderQueue(){return zL},get PassStage(){return HL},genHandle:Bv,getTypeFromHandle:Ov,getBindingFromHandle:Lv,getCountFromHandle:Nv,getOffsetFromHandle:Fv,customizeType:kv,type2reader:Vv,type2writer:Gv,type2validator:Uv,getDefaultFromType:Hv,getStringFromType:Wv,overrideMacros:jv,get BatchingSchemes(){return VA},Pass:YA,nearestPOT:XL,TextureBufferPool:nN,MaterialInstance:pT,PassInstance:dT,get PoolType(){return sN},NULL_HANDLE:0,get Render2dView(){return oN},Render2dPool:cN,get NodeView(){return hN},NodePool:pN,get PassView(){return _N},PassPool:vN,get AABBView(){return mN},AABBPool:TN,RenderScene:aR,CameraVisFlags:bN,VisibilityFlags:EN});t("aH",RN),function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE"}(CN||(CN={})),xe(CN),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER"}(xN||(xN={})),xe(xN),function(t){t[t.PT_CORNER=1]="PT_CORNER",t[t.PT_LEFT=2]="PT_LEFT",t[t.PT_BEVEL=4]="PT_BEVEL",t[t.PT_INNERBEVEL=8]="PT_INNERBEVEL"}(wN||(wN={})),xe(wN);var IN=Math.PI,MN=Math.min,PN=Math.max,BN=Math.cos,ON=Math.sin,LN=Math.abs,NN=Math.sign,FN=.5522847493;function kN(t,e,i,n,r){t.moveTo(e-n,i),t.bezierCurveTo(e-n,i+r*FN,e-n*FN,i+r,e,i+r),t.bezierCurveTo(e+n*FN,i+r,e+n,i+r*FN,e+n,i),t.bezierCurveTo(e+n,i-r*FN,e+n*FN,i-r,e,i-r),t.bezierCurveTo(e-n*FN,i-r,e-n,i-r*FN,e-n,i),t.close()}function VN(t,e,i,n,r,s,o,a,h,u,l){var c,_,f,d,p,m,g,y,v,S,A,T,b,E,C,x;u>10||(p=.5*(s+a),m=.5*(o+h),g=.5*((c=.5*(e+n))+(f=.5*(n+s))),y=.5*((_=.5*(i+r))+(d=.5*(r+o))),((C=LN((n-a)*(E=h-i)-(r-h)*(b=a-e)))+(x=LN((s-a)*E-(o-h)*b)))*(C+x)<t.tessTol*(b*b+E*E)?t.addPoint(a,h,0===l?l|wN.PT_BEVEL:l):(VN(t,e,i,c,_,g,y,A=.5*(g+(v=.5*(f+p))),T=.5*(y+(S=.5*(d+m))),u+1,0),VN(t,A,T,v,S,p,m,a,h,u+1,l)))}var GN,UN,zN,HN,WN,jN,XN,YN,qN,KN,QN,ZN,JN,$N,tF,eF,iF,nF,rF,sF,oF,aF,hF,uF,lF,cF,_F,fF,dF,pF,mF,gF,yF,vF,SF,AF,TF,bF=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}(jn),EF=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}(),CF=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=bn.WHITE.clone(),this.lineCap=CN.BUTT,this.strokeColor=bn.BLACK.clone(),this.lineJoin=xN.MITER,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,wN.PT_CORNER),this._commandX=t,this._commandY=e},e.lineTo=function(t,e){this.addPoint(t,e,wN.PT_CORNER),this._commandX=t,this._commandY=e},e.bezierCurveTo=function(t,e,i,n,r,s){var o=this._curPath,a=o.points[o.points.length-1];a&&(a.x!==t||a.y!==e||i!==r||n!==s?(VN(this,a.x,a.y,t,e,i,n,r,s,0,wN.PT_CORNER),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){!function(t,e,i,n,r,s,o){var a,h,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0,y=0,v=0,S=0,A=0,T=0;if(l=s-r,o=o||!1)if(LN(l)>=2*IN)l=2*IN;else for(;l<0;)l+=2*IN;else if(LN(l)>=2*IN)l=2*-IN;else for(;l>0;)l-=2*IN;for(h=0|PN(1,MN(LN(l)/(.5*IN)+.5,5)),c=LN(4/3*(1-BN(a=l/h/2))/ON(a)),o||(c=-c),T=0;T<=h;T++)d=e+(_=BN(u=r+l*(T/h)))*n,p=i+(f=ON(u))*n,m=-f*n*c,g=_*n*c,0===T?t.moveTo(d,p):t.bezierCurveTo(y+S,v+A,d-m,p-g,d,p),y=d,v=p,S=m,A=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){kN(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){kN(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){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var o=MN(s,.5*LN(n))*NN(n),a=MN(s,.5*LN(r))*NN(r);t.moveTo(e,i+a),t.lineTo(e,i+r-a),t.bezierCurveTo(e,i+r-a*(1-FN),e+o*(1-FN),i+r,e+o,i+r),t.lineTo(e+n-o,i+r),t.bezierCurveTo(e+n-o*(1-FN),i+r,e+n,i+r-a*(1-FN),e+n,i+r-a),t.lineTo(e+n,i+a),t.bezierCurveTo(e+n,i+a*(1-FN),e+n-o*(1-FN),i,e+n-o,i),t.lineTo(e+o,i),t.bezierCurveTo(e+o*(1-FN),i,e,i+a*(1-FN),e,i+a),t.close()}}(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&&(CO.remove(n),n.removeRenderDrawInfo(this._comp))}this._renderDataList.length=0},e.close=function(){this._curPath.closed=!0},e.requestRenderData=function(){var t=CO.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,o=r[this.pointsOffset++];o?(o.x=t,o.y=e):(o=new bF(t,e),r.push(o)),o.flags=i,s.push(o)}},e._addPath=function(){var t=this.pathLength,e=this.paths[t];return e?e.reset():(e=new EF,this.paths.push(e)),this.pathLength++,this._curPath=e,e},t}(),xF=VB.concat([new U_("a_dist",Ac.R32F)]),wF=WB(xF),DF=jB(xF),RF=t("G",(GN=Ta("cc.Graphics"),UN=Ea(110),zN=eh(xN),HN=eh(CN),GN(WN=UN(((JN=function(t){function e(){var e;return(e=t.call(this)||this).impl=null,e.model=null,e._lineWidth=XN&&XN(),e._strokeColor=YN&&YN(),e._lineJoin=qN&&qN(),e._lineCap=KN&&KN(),e._fillColor=QN&&QN(),e._miterLimit=ZN&&ZN(),e._isDrawing=!1,e._isNeedUploadData=!0,e._graphicsUseSubMeshes=[],e._instanceMaterialType=YO.ADD_COLOR,e.impl=new CF(c(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=FI.root.createModel(ND),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&&(FI.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=UA.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=nd.gfxDevice,i=e.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,65535*DF,DF)),n=e.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,131070*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),r=new jI([i],xF,Yc.TRIANGLE_LIST,n);r.subMeshIdx=0,this.model.initSubModel(t,r,this.getMaterialInstance(0)),this._graphicsUseSubMeshes.push(r)}}else $(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 o=new Float32Array(r.vData.buffer,0,r.vertexStart*wF);s.vertexBuffers[0].update(o),s.vertexCount=r.vertexStart;var a=new Uint16Array(r.iData.buffer,0,r.indexStart);s.indexBuffer.update(a),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 AO(rO.DYNAMIC)},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}(JO)).LineJoin=xN,JN.LineCap=CN,m((jN=JN).prototype,"lineJoin",[zN],Object.getOwnPropertyDescriptor(jN.prototype,"lineJoin"),jN.prototype),m(jN.prototype,"lineCap",[HN],Object.getOwnPropertyDescriptor(jN.prototype,"lineCap"),jN.prototype),m(jN.prototype,"color",[_h],Object.getOwnPropertyDescriptor(jN.prototype,"color"),jN.prototype),XN=fa(jN.prototype,"_lineWidth",[Ma],(function(){return 1})),YN=fa(jN.prototype,"_strokeColor",[Ma],(function(){return bn.BLACK.clone()})),qN=fa(jN.prototype,"_lineJoin",[Ma],(function(){return xN.MITER})),KN=fa(jN.prototype,"_lineCap",[Ma],(function(){return CN.BUTT})),QN=fa(jN.prototype,"_fillColor",[Ma],(function(){return bn.WHITE.clone()})),ZN=fa(jN.prototype,"_miterLimit",[Ma],(function(){return 10})),WN=jN))||WN)||WN));v.Graphics=RF,function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED",t[t.FILLED=3]="FILLED"}(vF||(vF={})),xe(vF),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.RADIAL=2]="RADIAL"}(SF||(SF={})),xe(SF),function(t){t[t.CUSTOM=0]="CUSTOM",t[t.TRIMMED=1]="TRIMMED",t[t.RAW=2]="RAW"}(AF||(AF={})),xe(AF),function(t){t.SPRITE_FRAME_CHANGED="spriteframe-changed"}(TF||(TF={}));var IF,MF,PF,BF,OF,LF,NF,FF,kF,VF,GF=t("j",($N=Ta("cc.Sprite"),tF=Ea(110),eF=eh(RP),iF=eh(wP),nF=eh(vF),rF=eh(SF),sF=eh(AF),$N(oF=tF(((yF=function(t){function e(){var e;return(e=t.call(this)||this)._spriteFrame=hF&&hF(),e._type=uF&&uF(),e._fillType=lF&&lF(),e._sizeMode=cF&&cF(),e._fillCenter=_F&&_F(),e._fillStart=fF&&fF(),e._fillRange=dF&&dF(),e._isTrimmedMode=pF&&pF(),e._useGrayscale=mF&&mF(),e._atlas=gF&&gF(),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(),this._type===vF.SLICED&&e.on(wP.EVENT_UV_UPDATED,this._updateUVs,this))},i.onDisable=function(){t.prototype.onDisable.call(this),this._spriteFrame&&this._type===vF.SLICED&&this._spriteFrame.off(wP.EVENT_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 $(16377)},i.changeMaterialForDefine=function(){var t,e=this._instanceMaterialType;this._spriteFrame&&(t=this._spriteFrame.texture);var i=!1;if(t instanceof lp){var n=t.getPixelFormat();i=n===kd.RGBA_ETC1||n===kd.RGB_A_PVRTC_4BPPV1||n===kd.RGB_A_PVRTC_2BPPV1}i&&this.grayscale?this._instanceMaterialType=YO.USE_ALPHA_SEPARATED_AND_GRAY:i?this._instanceMaterialType=YO.USE_ALPHA_SEPARATED:this.grayscale?this._instanceMaterialType=YO.GRAYSCALE:this._instanceMaterialType=YO.ADD_COLOR_AND_TEXTURE,e!==this._instanceMaterialType&&this.updateMaterial()},i._updateBuiltinMaterial=function(){var e=t.prototype._updateBuiltinMaterial.call(this);if(this.spriteFrame&&this.spriteFrame.texture instanceof TD){var i=new oT;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=e.Assembler.getAssembler(this);this._assembler!==t&&(this.destroyRenderData(),this._assembler=t),this._renderData||this._assembler&&this._assembler.createData&&(this._renderData=this._assembler.createData(this),this._renderData.material=this.getRenderMaterial(0),this.markForUpdateRenderData(),this.spriteFrame&&this._assembler.updateUVs(this),this._updateColor()),this._spriteFrame&&(this._type===vF.SLICED?this._spriteFrame.on(wP.EVENT_UV_UPDATED,this._updateUVs,this):this._spriteFrame.off(wP.EVENT_UV_UPDATED,this._updateUVs,this))},i._applySpriteSize=function(){if(this._spriteFrame)if(AF.RAW===this._sizeMode){var t=this._spriteFrame.originalSize;this.node._uiProps.uiTransformComp.setContentSize(t)}else if(AF.TRIMMED===this._sizeMode){var e=this._spriteFrame.rect;this.node._uiProps.uiTransformComp.setContentSize(e.width,e.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._spriteFrame;t&&this._type===vF.SLICED&&t.off(wP.EVENT_UV_UPDATED,this._updateUVs,this);var i=!1;e&&(t&&t.texture===e.texture||(i=!0),i&&(this.renderData&&(this.renderData.textureDirty=!0),(!!t&&t.texture instanceof TD)!=e.texture instanceof TD&&(this._instanceMaterialType=-1),this.changeMaterialForDefine()),this._applySpriteSize(),this._type===vF.SLICED&&e.on(wP.EVENT_UV_UPDATED,this._updateUVs,this))},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&&(t===SF.RADIAL||this._fillType===SF.RADIAL?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,this._type===vF.FILLED&&this.renderData&&this.markForUpdateRenderData()}},{key:"fillStart",get:function(){return this._fillStart},set:function(t){this._fillStart=Ni(t,0,1),this._type===vF.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"fillRange",get:function(){return this._fillRange},set:function(t){this._fillRange=Ni(t,-1,1),this._type===vF.FILLED&&this.renderData&&(this.markForUpdateRenderData(),this._updateUVs())}},{key:"trim",get:function(){return this._isTrimmedMode},set:function(t){this._isTrimmedMode!==t&&(this._isTrimmedMode=t,this._type===vF.SIMPLE&&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,t!==AF.CUSTOM&&this._applySpriteSize())}}]),e}(JO)).FillType=SF,yF.Type=vF,yF.SizeMode=AF,yF.EventType=TF,m((aF=yF).prototype,"spriteAtlas",[eF],Object.getOwnPropertyDescriptor(aF.prototype,"spriteAtlas"),aF.prototype),m(aF.prototype,"spriteFrame",[iF],Object.getOwnPropertyDescriptor(aF.prototype,"spriteFrame"),aF.prototype),m(aF.prototype,"type",[nF],Object.getOwnPropertyDescriptor(aF.prototype,"type"),aF.prototype),m(aF.prototype,"fillType",[rF],Object.getOwnPropertyDescriptor(aF.prototype,"fillType"),aF.prototype),m(aF.prototype,"sizeMode",[sF],Object.getOwnPropertyDescriptor(aF.prototype,"sizeMode"),aF.prototype),hF=fa(aF.prototype,"_spriteFrame",[Ma],(function(){return null})),uF=fa(aF.prototype,"_type",[Ma],(function(){return vF.SIMPLE})),lF=fa(aF.prototype,"_fillType",[Ma],(function(){return SF.HORIZONTAL})),cF=fa(aF.prototype,"_sizeMode",[Ma],(function(){return AF.TRIMMED})),_F=fa(aF.prototype,"_fillCenter",[Ma],(function(){return new jn(0,0)})),fF=fa(aF.prototype,"_fillStart",[Ma],(function(){return 0})),dF=fa(aF.prototype,"_fillRange",[Ma],(function(){return 0})),pF=fa(aF.prototype,"_isTrimmedMode",[Ma],(function(){return!0})),mF=fa(aF.prototype,"_useGrayscale",[Ma],(function(){return!1})),gF=fa(aF.prototype,"_atlas",[Ma],(function(){return null})),oF=aF))||oF)||oF));v.Sprite=GF;var UF,zF=new Vn,HF=new jn,WF=new Vn,jF=[];!function(t){t[t.GRAPHICS_RECT=0]="GRAPHICS_RECT",t[t.GRAPHICS_ELLIPSE=1]="GRAPHICS_ELLIPSE",t[t.GRAPHICS_STENCIL=2]="GRAPHICS_STENCIL",t[t.SPRITE_STENCIL=3]="SPRITE_STENCIL"}(UF||(UF={})),xe(UF);var XF,YF,qF,KF,QF,ZF,JF=t("h",(IF=Ta("cc.Mask"),MF=Ea(110),PF=eh(UF),IF(BF=MF(((VF=function(t){function e(){var e;return(e=t.call(this)||this)._type=LF&&LF(),e._inverted=NF&&NF(),e._segments=FF&&FF(),e._alphaThreshold=kF&&kF(),e._sprite=null,e._graphics=null,e._stencilStage=eO.DISABLED,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(Nm.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(Nm.SIZE_CHANGED,this._nodeStateChange,this)},i.onRestore=function(){this._changeRenderType(),this._updateGraphics()},i.onDisable=function(){this._disableRender(),this.node.off(Nm.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(Nm.SIZE_CHANGED,this._nodeStateChange,this)},i.onDestroy=function(){this._removeMaskNode()},i.isHit=function(t){var e=this.node._uiProps.uiTransformComp,i=e.contentSize,n=i.width,r=i.height,s=HF;this.node.getWorldMatrix(zF),Vn.invert(WF,zF),jn.transformMat4(s,t,WF);var o=e.anchorPoint;s.x+=o.x*n,s.y+=o.y*r;var a=!1;if(this.type===UF.GRAPHICS_RECT||this.type===UF.GRAPHICS_STENCIL||this.type===UF.SPRITE_STENCIL)a=s.x>=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===UF.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,l=s.x-.5*n,c=s.y-.5*r;a=l*l/(h*h)+c*c/(u*u)<1}return this._inverted&&(a=!a),a},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==UF.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(GF);if(!t){var e=this.node;t=this._sprite=e.addComponent(GF)}}this._sprite.stencilStage=this.inverted?eO.ENTER_LEVEL_INVERTED:eO.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(RF);if(!t){var e=this.node;t=this._graphics=e.addComponent(RF)}t.lineWidth=1;var i=bn.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?eO.ENTER_LEVEL_INVERTED:eO.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===UF.GRAPHICS_RECT||this._type===UF.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,o=-n*s.x,a=-r*s.y;if(this._type===UF.GRAPHICS_RECT)e.rect(o,a,n,r);else if(this._type===UF.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){jF.length=0;for(var n=2*Math.PI/i,r=0;r<i;++r)jF.push(new mn(e.x*Math.cos(n*r)+t.x,e.y*Math.sin(n*r)+t.y,0));return jF}(new mn(o+n/2,a+r/2,0),new mn(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=eO.DISABLED,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),$(9007),this.subComp&&this.subComp.markForUpdateRenderData(t)},i.requestRenderData=function(){$(9007)},i.destroyRenderData=function(){$(9007)},i.updateRenderer=function(){$(9007),this.subComp&&this.subComp.updateRenderer()},i.fillBuffers=function(){$(9007)},i.postUpdateAssembler=function(){$(9007)},i.setNodeDirty=function(){$(9007),this.subComp&&this.subComp.setNodeDirty()},i.setTextureDirty=function(){$(9007),this.subComp&&this.subComp.setTextureDirty()},i.getMaterial=function(t){return $(9007),this.subComp?this.subComp.getSharedMaterial(t):null},i.setMaterial=function(t,e){$(9007),this.subComp&&this.subComp.setMaterial(t,e)},i.getMaterialInstance=function(t){return $(9007),this.subComp?this.subComp.getMaterialInstance(t):null},i.setMaterialInstance=function(t,e){$(9007),this.subComp&&this.subComp.setMaterialInstance(t,e)},i.getRenderMaterial=function(t){return $(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,this._type!==UF.SPRITE_STENCIL?(this._sprite&&(this.node.removeComponent(GF),this._sprite._destroyImmediate(),this._sprite=null),this._changeRenderType(),this._updateGraphics()):(this._graphics&&(this._graphics.clear(),this.node.removeComponent(RF),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?eO.ENTER_LEVEL_INVERTED:eO.ENTER_LEVEL}},{key:"segments",get:function(){return this._segments},set:function(t){this._segments!==t&&(this._segments=Ni(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:et(16307)}},{key:"alphaThreshold",get:function(){return this._alphaThreshold},set:function(t){this._alphaThreshold!==t&&(this._alphaThreshold=t,this.type===UF.SPRITE_STENCIL&&this._sprite&&this._sprite.getMaterialInstance(0).setProperty("alphaThreshold",this._alphaThreshold))}},{key:"subComp",get:function(){return this._graphics||this._sprite}},{key:"customMaterial",get:function(){return $(9007),this.subComp?this.subComp.customMaterial:null},set:function(t){$(9007),this.subComp&&(this.subComp.customMaterial=t)}},{key:"color",get:function(){return $(9007),this.subComp?this.subComp.color:null},set:function(t){$(9007),this.subComp&&t&&(this.subComp.color=t)}},{key:"sharedMaterial",get:function(){return $(9007),this.subComp?this.subComp.sharedMaterial:null}},{key:"sharedMaterials",get:function(){return $(9007),this.subComp?this.subComp.sharedMaterials:null},set:function(t){$(9007),this.subComp&&t&&(this.subComp.sharedMaterials=t)}},{key:"material",get:function(){return $(9007),this.subComp?this.subComp.material:null},set:function(t){$(9007),this.subComp&&(this.subComp.material=t)}},{key:"materials",get:function(){return $(9007),this.subComp?this.subComp.materials:[null]},set:function(t){$(9007),this.subComp&&(this.subComp.materials=t)}}]),e}(Lp)).Type=UF,m((OF=VF).prototype,"type",[PF],Object.getOwnPropertyDescriptor(OF.prototype,"type"),OF.prototype),LF=fa(OF.prototype,"_type",[Ma],(function(){return UF.GRAPHICS_RECT})),NF=fa(OF.prototype,"_inverted",[Ma],(function(){return!1})),FF=fa(OF.prototype,"_segments",[Ma],(function(){return 64})),kF=fa(OF.prototype,"_alphaThreshold",[Ma],(function(){return.1})),BF=OF))||BF)||BF));CR._maskComp=JF,v.Mask=JF,St({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}}),St({UIRenderable:{newName:"UIRenderer",since:"3.0.0",removed:!0}}),St({Renderable2D:{newName:"UIRenderer",since:"3.6.0",removed:!1}});var $F,tk,ek,ik,nk,rk,sk,ok,ak,hk,uk,lk,ck,_k,fk,dk,pk,mk,gk,yk,vk,Sk,Ak,Tk,bk,Ek,Ck,xk,wk,Dk,Rk,Ik,Mk,Pk,Bk,Ok,Lk=Ta("cc.PostProcess")(XF=Ca(((ZF=function(t){function e(){var e;return(e=t.call(this)||this).global=qF&&qF(),e._shadingScale=KF&&KF(),e.enableShadingScaleInEditor=QF&&QF(),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}(Lp)).all=[],qF=fa((YF=ZF).prototype,"global",[xa,Ma],(function(){return!0})),KF=fa(YF.prototype,"_shadingScale",[Ma],(function(){return 1})),m(YF.prototype,"shadingScale",[xa],Object.getOwnPropertyDescriptor(YF.prototype,"shadingScale"),YF.prototype),QF=fa(YF.prototype,"enableShadingScaleInEditor",[xa,Ma],(function(){return!1})),XF=YF))||XF)||XF,Nk=new mn,Fk=be(Qw),kk=be(Kw),Vk=be(Zw),Gk=be($w),Uk=be(Jw),zk=be({SKYBOX:cD|n_.DEPTH_STENCIL,SOLID_COLOR:n_.ALL,DEPTH_ONLY:n_.DEPTH_STENCIL,DONT_CLEAR:n_.NONE}),Hk=t("dL",($F=Ta("cc.Camera"),tk=eh(Pm.BitMask),ek=eh(zk),ik=eh(Fk),nk=eh(kk),rk=eh(Vk),sk=eh(Gk),ok=eh(Uk),ak=eh(TD),hk=eh(Lk),$F(((Bk=function(t){function e(){var e;return(e=t.call(this)||this)._projection=ck&&ck(),e._priority=_k&&_k(),e._fov=fk&&fk(),e._fovAxis=dk&&dk(),e._orthoHeight=pk&&pk(),e._near=mk&&mk(),e._far=gk&&gk(),e._color=yk&&yk(),e._depth=vk&&vk(),e._stencil=Sk&&Sk(),e._clearFlags=Ak&&Ak(),e._rect=Tk&&Tk(),e._aperture=bk&&bk(),e._shutter=Ek&&Ek(),e._iso=Ck&&Ck(),e._screenScale=xk&&xk(),e._visibility=wk&&wk(),e._targetTexture=Dk&&Dk(),e._postProcess=Rk&&Rk(),e._usePostProcess=Ik&&Ik(),e._camera=null,e._inEditorMode=!1,e._flows=void 0,e._cameraType=Mk&&Mk(),e._trackingType=Pk&&Pk(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createCamera()},i.onEnable=function(){this.node.hasChangedFlags|=Om.POSITION,this._camera&&this._attachToScene()},i.onDisable=function(){this._camera&&this._detachFromScene()},i.onDestroy=function(){this._camera&&(this._camera.destroy(),this._camera=null),this._targetTexture&&this._targetTexture.off("resize")},i.screenPointToRay=function(t,e,i){return i||(i=mr.create()),this._camera&&this._camera.screenPointToRay(i,t,e),i},i.worldToScreen=function(t,e){return e||(e=new mn),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 mn),!this._camera)return i;this.worldToScreen(t,Nk);var n=e.getComponent("cc.UITransform"),r=v.view.getVisibleSize(),s=Nk.x-.5*this._camera.width,o=Nk.y-.5*this._camera.height;return Nk.x=s/v.view.getScaleX()+.5*r.width,Nk.y=o/v.view.getScaleY()+.5*r.height,n&&n.convertToNodeSpaceAR(Nk,i),i},i._createCamera=function(){this._camera||(this._camera=v.director.root.createCamera(),this._camera.initialize({name:this.node.name,node:this.node,projection:this._projection,window:this._inEditorMode?v.director.root&&v.director.root.mainWindow:v.director.root&&v.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=Vi(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,t===Kw.VERTICAL?this.fov=this._fov*this._camera.aspect:this.fov=this._fov/this._camera.aspect))}},{key:"fov",get:function(){return this._fov},set:function(t){this._fov=t,this._camera&&(this._camera.fov=Vi(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 i=this._targetTexture;this._targetTexture=t,this._checkTargetTextureEvent(i),this._updateTargetTexture(),!t&&this._camera&&(this._camera.changeTargetWindow(null),this._camera.isWindowSize=!0),this.node.emit(e.TARGET_TEXTURE_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){this._inEditorMode=t,this._camera&&this._camera.changeTargetWindow(t?v.director.root&&v.director.root.mainWindow:v.director.root&&v.director.root.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}(Lp)).ProjectionType=Fk,Bk.FOVAxis=kk,Bk.ClearFlag=zk,Bk.Aperture=Vk,Bk.Shutter=Gk,Bk.ISO=Uk,Bk.TARGET_TEXTURE_CHANGE="tex-change",ck=fa((lk=Bk).prototype,"_projection",[Ma],(function(){return Fk.PERSPECTIVE})),_k=fa(lk.prototype,"_priority",[Ma],(function(){return 0})),fk=fa(lk.prototype,"_fov",[Ma],(function(){return 45})),dk=fa(lk.prototype,"_fovAxis",[Ma],(function(){return kk.VERTICAL})),pk=fa(lk.prototype,"_orthoHeight",[Ma],(function(){return 10})),mk=fa(lk.prototype,"_near",[Ma],(function(){return 1})),gk=fa(lk.prototype,"_far",[Ma],(function(){return 1e3})),yk=fa(lk.prototype,"_color",[Ma],(function(){return new bn("#333333")})),vk=fa(lk.prototype,"_depth",[Ma],(function(){return 1})),Sk=fa(lk.prototype,"_stencil",[Ma],(function(){return 0})),Ak=fa(lk.prototype,"_clearFlags",[Ma],(function(){return zk.SOLID_COLOR})),Tk=fa(lk.prototype,"_rect",[Ma],(function(){return new Zn(0,0,1,1)})),bk=fa(lk.prototype,"_aperture",[Ma],(function(){return Vk.F16_0})),Ek=fa(lk.prototype,"_shutter",[Ma],(function(){return Gk.D125})),Ck=fa(lk.prototype,"_iso",[Ma],(function(){return Uk.ISO100})),xk=fa(lk.prototype,"_screenScale",[Ma],(function(){return 1})),wk=fa(lk.prototype,"_visibility",[Ma],(function(){return bv})),Dk=fa(lk.prototype,"_targetTexture",[Ma],(function(){return null})),Rk=fa(lk.prototype,"_postProcess",[Ma],(function(){return null})),Ik=fa(lk.prototype,"_usePostProcess",[Ma],(function(){return!1})),Mk=fa(lk.prototype,"_cameraType",[Ma],(function(){return tD.DEFAULT})),Pk=fa(lk.prototype,"_trackingType",[Ma],(function(){return eD.NO_TRACKING})),m(lk.prototype,"visibility",[tk],Object.getOwnPropertyDescriptor(lk.prototype,"visibility"),lk.prototype),m(lk.prototype,"clearFlags",[ek],Object.getOwnPropertyDescriptor(lk.prototype,"clearFlags"),lk.prototype),m(lk.prototype,"projection",[ik],Object.getOwnPropertyDescriptor(lk.prototype,"projection"),lk.prototype),m(lk.prototype,"fovAxis",[nk],Object.getOwnPropertyDescriptor(lk.prototype,"fovAxis"),lk.prototype),m(lk.prototype,"aperture",[rk],Object.getOwnPropertyDescriptor(lk.prototype,"aperture"),lk.prototype),m(lk.prototype,"shutter",[sk],Object.getOwnPropertyDescriptor(lk.prototype,"shutter"),lk.prototype),m(lk.prototype,"iso",[ok],Object.getOwnPropertyDescriptor(lk.prototype,"iso"),lk.prototype),m(lk.prototype,"targetTexture",[ak],Object.getOwnPropertyDescriptor(lk.prototype,"targetTexture"),lk.prototype),m(lk.prototype,"usePostProcess",[xa],Object.getOwnPropertyDescriptor(lk.prototype,"usePostProcess"),lk.prototype),m(lk.prototype,"postProcess",[hk],Object.getOwnPropertyDescriptor(lk.prototype,"postProcess"),lk.prototype),uk=lk))||uk));v.Camera=Hk;var Wk,jk,Xk,Yk,qk,Kk,Qk,Zk,Jk,$k=t("R",Ta("cc.RenderRoot2D")(Ok=Ea(100)(Ok=ba(OO)(Ok=Ca(Ok=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){v.director.root.batcher2D.addScreen(this)},i.onDisable=function(){v.director.root.batcher2D.removeScreen(this)},i.onDestroy=function(){v.director.root.batcher2D.removeScreen(this)},e}(Lp))||Ok)||Ok)||Ok)||Ok),tV=new mn,eV=be({OVERLAY:0,INTERSPERSE:1}),iV=t("C",(Wk=Ta("cc.Canvas"),jk=Ea(100),Xk=eh(Hk),Yk=eh(Hk),Wk(qk=jk(qk=Ca((m((Kk=function(t){function e(){var e;return(e=t.call(this)||this)._cameraComponent=Qk&&Qk(),e._alignCanvasWithScreen=Zk&&Zk(),e._pos=new mn,e._renderMode=eV.OVERLAY,e._thisOnCameraResized=e._onResizeCamera.bind(c(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(Hk.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)),this._onResizeCamera(),wM.on("canvas-resize",this._thisOnCameraResized,this)},i.onEnable=function(){t.prototype.onEnable.call(this),this._cameraComponent&&this._cameraComponent.node.on(Hk.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDisable=function(){t.prototype.onDisable.call(this),this._cameraComponent&&this._cameraComponent.node.off(Hk.TARGET_TEXTURE_CHANGE,this._thisOnCameraResized)},i.onDestroy=function(){t.prototype.onDestroy.call(this),wM.off("canvas-resize",this._thisOnCameraResized,this)},i._onResizeCamera=function(){if(this._cameraComponent&&this._alignCanvasWithScreen){if(this._cameraComponent.targetTexture)this._cameraComponent.orthoHeight=zo.height/2;else{var t=Go.windowSize;this._cameraComponent.orthoHeight=t.height/wM.getScaleY()/2}this.node.getWorldPosition(tV),this._cameraComponent.node.setWorldPosition(tV.x,tV.y,1e3)}},i._getViewPriority=function(){if(this._cameraComponent){var t,e=null===(t=this.cameraComponent)||void 0===t?void 0:t.priority;return this._renderMode===eV.OVERLAY?e|1<<30:e&~(1<<30)}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}($k)).prototype,"cameraComponent",[Xk],Object.getOwnPropertyDescriptor(Kk.prototype,"cameraComponent"),Kk.prototype),Qk=fa(Kk.prototype,"_cameraComponent",[Yk],(function(){return null})),Zk=fa(Kk.prototype,"_alignCanvasWithScreen",[Ma],(function(){return!0})),qk=Kk))||qk)||qk)||qk));function nV(t,e,i){var n=t.o,r=t.d,s=1/r.x,o=1/r.y,a=1/r.z,h=(e.x-n.x)*s,u=(i.x-n.x)*s,l=(e.y-n.y)*o,c=(i.y-n.y)*o,_=(e.z-n.z)*a,f=(i.z-n.z)*a,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}v.Canvas=iV,ut(t("U",Ta("cc.UIComponent")(Jk=ba(OO)(Jk=Ea(110)(Jk=Ca(Jk=function(t){function e(){var e;return(e=t.call(this)||this)._lastParent=null,e.stencilStage=eO.DISABLED,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(){this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null)},i.postUpdateAssembler=function(){},i.markForUpdateRenderData=function(){},i.setNodeDirty=function(){},i.setTextureDirty=function(){},e}(Lp))||Jk)||Jk)||Jk)||Jk).prototype,"UIComponent",[{name:"_visibility"},{name:"setVisibility"}]),ht(iV.prototype,"Canvas.prototype",[{name:"camera",newName:"cameraComponent.camera",customGetter:function(){var t;return null===(t=this._cameraComponent)||void 0===t?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:bn.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}}]),lt(OO.prototype,"UITransform.prototype",[{name:"priority",suggest:"Please use setSiblingIndex to change index of the current node in its parent's children array."}]),v.UITransformComponent=OO,ie(OO,"cc.UITransformComponent"),ie(JO,"cc.RenderComponent"),v.CanvasComponent=iV,ie(iV,"cc.CanvasComponent"),v.internal.Renderable2D=JO,ie(JO,"cc.Renderable2D");var rV,sV,oV,aV,hV,uV,lV,cV=(rV=Is.create(),sV={distance:1/0,doubleSided:!1,mode:Ol.ANY},oV=0,aV=function(t,e,i,n,r,s){t===Ol.CLOSEST?(oV>e||0===oV)&&(oV=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))):(oV=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(oV=0,0===e.geometricInfo.positions.length)return oV;var n=void 0===i?sV:i;if(nV(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===Yc.TRIANGLE_LIST)for(var s=e.length,o=0;o<s;o+=3){var a=3*e[o],h=3*e[o+1],u=3*e[o+2];mn.set(rV.a,t[a],t[a+1],t[a+2]),mn.set(rV.b,t[h],t[h+1],t[h+2]),mn.set(rV.c,t[u],t[u+1],t[u+2]);var l=gs.rayTriangle(n,rV,r.doubleSided);if(!(0===l||l>r.distance)&&(aV(r.mode,l,a,h,u,r.result),r.mode===Ol.ANY))return l}else if(i===Yc.TRIANGLE_STRIP)for(var c=e.length-2,_=0,f=0;f<c;f+=1){var d=3*e[f-_],p=3*e[f+_+1],m=3*e[f+2];mn.set(rV.a,t[d],t[d+1],t[d+2]),mn.set(rV.b,t[p],t[p+1],t[p+2]),mn.set(rV.c,t[m],t[m+1],t[m+2]),_=~_;var g=gs.rayTriangle(n,rV,r.doubleSided);if(!(0===g||g>r.distance)&&(aV(r.mode,g,d,p,m,r.result),r.mode===Ol.ANY))return g}else if(i===Yc.TRIANGLE_FAN){var y=e.length-1,v=3*e[0];mn.set(rV.a,t[v],t[v+1],t[v+2]);for(var S=1;S<y;S+=1){var A=3*e[S],T=3*e[S+1];mn.set(rV.b,t[A],t[A+1],t[A+2]),mn.set(rV.c,t[T],t[T+1],t[T+2]);var b=gs.rayTriangle(n,rV,r.doubleSided);if(!(0===b||b>r.distance)&&(aV(r.mode,b,v,A,T,r.result),r.mode===Ol.ANY))return b}}}(s.positions,s.indices,r,t,n)}return oV}),_V=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Ol.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,o=n.renderingSubMeshes.length,a=n.struct.minPosition,h=n.struct.maxPosition;if(a&&h&&!nV(i,a,h))return t;for(var u=0;u<o;u++){var l=n.renderingSubMeshes[u],c=cV(i,l,s);if(c)if(s.mode===Ol.CLOSEST)(0===t||t>c)&&(t=c,s.subIndices&&(s.subIndices[0]=u));else if(t=c,s.subIndices&&s.subIndices.push(u),s.mode===Ol.ANY)return c}return t&&s.mode===Ol.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),fV=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Ol.ANY},i=new mr,n=new Vn;return function(r,s,o){t=0;var a=void 0===o?e:o,h=s.worldBounds;if(h&&!gs.rayAABB(r,h))return t;mr.copy(i,r),s.node&&(Vn.invert(n,s.node.getWorldMatrix(n)),mn.transformMat4(i.o,r.o,n),mn.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;l<u.length;l++){var c=u[l].subMesh,_=cV(i,c,a);if(_)if(a.mode===Ol.CLOSEST)(0===t||t>_)&&(t=_,a.subIndices&&(a.subIndices[0]=l));else if(t=_,a.subIndices&&a.subIndices.push(l),a.mode===Ol.ANY)return _}return t&&a.mode===Ol.CLOSEST&&(a.result&&(a.result[0].distance=t,a.result.length=1),a.subIndices&&(a.subIndices.length=1)),t}}();gs.rayModel=fV,gs.raySubMesh=cV,gs.rayMesh=_V,zA("specular-pass");var dV,pV,mV,gV,yV,vV,SV,AV,TV,bV,EV,CV,xV,wV,DV,RV,IV,MV=t("dM",Ta("cc.ModelRenderer")((uV=function(t){function e(){var e;return(e=t.call(this)||this)._visFlags=lV&&lV(),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}(ZO),lV=fa(uV.prototype,"_visFlags",[Ma],(function(){return Pm.Enum.NONE})),hV=uV))||hV),PV=Ma,BV=eh;t("dP",(dV=Ta("cc.PrefabLink"),pV=BV(EI),dV((gV=function(t){function e(){var e;return(e=t.call(this)||this).prefab=yV&&yV(),e}return s(e,t),e}(Lp),yV=fa(gV.prototype,"prefab",[pV,PV],(function(){return null})),mV=gV))||mV)),ht(Hk,"Camera",[{name:"CameraClearFlag",newName:"ClearFlag"}]),ht(Hk.prototype,"Camera.prototype",[{name:"color",newName:"clearColor"},{name:"depth",newName:"clearDepth"},{name:"stencil",newName:"clearStencil"}]),lt(ZO.prototype,"Renderer.prototype",[{name:"getMaterial",suggest:"please use renderer.getSharedMaterial instead."}]),v.CameraComponent=Hk,ie(Hk,"cc.CameraComponent"),v.RenderableComponent=MV,ie(MV,"cc.RenderableComponent"),function(t){t[t.SIMPLE=0]="SIMPLE",t[t.SLICED=1]="SLICED",t[t.TILED=2]="TILED"}(IV||(IV={})),t("f",(vV=Ta("cc.SpriteRenderer"),SV=Ea(100),AV=eh(wP),vV(TV=SV((m((bV=function(t){function e(){var e;return(e=t.call(this)||this)._spriteFrame=EV&&EV(),e._mode=CV&&CV(),e._color=xV&&xV(),e._flipX=wV&&wV(),e._flipY=DV&&DV(),e._size=RV&&RV(),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&&(v.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=v.director.root.createModel(ND);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|=Om.POSITION,this._model.transform.hasChangedFlags|=Om.POSITION;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 UA.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=Kg.SAMPLER_SPRITE,r=0;r<i.length;r++){var s=i[r].descriptorSet;s.bindTexture(n,t),s.bindSampler(n,e),s.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}(MV)).prototype,"spriteFrame",[AV],Object.getOwnPropertyDescriptor(bV.prototype,"spriteFrame"),bV.prototype),EV=fa(bV.prototype,"_spriteFrame",[Ma],(function(){return null})),CV=fa(bV.prototype,"_mode",[Ma],(function(){return IV.SIMPLE})),xV=fa(bV.prototype,"_color",[Ma],(function(){return bn.WHITE.clone()})),wV=fa(bV.prototype,"_flipX",[Ma],(function(){return!1})),DV=fa(bV.prototype,"_flipY",[Ma],(function(){return!1})),RV=fa(bV.prototype,"_size",[Ma],(function(){return new jn})),TV=bV))||TV)||TV));var OV,LV,NV,FV,kV,VV,GV,UV,zV,HV,WV,jV,XV,YV,qV,KV,QV,ZV,JV,$V,tG,eG,iG,nG,rG,sG=new EB,oG="RICHTEXT_CHILD",aG="RICHTEXT_Image_CHILD",hG=new jn,uG=new jn,lG=new ue((function(t){if(!v.isValid(t.node))return!1;var e=t.node.getComponent(UL);return e&&(e.outlineWidth=0),!0}),20),cG=new ue((function(t){return v.isValid(t.node)}),10);function _G(t){return{node:new xg(t),comp:null,lineCount:0,styleIndex:0,imageOffset:"",clickParam:"",clickHandler:"",type:t}}function fG(t,e){var i;t===oG?i=lG._get():t===aG&&(i=cG._get());var n=(i=i||_G(t)).node;return n||(n=new xg(t)),n.hideFlags|=$s.Flags.DontSave|$s.Flags.HideInHierarchy,n.active=!0,t===aG?(i.comp=n.getComponent(GF)||n.addComponent(GF),i.comp.spriteFrame=e,i.comp.type=GF.Type.SLICED,i.comp.sizeMode=GF.SizeMode.CUSTOM):(i.comp=n.getComponent(UL)||n.addComponent(UL),i.comp.string=e,i.comp.horizontalAlign=BL.LEFT,i.comp.verticalAlign=OL.TOP,i.comp.underlineHeight=2),n.setPosition(0,0,0),n._uiProps.uiTransformComp.setAnchorPoint(.5,.5),i.node=n,i.lineCount=0,i.styleIndex=0,i.imageOffset="",i.clickParam="",i.clickHandler="",i}var dG,pG=t("i",(OV=Ta("cc.RichText"),LV=Ea(110),NV=eh(BL),FV=eh(OL),kV=eh(bn),VV=eh(BP),GV=eh(NL),UV=eh(RP),OV(zV=LV(((rG=function(t){function e(){var e;return(e=t.call(this)||this)._lineHeight=WV&&WV(),e._string=jV&&jV(),e._horizontalAlign=XV&&XV(),e._verticalAlign=YV&&YV(),e._fontSize=qV&&qV(),e._fontColor=KV&&KV(),e._maxWidth=QV&&QV(),e._fontFamily=ZV&&ZV(),e._font=JV&&JV(),e._isSystemFontUsed=$V&&$V(),e._userDefinedFont=tG&&tG(),e._cacheMode=eG&&eG(),e._imageAtlas=iG&&iG(),e._handleTouchEvent=nG&&nG(),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(Nm.LAYER_CHANGED,this._applyLayer,this),this.node.on(Nm.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(){for(var t,e=f(this._segments);!(t=e()).done;){var i=t.value;i.node.removeFromParent(),i.type===oG?lG.put(i):i.type===aG&&cG.put(i)}this.node.off(Nm.ANCHOR_CHANGED,this._updateRichTextPosition,this),this.node.off(Nm.LAYER_CHANGED,this._applyLayer,this)},i._addEventListeners=function(){this.node.on(Nm.TOUCH_END,this._onTouchEnded,this)},i._removeEventListeners=function(){this.node.off(Nm.TOUCH_END,this._onTouchEnded,this)},i._updateLabelSegmentTextAttributes=function(){var t=this;this._segments.forEach((function(e){t._applyTextAttribute(e)}))},i._createFontLabel=function(t){return fG(oG,t)},i._createImage=function(t){return fG(aG,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(hG,e,t),hG.x<2048)i.push(t);else for(var n=t.split("\n"),r=0;r<n.length;r++)if(this._calculateSize(hG,e,n[r]),hG.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,o=n.substring(r,s),a=n.substring(s),h=this._calculateSize(hG,e,o),u=this._calculateSize(uG,e,a),l=this._maxWidth;0===this._maxWidth&&(l=2047.9);for(var c=1*l;h.x>c;){if((s/=2)<1){s*=2;break}o=o.substring(r,s),a=n.substring(s),this._calculateSize(h,e,o)}for(var _=1e3,f=1;_&&r<t.length;){for(;_&&h.x<c;){var d=$P(a);d&&d.length>0&&(f=d[0].length),s+=f,o=n.substring(r,s),a=n.substring(s),this._calculateSize(h,e,o),_--}for(;_&&o.length>=2&&h.x>c;)s-=f,o=n.substring(r,s),this._calculateSize(h,e,o),f=1,_--;if(o.length>=2){var p=tB(o);p&&p.length>0&&o!==p[0]&&(s-=p[0].length,o=n.substring(r,s))}if(i.push(o),r=s,s+=o.length,o=n.substring(r,s),a=n.substring(s),this._calculateSize(u,e,a),this._calculateSize(h,e,o),_--,u.x<2048&&h.x<c){i.push(o),r=t.length,s=t.length,o=a,""!==a&&i.push(o);break}}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(hG,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(UL).string=i,n.styleIndex=e,this._applyTextAttribute(n);var r=n.node._uiProps.uiTransformComp.contentSize;return jn.set(t,r.x,r.y),t},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(Lp),r=function(){var r=e.value,s=r.clickHandler,o=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,o)})),t.propagationStopped=!0)},s=f(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(OO);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===oG||i.name===aG){i.parent=null;var n=_G(i.name);n.node=i,i.name===oG?(n.comp=i.getComponent(UL),lG.put(n)):(n.comp=i.getComponent(GF),cG.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!==oG&&i.name!==aG||(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(UL);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._uiProps.uiTransformComp.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),o=t.substr(r,s),a=this._measureText(i,o);if(!(this._lineOffsetX+a<=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+=a,r+=s}if(n>this._maxWidth)for(var u=eB(t,n,this._maxWidth,this._measureText(i)),l=0;l<u.length;++l){var c=u[l],_=this._addLabelSegment(c,i).node._uiProps.uiTransformComp.contentSize;this._lineOffsetX+=_.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._uiProps.uiTransformComp.setAnchorPoint(0,1);break;case"center":r.node._uiProps.uiTransformComp.setAnchorPoint(0,.5);break;default:r.node._uiProps.uiTransformComp.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(),o=1,a=s.width,h=s.height,u=e.imageWidth||0,l=e.imageHeight||0;l>0?(a*=o=l/h,h*=o):(a*=o=this._lineHeight/h,h*=o),u>0&&(a=u),this._maxWidth>0?(this._lineOffsetX+a>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=a):(this._lineOffsetX+=a,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(a,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else $(4400)}},i._updateTextDefaultColor=function(){for(var t=0;t<this._segments.length;++t){var e,i,n=this._segments[t],r=n.node.getComponent(UL);r&&(null!==(e=this._textArray[n.styleIndex])&&void 0!==e&&null!==(i=e.style)&&void 0!==i&&i.color||(r.color=this._fontColor))}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=sG.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 o=(s=this.splitLongStringApproximatelyIn2048(s,n).join("\n")).split("\n"),a=0;a<o.length;++a){var h=o[a];if(""!==h)if(i=!1,this._maxWidth>0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),o.length>1&&a<o.length-1&&this._updateLineInfo()}else e=this._addLabelSegment(h,n),this._lineOffsetX+=e.node._uiProps.uiTransformComp.width,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX),o.length>1&&a<o.length-1&&this._updateLineInfo();else{if(this._isLastComponentCR(s)&&a===o.length-1)continue;this._updateLineInfo(),i=!0}}}}i||this._linesWidth.push(this._lineOffsetX),this._maxWidth>0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+LP)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=qP(t,e);if(WP(n)||jP(n))return 1;for(var r=1,s=e+1;s<i&&!jP(n=qP(t,s))&&!WP(n);++s)r++;return r},i._updateRichTextPosition=function(){for(var t=0,e=1,i=this._lineCount,n=this.node._uiProps.uiTransformComp,r=n.anchorX,s=n.anchorY,o=0;o<this._segments.length;++o){var a=this._segments[o],h=a.lineCount;h>e&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case BL.LEFT:break;case BL.CENTER:u-=this._linesWidth[h-1]/2;break;case BL.RIGHT:u-=this._linesWidth[h-1]}var l=a.node.position;if(a.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,l.z),h===e&&(t+=a.node._uiProps.uiTransformComp.width),a.node.getComponent(GF)){var c=a.node.position.clone(),_=this._lineHeight,f=this._lineHeight*(1+LP);switch(a.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(f-_)/2;break;case.5:c.y+=f/2;break;default:c.y+=(f-_)/2}if(a.imageOffset){var d=a.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)}}a.node.position=c}var y=a.node.getComponent(UL);if(y&&y.enableOutline){var v=a.node.position.clone();v.y-=y.outlineWidth,a.node.position=v}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return bn[e]?bn[e]:(new bn).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(UL);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(UL);r||(r=t.node.addComponent(UL)),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 BP&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=f(this._segments);!(t=e()).done;)t.value.node.layer=this.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}(Lp)).HorizontalAlign=BL,rG.VerticalAlign=OL,m((HV=rG).prototype,"horizontalAlign",[NV],Object.getOwnPropertyDescriptor(HV.prototype,"horizontalAlign"),HV.prototype),m(HV.prototype,"verticalAlign",[FV],Object.getOwnPropertyDescriptor(HV.prototype,"verticalAlign"),HV.prototype),m(HV.prototype,"fontColor",[kV],Object.getOwnPropertyDescriptor(HV.prototype,"fontColor"),HV.prototype),m(HV.prototype,"font",[VV],Object.getOwnPropertyDescriptor(HV.prototype,"font"),HV.prototype),m(HV.prototype,"cacheMode",[GV],Object.getOwnPropertyDescriptor(HV.prototype,"cacheMode"),HV.prototype),m(HV.prototype,"imageAtlas",[UV],Object.getOwnPropertyDescriptor(HV.prototype,"imageAtlas"),HV.prototype),WV=fa(HV.prototype,"_lineHeight",[Ma],(function(){return 40})),jV=fa(HV.prototype,"_string",[Ma],(function(){return"<color=#00ff00>Rich</color><color=#0fffff>Text</color>"})),XV=fa(HV.prototype,"_horizontalAlign",[Ma],(function(){return BL.LEFT})),YV=fa(HV.prototype,"_verticalAlign",[Ma],(function(){return OL.TOP})),qV=fa(HV.prototype,"_fontSize",[Ma],(function(){return 40})),KV=fa(HV.prototype,"_fontColor",[Ma],(function(){return bn.WHITE.clone()})),QV=fa(HV.prototype,"_maxWidth",[Ma],(function(){return 0})),ZV=fa(HV.prototype,"_fontFamily",[Ma],(function(){return"Arial"})),JV=fa(HV.prototype,"_font",[Ma],(function(){return null})),$V=fa(HV.prototype,"_isSystemFontUsed",[Ma],(function(){return!0})),tG=fa(HV.prototype,"_userDefinedFont",[Ma],(function(){return null})),eG=fa(HV.prototype,"_cacheMode",[Ma],(function(){return NL.NONE})),iG=fa(HV.prototype,"_imageAtlas",[Ma],(function(){return null})),nG=fa(HV.prototype,"_handleTouchEvent",[Ma],(function(){return!0})),zV=HV))||zV)||zV));v.RichText=pG;var mG,gG=t("k",Ta("cc.UIMeshRenderer")(dG=Ea(110)(dG=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=eO.DISABLED,e._renderData=null,e._renderEntity=new AO(rO.DYNAMIC),e}s(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){CI.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){CI.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):$(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(Wg.MAX-11),i.recompileShaders({CC_FORCE_FORWARD_SHADING:!0},s)}},i.markForUpdateRenderData=function(){CI.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}(Lp))||dG)||dG);v.UIMeshRenderer=gG;var yG=t("m",Ta("cc.LabelOutline")(mG=Ea(110)(mG=ba(UL)(mG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(UL).enableOutline=!0},i.onDisable=function(){this.node.getComponent(UL).enableOutline=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(UL).outlineColor},set:function(t){this.node.getComponent(UL).outlineColor=t}},{key:"width",get:function(){return this.node.getComponent(UL).outlineWidth},set:function(t){this.node.getComponent(UL).outlineWidth=t}}]),e}(Lp))||mG)||mG)||mG);v.LabelOutline=yG;var vG,SG,AG,TG,bG,EG,CG=Pm.Enum.NONE|Pm.Enum.UI_3D,xG=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=CG,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=CG},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 YA(v.director.root));var o=r[s],a=this._passes[s];o.update(),e||(e=o.depthStencilState,i=0),a._initPassFromTarget(o,e,i),this._shaders[s]=a.getShaderVariant(n)}}},n(t,[{key:"inputAssembler",get:function(){return this._inputAssembler},set:function(t){this._inputAssembler=t}},{key:"descriptorSet",get:function(){return this._descriptorSet},set:function(t){this._descriptorSet=t}},{key:"visFlags",get:function(){return this._visFlags},set:function(t){this._visFlags=t}},{key:"passes",get:function(){return this._passes}},{key:"shaders",get:function(){return this._shaders}}]),t}(),wG=t("n",Ta("cc.UIStaticBatch")(vG=Ea(110)((m((SG=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 xG;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 FI.root&&FI.root.batcher2D?FI.root.batcher2D:($(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}(JO)).prototype,"color",[_h],Object.getOwnPropertyDescriptor(SG.prototype,"color"),SG.prototype),vG=SG))||vG)||vG),DG=t("o",Ta("cc.LabelShadow")(AG=Ea(110)(AG=ba(UL)(AG=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.onEnable=function(){this.node.getComponent(UL).enableShadow=!0},i.onDisable=function(){this.node.getComponent(UL).enableShadow=!1},n(e,[{key:"color",get:function(){return this.node.getComponent(UL).shadowColor},set:function(t){this.node.getComponent(UL).shadowColor=t}},{key:"offset",get:function(){return this.node.getComponent(UL).shadowOffset},set:function(t){this.node.getComponent(UL).shadowOffset=t}},{key:"blur",get:function(){return this.node.getComponent(UL).shadowBlur},set:function(t){this.node.getComponent(UL).shadowBlur=t}}]),e}(Lp))||AG)||AG)||AG),RG=t("p",Ta("cc.UIOpacity")(TG=Ea(110)(TG=Ca((bG=function(t){function e(){var e;return(e=t.call(this)||this)._parentOpacity=1,e._opacity=EG&&EG(),e}s(e,t);var i=e.prototype;return i.setEntityLocalOpacityDirtyRecursively=function(){},e.setEntityLocalOpacityDirtyRecursively=function(t,i,n,r){if(t.isValid){var s=t.getComponent(e);if(s&&r)s._parentOpacity=n;else{var o=t._uiProps.uiComp;if(o||(o=t.getComponent(JO)),o&&o.color)return o.renderEntity.colorDirty=i,s?(s._parentOpacity=n,o.renderEntity.localOpacity=n*s.opacity/255):o.renderEntity.localOpacity=n,void(o.node._uiProps.localOpacity=o.renderEntity.localOpacity);s&&(s._parentOpacity=n,n=n*s.opacity/255);for(var a=t.children,h=0,u=a.length;h<u;++h)e.setEntityLocalOpacityDirtyRecursively(a[h],i||n<1,n,r)}}},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(){var t=this.node.getParent(),i=1;t&&(this._parentOpacity=this._getParentOpacity(t),i=this._parentOpacity),e.setEntityLocalOpacityDirtyRecursively(this.node,!0,i,!1)},i._setEntityLocalOpacityRecursively=function(){},i.onEnable=function(){this.node.on(Nm.PARENT_CHANGED,this._parentChanged,this),this.node._uiProps.localOpacity=this._parentOpacity*this._opacity/255,this._setEntityLocalOpacityRecursively(this.node._uiProps.localOpacity)},i.onDisable=function(){this.node.off(Nm.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=Ni(t,0,255),this._opacity=t,this.node._uiProps.localOpacity=t/255,this.setEntityLocalOpacityDirtyRecursively(!0))}}]),e}(Lp),EG=fa(bG.prototype,"_opacity",[Ma],(function(){return 255})),TG=bG))||TG)||TG)||TG);v.MaskComponent=JF,ie(JF,"cc.MaskComponent"),v.LabelComponent=UL,ie(UL,"cc.LabelComponent"),v.LabelOutlineComponent=yG,ie(yG,"cc.LabelOutlineComponent"),v.RichTextComponent=pG,ie(pG,"cc.RichTextComponent"),v.SpriteComponent=GF,ie(GF,"cc.SpriteComponent"),v.UIModelComponent=gG,ie(gG,"cc.UIModelComponent"),v.GraphicsComponent=RF,ie(RF,"cc.GraphicsComponent"),ie(wG,"cc.UIStaticBatchComponent"),ie(RG,"cc.UIOpacityComponent"),ht(JF.prototype,"Mask",[{name:"graphics",newName:"subComp",target:JF.prototype,targetName:"Mask"}]),ht(UF,"MaskType",[{name:"RECT",newName:"GRAPHICS_RECT",target:UF,targetName:"MaskType"},{name:"ELLIPSE",newName:"GRAPHICS_ELLIPSE",target:UF,targetName:"MaskType"},{name:"IMAGE_STENCIL",newName:"SPRITE_STENCIL",target:UF,targetName:"MaskType"}]),lt(yG.prototype,"LabelOutline",[{name:"width",suggest:"Please use Label.outlineWidth instead."},{name:"color",suggest:"Please use Label.outlineColor instead."}]),lt(DG.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 IG=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 MG(t,e,i,n,r){var s=0,o=null;if(r===function(t,e,i,n){for(var r=0,s=e,o=i-n;s<i;s+=n)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,i,n)>0)for(s=e;s<i;s+=n)o=KG(s,t[s],t[s+1],o);else for(s=i-n;s>=e;s-=n)o=KG(s,t[s],t[s+1],o);return o&&jG(o,o.next)&&(QG(o),o=o.next),o}function PG(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||!jG(i,i.next)&&0!==WG(i.prev,i,i.next))i=i.next;else{if(QG(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function BG(t,e,i,n,r,s,o){if(void 0===o&&(o=0),t){!o&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=GG(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,function(t){var e=0,i=null,n=null,r=null,s=null,o=0,a=0,h=0,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e<u&&(a++,n=n.nextZ);e++);for(h=u;a>0||h>0&&n;)0===a?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,a--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(o>1)}(r)}(t,n,r,s);for(var a=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?LG(t,n,r,s):OG(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),QG(t),t=u.next,a=u.next;else if((t=u)===a){o?1===o?BG(t=NG(t,e,i),e,i,n,r,s,2):2===o&&FG(t,e,i,n,r,s):BG(PG(t),e,i,n,r,s,1);break}}}function OG(t){var e=t.prev,i=t,n=t.next;if(WG(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(zG(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&WG(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function LG(t,e,i,n){var r=t.prev,s=t,o=t.next;if(WG(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=GG(a,h,e,i,n),_=GG(u,l,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&zG(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&WG(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&zG(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&WG(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function NG(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!jG(r,s)&&XG(r,n,n.next,s)&&YG(r,s)&&YG(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),QG(n),QG(n.next),n=t=s),n=n.next}while(n!==t);return n}function FG(t,e,i,n,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&HG(o,a)){var h=qG(o,a);return o=PG(o,o.next),h=PG(h,h.next),BG(o,e,i,n,r,s),void BG(h,e,i,n,r,s)}a=a.next}o=o.next}while(o!==t)}function kG(t,e){return t.x-e.x}function VG(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,o=null;do{if(r<=i.y&&r>=i.next.y){var a=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s){if(s=a,a===n){if(r===i.y)return i;if(r===i.next.y)return i.next}o=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!o)return null;if(n===s)return o.prev;var h,u=o,l=o.x,c=o.y,_=1/0;for(i=o.next;i!==u;)n>=i.x&&i.x>=l&&zG(r<c?n:s,r,l,c,r<c?s:n,r,i.x,i.y)&&((h=Math.abs(r-i.y)/(n-i.x))<_||h===_&&i.x>o.x)&&YG(i,t)&&(o=i,_=h),i=i.next;return o}(t,e)){var i=qG(e,t);PG(i,i.next)}}function GG(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 UG(t){var e=t,i=t;do{e.x<i.x&&(i=e),e=e.next}while(e!==t);return i}function zG(t,e,i,n,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(s-a)-(r-o)*(n-a)>=0}function HG(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(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&&XG(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&YG(t,e)&&YG(e,t)&&function(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}(t,e)}function WG(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function jG(t,e){return t.x===e.x&&t.y===e.y}function XG(t,e,i,n){return!!(jG(t,e)&&jG(i,n)||jG(t,n)&&jG(i,e))||WG(t,e,i)>0!=WG(t,e,n)>0&&WG(i,n,t)>0!=WG(i,n,e)>0}function YG(t,e){return WG(t.prev,t,t.next)<0?WG(t,e,t.next)>=0&&WG(t,t.prev,e)>=0:WG(t,e,t.prev)<0||WG(t,t.next,e)<0}function qG(t,e){var i=new IG(t.i,t.x,t.y),n=new IG(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 KG(t,e,i,n){var r=new IG(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 QG(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 ZG(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=MG(t,0,r,i,!0),o=[];if(!s)return o;var a=0,h=0,u=0,l=0,c=0,_=0,f=0;if(n&&(s=function(t,e,i,n){var r,s=[],o=0,a=null;for(o=0,r=e.length;o<r;o++)(a=MG(t,e[o]*n,o<r-1?e[o+1]*n:t.length,n,!1))&&(a===a.next&&(a.steiner=!0),s.push(UG(a)));if(s.sort(kG),!i)return i;for(o=0;o<s.length;o++)VG(s[o],i),i=PG(i,i.next);return i}(t,e,s,i)),t.length>80*i){a=u=t[0],h=l=t[1];for(var d=i;d<r;d+=i)(c=t[d])<a&&(a=c),(_=t[d+1])<h&&(h=_),c>u&&(u=c),_>l&&(l=_);f=Math.max(u-a,l-h)}return BG(s,o,i,a,h,f),o}for(var JG=Math.PI,$G=Math.min,tU=Math.max,eU=Math.ceil,iU=Math.acos,nU=Math.cos,rU=Math.sin,sU=Math.atan2,oU=null,aU=null,hU=new bn,uU=[],lU=0;lU<4;lU++)uU.push(new mn);function cU(t,e,i){return t<e?e:t>i?i:t}var _U={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!aU)return null;var i=aU.getRenderDataList(),n=i[aU.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++aU.dataOffset,aU.dataOffset<i.length?n=i[aU.dataOffset]:(n=aU.requestRenderData(),i[aU.dataOffset]=n),r=n),r&&r.vertexCount<s&&r.request(e,3*e),n},stroke:function(t){bn.copy(hU,t.strokeColor),t.impl&&(this._flattenPaths(t.impl),this._expandStroke(t),t.impl.updatePathOffset=!0,this.end(t))},fill:function(t){bn.copy(hU,t.fillColor),this._expandFill(t),t.impl&&(t.impl.updatePathOffset=!0),this.end(t)},end:function(t){t.markForUpdateRenderData()},_expandStroke:function(t){var e=.5*t.lineWidth,i=t.lineCap,n=t.lineJoin,r=t.miterLimit;if(aU=t.impl){var s=function(t,e,i){var n=2*iU(t/(t+i));return tU(2,eU(e/n))}(e,JG,aU.tessTol);this._calculateJoins(aU,e,n,r);for(var o=aU.paths,a=0,h=aU.pathOffset,u=aU.pathLength;h<u;h++){var l=o[h],c=l.points.length;n===xN.ROUND?a+=2*(c+l.bevel*(s+2)+1):a+=2*(c+5*l.bevel+1),l.closed||(i===CN.ROUND?a+=2*(2*s+2):a+=12)}var _=oU=this.getRenderData(t,a);if(_){for(var f=_.vData,d=_.iData,p=aU.pathOffset,m=aU.pathLength;p<m;p++){var g=o[p],y=g.points,v=y.length,S=_.vertexStart,A=void 0,T=void 0,b=0,E=0,C=g.closed;if(C?(A=y[v-1],T=y[0],b=0,E=v):(A=y[0],T=y[1],b=1,E=v-1),T=T||A,!C){var x=new bF(T.x,T.y);x.subtract(A),x.normalize();var w=x.x,D=x.y;i===CN.BUTT?this._buttCapStart(A,w,D,e,0):i===CN.SQUARE?this._buttCapStart(A,w,D,e,e):i===CN.ROUND&&this._roundCapStart(A,w,D,e,s)}for(var R=b;R<E;++R)n===xN.ROUND?this._roundJoin(A,T,e,e,s):0!=(T.flags&(wN.PT_BEVEL|wN.PT_INNERBEVEL))?this._bevelJoin(A,T,e,e):(this._vSet(T.x+T.dmx*e,T.y+T.dmy*e,1),this._vSet(T.x-T.dmx*e,T.y-T.dmy*e,-1)),A=T,T=y[R+1];if(C){var I=8*S;this._vSet(f[I],f[I+1],1),this._vSet(f[I+8],f[I+8+1],-1)}else{var M=new bF(T.x,T.y);M.subtract(A),M.normalize();var P=M.x,B=M.y;i===CN.BUTT?this._buttCapEnd(T,P,B,e,0):i===CN.SQUARE?this._buttCapEnd(T,P,B,e,e):i===CN.ROUND&&this._roundCapEnd(T,P,B,e,s)}for(var O=_.indexStart,L=S+2,N=_.vertexStart;L<N;L++)d[O++]=L-2,d[O++]=L-1,d[O++]=L;_.indexStart=O}oU=null,aU=null}}},_expandFill:function(t){if(aU=t.impl){for(var e=aU.paths,i=0,n=aU.pathOffset,r=aU.pathLength;n<r;n++)i+=e[n].points.length;var s=oU=this.getRenderData(t,i);if(s){for(var o=s,a=o.vData,h=o.iData,u=aU.pathOffset,l=aU.pathLength;u<l;u++){var c=e[u],_=c.points,f=_.length;if(0!==f){for(var d=s.vertexStart,p=0;p<f;++p)this._vSet(_[p].x,_[p].y);var m=s.indexStart;if(c.complex){for(var g=[],y=d,v=s.vertexStart;y<v;y++){var S=8*y;g.push(a[S++]),g.push(a[S++]),g.push(a[S++])}var A=ZG(g,null,3);if(!A||0===A.length)continue;for(var T=0,b=A.length;T<b;T++)h[m++]=A[T]+d}else for(var E=d,C=d+2,x=o.vertexStart;C<x;C++)h[m++]=E,h[m++]=C-1,h[m++]=C;o.indexStart=m}}oU=null,aU=null}}},_calculateJoins:function(t,e,i,n){var r=0;e>0&&(r=1/e);for(var s=t.paths,o=t.pathOffset,a=t.pathLength;o<a;o++){var h=s[o],u=h.points,l=u.length,c=u[l-1],_=u[0];h.bevel=0;for(var f=0;f<l;f++){var d,p,m=c.dy,g=-c.dx,y=_.dy,v=-_.dx;if(_.dmx=.5*(m+y),_.dmy=.5*(g+v),(d=_.dmx*_.dmx+_.dmy*_.dmy)>1e-6){var S=1/d;S>600&&(S=600),_.dmx*=S,_.dmy*=S}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=wN.PT_LEFT),d*(p=tU(11,$G(c.len,_.len)*r))*p<1&&(_.flags|=wN.PT_INNERBEVEL),_.flags&wN.PT_CORNER&&(d*n*n<1||i===xN.BEVEL||i===xN.ROUND)&&(_.flags|=wN.PT_BEVEL),0!=(_.flags&(wN.PT_BEVEL|wN.PT_INNERBEVEL))&&h.bevel++,c=_,_=u[f+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i<n;i++){var r=e[i],s=r.points,o=s[s.length-1],a=s[0];s.length>2&&o.equals(a)&&(r.closed=!0,s.pop(),o=s[s.length-1]);for(var h=0,u=s.length;h<u;h++){var l=new bF(a.x,a.y);l.subtract(o),o.len=l.length(),(l.x||l.y)&&l.normalize(),o.dx=l.x,o.dy=l.y,o=a,a=s[h+1]}}},_chooseBevel:function(t,e,i,n){var r=i.x,s=i.y,o=0,a=0,h=0,u=0;return 0!==t?(o=r+e.dy*n,a=s-e.dx*n,h=r+i.dy*n,u=s-i.dx*n):(o=h=r+i.dmx*n,a=u=s+i.dmy*n),[o,a,h,u]},_buttCapStart:function(t,e,i,n,r){var s=t.x-e*r,o=t.y-i*r,a=i,h=-e;this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1)},_buttCapEnd:function(t,e,i,n,r){var s=t.x+e*r,o=t.y+i*r,a=i,h=-e;this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1)},_roundCapStart:function(t,e,i,n,r){for(var s=t.x,o=t.y,a=i,h=-e,u=0;u<r;u++){var l=u/(r-1)*JG,c=nU(l)*n,_=rU(l)*n;this._vSet(s-a*c-e*_,o-h*c-i*_,1),this._vSet(s,o,0)}this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1)},_roundCapEnd:function(t,e,i,n,r){var s=t.x,o=t.y,a=i,h=-e;this._vSet(s+a*n,o+h*n,1),this._vSet(s-a*n,o-h*n,-1);for(var u=0;u<r;u++){var l=u/(r-1)*JG,c=nU(l)*n,_=rU(l)*n;this._vSet(s,o,0),this._vSet(s-a*c+e*_,o-h*c+i*_,1)}},_roundJoin:function(t,e,i,n,r){var s=t.dy,o=-t.dx,a=e.dy,h=-e.dx,u=e.x,l=e.y;if(0!=(e.flags&wN.PT_LEFT)){var c=this._chooseBevel(e.flags&wN.PT_INNERBEVEL,t,e,i),_=c[0],f=c[1],d=c[2],p=c[3],m=sU(-o,-s),g=sU(-h,-a);g>m&&(g-=2*JG),this._vSet(_,f,1),this._vSet(u-s*n,e.y-o*n,-1);for(var y=cU(eU((m-g)/JG)*r,2,r),v=0;v<y;v++){var S=m+v/(y-1)*(g-m),A=u+nU(S)*n,T=l+rU(S)*n;this._vSet(u,l,0),this._vSet(A,T,-1)}this._vSet(d,p,1),this._vSet(u-a*n,l-h*n,-1)}else{var b=this._chooseBevel(e.flags&wN.PT_INNERBEVEL,t,e,-n),E=b[0],C=b[1],x=b[2],w=b[3],D=sU(o,s),R=sU(h,a);R<D&&(R+=2*JG),this._vSet(u+s*n,l+o*n,1),this._vSet(E,C,-1);for(var I=cU(eU((R-D)/JG)*r,2,r),M=0;M<I;M++){var P=D+M/(I-1)*(R-D),B=u+nU(P)*i,O=l+rU(P)*i;this._vSet(B,O,1),this._vSet(u,l,0)}this._vSet(u+a*n,l+h*n,1),this._vSet(x,w,-1)}},_bevelJoin:function(t,e,i,n){var r=0,s=0,o=0,a=0,h=0,u=0,l=0,c=0,_=t.dy,f=-t.dx,d=e.dy,p=-e.dx;if(e.flags&wN.PT_LEFT){var m=this._chooseBevel(e.flags&wN.PT_INNERBEVEL,t,e,i);h=m[0],u=m[1],l=m[2],c=m[3],this._vSet(h,u,1),this._vSet(e.x-_*n,e.y-f*n,-1),this._vSet(l,c,1),this._vSet(e.x-d*n,e.y-p*n,-1)}else{var g=this._chooseBevel(e.flags&wN.PT_INNERBEVEL,t,e,-n);r=g[0],s=g[1],o=g[2],a=g[3],this._vSet(e.x+_*i,e.y+f*i,1),this._vSet(r,s,-1),this._vSet(e.x+d*i,e.y+p*i,1),this._vSet(o,a,-1)}},_vSet:function(t,e,i){if(void 0===i&&(i=0),oU){var n=oU,r=8*n.vertexStart,s=n.vData;s[r++]=t,s[r++]=e,s[r++]=0,bn.toArray(s,hU,r),r+=4,s[r++]=i,n.vertexStart++}}},fU=t("g",{getAssembler:function(){return _U}});RF.Assembler=fU;var dU=["left","center","right"],pU=2048,mU=(1/255).toFixed(3),gU=function(){this.char="",this.valid=!0,this.x=0,this.y=0,this.line=0,this.hash=""},yU=function(){function t(){this._context=null,this._canvas=null,this._canvasData=null,this._lettersInfo=[],this._tmpRect=new Zn,this._maxFontSize=100,this._fontScale=1,this._canvasData=MB.getInstance().get(),this._canvas=this._canvasData.canvas,this._context=this._canvasData.context}var e=t.prototype;return e.destroy=function(){MB.getInstance().put(this._canvasData),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),FB.fontScale=this._fontScale,this._setupBMFontOverflowMetrics(i,n),this._updateFontScale(e),this._computeHorizontalKerningForText(e,i,r),this._alignText(e,i,n,r);else{var o=0;for(this._fontScale=this._getStyleFontScale(e.fontSize,e.fontScale),this._updatePaddingRect(e,n),this._calculateLabelFont(e,i,n,r);(n.canvasSize.width>pU||n.canvasSize.height>pU)&&o<=3;){if(++o>3)this._fontScale=1;else{var a=Math.max(n.canvasSize.width,n.canvasSize.height),h=pU/a;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,o){t?(this._computeAlignmentOffset(e,i,n),this.generateVertexData(t,e,i,n,r,s,o)):(this._updateLabelDimensions(e,i,n),this._updateTexture(e,i,n,r),this.generateVertexData(t,e,i,n,r,s,o))},e.setCanvasUsed=function(t,e){this._canvas=t,this._context=e},e._getStyleFontScale=function(t,e){var i=e;return i*t>this._maxFontSize&&t<this._maxFontSize&&(i=this._maxFontSize/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,o=this._getFontDesc(t.actualFontSize,t.fontFamily,t.isBold,t.isItalic);switch(this._context.font=t.fontDesc=o,e.overFlow){case LL.NONE:for(var a=0,h=0;h<r.length;++h){var u=XP(this._context,r[h],o);a=a>u?a:u}var l=a,c=(s.length+LP)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=l+i.canvasPadding.width*this._fontScale,i.canvasSize.height=c+i.canvasPadding.height*this._fontScale,i.nodeContentSize.width=(l+i.contentSizeExtend.width*this._fontScale)/this._fontScale,i.nodeContentSize.height=(c+i.contentSizeExtend.height*this._fontScale)/this._fontScale;break;case LL.SHRINK:this._calculateShrinkFont(r,t,e,i),this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case LL.CLAMP:this._calculateWrapText(r,t,e,i),i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=i.nodeContentSize.height*this._fontScale;break;case LL.RESIZE_HEIGHT:this._calculateWrapText(r,t,e,i);var _=(i.parsedString.length+LP)*this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);i.canvasSize.width=i.nodeContentSize.width*this._fontScale,i.canvasSize.height=_+i.canvasPadding.height*this._fontScale,i.nodeContentSize.height=(_+i.contentSizeExtend.height*this._fontScale)/this._fontScale}}},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),o=0,a=0,h=0,u=e.actualFontSize;if(i.wrapping){var l=n.nodeContentSize.width*this._fontScale,c=n.nodeContentSize.height*this._fontScale;if(l<0||c<0)return;a=c+1;for(var _=0,f=0|e.actualFontSize+1,d=0;_<f;){if((d=_+f+1>>1)<=0){K(4003);break}u=d,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r;var p=this._getLineHeight(i.lineHeight,u,e.fontSize);for(a=0,o=0;o<t.length;++o){var m=XP(this._context,t[o],r);a+=eB(t[o],m,l,this._measureText(this._context,r)).length*p}a>c?f=d-1:_=d}0===_?K(4003):(u=_,r=this._getFontDesc(u,e.fontFamily,e.isBold,e.isItalic),this._context.font=r)}else{for(a=t.length*this._getLineHeight(i.lineHeight,u,e.fontSize),o=0;o<t.length;++o)h<s[o]&&(h=s[o]);var g=(n.canvasSize.width-n.canvasPadding.width)*this._fontScale/h,y=n.canvasSize.height*this._fontScale/a;u=e.actualFontSize*Math.min(1,g,y)|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,o=this._getFontDesc(e.actualFontSize,e.fontFamily,e.isBold,e.isItalic);this._context.font=o;for(var a=0;a<t.length;++a){var h=XP(this._context,t[a],o),u=eB(t[a],h,s,this._measureText(this._context,o));r=r.concat(u)}n.parsedString=r,e.fontDesc=o}},e._measureText=function(t,e){return function(i){return XP(t,i,e)}},e._calculateParagraphLength=function(t,e,i){for(var n,r=[],s=f(t);!(n=s()).done;){var o=XP(e,n.value,i);r.push(o)}return r},e._updatePaddingRect=function(t,e){var i=0,n=0,r=0,s=0,o=0;if(e.contentSizeExtend.width=e.contentSizeExtend.height=0,t.isOutlined&&(i=n=r=s=o=t.outlineWidth,e.contentSizeExtend.width=e.contentSizeExtend.height=2*o),t.hasShadow){var a=t.shadowBlur+o,h=t.shadowOffsetX,u=t.shadowOffsetY;r=Math.max(r,-h+a),s=Math.max(s,h+a),i=Math.max(i,u+a),n=Math.max(n,-u+a)}if(t.isItalic){var l=t.fontSize*Math.tan(.20943951);s+=l,e.contentSizeExtend.width+=l}e.canvasPadding.x=r,e.canvasPadding.y=i,e.canvasPadding.width=r+s,e.canvasPadding.height=i+n},e._updateLabelDimensions=function(t,e,i){i.canvasSize.width=Math.min(i.canvasSize.width,pU),i.canvasSize.height=Math.min(i.canvasSize.height,pU),this._canvas.width=i.canvasSize.width,this._canvas.height=i.canvasSize.height,this._context.font=t.fontDesc,this._context.textAlign=dU[e.horizontalAlign],this._context.textBaseline="alphabetic"},e._calculateFillTextStartPosition=function(t,e,i){var n=0;e.horizontalAlign===BL.RIGHT?n=i.canvasSize.width-i.canvasPadding.width:e.horizontalAlign===BL.CENTER&&(n=(i.canvasSize.width-i.canvasPadding.width)/2);var r=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize)*(i.parsedString.length-1),s=t.actualFontSize*(1-LP/2);if(e.verticalAlign!==OL.TOP){var o=r+i.canvasPadding.height+t.actualFontSize-i.canvasSize.height;e.verticalAlign===OL.BOTTOM?s-=o+=LP/2*t.actualFontSize:s-=o/2}s+=0*t.actualFontSize,i.startPosition.set(n+i.canvasPadding.x,s+i.canvasPadding.y)},e._updateTexture=function(t,e,i,n){if(this._context&&this._canvas){this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.font=t.fontDesc,this._calculateFillTextStartPosition(t,e,i);var r=this._getLineHeight(e.lineHeight,t.actualFontSize,t.fontSize);this._context.lineJoin="round",t.isOutlined?(this._context.fillStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+mU+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)):(this._context.fillStyle="rgba("+t.color.r+", "+t.color.g+", "+t.color.b+", "+mU+")",this._context.fillRect(0,0,this._canvas.width,this._canvas.height)),this._context.fillStyle="rgb("+t.color.r+", "+t.color.g+", "+t.color.b+")";var s=new jn(i.startPosition.x,i.startPosition.y),o=s.x,a=0;this._drawTextEffect(s,r,t,e,i);for(var h=0;h<i.parsedString.length;++h)a=s.y+h*r,t.hasShadow&&(this._setupShadow(t),this._context.fillText(i.parsedString[h],o,a)),t.isOutlined&&(this._setupOutline(t),this._context.strokeText(i.parsedString[h],o,a)),t.hasShadow&&!t.isOutlined||this._context.fillText(i.parsedString[h],o,a);t.hasShadow&&(this._context.shadowColor="transparent"),this._uploadTexture(n)}},e._uploadTexture=function(t){var e;t.texture&&this._canvas&&(e=t.texture instanceof wP?t.texture.texture:t.texture,0!==this._canvas.width&&0!==this._canvas.height&&(e.getGFXTexture(),e.getGFXSampler(),e.reset({width:this._canvas.width,height:this._canvas.height,mipmapLevel:1}),e.uploadData(this._canvas),e.setWrapMode(Vd.CLAMP_TO_EDGE,Vd.CLAMP_TO_EDGE),t.texture instanceof wP&&(t.texture.rect=new Zn(0,0,this._canvas.width,this._canvas.height),t.texture._calculateUV()),v.director.root&&v.director.root.batcher2D&&v.director.root.batcher2D._releaseDescriptorSetCache(e.getHash())))},e._drawTextEffect=function(t,e,i,n,r){if(i.hasShadow||i.isOutlined||i.isUnderline){for(var s=r.parsedString.length>1&&i.hasShadow,o=this._measureText(this._context,i.fontDesc),a=0,h=0,u=0;u<r.parsedString.length;++u)if(a=t.x,h=t.y+u*e,s&&(i.hasShadow&&(this._setupShadow(i),this._context.fillText(r.parsedString[u],a,h)),i.isOutlined&&(this._setupOutline(i),this._context.strokeText(r.parsedString[u],a,h)),i.hasShadow&&!i.isOutlined||this._context.fillText(r.parsedString[u],a,h)),i.isUnderline){var l=o(r.parsedString[u]),c=new jn;n.horizontalAlign===BL.RIGHT?c.x=t.x-l:n.horizontalAlign===BL.CENTER?c.x=t.x-l/2:c.x=t.x,c.y=h+i.actualFontSize/8,this._context.fillRect(c.x,c.y,l,i.underlineHeight*this._fontScale)}s&&(this._context.shadowColor="transparent")}},e._setupOutline=function(t){this._context.shadowBlur=0,this._context.shadowOffsetX=0,this._context.shadowOffsetY=0,this._context.strokeStyle="rgba("+t.outlineColor.r+", "+t.outlineColor.g+", "+t.outlineColor.b+", "+t.outlineColor.a/255+")",this._context.lineWidth=2*t.outlineWidth*this._fontScale},e._setupShadow=function(t){var e=this._fontScale;this._context.shadowColor="rgba("+t.shadowColor.r+", "+t.shadowColor.g+", "+t.shadowColor.b+", "+t.shadowColor.a/255+")",this._context.shadowBlur=t.shadowBlur*e,this._context.shadowOffsetX=t.shadowOffsetX*e,this._context.shadowOffsetY=-t.shadowOffsetY*e},e.generateVertexData=function(t,e,i,n,r,s,o){t?this._updateQuads(e,i,n,r,s,o):(this.updateQuatCount(r),o(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:bn.WHITE.clone()});e.length=i}},e._setupBMFontOverflowMetrics=function(t,e){var i=e.nodeContentSize.width,n=e.nodeContentSize.height;t.overFlow===LL.RESIZE_HEIGHT&&(n=0),t.overFlow===LL.NONE&&(i=0,n=0),t.textWidthTemp=i,t.textHeightTemp=n,t.textDimensions.width=i,t.textDimensions.height=n,t.maxLineWidth=i},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,o=e.horizontalKerning;if(s&&0!==s.length)for(var a=-1,h=0;h<r;++h){var u=n.charCodeAt(h),l=s[a<<16|65535&u]||0;o[h]=h<r-1?l:0,a=u}}},e._alignText=function(t,e,i,n){this._multilineTextWrap(t,e,i,n,this._getFirstWordLen),e.overFlow===LL.SHRINK&&(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,o=YP(e);r<o;++r){var a=this._lettersInfo[r];a.valid&&(s===a.line?n+=a.char:(i=i.concat(n),s=a.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,o=s.length,a=0,h=0,u=0,l=0,c=0,_=0,f=0,d=null,p=0;p<o;){var m=qP(s,p);if("\n"!==m){for(var g=r(t,e,s,p,o),y=_,v=f,S=c,A=h,T=!1,b=new jn,E=0;E<g;++E){var C=p+E;if("\r"!==(m=qP(s,C)))if(d=FB.fontAtlas.getLetterDefinitionForChar(m,FB)){var x=A+d.offsetX*t.bmfontScale-FB.margin;if(e.wrapping&&e.maxLineWidth>0&&h>0&&x+d.w*t.bmfontScale>e.maxLineWidth&&!jP(m)){e.linesWidth.push(c),c=0,a++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,T=!0;break}b.x=x,b.y=u-d.offsetY*t.bmfontScale,this._recordLetterInfo(b,m,C,a),C+1<e.horizontalKerning.length&&C<o-1&&(A+=e.horizontalKerning[C+1]*t.bmfontScale),A+=d.xAdvance*t.bmfontScale+e.spacingX,S=b.x+d.w*t.bmfontScale,y<b.y&&(y=b.y),v>b.y-d.h*t.bmfontScale&&(v=b.y-d.h*t.bmfontScale)}else this._recordPlaceholderInfo(C,m),null!=t.fntConfig?K(16354,t.fntConfig.atlasName,m):K(16355,t.fontFamily,m);else this._recordPlaceholderInfo(C,m)}T||(h=A,_<y&&(_=y),f>v&&(f=v),l<(c=S)&&(l=c),p+=g)}else e.linesWidth.push(c),c=0,a++,h=0,u-=e.lineHeight*this._getFontScale(t,e)+0,this._recordPlaceholderInfo(p,m),p++}return e.linesWidth.push(c),e.numberOfLines=a+1,e.textDesiredHeight=e.numberOfLines*e.lineHeight*this._getFontScale(t,e),e.numberOfLines>1&&(e.textDesiredHeight+=0*(e.numberOfLines-1)),i.nodeContentSize.width=e.textWidthTemp,i.nodeContentSize.height=e.textHeightTemp,e.textWidthTemp<=0&&(i.nodeContentSize.width=parseFloat(l.toFixed(2))+2*FB.margin),e.textHeightTemp<=0&&(i.nodeContentSize.height=parseFloat(e.textDesiredHeight.toFixed(2))+2*FB.margin),e.tailoredTopY=i.nodeContentSize.height,e.tailoredBottomY=0,_>0&&(e.tailoredTopY=i.nodeContentSize.height+_),f<-e.textDesiredHeight&&(e.tailoredBottomY=e.textDesiredHeight+f),!0},e._recordPlaceholderInfo=function(t,e){if(t>=this._lettersInfo.length){var i=new gU;this._lettersInfo.push(i)}this._lettersInfo[t].char=e,this._lettersInfo[t].hash=""+KP(e,0)+FB.hash,this._lettersInfo[t].valid=!1},e._recordLetterInfo=function(t,e,i,n){if(i>=this._lettersInfo.length){var r=new gU;this._lettersInfo.push(r)}var s=""+KP(e,0)+FB.hash;this._lettersInfo[i].line=n,this._lettersInfo[i].char=e,this._lettersInfo[i].hash=s,this._lettersInfo[i].valid=FB.fontAtlas.getLetter(s).valid,this._lettersInfo[i].x=t.x,this._lettersInfo[i].y=t.y},e._getFirstWordLen=function(t,e,i,n,r){var s=qP(i,n);if(WP(s)||"\n"===s||jP(s))return 1;var o=1,a=FB.fontAtlas.getLetterDefinitionForChar(s,FB);if(!a)return o;for(var h=a.xAdvance*t.bmfontScale+e.spacingX,u=n+1;u<r&&(s=qP(i,u),a=FB.fontAtlas.getLetterDefinitionForChar(s,FB));++u){if(h+a.offsetX*t.bmfontScale+a.w*t.bmfontScale>e.maxLineWidth&&!jP(s)&&e.maxLineWidth>0)return o;if(h+=a.xAdvance*t.bmfontScale+e.spacingX,"\n"===s||jP(s)||WP(s))break;o++}return o},e._computeAlignmentOffset=function(t,e,i){switch(e.linesOffsetX.length=0,e.letterOffsetY=0,e.horizontalAlign){case BL.LEFT:for(var n=0;n<e.numberOfLines;++n)e.linesOffsetX.push(0);break;case BL.CENTER:for(var r=0,s=e.linesWidth.length;r<s;r++)e.linesOffsetX.push((i.nodeContentSize.width-e.linesWidth[r])/2);break;case BL.RIGHT:for(var o=0,a=e.linesWidth.length;o<a;o++)e.linesOffsetX.push(i.nodeContentSize.width-e.linesWidth[o])}if(e.letterOffsetY=i.nodeContentSize.height,e.verticalAlign!==OL.TOP){var h=i.nodeContentSize.height-e.textDesiredHeight+e.lineHeight*this._getFontScale(t,e)-t.originFontSize*this._fontScale*t.bmfontScale;e.verticalAlign===OL.BOTTOM?e.letterOffsetY-=h:e.letterOffsetY-=h/2}},e._getFontScale=function(t,e){return e.overFlow===LL.SHRINK?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,o=0,a=YP(n);o<a;++o){var h=r._lettersInfo[o];if(h.valid){var u=FB.fontAtlas.getLetterDefinitionForChar(h.char,FB);if(!u)continue;var l=h.x+u.w*t.bmfontScale,c=h.line;if(e.textWidthTemp>0)if(e.wrapping){if(e.linesWidth[c]>i.nodeContentSize.width&&(l>i.nodeContentSize.width||l<0)){s=!0;break}}else if(l>i.nodeContentSize.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,o=0|t.actualFontSize,a=0;s<o;){var h=a=s+o+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)?o=a-1:s=a}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 o=t.spriteFrame?t.spriteFrame.texture:FB.fontAtlas.getTexture(),a=n.uiTransAnchorX*i.nodeContentSize.width,h=n.uiTransAnchorY*i.nodeContentSize.height,u=0,l=YP(r);u<l;++u){var c=this._lettersInfo[u];if(c.valid){var _=FB.fontAtlas.getLetter(c.hash);if(_){this._tmpRect.height=_.h,this._tmpRect.width=_.w,this._tmpRect.x=_.u,this._tmpRect.y=_.v;var f=c.y+e.letterOffsetY;if(e.textHeightTemp>0){if(f>e.tailoredTopY){var d=f-e.tailoredTopY;this._tmpRect.y+=d,this._tmpRect.height-=d,f-=d}f-this._tmpRect.height*t.bmfontScale<e.tailoredBottomY&&e.overFlow===LL.CLAMP&&(this._tmpRect.height=f<e.tailoredBottomY?0:(f-e.tailoredBottomY)/t.bmfontScale)}var p=c.line,m=c.x+_.w/2*t.bmfontScale+e.linesOffsetX[p];if(e.textWidthTemp>0&&this._isHorizontalClamped(e,i,m,p)&&e.overFlow===LL.CLAMP&&(this._tmpRect.width=0),this._tmpRect.height>0&&this._tmpRect.width>0){var g=this._determineRect(t),y=c.x+e.linesOffsetX[c.line],v=n.quadCount;n.quadCount+=4,this.updateQuatCount(n),s(t,i,n,v,o,this._tmpRect,g,y-a,f-h)}}else $(16353)}}return!0},e._isHorizontalClamped=function(t,e,i,n){var r=t.linesWidth[n],s=i>e.nodeContentSize.width||i<0;return t.wrapping?r>e.nodeContentSize.width&&s:s},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(),o=s.x+(n.width-r.width)/2,a=s.y-(n.height-r.height)/2;if(i){var h=this._tmpRect.x;this._tmpRect.x=r.x+r.height-this._tmpRect.y-this._tmpRect.height-a,this._tmpRect.y=h+r.y-o,this._tmpRect.y<0&&(this._tmpRect.height+=a)}else this._tmpRect.x+=r.x-o,this._tmpRect.y+=r.y+a;return i},t}();yU.instance=void 0,yU.instance=new yU;var vU=new NB(64,64),SU=new xB(null),AU=null,TU=null,bU=null,EU=null,CU=null,xU={updateProcessingData:function(t,e,i,n,r,s){t.fontSize=r.fontSize,t.actualFontSize=r.fontSize,t.originFontSize=bU?bU.fontSize:r.fontSize,e.horizontalAlign=r.horizontalAlign,e.verticalAlign=r.verticalAlign,e.spacingX=r.spacingX;var o=r.overflow;e.overFlow=o,e.lineHeight=r.lineHeight,i.nodeContentSize.width=s.width,i.nodeContentSize.height=s.height,o===LL.NONE?(e.wrapping=!1,i.nodeContentSize.width+=2*FB.margin,i.nodeContentSize.height+=2*FB.margin):o===LL.RESIZE_HEIGHT?(e.wrapping=!0,i.nodeContentSize.height+=2*FB.margin):e.wrapping=r.enableWrapText,n.uiTransAnchorX=s.anchorX,n.uiTransAnchorY=s.anchorY,FB.lineHeight=r.lineHeight,FB.fontSize=r.fontSize,t.spriteFrame=EU,t.fntConfig=bU,t.fontFamily=FB.fontFamily,t.color.set(r.color)},updateRenderData:function(t){if(t.renderData&&AU!==t){if(t.renderData.vertDirty){TU=(AU=t).node._uiProps.uiTransformComp;var e=t.renderData,i=yU.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,o=t.textRenderData;n.fontScale=wM.getScaleX(),this._updateFontFamily(t),this.updateProcessingData(n,r,s,o,t,TU),this._updateLabelInfo(t),n.fontDesc=FB.fontDesc,i.processingString(!0,n,r,s,t.string),o.quadCount=0,i.generateRenderInfo(!0,n,r,s,o,t.string,this.generateVertexData),e.dataLength!==o.quadCount&&(this.resetRenderData(t),e.dataLength=o.quadCount,e.resize(e.dataLength,e.dataLength/2*3));for(var a=e.data,h=0,u=o.quadCount;h<u;h++)a[h]=o.vertexBuffer[h];var l=e.indexCount;this.createQuadIndices(l),e.chunk.setIndexBuffer(CU),AU.actualFontSize=n.actualFontSize,TU.setContentSize(s.nodeContentSize),this.updateUVs(t),e.vertDirty=!1,AU=null,this._resetProperties()}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},updateUVs:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.vertexCount,r=e.data,s=3,o=0;o<n;o++){var a=r[o];i[s]=a.u,i[s+1]=a.v,s+=9}},updateColor:function(){},resetRenderData:function(t){var e=t.renderData;e.dataLength=0,e.resize(0,0)},generateVertexData:function(t,e,i,n,r,s,o,a,h){var u=n,l=t.bmfontScale,c=i.vertexBuffer,_=r.width,f=r.height,d=s.width,p=s.height,m=0,g=0,y=0,v=0;o?(m=s.x/_,v=(s.x+p)/_,g=(s.y+d)/f,y=s.y/f,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/_,v=(s.x+d)/_,g=(s.y+p)/f,y=s.y/f,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=a,c[u].y=h-p*l,c[u+1].x=a+d*l,c[u+1].y=h-p*l,c[u+2].x=a,c[u+2].y=h,c[u+3].x=a+d*l,c[u+3].y=h},_updateFontFamily:function(t){var e=t.font;EU=e.spriteFrame,bU=e.fntConfig,FB.fontAtlas=e.fontDefDictionary,FB.fontAtlas||(t.cacheMode===NL.CHAR?FB.fontAtlas=vU:FB.fontAtlas=SU),OM.packToDynamicAtlas(t,EU)},_updateLabelInfo:function(){FB.hash="",FB.margin=0},_resetProperties:function(){bU=null,EU=null,FB.hash="",FB.margin=0},createQuadIndices:function(t){if(t%6==0){var e=t/6;CU=new Uint16Array(t);for(var i=0,n=0;n<e;n++)CU[i++]=0+4*n,CU[i++]=1+4*n,CU[i++]=2+4*n,CU[i++]=1+4*n,CU[i++]=3+4*n,CU[i++]=2+4*n}else et(16308)}},wU=new bn(255,255,255,255),DU={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){var e=t.node;wU.set(t.color),wU.a=255*e._uiProps.opacity,sd(e,0,t.renderData,wU)},appendQuad:function(t,e,i,n,r,s,o){var a=t.renderData;if(a){var h=a.dataLength;a.dataLength+=4,a.resize(a.dataLength,a.dataLength/2*3);var u=a.data,l=e.width,c=e.height,_=i.width,f=i.height,d=0,p=0,m=0,g=0;n?(d=i.x/l,g=(i.x+f)/l,p=(i.y+_)/c,m=i.y/c,u[h].u=d,u[h].v=m,u[h+1].u=d,u[h+1].v=p,u[h+2].u=g,u[h+2].v=m,u[h+3].u=g,u[h+3].v=p):(d=i.x/l,g=(i.x+_)/l,p=(i.y+f)/c,m=i.y/c,u[h].u=d,u[h].v=p,u[h+1].u=g,u[h+1].v=p,u[h+2].u=d,u[h+2].v=m,u[h+3].u=g,u[h+3].v=m),u[h].x=r,u[h].y=s-f*o,u[h+1].x=r+_*o,u[h+1].y=s-f*o,u[h+2].x=r,u[h+2].y=s,u[h+3].x=r+_*o,u[h+3].y=s}}};Wt(DU,xU);var RU=null,IU=jt(xU,{getAssemblerData:function(){return RU||(RU=new NB(1024,1024)),RU.getTexture()},_updateFontFamily:function(t){FB.fontAtlas=RU,FB.fontFamily=this._getFontFamily(t),t.enableOutline&&t.outlineWidth>0?(FB.isOutlined=!0,FB.margin=t.outlineWidth,FB.out=t.outlineColor.clone(),FB.out.a=t.outlineColor.a*t.color.a/255):(FB.isOutlined=!1,FB.margin=0)},_getFontFamily:function(t){var e="Arial";return t.useSystemFont?e=t.fontFamily||"Arial":t.font&&(e=t.font._nativeAsset||"Arial"),e},_updateLabelInfo:function(t){FB.fontDesc=this._getFontDesc(),FB.color=t.color,FB.hash=function(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}(FB)},_getFontDesc:function(){return FB.fontSize.toString()+"px "+FB.fontFamily}}),MU=new bn(255,255,255,255),PU={createData:function(t){var e=t.requestRenderData();return e.resize(0,0),e},fillBuffers:function(t){if(t.renderData){var e=t.node;MU.a=255*e._uiProps.opacity,sd(e,0,t.renderData,MU)}},updateColor:function(){}};Wt(PU,IU);var BU=UL.Overflow,OU={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,r.overflow===BU.NONE?e.wrapping=!1:r.overflow===BU.RESIZE_HEIGHT?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||!Li(r.shadowOffset.x,0)||!Li(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},getAssemblerData:function(){var t=UL._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&UL._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp,i=yU.instance,n=t.textStyle,r=t.textLayout,s=t.textLayoutData,o=t.textRenderData;n.fontScale=wM.getScaleX(),this.updateProcessingData(n,r,s,o,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,o,t.string,this.generateVertexData);var a=t.renderData;a.textureDirty=!0,this._calDynamicAtlas(t,s),t.actualFontSize=n.actualFontSize,e.setContentSize(s.nodeContentSize);var h=a.data;h[0]=o.vertexBuffer[0],h[1]=o.vertexBuffer[1],h[2]=o.vertexBuffer[2],h[3]=o.vertexBuffer[3],this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=s.nodeContentSize.width}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},generateVertexData:function(t,e,i){var n=i.vertexBuffer,r=e.nodeContentSize.width,s=e.nodeContentSize.height,o=i.uiTransAnchorX*r,a=i.uiTransAnchorY*s;n[0].x=-o,n[0].y=-a,n[1].x=r-o,n[1].y=-a,n[2].x=-o,n[2].y=s-a,n[3].x=r-o,n[3].y=s-a},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){return t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_calDynamicAtlas:function(t,e){if(!(t.cacheMode!==UL.CacheMode.BITMAP||e.canvasSize.width<=0||e.canvasSize.height<=0)){var i=t.ttfSpriteFrame;OM.packToDynamicAtlas(t,i)}},_resetDynamicAtlas:function(t){if(t.cacheMode===UL.CacheMode.BITMAP){var e=t.ttfSpriteFrame;OM.deleteAtlasSpriteFrame(e),e._resetDynamicAtlasFrame()}}},LU=bn.WHITE.clone(),NU=Uint16Array.from([0,1,2,1,3,2]),FU={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),t.textRenderData.quadCount=4;var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)bn.toArray(i,LU,n),n+=9;return e.chunk.setIndexBuffer(NU),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,o=r.worldMatrix,a=e.floatStride,h=0,u=n.length,l=0;l<u;l++){var c=n[l],_=c.x,f=c.y,d=o.m03*_+o.m07*f+o.m15;d=d?1/d:1,s[0+(h=l*a)]=(o.m00*_+o.m04*f+o.m12)*d,s[h+1]=(o.m01*_+o.m05*f+o.m13)*d,s[h+2]=(o.m02*_+o.m06*f+o.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},updateVertexData:function(t){var e=t.renderData;if(e){var i=t.node._uiProps.uiTransformComp,n=i.width,r=i.height,s=i.anchorX*n,o=i.anchorY*r,a=e.data;a[0].x=-s,a[0].y=-o,a[1].x=n-s,a[1].y=-o,a[2].x=-s,a[2].y=r-o,a[3].x=n-s,a[3].y=r-o}},updateUVs:function(t){var e=t.renderData;if(e&&t.ttfSpriteFrame){var i=e.chunk.vb,n=t.ttfSpriteFrame.uv;i[3]=n[0],i[4]=n[1],i[12]=n[2],i[13]=n[3],i[21]=n[4],i[22]=n[5],i[30]=n[6],i[31]=n[7]}},updateColor:function(){}};Wt(FU,OU);var kU=t("l",{getAssembler:function(t){var e=FU;return t.font instanceof wB?e=DU:t.cacheMode===UL.CacheMode.CHAR&&(e=PU),e}});UL.Assembler=kU;var VU=GF.FillType,GU=new Vn,UU=Uint16Array.from([0,1,2,1,3,2]),zU={updateRenderData:function(t){var e=t.spriteFrame;OM.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)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,o=n.height,a=n.rect,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0;switch(n.isRotated()?(h=a.x/s,u=(a.y+a.width)/o,l=_=h,d=m=(a.x+a.height)/s,f=g=u,c=p=a.y/o):(h=a.x/s,u=(a.y+a.height)/o,l=d=h,_=m=(a.x+a.width)/s,c=f=u,p=g=a.y/o),t.fillType){case VU.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(f-c)*e,r[12]=l+(_-l)*i,r[13]=c+(f-c)*i,r[21]=d+(m-d)*e,r[22]=p+(g-p)*e,r[30]=d+(m-d)*i,r[31]=p+(g-p)*i;break;case VU.VERTICAL:r[3]=l+(d-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=f+(g-f)*e,r[21]=l+(d-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=f+(g-f)*i;break;default:et(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,o=r.height,a=r.anchorX*s,h=r.anchorY*o,u=-a,l=-h,c=s-a,_=o-h,f=0;switch(t.fillType){case VU.HORIZONTAL:f=u+(c-u)*i,u+=(c-u)*e,c=f;break;case VU.VERTICAL:f=l+(_-l)*i,l+=(_-l)*e,_=f;break;default:et(2626)}n[0].x=u,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=u,n[2].y=_,n[3].x=c,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(UU);for(var i,n=f(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(GU);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,o=0;o<4;o++){var a=n[o],h=a.x,u=a.y,l=GU.m03*h+GU.m07*u+GU.m15;l=l?1/l:1,r[s=o*i]=(GU.m00*h+GU.m04*u+GU.m12)*l,r[s+1]=(GU.m01*h+GU.m05*u+GU.m13)*l,r[s+2]=(GU.m02*h+GU.m06*u+GU.m14)*l}},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,o=r.indexOffset;s[o++]=n,s[o++]=n+1,s[o++]=n+2,s[o++]=n+2,s[o++]=n+1,s[o++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,o=s.r/255,a=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=o,i[r+1]=a,i[r+2]=h,i[r+3]=u,r+=n}},HU=2*Math.PI,WU=1e-6,jU=new Vn,XU=[new jn,new jn,new jn,new jn],YU=new Array(4),qU=new Array(8),KU=[new jn,new jn,new jn,new jn],QU=[new jn,new jn,new jn,new jn],ZU=new jn,JU=[new jn,new jn,new jn,new jn],$U=null;function tz(t,e,i,n,r,s,o){var a=Math.sin(s);a=Math.abs(a)>WU?a:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>WU?h:0)){if(u=a/h,(t-r.x)*h>0){var c=r.y+u*(t-r.x);o[0].x=t,o[0].y=c}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);o[2].x=e,o[2].y=_}}if(0!==a){if(l=h/a,(n-r.y)*a>0){var f=r.x+l*(n-r.y);o[3].x=f,o[3].y=n}if((i-r.y)*a>0){var d=r.x+l*(i-r.y);o[1].x=d,o[1].y=i}}}function ez(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 iz(t,e,i,n,r){var s=YU,o=s[0],a=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,nz((i.x-o)/(h-o),(i.y-a)/(u-a),t,e),nz((n.x-o)/(h-o),(n.y-a)/(u-a),t,e+1),nz((r.x-o)/(h-o),(r.y-a)/(u-a),t,e+2)}function nz(t,e,i,n){var r=qU,s=r[0]+(r[2]-r[0])*t,o=r[4]+(r[6]-r[4])*t,a=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(o-s)*e,u.v=a+(h-a)*e}for(var rz={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;OM.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 o=(r*=HU)+(s*=HU);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,o=-r,a=-s,h=i-r,u=n-s,l=YU;l[0]=o,l[1]=a,l[2]=h,l[3]=u;var c=t.fillCenter,_=ZU.x=Math.min(Math.max(0,c.x),1)*(h-o)+o,f=ZU.y=Math.min(Math.max(0,c.y),1)*(u-a)+a;XU[0].x=XU[3].x=o,XU[1].x=XU[2].x=h,XU[0].y=XU[1].y=a,XU[2].y=XU[3].y=u;for(var d=0,p=JU;d<p.length;d++){var m=p[d];jn.set(m,0,0)}_!==l[0]&&jn.set(JU[0],3,0),_!==l[2]&&jn.set(JU[2],1,2),f!==l[1]&&jn.set(JU[1],0,1),f!==l[3]&&jn.set(JU[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,o=0,a=0,h=qU;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,o=n.y/i,a=(n.y+n.width)/i,h[0]=h[2]=r,h[4]=h[6]=s,h[3]=h[7]=a,h[1]=h[5]=o):(r=n.x/e,s=(n.x+n.width)/e,o=n.y/i,a=(n.y+n.height)/i,h[0]=h[4]=r,h[2]=h[6]=s,h[1]=h[3]=a,h[5]=h[7]=o)}(e),tz(YU[0],YU[2],YU[1],YU[3],ZU,r,KU),tz(YU[0],YU[2],YU[1],YU[3],ZU,r+s,QU);for(var a=0,h=0;h<4;++h){var u=JU[h];if(u)if(s>=HU)i.dataLength=a+3,iz(n,a,ZU,XU[u.x],XU[u.y]),a+=3;else{var l=ez(ZU,XU[u.x]),c=ez(ZU,XU[u.y]);c<l&&(c+=HU),l-=HU,c-=HU;for(var _=0;_<3;++_)l>=o||(l>=r?(i.dataLength=a+3,iz(n,a,ZU,XU[u.x],c>=o?QU[h]:XU[u.y]),a+=3):c>r&&(c<=o?(i.dataLength=a+3,iz(n,a,ZU,KU[h],XU[u.y]),a+=3):(i.dataLength=a+3,iz(n,a,ZU,KU[h],QU[h]),a+=3))),l+=HU,c+=HU}}0===a&&(i.dataLength=0),i.resize(a,a),i.updateRenderData(t,e)}},createQuadIndices:function(t){$U=null,$U=new Uint16Array(t);for(var e=0,i=0;i<t;i++)$U[e++]=i},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,o=n.meshBuffer.iData,a=s.indexOffset,h=0;h<i.indexCount;h++)o[a+h]=r+h;s.indexOffset+=i.indexCount,s.setDirty()},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 o=s*i;r[o+3]=n[s].u,r[o+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(jU);for(var i=t.renderData,n=i.floatStride,r=t.renderData.data,s=e.vb,o=i.vertexCount,a=0,h=0;h<o;h++){var u=r[h],l=u.x,c=u.y,_=jU.m03*l+jU.m07*c+jU.m15;_=_?1/_:1,s[a+0]=(jU.m00*l+jU.m04*c+jU.m12)*_,s[a+1]=(jU.m01*l+jU.m05*c+jU.m13)*_,s[a+2]=(jU.m02*l+jU.m06*c+jU.m14)*_,s[a+3]=u.u,s[a+4]=u.v,a+=n}},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},updateColorLate:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,o=t.color,a=o.r/255,h=o.g/255,u=o.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=a,i[s+1]=h,i[s+2]=u,i[s+3]=l,s+=n},updateColor:function(){}},sz=Uint16Array.from([0,1,2,1,3,2]),oz={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(4,6),e.chunk.setIndexBuffer(sz),e},updateRenderData:function(t){var e=t.spriteFrame;OM.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},updateWorldVerts:function(t,e){for(var i=t.renderData,n=e.vb,r=i.data,s=t.node.worldMatrix,o=s.m00,a=s.m01,h=s.m02,u=s.m03,l=s.m04,c=s.m05,_=s.m06,f=s.m07,d=s.m12,p=s.m13,m=s.m14,g=s.m15,y=i.floatStride,v=0,S=r.length,A=0;A<S;++A){var T=r[A],b=T.x,E=T.y,C=u*b+f*E+g;C=C?1/C:1,n[0+(v=A*y)]=(o*b+l*E+d)*C,n[v+1]=(a*b+c*E+p)*C,n[v+2]=(h*b+_*E+m)*C}},fillBuffers:function(t){if(null!==t){var e=t.renderData,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,o=r.indexOffset,a=n;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2,r.indexOffset+=6}},updateVertexData:function(t){var e=t.renderData;if(e){var i=t.node._uiProps.uiTransformComp,n=e.data,r=i.width,s=i.height,o=i.anchorX*r,a=i.anchorY*s,h=0,u=0,l=0,c=0;if(t.trim)h=-o,u=-a,l=r-o,c=s-a;else{var _=t.spriteFrame,f=_.originalSize,d=r/f.width,p=s/f.height,m=_.trimmedBorder;h=m.x*d-o,u=m.z*p-a,l=r+m.y*d-o,c=s+m.w*p-a}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}},updateUVs:function(t){if(t.spriteFrame){var e=t.renderData.chunk.vb,i=t.spriteFrame.uv;e[3]=i[0],e[4]=i[1],e[12]=i[2],e[13]=i[3],e[21]=i[4],e[22]=i[5],e[30]=i[6],e[31]=i[7]}},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=5,r=t.color,s=r.r/255,o=r.g/255,a=r.b/255,h=r.a/255,u=0;u<4;u++,n+=e.floatStride)i[n]=s,i[n+1]=o,i[n+2]=a,i[n+3]=h}},az=[],hz=0;hz<4;hz++)az.push({x:0,y:0,z:0,u:0,v:0,color:new bn});var uz,lz,cz,_z,fz,dz,pz,mz={createData:function(t){var e=t.requestRenderData();return e.dataLength=16,e.resize(16,54),this.QUAD_INDICES=new Uint16Array(54),this.createQuadIndices(4,4),e.chunk.setIndexBuffer(this.QUAD_INDICES),e},createQuadIndices:function(t,e){for(var i=0,n=0;n<t-1;n++)for(var r=0;r<e-1;r++){var s=n*e+r;this.QUAD_INDICES[i++]=s,this.QUAD_INDICES[i++]=s+1,this.QUAD_INDICES[i++]=s+e,this.QUAD_INDICES[i++]=s+1,this.QUAD_INDICES[i++]=s+1+e,this.QUAD_INDICES[i++]=s+e}},updateRenderData:function(t){var e=t.spriteFrame;OM.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;i&&e&&(i.vertDirty&&this.updateVertexData(t),i.updateRenderData(t,e))},updateVertexData:function(t){var e=t.renderData,i=e.data,n=t.node._uiProps.uiTransformComp,r=n.width,s=n.height,o=n.anchorX*r,a=n.anchorY*s,h=t.spriteFrame,u=h.insetLeft,l=h.insetRight,c=h.insetTop,_=h.insetBottom,f=r-u-l,d=s-c-_,p=r/(u+l),m=s/(c+_);p=Number.isNaN(p)||p>1?1:p,m=Number.isNaN(m)||m>1?1:m,f=f<0?0:f,d=d<0?0:d,az[0].x=-o,az[0].y=-a,az[1].x=u*p-o,az[1].y=_*m-a,az[2].x=az[1].x+f,az[2].y=az[1].y+d,az[3].x=r-o,az[3].y=s-a;for(var g=0;g<4;g++)for(var y=0;y<4;y++){var v=4*g+y;v<e.dataLength&&g<az.length&&y<az.length&&(i[v].x=az[y].x,i[v].y=az[g].y)}},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;for(var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,o=r.indexOffset,a=0;a<3;++a)for(var h=0;h<3;++h){var u=n+4*a+h;s[o++]=u,s[o++]=u+1,s[o++]=u+4,s[o++]=u+1,s[o++]=u+5,s[o++]=u+4}r.indexOffset=o},updateWorldVertexData:function(t,e){for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,o=t.node.worldMatrix,a=o.m00,h=o.m01,u=o.m02,l=o.m03,c=o.m04,_=o.m05,f=o.m06,d=o.m07,p=o.m12,m=o.m13,g=o.m14,y=o.m15,v=0,S=0;S<4;++S)for(var A=r[4*S],T=0;T<4;++T){var b=r[T].x,E=A.y,C=l*b+d*E+y;C=C?1/C:1,s[0+(v=(4*S+T)*n)]=(a*b+c*E+p)*C,s[v+1]=(h*b+_*E+m)*C,s[v+2]=(u*b+f*E+g)*C}},updateUVs:function(t){if(t.spriteFrame)for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=t.spriteFrame.uvSliced,s=3,o=0;o<16;o++)i[s]=r[o].u,i[s+1]=r[o].v,s+=n},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,o=s.r/255,a=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<16;l++)i[r]=o,i[r+1]=a,i[r+2]=h,i[r+3]=u,r+=n}},gz=new Vn,yz=0,vz=[],Sz=null;function Az(t){return t&&(t.insetTop>0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var Tz={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),o=i.getRect(),a=i.insetLeft,h=i.insetRight,u=o.width-a-h,l=i.insetTop,c=i.insetBottom,_=o.height-l-c,f=r-a-h,d=s-l-c;f=f>0?f:0,d=d>0?d:0;var p=0===u?f:f/u,m=0===_?d:d/_,g=Az(i),y=Math.ceil(m+g),v=Math.ceil(p+g);e.dataLength=4*y*v,this.updateVerts(t,f,d,y,v),e.vertexCount!==y*v*4&&(t.renderEntity.colorDirty=!0),e.resize(y*v*4,y*v*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;Sz=new Uint16Array(t);for(var i=0,n=0;n<e;n++)Sz[i++]=0+4*n,Sz[i++]=1+4*n,Sz[i++]=2+4*n,Sz[i++]=1+4*n,Sz[i++]=3+4*n,Sz[i++]=2+4*n}else et(16308)},updateUVs:function(t){t.renderData.vertDirty=!0,t.markForUpdateRenderData()},fillBuffers:function(t){var e=t.node,i=t.renderData,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,o=n.meshBuffer.iData,a=s.indexOffset,h=0;h<i.indexCount;h+=6)o[a++]=r,o[a++]=r+1,o[a++]=r+2,o[a++]=r+1,o[a++]=r+3,o[a++]=r+2,r+=4,s.indexOffset+=6;s.setDirty()}},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 o=s*i;r[o+3]=n[s].u,r[o+4]=n[s].v}},updateWorldVertexAndUVData:function(t,e){t.node.getWorldMatrix(gz);for(var i=t.renderData,n=i.floatStride,r=i.data,s=e.vb,o=r.length,a=0;a<o;a++){var h=r[a].x,u=r[a].y,l=r[a].z,c=gz.m03*h+gz.m07*u+gz.m11*l+gz.m15;c=c?1/c:1;var _=a*n;s[_]=(gz.m00*h+gz.m04*u+gz.m08*l+gz.m12)*c,s[_+1]=(gz.m01*h+gz.m05*u+gz.m09*l+gz.m13)*c,s[_+2]=(gz.m02*h+gz.m06*u+gz.m10*l+gz.m14)*c}this.updateWorldUVData(t)},updateVerts:function(t,e,i,n,r){var s,o,a=t.node._uiProps.uiTransformComp,h=t.renderData.data,u=t.spriteFrame,l=u.rect,c=Math.abs(a.width),_=Math.abs(a.height),f=a.anchorX*c,d=a.anchorY*_,p=u.insetLeft,m=u.insetRight,g=l.width-p-m,y=u.insetTop,v=u.insetBottom,S=l.height-y-v,A=a.width/(p+m)>1?1:a.width/(p+m),T=a.height/(y+v)>1?1:a.height/(y+v);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,o=S>0?Math.floor(1e3*i)/1e3%S==0?S:i%S:i,vz.length=0,yz=Math.max(n+1,r+1);for(var b=0;b<yz;b++)vz.push({x:0,y:0,z:0,u:0,v:0,color:new bn});var E=Az(u);if(0===E)for(var C=0;C<yz;C++)vz[C].x=C>=r?c-f:C*g-f,vz[C].y=C>=n?_-d:C*S-d;else for(var x=0;x<yz;x++)0===x?vz[x].x=-f:1===x?vz[x].x=p*A-f:x>1&&x<r-1?vz[x].x=g>0?p*A-f+g*(x-1):p+e-f:x===r-1?vz[x].x=p*A-f+s+g*(x-2):x>=r&&(vz[x].x=Math.min(p+e+m,c)-f),0===x?vz[x].y=-d:1===x?vz[x].y=v*T-d:x>1&&x<n-1?vz[x].y=S>0?v*T-d+S*(x-1):v+i-d:x===n-1?vz[x].y=v*T-d+o+S*(x-2):x>=n&&(vz[x].y=Math.min(v+i+y,_)-d);for(var w=0,D=0,R=0,I=0,M=0;M<n;++M){R=vz[M].y,I=vz[M+1].y;for(var P=0;P<r;++P){w=vz[P].x,D=vz[P+1].x;var B=4*(M*r+P);h[B].x=w,h[B].y=R,h[B+1].x=D,h[B+1].y=R,h[B+2].x=w,h[B+2].y=I,h[B+3].x=D,h[B+3].y=I}}var O=u.rotated;u.uv;var L=u.uvSliced;uz=L[0],lz=L[1],cz=L[2],_z=L[3],fz=L[4],dz=L[8],pz=L[12];for(var N=0,F=0,k=0===g?e:e/g,V=0===S?i:i/S,G=[],U=[],z=0;z<n;++z){F=i>S?i>=(E>0?z:z+1)*S?1:V%1:V;for(var H=0;H<r;++H){N=e>g?e>=(E>0?H:H+1)*g?1:k%1:k,O?(0===E?(G[0]=fz.u,G[1]=fz.u,G[2]=fz.u+(dz.u-fz.u)*F,U[0]=lz.v,U[1]=lz.v+(cz.v-lz.v)*N,U[2]=lz.v):(0===z?(G[0]=uz.u,G[1]=uz.u,G[2]=fz.u):z<n-1?(G[0]=fz.u,G[1]=fz.u,G[2]=fz.u+(dz.u-fz.u)*F):z===n-1&&(G[0]=dz.u,G[1]=dz.u,G[2]=pz.u),0===H?(U[0]=uz.v,U[1]=lz.v,U[2]=uz.v):H<r-1?(U[0]=lz.v,U[1]=lz.v+(cz.v-lz.v)*N,U[2]=lz.v):H===r-1&&(U[0]=cz.v,U[1]=_z.v,U[2]=cz.v)),G[3]=G[2],U[3]=U[1]):(0===E?(G[0]=lz.u,G[1]=lz.u+(cz.u-lz.u)*N,G[2]=lz.u,U[0]=fz.v,U[1]=fz.v,U[2]=fz.v+(dz.v-fz.v)*F):(0===H?(G[0]=uz.u,G[1]=lz.u,G[2]=uz.u):H<r-1?(G[0]=lz.u,G[1]=lz.u+(cz.u-lz.u)*N,G[2]=lz.u):H===r-1&&(G[0]=cz.u,G[1]=_z.u,G[2]=cz.u),0===z?(U[0]=uz.v,U[1]=uz.v,U[2]=fz.v):z<n-1?(U[0]=fz.v,U[1]=fz.v,U[2]=fz.v+(dz.v-fz.v)*F):z===n-1&&(U[0]=dz.v,U[1]=dz.v,U[2]=pz.v)),G[3]=G[1],U[3]=U[2]);var W=4*(z*r+H);h[W].u=G[0],h[W].v=U[0],h[W+1].u=G[1],h[W+1].v=U[1],h[W+2].u=G[2],h[W+2].v=U[2],h[W+3].u=G[3],h[W+3].v=U[3]}}},updateColorLate:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=e.vertexCount,s=5,o=t.color,a=o.r/255,h=o.g/255,u=o.b/255,l=t.node._uiProps.opacity,c=0;c<r;c++)i[s]=a,i[s+1]=h,i[s+2]=u,i[s+3]=l,s+=n},updateColor:function(){}},bz=GF.Type,Ez=GF.FillType,Cz=t("s",{getAssembler:function(t){var e=oz,i=t;switch(i.type){case bz.SLICED:e=mz;break;case bz.TILED:e=Tz;break;case bz.FILLED:e=i.fillType===Ez.RADIAL?rz:zU}return e}});GF.Assembler=Cz;var xz=[jw.EventType.MOUSE_DOWN,jw.EventType.MOUSE_MOVE,jw.EventType.MOUSE_UP,jw.EventType.MOUSE_WHEEL,jw.EventType.MOUSE_LEAVE,jw.EventType.MOUSE_ENTER],wz=[jw.EventType.TOUCH_START,jw.EventType.TOUCH_MOVE,jw.EventType.TOUCH_END,jw.EventType.TOUCH_CANCEL];new(function(){function t(){this.priority=Fw.UI,this._isListDirty=!1,this._inDispatchCount=0,this._pointerEventProcessorList=[],this._processorListToAdd=[],this._processorListToRemove=[],Xw._registerEventDispatcher(this),CR.callbacksInvoker.on(yR.ADD_POINTER_EVENT_PROCESSOR,this.addPointerEventProcessor,this),CR.callbacksInvoker.on(yR.REMOVE_POINTER_EVENT_PROCESSOR,this.removePointerEventProcessor,this),CR.callbacksInvoker.on(yR.MARK_LIST_DIRTY,this._markListDirty,this)}var e=t.prototype;return e.onThrowException=function(){this._inDispatchCount=0},e.dispatchEvent=function(t){var e=t.type;return wz.includes(e)?this.dispatchEventTouch(t):!xz.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),fe(this._processorListToRemove,t)},e.removePointerEventProcessor=function(t){0===this._inDispatchCount?(fe(this._pointerEventProcessorList,t),this._isListDirty=!0):this._processorListToRemove.includes(t)||this._processorListToRemove.push(t),fe(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 o=e[s];if(o.isEnabled&&o.shouldHandleEventTouch)if(t.type===nw.TOUCH_START){if(o._handleEventTouch(t)){if(o.isEnabled)o.claimedTouchIdList.push(n.getID());else{var a=new uw([t.touch],!0,nw.TOUCH_CANCEL);a.touch=t.touch,o.dispatchEvent(a),o.claimedTouchIdList.length=0}if(r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}else if(o.claimedTouchIdList.length>0){var h=o.claimedTouchIdList.indexOf(n.getID());if(-1!==h){if(o._handleEventTouch(t),t.type!==nw.TOUCH_END&&t.type!==nw.TOUCH_CANCEL||(ce(o.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],o=s.claimedTouchIdList.indexOf(e);-1!==o&&ce(s.claimedTouchIdList,o)}},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._uiProps.uiTransformComp;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._uiProps.uiTransformComp))return-1;if(!(t&&i&&i.activeInHierarchy&&i._uiProps.uiTransformComp))return 1;if(t.cachedCameraPriority!==e.cachedCameraPriority)return e.cachedCameraPriority-t.cachedCameraPriority;for(var r=i,s=n,o=!1;(null===(a=r.parent)||void 0===a?void 0:a.uuid)!==(null===(h=s.parent)||void 0===h?void 0:h.uuid);){var a,h,u,l,c,_;r=null===(null===(u=r)||void 0===u||null===(l=u.parent)||void 0===l?void 0:l.parent)?(o=!0)&&n:r&&r.parent,s=null===(null===(c=s)||void 0===c||null===(_=c.parent)||void 0===_?void 0:_.parent)?(o=!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 f=r?r.getSiblingIndex():0,d=s?s.getSiblingIndex():0;return o?f-d:d-f},e._markListDirty=function(){this._isListDirty=!0},t}());var Dz=new ef(null),Rz=new Vn,Iz=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 oT,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 Pz,this._meshDataArray=[],this._maskClearModel=null,this._maskClearMtl=null,this._maskModelMesh=null,this._root=t,this.device=t.device,this._batches=new Qs(64),this._drawBatchPool=new qs((function(){return new xG}),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=f(this._bufferAccessors.values());!(e=i()).done;)e.value.destroy();this._bufferAccessors.clear(),this._drawBatchPool&&this._drawBatchPool.destroy(),this._descriptorSetCache.destroy(),uO.sharedManager.destroy(),this._maskClearModel&&this._maskModelMesh&&(v.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 o=this._batches.array[e];if(o.model)for(var a=o.model.subModels,h=0;h<a.length;h++)a[h].priority=s++;else o.descriptorSet=this._descriptorSetCache.getDescriptorSet(o);r.addBatch(o)}}}},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=f(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=f(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(),uO.sharedManager.reset()},e.switchBufferAccessor=function(t){void 0===t&&(t=GB);var e=t===GB?36:jB(t);if(!this._staticVBBuffer||this._staticVBBuffer.vertexFormatBytes!==e){var i=this._bufferAccessors.get(e);i||(i=new tO(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,o=0,a=-1;if(e&&e.chunk){if(!e.isValid())return;o=e.dataHash,s=e.material,a=e.chunk.bufferId}t.stencilStage===eO.ENTER_LEVEL||t.stencilStage===eO.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=uO.sharedManager.stage;var h=t.stencilStage;this._currHash===o&&0!==o&&this._currMaterial===s&&this._currDepthStencilStateStage===h||(this.autoMergeBatches(this._currComponent),e&&!e._isMeshBuffer&&this.updateBuffer(e.vertexFormat,a),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(t,this)},e.commitIA=function(t,e,i,n,r){this._currMaterial!==this._emptyMaterial&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates());var s=null,o=0;t&&(t.stencilStage=uO.sharedManager.stage,s=null!==t.customMaterial?uO.sharedManager.getStencilStage(t.stencilStage,n):uO.sharedManager.getStencilStage(t.stencilStage),o=uO.sharedManager.getStencilHash(t.stencilStage));var a=this._currStaticRoot?this._currStaticRoot._requireDrawBatch():this._drawBatchPool.alloc();a.visFlags=t.node.layer,a.inputAssembler=e,a.useLocalData=r||null,i&&(a.texture=i.getGFXTexture(),a.sampler=i.getGFXSampler(),a.textureHash=i.getHash(),a.samplerHash=a.sampler.hash),a.fillPasses(n||null,s,o,null),this._batches.push(a)},e.commitMiddleware=function(t,e,i,n,r,s,o){var a=r.getGFXTexture();o&&this._middlewareEnableBatch&&this._middlewareBuffer===e&&this._currTexture===a&&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=a,this._currSampler=r.getGFXSampler(),this._currTextureHash=r.getHash(),this._currLayer=t.node.layer,this._currSamplerHash=this._currSampler.hash,this._currHash=0,this._currTransform=o?null:t.node,this._middlewareEnableBatch=o,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&&(t.stencilStage===eO.ENTER_LEVEL||t.stencilStage===eO.ENTER_LEVEL_INVERTED?this._insertMaskBatch(t):t.stencilStage=uO.sharedManager.stage,n=uO.sharedManager.getStencilStage(t.stencilStage,i),r=uO.sharedManager.getStencilHash(t.stencilStage));var s=v.director.getTotalFrames();e&&(e.updateTransform(s),e.updateUBOs(s));for(var o=0;o<e.subModels.length;o++){var a=this._drawBatchPool.alloc(),h=e.subModels[o];a.visFlags=t.node.layer,a.model=e,a.texture=null,a.sampler=null,a.useLocalData=null,n||(n=null),a.fillPasses(i,n,r,h.patches),a.inputAssembler=h.inputAssembler,a.model.visFlags=a.visFlags,a.descriptorSet=h.descriptorSet,this._batches.push(a)}},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,o=r.getMeshBuffer(s);if(!o)return;var a=o.indexOffset-this._indexStart;if(a<=0)return;this._indexStart,o.indexOffset,o.setDirty(),(i=o.requireFreeIA(this.device)).firstIndex=this._indexStart,i.indexCount=a,this._indexStart=o.indexOffset}if(this._currBID=-1,i&&this._currTexture){var h=null,u=0;t&&(h=null!==t.customMaterial?uO.sharedManager.getStencilStage(t.stencilStage,e):uO.sharedManager.getStencilStage(t.stencilStage),u=uO.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=uO.sharedManager.stage,i=null!==t.customMaterial?uO.sharedManager.getStencilStage(t.stencilStage,this._currMaterial):uO.sharedManager.getStencilStage(t.stencilStage),e=uO.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,o=s,a=r&&r.color?r.color.a/255:1;if(this._pOpacity=o*=a*n.localOpacity,n.setOpacity(o),!Li(o,0,Bi)){if(n.colorDirty&&this._opacityDirty++,r&&r.enabledInHierarchy&&r.fillBuffers(this),this._opacityDirty&&r&&!r.useVertexOpacity&&r.renderData&&r.renderData.vertexCount>0){!function(t,e){for(var i,n,r,s=t.vertexFormat,o=t.chunk.vb,a=0,h=0;h<s.length;++h){if(i=s[h],(n=ff[i.format]).hasAlpha)if(r=t.floatStride,n.size/n.count==1)for(var u=~~Ni(Math.round(255*e),0,255),l=a;l<o.length;l+=r)o[l]=(4294967040&o[l]|u)>>>0;else if(n.size/n.count==4)for(var c=a+3;c<o.length;c+=r)o[c]=e;a+=n.size>>2}}(r.renderData,o);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),(r.stencilStage===eO.ENTER_LEVEL||r.stencilStage===eO.ENTER_LEVEL_INVERTED)&&uO.sharedManager.getMaskStackSize()>0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),uO.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=UA.get("default-clear-stencil"),this._maskClearModel=v.director.root.createModel(ND);var t=jB(kB),e=nd.gfxDevice,i=e.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,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 E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,6*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new jI([i],kB,Yc.TRIANGLE_LIST,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=uO.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 o=this._maskClearModel,a=v.director.getTotalFrames();o&&(o.updateTransform(a),o.updateUBOs(a));for(var h=0;h<o.subModels.length;h++){var u=this._drawBatchPool.alloc(),l=o.subModels[h];u.visFlags=t.node.layer,u.model=o,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}()),Mz=function(){function t(){this._descriptorSet=null,this._transform=null,this._textureHash=0,this._samplerHash=0,this._localBuffer=null,this._transformUpdate=!0;var t=nd.gfxDevice;this._localData=new Float32Array(vy.COUNT),this._localBuffer=t.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,vy.SIZE,vy.SIZE))}var e=t.prototype;return e.initialize=function(t){var e=nd.gfxDevice;this._transform=t.useLocalData,this._textureHash=t.textureHash,this._samplerHash=t.samplerHash,Dz.layout=t.passes[0].localSetLayout,this._descriptorSet=e.createDescriptorSet(Dz),this._descriptorSet.bindBuffer(vy.BINDING,this._localBuffer);var i=Kg.SAMPLER_SPRITE;this._descriptorSet.bindTexture(i,t.texture),this._descriptorSet.bindSampler(i,t.sampler),this._descriptorSet.update(),this._transformUpdate=!0},e.updateTransform=function(t){t!==this._transform&&(this._transform=t,this._transformUpdate=!0,this.uploadLocalData())},e.equals=function(t,e,i){return this._transform===t&&this._textureHash===e&&this._samplerHash===i},e.reset=function(){this._transform=null,this._textureHash=0,this._samplerHash=0},e.destroy=function(){this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=null),this._descriptorSet&&(this._descriptorSet.destroy(),this._descriptorSet=null),this._localData=null},e.isValid=function(){return this._transform&&this._transform.isValid},e.uploadLocalData=function(){var t=this._transform;if((t.hasChangedFlags||t.isTransformDirty())&&(t.updateWorldTransform(),this._transformUpdate=!0),this._transformUpdate){var e=t.worldMatrix;Vn.toArray(this._localData,e,vy.MAT_WORLD_OFFSET),Vn.invert(Rz,e),Vn.transpose(Rz,Rz);var i=Vn.determinant(Rz),n=1/Math.sqrt(i);Vn.multiplyScalar(Rz,Rz,n),Vn.toArray(this._localData,Rz,vy.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData),this._transformUpdate=!1}},n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}}]),t}(),Pz=function(){function t(){this._descriptorSetCache=new Map,this._dsCacheHashByTexture=new Map,this._localDescriptorSetCache=[],this._localCachePool=new qs((function(){return new Mz}),16,(function(t){return t.destroy()}))}var e=t.prototype;return e.getDescriptorSet=function(t){if(v.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.descriptorSet}var s=this._localCachePool.alloc();return s.initialize(t),this._localDescriptorSetCache.push(s),s.descriptorSet}var o=t.textureHash^t.samplerHash;if(this._descriptorSetCache.has(o))return this._descriptorSetCache.get(o);Dz.layout=t.passes[0].localSetLayout;var a=nd.gfxDevice.createDescriptorSet(Dz),h=Kg.SAMPLER_SPRITE;return a.bindTexture(h,t.texture),a.bindSampler(h,t.sampler),a.update(),this._descriptorSetCache.set(o,a),this._dsCacheHashByTexture.set(t.textureHash,o),a},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 o=i.length-1;o>=0;o--){var a=i[o],h=t[a];t.splice(a,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=f(this._descriptorSetCache.values());!(t=e()).done;)t.value.destroy();this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();v.internal.Batcher2D=Iz,t("y",function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(xG)),lt(QB.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),ht(QB.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),ut(QB.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),ht(Iz.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),ut(CO.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),ht(CO.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("Q",function(t){function e(e){var i;return i=t.call(this,e)||this,$(9006),i}return s(e,t),e}(CO)),v.UI={MeshBuffer:QB,spriteAssembler:Cz,graphicsAssembler:fU,labelAssembler:kU,RenderData:EO,MeshRenderData:CO},MM.on(IM.EVENT_POST_SUBSYSTEM_INIT,(function(){Vz.init()}));var Bz,Oz,Lz,Nz,Fz,kz,Vz=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):et(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):et(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 et(2106),0},t.isLayerValid=function(t){return!!this.indexMap.has(t)||(et(2105),!1)},t.getBuiltinLayers=function(){return[{id:0,name:"default",value:0}]},t.init=function(){var e=Me.querySettings(Re.Category.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}be.update(t.Enum),be.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}());Vz.nameMap=new Map,Vz.indexMap=new Map,Vz.Enum=be({default:0}),t("a7",(Bz=Ta("cc.Sorting"),Oz=eh(Vz.Enum),Bz(Lz=Ca((m((Nz=function(t){function e(){var e;return(e=t.call(this)||this)._sortingLayer=Fz&&Fz(),e._sortingOrder=kz&&kz(),e._modelRenderer=null,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._modelRenderer=this.getComponent("cc.ModelRenderer"),this._modelRenderer||$(16301,this.node.name),this._updateSortingPriority()},i._updateSortingPriority=function(){var t=Vz.getLayerIndex(this._sortingLayer),e=Vz.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&&Vz.isLayerValid(t)&&(this._sortingLayer=t,this._updateSortingPriority())}},{key:"sortingOrder",get:function(){return this._sortingOrder},set:function(t){t!==this._sortingOrder&&(this._sortingOrder=Ni(t,-32768,32767),this._updateSortingPriority())}}]),e}(Lp)).prototype,"sortingLayer",[Oz],Object.getOwnPropertyDescriptor(Nz.prototype,"sortingLayer"),Nz.prototype),Fz=fa(Nz.prototype,"_sortingLayer",[Ma],(function(){return Vz.Enum.default})),kz=fa(Nz.prototype,"_sortingOrder",[Ma],(function(){return 0})),Lz=Nz))||Lz)||Lz));var Gz,Uz,zz,Hz,Wz,jz,Xz,Yz,qz,Kz,Qz,Zz,Jz,$z,tH,eH,iH,nH,rH,sH,oH,aH,hH,uH,lH,cH,_H,fH,dH,pH,mH,gH,yH,vH,SH,AH,TH,bH,EH,CH,xH,wH,DH=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}(ND),RH=Ta,IH=Ea,MH=eh,PH=Pa,BH=Ma,OH=zA("specular-pass");function LH(t){var e=t.passes,i=v.rendering;Rv()&&(OH=i.getPhaseID(i.getPassID("specular-pass"),"default"));for(var n=0;n<e.length;n++)if((!i||!i.enableEffectImport)&&e[n].phase===OH||Rv()&&e[n].phaseID===OH)return n;return-1}var NH,FH,kH,VH,GH,UH,zH,HH,WH=be({OFF:0,ON:1}),jH=be({OFF:0,ON:1}),XH=(Gz=RH("cc.ModelBakeSettings"),Uz=PH("_recieveShadow"),zz=MH(ei),Hz=MH(ni),Wz=MH(ni),jz=MH(be(bD)),Xz=MH(ni),Gz(((sH=function(t){function e(){var e;return(e=t.call(this)||this).texture=Kz&&Kz(),e.uvParam=Qz&&Qz(),e._bakeable=Zz&&Zz(),e._castShadow=Jz&&Jz(),e._receiveShadow=$z&&$z(),e._lightmapSize=tH&&tH(),e._useLightProbe=eH&&eH(),e._bakeToLightProbe=iH&&iH(),e._reflectionProbeType=nH&&nH(),e._bakeToReflectionProbe=rH&&rH(),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(e.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(e.REFLECTION_PROBE_CHANGED)}},{key:"bakeToReflectionProbe",get:function(){return this._bakeToReflectionProbe},set:function(t){this._bakeToReflectionProbe=t,this.emit(e.BAKE_TO_REFLECTION_PROBE_CHANGED)}}]),e}(lo)).USE_LIGHT_PROBE_CHANGED="use_light_probe_changed",sH.REFLECTION_PROBE_CHANGED="reflection_probe_changed",sH.BAKE_TO_REFLECTION_PROBE_CHANGED="bake_to_reflection_probe_changed",Kz=fa((qz=sH).prototype,"texture",[BH],(function(){return null})),Qz=fa(qz.prototype,"uvParam",[BH],(function(){return new ln})),Zz=fa(qz.prototype,"_bakeable",[BH],(function(){return!1})),Jz=fa(qz.prototype,"_castShadow",[BH],(function(){return!1})),$z=fa(qz.prototype,"_receiveShadow",[Uz],(function(){return!1})),tH=fa(qz.prototype,"_lightmapSize",[BH],(function(){return 64})),eH=fa(qz.prototype,"_useLightProbe",[BH],(function(){return!1})),iH=fa(qz.prototype,"_bakeToLightProbe",[BH],(function(){return!0})),nH=fa(qz.prototype,"_reflectionProbeType",[BH],(function(){return bD.NONE})),rH=fa(qz.prototype,"_bakeToReflectionProbe",[BH],(function(){return!0})),m(qz.prototype,"lightmapSize",[zz],Object.getOwnPropertyDescriptor(qz.prototype,"lightmapSize"),qz.prototype),m(qz.prototype,"useLightProbe",[Hz],Object.getOwnPropertyDescriptor(qz.prototype,"useLightProbe"),qz.prototype),m(qz.prototype,"bakeToLightProbe",[Wz],Object.getOwnPropertyDescriptor(qz.prototype,"bakeToLightProbe"),qz.prototype),m(qz.prototype,"reflectionProbe",[jz],Object.getOwnPropertyDescriptor(qz.prototype,"reflectionProbe"),qz.prototype),m(qz.prototype,"bakeToReflectionProbe",[Xz],Object.getOwnPropertyDescriptor(qz.prototype,"bakeToReflectionProbe"),qz.prototype),Yz=qz))||Yz),YH=t("ac",(oH=RH("cc.MeshRenderer"),aH=IH(100),hH=MH(ii),uH=MH(ii),lH=MH(WH),cH=MH(jH),_H=MH(rP),fH=MH(ni),oH(dH=aH(((wH=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).bakeSettings=mH&&mH(),e._mesh=gH&&gH(),e._shadowCastingMode=yH&&yH(),e._shadowReceivingMode=vH&&vH(),e._shadowBias=SH&&SH(),e._shadowNormalBias=AH&&AH(),e._reflectionProbeId=TH&&TH(),e._reflectionProbeBlendId=bH&&bH(),e._reflectionProbeBlendWeight=EH&&EH(),e._enabledGlobalStandardSkinObject=CH&&CH(),e._reflectionProbeDataMap=null,e._subMeshShapesWeights=[],e._modelType=ND,e._model=null,e._morphInstance=null,e._enableMorph=xH&&xH(),Me.querySettings(Re.Category.RENDERING,"highQualityMode")&&(e._shadowCastingMode=WH.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(Nm.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.on(Nm.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.on(XH.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.on(XH.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.on(XH.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(Nm.MOBILITY_CHANGED,this.onMobilityChanged,this),this.node.off(Nm.LIGHT_PROBE_BAKING_CHANGED,this.onLightProbeBakingChanged,this),this.bakeSettings.off(XH.USE_LIGHT_PROBE_CHANGED,this.onUseLightProbeChanged,this),this.bakeSettings.off(XH.REFLECTION_PROBE_CHANGED,this.onReflectionProbeChanged,this),this.bakeSettings.off(XH.BAKE_TO_REFLECTION_PROBE_CHANGED,this.onBakeToReflectionProbeChanged,this)},e.onDestroy=function(){this._model&&(v.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,o=r.views,a=0;a<s.length;a++)if(s[a].name===t){o[a].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;e===bD.BAKED_CUBEMAP?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbePlanarMap(null),this.model.updateReflectionProbeBlendCubemap(null)):e===bD.BLEND_PROBES||e===bD.BLEND_PROBES_AND_SKYBOX?(this.model.updateReflectionProbeCubemap(r),this.model.updateReflectionProbeBlendCubemap(i),this.model.updateReflectionProbePlanarMap(null)):e===bD.PLANAR_REFLECTION?(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===tg.Static){var n=!1;this.bakeSettings.texture&&!this.node.scene.globals.disableLightmap&&(n=!0),this.node.scene.globals.lightProbeInfo.data&&this.node.scene.globals.lightProbeInfo.data.hasCoefficients()&&this._model.useLightProbe&&(n=!0),this.onUpdateReceiveDirLight(i,n)}else this.onUpdateReceiveDirLight(i)}}}},e._createModel=function(){var t=this._morphInstance&&this._modelType===ND?DH:this._modelType,e=this._model=v.director.root.createModel(t);e.visFlags=this.visibility,e.node=e.transform=this.node,this._models.length=0,this._models.push(this._model),this._morphInstance&&e instanceof DH&&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|=Om.POSITION,this._model.transform.hasChangedFlags|=Om.POSITION,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(){this.bakeSettings.reflectionProbe!==bD.BAKED_CUBEMAP&&this.bakeSettings.reflectionProbe!==bD.BLEND_PROBES&&this.bakeSettings.reflectionProbe!==bD.BLEND_PROBES_AND_SKYBOX||(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 UA.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===WH.OFF?this._model.castShadow=!1:(this._shadowCastingMode,WH.ON,this._shadowCastingMode,this._model.castShadow=!0))},e._updateReceiveShadow=function(){this._model&&(this._shadowReceivingMode===jH.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(),this.bakeSettings.reflectionProbe===bD.BAKED_CUBEMAP||this.bakeSettings.reflectionProbe===bD.BLEND_PROBES||this.bakeSettings.reflectionProbe===bD.BLEND_PROBES_AND_SKYBOX?(v.internal.reflectionProbeManager.selectReflectionProbe(this._model),v.internal.reflectionProbeManager.getUsedReflectionProbe(this._model,!1)||$(16302)):this.bakeSettings.reflectionProbe===bD.PLANAR_REFLECTION&&(v.internal.reflectionProbeManager.selectPlanarReflectionProbe(this._model),v.internal.reflectionProbeManager.getUsedReflectionProbe(this._model,!0)||$(16302))},e.onBakeToReflectionProbeChanged=function(){this._updateBakeToReflectionProbe()},e._updateUseLightProbe=function(){if(this._model){var t=this.node;this._mesh&&t&&t.mobility===tg.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 DH&&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?void 0:r.targets.length)&&void 0!==n?n:0)===s}))},e._uploadSubMeshShapesWeights=function(t){var e;null===(e=this._morphInstance)||void 0===e||e.setWeights(t,this._subMeshShapesWeights[t])},e._updateStandardSkin=function(){var t=v.director.root.pipeline.pipelineSceneData;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(!(LH(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===WH.ON},set:function(t){this.shadowCastingMode=!0===t?WH.ON:WH.OFF}},{key:"receiveShadow",get:function(){return this._shadowReceivingMode},set:function(t){this._shadowReceivingMode=t,this._updateReceiveShadow()}},{key:"receiveShadowForInspector",get:function(){return this._shadowReceivingMode===jH.ON},set:function(t){this._shadowReceivingMode=!0===t?jH.ON:jH.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){v.director.root.pipeline.pipelineSceneData.standardSkinMeshRenderer=t?this:null,this._enabledGlobalStandardSkinObject=t}}]),i}(MV)).ShadowCastingMode=WH,wH.ShadowReceivingMode=jH,mH=fa((pH=wH).prototype,"bakeSettings",[BH],(function(){return new XH})),gH=fa(pH.prototype,"_mesh",[BH],(function(){return null})),yH=fa(pH.prototype,"_shadowCastingMode",[BH],(function(){return WH.OFF})),vH=fa(pH.prototype,"_shadowReceivingMode",[BH],(function(){return jH.ON})),SH=fa(pH.prototype,"_shadowBias",[BH],(function(){return 0})),AH=fa(pH.prototype,"_shadowNormalBias",[BH],(function(){return 0})),TH=fa(pH.prototype,"_reflectionProbeId",[BH],(function(){return-1})),bH=fa(pH.prototype,"_reflectionProbeBlendId",[BH],(function(){return-1})),EH=fa(pH.prototype,"_reflectionProbeBlendWeight",[BH],(function(){return 0})),CH=fa(pH.prototype,"_enabledGlobalStandardSkinObject",[BH],(function(){return!1})),m(pH.prototype,"shadowBias",[hH],Object.getOwnPropertyDescriptor(pH.prototype,"shadowBias"),pH.prototype),m(pH.prototype,"shadowNormalBias",[uH],Object.getOwnPropertyDescriptor(pH.prototype,"shadowNormalBias"),pH.prototype),m(pH.prototype,"shadowCastingMode",[lH],Object.getOwnPropertyDescriptor(pH.prototype,"shadowCastingMode"),pH.prototype),m(pH.prototype,"receiveShadow",[cH],Object.getOwnPropertyDescriptor(pH.prototype,"receiveShadow"),pH.prototype),m(pH.prototype,"mesh",[_H],Object.getOwnPropertyDescriptor(pH.prototype,"mesh"),pH.prototype),m(pH.prototype,"isGlobalStandardSkinObject",[fH],Object.getOwnPropertyDescriptor(pH.prototype,"isGlobalStandardSkinObject"),pH.prototype),xH=fa(pH.prototype,"_enableMorph",[BH],(function(){return!0})),dH=pH))||dH)||dH));function qH(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(YH);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(!qH(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 rP,s=new Vn,o=new Vn;t.getWorldMatrix(o),Vn.invert(o,o);for(var a=0;a<i.length;a++){var h=i[a];h.node.getWorldMatrix(s),Vn.multiply(s,o,s),r.merge(i[a].mesh,s),h.enabled=!1}var u=e.addComponent(YH);return u.mesh=r,u.sharedMaterials=i[0].sharedMaterials,!0},t.unbatchStaticModel=function(t,e){for(var i=t.getComponentsInChildren(YH),n=0;n<i.length;n++)i[n].enabled=!0;var r=e.getComponent(YH);return r&&(r.mesh&&r.mesh.destroyRenderingMesh(),r.destroy()),!0},t}()),ht(rP.prototype,"Mesh.prototype",[{name:"renderingMesh",newName:"renderingSubMeshes"}]),ut(rP.prototype,"Mesh.prototype",[{name:"hasFlatBuffers"},{name:"destroyFlatBuffers"}]);var KH,QH,ZH,JH,$H,tW,eW,iW,nW,rW,sW,oW,aW,hW,uW,lW,cW=t("ab",(NH=Ta("cc.Skeleton"),FH=eh([ri]),kH=eh([Vn]),NH((GH=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)._joints=UH&&UH(),e._bindposes=zH&&zH(),e._hash=HH&&HH(),e._invBindposes=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i;return null===(e=v.director.root)||void 0===e||null===(i=e.dataPoolManager)||void 0===i||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 Vn;Vn.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=hc(t,666)}return this._hash}}]),e}(Fd),UH=fa(GH.prototype,"_joints",[FH],(function(){return[]})),zH=fa(GH.prototype,"_bindposes",[kH],(function(){return[]})),HH=fa(GH.prototype,"_hash",[Ma],(function(){return 0})),VH=GH))||VH));v.Skeleton=cW,ut(YH.prototype,"MeshRenderer.prototype",[{name:"enableDynamicBatching"},{name:"recieveShadows"}]),v.ModelComponent=YH,ie(YH,"cc.ModelComponent");var _W,fW,dW,pW,mW,gW,yW,vW,SW,AW,TW,bW,EW,CW,xW,wW,DW,RW,IW,MW,PW,BW,OW,LW,NW,FW,kW,VW,GW,UW,zW,HW,WW,jW,XW,YW,qW,KW,QW,ZW,JW,$W,tj,ej,ij,nj,rj,sj,oj,aj,hj,uj,lj,cj,_j,fj,dj,pj,mj,gj,yj,vj,Sj,Aj,Tj,bj,Ej,Cj,xj,wj,Dj,Rj,Ij,Mj,Pj,Bj,Oj,Lj,Nj,Fj,kj,Vj,Gj,Uj,zj,Hj,Wj,jj,Xj,Yj,qj,Kj,Qj,Zj,Jj,$j,tX,eX,iX,nX,rX,sX,oX,aX,hX,uX,lX,cX,_X,fX,dX,pX,mX,gX,yX,vX,SX,AX,TX=new mn,bX=be({LUMINOUS_FLUX:0,LUMINANCE:1}),EX=Ta("cc.StaticLightSettings")((QH=function(){function t(){this._baked=ZH&&ZH(),this._editorOnly=JH&&JH(),this._castShadow=$H&&$H()}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}(),ZH=fa(QH.prototype,"_baked",[Ma],(function(){return!1})),JH=fa(QH.prototype,"_editorOnly",[Ma],(function(){return!1})),$H=fa(QH.prototype,"_castShadow",[Ma],(function(){return!1})),KH=QH))||KH,CX=t("ae",(tW=Ta("cc.Light"),eW=eh(EX),iW=eh(Pm.BitMask),tW(((lW=function(t){function e(){var e;return(e=t.call(this)||this)._color=sW&&sW(),e._useColorTemperature=oW&&oW(),e._colorTemperature=aW&&aW(),e._staticSettings=hW&&hW(),e._visibility=uW&&uW(),e._type=BD.UNKNOWN,e._lightType=void 0,e._light=null,e._lightType=HD,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=v.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&&(v.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 BD.DIRECTIONAL:t.addDirectionalLight(this._light),t.setMainLight(this._light);break;case BD.SPHERE:t.addSphereLight(this._light);break;case BD.SPOT:t.addSpotLight(this._light);break;case BD.POINT:t.addPointLight(this._light);break;case BD.RANGED_DIRECTIONAL:t.addRangedDirLight(this._light)}}},i._detachFromScene=function(){if(this._light&&this._light.scene){var t=this._light.scene;switch(this._type){case BD.DIRECTIONAL:t.removeDirectionalLight(this._light),t.unsetMainLight(this._light);break;case BD.SPHERE:t.removeSphereLight(this._light);break;case BD.SPOT:t.removeSpotLight(this._light);break;case BD.POINT:t.removePointLight(this._light);break;case BD.RANGED_DIRECTIONAL: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&&(TX.x=t.r/255,TX.y=t.g/255,TX.z=t.b/255,this._light.color=TX)}},{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}(Lp)).Type=BD,lW.PhotometricTerm=bX,sW=fa((rW=lW).prototype,"_color",[Ma],(function(){return bn.WHITE.clone()})),oW=fa(rW.prototype,"_useColorTemperature",[Ma],(function(){return!1})),aW=fa(rW.prototype,"_colorTemperature",[Ma],(function(){return 6550})),hW=fa(rW.prototype,"_staticSettings",[Ma],(function(){return new EX})),uW=fa(rW.prototype,"_visibility",[Ma],(function(){return bv})),m(rW.prototype,"staticSettings",[eW],Object.getOwnPropertyDescriptor(rW.prototype,"staticSettings"),rW.prototype),m(rW.prototype,"visibility",[iW],Object.getOwnPropertyDescriptor(rW.prototype,"visibility"),rW.prototype),nW=rW))||nW)),xX=xa,wX=Ma,DX=Pa,RX=eh,IX=t("ad",(_W=Ta("cc.DirectionalLight"),fW=DX("_illuminance"),dW=RX(ei),pW=xX({group:{name:"DynamicShadowSettings",displayOrder:1}}),mW=RX(ni),gW=xX({group:{name:"DynamicShadowSettings",displayOrder:5}}),yW=RX(uT),vW=xX({group:{name:"DynamicShadowSettings",displayOrder:6}}),SW=RX(ii),AW=xX({group:{name:"DynamicShadowSettings",displayOrder:7}}),TW=RX(ii),bW=xX({group:{name:"DynamicShadowSettings",displayOrder:8}}),EW=RX(ii),CW=xX({group:{name:"DynamicShadowSettings",displayOrder:9}}),xW=RX(ii),wW=xX({group:{name:"DynamicShadowSettings",displayOrder:22}}),DW=RX(ii),RW=xX({group:{name:"DynamicShadowSettings",displayOrder:10}}),IW=RX(lT),MW=xX({group:{name:"DynamicShadowSettings",displayOrder:11}}),PW=RX(ni),BW=xX({group:{name:"DynamicShadowSettings",displayOrder:12}}),OW=RX(ii),LW=xX({group:{name:"DynamicShadowSettings",displayOrder:13}}),NW=RX(cT),FW=xX({group:{name:"DynamicShadowSettings",displayOrder:14}}),kW=RX(ni),VW=xX({group:{name:"DynamicShadowSettings",displayOrder:15}}),GW=RX(ii),UW=xX({group:{name:"DynamicShadowSettings",displayOrder:16}}),zW=RX(ii),HW=xX({group:{name:"DynamicShadowSettings",displayOrder:17}}),WW=RX(ii),jW=xX({group:{name:"DynamicShadowSettings",displayOrder:19}}),XW=RX(ni),YW=xX({group:{name:"DynamicShadowSettings",displayOrder:20}}),qW=RX(ni),KW=xX({group:{name:"DynamicShadowSettings",displayOrder:21}}),QW=RX(ii),_W((JW=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=$W&&$W(),e._illuminanceLDR=tj&&tj(),e._shadowEnabled=ej&&ej(),e._shadowPcf=ij&&ij(),e._shadowBias=nj&&nj(),e._shadowNormalBias=rj&&rj(),e._shadowSaturation=sj&&sj(),e._shadowDistance=oj&&oj(),e._shadowInvisibleOcclusionRange=aj&&aj(),e._csmLevel=hj&&hj(),e._csmLayerLambda=uj&&uj(),e._csmOptimizationMode=lj&&lj(),e._csmAdvancedOptions=cj&&cj(),e._csmLayersTransition=_j&&_j(),e._csmTransitionRange=fj&&fj(),e._shadowFixedArea=dj&&dj(),e._shadowNear=pj&&pj(),e._shadowFar=mj&&mj(),e._shadowOrthoSize=gj&&gj(),e._lightType=XD,Me.querySettings(Re.Category.RENDERING,"highQualityMode")&&(e._shadowPcf=uT.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=BD.DIRECTIONAL,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(YH);s&&s.onUpdateReceiveDirLight(this._visibility)}}}},n(e,[{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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=Ni(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,fT.MAX_FAR),this._shadowDistance/.1<10&&$(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,fT.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>lT.LEVEL_1},set:function(t){this._csmLevel=t?lT.LEVEL_4:lT.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,fT.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}(CX),$W=fa(JW.prototype,"_illuminanceHDR",[xX,fW],(function(){return 65e3})),tj=fa(JW.prototype,"_illuminanceLDR",[wX],(function(){return 65e3*fD.standardExposureValue})),ej=fa(JW.prototype,"_shadowEnabled",[wX],(function(){return!1})),ij=fa(JW.prototype,"_shadowPcf",[wX],(function(){return uT.HARD})),nj=fa(JW.prototype,"_shadowBias",[wX],(function(){return 1e-5})),rj=fa(JW.prototype,"_shadowNormalBias",[wX],(function(){return 0})),sj=fa(JW.prototype,"_shadowSaturation",[wX],(function(){return 1})),oj=fa(JW.prototype,"_shadowDistance",[wX],(function(){return 50})),aj=fa(JW.prototype,"_shadowInvisibleOcclusionRange",[wX],(function(){return 200})),hj=fa(JW.prototype,"_csmLevel",[wX],(function(){return lT.LEVEL_4})),uj=fa(JW.prototype,"_csmLayerLambda",[wX],(function(){return.75})),lj=fa(JW.prototype,"_csmOptimizationMode",[wX],(function(){return cT.RemoveDuplicates})),cj=fa(JW.prototype,"_csmAdvancedOptions",[wX],(function(){return!1})),_j=fa(JW.prototype,"_csmLayersTransition",[wX],(function(){return!1})),fj=fa(JW.prototype,"_csmTransitionRange",[wX],(function(){return.05})),dj=fa(JW.prototype,"_shadowFixedArea",[wX],(function(){return!1})),pj=fa(JW.prototype,"_shadowNear",[wX],(function(){return.1})),mj=fa(JW.prototype,"_shadowFar",[wX],(function(){return 10})),gj=fa(JW.prototype,"_shadowOrthoSize",[wX],(function(){return 5})),m(JW.prototype,"illuminance",[dW],Object.getOwnPropertyDescriptor(JW.prototype,"illuminance"),JW.prototype),m(JW.prototype,"shadowEnabled",[pW,mW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowEnabled"),JW.prototype),m(JW.prototype,"shadowPcf",[gW,yW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowPcf"),JW.prototype),m(JW.prototype,"shadowBias",[vW,SW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowBias"),JW.prototype),m(JW.prototype,"shadowNormalBias",[AW,TW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowNormalBias"),JW.prototype),m(JW.prototype,"shadowSaturation",[bW,EW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowSaturation"),JW.prototype),m(JW.prototype,"shadowDistance",[CW,xW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowDistance"),JW.prototype),m(JW.prototype,"shadowInvisibleOcclusionRange",[wW,DW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowInvisibleOcclusionRange"),JW.prototype),m(JW.prototype,"csmLevel",[RW,IW],Object.getOwnPropertyDescriptor(JW.prototype,"csmLevel"),JW.prototype),m(JW.prototype,"enableCSM",[MW,PW],Object.getOwnPropertyDescriptor(JW.prototype,"enableCSM"),JW.prototype),m(JW.prototype,"csmLayerLambda",[BW,OW],Object.getOwnPropertyDescriptor(JW.prototype,"csmLayerLambda"),JW.prototype),m(JW.prototype,"csmOptimizationMode",[LW,NW],Object.getOwnPropertyDescriptor(JW.prototype,"csmOptimizationMode"),JW.prototype),m(JW.prototype,"shadowFixedArea",[FW,kW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowFixedArea"),JW.prototype),m(JW.prototype,"shadowNear",[VW,GW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowNear"),JW.prototype),m(JW.prototype,"shadowFar",[UW,zW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowFar"),JW.prototype),m(JW.prototype,"shadowOrthoSize",[HW,WW],Object.getOwnPropertyDescriptor(JW.prototype,"shadowOrthoSize"),JW.prototype),m(JW.prototype,"csmAdvancedOptions",[jW,XW],Object.getOwnPropertyDescriptor(JW.prototype,"csmAdvancedOptions"),JW.prototype),m(JW.prototype,"csmLayersTransition",[YW,qW],Object.getOwnPropertyDescriptor(JW.prototype,"csmLayersTransition"),JW.prototype),m(JW.prototype,"csmTransitionRange",[KW,QW],Object.getOwnPropertyDescriptor(JW.prototype,"csmTransitionRange"),JW.prototype),ZW=JW))||ZW)),MX=t("af",(yj=Ta("cc.SphereLight"),vj=Pa("_luminance"),Sj=eh(ei),Aj=eh(ei),Tj=eh(bX),bj=eh(ii),Ej=eh(ii),yj((xj=function(t){function e(){var e;return(e=t.call(this)||this)._size=wj&&wj(),e._luminanceHDR=Dj&&Dj(),e._luminanceLDR=Rj&&Rj(),e._term=Ij&&Ij(),e._range=Mj&&Mj(),e._lightType=YD,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=BD.SPHERE,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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*zD(this._size):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/zD(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}(CX),wj=fa(xj.prototype,"_size",[Ma],(function(){return.15})),Dj=fa(xj.prototype,"_luminanceHDR",[Ma,vj],(function(){return 1700/zD(.15)})),Rj=fa(xj.prototype,"_luminanceLDR",[Ma],(function(){return 1700/zD(.15)*fD.standardExposureValue*fD.standardLightMeterScale})),Ij=fa(xj.prototype,"_term",[Ma],(function(){return bX.LUMINOUS_FLUX})),Mj=fa(xj.prototype,"_range",[Ma],(function(){return 1})),m(xj.prototype,"luminousFlux",[Sj],Object.getOwnPropertyDescriptor(xj.prototype,"luminousFlux"),xj.prototype),m(xj.prototype,"luminance",[Aj],Object.getOwnPropertyDescriptor(xj.prototype,"luminance"),xj.prototype),m(xj.prototype,"term",[Tj],Object.getOwnPropertyDescriptor(xj.prototype,"term"),xj.prototype),m(xj.prototype,"size",[bj],Object.getOwnPropertyDescriptor(xj.prototype,"size"),xj.prototype),m(xj.prototype,"range",[Ej],Object.getOwnPropertyDescriptor(xj.prototype,"range"),xj.prototype),Cj=xj))||Cj)),PX=eh,BX=Ma,OX=Pa,LX=xa,NX=t("ag",(Pj=Ta("cc.SpotLight"),Bj=OX("_luminance"),Oj=PX(bX),Lj=PX(ii),Nj=LX({group:{name:"DynamicShadowSettings",displayOrder:1}}),Fj=PX(ni),kj=LX({group:{name:"DynamicShadowSettings",displayOrder:2}}),Vj=PX(uT),Gj=LX({group:{name:"DynamicShadowSettings",displayOrder:3}}),Uj=PX(ii),zj=LX({group:{name:"DynamicShadowSettings",displayOrder:4}}),Hj=PX(ii),Pj((jj=function(t){function e(){var e;return(e=t.call(this)||this)._size=Xj&&Xj(),e._luminanceHDR=Yj&&Yj(),e._luminanceLDR=qj&&qj(),e._term=Kj&&Kj(),e._range=Qj&&Qj(),e._spotAngle=Zj&&Zj(),e._angleAttenuationStrength=Jj&&Jj(),e._shadowEnabled=$j&&$j(),e._shadowPcf=tX&&tX(),e._shadowBias=eX&&eX(),e._shadowNormalBias=iX&&iX(),e._lightType=tR,e}return s(e,t),e.prototype._createLight=function(){if(t.prototype._createLight.call(this),this._type=BD.SPOT,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 v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*zD(this._size):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/zD(this._size),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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=Vi(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}(CX),Xj=fa(jj.prototype,"_size",[BX],(function(){return.15})),Yj=fa(jj.prototype,"_luminanceHDR",[BX,Bj],(function(){return 1700/zD(.15)})),qj=fa(jj.prototype,"_luminanceLDR",[BX],(function(){return 1700/zD(.15)*fD.standardExposureValue*fD.standardLightMeterScale})),Kj=fa(jj.prototype,"_term",[BX],(function(){return bX.LUMINOUS_FLUX})),Qj=fa(jj.prototype,"_range",[BX],(function(){return 1})),Zj=fa(jj.prototype,"_spotAngle",[BX],(function(){return 60})),Jj=fa(jj.prototype,"_angleAttenuationStrength",[BX],(function(){return 0})),$j=fa(jj.prototype,"_shadowEnabled",[BX],(function(){return!1})),tX=fa(jj.prototype,"_shadowPcf",[BX],(function(){return uT.HARD})),eX=fa(jj.prototype,"_shadowBias",[BX],(function(){return 1e-5})),iX=fa(jj.prototype,"_shadowNormalBias",[BX],(function(){return 0})),m(jj.prototype,"term",[Oj],Object.getOwnPropertyDescriptor(jj.prototype,"term"),jj.prototype),m(jj.prototype,"size",[Lj],Object.getOwnPropertyDescriptor(jj.prototype,"size"),jj.prototype),m(jj.prototype,"shadowEnabled",[Nj,Fj],Object.getOwnPropertyDescriptor(jj.prototype,"shadowEnabled"),jj.prototype),m(jj.prototype,"shadowPcf",[kj,Vj],Object.getOwnPropertyDescriptor(jj.prototype,"shadowPcf"),jj.prototype),m(jj.prototype,"shadowBias",[Gj,Uj],Object.getOwnPropertyDescriptor(jj.prototype,"shadowBias"),jj.prototype),m(jj.prototype,"shadowNormalBias",[zj,Hj],Object.getOwnPropertyDescriptor(jj.prototype,"shadowNormalBias"),jj.prototype),Wj=jj))||Wj));t("ah",(nX=Ta("cc.PointLight"),rX=Pa("_luminance"),sX=eh(ei),oX=eh(ei),aX=eh(bX),hX=eh(ii),nX((lX=function(t){function e(){var e;return(e=t.call(this)||this)._luminanceHDR=cX&&cX(),e._luminanceLDR=_X&&_X(),e._term=fX&&fX(),e._range=dX&&dX(),e._lightType=eR,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=BD.POINT,this.range=this._range,this._light&&(this._light.luminanceHDR=this._luminanceHDR,this._light.luminanceLDR=this._luminanceLDR)},n(e,[{key:"luminousFlux",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR*zD(1):this._luminanceLDR},set:function(t){var e=0;v.director.root.pipeline.pipelineSceneData.isHDR?(this._luminanceHDR=t/zD(1),e=this._luminanceHDR):(this._luminanceLDR=t,e=this._luminanceLDR),this._light&&(this._light.luminance=e)}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.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}(CX),cX=fa(lX.prototype,"_luminanceHDR",[Ma,rX],(function(){return 1700/zD(.15)})),_X=fa(lX.prototype,"_luminanceLDR",[Ma],(function(){return 1700/zD(.15)*fD.standardExposureValue*fD.standardLightMeterScale})),fX=fa(lX.prototype,"_term",[Ma],(function(){return bX.LUMINOUS_FLUX})),dX=fa(lX.prototype,"_range",[Ma],(function(){return 1})),m(lX.prototype,"luminousFlux",[sX],Object.getOwnPropertyDescriptor(lX.prototype,"luminousFlux"),lX.prototype),m(lX.prototype,"luminance",[oX],Object.getOwnPropertyDescriptor(lX.prototype,"luminance"),lX.prototype),m(lX.prototype,"term",[aX],Object.getOwnPropertyDescriptor(lX.prototype,"term"),lX.prototype),m(lX.prototype,"range",[hX],Object.getOwnPropertyDescriptor(lX.prototype,"range"),lX.prototype),uX=lX))||uX)),t("ai",(pX=Ta("cc.RangedDirectionalLight"),mX=Pa("_illuminance"),gX=eh(ei),pX((vX=function(t){function e(){var e;return(e=t.call(this)||this)._illuminanceHDR=SX&&SX(),e._illuminanceLDR=AX&&AX(),e._lightType=nR,e}return s(e,t),e.prototype._createLight=function(){t.prototype._createLight.call(this),this._type=BD.RANGED_DIRECTIONAL,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR,this._light.illuminanceLDR=this._illuminanceLDR)},n(e,[{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){v.director.root.pipeline.pipelineSceneData.isHDR?(this._illuminanceHDR=t,this._light&&(this._light.illuminanceHDR=this._illuminanceHDR)):(this._illuminanceLDR=t,this._light&&(this._light.illuminanceLDR=this._illuminanceLDR))}}]),e}(CX),SX=fa(vX.prototype,"_illuminanceHDR",[xa,mX],(function(){return 65e3})),AX=fa(vX.prototype,"_illuminanceLDR",[Ma],(function(){return 65e3*fD.standardExposureValue})),m(vX.prototype,"illuminance",[gX],Object.getOwnPropertyDescriptor(vX.prototype,"illuminance"),vX.prototype),yX=vX))||yX)),v.LightComponent=CX,ie(CX,"cc.LightComponent"),v.DirectionalLightComponent=IX,ie(IX,"cc.DirectionalLightComponent"),v.SphereLightComponent=MX,ie(MX,"cc.SphereLightComponent"),v.SpotLightComponent=NX,ie(NX,"cc.SpotLightComponent"),ht(NX.prototype,"SpotLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),ht(MX.prototype,"SphereLight.prototype",[{name:"luminousPower",newName:"luminousFlux",customGetter:function(){return this.luminousFlux},customSetter:function(t){this.luminousFlux=t}}]),ht(CX.PhotometricTerm,"Light.PhotometricTerm",[{name:"LUMINOUS_POWER",newName:"LUMINOUS_FLUX"}]);var FX=Symbol("BakeNodeCurves"),kX=t("fZ",function(){function t(){}return t.getOrExtract=function(e){var i=t.pool.get(e);if(!i||i.samples!==e.sample){i&&v.director.root.dataPoolManager.releaseAnimationClip(e);var n=Math.ceil(e.sample*e.duration)+1,r=e.sample;i=e[FX](0,r,n),t.pool.set(e,i)}return i},t.destroy=function(e){t.pool.delete(e)},t}());kX.pool=new Map;var VX=new Vn;function GX(t,e,i){for(Vn.identity(i);t!==e;)Vn.fromRTS(VX,t.rotation,t.position,t.scale),Vn.multiply(i,VX,i),t=t.parent;return i}var UX=new M_(Oc.POINT,Oc.POINT,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP),zX=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 HX(t,e){var i=4/Math.sqrt(e);return 12*Math.ceil(Math.max(480*i,t)/12)}new In,new In,new mn,new In,new mn;var WX=new mn,jX=new mn,XX=new mn,YX=new mn,qX=new Vn,KX=new Vn,QX=new Ko,ZX=Number.MAX_SAFE_INTEGER,JX=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=function(t){return t.getFormatFeatures(Ac.RGBA32F)&Mc.SAMPLED_TEXTURE?Ac.RGBA32F:Ac.RGBA8}(this._device);this._formatSize=ff[e].size,this._pixelsPerJoint=48/this._formatSize,this._pool=new nN(t),this._pool.initialize({format:e,roundUpFn:HX}),this._customPool=new nN(t),this._customPool.initialize({format:e,roundUpFn:HX})}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;this._device.getFormatFeatures(Ac.RGBA32F)&Mc.SAMPLED_TEXTURE||(n*=2);for(var r=this._customPool.createChunk(n),s=0;s<i.contents.length;s++){var o=i.contents[s],a=o.skeleton;this._chunkIdxMap.set(a,r);for(var h=0;h<o.clips.length;h++){var u=o.clips[h];this._chunkIdxMap.set(a^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,o=t.bindposes,a=null,h=!1,u=s.length;if(r)r.refCount++;else{var l=12*u,c=this._chunkIdxMap.get(n),_=void 0!==c?this._customPool.alloc(l*Float32Array.BYTES_PER_ELEMENT,c):this._pool.alloc(l*Float32Array.BYTES_PER_ELEMENT);if(!_)return r;r={pixelOffset:_.start/this._formatSize,refCount:1,bounds:new Map,skeletonHash:t.hash,clipHash:0,readyToBeDeleted:!1,handle:_},a=new Float32Array(l),h=!0}mn.set(XX,ZX,ZX,ZX),mn.set(YX,-ZX,-ZX,-ZX);for(var f=e.getBoneSpaceBounds(t),d=0,p=0;d<u;d++,p+=12){var m=i.getChildByPath(s[d]),g=m?GX(m,i,qX):t.inverseBindposes[d],y=f[d];y&&(Ko.transform(QX,y,g),QX.getBoundary(WX,jX),mn.min(XX,XX,WX),mn.max(YX,YX,jX)),h&&(m&&Vn.multiply(g,g,o[d]),zX(a,p,m?g:Vn.IDENTITY))}var v=[new Ko];return r.bounds.set(e.hash,v),Ko.fromPoints(v[0],XX,YX),h&&(this._pool.update(r.handle,a.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 o=t.joints,a=t.bindposes,h=kX.getOrExtract(e).frames,u=null,l=!1,c=o.length;if(s)s.refCount++;else{var _=12*c*h,f=this._chunkIdxMap.get(r),d=void 0!==f?this._customPool.alloc(_*Float32Array.BYTES_PER_ELEMENT,f):this._pool.alloc(_*Float32Array.BYTES_PER_ELEMENT);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(_),l=!0}var m=i.getBoneSpaceBounds(t),g=[];s.bounds.set(i.hash,g);for(var y=0;y<h;y++)g.push(new Ko(ZX,ZX,ZX,-ZX,-ZX,-ZX));for(var v=0,S=0;v<h;v++){for(var A=g[v],T=0;T<c;T++,S+=12){var b=s.animInfos[T],E=b.curveData,C=b.downstream,x=b.bindposeIdx,w=b.bindposeCorrection,D=void 0,R=!0;E&&C?D=Vn.multiply(qX,E[v],C):E?D=E[v]:C?D=C:(D=t.inverseBindposes[x],R=!1);var I=m[T];if(I){var M=w?Vn.multiply(KX,D,w):D;Ko.transform(QX,I,M),QX.getBoundary(WX,jX),mn.min(A.center,A.center,WX),mn.max(A.halfExtents,A.halfExtents,jX)}l&&(R&&Vn.multiply(qX,D,a[x]),zX(u,S,R?qX:Vn.IDENTITY))}Ko.fromPoints(A,A.center,A.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,o=r.length,a=kX.getOrExtract(e),h=0;h<o;h++){for(var u=r[h],l=a.joints[u],c=i.getChildByPath(u),_=void 0,f=void 0;!l;){var d=u.lastIndexOf("/");if(u=u.substring(0,d),l=a.joints[u],c?(_||(_=new Vn),Vn.fromRTS(qX,c.rotation,c.position,c.scale),Vn.multiply(_,qX,_),c=c.parent):f=u,d<0)break}var p=h,m=void 0;if(void 0!==f&&l){p=h-1;for(var g=0;g<o;g++)if(r[g]===f){p=g,m=new Vn,Vn.multiply(m,s[g],t.inverseBindposes[h]);break}}n.push({curveData:l&&l.transforms,downstream:_,bindposeIdx:p,bindposeCorrection:m})}return n},n(t,[{key:"pixelsPerJoint",get:function(){return this._pixelsPerJoint}}]),t}(),$X=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 E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,wy.SIZE,wy.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=f(this._pool.values());!(t=e()).done;)t.value.buffer.destroy();this._pool.clear()},t}(),tY=[],eY=new Map;function iY(t,e){for(var i=0,n=Vn.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;Vn.fromRTS(t.local,r.rotation,r.position,r.scale),n=Vn.multiply(t.world,n,t.local)}return n}function nY(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(eY.has(s)){n=eY.get(s);break}n={node:t,local:new Vn,world:new Vn,stamp:-1,parent:null},eY.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 rY(t){for(var e=eY.get(t.uuid)||null;e;)eY.delete(e.node.uuid),e=e.parent}var sY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!1}],oY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_REAL_TIME_JOINT_TEXTURE",value:!0}];function aY(t,e,i,n){for(var r=0;r<i.length;r++){for(var s=i[r],o=-1,a=0;a<s.length;a++)if(s[a]===n){o=a;break}o>=0&&(e.push(r),t.push(o))}}var hY=new mn,uY=new mn,lY=new mn,cY=new mn,_Y=new Vn,fY=new Ko,dY=function(){this._format=kd.RGBA32F,this._textures=[],this._buffers=[]};dY.WIDTH=256,dY.HEIGHT=3;var pY,mY,gY,yY,vY,SY,AY,TY,bY,EY,CY,xY,wY,DY,RY,IY,MY,PY,BY,OY,LY,NY,FY,kY,VY,GY,UY,zY,HY,WY,jY,XY,YY=function(t){function e(){var e;return(e=t.call(this)||this)._buffers=[],e._dataArray=[],e._joints=[],e._bufferIndices=null,e._realTimeJointTexture=new dY,e._realTimeTextureMode=!1,e.type=xD.SKINNING,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++)rY(this._joints[n].target);if(this._bufferIndices=null,this._joints.length=0,t&&e&&i){this._realTimeTextureMode=!1,Ry.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 o=0;o<t.joints.length;o++){var a=r[o],h=e.getChildByPath(t.joints[o]);if(a&&h){var u=nY(h,e),l=t.bindposes[o],c=[],_=[];s?aY(c,_,s,o):(c.push(o),_.push(0)),this._joints.push({indices:c,buffers:_,bound:a,target:h,bindpose:l,transform:u})}}}},i.updateTransform=function(t){var e=this.transform;(e.hasChangedFlags||e.isTransformDirty())&&(e.updateWorldTransform(),this._localDataUpdated=!0),mn.set(hY,1/0,1/0,1/0),mn.set(uY,-1/0,-1/0,-1/0);for(var i=0;i<this._joints.length;i++){var n=this._joints[i],r=n.bound,s=iY(n.transform,t);Ko.transform(fY,r,s),fY.getBoundary(lY,cY),mn.min(hY,hY,lY),mn.max(uY,uY,cY)}var o=this._worldBounds;this._modelBounds&&o&&(Ko.fromPoints(this._modelBounds,hY,uY),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,o=n.transform,a=n.bindpose;Vn.multiply(_Y,o.world,a);for(var h=0;h<s.length;h++)zX(this._dataArray[s[h]],12*r[h],_Y)}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=sY;return this._realTimeTextureMode&&(n=oY),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(Ry.BINDING,r)}},i._updateInstancedAttributes=function(e,i){i.passes[0].batchingScheme!==VA.NONE&&$(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=dY.WIDTH;this._dataArray[i]=new Float32Array(12*n)}else for(var r=0;r<t;r++){this._buffers[r]=this._device.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,Ry.SIZE,Ry.SIZE));var s=Ry.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=FI.root.device,e=dY.WIDTH,i=dY.HEIGHT;0==(t.getFormatFeatures(Ac.RGBA32F)&Mc.SAMPLED_TEXTURE)&&(this._realTimeJointTexture._format=kd.RGBA8888,e=4*dY.WIDTH);for(var n=this._realTimeJointTexture._textures,r=this._realTimeJointTexture._buffers,s=this._realTimeJointTexture._format,o=0;o<this._dataArray.length;o++){r[o]=new Float32Array(4*dY.HEIGHT*dY.WIDTH);var a=r[o],h=s===kd.RGBA32F?a:new Uint8Array(a.buffer),u=new sp({width:e,height:i,_data:h,_compressed:!1,format:s}),l=new Dm;l.setFilters(Dm.Filter.NEAREST,Dm.Filter.NEAREST),l.setMipFilter(Dm.Filter.NONE),l.setWrapMode(Dm.WrapMode.CLAMP_TO_EDGE,Dm.WrapMode.CLAMP_TO_EDGE,Dm.WrapMode.CLAMP_TO_EDGE),l.image=u,n[o]=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(Fy,n),e.bindSampler(Fy,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,o=0,a=0,h=0;h<s;h++)a=4*h,n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],a=4*(h+dY.WIDTH),n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],a=4*(h+2*dY.WIDTH),n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++],n[a++]=r[o++];var u=this._realTimeJointTexture._format===kd.RGBA32F?n:new Uint8Array(n.buffer);t[i].uploadData(u)}},e}(DH),qY=[{name:"CC_USE_SKINNING",value:!0},{name:"CC_USE_BAKED_ANIMATION",value:!0}],KY=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=xD.BAKED_SKINNING,e._dataPoolManager=v.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 E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.DEVICE,xy.SIZE,xy.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 o=this.transform;r.transform(o._mat,o._pos,o._rot,o._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 o=this._subModels[s];r>=0?o.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(qY):qY},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,o=0;o<this._subModels.length;++o)this._subModels[o].descriptorSet.bindTexture(Oy,s)}},i._updateLocalDescriptors=function(e,i){t.prototype._updateLocalDescriptors.call(this,e,i);var n=this._jointsMedium,r=n.buffer,s=n.texture,o=n.animInfo;if(i.bindBuffer(xy.BINDING,r),i.bindBuffer(wy.BINDING,o.buffer),s){var a=this._device.getSampler(UX);i.bindTexture(Oy,s.handle.texture),i.bindSampler(Oy,a)}},i._updateInstancedAttributes=function(e,i){t.prototype._updateInstancedAttributes.call(this,e,i),this._instAnimInfoIdx=i.getInstancedAttributeIndex(Dy),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 o=s[n];o[0]=i.data[0],o[1]=e[1],o[2]=e[2]}}},e}(DH),QY=t("aj",(pY=Ta("cc.SkinnedMeshRenderer"),mY=Ea(100),gY=eh(cW),yY=eh(xg),vY=eh(cW),SY=eh(xg),pY(AY=mY((TY=function(t){function e(){var e;return(e=t.call(this)||this)._skeleton=bY&&bY(),e._skinningRoot=EY&&EY(),e._clip=null,e.associatedAnimation=null,e._modelType=KY,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?KY:YY;(e||this._modelType!==i)&&(this._modelType=i,this._model&&(v.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===YY&&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}(YH),bY=fa(TY.prototype,"_skeleton",[gY],(function(){return null})),EY=fa(TY.prototype,"_skinningRoot",[yY],(function(){return null})),m(TY.prototype,"skeleton",[vY],Object.getOwnPropertyDescriptor(TY.prototype,"skeleton"),TY.prototype),m(TY.prototype,"skinningRoot",[SY],Object.getOwnPropertyDescriptor(TY.prototype,"skinningRoot"),TY.prototype),AY=TY))||AY)||AY)),ZY=new U_(a_.ATTR_BATCH_ID,Ac.R32F),JY=new U_(a_.ATTR_BATCH_UV,Ac.RG32F),$Y=ff[ZY.format].size+ff[JY.format].size,tq=t("al",(CY=Ta("cc.SkinnedMeshUnit"),xY=eh(rP),wY=eh(cW),DY=eh(oT),RY=eh(QY),CY((MY=function(){function t(){this.mesh=PY&&PY(),this.skeleton=BY&&BY(),this.material=OY&&OY(),this._localTransform=LY&&LY(),this._offset=NY&&NY(),this._size=FY&&FY()}return n(t,[{key:"offset",get:function(){return this._offset},set:function(t){jn.copy(this._offset,t)}},{key:"size",get:function(){return this._size},set:function(t){jn.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&&GX(t.node,t.skinningRoot,this._localTransform))}}]),t}(),PY=fa(MY.prototype,"mesh",[xY],(function(){return null})),BY=fa(MY.prototype,"skeleton",[wY],(function(){return null})),OY=fa(MY.prototype,"material",[DY],(function(){return null})),LY=fa(MY.prototype,"_localTransform",[Ma],(function(){return new Vn})),NY=fa(MY.prototype,"_offset",[Ma],(function(){return new jn(0,0)})),FY=fa(MY.prototype,"_size",[Ma],(function(){return new jn(1,1)})),m(MY.prototype,"copyFrom",[RY],Object.getOwnPropertyDescriptor(MY.prototype,"copyFrom"),MY.prototype),IY=MY))||IY)),eq=new Vn;new Vn;var iq,nq,rq,sq,oq,aq,hq,uq,lq,cq,_q,fq,dq,pq,mq,gq,yq,vq=new mn,Sq=t("ak",(kY=Ta("cc.SkinnedMeshBatchRenderer"),VY=Ea(100),GY=eh([ri]),UY=eh([tq]),kY(zY=VY((HY=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).atlasSize=WY&&WY(),e.batchableTextureNames=jY&&jY(),e.units=XY&&XY(),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>=bc.SAMPLER1D){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 o=[],a=0;a<t.units.length;a++){var h=t.units[a];h.material&&o.push(h.material.getProperty(i.slice(0,-3),n))}e.setProperty(i,o,n)}};for(var o in r.properties)s(o)},r=0;r<i.passes.length;r++)n(r)}else U("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;Vn.invert(eq,n._localTransform);for(var s=function(){var i=r.joints[o];if(t.findIndex((function(t){return t===i}))>=0)return 1;t.push(i),e.push(Vn.multiply(new Vn,r.bindposes[o]||Vn.IDENTITY,eq))},o=0;o<r.joints.length;o++)s()}}var a=Array.from(Array(t.length).keys()).sort((function(e,i){return t[e]>t[i]?1:t[e]<t[i]?-1:0})),h=new cW;h.joints=t.map((function(t,e,i){return i[a[e]]})),h.bindposes=e.map((function(t,e,i){return i[a[e]]})),this._skeleton&&this._skeleton.destroy(),this.skeleton=h}else U("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 rP;for(var n=0,r=Ac.UNKNOWN,s=0,o=Ac.UNKNOWN,a=0,h=Ac.UNKNOWN,u=0,l=Ac.UNKNOWN,c=0,_=Ac.UNKNOWN,f=new Array(this.units.length),d=this.units.length,p=0;p<d;p++){var m=this.units[p];m&&m.skeleton&&(f[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);Vn.invert(eq,e._localTransform),Vn.transpose(eq,eq);for(var p=e.offset,m=e.size,g=function(){var t=i.struct.vertexBundles[v];n=t.view.offset,r=Ac.UNKNOWN;for(var g=0;g<t.attributes.length;g++){var S=t.attributes[g];if(S.name===a_.ATTR_POSITION){r=S.format;break}n+=ff[S.format].size}if(r){for(var A=HI(d,r,n,t.view.length,t.view.stride),T=0;T<A.length;T+=3)mn.fromArray(vq,A,T),mn.transformMat4(vq,vq,e._localTransform),mn.toArray(A,vq,T);zI(d,A,r,n,t.view.stride)}s=t.view.offset,o=Ac.UNKNOWN;for(var b=0;b<t.attributes.length;b++){var E=t.attributes[b];if(E.name===a_.ATTR_NORMAL){o=E.format;break}s+=ff[E.format].size}if(o){for(var C=HI(d,o,s,t.view.length,t.view.stride),x=0;x<C.length;x+=3)mn.fromArray(vq,C,x),mn.transformMat4Normal(vq,vq,eq),mn.toArray(C,vq,x);zI(d,C,o,s,t.view.stride)}a=t.view.offset,h=Ac.UNKNOWN;for(var w=0;w<t.attributes.length;w++){var D=t.attributes[w];if(D.name===a_.ATTR_TANGENT){h=D.format;break}a+=ff[D.format].size}if(h){for(var R=HI(d,h,a,t.view.length,t.view.stride),I=0;I<R.length;I+=3)mn.fromArray(vq,R,I),mn.transformMat4Normal(vq,vq,eq),mn.toArray(R,vq,I);zI(d,R,h,a,t.view.stride)}u=t.view.offset,l=Ac.UNKNOWN;for(var M=0;M<t.attributes.length;M++){var P=t.attributes[M];if(P.name===a_.ATTR_BATCH_UV){l=P.format;break}u+=ff[P.format].size}l&&WI(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 B=f[y];if(!B)return 1;c=t.view.offset,_=Ac.UNKNOWN;for(var O=0;O<t.attributes.length;O++){var L=t.attributes[O];if(L.name===a_.ATTR_JOINTS){_=L.format;break}c+=ff[L.format].size}_&&WI(d,(function(t){return B[t]}),_,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=[],o=[],a=0;a<this.units.length;a++){var h=this.units[a];if(h.material){var u=h.material.getProperty(e,i);if(u&&u.image&&u.image.data){var l=new y_;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),o.push(l)):(n.push(c),r.push(l))}}}var _=t.getGFXTexture(),f=v.director.root.device;s.length>0&&f.copyBuffersToTexture(s,_,o),n.length>0&&f.copyTexImagesToTexture(n,_,r)},i.createTexture=function(t){var e=new Dm;return e.setFilters(Gd.LINEAR,Gd.LINEAR),e.setMipFilter(Gd.NEAREST),e.reset({width:this.atlasSize,height:this.atlasSize,format:kd.RGBA8888}),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:kd.RGBA8888})},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],o=0,a=Ac.UNKNOWN,h=0;h<s.vertexBundelIndices.length;h++){var u=e.struct.vertexBundles[s.vertexBundelIndices[h]];o=u.view.offset,a=Ac.UNKNOWN;for(var l=0;l<u.attributes.length;l++){var c=u.attributes[l];if(c.name===a_.ATTR_TEX_COORD){a=c.format;break}o+=ff[c.format].size}if(a)break}if(void 0===n[h]){n[h]=[a,o];var _=i.vertexBundles[h];_.attributes.push(ZY),_.attributes.push(JY),_.view.offset=0,_.view.length+=_.view.count*$Y,_.view.stride+=$Y}}for(var f=0,d=0;d<i.vertexBundles.length;d++)f+=i.vertexBundles[d].view.length;for(var p=0;p<i.primitives.length;p++){var m=i.primitives[p];m.indexView&&(m.indexView.offset=f,f+=m.indexView.length)}var g=new Uint8Array(f),y=e.data,S=new DataView(g.buffer),A=new DataView(y.buffer),T=v.sys.isLittleEndian;for(var b in n)for(var E=i.vertexBundles[b],C=e.struct.vertexBundles[b],x=n[b],w=HI(A,x[0],x[1],C.view.length,C.view.stride),D=C.view,R=E.view,I=D.stride,M=R.stride,P=D.offset,B=R.offset,O=0;O<R.count;O++){var L=y.subarray(P,P+I);g.set(L,B),S.setFloat32(B+I,t),S.setFloat32(B+I+4,w[2*O],T),S.setFloat32(B+I+8,w[2*O+1],T),B+=M,P+=I}for(var N=0;N<i.primitives.length;N++){var F=e.struct.primitives[N],k=i.primitives[N];if(F.indexView&&k.indexView)for(var V=F.indexView.stride,G=k.indexView.stride,U=F.indexView.offset,z=k.indexView.offset,H=0;H<k.indexView.count;H++){var W=y.subarray(U,U+V);g.set(W,z),z+=G,U+=V}}var j=new rP;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}(QY),WY=fa(HY.prototype,"atlasSize",[Ma],(function(){return 1024})),jY=fa(HY.prototype,"batchableTextureNames",[GY,Ma],(function(){return[]})),XY=fa(HY.prototype,"units",[UY,Ma],(function(){return[]})),m(HY.prototype,"mesh",[_h],Object.getOwnPropertyDescriptor(HY.prototype,"mesh"),HY.prototype),m(HY.prototype,"skeleton",[_h],Object.getOwnPropertyDescriptor(HY.prototype,"skeleton"),HY.prototype),zY=HY))||zY)||zY));v.SkinningModelComponent=QY,ie(QY,"cc.SkinningModelComponent"),v.SkinningModelUnit=tq,ie(tq,"cc.SkinningModelUnit"),v.BatchedSkinningModelComponent=Sq,ie(Sq,"cc.BatchedSkinningModelComponent");var Aq=[.25,.125,.01],Tq=t("am",(iq=Ta("cc.LOD"),nq=eh([YH]),rq=eh(ii),sq=eh([YH]),oq=eh([ei]),iq((hq=function(){function t(){this._screenUsagePercentage=uq&&uq(),this._renderers=lq&&lq(),this._LODData=new rR,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?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?z("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?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}(),uq=fa(hq.prototype,"_screenUsagePercentage",[Ma],(function(){return 1})),lq=fa(hq.prototype,"_renderers",[nq,Ma],(function(){return[]})),m(hq.prototype,"screenUsagePercentage",[rq],Object.getOwnPropertyDescriptor(hq.prototype,"screenUsagePercentage"),hq.prototype),m(hq.prototype,"renderers",[sq],Object.getOwnPropertyDescriptor(hq.prototype,"renderers"),hq.prototype),m(hq.prototype,"triangleCount",[oq],Object.getOwnPropertyDescriptor(hq.prototype,"triangleCount"),hq.prototype),aq=hq))||aq)),bq=(t("an",(cq=Ta("cc.LODGroup"),_q=eh(ii),fq=eh([Tq]),cq((pq=function(t){function e(){var e;return(e=t.call(this)||this)._localBoundaryCenter=mq&&mq(),e._objectSize=gq&&gq(),e._LODs=yq&&yq(),e._lodGroup=new sR,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 Tq),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=Aq[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 U("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):(U("eraseLOD error, LOD not exist at specified index."),null)},i.getLOD=function(t){return t<0||t>=this.lodCount?(U("getLOD error, index out of range"),null):this._LODs[t]},i.setLOD=function(t,e){t<0||t>=this.lodCount?U("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 mn,e=new mn,i=null,n=new mn,r=0;r<this.lodCount;++r){var s=this.getLOD(r);if(s)for(var o=0;o<s.rendererCount;++o){var a,h,u=s.getRenderer(o);if(u){null===(a=u.model)||void 0===a||a.updateWorldBound();var l=null===(h=u.model)||void 0===h?void 0:h.worldBounds;l&&(l.getBoundary(t,e),i?(mn.min(i,i,t),mn.max(n,n,e)):(i=t.clone(),n=e.clone()))}}}if(i){var c=i,_=new mn(.5*(n.x+c.x),.5*(n.y+c.y),.5*(n.z+c.z)),f=new mn(.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 mn(t.x-e.x,t.y-e.y,t.z-e.z),new mn(t.x-e.x,t.y+e.y,t.z-e.z),new mn(t.x+e.x,t.y+e.y,t.z-e.z),new mn(t.x+e.x,t.y-e.y,t.z-e.z),new mn(t.x-e.x,t.y-e.y,t.z+e.z),new mn(t.x-e.x,t.y+e.y,t.z+e.z),new mn(t.x+e.x,t.y+e.y,t.z+e.z),new mn(t.x+e.x,t.y-e.y,t.z+e.z));r=(n=s[0].transformMat4(i)).clone();for(var o=1;o<8;++o){var a=s[o].transformMat4(i);n=mn.min(n,n,a),r=mn.max(r,r,a)}return[n,r]}(_,f,this.node.worldMatrix.clone().invert()),p=d[0],m=d[1];_.set(.5*(m.x+p.x),.5*(m.y+p.y),.5*(m.z+p.z)),f.set(.5*(m.x-p.x),.5*(m.y-p.y),.5*(m.z-p.z)),this.localBoundaryCenter=_,this.objectSize=2*Math.max(f.x,f.y,f.z)}else this.localBoundaryCenter=new mn(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(Nm.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=Aq.length,e=0;e<t;e++)this.insertLOD(e,Aq[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,o=n[r];s&&o&&o.model&&s.addModel(o.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}(Lp),mq=fa(pq.prototype,"_localBoundaryCenter",[Ma],(function(){return new mn(0,0,0)})),gq=fa(pq.prototype,"_objectSize",[Ma],(function(){return 0})),yq=fa(pq.prototype,"_LODs",[Ma],(function(){return[]})),m(pq.prototype,"objectSize",[_q],Object.getOwnPropertyDescriptor(pq.prototype,"objectSize"),pq.prototype),m(pq.prototype,"LODs",[fq],Object.getOwnPropertyDescriptor(pq.prototype,"LODs"),pq.prototype),dq=pq))||dq)),Pm.makeMaskExclude([Pm.BitMask.UI_2D,Pm.BitMask.UI_3D,Pm.BitMask.GIZMOS,Pm.BitMask.EDITOR,Pm.BitMask.SCENE_GIZMO,Pm.BitMask.PROFILER,Pm.Enum.IGNORE_RAYCAST])),Eq=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||(v.director.on(v.Director.EVENT_BEFORE_UPDATE,this.onUpdateProbes,this),this._registeredEvent=!0)},e.onUpdateProbes=function(){if(0!==this._probes.length){var t=v.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&bq&&(n.reflectionProbeType===bD.BAKED_CUBEMAP||this._isUsedBlending(n)?this.selectReflectionProbe(n):n.reflectionProbeType===bD.PLANAR_REFLECTION&&this.selectPlanarReflectionProbe(n))}}},e.filterModelsForPlanarReflection=function(){if(0!==this._probes.length){var t=v.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&bq&&n.reflectionProbeType===bD.PLANAR_REFLECTION&&this.selectPlanarReflectionProbe(n)}}},e.clearPlanarReflectionMap=function(t){for(var e,i=f(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=f(this._useCubeModels.entries());!(r=s()).done;){var o=r.value;o[0].reflectionProbeBlendId===t.getProbeId()&&this._updateBlendCubemap(o[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(YH);r&&r.updateProbePlanarMap(e)}}},e.selectPlanarReflectionProbe=function(t){if(t.node&&t.worldBounds&&t.reflectionProbeType===bD.PLANAR_REFLECTION){for(var e=0;e<this._probes.length;e++){var i=this._probes[e];i.probeType===vD.PLANAR&&t.node.layer&bq&&(t.updateWorldBound(),gs.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++)this._probes[n].probeType===vD.PLANAR&&(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&bq){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&&this._probes[i].probeType===vD.CUBE||this._isUsedBlending(t))&&this.updateBakedCubemap(this._probes[i])},e.updatePreviewSphere=function(t){if(t&&t.previewSphere){var e=t.previewSphere.getComponent(YH);e&&(e.updateProbeCubemap(t.cubemap),e.updateReflectionProbeId(t.getProbeId()))}},e.updatePreviewPlane=function(t){t&&t.previewPlane&&t.previewPlane.getComponent(YH)&&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(s.probeType===vD.CUBE){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 o=s.isRGBE()?1e3:0;i[n+8]=s.cubemap?s.cubemap.mipmapLevel+o:1+o}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 a=new Uint8Array(i.buffer),h=new sp({_data:a,_compressed:!1,width:12,height:e,format:kd.RGBA8888});this._dataTexture=new Dm,this._dataTexture.setFilters(Dm.Filter.NONE,Dm.Filter.NONE),this._dataTexture.setMipFilter(Dm.Filter.NONE),this._dataTexture.setWrapMode(Dm.WrapMode.CLAMP_TO_EDGE,Dm.WrapMode.CLAMP_TO_EDGE,Dm.WrapMode.CLAMP_TO_EDGE),this._dataTexture.image=h,this._dataTexture.uploadData(a);for(var u=0;u<this._probes.length;u++)for(var l=this._probes[u],c=this._getModelsByProbe(l),_=0;_<c.length;_++){var f=c[_].node.getComponent(YH);f&&f.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=v.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&bq&&(n.reflectionProbeType===bD.BAKED_CUBEMAP||n.reflectionProbeType===bD.PLANAR_REFLECTION||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=f(this._probes);!(e=r()).done;){var s=e.value;if(s.probeType===vD.CUBE&&s.validate()&&gs.aabbWithAABB(t.worldBounds,s.boundingBox)){var o=mn.distance(t.node.worldPosition,s.node.worldPosition);o<n&&(n=o,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++)this._probes[i].probeType===vD.CUBE&&this._probes[i].validate()&&gs.aabbWithAABB(t.worldBounds,this._probes[i].boundingBox)&&e.push(this._probes[i]);return e.sort((function(e,i){return mn.distance(t.node.worldPosition,e.node.worldPosition)-mn.distance(t.node.worldPosition,i.node.worldPosition)})),e.length>1?e[1]:null},e._getModelsByProbe=function(t){var e=[],i=this._useCubeModels;t.probeType===vD.PLANAR&&(i=this._usePlanarModels);for(var n,r=f(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=f(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,o=f(this._usePlanarModels.keys());!(s=o()).done;){var a=s.value,h=this._usePlanarModels.get(a);void 0!==h&&h===t&&(this._usePlanarModels.delete(a),this.selectPlanarReflectionProbe(a))}},e._updateCubemapOfModel=function(t,e){var i=t.node;if(i){var n=i.getComponent(YH);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(YH);n&&(n.updateProbePlanarMap(e),i?(n.updateReflectionProbeId(i.getProbeId()),n.updateReflectionProbeDataMap(this._dataTexture)):n.updateReflectionProbeId(-1))},e._isUsedBlending=function(t){return t.reflectionProbeType===bD.BLEND_PROBES||t.reflectionProbeType===bD.BLEND_PROBES_AND_SKYBOX},e._updateBlendProbeInfo=function(t,e,i){var n=t.node;if(n){var r=n.getComponent(YH);r&&(i?(r.updateReflectionProbeBlendId(i.getProbeId()),r.updateProbeBlendCubemap(i.cubemap),r.updateReflectionProbeBlendWeight(this._calculateBlendWeight(t,e,i))):(r.updateReflectionProbeBlendId(-1),t.reflectionProbeType===bD.BLEND_PROBES_AND_SKYBOX&&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(YH);n&&n.updateProbeBlendCubemap(e.cubemap)}},e._calculateBlendWeight=function(t,e,i){if(i){var n=mn.distance(t.node.worldPosition,e.node.worldPosition),r=mn.distance(t.node.worldPosition,i.node.worldPosition);return 1-r/(n+r)}return t.reflectionProbeType===bD.BLEND_PROBES?0:t.reflectionProbeType===bD.BLEND_PROBES_AND_SKYBOX?this._calculateBlendOfSkybox(t.worldBounds,e.boundingBox):0},e._calculateBlendOfSkybox=function(t,e){if(!t)return 1;var i=new mn,n=new mn,r=new mn,s=new mn;if(mn.subtract(i,t.center,t.halfExtents),mn.add(n,t.center,t.halfExtents),mn.subtract(r,e.center,e.halfExtents),mn.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 o=new mn;mn.multiplyScalar(o,t.halfExtents,2);var a=i.x+o.x<=s.x&&n.x+o.x>=r.x,h=i.x-o.x<=s.x&&n.x-o.x>=r.x,u=i.y+o.y<=s.y&&n.y+o.y>=r.y,l=i.y-o.y<=s.y&&n.y-o.y>=r.y,c=i.z+o.z<=s.z&&n.z+o.z>=r.z,_=i.z-o.z<=s.z&&n.z-o.z>=r.z,f=[];if(!a){var d=n.x-s.x;f.push(d/o.x)}if(!h){var p=Math.abs(i.x-r.x);f.push(p/o.x)}if(!u){var m=n.y-s.y;f.push(m/o.y)}if(!l){var g=Math.abs(i.y-r.y);f.push(g/o.y)}if(!c){var y=n.z-s.z;f.push(y/o.z)}if(!_){var v=Math.abs(i.z-r.z);f.push(v/o.z)}return f.length>0?(f.sort((function(t,e){return e-t})),f[0]):0}return 1},n(t,[{key:"updateForRuntime",get:function(){return this._updateForRuntime},set:function(t){this._updateForRuntime=t}}]),t}());function Cq(t){return void 0===(t=t||{}).includeNormal&&(t.includeNormal=!0),void 0===t.includeUV&&(t.includeUV=!0),t}Eq.probeManager=void 0,Eq.probeManager=new Eq,v.internal.reflectionProbeManager=Eq.probeManager;var xq=new mn,wq=new mn,Dq=new mn,Rq=new mn,Iq=new mn,Mq=new mn,Pq=new mn,Bq=new mn,Oq=new mn,Lq=new mn,Nq=new mn,Fq=new mn,kq=new mn(0,0,0),Vq=new mn(0,0,0);function Gq(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,o=n.heightSegments||1,a=void 0===n.capped||n.capped,h=n.arc||2*Math.PI,u=0;a&&(t>0&&u++,e>0&&u++);var l=(s+1)*(o+1);a&&(l+=(s+1)*u+s*u);var c=s*o*6;a&&(c+=s*u*3);var _=new Array(c),f=new Array(3*l),d=new Array(3*l),p=new Array(2*l),m=Math.max(t,e),g=new mn(-m,-r,-m),y=new mn(m,r,m),v=Math.sqrt(m*m+r*r),S=0,A=0;return function(){for(var n=[],a=t-e,u=a*a/i*Math.sign(a),l=0;l<=o;l++){for(var c=[],m=l/o,g=m*a+e,y=0;y<=s;++y){var v=y/s,T=v*h,b=Math.sin(T),E=Math.cos(T);f[3*S]=g*b,f[3*S+1]=m*i-r,f[3*S+2]=g*E,mn.normalize(kq,mn.set(Vq,b,-u,E)),d[3*S]=kq.x,d[3*S+1]=kq.y,d[3*S+2]=kq.z,p[2*S]=2*(1-v)%1,p[2*S+1]=m,c.push(S),++S}n.push(c)}for(var C=0;C<o;++C)for(var x=0;x<s;++x){var w=n[C][x],D=n[C+1][x],R=n[C+1][x+1],I=n[C][x+1];_[A]=w,++A,_[A]=I,++A,_[A]=D,++A,_[A]=I,++A,_[A]=R,++A,_[A]=D,++A}}(),a&&(e>0&&T(!1),t>0&&T(!0)),{positions:f,normals:d,uvs:p,indices:_,minPos:g,maxPos:y,boundingRadius:v};function T(i){for(var n=i?t:e,o=i?1:-1,a=S,u=1;u<=s;++u)f[3*S]=0,f[3*S+1]=r*o,f[3*S+2]=0,d[3*S]=0,d[3*S+1]=o,d[3*S+2]=0,p[2*S]=.5,p[2*S+1]=.5,++S;for(var l=S,c=0;c<=s;++c){var m=c/s*h,g=Math.cos(m),y=Math.sin(m);f[3*S]=n*y,f[3*S+1]=r*o,f[3*S+2]=n*g,d[3*S]=0,d[3*S+1]=o,d[3*S+2]=0,p[2*S]=.5-.5*y*o,p[2*S+1]=.5+.5*g,++S}for(var v=0;v<s;++v){var T=a+v,b=l+v;i?(_[A]=b+1,++A,_[A]=T,++A,_[A]=b,++A):(_[A]=T,++A,_[A]=b+1,++A,_[A]=b,++A)}}}var Uq=new mn(0,0,0),zq=new mn(0,0,0),Hq=new mn(0,0,0),Wq=new mn(0,0,0),jq=new mn(0,0,0),Xq=new mn(0,0,0),Yq=new mn(0,0,0),qq=new mn(0,0,0),Kq=new mn(0,0,0),Qq=Object.freeze({__proto__:null,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,o=(t.length||1)/2,a=[mn.set(Iq,-r,-s,o),mn.set(Mq,r,-s,o),mn.set(Pq,r,s,o),mn.set(Bq,-r,s,o),mn.set(Oq,r,-s,-o),mn.set(Lq,-r,-s,-o),mn.set(Nq,-r,s,-o),mn.set(Fq,r,s,-o)],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 mn(-r,-s,-o),g=new mn(r,s,o),y=Math.sqrt(r*r+s*s+o*o);function v(t,e,i){var n,r,s,o,m=c.length/3,g=h[t],y=u[t],v=l[t];for(o=0;o<=i;o++)for(s=0;s<=e;s++)if(n=s/e,r=o/i,mn.lerp(xq,a[g[0]],a[g[1]],n),mn.lerp(wq,a[g[0]],a[g[2]],r),mn.subtract(Dq,wq,a[g[0]]),mn.add(Rq,xq,Dq),c.push(Rq.x,Rq.y,Rq.z),_.push(y[0],y[1],y[2]),f.push(n,r),d.push(v[0],v[1],v[2],v[3]),s<e&&o<i){var S=e+1,A=s+o*S,T=s+(o+1)*S,b=s+1+(o+1)*S,E=s+1+o*S;p.push(m+A,m+E,m+T),p.push(m+T,m+E,m+b)}}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:_,uvs:f,tangents:d,indices:p,minPos:m,maxPos:g,boundingRadius:y}},cone:function(t,e,i){return void 0===t&&(t=.5),void 0===e&&(e=1),void 0===i&&(i={}),Gq(0,t,e,i)},cylinder:Gq,plane:function(t){var e=function(t){return(t=Cq(t)).width=t.width||10,t.length=t.length||10,t.widthSegments=t.widthSegments||10,t.lengthSegments=t.lengthSegments||10,t}(t),i=e.width,n=e.length,r=e.widthSegments,s=e.lengthSegments,o=.5*i,a=.5*n,h=[],u=[],l=[],c=new mn(-o,0,-a),_=new mn(o,0,a),f=Math.sqrt(i*i+n*n);mn.set(jq,-o,0,a),mn.set(Xq,o,0,a),mn.set(Yq,-o,0,-a);for(var d=0;d<=s;d++)for(var p=0;p<=r;p++){var m=p/r,g=d/s;if(mn.lerp(Uq,jq,Xq,m),mn.lerp(zq,jq,Yq,g),mn.subtract(Hq,zq,jq),mn.add(Wq,Uq,Hq),h.push(Wq.x,Wq.y,Wq.z),e.includeUV&&u.push(m,g),p<r&&d<s){var y=r+1,v=p+d*y,S=p+(d+1)*y,A=p+1+(d+1)*y,T=p+1+d*y;l.push(v,T,S),l.push(T,A,S)}}var b={positions:h,indices:l,minPos:c,maxPos:_,boundingRadius:f};if(e.includeNormal){var E=(s+1)*(r+1),C=new Array(3*E);b.normals=C;for(var x=0;x<E;++x)C[3*x+0]=0,C[3*x+1]=1,C[3*x+2]=0}return e.includeUV&&(b.uvs=u),b},quad:function(t){var e=Cq(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},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=[],o=[],a=new mn(-t,-t,-t),h=new mn(t,t,t),u=t,l=0;l<=i;++l)for(var c=l*Math.PI/i,_=Math.sin(c),f=-Math.cos(c),d=0;d<=i;++d){var p=2*d*Math.PI/i-Math.PI/2,m=Math.sin(p)*_,g=f,y=Math.cos(p)*_,v=d/i,S=l/i;if(n.push(m*t,g*t,y*t),r.push(m,g,y),s.push(v,S),l<i&&d<i){var A=i+1,T=A*l+d,b=A*(l+1)+d,E=A*(l+1)+d+1,C=A*l+d+1;o.push(T,C,b),o.push(C,E,b)}}return{positions:n,indices:o,normals:r,uvs:s,minPos:a,maxPos:h,boundingRadius:u}},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,o=[],a=[],h=[],u=[],l=new mn(-t-e,-e,-t-e),c=new mn(t+e,e,t+e),_=t+e,f=0;f<=n;f++)for(var d=0;d<=r;d++){var p=d/r,m=f/n,g=p*s,y=m*Math.PI*2,v=(t+e*Math.cos(y))*Math.sin(g),S=e*Math.sin(y),A=(t+e*Math.cos(y))*Math.cos(g),T=Math.sin(g)*Math.cos(y),b=Math.sin(y),E=Math.cos(g)*Math.cos(y);if(o.push(v,S,A),a.push(T,b,E),h.push(p,m),d<r&&f<n){var C=r+1,x=C*f+d,w=C*(f+1)+d,D=C*(f+1)+d+1,R=C*f+d+1;u.push(x,R,w),u.push(R,D,w)}}return{positions:o,normals:a,uvs:h,indices:u,minPos:l,maxPos:c,boundingRadius:_}},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,o=n.heightSegments||32,a=e/i,h=r/i,u=t/i,l=Math.floor(o*a),c=Math.floor(o*u),_=Math.floor(o*h),f=r+e-i/2,d=e-i/2,p=e-i/2,m=n.arc||2*Math.PI,g=[],y=[],v=[],S=[],A=Math.max(t,e),T=new mn(-A,-i/2,-A),b=new mn(A,i/2,A),E=i/2,C=0,x=[];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),a=0;a<=s;++a){var h=2*a*Math.PI/s-Math.PI/2,u=Math.sin(h)*n,c=r,_=Math.cos(h)*n,f=a/s,d=t/o;if(g.push(u*e,c*e+p,_*e),y.push(u,c,_),v.push(f,d),t<l&&a<s){var m=s+1,A=m*t+a,T=m*(t+1)+a,b=m*(t+1)+a+1,E=m*t+a+1;S.push(A,E,T),S.push(E,b,T)}++C}}(),function(){for(var i=(t-e)/r,n=0;n<=_;n++){for(var o=[],u=n/_,l=u*(t-e)+e,c=0;c<=s;++c){var f=c/s,p=u*h+a,A=f*m-m/4,T=Math.sin(A),b=Math.cos(A);g.push(l*T),g.push(u*r+d),g.push(l*b),mn.normalize(qq,mn.set(Kq,T,-i,b)),y.push(qq.x),y.push(qq.y),y.push(qq.z),v.push(f,p),o.push(C),++C}x.push(o)}for(var E=0;E<_;++E)for(var w=0;w<s;++w){var D=x[E][w],R=x[E+1][w],I=x[E+1][w+1],M=x[E][w+1];S.push(D),S.push(M),S.push(R),S.push(M),S.push(I),S.push(R)}}(),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),a=0;a<=s;++a){var h=2*a*Math.PI/s-Math.PI/2,l=Math.sin(h)*n,d=r,p=Math.cos(h)*n,m=a/s,A=e/o+(1-u);if(g.push(l*t,d*t+f,p*t),y.push(l,d,p),v.push(m,A),e<c&&a<s){var T=s+1,b=T*e+a+x[_][s]+1,E=T*(e+1)+a+x[_][s]+1,C=T*(e+1)+a+1+x[_][s]+1,w=T*e+a+1+x[_][s]+1;S.push(b,w,E),S.push(w,C,E)}}}(),{positions:g,normals:y,uvs:v,indices:S,minPos:T,maxPos:b,boundingRadius:E}},circle:function(t){var e=function(t){return(t=Cq(t)).segments=64,t}(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 o=r*s,a=Math.cos(o),h=Math.sin(o),u=3*(s+1);i[u+0]=a,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:Yc.TRIANGLE_FAN}},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),o=0;o<s;++o){var a=3*o,h=3*o+1,u=3*o+2;t.positions[a]+=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},scale:function(t,e){for(var i,n,r,s=null!==(i=e.x)&&void 0!==i?i:1,o=null!==(n=e.y)&&void 0!==n?n:1,a=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,_=3*u+2;t.positions[l]*=s,t.positions[c]*=o,t.positions[_]*=a}var f=t.minPos,d=t.maxPos;if(f&&(f.x*=s,f.y*=o,f.z*=a),d&&(d.x*=s,d.y*=o,d.z*=a),f&&d){if(s<0){var p=f.x;f.x=d.x,d.x=p}if(o<0){var m=f.y;f.y=d.y,d.y=m}if(a<0){var g=f.z;f.z=d.z,d.z=g}}return void 0!==t.boundingRadius&&(t.boundingRadius*=Math.max(Math.max(Math.abs(s),Math.abs(o)),Math.abs(a))),t},wireframed:function(t){var e=t.indices;if(!e)return t;if(t.primitiveMode&&t.primitiveMode!==Yc.TRIANGLE_LIST)return t;for(var i=[[0,1],[1,2],[2,0]],n=[],r={},s=0;s<e.length;s+=3)for(var o=0;o<3;++o){var a=e[s+i[o][0]],h=e[s+i[o][1]],u=a>h?h<<16|a:a<<16|h;void 0===r[u]&&(r[u]=0,n.push(a,h))}return t.indices=n,t.primitiveMode=Yc.LINE_LIST,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 o=t[r+e[s][0]],a=t[r+e[s][1]],h=o>a?a<<16|o:o<<16|a;void 0===n[h]&&(n[h]=0,i.push(o,a))}return i},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},toWavefrontOBJ:function(t,e){if(void 0===e&&(e=1),!t.indices||!t.uvs||!t.normals||void 0!==t.primitiveMode&&t.primitiveMode!==Yc.TRIANGLE_LIST)return"";for(var i=t.positions,n=t.uvs,r=t.normals,s=t.indices,o=function(t){return s[t]+1+"/"+(s[t]+1)+"/"+(s[t]+1)},a="",h=0;h<i.length;h+=3)a+="v "+i[h]*e+" "+i[h+1]*e+" "+i[h+2]*e+"\n";for(var u=0;u<n.length;u+=2)a+="vt "+n[u]+" "+n[u+1]+"\n";for(var l=0;l<r.length;l+=3)a+="vn "+r[l]+" "+r[l+1]+" "+r[l+2]+"\n";for(var c=0;c<s.length;c+=3)a+="f "+o(c)+" "+o(c+1)+" "+o(c+2)+"\n";return a},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,o=6*r;n[o+0]=t[s+0],n[o+1]=t[s+1],n[o+2]=t[s+2],n[o+3]=t[s+0]+e[s+0]*i,n[o+4]=t[s+1]+e[s+1]*i,n[o+5]=t[s+2]+e[s+2]*i}return n},applyDefaultGeometryOptions:Cq});t("fV",Qq);var Zq=new mn;function Jq(t){return t.x=Math.abs(t.x),t.y=Math.abs(t.y),t.z=Math.abs(t.z),t}var $q,tK,eK,iK,nK,rK,sK,oK,aK,hK,uK,lK,cK,_K,fK,dK,pK,mK,gK,yK,vK,SK,AK,TK,bK=Object.freeze({__proto__:null,setWrap:function(t,e){t.__cc_wrapper__=e},getWrap:function(t){return t.__cc_wrapper__},maxComponent:function(t){return Math.max(t.x,Math.max(t.y,t.z))},VEC3_0:Zq,TriggerEventObject:{type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},CharacterTriggerEventObject:{type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},CollisionEventObject:{type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},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],o=t[r+1],a=t[r+2],h=String(s)+String(o)+String(a),u=hc(h,666);i[u]!==h&&(i[u]=h,e.push(s),e.push(o),e.push(a))}}return e},absolute:Jq,cylinder:Gq});!function(t){t[t.Low_256x256=256]="Low_256x256",t[t.Medium_512x512=512]="Medium_512x512",t[t.High_768x768=768]="High_768x768"}(TK||(TK={})),t("ao",($q=Ta("cc.ReflectionProbe"),tK=eh(mn),eK=eh(be(vD)),iK=eh(be(TK)),nK=eh(be(yD)),rK=eh(bn),sK=eh(Pm.BitMask),oK=eh(Hk),aK=eh(ni),hK=eh(wg),$q(((AK=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=new mn,e._resolution=cK&&cK(),e._clearFlag=_K&&_K(),e._backgroundColor=fK&&fK(),e._visibility=dK&&dK(),e._probeType=pK&&pK(),e._cubemap=mK&&mK(),e._size=gK&&gK(),e._sourceCamera=yK&&yK(),e._probeId=vK&&vK(),e._fastBake=SK&&SK(),e._probe=null,e._previewSphere=null,e._previewPlane=null,e._sourceCameraPos=new mn(0,0,0),e._position=new mn(0,0,0),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._createProbe()},i.onEnable=function(){if(this._probe){var t=Eq.probeManager.getProbeById(this._probeId);null!==t&&t!==this._probe&&(this._probeId=Eq.probeManager.getNewReflectionProbeId(),this._probe.updateProbeId(this._probeId)),Eq.probeManager.register(this._probe),Eq.probeManager.onUpdateProbes(),this._probe.enable()}},i.onDisable=function(){this._probe&&(Eq.probeManager.unregister(this._probe),this._probe.disable())},i.start=function(){this._sourceCamera&&this.probeType===vD.PLANAR&&(this.probe.renderPlanarReflection(this.sourceCamera.camera),Eq.probeManager.filterModelsForPlanarReflection()),Eq.probeManager.updateProbeData(),this._position=this.node.getWorldPosition().clone()},i.onDestroy=function(){this.probe&&this.probe.destroy()},i.update=function(){if(this.probe){this.probeType===vD.PLANAR&&this.sourceCamera&&(this.sourceCamera.node.hasChangedFlags&Om.TRS||!this._sourceCameraPos.equals(this.sourceCamera.node.getWorldPosition()))&&(this._sourceCameraPos=this.sourceCamera.node.getWorldPosition(),this.probe.renderPlanarReflection(this.sourceCamera.camera)),this.node.hasChangedFlags&Om.POSITION&&(this.probe.updateBoundingBox(),Eq.probeManager.onUpdateProbes(),Eq.probeManager.updateProbeData());var t=this.node.getWorldPosition();this._position.equals(t)||(this._position=t,this.probe.updateBoundingBox(),Eq.probeManager.updateProbeData(),Eq.probeManager.updateProbeOfModels())}},i.clearBakedCubemap=function(){this.cubemap=null,Eq.probeManager.updateBakedCubemap(this.probe),Eq.probeManager.updatePreviewSphere(this.probe)},i._createProbe=function(){if((-1===this._probeId||Eq.probeManager.exists(this._probeId))&&(this._probeId=Eq.probeManager.getNewReflectionProbeId()),this._probe=new CD(this._probeId),this._probe){var t=new xg("ReflectionProbeCamera");t.hideFlags|=$s.Flags.DontSave|$s.Flags.HideInHierarchy,this.node.scene.addChild(t),this._probe.initialize(this.node,t),this.enabled&&Eq.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),Jq(this._size),this.probe.size=this._size,this.probe&&(this.probe.updateBoundingBox(),Eq.probeManager.onUpdateProbes(),Eq.probeManager.updateProbeData(),Eq.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=mn.equals(this._lastSize,mn.ZERO);this._probeType=t,this._probeType===vD.CUBE?(n&&this._size.set(e.DEFAULT_CUBE_SIZE),this.probe.switchProbeType(t,null),Eq.probeManager.clearPlanarReflectionMap(this.probe)):(n&&this._size.set(e.DEFAULT_PLANER_SIZE),this._sourceCamera?this.probe.switchProbeType(t,this._sourceCamera.camera):U("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,this.probeType===vD.PLANAR&&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,Eq.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&&Eq.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&&Eq.probeManager.updatePreviewPlane(this.probe))}}]),e}(Lp)).DEFAULT_CUBE_SIZE=new mn(1,1,1),AK.DEFAULT_PLANER_SIZE=new mn(5,.5,5),cK=fa((lK=AK).prototype,"_resolution",[Ma],(function(){return 256})),_K=fa(lK.prototype,"_clearFlag",[Ma],(function(){return yD.SKYBOX})),fK=fa(lK.prototype,"_backgroundColor",[Ma],(function(){return new bn(0,0,0,255)})),dK=fa(lK.prototype,"_visibility",[Ma],(function(){return bv})),pK=fa(lK.prototype,"_probeType",[Ma],(function(){return vD.CUBE})),mK=fa(lK.prototype,"_cubemap",[Ma],(function(){return null})),gK=fa(lK.prototype,"_size",[Ma],(function(){return new mn(1,1,1)})),yK=fa(lK.prototype,"_sourceCamera",[Ma],(function(){return null})),vK=fa(lK.prototype,"_probeId",[Ma],(function(){return-1})),SK=fa(lK.prototype,"_fastBake",[Ma],(function(){return!1})),m(lK.prototype,"size",[tK],Object.getOwnPropertyDescriptor(lK.prototype,"size"),lK.prototype),m(lK.prototype,"probeType",[eK],Object.getOwnPropertyDescriptor(lK.prototype,"probeType"),lK.prototype),m(lK.prototype,"resolution",[iK],Object.getOwnPropertyDescriptor(lK.prototype,"resolution"),lK.prototype),m(lK.prototype,"clearFlag",[nK],Object.getOwnPropertyDescriptor(lK.prototype,"clearFlag"),lK.prototype),m(lK.prototype,"backgroundColor",[rK],Object.getOwnPropertyDescriptor(lK.prototype,"backgroundColor"),lK.prototype),m(lK.prototype,"visibility",[sK],Object.getOwnPropertyDescriptor(lK.prototype,"visibility"),lK.prototype),m(lK.prototype,"sourceCamera",[oK],Object.getOwnPropertyDescriptor(lK.prototype,"sourceCamera"),lK.prototype),m(lK.prototype,"fastBake",[aK],Object.getOwnPropertyDescriptor(lK.prototype,"fastBake"),lK.prototype),m(lK.prototype,"cubemap",[hK],Object.getOwnPropertyDescriptor(lK.prototype,"cubemap"),lK.prototype),uK=lK))||uK)),v.utils=vP;var EK,CK,xK,wK,DK,RK=Symbol("CreateEval");Ta("cc.animation.EmbeddedPlayer")((EK=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=CK&&CK(),e.end=xK&&xK(),e.reconciledSpeed=wK&&wK(),e.playable=DK&&DK(),e}return s(e,t),e}(fh),CK=fa(EK.prototype,"begin",[Ma],(function(){return 0})),xK=fa(EK.prototype,"end",[Ma],(function(){return 0})),wK=fa(EK.prototype,"reconciledSpeed",[Ma],(function(){return!1})),DK=fa(EK.prototype,"playable",[Ma],(function(){return null})),EK));var IK,MK=function(){},PK=function(){function t(t){this._randomAccess=t}return t.prototype.setTime=function(){},n(t,[{key:"randomAccess",get:function(){return this._randomAccess}}]),t}(),BK=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(st(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}();!function(t){t[t.Default=Dl.Default]="Default",t[t.Normal=Dl.Normal]="Normal",t[t.Reverse=Dl.Reverse]="Reverse",t[t.Loop=Dl.Loop]="Loop",t[t.LoopReverse=Dl.Loop|Dl.Reverse]="LoopReverse",t[t.PingPong=Dl.PingPong]="PingPong",t[t.PingPongReverse=Dl.PingPong|Dl.Reverse]="PingPongReverse"}(IK||(IK={})),xe(IK);var OK,LK=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}(),NK=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 FK(){return v.director.getAnimationManager()}!function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.RESUME="resume",t.LASTFRAME="lastframe",t.FINISHED="finished"}(OK||(OK={})),xe(OK);var kK,VK,GK,UK=t("at",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=IK.Normal,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 LK,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||W("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,(this.wrapMode&Dl.Loop)===Dl.Loop?this.repeatCount=1/0:this.repeatCount=1,!this._doNotCreateEval){var r,s,o,a=null!==(r=null!=e?e:null===(s=FK())||void 0===s?void 0:s.blendState)&&void 0!==r?r:null;a&&(this._poseOutput=new NK(a)),this._clipEval=n.createEvaluator({target:t,pose:null!==(o=this._poseOutput)&&void 0!==o?o: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||FK().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];FK().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)||void 0===e||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(OK.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(OK.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(OK.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(OK.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||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 LK(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(OK.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(OK.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(OK.LASTFRAME,this),this._lastIterations=n)},i._needReverse=function(t){var e=this.wrapMode,i=!1;return(e&Dl.PingPong)===Dl.PingPong&&(t-(0|t)==0&&t>0&&(t-=1),1&t&&(i=!i)),(e&Dl.Reverse)===Dl.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new LK;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,o=(t-=i)>0?t/n:-t/n;if(o>=r){o=r,s=!0;var a=r-(0|r);0===a&&(a=1),t=a*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=this._wrapMode&Dl.ShouldWrap;l&&(u=this._needReverse(o));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=o,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||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(){FK().addAnimation(this)},i._onPauseOrStop=function(){FK().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,t&Dl.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&Dl.ShouldWrap,i=(this.wrapMode&Dl.Reverse)===Dl.Reverse;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)||void 0===e||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}(BK));v.AnimationState=UK,Ta("cc.animation.EmbeddedAnimationClipPlayable")((kK=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=VK&&VK(),e.clip=GK&&GK(),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 et(3938,i,t.getPathInHierarchy(),e.name),null;var r=new UK(e);return r.initialize(n),new WK(r)},e}(MK),VK=fa(kK.prototype,"path",[Ma],(function(){return""})),GK=fa(kK.prototype,"clip",[Ma],(function(){return null})),kK));var zK,HK,WK=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}(PK);Ta("cc.animation.EmbeddedParticleSystemPlayable")((zK=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=HK&&HK(),e}return s(e,t),e.prototype.instantiate=function(t){var e=t.getChildByPath(this.path);if(!e)return U("Hierarchy path "+this.path+" does not exists."),null;var i=oe("cc.ParticleSystem");if(!i)return U("Particle system is required for embedded particle system player."),null;var n=e.getComponent(i);return n?new ZK(n):(U(this.path+" does not includes a particle system component."),null)},e}(MK),HK=fa(zK.prototype,"path",[Ma],(function(){return""})),zK));var jK,XK,YK,qK,KK,QK,ZK=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}(PK);function JK(t){return"string"==typeof t||"number"==typeof t}var $K,tQ,eQ,iQ,nQ,rQ,sQ,oQ,aQ,hQ,uQ,lQ,cQ,_Q,fQ,dQ,pQ,mQ=Ta("cc.animation.HierarchyPath")((XK=function(){function t(t){this.path=YK&&YK(),this.path=t||""}return t.prototype.get=function(t){return t instanceof xg?t.getChildByPath(this.path)||($(3926,t.name,this.path),null):($(3925),null)},t}(),YK=fa(XK.prototype,"path",[Ma],(function(){return""})),jK=XK))||jK,gQ=Ta("cc.animation.ComponentPath")((KK=function(){function t(t){this.component=QK&&QK(),this.component=t||""}return t.prototype.get=function(t){return t instanceof xg?t.getComponent(this.component)||($(3928,t.name,this.component),null):($(3927),null)},t}(),QK=fa(KK.prototype,"component",[Ma],(function(){return""})),qK=KK))||qK,yQ=Symbol("NormalizedFollow"),vQ=Symbol("ConvertAsTrsPath"),SQ=Symbol("TrackBinding"),AQ=Ta("cc.animation.TrackPath")((tQ=function(){function t(){this._paths=eQ&&eQ()}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 mQ(t)),this},e.toComponent=function(t){var e=new gQ("string"==typeof t?t:Lt(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 mQ},e.parseHierarchyAt=function(t){return this.isHierarchyAt(t),this._paths[t].path},e.isComponentAt=function(t){return this._paths[t]instanceof gQ},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[yQ](t,e,i)},e[vQ]=function(){for(var t,e=this._paths,i=e.length,n=0,r="";n<i;++n){var s=e[n];if(!(s instanceof mQ))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[yQ]=function(t,e,i){for(var n=this._paths,r=t,s=e;s<i;++s){var o=n[s];if(JK(o)){if(!(o in r))return $(3929,o),null;r=r[o]}else r=o.get(r);if(null===r)break}return r},n(t,[{key:"length",get:function(){return this._paths.length}}]),t}(),eQ=fa(tQ.prototype,"_paths",[Ma],(function(){return[]})),$K=tQ))||$K,TQ=Ta("cc.animation.TrackBinding")(iQ=La(((oQ=function(){function t(){this.path=rQ&&rQ(),this.proxy=sQ&&sQ()}var e=t.prototype;return e.parseTrsPath=function(){return this.proxy?null:this.path[vQ]()},e.createRuntimeBinding=function(t,e,i){var n=this.path,r=this.proxy,s=n.length,o=s-1;if(0===s||!n.isPropertyAt(o)&&!n.isElementAt(o)||r){if(r){var a=n[yQ](t,0,s);if(null===a)return null;var h=r.forTarget(a);if(!h)return null;var u={setValue:function(t){h.set(t)}},l=h.get;return l&&(u.getValue=function(){return l.call(h)}),u}return et(3921),null}var c,_=n.isPropertyAt(o)?n.parsePropertyAt(o):n.parseElementAt(o),f=n[yQ](t,0,s-1);return null===f?null:e&&f instanceof xg&&bQ(_)?e.createPoseWriter(f,_,i):(c=function(t){f[_]=t},{target:f,setValue:c,getValue:function(){return f[_]}})},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}())._animationFunctions=new WeakMap,rQ=fa((nQ=oQ).prototype,"path",[Ma],(function(){return new AQ})),sQ=fa(nQ.prototype,"proxy",[Ma],null),iQ=nQ))||iQ)||iQ;function bQ(t){return"position"===t||"rotation"===t||"scale"===t||"eulerAngles"===t}var EQ,CQ,xQ=Ta("cc.animation.Track")((hQ=function(){function t(){this._binding=uQ&&uQ()}var e=t.prototype;return e.channels=function(){return[]},e.range=function(){for(var t,e={min:1/0,max:-1/0},i=f(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:SQ,get:function(){return this._binding}}]),t}(),uQ=fa(hQ.prototype,"_binding",[Ma],(function(){return new TQ})),aQ=hQ))||aQ,wQ=Ta("cc.animation.Channel")((cQ=function(){function t(t){this.name="",this._curve=_Q&&_Q(),this._curve=t}return n(t,[{key:"curve",get:function(){return this._curve}}]),t}(),_Q=fa(cQ.prototype,"_curve",[Ma],null),lQ=cQ))||lQ,DQ=Ta("cc.animation.SingleChannelTrack")((dQ=function(t){function e(){var e;return(e=t.call(this)||this)._channel=pQ&&pQ(),e._channel=new wQ(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[RK]=function(){var t=this._channel.curve;return new RQ(t)},n(e,[{key:"channel",get:function(){return this._channel}}]),e}(xQ),pQ=fa(dQ.prototype,"_channel",[Ma],null),fQ=dQ))||fQ,RQ=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}(),IQ=Ma;Ta("cc.animation.RealArrayTrack")((EQ=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=CQ&&CQ(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[RK]=function(){return new KQ(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 wQ(new Cu)})))}}}]),e}(xQ),CQ=fa(EQ.prototype,"_channels",[IQ],(function(){return[]})),EQ));var MQ,PQ,BQ,OQ,LQ,NQ,FQ,kQ,VQ,GQ,UQ,zQ,HQ,WQ,jQ,XQ,YQ,qQ,KQ=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}(),QQ=Ta("cc.animation.UniformProxyFactory")((PQ=function(){function t(t,e){this.passIndex=BQ&&BQ(),this.uniformName=OQ&&OQ(),p(this,"channelIndex",LQ,this),this.passIndex=e||0,this.uniformName=t||""}return t.prototype.forTarget=function(t){if(t instanceof oT){var e=this.passIndex,i=this.uniformName,n=this.channelIndex;if(e<0||e>=t.passes.length)$(3941,t.name,e);else{var r=t.passes[e],s=r.getHandle(i);if(s){if(YA.getTypeFromHandle(s)<bc.SAMPLER1D){var o=void 0===n?s:r.getHandle(i,n,bc.FLOAT);return o?function(t,e){for(var i,n=f(t.shaderInfo.blocks);!(i=n()).done;)for(var r,s=f(i.value.members);!(r=s()).done;){var o=r.value;if(o.name===e)return o.count>1}return!1}(r,i)?{set:function(t){r.setUniformArray(o,t)}}:{set:function(t){r.setUniform(o,t)}}:void $(3943,t.name,e,i,n)}var a=YA.getBindingFromHandle(s),h=r.properties[i],u=h&&h.value?""+h.value+Wv(h.type):Hv(h.type),l=UA.get(u);return l||(U("Illegal texture default value: "+u+"."),l=UA.get("default-texture")),{set:function(t){t||(t=l);var e=t.getGFXTexture();e&&e.width&&e.height&&(r.bindTexture(a,e),t instanceof lp&&r.bindSampler(a,nd.gfxDevice.getSampler(t.getSamplerInfo())))}}}$(3942,t.name,e,i)}}else $(3940,t)},t}(),BQ=fa(PQ.prototype,"passIndex",[Ma],(function(){return 0})),OQ=fa(PQ.prototype,"uniformName",[Ma],(function(){return""})),LQ=m(PQ.prototype,"channelIndex",[Ja],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),MQ=PQ))||MQ,ZQ=Ta("cc.animation.MorphWeightValueProxy")((FQ=function(){function t(){this.subMeshIndex=kQ&&kQ(),this.shapeIndex=VQ&&VQ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),kQ=fa(FQ.prototype,"subMeshIndex",[Ma],(function(){return 0})),VQ=fa(FQ.prototype,"shapeIndex",[Ma],(function(){return 0})),NQ=FQ))||NQ,JQ=Ta("cc.animation.MorphWeightsValueProxy")((UQ=function(){function t(){this.subMeshIndex=zQ&&zQ()}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),zQ=fa(UQ.prototype,"subMeshIndex",[Ma],(function(){return 0})),GQ=UQ))||GQ,$Q=Ta("cc.animation.MorphWeightsAllValueProxy")(HQ=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?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s<r;++s)t.setWeights(e,s)}}},t}())||HQ;function tZ(t,e,i,n){var r,s,o,a,h,u=new e,l=new e,c=new e,_=Ta(t)((s=function(){function t(t,i,n){this.dataPoint=o&&o(),this.inTangent=a&&a(),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,o=t.dataPoint;l=i(l,this.inTangent,r),c=i(c,t.outTangent,r);var a=e*e*e,h=e*e,_=a-2*h+e,f=-2*a+3*h,d=a-h;return u=i(u,s,2*a-3*h+1),u=n(u,u,l,_),u=n(u,u,o,f),u=n(u,u,c,d)},r.getNoLerp=function(){return this.dataPoint},t}(),o=fa(s.prototype,"dataPoint",[Ma],(function(){return new e})),a=fa(s.prototype,"inTangent",[Ma],(function(){return new e})),h=fa(s.prototype,"outTangent",[Ma],(function(){return new e})),r=s))||r;if(e===In){var f=_.prototype.lerp;_.prototype.lerp=function(t,e,i){var n=f.call(this,t,e,i);return In.normalize(n,n),n}}return _}var eZ,iZ,nZ,rZ,sZ,oZ=tZ("cc.CubicSplineVec2Value",jn,jn.multiplyScalar,jn.scaleAndAdd),aZ=tZ("cc.CubicSplineVec3Value",mn,mn.multiplyScalar,mn.scaleAndAdd),hZ=tZ("cc.CubicSplineVec4Value",ln,ln.multiplyScalar,ln.scaleAndAdd),uZ=tZ("cc.CubicSplineQuatValue",In,In.multiplyScalar,In.scaleAndAdd),lZ=Ta("cc.CubicSplineNumberValue")((jQ=function(){function t(t,e,i){this.dataPoint=XQ&&XQ(),this.inTangent=YQ&&YQ(),this.outTangent=qQ&&qQ(),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,o=e*e;return n*(2*s-3*o+1)+this.outTangent*i*(s-2*o+e)+r*(-2*s+3*o)+t.inTangent*i*(s-o)},e.getNoLerp=function(){return this.dataPoint},t}(),XQ=fa(jQ.prototype,"dataPoint",[Ma],(function(){return 0})),YQ=fa(jQ.prototype,"inTangent",[Ma],(function(){return 0})),qQ=fa(jQ.prototype,"outTangent",[Ma],(function(){return 0})),WQ=jQ))||WQ,cZ=Ta("cc.animation.RealTrack")(eZ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new Cu},e}(DQ))||eZ;function _Z(t){return 0===t.keyFramesCount?void 0:t}var fZ,dZ,pZ,mZ,gZ,yZ,vZ,SZ,AZ,TZ=["X","Y","Z","W"],bZ=Ta("cc.animation.VectorTrack")((nZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=rZ&&rZ(),e._nComponents=sZ&&sZ(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new wQ(new Cu);n.name=TZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[RK]=function(){switch(this._nComponents){default:case 2:return new EZ(_Z(this._channels[0].curve),_Z(this._channels[1].curve));case 3:return new CZ(_Z(this._channels[0].curve),_Z(this._channels[1].curve),_Z(this._channels[2].curve));case 4:return new xZ(_Z(this._channels[0].curve),_Z(this._channels[1].curve),_Z(this._channels[2].curve),_Z(this._channels[3].curve))}},n(e,[{key:"componentsCount",get:function(){return this._nComponents},set:function(t){this._nComponents=t}}]),e}(xQ),rZ=fa(nZ.prototype,"_channels",[Ma],null),sZ=fa(nZ.prototype,"_nComponents",[Ma],(function(){return 4})),iZ=nZ))||iZ,EZ=function(){function t(t,e){this._result=new jn,this._x=t,this._y=e}return t.prototype.evaluate=function(t,e){return e&&jn.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}(),CZ=function(){function t(t,e,i){this._result=new mn,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&&mn.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}(),xZ=function(){function t(t,e,i,n){this._result=new ln,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&ln.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}(),wZ=Ta("cc.animation.QuatTrack")(fZ=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.createCurve=function(){return new ll},i[RK]=function(){return new DZ(this.channels()[0].curve)},e}(DQ))||fZ,DZ=function(){function t(t){this._result=new In,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}(),RZ=["Red","Green","Blue","Alpha"],IZ=Ta("cc.animation.ColorTrack")((pZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=mZ&&mZ(),e._channels=new Array(4);for(var i=0;i<e._channels.length;++i){var n=new wQ(new Cu);n.name=RZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[RK]=function(){return new MZ(_Z(this._channels[0].curve),_Z(this._channels[1].curve),_Z(this._channels[2].curve),_Z(this._channels[3].curve))},e}(xQ),mZ=fa(pZ.prototype,"_channels",[Ma],null),dZ=pZ))||dZ,MZ=function(){function t(t,e,i,n){this._result=new bn,this._x=t,this._y=e,this._z=i,this._w=n}return t.prototype.evaluate=function(t,e){return e&&bn.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}(),PZ=["Width","Height"],BZ=Ta("cc.animation.SizeTrack")((yZ=function(t){function e(){var e;(e=t.call(this)||this)._channels=vZ&&vZ(),e._channels=new Array(2);for(var i=0;i<e._channels.length;++i){var n=new wQ(new Cu);n.name=PZ[i],e._channels[i]=n}return e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[RK]=function(){return new OZ(_Z(this._channels[0].curve),_Z(this._channels[1].curve))},e}(xQ),vZ=fa(yZ.prototype,"_channels",[Ma],null),gZ=yZ))||gZ,OZ=function(){function t(t,e){this._result=new Kn,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}(),LZ=Ta("cc.animation.ObjectTrack")(SZ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createCurve=function(){return new Sl},e}(DQ))||SZ,NZ=Symbol("[[Owner]]");function FZ(t){t[NZ]}!function(t){t[t.FLOAT=0]="FLOAT",t[t.BOOLEAN=1]="BOOLEAN",t[t.TRIGGER=2]="TRIGGER",t[t.INTEGER=3]="INTEGER",t[t.VEC3_experimental=4]="VEC3_experimental",t[t.QUAT_experimental=5]="QUAT_experimental"}(AZ||(AZ={}));var kZ,VZ,GZ,UZ,zZ,HZ,WZ,jZ,XZ=Symbol("CreateInstance"),YZ=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=f(this._refs);!(e=i()).done;){var n=e.value,r=n.fn,s=n.thisArg,o=n.args;r.call.apply(r,[s,t].concat(o))}}}]),t}(),qZ=Ta("cc.animation.PlainVariable")((VZ=function(){function t(t){if(this._type=GZ&&GZ(),this._value=UZ&&UZ(),void 0!==t)switch(this._type=t,t){default:break;case AZ.FLOAT:case AZ.INTEGER:this._value=0;break;case AZ.BOOLEAN:this._value=!1}}return t.prototype[XZ]=function(){return new KZ(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}(),GZ=fa(VZ.prototype,"_type",[Ma],(function(){return AZ.FLOAT})),UZ=fa(VZ.prototype,"_value",[Ma],(function(){return 0})),kZ=VZ))||kZ,KZ=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}(YZ);!function(t){t[t.AFTER_CONSUMED=0]="AFTER_CONSUMED",t[t.NEXT_FRAME_OR_AFTER_CONSUMED=1]="NEXT_FRAME_OR_AFTER_CONSUMED"}(jZ||(jZ={})),jZ.AFTER_CONSUMED;var QZ,ZZ,JZ,$Z,tJ,eJ,iJ,nJ,rJ,sJ,oJ,aJ,hJ=Ta("cc.animation.TriggerVariable")((HZ=function(){function t(){this._flags=WZ&&WZ()}return t.prototype[XZ]=function(){return new uJ(this.value,this.resetMode)},n(t,[{key:"type",get:function(){return AZ.TRIGGER}},{key:"value",get:function(){return!!((1&this._flags)>>0)},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}(),WZ=fa(HZ.prototype,"_flags",[Ma],(function(){return 0})),zZ=HZ))||zZ,uJ=function(t){function e(e,i){var n;return(n=t.call(this,AZ.TRIGGER)||this).resetMode=jZ.AFTER_CONSUMED,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}(YZ),lJ=Ta("cc.animation.Vec3Variable")((ZZ=function(){function t(){this._value=JZ&&JZ()}return t.prototype[XZ]=function(){return new cJ(this.value)},n(t,[{key:"type",get:function(){return AZ.VEC3_experimental}},{key:"value",get:function(){return this._value},set:function(t){mn.copy(this._value,t)}}]),t}(),JZ=fa(ZZ.prototype,"_value",[Ma],(function(){return new mn})),QZ=ZZ))||QZ,cJ=function(t){function e(e){var i;return(i=t.call(this,AZ.VEC3_experimental)||this)._value=new mn,mn.copy(i._value,e),i}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){mn.copy(this._value,t)},e}(YZ),_J=Ta("cc.animation.QuatVariable")((tJ=function(){function t(){this._value=eJ&&eJ()}return t.prototype[XZ]=function(){return new fJ(this._value)},n(t,[{key:"type",get:function(){return AZ.QUAT_experimental}},{key:"value",get:function(){return this._value},set:function(t){In.copy(this._value,t)}}]),t}(),eJ=fa(tJ.prototype,"_value",[Ma],(function(){return new In})),$Z=tJ))||$Z,fJ=function(t){function e(e){var i;return(i=t.call(this,AZ.QUAT_experimental)||this)._value=new In,In.copy(i._value,e),i}s(e,t);var i=e.prototype;return i.getValue=function(){return this._value},i.setValue=function(t){In.copy(this._value,t)},e}(YZ),dJ=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)),pJ=function(t){function e(e){return t.call(this,"Graph variable "+e+" is not defined")||this}return s(e,t),e}(l(Error)),mJ=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)),gJ=$s.Flags.Destroyed,yJ=$s.Flags.PersistentMask,vJ=[];function SJ(t){var e;if(to(t)){if(function(t){return"function"==typeof t._instantiate}(t))return v.game._isCloning=!0,e=t._instantiate(null,!0),v.game._isCloning=!1,e;if(t instanceof v.Asset)throw new TypeError(st(6903))}return v.game._isCloning=!0,e=AJ(t),v.game._isCloning=!1,e}function AJ(t,e){var i;TJ(t,i=t._iN$t?t._iN$t:t.constructor?new(0,t.constructor):Object.create(null),e);for(var n=0,r=vJ.length;n<r;++n)vJ[n]._iN$t=null;return vJ.length=0,i}function TJ(t,e,i){It(t,"_iN$t",e,!0),vJ.push(t);var n=t.constructor;if(Ci(n))!function(t,e,i,n){for(var r=t.__values__,s=0;s<r.length;s++){var o=r[s],a=e[o];if("object"==typeof a&&a){var h=i[o];h instanceof De&&h.constructor===a.constructor?h.set(a):i[o]=a._iN$t||bJ(a,n)}else i[o]=a}}(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||bJ(s,i)}else e[r]=s}to(t)&&(e._objFlags&=yJ)}function bJ(t,e){if(t instanceof De)return t.clone();if(t instanceof v.Asset)return t;var i;if(ArrayBuffer.isView(t)){var n=t.length;i=new t.constructor(n),t._iN$t=i,vJ.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,vJ.push(t);for(var o=0;o<s;++o){var a=t[o];i[o]="object"==typeof a&&a?a._iN$t||bJ(a,e):a}return i}if(t._objFlags&gJ)return null;var h=t.constructor;if(Ci(h)){if(e)if(e instanceof Lp){if(t instanceof xg||t instanceof Lp)return t}else if(e instanceof xg)if(t instanceof xg){if(!t.isChildOf(e))return t}else if(t instanceof Lp&&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 TJ(t,i,e),i}function EJ(t){var e=t[Zs];if("object"==typeof e&&e){var i,n=e;return null===(i=n.clone)||void 0===i?void 0:i.call(n,t)}}SJ._clone=AJ,v.instantiate=SJ;var CJ,xJ,wJ,DJ=Symbol("[[Outgoing transitions]]"),RJ=Symbol("[[Incoming transitions]]"),IJ=Ta,MJ=Ma,PJ=IJ("cc.animation.State")((nJ=function(t){function e(){var e;return(e=t.call(this)||this).name=rJ&&rJ(),e[DJ]=[],e[RJ]=[],e}return s(e,t),e.prototype.copyTo=function(t){t.name=this.name,t[Zs]=EJ(this)},e}(fh),rJ=fa(nJ.prototype,"name",[MJ],(function(){return""})),iJ=nJ))||iJ,BJ=IJ("cc.animation.InteractiveState")((oJ=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=aJ&&aJ(),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){fe(this._components,t)},i.instantiateComponents=function(){return this._components.map((function(t){return SJ(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}(PJ),aJ=fa(oJ.prototype,"_components",[MJ],(function(){return[]})),sJ=oJ))||sJ;function OJ(t,e,i){for(var n=t.components,r=n.length,s=0;s<r;++s){var o=n[s],a=o[e];"function"==typeof a&&a.apply(o,i)}}var LJ,NJ,FJ,kJ,VJ,GJ,UJ,zJ,HJ,WJ=Ta("cc.animation.AnimationGraphEventBinding")((xJ=function(){function t(){this.methodName=wJ&&wJ()}var e=t.prototype;return e.emit=function(t){this.methodName&&OJ(t,this.methodName,[])},e.copyTo=function(t){return t.methodName=this.methodName,this},n(t,[{key:"isBound",get:function(){return!!this.methodName}}]),t}(),wJ=fa(xJ.prototype,"methodName",[Ma],(function(){return""})),CJ=xJ))||CJ,jJ=Ta("cc.animation.Motion")((NJ=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=FJ&&FJ(),e.speed=kJ&&kJ(),e.speedMultiplier=VJ&&VJ(),e.speedMultiplierEnabled=GJ&&GJ(),e.transitionInEventBinding=UJ&&UJ(),e.transitionOutEventBinding=zJ&&zJ(),e}s(e,t);var i=e.prototype;return i.__callOnAfterDeserializeRecursive=function(){var t;null===(t=this.motion)||void 0===t||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?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}(BJ),FJ=fa(NJ.prototype,"motion",[Ma],(function(){return null})),kJ=fa(NJ.prototype,"speed",[Ma],(function(){return 1})),VJ=fa(NJ.prototype,"speedMultiplier",[Ma],(function(){return""})),GJ=fa(NJ.prototype,"speedMultiplierEnabled",[Ma],(function(){return!1})),UJ=fa(NJ.prototype,"transitionInEventBinding",[Ma],(function(){return new WJ})),zJ=fa(NJ.prototype,"transitionOutEventBinding",[Ma],(function(){return new WJ})),LJ=NJ))||LJ,XJ=Symbol("[[OnAfterDeserialized]]"),YJ=Ta("cc.animation.AnimationGraphLike")(HJ=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Fd))||HJ;function qJ(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 KJ,QJ,ZJ,JJ,$J,t$,e$,i$,n$=function(){var t=!1;try{t=[]instanceof function(){function t(){}return t[Symbol.hasInstance]=function(t){return Array.isArray(t)},t}()}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}}(),r$=Ta("cc.animation.PoseGraphNodeShell")((QJ=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=ZJ&&ZJ(),e}s(e,t);var i=e.prototype;return i.getBindings=function(){return this._bindings},i.addBinding=function(t,e,i){this._emplaceBinding(new a$(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 o=n[s],a=o.inputPath,h=a[0],u=a[1];h===t&&(void 0===u?-1:u)>=e&&(r.push(o),n.splice(s,1))}for(var l=0,c=r;l<c.length;l++){var _=c[l],f=_.inputPath,d=f[0],p=f[1],m=void 0===p?-1:p;this.addBinding([d,m+(i?-1:1)],_.producer,_.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 s$(e.inputPath,t)}))},i._emplaceBinding=function(t){var e=this._bindings.findIndex((function(e){return s$(e.inputPath,t.inputPath)}));e>=0?this._bindings[e]=t:this._bindings.push(t)},e}(fh),ZJ=fa(QJ.prototype,"_bindings",[Ma],(function(){return[]})),KJ=QJ))||KJ;function s$(t,e){var i=t[0],n=t[1],r=e[0],s=e[1];return i===r&&n===s}var o$,a$=Ta("cc.animation.PoseGraphNodeInputBinding")(($J=function(){function t(t,e,i){this._inputPath=t$&&t$(),this._producer=e$&&e$(),this._outputIndex=i$&&i$(),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}(),t$=fa($J.prototype,"_inputPath",[Ma],null),e$=fa($J.prototype,"_producer",[Ma],null),i$=fa($J.prototype,"_outputIndex",[Ma],(function(){return 0})),JJ=$J))||JJ,h$=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)),u$=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));!function(t){t[t.FLOAT=0]="FLOAT",t[t.INTEGER=1]="INTEGER",t[t.BOOLEAN=2]="BOOLEAN",t[t.VEC3=3]="VEC3",t[t.QUAT=4]="QUAT",t[t.POSE=5]="POSE"}(o$||(o$={}));var l$=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(fh),c$=new WeakMap;function _$(t){return function(e){if(qt(e,l$)||(z("This kind of decorator should only be applied to pose graph node classes."),0)){var i=function(t){var e=c$.get(t);if(e)return e;var i={};return c$.set(t,i),i}(e);t(i)}}}var f$=function(t){return _$((function(e){var i;Object.assign(null!==(i=e.appearance)&&void 0!==i?i:e.appearance={},t)}))},d$=["arraySyncGroup"];function p$(t,e,i,n){var r=t.getShell(e);if(!r)throw new u$(e);var s=i[0],o=i[1],a=void 0===o?-1:o,h=e[s];Array.isArray(h)&&(h.splice(a,0,n),r.moveArrayElementBindingForward(s,a+1,!1))}function m$(t,e,i){var n=t.getShell(e);if(!n)throw new u$(e);var r=i[0],s=i[1],o=void 0===s?-1:s,a=e[r];Array.isArray(a)&&(o<0||o>=a.length||(n.deleteBinding(i),a.splice(o,1),n.moveArrayElementBindingForward(r,o+1,!0)))}function g$(t){switch(t){default:case o$.FLOAT:case o$.INTEGER:return 0;case o$.BOOLEAN:return!1;case o$.POSE:return null;case o$.VEC3:return new mn;case o$.QUAT:return new In}}var y$,v$=new(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=function(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}(i,d$),s=i.arraySyncGroup;if(s){var o,a;n.arraySyncGroups||(n.arraySyncGroups={});var h=null!==(a=(o=n.arraySyncGroups)[s])&&void 0!==a?a:o[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(Yt(r));var s=e._classInputMap.get(r);if(s)for(var o=function(){var e=h[a][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])},a=0,h=Object.entries(s.properties);a<h.length;a++)o()}}(t.constructor),i},e.isPoseInput=function(t,e){var i=e[0],n=this._getPropertyNodeInputRecord(t.constructor,i);return!!n&&n.type===o$.POSE},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 o=t[i];if(Array.isArray(o)){if(r<0||r>=o.length)return;var a,h,u=null!==(a=null===(h=s.getArrayElementDisplayName)||void 0===h?void 0:h.call(t,r))&&void 0!==a?a: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=Yt(i)){var n=this._classInputMap.get(i);if(n)for(var r in n.properties){var s=n.properties[r],o=t[r];if(Array.isArray(o)){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,o=this._getPropertyNodeInputRecord(e.constructor,n);if(o){var a=e[n];if(Array.isArray(a)&&!(s<0||s>=a.length)){var h=o.arraySyncGroup;h?this._deleteInputInArraySyncGroup(t,e,h,a.length,s):m$(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 o=s.length,a=r.arraySyncGroup;a?this._insertInputInArraySyncGroup(t,e,a,s.length,o):p$(t,e,[n,o],g$(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(Yt(t),e)}},e._insertInputInArraySyncGroup=function(t,e,i,n,r){for(var s=0;s<i.members.length;++s){var o=i.members[s],a=this._getPropertyNodeInputRecord(e.constructor,o),h=e[o];Array.isArray(h)&&h.length===n&&p$(t,e,[o,r],g$(a.type))}},e._deleteInputInArraySyncGroup=function(t,e,i,n,r){for(var s=0;s<i.members.length;++s){var o=i.members[s];this._getPropertyNodeInputRecord(e.constructor,o);var a=e[o];Array.isArray(a)&&a.length===n&&m$(t,e,[o,r])}},t}()),S$=new mn,A$=new mn,T$=new In;new In;var b$,E$,C$=function(){function t(){this._position=new mn,this._rotation=new In,this._scale=mn.clone(mn.ONE)}return t.clone=function(e){var i=new t;return t.copy(i,e),i},t.setIdentity=function(t){return mn.copy(t._position,mn.ZERO),In.copy(t._rotation,In.IDENTITY),mn.copy(t._scale,mn.ONE),t},t.copy=function(t,e){return mn.copy(t._position,e._position),In.copy(t._rotation,e._rotation),mn.copy(t._scale,e._scale),t},t.equals=function(t,e,i){return mn.equals(t._position,e._position,i)&&In.equals(t._rotation,e._rotation,i)&&mn.equals(t._scale,e._scale,i)},t.strictEquals=function(t,e){return mn.strictEquals(t._position,e._position)&&In.strictEquals(t._rotation,e._rotation)&&mn.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):(mn.lerp(e._position,i._position,n._position,r),In.slerp(e._rotation,i._rotation,n._rotation,r),mn.lerp(e._scale,i._scale,n._scale,r),e)},t.multiply=function(t,e,i){var n=In.multiply(T$,e._rotation,i._rotation),r=mn.multiply(S$,i._scale,e._scale),s=mn.multiply(A$,i._position,e._scale);return mn.transformQuat(s,s,e._rotation),mn.add(s,s,e._position),mn.copy(t._position,s),In.copy(t._rotation,n),mn.copy(t._scale,r),t},t.invert=function(t,e){var i=t._rotation,n=t._scale,r=t._position;return In.invert(i,e._rotation),x$(n,e._scale,Bi),mn.negate(r,e._position),mn.multiply(r,r,n),mn.transformQuat(r,r,i),t},t.fromMatrix=function(t,e){return Vn.toSRT(e,t._rotation,t._position,t._scale),t},t.toMatrix=function(t,e){return Vn.fromSRT(t,e._rotation,e._position,e._scale)},n(t,[{key:"position",get:function(){return this._position},set:function(t){mn.copy(this._position,t)}},{key:"rotation",get:function(){return this._rotation},set:function(t){In.copy(this._rotation,t)}},{key:"scale",get:function(){return this._scale},set:function(t){mn.copy(this._scale,t)}}]),t}();function x$(t,e,i){var n=e.x,r=e.y,s=e.z;return mn.set(t,Math.abs(n)<=i?0:1/n,Math.abs(r)<=i?0:1/r,Math.abs(s)<=i?0:1/s)}y$=C$,C$.IDENTITY=Object.freeze(new y$),C$.ZERO=Object.freeze(function(){var t=new y$;return mn.copy(t._position,mn.ZERO),In.set(t._rotation,0,0,0,0),mn.copy(t._scale,mn.ZERO),t}()),C$.calculateRelative=(b$=new In,E$=new mn,function(t,e,i){var n=In.invert(b$,i._rotation),r=x$(E$,i._scale,Bi),s=mn.subtract(A$,e._position,i._position);return mn.transformQuat(s,s,n),mn.multiply(s,s,r),mn.copy(t._position,s),In.multiply(t._rotation,n,e._rotation),mn.multiply(t._scale,e._scale,r),t});var w$,D$,R$,I$=(w$=new In,function(t,e,i,n){mn.scaleAndAdd(t.position,e.position,i.position,n);var r=In.slerp(w$,In.IDENTITY,i.rotation,n);return In.multiply(t.rotation,r,e.rotation),mn.scaleAndAdd(t.scale,e.scale,i.scale,n),t}),M$=(D$=new In,function(t,e,i){var n=In.invert(D$,e);return In.multiply(t,i,n)}),P$=Object.freeze(function(){var t=new C$;return t.position=mn.ZERO,t.rotation=In.IDENTITY,t.scale=mn.ZERO,t}()),B$=function(){function t(t,e){this.transforms=void 0,this.auxiliaryCurves=void 0,this._poseTransformSpace=R$.LOCAL,this.transforms=t,this.auxiliaryCurves=e}return t._create=function(e,i){return new t(e,i)},t}();!function(t){t[t.LOCAL=0]="LOCAL",t[t.COMPONENT=1]="COMPONENT"}(R$||(R$={}));var O$=function(){function t(t){this._involvedTransforms=new Uint16Array(t)}return n(t,[{key:"involvedTransforms",get:function(){return this._involvedTransforms}}]),t}();function L$(t,e,i,n){void 0===n&&(n=void 0),function(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 o=n.involvedTransforms[s];k$(t,e,i,o)}else for(var a=0;a<r;++a)k$(t,e,i,a);else n?function(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)}}(t,e,n):t.set(e)}(t.transforms,e.transforms,i,n),function(t,e,i){var n=e.length;t.length;for(var r=0;r<n;++r)t[r]=ki(t[r],e[r],i)}(t.auxiliaryCurves,e.auxiliaryCurves,i)}var N$,F$,k$=(N$=new C$,F$=new C$,function(t,e,i,n){var r=t.getTransform(n,F$),s=e.getTransform(n,N$);C$.lerp(r,r,s,i),t.setTransform(n,r)});var V$=function(){var t=new C$,e=new C$;return function(i,n,r){var s=n.getTransform(r,t),o=i.getTransform(r,e);!function(t,e,i){mn.subtract(t.position,e.position,i.position),M$(t.rotation,i.rotation,e.rotation),mn.subtract(t.scale,e.scale,i.scale)}(o,o,s),i.setTransform(r,o)}}();function G$(t,e,i,n){void 0===n&&(n=void 0),function(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 o=n.involvedTransforms[s];H$(t,e,i,o)}else for(var a=0;a<r;++a)H$(t,e,i,a)}(t.transforms,e.transforms,i,n),function(t,e,i){t.length,e.length;for(var n=0;n<t.length;++n)t[n]+=e[n]*i}(t.auxiliaryCurves,e.auxiliaryCurves,i)}var U$,z$,H$=function(){var t=new C$,e=new C$;return function(i,n,r,s){var o=n.getTransform(s,t),a=i.getTransform(s,e);I$(a,a,o,r),i.setTransform(s,a)}}();!function(t){t[t.NO=0]="NO",t[t.LOCAL=1]="LOCAL",t[t.COMPONENT=2]="COMPONENT"}(z$||(z$={})),xe(z$);var W$,j$,X$,Y$,q$,K$,Q$=Ta("cc.animation.PoseNode")(U$=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)||void 0===e||e.evaluate(),this.doUpdate(t)},i.evaluate=function(t,e){var i=this.doEvaluate(t),n=i._poseTransformSpace;switch(e){default:case z$.NO:break;case z$.LOCAL:n===R$.COMPONENT&&t._poseTransformsSpaceComponentToLocal(i),i._poseTransformSpace,R$.LOCAL;break;case z$.COMPONENT:n===R$.LOCAL&&t._poseTransformsSpaceLocalToComponent(i),i._poseTransformSpace,R$.COMPONENT}return i},e.evaluateDefaultPose=function(t,e){switch(e){default:case z$.NO:case z$.LOCAL:return t.pushDefaultedPose();case z$.COMPONENT:return t.pushDefaultedPoseInComponentSpace()}},i._setDependencyEvaluation=function(t){this._dependencyEvaluation=t},i._forceEvaluateEvaluation=function(){var t;null===(t=this._dependencyEvaluation)||void 0===t||t.evaluate()},e}(l$))||U$,Z$=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}(l$);function J$(t){return function(e,i){var n=e.constructor;t.type!==o$.POSE||qt(n,Q$)?qt(n,Q$)||qt(n,Z$)?$$(t)(e,i):z("@input can be only applied to fields of subclasses of PoseNode or PureValueNode."):z("@input specifying pose input can be only applied to fields of subclasses of PoseNode.")}}function $$(t){return function(e,i){if("string"==typeof i){var n=e.constructor;v$.setPropertyNodeInputRecord(n,i,t),Da(e,i).__internalFlags|=_i.STANDALONE|_i.IMPLICIT_VISIBLE}else z("@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()}}(Z$);var t0,e0,i0,n0,r0,s0,o0,a0,h0,u0,l0,c0,_0,f0,d0,p0,m0,g0,y0,v0,S0,A0,T0,b0,E0,C0,x0,w0,D0,R0,I0,M0,P0,B0,O0,L0,N0,F0,k0,V0,G0,U0,z0,H0,W0,j0,X0,Y0,q0,K0,Q0,Z0,J0,$0,t1,e1,i1,n1,r1,s1,o1=(W$=Ta("cc.animation.PoseGraphOutputNode"),j$=f$({themeColor:"#CD3A58",inline:!0}),X$=$$({type:o$.POSE}),W$(Y$=j$((q$=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return p(e=t.call.apply(t,[this].concat(n))||this,"pose",K$,c(e)),e}return s(e,t),e}(l$),K$=m(q$.prototype,"pose",[Ma,X$],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Y$=q$))||Y$)||Y$),a1=Ta("cc.animation.PoseGraph")((e0=function(t){function e(){var e;return(e=t.call(this)||this)._outputNode=i0&&i0(),e._nodes=n0&&n0(),e._shells=r0&&r0(),e._shellMap=s0&&s0(),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,i=this._nodes[t],n=this._shells[t];this._shellMap.set(i,n),null===(e=i.__callOnAfterDeserializeRecursive)||void 0===e||e.call(i)}},i.nodes=function(){return this._nodes.values()},i.addNode=function(t){if(this._shellMap.has(t))throw new h$(t);var e=new r$;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=f(this._shells);!(i=n()).done;)i.value.deleteBindingTo(t);ce(this._shells,e),ce(this._nodes,e),this._shellMap.delete(t)}}else z("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}(fh),i0=fa(e0.prototype,"_outputNode",[Ma],(function(){return new o1})),n0=fa(e0.prototype,"_nodes",[Ma],(function(){return[]})),r0=fa(e0.prototype,"_shells",[Ma],(function(){return[]})),s0=fa(e0.prototype,"_shellMap",[Ma],(function(){return new Map})),t0=e0))||t0,h1=Ta("cc.animation.Transition")((a0=function(t){function e(e,i,n){var r;return(r=t.call(this)||this).from=h0&&h0(),r.to=u0&&u0(),r.conditions=l0&&l0(),r[NZ]=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}(fh),h0=fa(a0.prototype,"from",[Ma],null),u0=fa(a0.prototype,"to",[Ma],null),l0=fa(a0.prototype,"conditions",[Ma],(function(){return[]})),o0=a0))||o0,u1=Ta("cc.animation.DurationalTransition")((_0=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=f0&&f0(),e.relativeDestinationStart=d0&&d0(),e.startEventBinding=p0&&p0(),e.endEventBinding=m0&&m0(),e[NZ]=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}(h1),f0=fa(_0.prototype,"destinationStart",[Ma],(function(){return 0})),d0=fa(_0.prototype,"relativeDestinationStart",[Ma],(function(){return!1})),p0=fa(_0.prototype,"startEventBinding",[Ma],(function(){return new WJ})),m0=fa(_0.prototype,"endEventBinding",[Ma],(function(){return new WJ})),c0=_0))||c0,l1=Ta("cc.animation.AnimationTransition")((y0=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=v0&&v0(),e.relativeDuration=S0&&S0(),e.exitConditionEnabled=A0&&A0(),e._exitCondition=T0&&T0(),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}(u1),v0=fa(y0.prototype,"duration",[Ma],(function(){return.3})),S0=fa(y0.prototype,"relativeDuration",[Ma],(function(){return!1})),A0=fa(y0.prototype,"exitConditionEnabled",[Ma],(function(){return!0})),T0=fa(y0.prototype,"_exitCondition",[Ma],(function(){return 1})),g0=y0))||g0;function c1(t){return t instanceof l1}var _1,f1=Ta("cc.animation.EmptyState")(b0=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(PJ))||b0,d1=Ta("cc.animation.EmptyStateTransition")((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).duration=x0&&x0(),e}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),e.duration=this.duration},e}(u1),x0=fa(C0.prototype,"duration",[Ma],(function(){return.3})),E0=C0))||E0,p1=Ta("cc.animation.ProceduralPoseState")((D0=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=R0&&R0(),e.transitionInEventBinding=I0&&I0(),e.transitionOutEventBinding=M0&&M0(),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}(PJ),R0=fa(D0.prototype,"graph",[Ma],(function(){return new a1})),I0=fa(D0.prototype,"transitionInEventBinding",[Ma],(function(){return new WJ})),M0=fa(D0.prototype,"transitionOutEventBinding",[Ma],(function(){return new WJ})),w0=D0))||w0,m1=n$(p1),g1=Ta("cc.animation.ProceduralPoseTransition")((B0=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=O0&&O0(),e}return s(e,t),e.prototype.copyTo=function(e){t.prototype.copyTo.call(this,e),e.duration=this.duration},e}(u1),O0=fa(B0.prototype,"duration",[Ma],(function(){return.3})),P0=B0))||P0,y1=n$(g1),v1=Ta("cc.animation.StateMachine")((N0=function(t){s(i,t);var e=i.prototype;function i(e){var i;return(i=t.call(this)||this)._states=F0&&F0(),i._transitions=k0&&k0(),i._entryState=V0&&V0(),i._exitState=G0&&G0(),i._anyState=U0&&U0(),i._allowEmptyStates=!0,i._allowEmptyStates=null!=e&&e,i._entryState=i._addState(new PJ),i._entryState.name="Entry",i._exitState=i._addState(new PJ),i._exitState.name="Exit",i._anyState=i._addState(new PJ),i._anyState.name="Any",i}return e.__callOnAfterDeserializeRecursive=function(){this[XJ]();for(var t=this._states.length,e=0;e<t;++e){var i=this._states[e];i instanceof S1?i.stateMachine.__callOnAfterDeserializeRecursive():(i instanceof p1||i instanceof jJ)&&i.__callOnAfterDeserializeRecursive()}},e[XJ]=function(){this._states.forEach((function(){})),this._transitions.forEach((function(t){t.from[DJ].push(t),t.to[RJ].push(t)}))},e.states=function(){return this._states},e.transitions=function(){return this._transitions},e.getTransitionsBetween=function(t,e){return FZ(t),FZ(e),t[DJ].filter((function(t){return t.to===e}))},e.getOutgoings=function(t){return FZ(t),t[DJ]},e.getIncomings=function(t){return FZ(t),t[RJ]},e.addMotion=function(){return this._addState(new jJ)},e.addSubStateMachine=function(){return this._addState(new S1(this._allowEmptyStates))},e.addEmpty=function(){if(!this._allowEmptyStates)throw new Error("Empty states are now allowed in this state machine.");return this._addState(new f1)},e.addProceduralPoseState=function(){return this._addState(new p1)},e.remove=function(t){FZ(t),t!==this.entryState&&t!==this.exitState&&t!==this.anyState&&(this.eraseTransitionsIncludes(t),fe(this._states,t))},e.connect=function(t,e,i){if(FZ(t),FZ(e),e===this.entryState)throw new dJ("to-entry");if(e===this.anyState)throw new dJ("to-any");if(t===this.exitState)throw new dJ("from-exit");var n=t instanceof jJ||t===this._anyState?new l1(t,e,i):t instanceof f1?new d1(t,e,i):t instanceof p1?new g1(t,e,i):new h1(t,e,i);return this._transitions.push(n),t[DJ].push(n),e[RJ].push(n),n},e.disconnect=function(t,e){FZ(t),FZ(e);for(var i=t[DJ],n=e[RJ],r=this._transitions,s=i.filter((function(t){return t.to===e})),o=s.length,a=function(){var t=s[h];fe(i,t),fe(r,t),pe(n,(function(e){return e===t}))},h=0;h<o;++h)a()},e.removeTransition=function(t){fe(this._transitions,t),pe(t.from[DJ],(function(e){return e===t})),pe(t.to[RJ],(function(e){return e===t}))},e.eraseOutgoings=function(t){var e=this;FZ(t);for(var i=t[DJ],n=function(){var t=i[r],n=t.to;fe(e._transitions,t),pe(n[RJ],(function(e){return e===t}))},r=0;r<i.length;++r)n();i.length=0},e.eraseIncomings=function(t){var e=this;FZ(t);for(var i=t[RJ],n=function(){var t=i[r],n=t.from;fe(e._transitions,t),pe(n[DJ],(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[DJ],r=n.indexOf(t),s=Ni(r+e,0,n.length-1),o=this._transitions,a=o.indexOf(t);if(s>r)for(var h=r+1;h<=s;++h){var u=n[h],l=o.indexOf(u);o[a]=u,a=l}else if(r>s)for(var c=r-1;c>=s;--c){var _=n[c],f=o.indexOf(_);o[a]=_,a=f}o[a]=t,lc(n,r,s)}},e.copyTo=function(t){for(var e,i=f(t._states.filter((function(e){switch(e){case t._entryState:case t._exitState:case t._anyState:return!0;default:return!1}})));!(e=i()).done;){var n=e.value;t.remove(n)}for(var r,s=new Map,o=f(this._states);!(r=o()).done;){var a=r.value;switch(a){case this._entryState:s.set(a,t._entryState);break;case this._exitState:s.set(a,t._exitState);break;case this._anyState:s.set(a,t._anyState);break;default:if(a instanceof jJ||a instanceof S1||a instanceof f1||a instanceof p1){if(a instanceof f1&&!t._allowEmptyStates)continue;var h=SJ(a);t._addState(h),s.set(a,h)}}}for(var u,l=f(this._transitions);!(u=l()).done;){var c=u.value;if(t._allowEmptyStates||!(c.from instanceof f1||c.to instanceof f1)){var _=s.get(c.from),d=s.get(c.to),p=t.connect(_,d);p.conditions=c.conditions.map((function(t){return t.clone()})),c.copyTo(p)}}},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}(fh),F0=fa(N0.prototype,"_states",[Ma],(function(){return[]})),k0=fa(N0.prototype,"_transitions",[Ma],(function(){return[]})),V0=fa(N0.prototype,"_entryState",[Ma],null),G0=fa(N0.prototype,"_exitState",[Ma],null),U0=fa(N0.prototype,"_anyState",[Ma],null),L0=N0))||L0,S1=Ta("cc.animation.SubStateMachine")((H0=function(t){function e(e){var i;return(i=t.call(this)||this)._stateMachine=W0&&W0(),i._stateMachine=new v1(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}(BJ),W0=fa(H0.prototype,"_stateMachine",[Ma],null),z0=H0))||z0,A1=Ta("cc.animation.PoseGraphStash")((X0=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=Y0&&Y0(),e}return s(e,t),e}(fh),Y0=fa(X0.prototype,"graph",[Ma],(function(){return new a1})),j0=X0))||j0,T1=Ta("cc.animation.Layer")((K0=function(){var t=e.prototype;function e(){this[NZ]=void 0,this._stateMachine=Q0&&Q0(),this.name=Z0&&Z0(),this.weight=J0&&J0(),this.mask=$0&&$0(),this.additive=t1&&t1(),this._stashes=e1&&e1(),this._stateMachine=new v1(!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 A1},t.removeStash=function(t){delete this._stashes[t]},t.renameStash=function(t,e){this._stashes=qJ(this._stashes,t,e)},n(e,[{key:"stateMachine",get:function(){return this._stateMachine}}]),e}(),Q0=fa(K0.prototype,"_stateMachine",[Ma],null),Z0=fa(K0.prototype,"name",[Ma],(function(){return""})),J0=fa(K0.prototype,"weight",[Ma],(function(){return 1})),$0=fa(K0.prototype,"mask",[Ma],(function(){return null})),t1=fa(K0.prototype,"additive",[Ma],(function(){return!1})),e1=fa(K0.prototype,"_stashes",[Ma],(function(){return{}})),q0=K0))||q0;!function(t){t[t.override=0]="override",t[t.additive=1]="additive"}(_1||(_1={}));var b1,E1=Ta("cc.animation.AnimationGraph")((n1=function(t){function e(){var e;return(e=t.call(this)||this)._layers=r1&&r1(),e._variables=s1&&s1(),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 T1;return this._layers.push(t),t},i.removeLayer=function(t){ce(this._layers,t)},i.moveLayer=function(t,e){lc(this._layers,t,e)},i.addVariable=function(t,e,i){var n=function(t,e){var i;switch(t){case AZ.FLOAT:case AZ.INTEGER:case AZ.BOOLEAN:i=new qZ(t);break;case AZ.TRIGGER:i=new hJ;break;case AZ.VEC3_experimental:i=new lJ;break;case AZ.QUAT_experimental:i=new _J;break;default:throw new Error("Unknown variable type "+t)}return void 0!==e&&(i.value=e),i}(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=qJ(this._variables,t,e)},n(e,[{key:"layers",get:function(){return this._layers}},{key:"variables",get:function(){return Object.entries(this._variables)}}]),e}(YJ),r1=fa(n1.prototype,"_layers",[Ma],(function(){return[]})),s1=fa(n1.prototype,"_variables",[Ma],(function(){return{}})),i1=n1))||i1,C1=Symbol("[[createEval]]"),x1=Ta("cc.animation.MotionBase")(b1=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.__callOnAfterDeserializeRecursive=function(){},e}(fh))||b1,w1=t("av",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?M1:aa}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());v.RatioSampler=w1;var D1=t("aw",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 o=s[r];this.types[o]=n(e.easingMethods[o])}}else this.type=null;var a=e.values[0];(void 0===e.interpolate||e.interpolate)&&(this._lerp=k1(a)),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,o=r-i,a=(t-i)/o;if(s&&(a=I1(a,s)),void 0===this._array){var h=this._values[e],u=this._values[n];return this._lerp(h,u,a,o*this._duration)}for(var l=0;l<this._array.length;++l){var c=this._values[this._array.length*e+l],_=this._values[this._array.length*n+l];this._array[l]=this._lerp(c,_,a,o*this._duration)}return this._array}if(void 0===this._array)return this.valueAt(e);for(var f=0;f<this._array.length;++f)this._array[f]=this._values[this._array.length*e+f];return this._array},e.empty=function(){return 0===this._values.length},e.constant=function(){return 1===this._values.length},t}());function R1(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 I1(t,e){if("string"==typeof e){var i=du[e];i?t=i(t):et(3906,e)}else Array.isArray(e)&&(t=ol(e,t));return t}function M1(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),o=0|s,a=1e-6;return s-o<a?o:o+1-s<a?o+1:~(o+1)}D1.Linear=null,v.AnimCurve=D1,t("ax",function(){function t(){this.events=[]}return t.prototype.add=function(t,e){this.events.push({func:t||"",params:e||[]})},t}()),v.sampleAnimationCurve=R1;var P1,B1,O1,L1,N1,F1,k1=function(){function t(t,e,i,n){return t.lerp(e,i,n)}return function(e){if(null!==e){if("number"==typeof e)return ki;if("object"==typeof e&&e.constructor){if(e instanceof In)return i=new In,function(t,e,n){return In.slerp(i,t,e,n)};if(e instanceof De)return function(t){var e=new t;return function(i,n,r){return t.lerp(e,i,n,r),e}}(e.constructor);if(e.constructor===Number)return ki;if("function"==typeof e.lerp)return t}var i}}}(),V1=Ta("cc.animation.UntypedTrackChannel")((B1=function(t){function e(){var e;return(e=t.call(this,new Cu)||this).property=O1&&O1(),e}return s(e,t),e}(wQ),O1=fa(B1.prototype,"property",[Ma],(function(){return""})),P1=B1))||P1,G1=Ta("cc.animation.UntypedTrack")((N1=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=F1&&F1(),e}s(e,t);var i=e.prototype;return i.channels=function(){return this._channels},i[RK]=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?void 0:i.curve};switch(!0){default:throw new Error(st(3931));case t instanceof jn:return new EZ(i("x"),i("y"));case t instanceof mn:return new CZ(i("x"),i("y"),i("z"));case t instanceof ln:return new xZ(i("x"),i("y"),i("z"),i("w"));case t instanceof bn:return new MZ(i("r"),i("g"),i("b"),i("a"));case t instanceof Kn:return new OZ(i("width"),i("height"))}},i.addChannel=function(t){var e=new V1;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:break;case"vec2":case"vec3":case"vec4":var r=new bZ;r.path=this.path,r.proxy=this.proxy,r.componentsCount="vec2"===n?2:"vec3"===n?3:4;var s=r.channels(),o=s[0],a=s[1],h=s[2],u=s[3];switch(n){case"vec4":i("w",u);case"vec3":i("z",h);default:case"vec2":i("x",o),i("y",a)}return r;case"color":var l=new IZ,c=l.channels(),_=c[0],f=c[1],d=c[2],p=c[3];return i("r",_),i("g",f),i("b",d),i("a",p),i("x",_),i("y",f),i("z",d),i("w",p),l;case"size":}return null},e}(xQ),F1=fa(N1.prototype,"_channels",[Ma],(function(){return[]})),L1=N1))||L1,U1=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 AQ,s=f(e);!(n=s()).done;){var o=n.value;"string"==typeof o?r.toProperty(o):"number"==typeof o?r.toElement(o):o instanceof mQ?r.toHierarchy(o.path):o instanceof gQ?r.toComponent(o.component):r.toCustomized(o)}t.path=r,t.proxy=i},o=r.map((function(t){var i=new G1;return s(i,t.modifiers,t.valueAdapter),e.push(i),i})),a=function(){var n,r=t.value,a=r.data,h=a.values;if(0===h.length)return 0;var u=a.keys<0?[0]:i[a.keys],l=h[0],c=null===(n=a.interpolate)||void 0===n||n;a._arrayLength;var _,f=new H1(a,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 $(3932),0;if(r.valueAdapter||1!==r.modifiers.length||"string"!=typeof r.modifiers[0])return $(3933),0;var p=r.modifiers[0],m=o[r.commonTarget].addChannel(p).curve;_=m}!function(){if("number"==typeof l){if(!h.every((function(t){return"number"==typeof t})))return void $(3934);var t;if(_)t=_;else{var i=new cZ;d(i),e.push(i),t=i.channel.curve}var n=c?ha.LINEAR:ha.CONSTANT;return t.assignSorted(u,h.map((function(t){return{value:t,interpolationMode:n}}))),void f.convert(t)}if("object"==typeof l)switch(!0){default:break;case z1(h,jn):case z1(h,mn):case z1(h,ln):var r=l instanceof jn?2:l instanceof mn?3:4,s=new bZ;d(s),s.componentsCount=r;var o=s.channels(),a=o[0].curve,p=o[1].curve,m=o[2].curve,g=o[3].curve,y=c?ha.LINEAR:ha.CONSTANT,v=function(t){return{value:t,interpolationMode:y}};switch(r){case 4:g.assignSorted(u,h.map((function(t){return v(t.w)}))),f.convert(g);case 3:m.assignSorted(u,h.map((function(t){return v(t.z)}))),f.convert(m);default:a.assignSorted(u,h.map((function(t){return v(t.x)}))),f.convert(a),p.assignSorted(u,h.map((function(t){return v(t.y)}))),f.convert(p)}return void e.push(s);case z1(h,In):var S=new wZ;d(S);var A=c?$u.SLERP:$u.CONSTANT;return S.channel.curve.assignSorted(u,h.map((function(t){return{value:In.clone(t),interpolationMode:A}}))),f.convertQuatCurve(S.channel.curve),void e.push(S);case z1(h,bn):var T=new IZ;d(T);var b=T.channels(),E=b[0].curve,C=b[1].curve,x=b[2].curve,w=b[3].curve,D=c?ha.LINEAR:ha.CONSTANT,R=function(t){return{value:t,interpolationMode:D}};return E.assignSorted(u,h.map((function(t){return R(t.r)}))),f.convert(E),C.assignSorted(u,h.map((function(t){return R(t.g)}))),f.convert(C),x.assignSorted(u,h.map((function(t){return R(t.b)}))),f.convert(x),w.assignSorted(u,h.map((function(t){return R(t.a)}))),f.convert(w),void e.push(T);case z1(h,Kn):var I=new BZ;d(I);var M=I.channels(),P=M[0].curve,B=M[1].curve,O=c?ha.LINEAR:ha.CONSTANT,L=function(t){return{value:t,interpolationMode:O}};return P.assignSorted(u,h.map((function(t){return L(t.width)}))),f.convert(P),B.assignSorted(u,h.map((function(t){return L(t.height)}))),f.convert(B),void e.push(I);case z1(h,lZ):f.nil;var N=new cZ;d(N);var F=c?ha.CUBIC:ha.CONSTANT;return N.channel.curve.assignSorted(u,h.map((function(t){return{value:t.dataPoint,leftTangent:t.inTangent,rightTangent:t.outTangent,interpolationMode:F}}))),void e.push(N);case z1(h,oZ):case z1(h,aZ):case z1(h,hZ):f.nil;var k=l instanceof oZ?2:l instanceof aZ?3:4,V=new bZ;d(V),V.componentsCount=k;var G=V.channels(),U=G[0],z=G[1],H=G[2],W=G[3],j=c?ha.LINEAR:ha.CONSTANT,X=function(t,e,i){return{value:t,leftTangent:e,rightTangent:i,interpolationMode:j}};switch(k){case 4:W.curve.assignSorted(u,h.map((function(t){return X(t.dataPoint.w,t.inTangent.w,t.outTangent.w)})));case 3:H.curve.assignSorted(u,h.map((function(t){return X(t.dataPoint.z,t.inTangent.z,t.outTangent.z)})));default:U.curve.assignSorted(u,h.map((function(t){return X(t.dataPoint.y,t.inTangent.y,t.outTangent.y)}))),z.curve.assignSorted(u,h.map((function(t){return X(t.dataPoint.x,t.inTangent.x,t.outTangent.x)})))}return void e.push(V);case h.every((function(t){return t instanceof uZ})):$(3935)}var Y=new LZ;d(Y),Y.channel.curve.assignSorted(u,h),e.push(Y)}()},h=f(n);!(t=h()).done;)a();return e},e._createPropertyCurves=function(){var t=this;this._ratioSamplers=this._keys.map((function(e){return new w1(e.map((function(e){return e/t._duration})))})),this._runtimeCurves=this._curves.map((function(e){return{curve:new D1(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 z1(t,e){return t.every((function(t){return t instanceof e}))}var H1=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,o,a,h,u,l,c,_,f,d,p,m,g,y,v,S,A,T,b=this._easingMethods;if(b){var E=t.keyFramesCount;if(!(t.keyFramesCount<2)){Array.isArray(b)&&b.length;for(var C=E-1,x=0;x<C;++x){var w=b[x];w&&(Array.isArray(w)?(e=w,i=t.getKeyframeTime(x),n=t.getKeyframeValue(x),r=t.getKeyframeTime(x+1),s=t.getKeyframeValue(x+1),o=void 0,a=void 0,h=void 0,u=void 0,l=void 0,c=void 0,_=void 0,f=void 0,d=void 0,p=void 0,m=void 0,g=void 0,y=void 0,v=void 0,S=void 0,A=void 0,T=void 0,a=e[0],h=e[1],u=e[2],l=e[3],c=n.value,_=3*(r-i),f=3*(s.value-c),m=(1-u)*_,g=(1-l)*f,y=1/3,v=(p=h*f)/(d=a*_),S=Math.sqrt(d*d+p*p)*y,A=g/m,T=Math.sqrt(m*m+g*g)*y,n.interpolationMode=ha.CUBIC,n.tangentWeightMode=(o=n.tangentWeightMode)===la.NONE?la.RIGHT:o===la.LEFT?la.BOTH:o,n.rightTangent=v,n.rightTangentWeight=S,s.tangentWeightMode=function(t){return t===la.NONE?la.LEFT:t===la.RIGHT?la.BOTH:t}(s.tangentWeightMode),s.leftTangent=A,s.leftTangentWeight=T):W1(w,t,x))}}}},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():j1(s,t,r))}}}},n(t,[{key:"nil",get:function(){return!this._easingMethods||this._easingMethods.every((function(t){return null==t}))}}]),t}();function W1(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=m2[t];r===fu.CONSTANT?n.interpolationMode=ha.CONSTANT:(n.interpolationMode=ha.LINEAR,n.easingMethod=r)}function j1(t,e,i){e.keyFramesCount;var n=e.getKeyframeValue(i),r=m2[t];n.easingMethod=r}var X1,Y1,q1,K1,Q1,Z1,J1,$1,t2,e2,i2,n2,r2,s2,o2,a2,h2,u2,l2,c2,_2,f2,d2,p2,m2={constant:fu.CONSTANT,linear:fu.LINEAR,quadIn:fu.QUAD_IN,quadOut:fu.QUAD_OUT,quadInOut:fu.QUAD_IN_OUT,quadOutIn:fu.QUAD_OUT_IN,cubicIn:fu.CUBIC_IN,cubicOut:fu.CUBIC_OUT,cubicInOut:fu.CUBIC_IN_OUT,cubicOutIn:fu.CUBIC_OUT_IN,quartIn:fu.QUART_IN,quartOut:fu.QUART_OUT,quartInOut:fu.QUART_IN_OUT,quartOutIn:fu.QUART_OUT_IN,quintIn:fu.QUINT_IN,quintOut:fu.QUINT_OUT,quintInOut:fu.QUINT_IN_OUT,quintOutIn:fu.QUINT_OUT_IN,sineIn:fu.SINE_IN,sineOut:fu.SINE_OUT,sineInOut:fu.SINE_IN_OUT,sineOutIn:fu.SINE_OUT_IN,expoIn:fu.EXPO_IN,expoOut:fu.EXPO_OUT,expoInOut:fu.EXPO_IN_OUT,expoOutIn:fu.EXPO_OUT_IN,circIn:fu.CIRC_IN,circOut:fu.CIRC_OUT,circInOut:fu.CIRC_IN_OUT,circOutIn:fu.CIRC_OUT_IN,elasticIn:fu.ELASTIC_IN,elasticOut:fu.ELASTIC_OUT,elasticInOut:fu.ELASTIC_IN_OUT,elasticOutIn:fu.ELASTIC_OUT_IN,backIn:fu.BACK_IN,backOut:fu.BACK_OUT,backInOut:fu.BACK_IN_OUT,backOutIn:fu.BACK_OUT_IN,bounceIn:fu.BOUNCE_IN,bounceOut:fu.BOUNCE_OUT,bounceInOut:fu.BOUNCE_IN_OUT,bounceOutIn:fu.BOUNCE_OUT_IN,smooth:fu.SMOOTH,fade:fu.FADE};var g2=Ta,y2=Ma;function v2(){throw new Error("split() only valid in Editor.")}g2("cc.animation.ExoticAnimation")((X1=function(){function t(){this._nodeAnimations=Y1&&Y1()}var e=t.prototype;return e.createEvaluator=function(t){return new R2(this._nodeAnimations,t)},e.createEvaluatorForAnimationGraph=function(t){return new P2(this._nodeAnimations,t)},e.addNodeAnimation=function(t){var e=new S2(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 v2()},e.toHashString=function(){return this._nodeAnimations.map((function(t){return t.toHashString()})).join("\n")},t}(),Y1=fa(X1.prototype,"_nodeAnimations",[y2],(function(){return[]})),X1));var S2=g2("cc.animation.ExoticNodeAnimation")((K1=function(){function t(t){this._path=Q1&&Q1(),this._position=Z1&&Z1(),this._rotation=J1&&J1(),this._scale=$1&&$1(),this._path=t}var e=t.prototype;return e.createPosition=function(t,e){this._position=new x2(t,new E2(e))},e.createRotation=function(t,e){this._rotation=new x2(t,new C2(e))},e.createScale=function(t,e){this._scale=new x2(t,new E2(e))},e.createEvaluator=function(t){return new I2(this._path,this._position,this._rotation,this._scale,t)},e.createEvaluatorForAnimationGraph=function(t){var e=t.bindTransform(this._path);return e?new B2(e,this._position,this._rotation,this._scale):null},e.split=function(){return v2()},e.toHashString=function(){var t,e,i,n,r,s;return this._path+"\n"+(null!==(t=null===(e=this._position)||void 0===e?void 0:e.toHashString())&&void 0!==t?t:"")+(null!==(i=null===(n=this._scale)||void 0===n?void 0:n.toHashString())&&void 0!==i?i:"")+(null!==(r=null===(s=this._rotation)||void 0===s?void 0:s.toHashString())&&void 0!==r?r:"")},n(t,[{key:"path",get:function(){return this._path}}]),t}(),Q1=fa(K1.prototype,"_path",[y2],(function(){return""})),Z1=fa(K1.prototype,"_position",[y2],(function(){return null})),J1=fa(K1.prototype,"_rotation",[y2],(function(){return null})),$1=fa(K1.prototype,"_scale",[y2],(function(){return null})),q1=K1))||q1;function A2(t){return t.toPrecision(2)}function T2(t){return t.map((function(t){return Number.parseFloat(A2(t))})).join(" ")}var b2=g2("cc.animation.ExoticVectorLikeTrackValues")((e2=function(){function t(t){this._values=i2&&i2(),this._isQuantized=n2&&n2(),this._values=t}var e=t.prototype;return e.quantize=function(t){this._isQuantized,this._values=function(t,e){var i=O2[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 o=s-r,a=i.from(t,(function(t){return(t-r)/o*n}));return new G2(L2(t),a,o,r)}(this._values,t),this._isQuantized=!0},e.toHashString=function(){var t=this._isQuantized,e=this._values;return t+" "+(t?e.toHashString():T2(e))},n(t,[{key:"precision",get:function(){return this._isQuantized?this._values.originalPrecision:L2(this._values)}}]),t}(),i2=fa(e2.prototype,"_values",[y2],null),n2=fa(e2.prototype,"_isQuantized",[y2],(function(){return!1})),t2=e2))||t2,E2=g2("cc.animation.ExoticVec3TrackValues")(r2=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?H2(i,t,e):mn.fromArray(e,i,3*t)},i.lerp=function(t,e,i,n,r,s){var o=this._values;this._isQuantized?(H2(o,t,n),H2(o,e,r)):(mn.fromArray(n,o,3*t),mn.fromArray(r,o,3*e)),mn.lerp(s,n,r,i)},e}(b2))||r2,C2=g2("cc.animation.ExoticQuatTrackValues")(s2=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?W2(i,t,e):In.fromArray(e,i,4*t)},i.lerp=function(t,e,i,n,r,s){var o=this._values;this._isQuantized?(W2(o,t,n),W2(o,e,r)):(In.fromArray(n,o,4*t),In.fromArray(r,o,4*e)),In.slerp(s,n,r,i)},e}(b2))||s2,x2=g2("cc.animation.ExoticTrack")((a2=function(){function t(t,e){this.times=h2&&h2(),this.values=u2&&u2(),this.times=t,this.values=e}return t.prototype.toHashString=function(){var t=this.times,e=this.values;return"times: "+T2(t)+"; values: "+e.toHashString()},t}(),h2=fa(a2.prototype,"times",[y2],null),u2=fa(a2.prototype,"values",[y2],null),o2=a2))||o2;function w2(t,e){t.length,t.length;var i=0,n=0,r=aa(t,e);if(r>=0)i=r;else{var s=~r,o=s-1;i=o;var a=t[s],h=t[o];n=(e-h)/(a-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],o=0,a=0;if(e<r);else if(e>=s)o=n-1,a=0;else{var h=w2(t,e);o=h.index,a=h.ratio}var u=0,l=0;if(i<r);else if(i>=s)u=n-1,l=0;else{var c=w2(t,i);u=c.index,l=c.ratio}var _=!a,f=!l;o!==u||a!==l?(_||(this.preLerpIndex=o,this.preLerpRatio=a),this.directKeyframesBegin=_?o:o+1,this.directKeyframesEnd=u+1,f||(this.postLerpIndex=u,this.postLerpRatio=l)):_?(this.directKeyframesBegin=o,this.directKeyframesEnd=o+1):(this.preLerpIndex=o,this.preLerpRatio=a)}}},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 D2,R2=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}(),I2=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=z2(e.times,e.values,mn,t,"position",r)),i&&(this._rotation=z2(i.times,i.values,In,t,"rotation",r)),n&&(this._scale=z2(n.times,n.values,mn,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}(),M2=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=function(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 o=aa(t,e);if(o>=0)i.just=!0,i.index=o;else{var a=~o,h=a-1,u=t[h],l=t[a],c=(e-t[h])/(l-u);i.just=!1,i.index=h,i.nextIndex=a,i.ratio=c}}return i}(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}(),P2=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}(),B2=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 M2(e.times,e.values,mn)),i&&(this._rotation=new M2(i.times,i.values,In)),n&&(this._scale=new M2(n.times,n.values,mn))}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,o=e.transforms;if(n){var a=n.evaluate(t);o.setPosition(i,a)}if(r){var h=r.evaluate(t);o.setRotation(i,h)}if(s){var u=s.evaluate(t);o.setScale(i,u)}},t}(),O2={uint8:Uint8Array,uint16:Uint16Array};function L2(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return D2.FLOAT_32;case 8:return D2.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(D2||(D2={}));var N2,F2,k2,V2,G2=g2("cc.animation.QuantizedFloatArray")((c2=function(){function t(t,e,i,n){void 0===n&&(n=0),this.originalPrecision=_2&&_2(),this.min=f2&&f2(),this.extent=d2&&d2(),this.values=p2&&p2(),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+" "+A2(e)+" "+A2(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}(),_2=fa(c2.prototype,"originalPrecision",[y2],null),f2=fa(c2.prototype,"min",[y2],null),d2=fa(c2.prototype,"extent",[y2],null),p2=fa(c2.prototype,"values",[y2],null),l2=c2))||l2;function U2(t,e){return t.values[e]/(1<<t.values.BYTES_PER_ELEMENT)*t.extent+t.min}function z2(t,e,i,n,r,s){var o=new TQ;o.path=(new AQ).toHierarchy(n).toProperty(r);var a=s(o);return a?{runtimeBinding:a,evaluator:new M2(t,e,i)}:null}function H2(t,e,i){mn.set(i,U2(t,3*e+0),U2(t,3*e+1),U2(t,3*e+2))}function W2(t,e,i){In.set(i,U2(t,4*e+0),U2(t,4*e+1),U2(t,4*e+2),U2(t,4*e+3))}var j2,X2,Y2,q2,K2,Q2,Z2,J2,$2,t3,e3,i3,n3,r3,s3,o3,a3,h3,u3,l3=Ta("cc.animation.AuxiliaryCurveEntry")((F2=function(){this.name=k2&&k2(),this.curve=V2&&V2()},k2=fa(F2.prototype,"name",[Ma],(function(){return""})),V2=fa(F2.prototype,"curve",[Ma],(function(){return new Cu})),N2=F2))||N2,c3=Symbol("SearchForRootBonePath"),_3=Symbol("ExoticAnimation"),f3=Symbol("[[EmbeddedPlayerCount]]"),d3=Symbol("[[GetEmbeddedPlayers]]"),p3=Symbol("[[AddEmbeddedPlayer]]"),m3=Symbol("[[RemoveEmbeddedPlayer]]"),g3=Symbol("[[ClearEmbeddedPlayers]]"),y3=Symbol("[[Additive Settings]]"),v3=t("as",Ta("cc.AnimationClip")(((s3=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).sample=Y2&&Y2(),e.speed=q2&&q2(),e.wrapMode=K2&&K2(),e.enableTrsBlending=Q2&&Q2(),e._duration=Z2&&Z2(),e._hash=J2&&J2(),e.frameRate=0,e._tracks=$2&&$2(),e._exoticAnimation=t3&&t3(),e._legacyData=void 0,e._legacyDataDirty=!1,e._events=e3&&e3(),e._embeddedPlayers=i3&&i3(),e._additiveSettings=n3&&n3(),e._auxiliaryCurveEntries=r3&&r3(),e._runtimeEvents={ratios:[],eventGroups:[]},e}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 LZ;return s.path=(new AQ).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 I3(t,this._runtimeEvents.ratios,this._runtimeEvents.eventGroups,this.wrapMode)},i.containsAnyEmbeddedPlayer=function(){return 0!==this._embeddedPlayers.length},i.createEmbeddedPlayerEvaluator=function(t){return new T3(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;return null!==(e=v.director.root)&&void 0!==e&&e.dataPoolManager&&v.director.root.dataPoolManager.releaseAnimationClip(this),kX.destroy(this),t.prototype.destroy.call(this)},i[FX]=function(t,e,i){for(var n=1/e,r=this._collectAnimatedJoints(),s=r.length,o={},a=0;a<s;++a)o[r[a]]={transforms:Array.from({length:i},(function(){return new Vn}))};var h=r.reduce((function(t,e){return t[e]=new C3,t}),{});for(var u in h){var l=h[u],c=u.lastIndexOf("/");if(c>=0){var _=u.substring(0,c),f=h[_];f&&(l.parent=f)}}for(var d=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return R3(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];Vn.copy(o[y].transforms[p],h[y].globalTransform)}for(var v=0;v<s;++v){var S=r[v];h[S].invalidate()}}return{samples:e,frames:i,joints:o}},i.upgradeUntypedTracks=function(t){for(var e=[],i=[],n=this._tracks,r=n.length,s=0;s<r;++s){var o=n[s];if(o instanceof G1){var a=o.upgrade(t);a&&(e.push(a),i.push(o))}}for(var h=i.length,u=0;u<h;++u)fe(n,i[u]);n.push.apply(n,e)},i[c3]=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[d3]=function(){return this._embeddedPlayers},i[p3]=function(t){this._embeddedPlayers.push(t)},i[m3]=function(t){var e=this._embeddedPlayers.indexOf(t);e>=0&&this._embeddedPlayers.splice(e,1)},i[g3]=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 l3).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){pe(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,o=[],a=this._tracks,h=a.length,u=0;u<h;++u){var l=a[u];if(!r.includes(l)&&!Array.from(l.channels()).every((function(t){return 0===t.curve.keyFramesCount}))){var c=e(l[SQ]);if(c){var _=void 0;if(l instanceof G1){if(!c.getValue){et(3930);continue}var f=c.getValue();_=l.createLegacyEval(f)}else _=l[RK]();o.push(new A3(c,_))}}}return this._exoticAnimation&&(s=this._exoticAnimation.createEvaluator(e)),new b3(o,s,n)},i._createRootMotionEvaluation=function(t,e,i){if(t instanceof xg){var n=this._searchForRootBonePath();if(n){var r=t.getChildByPath(n);if(r){for(var s=new E3,o=[],a=this._tracks,h=a.length,u=0;u<h;++u){var l=a[u],c=l[SQ].parseTrsPath();if(c&&c.node===n){i.push(l);var _=R3(s,c.property);if(_){var f=l[RK]();o.push(new A3(_,f))}}}return new w3(r,this._duration,s,o)}$(3924)}else $(3923)}else et(3920)},i._searchForRootBonePath=function(){var t=this._tracks.map((function(t){var e=t[SQ].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 o=t[s];if(o.rank!==n.rank)break;if(o.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 U1(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][SQ].parseTrsPath();r&&t.add(r.node)}if(this._exoticAnimation)for(var s=this._exoticAnimation.collectAnimatedJoints(),o=s.length,a=0;a<o;++a)t.add(s[a]);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?void 0:e.toHashString())&&void 0!==t?t:"");return this._hash=hc(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,o=function(){var t=r[a],s=t.frame/e._duration,o=i.findIndex((function(t){return t===s}));o<0&&(o=i.length,i.push(s),n.push({events:[]})),n[o].events.push({functionName:t.func,parameters:t.params})},a=0;a<s;++a)o();this._runtimeEvents={ratios:i,eventGroups:n}}},{key:_3,get:function(){return this._exoticAnimation}},{key:_3,set:function(t){this._exoticAnimation=t}},{key:"isAdditive_experimental",get:function(){return this._additiveSettings.enabled}},{key:y3,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:f3,get:function(){return this._embeddedPlayers.length}},{key:"auxiliaryCurveCount_experimental",get:function(){return this._auxiliaryCurveEntries.length}}]),e}(Fd)).WrapMode=IK,Y2=fa((X2=s3).prototype,"sample",[Ma],(function(){return 60})),q2=fa(X2.prototype,"speed",[Ma],(function(){return 1})),K2=fa(X2.prototype,"wrapMode",[Ma],(function(){return IK.Normal})),Q2=fa(X2.prototype,"enableTrsBlending",[Ma],(function(){return!1})),Z2=fa(X2.prototype,"_duration",[Ma],(function(){return 0})),J2=fa(X2.prototype,"_hash",[Ma],(function(){return 0})),$2=fa(X2.prototype,"_tracks",[Ma],(function(){return[]})),t3=fa(X2.prototype,"_exoticAnimation",[Ma],(function(){return null})),e3=fa(X2.prototype,"_events",[Ma],(function(){return[]})),i3=fa(X2.prototype,"_embeddedPlayers",[Ma],(function(){return[]})),n3=fa(X2.prototype,"_additiveSettings",[Ma],(function(){return new S3})),r3=fa(X2.prototype,"_auxiliaryCurveEntries",[Ma],(function(){return[]})),j2=X2))||j2),S3=Ta("cc.AnimationClipAdditiveSettings")((a3=function(){this.enabled=h3&&h3(),this.refClip=u3&&u3()},h3=fa(a3.prototype,"enabled",[Ma],(function(){return!1})),u3=fa(a3.prototype,"refClip",[Ma],(function(){return null})),o3=a3))||o3;v.AnimationClip=v3;var A3=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}(),T3=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])||void 0===n||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 o=n[s];if(o){var a=o.entered,h=o.instantiatedPlayer,u=o.lastIterations,l=i[s],c=l.begin,_=l.end;if(t>=c&&t<=_?a?e!==u&&(h.stop(),h.play(),o.entered=!0):(h.play(),o.entered=!0):a&&(h.stop(),o.entered=!1),o.lastIterations=e,o.entered){var f=t-c;o.instantiatedPlayer.setTime(f)}}}},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 o=s.instantiatedPlayer;e[r].reconciledSpeed&&o.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 o=e[r],a=o.begin,h=o.end,u=s.instantiatedPlayer;if(s.entered){var l=s.hostPauseTime;if(u.randomAccess||Li(l,t,1e-5)){var c=Ni(t,a,h);u.play(),u.setTime(c-a)}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 o=s.instantiatedPlayer;s.entered&&(o.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}(),b3=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}(),E3=function(){function t(){this.position=new mn,this.scale=new mn(1,1,1),this.rotation=new In,this.eulerAngles=new mn}return t.prototype.getTransform=function(t){Vn.fromRTS(t,this.rotation,this.position,this.scale)},t}(),C3=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 Vn,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,Vn.fromRTS(t,this.rotation,this.position,this.scale),this.parent&&Vn.multiply(t,this.parent.globalTransform,t)),this._transform}}]),e}(E3),x3=new Vn,w3=function(){function t(t,e,i,n){this._initialTransformCache=new Vn,this._clipEndTransformCache=new Vn,this._startTransformCache=new Vn,this._endTransformCache=new Vn,this._motionTransformCache=new Vn,this._translationMotionCache=new mn,this._rotationMotionCache=new In,this._scaleMotionCache=new mn,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,o=this._rootBone;Vn.toRTS(i,r,n,s),mn.add(n,n,o.position),o.setPosition(n),In.multiply(r,r,o.rotation),o.setRotation(r),mn.multiply(s,s,o.scale),o.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 o=this._evaluateAt(t+e,this._endTransformCache);D3(i,s,o)}else{Vn.identity(i);var a=function(t,e){D3(x3,t,e),Vn.multiply(i,i,x3)},h=e-r,u=Math.floor(h/n),l=h-u*n,c=this._evaluateAt(0,this._initialTransformCache),_=this._evaluateAt(n,this._clipEndTransformCache),f=this._evaluateAt(l,this._endTransformCache);a(s,_),D3(x3,c,_);for(var d=0;d<u;++d)Vn.multiply(i,i,x3);a(c,f)}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 D3(t,e,i){Vn.invert(t,e),Vn.multiply(t,i,t)}function R3(t,e){switch(e){default:return;case"position":return{setValue:function(e){mn.copy(t.position,e)}};case"rotation":return{setValue:function(e){In.copy(t.rotation,e)}};case"scale":return{setValue:function(e){mn.copy(t.scale,e)}};case"eulerAngles":return{setValue:function(e){mn.copy(t.eulerAngles,e)}}}}var I3=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=P3(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=P3(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,o=M3(i),a=M3(this._lastIterations),h=this._lastFrameIndex,u=this._lastDirection,l=-1!==a&&o!==a;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?((s&Dl.PingPong)===Dl.PingPong?e*=-1:h=n,a++):1===e&&h===n-1&&r<n-1&&((s&Dl.PingPong)===Dl.PingPong?e*=-1:h=-1,a++),h===r)break;if(a>o)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?FK().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];OJ(this._targetNode,s.functionName,s.parameters)}}},t}();function M3(t){return t-(0|t)==0&&(t-=1),0|t}function P3(t,e){return aa(e,t)}var B3=new mn,O3=new In,L3=function(){function t(t){this._transformHandle=t}return t.prototype.destroy=function(){this._transformHandle.destroy()},t}(),N3=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,B3)},e}(L3),F3=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,O3)},e}(L3),k3=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=In.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,O3);return In.toEuler(B3,e)},e}(L3);k3._EULER_TO_QUAT_CACHE=new In;var V3=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,B3)},e}(L3),G3=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}(),U3=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?void 0:e.call(i))&&void 0!==t?t:void 0},t}(),z3=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 H3(t,e,i){var n=function(t,e){var i=e.origin,n=t.path,r=t.proxy,s=n.length,o=s-1;if(0!==s&&(n.isPropertyAt(o)||n.isElementAt(o))&&!r){var a=n.isPropertyAt(o)?n.parsePropertyAt(o):n.parseElementAt(o),h=n[yQ](i,0,s-1);if(null===h)return null;if(h instanceof xg&&bQ(a)){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 function(t,e){switch(e){case"position":return new N3(t);case"rotation":return new F3(t);case"eulerAngles":return new k3(t);case"scale":return new V3(t)}}(l,a)}}}var c=t.createRuntimeBinding(e.origin,void 0,!1);return c?new U3(c):null}(e[SQ],i);return null!=n?n:void 0}var W3,j3,X3,Y3,q3,K3,Q3,Z3,J3,$3,t5,e5,i5,n5,r5,s5,o5,a5,h5,u5,l5,c5,_5,f5,d5,p5,m5,g5=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}(),y5=function(){function t(t,e){this._trackEvaluations=[],this._exoticAnimationEvaluation=void 0,this._auxiliaryCurveEvaluations=[],t._trySyncLegacyData();for(var i,n,r=[],s=[],o=t.tracks,a=t[_3],h=f(o);!(n=h()).done;){var u=n.value;if(!(u instanceof G1||Array.from(u.channels()).every((function(t){return 0===t.curve.keyFramesCount})))){var l=H3(0,u,e);if(l){var c=u[RK](),_=new z3(l,c);r.push(_)}}}a&&(i=a.createEvaluatorForAnimationGraph(e));for(var d=t.getAuxiliaryCurveNames_experimental(),p=d.length,m=0;m<p;++m){var g=d[m],y=t.getAuxiliaryCurve_experimental(g),v=e.bindAuxiliaryCurve(g),S=new G3(v);s.push(new g5(S,y))}this._trackEvaluations=r,this._exoticAnimationEvaluation=i,this._auxiliaryCurveEvaluations=s}var e=t.prototype;return e.destroy=function(){var t;null===(t=this._exoticAnimationEvaluation)||void 0===t||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(),o=i.length,a=0;a<o;++a)i[a].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}(),v5=function(){function t(t,e){this._clipEval=void 0,this._refClipEval=void 0,this._clipEval=new y5(t,e);var i=t[y3].refClip;i&&i!==t&&(this._refClipEval=new y5(i,e))}var e=t.prototype;return e.destroy=function(){var t;this._clipEval.destroy(),null===(t=this._refClipEval)||void 0===t||t.destroy()},e.evaluate=function(t,e){var i,n,r,s=this._clipEval.evaluate(t,e);return i=this._refClipEval?this._refClipEval.evaluate(0,e):this._clipEval.evaluate(0,e),r=i,function(t,e){var i=t.length;e.length;for(var n=0;n<i;++n)V$(t,e,n)}((n=s).transforms,r.transforms),function(t,e){t.length,e.length;for(var i=0;i<t.length;++i)t[i]-=e[i]}(n.auxiliaryCurves,r.auxiliaryCurves),e.popPose(),s},t}(),S5=eh,A5=(W3=Ta("cc.animation.ClipMotion"),j3=S5(v3),W3((Y3=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=q3&&q3(),e}s(e,t);var i=e.prototype;return i[C1]=function(t,e){return this.clip?new b5(t,this.clip,e):null},i.clone=function(){var t=new e;return t.clip=this.clip,t[Zs]=EJ(this),t},e}(x1),q3=fa(Y3.prototype,"clip",[j3,Ma],(function(){return null})),X3=Y3))||X3),T5=Symbol("EvaluatePort"),b5=function(){function t(t,e,i){var n,r;this._clipEmbeddedPlayerEval=null,this._frameEventEval=null,this._wrapInfo=new LK,this._duration=0,this._ignoreEmbeddedPlayers=void 0,this._originalClip=e,this._ignoreEmbeddedPlayers=i;var s=null!==(n=null===(r=t.clipOverrides)||void 0===r?void 0:r.get(e))&&void 0!==n?n:e;this._setClip(s,t)}var e=t.prototype;return e.createPort=function(){return new E5(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[T5]=function(t,e){var i,n,r=this._duration,s=this._clip.duration,o=this._clipEval,a=r*t,h=this._clip.wrapMode,u=function(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 o=!1,a=t>0?t/e:-t/e;if(a>=n){a=n,o=!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=i&Dl.ShouldWrap;c&&(l=function(t,e){var i=!1;return(t&Dl.PingPong)===Dl.PingPong&&(e-(0|e)==0&&e>0&&(e-=1),1&e&&(i=!i)),(t&Dl.Reverse)===Dl.Reverse&&(i=!i),i}(i,a));var _=l?-1:1;return r&&(_*=-1),c&&l&&(t=e-t),s.time=t,s.ratio=s.time/e,s.direction=_,s.stopped=o,s.iterations=a,s}(a,r,h,(h&Dl.Loop)===Dl.Loop?1/0:1,!1,this._wrapInfo),l=u.ratio*s,c=o.evaluate(l,e);return null===(i=this._frameEventEval)||void 0===i||i.sample(u.ratio,u.direction,u.iterations),null===(n=this._clipEmbeddedPlayerEval)||void 0===n||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?void 0:e.get(i);n&&this._setClip(n,t)},e.reenter=function(){var t;null===(t=this._frameEventEval)||void 0===t||t.reset()},e._setClip=function(t,e){var i;null===(i=this._clipEval)||void 0===i||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=function(t,e){return t.isAdditive_experimental?new v5(t,e):new y5(t,e)}(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}(),E5=function(){function t(t){this._eval=void 0,this._eval=t}var e=t.prototype;return e.evaluate=function(t,e){return this._eval[T5](t,e)},e.reenter=function(){this._eval.reenter()},t}(),C5=Ta,x5=Ma,w5=C5("cc.animation.AnimationBlendItem")((Q3=function(){function t(){this.motion=Z3&&Z3()}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?void 0:i.clone())&&void 0!==e?e:null,t},t}(),Z3=fa(Q3.prototype,"motion",[x5],(function(){return null})),K3=Q3))||K3,D5=C5("cc.animation.AnimationBlend")(($3=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=t5&&t5(),e}return s(e,t),e.prototype.copyTo=function(t){t.name=this.name,t[Zs]=EJ(this)},e}(x1),t5=fa($3.prototype,"name",[x5],(function(){return""})),J3=$3))||J3,R5=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?void 0:r[C1](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 I5(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 o=e.next();if(!o.done)return o}if(s>=r)return{done:!0,value:void 0};var a=i[s];e=null==a?void 0:a.getClipStatuses(t*n[s]),++s}}}},e.__evaluatePort=function(t,e,i){for(var n=this._childEvaluators.length,r=0,s=null,o=0;o<n;++o){var a,h=this._weights[o];if(h){var u=null===(a=t.childPorts[o])||void 0===a?void 0:a.evaluate(e,i);u&&(r+=h,s?(r&&L$(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])||void 0===i||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?void 0:n.duration)&&void 0!==i?i:0)*this._weights[e]}return t}}]),t}(),I5=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])||void 0===n||n.reenter()}},t}(),M5=Ta,P5=Ma,B5=M5("cc.animation.BindableNumber")((i5=function(){function t(t){void 0===t&&(t=0),this.variable=n5&&n5(),this.value=r5&&r5(),this.value=t}return t.prototype.clone=function(){var e=new t;return e.value=this.value,e.variable=this.variable,e},t}(),n5=fa(i5.prototype,"variable",[P5],(function(){return""})),r5=fa(i5.prototype,"value",[P5],(function(){return 0})),e5=i5))||e5,O5=M5("cc.animation.BindableBoolean")((o5=function(){function t(t){void 0===t&&(t=!1),this.variable=a5&&a5(),this.value=h5&&h5(),this.value=t}return t.prototype.clone=function(){var e=new t;return e.value=this.value,e.variable=this.variable,e},t}(),a5=fa(o5.prototype,"variable",[P5],(function(){return""})),h5=fa(o5.prototype,"value",[P5],(function(){return!1})),s5=o5))||s5;function L5(t,e,i,n,r){var s=e.variable,o=e.value;if(!s)return o;var a=t.getVar(s);if(!N5(a,s))return o;if(a.type!==i)throw new mJ(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];var c=a.bind.apply(a,[n,r].concat(u));return c}function N5(t,e){if(t)return!0;throw new pJ(e)}var F5,k5,V5=Ta,G5=Ma,U5=V5("cc.animation.AnimationBlend1DItem")((l5=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=c5&&c5(),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}(w5),c5=fa(l5.prototype,"threshold",[G5],(function(){return 0})),u5=l5))||u5,z5=V5("cc.animation.AnimationBlend1D")(((m5=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=d5&&d5(),e.param=p5&&p5(),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[C1]=function(t,e){var i=new H5(t,e,this,this._items,this._items.map((function(t){return t.threshold})),0),n=L5(t,this.param,AZ.FLOAT,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}(D5)).Item=U5,d5=fa((f5=m5).prototype,"_items",[G5],(function(){return[]})),p5=fa(f5.prototype,"param",[G5],(function(){return new B5})),_5=f5))||_5,H5=function(t){function e(e,i,n,r,s,o){var a;return(a=t.call(this,e,i,n,r,[o])||this)._thresholds=s,a.doEval(),a}return s(e,t),e.prototype.eval=function(t,e){var i=e[0];!function(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],o=e[n],a=o-s;t[n-1]=(o-i)/a,t[n]=(i-s)/a}}(t,this._thresholds,i)},e}(R5),W5=(F5=new jn,k5={wA:0,wB:0},function(t,e,i){if(t.length,e.length,0!==e.length)if(1!==e.length)if(jn.strictEquals(i,jn.ZERO)){var n=e.findIndex((function(t){return jn.strictEquals(t,jn.ZERO)}));n>=0?t[n]=1:t.fill(1/e.length)}else{for(var r=-1,s=-1,o=-1,a=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY,u=i.x,l=i.y,c=0;c<e.length;++c){var _=e[c];if(jn.equals(_,jn.ZERO))o=c;else{var f=jn.normalize(F5,_),d=jn.dot(f,i);f.x*l-f.y*u>0?d>=h&&(h=d,r=c):d>=a&&(a=d,s=c)}}var p=0;if(r<0||s<0)p=1;else{var m=(E=e[r],C=e[s],x=i,w=k5,(D=jn.cross(E,C))?(w.wA=jn.cross(x,C)/D,w.wB=jn.cross(x,E)/-D):(w.wA=0,w.wB=0),w),g=m.wA,y=m.wB,v=0,S=0,A=g+y;A>1?(v=g/A,S=y/A):A<0?(v=0,S=0,p=1):(v=g,S=y,p=1-A),t[r]=v,t[s]=S}if(p>0)if(o>=0)t[o]=p;else for(var T=p/t.length,b=0;b<t.length;++b)t[b]+=T}else t[0]=1;var E,C,x,w,D});var j5,X5,Y5,q5,K5,Q5,Z5,J5,$5,t4,e4=function(t,e,i,n,r){jn.subtract(n,i,t),jn.subtract(r,e,t)},i4=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=jn.copy(new jn,t),n=jn.len(i);return r[e]=n,Li(n,0,1e-5)||jn.multiplyScalar(i,i,1/n),i})),o=this._precomputedVIJs=new Float32Array(3*n*n),a=0;a<n;++a)for(var h=r[a],u=s[a],l=0;l<n;++l)if(a!==l){var c=r[l],_=s[l],f=(h+c)/2,d=3*(n*a+l);o[d+0]=(c-h)/f,o[d+1]=n4(u,_)*i,o[d+2]=f}this._cacheVIXAngles=new Float32Array(n)}return t.prototype.interpolate=function(e,i){var n=this._exampleDirections,r=this._exampleMagnitudes,s=this._precomputedVIJs,o=this._cacheVIXAngles,a=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 _=i,f=jn.len(_),d=o;if(jn.equals(_,jn.ZERO))for(var p=0;p<c;++p)d[p]=0;else for(var m=jn.multiplyScalar(a,_,1/f),g=0;g<c;++g){var y=n[g];jn.equals(y,jn.ZERO)?d[g]=0:d[g]=n4(y,m)*l}for(var v=0,S=0;S<c;++S){for(var A=r[S],T=n[S],b=Number.POSITIVE_INFINITY,E=0;E<c;++E)if(S!==E){var C=n[E],x=3*(c*S+E),w=s[x+0],D=s[x+1],R=s[x+2],I=D,M=d[S];jn.equals(T,jn.ZERO)?I=d[E]:jn.equals(C,jn.ZERO)?I=d[S]:jn.equals(_,jn.ZERO)&&(M=I);var P=jn.set(h,w,I),B=jn.set(u,(f-A)/R,M),O=1-jn.dot(B,P)/jn.lengthSqr(P);if(O<=0){b=0;break}b=Math.min(b,O)}e[S]=b,v+=b}if(v>0)for(var L=0;L<c;++L)e[L]/=v;else for(var N=1/c,F=0;F<c;++F)e[F]=N}else e[0]=1},t}();function n4(t,e){var i=jn.angle(t,e);return t.x*e.y-t.y*e.x<0?-i:i}i4._CACHE_INPUT_DIRECTION=new jn,i4._CACHE_VIJ=new jn,i4._CACHE_VIX=new jn,i4._ANGLE_MULTIPLIER=1;var r4,s4=Ta,o4=Ma;!function(t){t[t.SIMPLE_DIRECTIONAL=0]="SIMPLE_DIRECTIONAL",t[t.FREEFORM_CARTESIAN=1]="FREEFORM_CARTESIAN",t[t.FREEFORM_DIRECTIONAL=2]="FREEFORM_DIRECTIONAL"}(r4||(r4={})),xe(r4);var a4,h4,u4,l4,c4,_4,f4=s4("cc.animation.AnimationBlend2DItem")((X5=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=Y5&&Y5(),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),jn.copy(e.threshold,this.threshold),e},e}(w5),Y5=fa(X5.prototype,"threshold",[o4],(function(){return new jn})),j5=X5))||j5,d4=s4("cc.animation.AnimationBlend2D")(((t4=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=Q5&&Q5(),e.paramX=Z5&&Z5(),e.paramY=J5&&J5(),e._algorithm=$5&&$5(),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[C1]=function(t,e){var i,n=this.algorithm;switch(n){case r4.FREEFORM_DIRECTIONAL:this._polarSpaceGBI,i=new m4(t,e,this,this._items,this._polarSpaceGBI,[0,0]);break;default:case r4.SIMPLE_DIRECTIONAL:case r4.FREEFORM_CARTESIAN:i=new p4(t,e,this,this._items,this._items.map((function(t){return t.threshold})),n,[0,0])}var r=L5(t,this.paramX,AZ.FLOAT,i.setInput,i,0),s=L5(t,this.paramY,AZ.FLOAT,i.setInput,i,1);return i.setInput(r,0),i.setInput(s,1),i},i._tryReconstructPolarSpaceInterpolator=function(){this._algorithm===r4.FREEFORM_DIRECTIONAL?this._polarSpaceGBI=new i4(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}(D5)).Algorithm=r4,t4.Item=f4,Q5=fa((K5=t4).prototype,"_items",[o4],(function(){return[]})),Z5=fa(K5.prototype,"paramX",[o4],(function(){return new B5})),J5=fa(K5.prototype,"paramY",[o4],(function(){return new B5})),$5=fa(K5.prototype,"_algorithm",[o4],(function(){return r4.SIMPLE_DIRECTIONAL})),q5=K5))||q5,p4=function(t){function e(e,i,n,r,s,o,a){var h;return(h=t.call(this,e,i,n,r,a)||this)._thresholds=void 0,h._algorithm=void 0,h._value=new jn,h._thresholds=s,h._algorithm=o,h.doEval(),h}return s(e,t),e.prototype.eval=function(t,e){var i=e[0],n=e[1];switch(jn.set(this._value,i,n),t.fill(0),this._algorithm){case r4.SIMPLE_DIRECTIONAL:W5(t,this._thresholds,this._value);break;case r4.FREEFORM_CARTESIAN:!function(t,e,i){!function(t,e,i,n){t.fill(0);for(var r=new jn(0,0),s=new jn(0,0),o=0,a=e.length,h=0;h<a;++h){for(var u=Number.MAX_VALUE,l=!1,c=0;c<a;++c)if(h!==c){n(e[h],e[c],i,r,s);var _=1-jn.dot(r,s)/jn.lengthSqr(s);if(_<0){l=!0;break}u=Math.min(u,_)}l||(t[h]=u,o+=u)}o>0&&t.forEach((function(e,i){return t[i]=e/o}))}(t,e,i,e4)}(t,this._thresholds,this._value)}},e}(R5),m4=function(t){function e(e,i,n,r,s,o){var a;return(a=t.call(this,e,i,n,r,o)||this)._interpolator=void 0,a._value=new jn,a._interpolator=s,a.doEval(),a}return s(e,t),e.prototype.eval=function(t,e){var i=e[0],n=e[1];jn.set(this._value,i,n),t.fill(0),this._interpolator.interpolate(t,this._value)},e}(R5),g4=Ta,y4=Ma,v4=g4("cc.animation.AnimationBlendDirectItem")((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).weight=u4&&u4(),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}(w5),u4=fa(h4.prototype,"weight",[y4],(function(){return new B5(0)})),a4=h4))||a4;g4("cc.animation.AnimationBlendDirect")(((_4=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=c4&&c4(),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[C1]=function(t,e){for(var i=new z4(t,e,this,this._items,new Array(this._items.length).fill(0)),n=0;n<this._items.length;++n){var r=L5(t,this._items[n].weight,AZ.FLOAT,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}(D5)).Item=v4,c4=fa((l4=_4).prototype,"_items",[y4],(function(){return[]})),l4));var S4,A4,T4,b4,E4,C4,x4,w4,D4,R4,I4,M4,P4,B4,O4,L4,N4,F4,k4,V4,G4,U4,z4=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}(R5),H4=Ta("cc.JointMask")((A4=function(){this.path=T4&&T4(),this.enabled=b4&&b4()},T4=fa(A4.prototype,"path",[Ma],(function(){return""})),b4=fa(A4.prototype,"enabled",[Ma],(function(){return!0})),S4=A4))||S4;E4=Ta("cc.animation.AnimationMask"),C4=eh(H4),E4((x4=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=w4&&w4(),e}s(e,t);var i=e.prototype;return i.addJoint=function(t,e){this.removeJoint(t);var i=new H4;i.path=t,i.enabled=e,this._jointMasks.push(i)},i.removeJoint=function(t){pe(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],o=s.path;if(!s.enabled){var a=t.getChildByPath(o);a&&n.add(a)}}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?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=f(t);!(e=i()).done;){var n=e.value;this.addJoint(n.path,n.enabled)}}}]),e}(Fd),w4=fa(x4.prototype,"_jointMasks",[Ma],(function(){return[]})),m(x4.prototype,"joints",[C4],Object.getOwnPropertyDescriptor(x4.prototype,"joints"),x4.prototype),x4));var W4=Ta("cc.animation.ClipOverrideEntry")((I4=function(){this.original=M4&&M4(),this.substitution=P4&&P4()},M4=fa(I4.prototype,"original",[Ma],(function(){return null})),P4=fa(I4.prototype,"substitution",[Ma],(function(){return null})),R4=I4))||R4,j4=(B4=Ta("cc.animation.AnimationGraphVariant"),O4=eh(E1),B4((m((N4=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=F4&&F4(),e._clipOverrides=k4&&k4(),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}(YJ)).prototype,"original",[O4],Object.getOwnPropertyDescriptor(N4.prototype,"original"),N4.prototype),F4=fa(N4.prototype,"_graph",[Ma],(function(){return null})),k4=fa(N4.prototype,"_clipOverrides",[Ma],(function(){return new X4})),L4=N4))||L4),X4=Ta("cc.animation.ClipOverrideMap")((D4=Symbol.iterator,G4=function(){function t(){this._entries=U4&&U4()}var e=t.prototype;return e[D4]=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 W4;n.original=t,n.substitution=e,this._entries.push(n)}},e.delete=function(t){pe(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}(),U4=fa(G4.prototype,"_entries",[Ma],(function(){return[]})),V4=G4))||V4,Y4=10,q4=Float64Array.BYTES_PER_ELEMENT*Y4,K4=function(){function t(t,e,i){this._data=void 0,this._data=void 0===t?new Float64Array:"number"==typeof t?new Float64Array(Y4*t):new Float64Array(t,e,"number"==typeof i?Y4*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,o=Y4*t;return mn.fromArray(n,i,o),In.fromArray(r,i,o+3),mn.fromArray(s,i,o+7),e},e.getPosition=function(t,e){var i=this._data,n=Y4*t;return mn.fromArray(e,i,n),e},e.getRotation=function(t,e){var i=this._data,n=Y4*t;return In.fromArray(e,i,n+3),e},e.getScale=function(t,e){var i=this._data,n=Y4*t;return mn.fromArray(e,i,n+7),e},e.setTransform=function(t,e){var i=this._data,n=e.position,r=e.rotation,s=e.scale,o=Y4*t;mn.toArray(i,n,o),In.toArray(i,r,o+3),mn.toArray(i,s,o+7)},e.setPosition=function(t,e){var i=this._data,n=Y4*t;mn.toArray(i,e,n)},e.setRotation=function(t,e){var i=this._data,n=Y4*t;In.toArray(i,e,n+3)},e.setScale=function(t,e){var i=this._data,n=Y4*t;mn.toArray(i,e,n+7)},e.copyWithin=function(t,e,i){this._data.copyWithin(t*Y4,e*Y4,"number"==typeof i?i*Y4: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 o=e+1;o<i;++o)this.copyWithin(o,e,e+1)}},e.fillZero=function(t,e){this._data.fill(0,"number"==typeof t?t*Y4:void 0,"number"==typeof e?e*Y4:void 0)},e.set=function(t,e){this._data.set(t._data,"number"==typeof e?e*Y4:void 0)},e.slice=function(e,i){var n=this._data.slice("number"==typeof e?e*Y4:void 0,"number"==typeof i?i*Y4:void 0);return new t(n.buffer,n.byteOffset,n.length/Y4)},e.copyRange=function(t,e,i,n){for(var r=Y4*n,s=this._data,o=Y4*t,a=e._data,h=Y4*i,u=0;u<r;++u)s[o+u]=a[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/Y4}}],[{key:"BYTES_PER_ELEMENT",get:function(){return q4}}]),t}(),Q4=Symbol(""),Z4=Symbol(""),J4=function(t){this.buffer=void 0,this.useCount=0,this.buffer=new ArrayBuffer(t)},$4=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[Q4];this._pages.length,e===this._pages.length&&this._pushNewPage(),this._pages.length;var i=this._pages[e];return++i.useCount,++t[Q4],i},e.popPage=function(t){var e=t[Q4]-1,i=this._pages[e];i.useCount,--i.useCount,--t[Q4],0===i.useCount&&(this._pages.length,this._pages.pop())},e.createAllocator=function(t){var e=new e6(this,t);return++this._allocatorCount,e},e.destroyAllocator=function(t){for(var e=t[Q4],i=0;i<e;++i){var n=this._pages[i];n.useCount,--n.useCount}this._allocatorCount,--this._allocatorCount,0===this._allocatorCount&&this._manager[Z4](this)},e._pushNewPage=function(){var t=new J4(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}(),t6=function(t,e){this.buffer=t,this.byteOffset=e},e6=function(){function t(t,e){this[Q4]=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[Q4]&&this._resource.pushPage(this),this[Q4]):(n===i*this[Q4]&&(this._resource.pushPage(this),this[Q4]),s=(n-(r=n%i))/i,this[Q4]);var o=this._resource.getPageMemory(s),a=new t6(o,t*r);return this._slices.push(a),a},e.pop=function(){var t=this._slices,e=this._slicesPerPage,i=t.length-1;0===this._sliceSize?(this[Q4],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}(),i6=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 $4(this,i),this._stacks.set(i,n)),n.createAllocator(e)},e[Z4]=function(t){for(var e,i=f(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=aa(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}(),n6=function(){function t(t,e){this._poses=[],this._allocatedCount=0,this._memoryAllocator=void 0,this._transformCount=t,this._auxiliaryCurveCount=e;var i=r6(t,e,1);this._memoryAllocator=o6.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=K4.BYTES_PER_ELEMENT*this._transformCount,i=t.byteOffset,n=new K4(t.buffer,i,this._transformCount),r=new Float64Array(t.buffer,i+e,this._auxiliaryCurveCount),s=B$._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 r6(t,e,i){return(K4.BYTES_PER_ELEMENT*t+Float64Array.BYTES_PER_ELEMENT*e)*i}var s6,o6=new i6([r6(128,10,4)]);!function(t){t[t.WORLD=0]="WORLD",t[t.COMPONENT=1]="COMPONENT",t[t.PARENT=2]="PARENT",t[t.LOCAL=3]="LOCAL"}(s6||(s6={})),xe(s6);var a6,h6,u6,l6,c6,_6,f6,d6,p6=Symbol("PoseHeapAllocator"),m6=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[p6].pageIndex=i,0===n.freeCount&&++this._foremostPossibleFreePage,r}var s=this._allocatePoseInNewPage();return this._foremostPossibleFreePage=s[p6].pageIndex,s},e.destroyPose=function(t){var e=this._pages;e.length;var i=t[p6].pageIndex,n=e[i];n.deallocate(t),--this._allocatedCount,i<this._foremostPossibleFreePage&&(n.freeCount,this._foremostPossibleFreePage=i)},e._allocatePoseInNewPage=function(){var t=new S6(this._transformCount,this._metaValueCount,4),e=this._pages.length;this._pages.push(t);var i=t.tryAllocate();return i[p6].pageIndex=e,i},n(t,[{key:"allocatedCount",get:function(){return this._allocatedCount}}]),t}(),g6=function(){function t(){this._id=-1}return n(t,[{key:"pageIndex",get:function(){return this._id>>v6},set:function(t){this._id&=y6,this._id|=t<<v6}},{key:"poseIndex",get:function(){return this._id&y6},set:function(t){this._id&=~y6,this._id|=t}}]),t}(),y6=7,v6=3,S6=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=(K4.BYTES_PER_ELEMENT*t+Float64Array.BYTES_PER_ELEMENT*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=function(t){return 0===t?1/0:Math.log2(t&-t)}(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[p6].poseIndex=r,this._idleFlags&=~(1<<r),this._freeCount,--this._freeCount,s},e.deallocate=function(t){var e=this._poses,i=t[p6].poseIndex;i>=0&&e.length,e[i],this._idleFlags|=1<<i,this._freeCount,this._capacity,++this._freeCount},e._createPose=function(t){var e=K4.BYTES_PER_ELEMENT*this._transformCount,i=(e+Float64Array.BYTES_PER_ELEMENT*this._metaValueCount)*t,n=new K4(this._buffer,i,this._transformCount),r=new Float64Array(this._buffer,i+e,this._metaValueCount),s=B$._create(n,r);return s[p6]=new g6,s},n(t,[{key:"capacity",get:function(){return this._capacity}},{key:"freeCount",get:function(){return this._freeCount}}]),t}();function A6(t,e){if(t.name===e)return t;for(var i=t.children.length,n=0;n<i;++n){var r=A6(t.children[n],e);if(r)return r}return null}var T6,b6=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=A6(this._origin,t);return e?this._layoutMaintainer.getOrCreateTransformBinding(e):null},e.getBoneChildren=function(t){var e=A6(this._origin,t);return e?e.children.map((function(t){return t.name})):[]},e.getParentBoneNameByName=function(t){var e,i=A6(this._origin,t);return i?i===this._origin?"":null===(e=i.parent)||void 0===e?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}(),E6=new C$,C6=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}();!function(t){t[t.TRANSFORM_COUNT=1]="TRANSFORM_COUNT",t[t.TRANSFORM_ORDER=2]="TRANSFORM_ORDER",t[t.AUXILIARY_CURVE_COUNT=4]="AUXILIARY_CURVE_COUNT"}(T6||(T6={}));var x6=(a6=function(){},h6=function(){},u6=function(){},l6=function(){},c6=function(){},_6=function(){},f6=function(){},m((d6=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},o=t.parent;o&&!s(o);o=o.parent);for(var a=r;a<e.length;++a)++e[a].handle.index;var h=new w6(new G6(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 D6(new U6(this,r),t);return e.push(s),s.handle},e.createEvaluationContext=function(){return this._bindStarted,new V6(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=f(this._transformRecords);!(e=r()).done;){var s=e.value,o=s.node,a=s.handle,h=u(i,o);if(void 0===h)z(o.getPathInHierarchy()+" is not a child of "+i.getPathInHierarchy());else if(t.isExcluded(h))continue;n.push(a.index)}return n.sort(),new O$(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,E6);this._transformRecords[r].node.setRTS(s.rotation,s.position,s.scale)}for(var o=this._auxiliaryCurveRecords.length,a=0;a<o;++a){var h=this._auxiliaryCurveRecords[a].name,u=i[a];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(R6(t),t.length!==this._transformCountBeforeBind){i|=T6.TRANSFORM_COUNT;for(var n=t.length,r=0;r<n;++r)t[r].order=r}else{for(var s=t.length,o=!1,a=0;a<s;++a){var h=t[a];h.order!==a&&(o=!0,h.order=a)}o&&(i|=T6.TRANSFORM_ORDER)}R6(e),e.length!==this._auxiliaryCurveCountBeforeBind&&(i|=T6.AUXILIARY_CURVE_COUNT);var u=this._parentTable,l=this._origin;u.length=t.length;for(var c=function(){var e=t[_].node;if(e===l)return u[_]=-1,1;var i=e.parent;if(i===l){var n=t.findIndex((function(t){return t.node===i}));u[_]=n>=0?n:-1}else{var r=t.findIndex((function(t){return t.node===i}));u[_]=r}},_=0;_<t.length;++_)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}()).prototype,"getOrCreateTransformBinding",[a6],Object.getOwnPropertyDescriptor(d6.prototype,"getOrCreateTransformBinding"),d6.prototype),m(d6.prototype,"_getOrCreateTransformBinding",[h6],Object.getOwnPropertyDescriptor(d6.prototype,"_getOrCreateTransformBinding"),d6.prototype),m(d6.prototype,"getOrCreateAuxiliaryCurveBinding",[u6],Object.getOwnPropertyDescriptor(d6.prototype,"getOrCreateAuxiliaryCurveBinding"),d6.prototype),m(d6.prototype,"_destroyTransformHandle",[l6],Object.getOwnPropertyDescriptor(d6.prototype,"_destroyTransformHandle"),d6.prototype),m(d6.prototype,"_destroyAuxiliaryCurveHandle",[c6],Object.getOwnPropertyDescriptor(d6.prototype,"_destroyAuxiliaryCurveHandle"),d6.prototype),m(d6.prototype,"startBind",[_6],Object.getOwnPropertyDescriptor(d6.prototype,"startBind"),d6.prototype),m(d6.prototype,"endBind",[f6],Object.getOwnPropertyDescriptor(d6.prototype,"endBind"),d6.prototype),d6),w6=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 C$;i.position=e.position,i.rotation=e.rotation,i.scale=e.scale,this.defaultTransform=i},D6=function(t,e){this.refCount=1,this.handle=void 0,this.name=void 0,this.handle=t,this.name=e};function R6(t){var e=function(t,e){for(var i=t.length,n=0;n<i&&e(t[n]);++n);if(n===i)return i;for(var r=n,s=n+1;s<i;++s){var o=t[s];if(e(o)){var a=o;t[s]=t[r],t[r]=a,++r}}return r}(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 I6,M6,P6,B6,O6,L6=Symbol("[[DefaultTransforms]]"),N6=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}(),F6=new C$,k6=new C$,V6=function(){function t(t,e,i,n){this[L6]=void 0,this._poseAllocator=void 0,this._parentTable=void 0,this._componentNode=void 0,this._cacheComponentToWorldTransform=new C$,this._poseAllocator=new n6(t,e),this._parentTable=i,this._componentNode=n,this[L6]=new K4(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[L6]),t._poseTransformSpace=R$.LOCAL,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(P$),t._poseTransformSpace=R$.LOCAL,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,F6),o=e.getTransform(r,k6);C$.multiply(s,o,s),e.setTransform(n,s)}}t._poseTransformSpace=R$.COMPONENT},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,F6),s=e.getTransform(n,k6);C$.calculateRelative(r,r,s),e.setTransform(i,r)}}t._poseTransformSpace=R$.LOCAL},e._convertPoseSpaceTransformToTargetSpace=function(t,e,i,n){var r=i._poseTransformSpace;switch(e){default:break;case s6.WORLD:r===R$.COMPONENT?C$.multiply(t,this._getComponentToWorldTransform(),t):(R$.LOCAL,C$.multiply(t,this._getLocalToWorldTransform(k6,i,n),t));break;case s6.COMPONENT:r===R$.COMPONENT||(R$.LOCAL,C$.multiply(t,this._getLocalToComponentTransform(k6,i,n),t));break;case s6.PARENT:if(r===R$.COMPONENT){var s=this._parentTable[n];if(s>=0){var o=i.transforms.getTransform(s,k6),a=C$.invert(o,o);C$.multiply(t,a,t)}}else R$.LOCAL;break;case s6.LOCAL:r===R$.COMPONENT||R$.LOCAL;var h=i.transforms.getTransform(n,k6),u=C$.invert(h,h);C$.multiply(t,u,t)}return t},e._convertTransformToPoseTransformSpace=function(t,e,i,n){var r=i._poseTransformSpace;switch(e){default:break;case s6.WORLD:if(r===R$.COMPONENT){var s=C$.invert(k6,this._getComponentToWorldTransform());C$.multiply(t,s,t)}else{R$.LOCAL;var o=this._getLocalToWorldTransform(k6,i,n),a=C$.invert(o,o);C$.multiply(t,a,t)}break;case s6.COMPONENT:if(r===R$.COMPONENT);else{R$.LOCAL;var h=this._getLocalToComponentTransform(k6,i,n),u=C$.invert(h,h);C$.multiply(t,u,t)}break;case s6.PARENT:if(r===R$.COMPONENT){var l=this._parentTable[n];if(l>=0){var c=i.transforms.getTransform(l,k6);C$.multiply(t,c,t)}}break;case s6.LOCAL:r===R$.COMPONENT||R$.LOCAL;var _=i.transforms.getTransform(n,k6);C$.multiply(t,_,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;C$.setIdentity(t);for(var r=n[i];r>=0;r=n[r]){var s=e.transforms.getTransform(r,F6);C$.multiply(t,s,t)}return t},e._getLocalToWorldTransform=function(t,e,i){return this._getLocalToComponentTransform(t,e,i),C$.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}(),G6=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}(),U6=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}(),z6=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}(),H6=function(){function t(){this._allocator=null}var e=t.prototype;return e._reset=function(t,e){this._allocator=new m6(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}(),W6=Ta,j6=Ma;!function(t){t[t.TRUTHY=0]="TRUTHY",t[t.FALSY=1]="FALSY"}(O6||(O6={})),W6("cc.animation.UnaryCondition")(((B6=function(){function t(){this.operator=M6&&M6(),this.operand=P6&&P6()}var e=t.prototype;return e.clone=function(){var e=new t;return e.operator=this.operator,e.operand=this.operand.clone(),e},e[C1]=function(t){var e=this.operator,i=this.operand,n=new Y6(e,!1),r=L5(t,i,AZ.BOOLEAN,n.setOperand,n);return n.reset(r),n},t}()).Operator=O6,M6=fa((I6=B6).prototype,"operator",[j6],(function(){return O6.TRUTHY})),P6=fa(I6.prototype,"operand",[j6],(function(){return new O5})),I6));var X6,Y6=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 O6.TRUTHY:this._result=!!t;break;case O6.FALSY:this._result=!t}},t}();!function(t){t[t.FLOAT=0]="FLOAT",t[t.INTEGER=3]="INTEGER"}(X6||(X6={}));var q6,K6=function(){},Q6=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(){}};!function(t){t[t.MOTION=1]="MOTION",t[t.POSE=2]="POSE",t[t.EMPTY=4]="EMPTY",t[t.WEIGHTED=7]="WEIGHTED"}(q6||(q6={}));var Z6,J6,$6,t8,e8,i8,n8,r8=Ma,s8=Ta("cc.animation.TCVariableBinding")(Z6=Q6(X6.FLOAT,X6.INTEGER)((J6=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&&$6(),e.variableName=t8&&t8(),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 o8(e)},e}(K6),$6=fa(J6.prototype,"type",[r8,Ba],(function(){return X6.FLOAT})),t8=fa(J6.prototype,"variableName",[r8],(function(){return""})),Z6=J6))||Z6)||Z6,o8=function(){function t(t){this._varInstance=t}return t.prototype.evaluate=function(){return this._varInstance.value},t}(),a8=Ma;Ta("cc.animation.TCAuxiliaryCurveBinding")(e8=Q6(X6.FLOAT)((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).curveName=n8&&n8(),e}s(e,t);var i=e.prototype;return i.getValueType=function(){return X6.FLOAT},i.bind=function(t){var e=t.getEvaluationTimeAuxiliaryCurveView();return new c8(e,this.curveName)},e}(K6),n8=fa(i8.prototype,"curveName",[a8],(function(){return""})),e8=i8))||e8);var h8,u8,l8,c8=function(){function t(t,e){this._view=t,this._curveName=e}return t.prototype.evaluate=function(){return this._view.get(this._curveName)},t}();h8=Ta("cc.animation.TCStateWeightBinding"),u8=Q6(X6.FLOAT),q6.WEIGHTED,h8(l8=u8(l8=void(l8=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getValueType=function(){return X6.FLOAT},i.bind=function(){return new p8},e}(K6))||l8)||l8);var _8,f8,d8,p8=function(){function t(){}return t.prototype.evaluate=function(t){return t.sourceStateWeight},t}();_8=Ta("cc.animation.TCStateMotionTimeBinding"),f8=Q6(X6.FLOAT),q6.POSE,_8(d8=f8(d8=void(d8=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.getValueType=function(){return X6.FLOAT},i.bind=function(){return new b8},e}(K6))||d8)||d8);var m8,g8,y8,v8,S8,A8,T8,b8=function(){function t(){}return t.prototype.evaluate=function(t){return t.sourceStateMotionTimeNormalized},t}(),E8=Ta,C8=Ma;!function(t){t[t.EQUAL_TO=0]="EQUAL_TO",t[t.NOT_EQUAL_TO=1]="NOT_EQUAL_TO",t[t.LESS_THAN=2]="LESS_THAN",t[t.LESS_THAN_OR_EQUAL_TO=3]="LESS_THAN_OR_EQUAL_TO",t[t.GREATER_THAN=4]="GREATER_THAN",t[t.GREATER_THAN_OR_EQUAL_TO=5]="GREATER_THAN_OR_EQUAL_TO"}(T8||(T8={})),E8("cc.animation.BinaryCondition")(((A8=function(){function t(){this.operator=g8&&g8(),this.lhs=y8&&y8(),this.lhsBinding=v8&&v8(),this.rhs=S8&&S8()}var e=t.prototype;return e.clone=function(){var e=new t;return e.operator=this.operator,e.lhs=this.lhs,e.lhsBinding=SJ(this.lhsBinding),e.rhs=this.rhs,e},e[C1]=function(t){var e,i=null===(e=this.lhsBinding)||void 0===e?void 0:e.bind(t);return new X8(this.operator,this.lhs,this.rhs,i)},t}()).Operator=T8,g8=fa((m8=A8).prototype,"operator",[C8],(function(){return T8.EQUAL_TO})),y8=fa(m8.prototype,"lhs",[C8],(function(){return 0})),v8=fa(m8.prototype,"lhsBinding",[C8],(function(){return new s8})),S8=fa(m8.prototype,"rhs",[C8],(function(){return 0})),m8));var x8,w8,D8,R8,I8,M8,P8,B8,O8,L8,N8,F8,k8,V8,G8,U8,z8,H8,W8,j8,X8=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?void 0:i.evaluate(t))&&void 0!==e?e:this._lhsValue,r=this._rhsValue;switch(this._operator){default:case T8.EQUAL_TO:return n===r;case T8.NOT_EQUAL_TO:return n!==r;case T8.LESS_THAN:return n<r;case T8.LESS_THAN_OR_EQUAL_TO:return n<=r;case T8.GREATER_THAN:return n>r;case T8.GREATER_THAN_OR_EQUAL_TO:return n>=r}},t}(),Y8=Ma,q8=Ta("cc.animation.TriggerCondition")((w8=function(){function t(){this.trigger=D8&&D8()}var e=t.prototype;return e.clone=function(){var e=new t;return e.trigger=this.trigger,e},e[C1]=function(t){var e=new K8(!1),i=t.getVar(this.trigger);return N5(i,this.trigger)&&(function(t,e){if(t!==AZ.TRIGGER)throw new mJ(e,"trigger")}(i.type,this.trigger),e.setTrigger(i.bind(e.setTrigger,e))),e},t}(),D8=fa(w8.prototype,"trigger",[Y8],(function(){return""})),x8=w8))||x8,K8=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}(),Q8=Ta("cc.animation.StateMachineComponent")(R8=function(){function t(){}var e=t.prototype;return e.onMotionStateEnter=function(){},e.onMotionStateExit=function(){},e.onMotionStateUpdate=function(){},e.onStateMachineEnter=function(){},e.onStateMachineExit=function(){},t}())||R8,Z8=Ta("cc.animation.MotionSyncInfo")((M8=function(){this.group=P8&&P8()},P8=fa(M8.prototype,"group",[Ma],(function(){return""})),I8=M8))||I8,J8=1e-5,$8=(B8=Ta("cc.animation.PoseNodePlayMotion"),"i18n:ENGINE.animation_graph.pose_graph_node_sub_categories.pose_nodes/",O8=_$((function(t){t.category="i18n:ENGINE.animation_graph.pose_graph_node_sub_categories.pose_nodes/"})),L8=function(t){return _$((function(e){e.factory=t}))}((j8=function(t){var e=new $8;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 A5;break;case"animation-blend-1d":e=new z5;break;case"animation-blend-2d":e=new d4}return j8(e)}})),N8=f$({themeColor:"#227F9B"}),F8=J$({type:o$.FLOAT}),k8=J$({type:o$.FLOAT}),B8(V8=O8(V8=L8(V8=N8((G8=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=U8&&U8(),e.syncInfo=z8&&z8(),p(e,"startTime",H8,c(e)),p(e,"speedMultiplier",W8,c(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[C1](t,!1);i&&(this._workspace=new t7(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<J8?0:Fi(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>J8&&(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?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?void 0:e.normalizedTime)&&void 0!==t?t:0}}]),e}(Q$),U8=fa(G8.prototype,"motion",[Ma],(function(){return new A5})),z8=fa(G8.prototype,"syncInfo",[Ma],(function(){return new Z8})),H8=m(G8.prototype,"startTime",[Ma,F8],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),W8=m(G8.prototype,"speedMultiplier",[Ma,k8],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),V8=G8))||V8)||V8)||V8)||V8),t7=function(t,e){this.normalizedTime=0,this.lastIndicativeWeight=0,this.motionEval=t,this.motionEvalPort=e};function e7(t){return t instanceof Q$||t instanceof Z$}var i7=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)||void 0===e||e.bind(t)},e.settle=function(t){var e;null===(e=this._rootPoseNode)||void 0===e||e.settle(t)},e.reenter=function(){var t;null===(t=this._rootPoseNode)||void 0===t||t.reenter()},e.update=function(t){var e;null===(e=this._rootPoseNode)||void 0===e||e.update(t)},e.evaluate=function(t){var e,i;return null!==(e=null===(i=this._rootPoseNode)||void 0===i?void 0:i.evaluate(t,z$.LOCAL))&&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,o=r.lastIndicativeWeight;o>i&&(i=o,e=s)}return e},t}();function n7(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 i7(void 0,i?[]:void 0);var s=r[0];s.outputIndex,s.producer;var o=new Map,a=r7(t,s.producer,o,e);return new i7(a,i?Array.from(o.values()).filter((function(t){return t instanceof $8})):void 0)}function r7(t,e,i,n){var r=t.getShell(e),s=i.get(e);if(s)return s;var o=SJ(e);"__callOnAfterDeserializeRecursive"in o&&o.__callOnAfterDeserializeRecursive(),o instanceof Z$&&o.link(n);for(var a,h=o,u=[],l=f(r.getBindings());!(a=l()).done;){var c=a.value,_=c.producer,d=c.outputIndex,p=c.inputPath;if(e7(_)){var m=r7(t,_,i,n);if(m instanceof Q$)a7(h,p,m,d);else{var g=c7(h,p,m,d);g&&u.push(g)}}else U("There's a input bound to a node with unrecognized type.")}var y,v=new s7(u);return h instanceof Q$?(h._setDependencyEvaluation(v),y=h):y=new o7(h,v),i.set(e,y),y}var s7=function(){function t(t){this._bindingEvaluations=void 0,this._bindingEvaluations=t}return t.prototype.evaluate=function(){for(var t,e=f(this._bindingEvaluations);!(t=e()).done;)t.value.evaluate()},t}(),o7=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 a7(t,e,i,n){var r=e[0],s=e[1],o=void 0===s?-1:s;if(r in t)if(0===n){var a=t[r];if(o<0)return null!==a?void U("Invalid binding: consumer node's input "+r+" should be leaved as evaluation before evaluation."):void(t[r]=i);Array.isArray(a)?o>=a.length?U("Invalid binding: consumer node's input "+r+" have length "+a.length+" but the binding specified "+o):null===a[o]?a[o]=i:U("Invalid binding: consumer node's input "+r+"["+o+"] should be leaved as null before evaluation"):U("Invalid binding: consumer node's input "+r+" should be an array.")}else U("Node "+i.toString()+" does not have specified output "+n+".");else U("Invalid binding: consumer node has no property "+r)}var h7,u7=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}(),l7=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 c7(t,e,i,n){var r=e[0],s=e[1],o=void 0===s?-1:s;if(r in t){var a=t[r];if(o<0)return new u7(t,r,i,n);if(Array.isArray(a)){if(!(o>=a.length))return new l7(t,r,o,i,n);U("Invalid binding: consumer node's input "+r+" have length "+a.length+" but the binding specified "+o)}else U("Invalid binding: consumer node's input "+r+" should be an array.")}else U("Invalid binding: consumer node has no property "+r)}var _7=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=R7.createPool(4),this._updateContextGenerator=new z6,this._conditionEvaluationContext=new D7,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=f(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 t.kind===d7.animation||t.kind===d7.procedural?t.getStatus():null},e.getCurrentClipStatuses=function(){var t=this._currentNode;return t.kind===d7.animation?t.getClipStatuses(t.absoluteWeight):m7},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 d7.procedural:case d7.animation:return e.getStatus()}return null},e.getNextClipStatuses=function(){var t,e=this._activatedTransitions;if(0===e.length)return m7;var i=e[e.length-1],n=i.destination;switch(n.kind){default:return m7;case d7.animation:return null!==(t=n.getClipStatuses(i.destination.absoluteWeight))&&void 0!==t?t:m7}},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,o,a=this,h=Array.from(t.states()),u=h.map((function(e){if(e instanceof jJ){var n=new A7(e,i);return a._motionStates.push(n),n}if(e===t.entryState)return r=new C7(e,d7.entry,e.name);if(e===t.exitState)return o=new C7(e,d7.exit,e.name);if(e===t.anyState)return s=new C7(e,d7.any,e.name);if(e instanceof f1)return new x7(e);if(e instanceof m1){var h=new w7(e,i);return a._proceduralPoseStates.push(h),h}return null})),l={components:null,parent:e,entry:r,exit:o,any:s},c=0;c<h.length;++c){var _=u[c];_&&(_.stateMachine=l)}for(var d=h.map((function(t){if(t instanceof S1){var e=a._addStateMachine(t.stateMachine,l,i,n+"/"+t.name);return e.components=new S7(t),e}return null})),p=0;p<h.length;++p){var m=h[p],g=t.getOutgoings(m),y=void 0;if(m instanceof S1){var v=d[p];y=v.exit}else{var S=u[p];y=S}for(var A,T=function(){var t,e=A.value,n=e.to,r=h.findIndex((function(t){return t===e.to}));if(n instanceof S1)t=d[r].entry;else{var s=u[r];t=s instanceof A7?s.entry:s}var o={conditions:e.conditions.map((function(t){return t[C1](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};(c1(e)||e instanceof d1||e instanceof y1)&&(o.duration=e.duration,o.destinationStart=e.destinationStart,o.relativeDestinationStart=e.relativeDestinationStart,e.startEventBinding.isBound&&(o.startEventBinding=e.startEventBinding),e.endEventBinding.isBound&&(o.endEventBinding=e.endEventBinding),c1(e)&&(o.normalizedDuration=e.relativeDuration,o.exitConditionEnabled=e.exitConditionEnabled,o.exitCondition=e.exitCondition)),o.conditions.forEach((function(t,i){var n,r=e.conditions[i];r instanceof q8&&r.trigger&&(null!==(n=o.triggers)&&void 0!==n?n:o.triggers=[]).push(r.trigger)})),y.addTransition(o)},b=f(g);!(A=b()).done;)T()}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){$(14e3,16,"");break}var r=this._matchNextTransition(i);if(!r)break;var s=r.to,o=i;if(i=s,f7(s)){if(s===o)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(g7.UPDATED))if(t.setTickFlag(g7.UPDATED),t.kind===d7.animation)t.update(e.deltaTime,this._controller);else if(t.kind===d7.procedural){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,o=0;if(i.kind===d7.animation)s=null!==(e=i.evaluate(t))&&void 0!==e?e:this._pushNullishPose(t);else if(i.kind===d7.procedural){var a;s=null!==(a=i.evaluate(t))&&void 0!==a?a:this._pushNullishPose(t)}else r-=i.absoluteWeight,s=null;s&&(o=i.absoluteWeight),i.setTickFlag(g7.EVALUATED);for(var h=0;h<n.length;++h){var u=n[h].destination;if(!u.testTickFlag(g7.EVALUATED)){u.setTickFlag(g7.EVALUATED);var l,c=u.absoluteWeight,_=void 0;u.kind===d7.empty?(r-=c,_=null):_=null!==(l=u.evaluate(t))&&void 0!==l?l:this._pushNullishPose(t),_&&(s&&(o+=c)?(L$(s,_,c/o),t.popPose()):s=_)}}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(t.kind===d7.animation||t.kind===d7.procedural){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,d7.any),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 o=s.conditions,a=o.length;if(0===a){if(t.kind===d7.entry||t.kind===d7.exit)return s;if(!s.exitConditionEnabled)continue}if(e.kind===d7.animation&&s.exitConditionEnabled){var h=e.duration*s.exitCondition;if(e.time<h)break}for(var u=!0,l=0;l<a;++l)if(!o[l].eval(this._conditionEvaluationContext)){u=!1;break}if(u)return s}}return null},e._activateTransition=function(t,e){var i=e.to;f7(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 o=n.path[s];this._resetTriggersOnTransition(o)}for(var a=0;a<n.path.length;++a){var h=n.path[a];this._callEnterMethods(h.to)}this._activatedTransitions.length;var u=1===this._activatedTransitions.length?this._currentNode:this._activatedTransitions[this._activatedTransitions.length-2].destination;u instanceof v7&&u.transitionOutEventBinding&&this._emit(u.transitionOutEventBinding),e.startEventBinding&&this._emit(e.startEventBinding),i instanceof v7&&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],o=0===i?this._currentNode:e[i-1].destination;if(s.update(t,o),s.done){this._dropActivatedTransitions(r);break}var a=s.normalizedElapsedTime*n;s.destination.increaseAbsoluteWeight(a),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 o=r.path[r.path.length-1];o.endEventBinding&&this._emit(o.endEventBinding),this._callExitMethods(this._currentNode);for(var a=0;a<=t;++a){var h=e[a];a!==t&&h.destination.decreaseActiveReference();for(var u=a===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 _=t+1;_<e.length;++_)e[_-n]=e[_];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 d7.animation:t.components.callMotionStateEnterMethods(i,t.getStatus());break;case d7.entry:null===(e=t.stateMachine.components)||void 0===e||e.callStateMachineEnterMethods(i)}},e._callExitMethods=function(t){var e,i=this._controller;switch(t.kind){default:break;case d7.animation:t.components.callMotionStateExitMethods(i,t.getStatus());break;case d7.exit:null===(e=t.stateMachine.components)||void 0===e||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 f7(t){return t.kind===d7.animation||t.kind===d7.empty||t.kind===d7.procedural}var d7,p7={next:function(){return{done:!0,value:void 0}}},m7=((h7={})[Symbol.iterator]=function(){return p7},h7);!function(t){t[t.entry=0]="entry",t[t.exit=1]="exit",t[t.any=2]="any",t[t.animation=3]="animation",t[t.empty=4]="empty",t[t.procedural=5]="procedural"}(d7||(d7={}));var g7,y7=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),g7[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}(),v7=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}(y7);!function(t){t[t.UPDATED=1]="UPDATED",t[t.EVALUATED=2]="EVALUATED"}(g7||(g7={}));var S7=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 o=n[s];o[t]!==Q8.prototype[t]&&o[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]!==Q8.prototype[t]&&s[t](e)}},t}(),A7=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,o=e.getVar(s);if(N5(o,s)){!function(t,e,i){if(t!==e)throw new mJ(i,"number")}(o.type,AZ.FLOAT,s),o.bind(this._setSpeedMultiplier,this);var a=o.value;this._setSpeedMultiplier(a)}}var h=null!==(i=null===(n=t.motion)||void 0===n?void 0:n[C1](e,!1))&&void 0!==i?i:null;h&&Object.defineProperty(h,"__DEBUG_ID__",{value:r}),this._source=h,this._publicState=new T7(this,t,null==h?void 0:h.createPort()),this._privateState=new T7(this,t,null==h?void 0:h.createPort()),this.components=new S7(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):m7},e.overrideClips=function(t){var e;null===(e=this._source)||void 0===e||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?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}(),T7=function(t){function e(e,i,n){var r;return(r=t.call(this,i)||this).kind=d7.animation,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)||void 0===e||e.reenter()},i.getStatus=function(){var t=this._statusCache;return t.progress=b7(this._progress),t},i.getClipStatuses=function(t){return this._container.getClipStatuses(t)},i.update=function(t,e){this._progress=function(t,e,i){return 0===e?0:t+i/e}(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?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}(v7);function b7(t){var e=t-Math.trunc(t);return e>=0?e:1+e}var E7,C7=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}(y7),x7=function(t){function e(e){var i;return(i=t.call(this,e)||this).kind=d7.empty,i}return s(e,t),e}(y7),w7=function(t){function e(e,i){var n;(n=t.call(this,e)||this).kind=d7.procedural,n.elapsedTime=0,n.statusCache={progress:0},n._instantiatedPoseGraph=void 0,n._statusCache={progress:0},n._elapsedTime=0;var r=n7(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=b7(this._elapsedTime),this._statusCache},i.countMotionTime=function(){return this._instantiatedPoseGraph.countMotionTime()},e}(v7),D7=function(){function t(){this.sourceStateWeight=0,this._sourceState=void 0}var e=t.prototype;return e.set=function(t){this._sourceState=t,f7(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&&(t.kind===d7.animation||t.kind===d7.procedural)&&t.activeReferenceCount,t.kind){case d7.animation:return t.normalizedTime;case d7.procedural:return t.countMotionTime();default:return 0}}}]),t}(),R7=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(f7(e)){var i=this.getAbsoluteDuration(e);if(i<=0)this.normalizedElapsedTime=1;else{var n=this.normalizedElapsedTime*i,r=i-n,s=Fi((n+Math.min(r,t))/i);this.normalizedElapsedTime=s}}else this.normalizedElapsedTime=1},t.createPool=function(e){return new qs((function(){return new t}),e,void 0)},e.reset=function(t,e){var i=e.to;f7(i),this.normalizedElapsedTime=0,this.destination=i,this.path=[].concat(t,[e]);var n=i.activeReferenceCount;if(i.increaseActiveReference(),0===n)if(i.kind===d7.animation){var r=this.path[0],s=r.destinationStart,o=r.relativeDestinationStart?s:0===i.duration?0:s/i.duration;i.reenter(o)}else i.kind===d7.procedural&&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?(t.kind===d7.animation?t.duration:1)*i:i},n(t,[{key:"done",get:function(){return Li(this.normalizedElapsedTime,1,1e-6)}}]),t}(),I7=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 M7(e),this._groups.push(i)),i.addMember()},e.sync=function(){for(var t,e=f(this._groups);!(t=e()).done;)t.value.sync()},t}(),M7=function(){function t(t){this._lastLeader=void 0,this._records=[],this.name=t}var e=t.prototype;return e.addMember=function(){var t=new P7;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 o=t[s];if(!o.active||!Li(o.weight,r,1e-6))break;if(o===i){n=s;break}}t[n].active,this._lastLeader=t[n];for(var a=t[n].normalizedTime,h=0;h<e;++h){var u=t[h];if(!u.active)break;u.normalizedTime=a,u.reset()}}},t}(),P7=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}();!function(t){t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.UNSETTLED=1]="UNSETTLED",t[t.SETTLED=2]="SETTLED",t[t.UP_TO_DATE=3]="UP_TO_DATE",t[t.OUTDATED=4]="OUTDATED",t[t.UPDATING=5]="UPDATING",t[t.UPDATED=6]="UPDATED",t[t.EVALUATING=7]="EVALUATING",t[t.EVALUATED=8]="EVALUATED"}(E7||(E7={}));var B7,O7,L7,N7,F7,k7,V7=function(){function t(t){this._state=E7.UNINITIALIZED,this._instantiatedPoseGraph=void 0,this._maxRequestedUpdateTime=0,this._evaluationCache=null,this._updateContextGenerator=new z6,this._allocator=t}var e=t.prototype;return e.set=function(t,e){this._state,E7.UNINITIALIZED;var i=n7(t.graph,e);i.bind(e),this._instantiatedPoseGraph=i,this._state=E7.UNSETTLED},e.settle=function(t){this._state===E7.UNSETTLED||(this._state,E7.SETTLED),this._instantiatedPoseGraph,this._instantiatedPoseGraph.settle(t),this._state=E7.SETTLED},e.reset=function(){switch(this._state){case E7.SETTLED:case E7.OUTDATED:break;case E7.UP_TO_DATE:this._state=E7.OUTDATED;break;case E7.UPDATED:case E7.EVALUATED:this._evaluationCache&&(this._allocator.destroyPose(this._evaluationCache),this._evaluationCache=null),this._maxRequestedUpdateTime=0,this._state=E7.UP_TO_DATE;break;case E7.UNINITIALIZED:}},e.reenter=function(){switch(this._state){default:this._state;break;case E7.UP_TO_DATE:case E7.UPDATED:break;case E7.SETTLED:case E7.OUTDATED:this._state=E7.UP_TO_DATE,this._instantiatedPoseGraph,this._instantiatedPoseGraph.reenter()}},e.requestUpdate=function(t){var e=t.deltaTime;if(this._state===E7.OUTDATED||this._state===E7.UP_TO_DATE||this._state===E7.UPDATING||(this._state,E7.UPDATED),this._instantiatedPoseGraph,this._state!==E7.UPDATING){var i=Math.max(0,e-this._maxRequestedUpdateTime);if(this._state!==E7.UPDATED||!Li(i,0,1e-8)){this._state=E7.UPDATING,this._maxRequestedUpdateTime=Math.max(e,this._maxRequestedUpdateTime);var n=this._updateContextGenerator.generate(i,t.indicativeWeight);this._instantiatedPoseGraph.update(n),this._state=E7.UPDATED}}},e.evaluate=function(t){switch(this._state){default:this._state;break;case E7.EVALUATING:this._state=E7.EVALUATED;break;case E7.EVALUATED:break;case E7.UPDATED:var e;this._evaluationCache,this._state=E7.EVALUATING;var i=null===(e=this._instantiatedPoseGraph)||void 0===e?void 0:e.evaluate(t);if(this._state=E7.EVALUATED,i){var n=this._allocator.allocatePose();n.transforms.set(i.transforms),n.auxiliaryCurves.set(i.auxiliaryCurves),this._evaluationCache=n,t.popPose()}this._state=E7.EVALUATED}return this._state,E7.EVALUATED,this._instantiatedPoseGraph,this._evaluationCache?t.pushDuplicatedPose(this._evaluationCache):null},t}(),G7=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 V7(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}(),U7=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 z7(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],o=s.stateMachineEvaluation.evaluate(t),a=s.weight*s.stateMachineEvaluation.passthroughWeight,h=s.transformFilter;s.additive?G$(e,o,a,h):L$(e,o,a,h),t.popPose(),s.postEvaluate()}return e},n(e,[{key:"layerCount",get:function(){return this._layerRecords.length}}]),e}(Q$),z7=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 G7(i),o=f(t.stashes());!(r=o()).done;){var a=r.value,h=a[0];a[1],s.addStash(h)}this._stashManager=s;var u=new I7;this._motionSyncManager=u,e._setLayerWideContextProperties(s,u);for(var l,c=f(t.stashes());!(l=c()).done;){var _=l.value,d=_[0],p=_[1];s.setStash(d,p,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 _7(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}(),H7=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 C6,this._poseLayoutMaintainer=void 0,this._bindingContext=void 0,this._settleContext=void 0,this._rootUpdateContextGenerator=new z6;for(var r,s=f(t.variables);!(r=s()).done;){var o=r.value,a=o[0],h=o[1][XZ]();this._varInstances[a]=h,h instanceof uJ&&h.resetMode===jZ.NEXT_FRAME_OR_AFTER_CONSUMED&&(this._hasAutoTrigger=!0)}var u=new x6(e,this._auxiliaryCurveRegistry);this._poseLayoutMaintainer=u;var l=new b6(e,u,this._varInstances,i);l._setClipOverrides(null!=n?n:void 0),this._bindingContext=l;var c=new N6(u);this._settleContext=c,u.startBind();var _=new H6;this._poseStashAllocator=_,this._rootPoseNode=new U7(t,l,_),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 o=r.evaluate(e,z$.LOCAL);if(this._hasAutoTrigger){var a=this._varInstances;for(var h in a){var u=a[h];u instanceof uJ&&u.resetMode===jZ.NEXT_FRAME_OR_AFTER_CONSUMED&&(u.value=!1)}}i.apply(o),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[L6]),t.resetPoseStashAllocator(this._poseStashAllocator)},e._updateAfterPossiblePoseLayoutChange=function(){var t=this._poseLayoutMaintainer,e=t.endBind();if(0!==e){(e&T6.TRANSFORM_COUNT||e&T6.TRANSFORM_ORDER)&&this._createOrUpdateTransformFilters();var i=!1;if(e&T6.TRANSFORM_COUNT||e&T6.AUXILIARY_CURVE_COUNT){var n=t.createEvaluationContext();this._evaluationContext.destroy(),this._evaluationContext=n,i=!0,t.resetPoseStashAllocator(this._poseStashAllocator)}(i||e&T6.TRANSFORM_COUNT||e&T6.TRANSFORM_ORDER)&&t.fetchDefaultTransforms(this._evaluationContext[L6])}},e._createOrUpdateTransformFilters=function(){this._rootPoseNode.settle(this._settleContext)},n(t,[{key:"layerCount",get:function(){return this._rootPoseNode.layerCount}}]),t}(),W7=eh,j7=Ma,X7=Pa,Y7=(B7=Ta("cc.animation.AnimationController"),O7=W7(YJ),L7=X7("graph"),B7((m((F7=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=k7&&k7(),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 j4){if(!t.original)return;e=t.original,i=t.clipOverrides}else e=t;var n=new H7(e,this.node,this,i);this._graphEval=n}},i.onDestroy=function(){var t;null===(t=this._graphEval)||void 0===t||t.destroy()},i.update=function(t){var e;null===(e=this._graphEval)||void 0===e||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?void 0:e.layerCount)&&void 0!==t?t:0}}]),e}(Lp)).prototype,"graph",[O7],Object.getOwnPropertyDescriptor(F7.prototype,"graph"),F7.prototype),k7=fa(F7.prototype,"_graph",[j7,L7],(function(){return null})),N7=F7))||N7);t("ar",Object.freeze({__proto__:null,UniformProxyFactory:QQ,MorphWeightValueProxy:ZQ,MorphWeightsValueProxy:JQ,MorphWeightsAllValueProxy:$Q,Track:xQ,TrackPath:AQ,RealTrack:cZ,VectorTrack:bZ,QuatTrack:wZ,ColorTrack:IZ,SizeTrack:BZ,ObjectTrack:LZ,isPropertyPath:JK,isCustomPath:function(t,e){return t instanceof e},HierarchyPath:mQ,ComponentPath:gQ,CubicSplineVec2Value:oZ,CubicSplineVec3Value:aZ,CubicSplineVec4Value:hZ,CubicSplineQuatValue:uZ,CubicSplineNumberValue:lZ,AnimationController:Y7,get VariableType(){return AZ},StateMachineComponent:Q8}));var q7,K7=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 Q7(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}(),Q7=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}();!function(t){t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.EULER_ANGLES=8]="EULER_ANGLES"}(q7||(q7={})),q7.POSITION,q7.ROTATION,q7.SCALE,q7.EULER_ANGLES;var Z7,J7,$7=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new mn}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=function(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var o=r/s;mn.lerp(t,t,n,o)}}else mn.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,mn.zero(this.result)},t}(),t9=function(){function t(){this.refCount=0,this.accumulatedWeight=0,this.result=new In}var e=t.prototype;return e.blend=function(t,e){this.accumulatedWeight=function(t,e,i,n,r){var s=i+r;if(1!==r||i){if(s){var o=r/s;In.slerp(t,e,n,o)}}else In.copy(t,n);return s}(this.result,this.result,this.accumulatedWeight,t,e)},e.reset=function(){this.accumulatedWeight=0,In.identity(this.result)},t}(),e9=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,o=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=q7.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=q7.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),o&&o.accumulatedWeight&&(this._transformApplyFlags|=q7.EULER_ANGLES,o.accumulatedWeight<1&&o.blend(e.eulerAngles,1-o.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=q7.ROTATION,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==o||o.reset()},i._createVec3BlendState=function(){return new $7},i._createQuatBlendState=function(){return new t9},e}(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,o=s.position,a=s.scale,h=s.rotation,u=s.eulerAngles;r&&(o&&r&q7.POSITION&&(e=o.result),a&&r&q7.SCALE&&(i=a.result),u&&r&q7.EULER_ANGLES&&(n=u.result),h&&r&q7.ROTATION&&(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}()),i9=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.createNodeBlendState=function(){return new e9},e}(K7),n9=t("aA",Ta(((J7=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 le([]),e._crossFades=new le([]),e._delayEvents=[],e._blendStateBuffer=new i9,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):et(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,o=s.array;for(s.i=0;s.i<o.length;++s.i){var a=o[s.i];a.isMotionless||a.update(t)}this._blendStateBuffer.apply();for(var h=FI.getTotalFrames(),u=0,l=n.length;u<l;u++){var c=n[u],_=c.target,f=c.transform;_.matrix=iY(f,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):et(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),o=n.target&&s&&nY(s,t);o&&i._sockets.push({target:n.target,transform:o})},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){rY(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}(Jl)).ID="animation",Z7=J7))||Z7);FI.on(LI.EVENT_INIT,(function(){var t=new n9;FI.registerSystem(n9.ID,t,Jl.Priority.HIGH)})),v.AnimationManager=n9;var r9,s9,o9,a9,h9,u9,l9,c9,_9,f9,d9,p9,m9,g9,y9=function(t){function e(e){var i;return(i=t.call(this)||this)._managedStates=[],i._fadings=[],i._scheduled=!1,i._scheduler=null!=e?e:FK(),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)&&void 0!==i&&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,o=i.length,a=0;a<i.length;++a){var h=i[a];h.easeTime+=t;var u=0===h.easeDuration?1:Fi(h.easeTime/h.easeDuration),l=u*s;if(s*=1-u,h.target.state&&(h.target.state.weight+=l),h.easeTime>=h.easeDuration){o=a+1,h.easeTime=h.easeDuration;break}}if(o!==i.length){for(var c=o;c<i.length;++c){var _=i[c];--_.target.reference,_.target.reference<=0&&(_.target.state&&_.target.state.stop(),fe(this._managedStates,_.target))}i.splice(o)}},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}(BK),v9=t("au",(r9=Ta("cc.Animation"),s9=Ea(99),o9=eh([v3]),a9=eh(v3),h9=eh([v3]),r9(u9=s9(((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).playOnLoad=c9&&c9(),e._crossFade=new y9,e._nameToState=Ot(!0),e._clips=_9&&_9(),e._defaultClip=f9&&f9(),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=Ot(!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 me(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 $(3902);this._defaultClip=null}if(i&&i.isPlaying){if(!e)return void $(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 e===OK.LASTFRAME&&this._syncAllowLastFrameEvent(),s},i.once=function(e,i,n){var r=t.prototype.once.call(this,e,i,n);return e===OK.LASTFRAME&&this._syncAllowLastFrameEvent(),r},i.off=function(e,i,n){t.prototype.off.call(this,e,i,n),e===OK.LASTFRAME&&this._syncDisallowLastFrameEvent()},i._createState=function(t,e){return new UK(t,e)},i._doCreateState=function(t,e){var i=this._createState(t,e);return i._setEventTarget(this),i.allowLastFrameEvent(this.hasEventListener(OK.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];S9(t,i.clip)&&(i.stop(),delete this._nameToState[e])}},i._syncAllowLastFrameEvent=function(){if(this.hasEventListener(OK.LASTFRAME))for(var t in this._nameToState)this._nameToState[t].allowLastFrameEvent(!0)},i._syncDisallowLastFrameEvent=function(){if(!this.hasEventListener(OK.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();for(var i,n=f(this._clips);!(i=n()).done;){var r=i.value;r&&this._removeStateOfAutomaticClip(r)}for(var s,o=f(t);!(s=o()).done;){var a=s.value;a&&this.createState(a)}var h=t.find((function(t){return S9(t,e._defaultClip)}));this._defaultClip=h||null,this._clips=t}},{key:"defaultClip",get:function(){return this._defaultClip},set:function(t){this._defaultClip=t,t&&(this._clips.findIndex((function(e){return S9(e,t)}))>=0||(this._clips.push(t),this.createState(t)))}}]),e}(uo(Lp))).EventType=OK,m((l9=d9).prototype,"clips",[o9],Object.getOwnPropertyDescriptor(l9.prototype,"clips"),l9.prototype),m(l9.prototype,"defaultClip",[a9],Object.getOwnPropertyDescriptor(l9.prototype,"defaultClip"),l9.prototype),c9=fa(l9.prototype,"playOnLoad",[Ma],(function(){return!1})),_9=fa(l9.prototype,"_clips",[h9],(function(){return[]})),f9=fa(l9.prototype,"_defaultClip",[Ma],(function(){return null})),u9=l9))||u9)||u9));function S9(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}v.Animation=v9,v.AnimationComponent=v9,ie(v9,"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"}(p9||(p9={})),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"}(m9||(m9={})),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"}(g9||(g9={})),t("aF",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}());var A9,T9=0;function b9(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()),function(t){for(var e=t._operationQueue.length,i=t._operationQueue.slice(),n=[],r=!1,s=e-1;s>=0;s--){var o=i[s];if("stop"===o.op){n.push(o);break}if("seek"===o.op)r||(n.push(o),r=!0);else{if(r){n.push(o);break}0===n.length&&n.push(o)}}t._operationQueue=n.reverse()}(t);var i=t._operationQueue[0];i&&b9(t,i)})).catch((function(){})))}function E9(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=T9++,o=t;o._operationQueue.push({op:e,id:s,func:n,args:r,invoking:!1}),o._eventTarget.once(s.toString(),i),b9(o,o._operationQueue[0])}))}}var C9,x9,w9,D9,R9=function(){function t(t,e){var i=this;this._innerAudioContext=void 0,this._onPlayCb=void 0,this._onEndCb=void 0,this._innerAudioContext=t,t.volume=e,t.onPlay((function(){var t;null===(t=i._onPlayCb)||void 0===t||t.call(i)}));var n=function(){var e;i._innerAudioContext&&(i._innerAudioContext=null,So.off("hide",i._onInterruptedBegin,i),So.off("show",i._onInterruptedEnd,i),null===(e=i._onEndCb)||void 0===e||e.call(i),t.destroy())};t.onEnded(n),t.onStop(n),So.on("hide",this._onInterruptedBegin,this),So.on("show",this._onInterruptedEnd,this)}var e=t.prototype;return e._onInterruptedBegin=function(){this._innerAudioContext.pause()},e._onInterruptedEnd=function(){this._innerAudioContext.play()},e.play=function(){this._innerAudioContext.play()},e.stop=function(){this._innerAudioContext.stop()},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}(),I9=(m((A9=function(){var t=e.prototype;function e(t){var e=this;this._innerAudioContext=void 0,this._state=g9.INIT,this._cacheTime=0,this._needSeek=!1,this._seeking=!1,this._onPlay=void 0,this._onPause=void 0,this._onStop=void 0,this._onSeeked=void 0,this._onEnded=void 0,this._readyToHandleOnShow=!1,this._eventTarget=new lo,this._operationQueue=[],this._innerAudioContext=t,this._eventTarget=new lo,So.on("hide",this._onInterruptedBegin,this),So.on("show",this._onInterruptedEnd,this);var i=this._eventTarget;this._onPlay=function(){e._state=g9.PLAYING,i.emit(p9.PLAYED),e._needSeek&&e.seek(e._cacheTime).catch((function(){}))},t.onPlay(this._onPlay),this._onPause=function(){e._state=g9.PAUSED;try{var t=e._innerAudioContext.currentTime;null!=t&&(e._cacheTime=t)}catch(t){}i.emit(p9.PAUSED)},t.onPause(this._onPause),this._onStop=function(){e._state=g9.STOPPED,e._resetSeekCache(),i.emit(p9.STOPPED),0!==(e._innerAudioContext?e._innerAudioContext.currentTime:0)&&e._innerAudioContext.seek(0)},t.onStop(this._onStop),this._onSeeked=function(){i.emit(p9.SEEKED),e._seeking=!1,e._needSeek&&(e._needSeek=!1,e._cacheTime.toFixed(2)!==e._innerAudioContext.currentTime.toFixed(2)&&e.seek(e._cacheTime).catch((function(){})))},t.onSeeked(this._onSeeked),this._onEnded=function(){e._state=g9.INIT,e._resetSeekCache(),i.emit(p9.ENDED)},t.onEnded(this._onEnded)}return t._resetSeekCache=function(){this._cacheTime=0,this._needSeek=!1,this._seeking=!1},t.destroy=function(){var t=this;So.off("hide",this._onInterruptedBegin,this),So.off("show",this._onInterruptedEnd,this),this._innerAudioContext&&(["Play","Pause","Stop","Seeked","Ended"].forEach((function(e){t._offEvent(e)})),this._innerAudioContext.stop(),this._innerAudioContext.destroy(),this._innerAudioContext=null,this._state=g9.INIT)},t._onInterruptedBegin=function(){var t=this;this._state===g9.PLAYING&&this.pause().then((function(){t._state=g9.INTERRUPTED,t._readyToHandleOnShow=!0,t._eventTarget.emit(p9.INTERRUPTION_BEGIN)})).catch((function(){}))},t._onInterruptedEnd=function(){var t=this;this._readyToHandleOnShow?(this._state===g9.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(p9.INTERRUPTION_END)})).catch((function(){})),this._readyToHandleOnShow=!1):this._eventTarget.once(p9.INTERRUPTION_END,this._onInterruptedEnd,this)},t._offEvent=function(t){this["_on"+t]&&(this._innerAudioContext["off"+t](this["_on"+t]),this["_on"+t]=null)},e.load=function(t){return new Promise((function(i,n){e.loadNative(t).then((function(t){i(new e(t))})).catch(n)}))},e.loadNative=function(t){return new Promise((function(e,i){var n=Bs.createInnerAudioContext(),r=setTimeout((function(){s(),e(n)}),8e3);function s(){n.offCanplay(o),n.offError(a)}function o(){s(),clearTimeout(r),e(n)}function a(t){s(),clearTimeout(r),console.error("failed to load innerAudioContext"),i(new Error(t))}n.onCanplay(o),n.onError(a),n.src=t}))},e.loadOneShotAudio=function(t,i){return new Promise((function(n,r){e.loadNative(t).then((function(t){n(new R9(t,i))})).catch(r)}))},t.getPCMData=function(){},t.seek=function(t){var e=this;return new Promise((function(i){e._state!==g9.PLAYING||e._seeking?(e._cacheTime!==t&&(e._cacheTime=t,e._needSeek=!0),i()):(t=Ni(t,0,e.duration),e._seeking=!0,e._cacheTime=t,e._eventTarget.once(p9.SEEKED,i),e._innerAudioContext.seek(t))}))},t.play=function(){var t=this;return new Promise((function(e){t._eventTarget.once(p9.PLAYED,e),t._innerAudioContext.play()}))},t.pause=function(){var t=this;return new Promise((function(e){t.state!==g9.PLAYING?e():(t._eventTarget.once(p9.PAUSED,e),t._innerAudioContext.pause())}))},t.stop=function(){var t=this;return new Promise((function(e){if(g9.INIT===t._state)return t._resetSeekCache(),void e();t._eventTarget.once(p9.STOPPED,e),t._innerAudioContext.stop()}))},t.onInterruptionBegin=function(t){this._eventTarget.on(p9.INTERRUPTION_BEGIN,t)},t.offInterruptionBegin=function(t){this._eventTarget.off(p9.INTERRUPTION_BEGIN,t)},t.onInterruptionEnd=function(t){this._eventTarget.on(p9.INTERRUPTION_END,t)},t.offInterruptionEnd=function(t){this._eventTarget.off(p9.INTERRUPTION_END,t)},t.onEnded=function(t){this._eventTarget.on(p9.ENDED,t)},t.offEnded=function(t){this._eventTarget.off(p9.ENDED,t)},n(e,[{key:"src",get:function(){return this._innerAudioContext?this._innerAudioContext.src:""}},{key:"type",get:function(){return m9.MINIGAME_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._innerAudioContext.loop},set:function(t){this._innerAudioContext.loop=t}},{key:"volume",get:function(){return this._innerAudioContext.volume},set:function(t){t=Fi(t),this._innerAudioContext.volume=t}},{key:"duration",get:function(){return this._innerAudioContext.duration}},{key:"currentTime",get:function(){return this._state!==g9.PLAYING||this._needSeek||this._seeking?this._cacheTime:this._innerAudioContext.currentTime}},{key:"sampleRate",get:function(){return 0}}]),e}()).prototype,"seek",[E9],Object.getOwnPropertyDescriptor(A9.prototype,"seek"),A9.prototype),m(A9.prototype,"play",[E9],Object.getOwnPropertyDescriptor(A9.prototype,"play"),A9.prototype),m(A9.prototype,"pause",[E9],Object.getOwnPropertyDescriptor(A9.prototype,"pause"),A9.prototype),m(A9.prototype,"stop",[E9],Object.getOwnPropertyDescriptor(A9.prototype,"stop"),A9.prototype),A9),M9=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}(),P9=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e){return new Promise((function(i,n){I9.load(e).then((function(e){i(new t(e))})).catch(n)}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t){return I9.loadNative(t)},t.loadOneShotAudio=function(t,e){return new Promise((function(i,n){I9.loadOneShotAudio(t,e).then((function(t){i(new M9(t))})).catch(n)}))},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}();P9.maxAudioChannel=10,v.AudioPlayer=P9;var B9=t("aE",Ta("cc.AudioClip")(((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)._duration=w9&&w9(),e._loadMode=m9.UNKNOWN_AUDIO,e._meta=null,e._player=null,e}s(e,t);var i=e.prototype;return i.destroy=function(){var e,i=t.prototype.destroy.call(this);return null===(e=this._player)||void 0===e||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)||void 0===e||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)||void 0===t||t.play().catch((function(){}))},i.pause=function(){var t;null===(t=this._player)||void 0===t||t.pause().catch((function(){}))},i.stop=function(){var t;null===(t=this._player)||void 0===t||t.stop().catch((function(){}))},i.playOneShot=function(t){void 0===t&&(t=1),this._nativeAsset&&P9.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=m9.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:g9.INIT}}]),e}(Fd)).AudioType=m9,w9=fa((x9=D9).prototype,"_duration",[Ma],(function(){return 0})),m(x9.prototype,"_nativeDep",[_h],Object.getOwnPropertyDescriptor(x9.prototype,"_nativeDep"),x9.prototype),C9=x9))||C9);function O9(t,e,i){P9.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 L9(t,e,i,n){var r=new B9;r._nativeUrl=t,r._nativeAsset=e,r.duration=e.duration,n(null,r)}v.AudioClip=B9,oA.register({".mp3":O9,".ogg":O9,".wav":O9,".m4a":O9}),yA.register({".mp3":L9,".ogg":L9,".wav":L9,".m4a":L9});var N9,F9,k9,V9,G9,U9,z9,H9,W9,j9,X9,Y9,q9=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);return i>-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){t instanceof P9?this._tryAddPlaying(this._audioPlayerInfoList,t):this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(_e(t,i),!0)},e.removePlaying=function(t){t instanceof P9?this._tryRemovePlaying(this._audioPlayerInfoList,t):this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length<P9.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}()),K9="audiosource-loaded";!function(t){t.STARTED="started",t.ENDED="ended"}(X9||(X9={})),function(t){t.PLAY="play",t.STOP="stop",t.PAUSE="pause",t.SEEK="seek"}(Y9||(Y9={}));var Q9=t("aD",(N9=Ta("cc.AudioSource"),F9=eh(B9),k9=eh(B9),N9(((j9=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=U9&&U9(),e._player=null,e._hasRegisterListener=!1,e._loop=z9&&z9(),e._playOnAwake=H9&&H9(),e._volume=W9&&W9(),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&&(q9.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,P9.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)||void 0===n||n.emit(K9)):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;q9.removePlaying(e),null===(i=t.node)||void 0===i||i.emit(X9.ENDED,t)})),e.onInterruptionBegin((function(){q9.removePlaying(e)})),e.onInterruptionEnd((function(){t._player===e&&q9.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 U("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)||void 0===n||n.once(K9,(function(){var n;i(null===(n=e._player)||void 0===n?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)||void 0===i||i.once(K9,(function(){e(t._player.sampleRate)}))}))},i._getRootNode=function(){for(var t,e,i=this.node,n=null===(t=i)||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.parent;n;){var r,s,o;n=null===(s=i=null===(r=i)||void 0===r?void 0:r.parent)||void 0===s||null===(o=s.parent)||void 0===o?void 0:o.parent}return i},i.play=function(){var t=this;if(this._isLoaded||!this.clip){var e;this._registerListener(),q9.discardOnePlayingIfNeeded(),this.state===g9.PLAYING&&(null===(e=this._player)||void 0===e||e.stop().catch((function(){})));var i=this._player;i&&(i.play().then((function(){var e;null===(e=t.node)||void 0===e||e.emit(X9.STARTED,t)})).catch((function(){q9.removePlaying(i)})),q9.addPlaying(i))}else this._operationsBeforeLoading.push({op:Y9.PLAY,params:null})},i.pause=function(){var t;this._isLoaded||!this.clip?null===(t=this._player)||void 0===t||t.pause().catch((function(){})):this._operationsBeforeLoading.push({op:Y9.PAUSE,params:null})},i.stop=function(){this._isLoaded||!this.clip?this._player&&(this._player.stop().catch((function(){})),q9.removePlaying(this._player)):this._operationsBeforeLoading.push({op:Y9.STOP,params:null})},i.playOneShot=function(t,e){var i;void 0===e&&(e=1),t._nativeAsset?P9.loadOneShotAudio(t._nativeAsset.url,this._volume*e,{audioLoadMode:t.loadMode}).then((function(t){i=t,q9.discardOnePlayingIfNeeded(),t.onEnd=function(){q9.removePlaying(t)},t.play(),q9.addPlaying(t)})).catch((function(){i&&q9.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;e.op===Y9.SEEK?(t._cachedCurrentTime=e.params&&e.params[0],t._player&&t._player.seek(t._cachedCurrentTime).catch((function(){}))):null===(i=t[e.op])||void 0===i||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)?U("illegal audio volume!"):(t=Ni(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)?U("illegal audio time!"):(t=Ni(t,0,this.duration),this._isLoaded||!this.clip?(this._cachedCurrentTime=t,null===(e=this._player)||void 0===e||e.seek(this._cachedCurrentTime).catch((function(){}))):this._operationsBeforeLoading.push({op:Y9.SEEK,params:[t]}))}},{key:"duration",get:function(){var t,e;return null!==(t=null===(e=this._clip)||void 0===e?void 0:e.getDuration())&&void 0!==t?t:this._player?this._player.duration:0}},{key:"state",get:function(){return this._player?this._player.state:g9.INIT}},{key:"playing",get:function(){return this.state===e.AudioState.PLAYING}}],[{key:"maxAudioChannel",get:function(){return P9.maxAudioChannel}}]),e}(Lp)).AudioState=g9,j9.EventType=X9,U9=fa((G9=j9).prototype,"_clip",[F9],(function(){return null})),z9=fa(G9.prototype,"_loop",[Ma],(function(){return!1})),H9=fa(G9.prototype,"_playOnAwake",[Ma],(function(){return!0})),W9=fa(G9.prototype,"_volume",[Ma],(function(){return 1})),m(G9.prototype,"clip",[k9],Object.getOwnPropertyDescriptor(G9.prototype,"clip"),G9.prototype),V9=G9))||V9));ht(B9,"AudioClip",[{name:"PlayingState",newName:"AudioState",target:Q9,targetName:"AudioSource"}]),lt(B9.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"}}))),v.AudioSourceComponent=Q9,ie(Q9,"cc.AudioSourceComponent"),v.log=G,v.warn=U,v.error=z,v.assert=H,v._throw=X,v.logID=K,v.warnID=$,v.errorID=et,v.assertID=rt,v.debug=ft,v.path={join:Eo,extname:Co,mainFileName:xo,basename:wo,dirname:Do,changeExtname:Ro,changeBasename:Io,_normalize:Mo,stripSep:Po,get sep(){return Bo()}};var Z9,J9,$9=t("ej",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}());v.NodePool=$9;var ttt,ett=null!==(Z9=globalThis.jsb)&&void 0!==Z9?Z9:{};function itt(t,e){t.s(e.name),t.n(e.type),t.n(e.count)}function ntt(t,e){e.name=t.s(),e.type=t.n(),e.count=t.n()}function rtt(t,e){t.n(e.set),t.n(e.binding),t.s(e.name),t.n(e.members.length);for(var i,n=f(e.members);!(i=n()).done;)itt(t,i.value);t.n(e.count)}function stt(t,e){var i;e.set=t.n(),e.binding=t.n(),e.name=t.s(),i=t.n(),e.members.length=i;for(var n=0;n!==i;++n){var r=new P_;ntt(t,r),e.members[n]=r}e.count=t.n()}function ott(t,e){e.binding=t.n(),e.descriptorType=t.n(),e.count=t.n(),e.stageFlags=t.n()}t("eB",{DownloaderHints:ett.DownloaderHints,Downloader:ett.Downloader,zipUtils:ett.zipUtils,fileUtils:ett.fileUtils,DebugRenderer:ett.DebugRenderer,copyTextToClipboard:null===(J9=ett.copyTextToClipboard)||void 0===J9?void 0:J9.bind(ett),garbageCollect:ett.garbageCollect,reflection:ett.reflection,bridge:ett.bridge,jsbBridgeWrapper:ett.jsbBridgeWrapper,AssetsManager:ett.AssetsManager,EventAssetsManager:ett.EventAssetsManager,Manifest:ett.Manifest,saveImageData:ett.saveImageData,process:ett.process,adpf:ett.adpf}),v.renderer=RN,function(t){t[t.PER_INSTANCE=0]="PER_INSTANCE",t[t.PER_BATCH=1]="PER_BATCH",t[t.PER_PHASE=2]="PER_PHASE",t[t.PER_PASS=3]="PER_PASS",t[t.COUNT=4]="COUNT"}(ttt||(ttt={}));var att,htt,utt,ltt,ctt,_tt={CONSTANTS:0,CBV:1,UAV:2,SRV:3,TABLE:4,SSV:5};!function(t){t[t.MANAGED=0]="MANAGED",t[t.MEMORYLESS=1]="MEMORYLESS",t[t.PERSISTENT=2]="PERSISTENT",t[t.EXTERNAL=3]="EXTERNAL",t[t.BACKBUFFER=4]="BACKBUFFER"}(att||(att={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=3]="BLEND",t[t.RENDER_OPAQUE=1]="RENDER_OPAQUE",t[t.RENDER_CUTOUT=2]="RENDER_CUTOUT",t[t.RENDER_TRANSPARENT=3]="RENDER_TRANSPARENT"}(htt||(htt={})),function(t){t[t.BUFFER=0]="BUFFER",t[t.TEXTURE1D=1]="TEXTURE1D",t[t.TEXTURE2D=2]="TEXTURE2D",t[t.TEXTURE3D=3]="TEXTURE3D"}(utt||(utt={})),function(t){t[t.NONE=0]="NONE",t[t.UNIFORM=1]="UNIFORM",t[t.INDIRECT=2]="INDIRECT",t[t.STORAGE=4]="STORAGE",t[t.SAMPLED=8]="SAMPLED",t[t.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",t[t.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT",t[t.SHADING_RATE=128]="SHADING_RATE",t[t.TRANSFER_SRC=256]="TRANSFER_SRC",t[t.TRANSFER_DST=512]="TRANSFER_DST"}(ltt||(ltt={})),function(t){t[t.NONE=0]="NONE",t[t.OPAQUE=1]="OPAQUE",t[t.MASK=2]="MASK",t[t.BLEND=4]="BLEND",t[t.OPAQUE_OBJECT=1]="OPAQUE_OBJECT",t[t.CUTOUT_OBJECT=2]="CUTOUT_OBJECT",t[t.TRANSPARENT_OBJECT=4]="TRANSPARENT_OBJECT",t[t.SHADOW_CASTER=8]="SHADOW_CASTER",t[t.UI=16]="UI",t[t.DEFAULT_LIGHTING=32]="DEFAULT_LIGHTING",t[t.VOLUMETRIC_LIGHTING=64]="VOLUMETRIC_LIGHTING",t[t.CLUSTERED_LIGHTING=128]="CLUSTERED_LIGHTING",t[t.PLANAR_SHADOW=256]="PLANAR_SHADOW",t[t.GEOMETRY=512]="GEOMETRY",t[t.PROFILER=1024]="PROFILER",t[t.DRAW_INSTANCING=2048]="DRAW_INSTANCING",t[t.DRAW_NON_INSTANCING=4096]="DRAW_NON_INSTANCING",t[t.REFLECTION_PROBE=8192]="REFLECTION_PROBE",t[t.GPU_DRIVEN=16384]="GPU_DRIVEN",t[t.NON_BUILTIN=32768]="NON_BUILTIN",t[t.ALL=4294967295]="ALL"}(ctt||(ctt={}));var ftt,dtt={NONE:0,DEFAULT:1,CLUSTERED:2},ptt={RENDER_TARGET:0,DEPTH_STENCIL:1,SHADING_RATE:2};!function(t){t[t.READ=0]="READ",t[t.READ_WRITE=1]="READ_WRITE",t[t.WRITE=2]="WRITE"}(ftt||(ftt={}));var mtt={NONE:0,FLOAT_TYPE:1,INT_TYPE:2},gtt=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=null),this.light=t,this.probe=n,this.level=e,this.culledByLight=i}return t.prototype.reset=function(t,e,i,n){this.light=t,this.probe=n,this.level=e,this.culledByLight=i},t}(),ytt={UNIFORM_BUFFER:0,DYNAMIC_UNIFORM_BUFFER:1,SAMPLER_TEXTURE:2,SAMPLER:3,TEXTURE:4,STORAGE_BUFFER:5,DYNAMIC_STORAGE_BUFFER:6,STORAGE_IMAGE:7,INPUT_ATTACHMENT:8},vtt=function(){function t(t){void 0===t&&(t=bc.UNKNOWN),this.count=1,this.type=t}return t.prototype.reset=function(t){this.type=t,this.count=1},t}(),Stt=function(){function t(){this.descriptors=new Map,this.uniformBlocks=new Map,this.capacity=0,this.count=0}return t.prototype.reset=function(){this.descriptors.clear(),this.uniformBlocks.clear(),this.capacity=0,this.count=0},t}(),Att=function(){function t(){this.descriptorNames=[],this.uniformBlockNames=[],this.descriptors=[],this.uniformBlocks=[],this.capacity=0,this.count=0}return t.prototype.reset=function(){this.descriptorNames.length=0,this.uniformBlockNames.length=0,this.descriptors.length=0,this.uniformBlocks.length=0,this.capacity=0,this.count=0},t}(),Ttt=function(t,e,i,n){void 0===t&&(t=ttt.PER_INSTANCE),void 0===e&&(e=_tt.CONSTANTS),void 0===i&&(i=ytt.UNIFORM_BUFFER),void 0===n&&(n=Uc.NONE),this.updateFrequency=t,this.parameterType=e,this.descriptorType=i,this.visibility=n},btt={NONE:0,COLOR:1,DEPTH:2,STENCIL:4},Ett=function(){function t(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=btt.NONE),void 0===n&&(n=jc.SAMPLE_ZERO),void 0===r&&(r=jc.SAMPLE_ZERO),this.source=t,this.target=e,this.resolveFlags=i,this.mode=n,this.mode1=r}return t.prototype.reset=function(t,e,i,n,r){this.source=t,this.target=e,this.resolveFlags=i,this.mode=n,this.mode1=r},t}(),Ctt=function(){function t(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0),this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.sourceMostDetailedMip=r,this.sourceFirstSlice=s,this.sourcePlaneSlice=o,this.targetMostDetailedMip=a,this.targetFirstSlice=h,this.targetPlaneSlice=u}return t.prototype.reset=function(t,e,i,n,r,s,o,a,h,u){this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.sourceMostDetailedMip=r,this.sourceFirstSlice=s,this.sourcePlaneSlice=o,this.targetMostDetailedMip=a,this.targetFirstSlice=h,this.targetPlaneSlice=u},t}(),xtt=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=new Uint8Array(0)),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=o}return t.prototype.reset=function(t,e,i,n,r,s){this.target=t,this.mipLevels=e,this.numSlices=i,this.targetMostDetailedMip=n,this.targetFirstSlice=r,this.targetPlaneSlice=s},t}(),wtt=function(){function t(t,e,i,n,r,s,o){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=o}return t.prototype.reset=function(t,e,i,n,r,s,o){this.source=t,this.target=e,this.mipLevels=i,this.numSlices=n,this.targetMostDetailedMip=r,this.targetFirstSlice=s,this.targetPlaneSlice=o},t}(),Dtt=function(){function t(){this.numRenderPasses=0,this.numManagedTextures=0,this.totalManagedTextures=0,this.numUploadBuffers=0,this.numUploadBufferViews=0,this.numFreeUploadBuffers=0,this.numFreeUploadBufferViews=0,this.numDescriptorSets=0,this.numFreeDescriptorSets=0,this.numInstancingBuffers=0,this.numInstancingUniformBlocks=0}return t.prototype.reset=function(){this.numRenderPasses=0,this.numManagedTextures=0,this.totalManagedTextures=0,this.numUploadBuffers=0,this.numUploadBufferViews=0,this.numFreeUploadBuffers=0,this.numFreeUploadBufferViews=0,this.numDescriptorSets=0,this.numFreeDescriptorSets=0,this.numInstancingBuffers=0,this.numInstancingUniformBlocks=0},t}();function Rtt(t){return new Ks((function(){return new t}),16)}var Itt,Mtt,Ptt,Btt=function(){function t(){this.li=Rtt(gtt),this.d=Rtt(vtt),this.db=Rtt(Stt),this.dbf=Rtt(Att),this.dbi=Rtt(Ttt),this.rp=Rtt(Ett),this.cp=Rtt(Ctt),this.up=Rtt(xtt),this.mp=Rtt(wtt),this.ps=Rtt(Dtt)}var e=t.prototype;return e.reset=function(){this.li.reset(),this.d.reset(),this.db.reset(),this.dbf.reset(),this.dbi.reset(),this.rp.reset(),this.cp.reset(),this.up.reset(),this.mp.reset(),this.ps.reset()},e.createLightInfo=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=null);var r=this.li.add();return r.reset(t,e,i,n),r},e.createDescriptor=function(t){void 0===t&&(t=bc.UNKNOWN);var e=this.d.add();return e.reset(t),e},e.createDescriptorBlock=function(){var t=this.db.add();return t.reset(),t},e.createDescriptorBlockFlattened=function(){var t=this.dbf.add();return t.reset(),t},e.createDescriptorBlockIndex=function(t,e,i,n){void 0===t&&(t=ttt.PER_INSTANCE),void 0===e&&(e=_tt.CONSTANTS),void 0===i&&(i=ytt.UNIFORM_BUFFER),void 0===n&&(n=Uc.NONE);var r=this.dbi.add();return r.updateFrequency=t,r.parameterType=e,r.descriptorType=i,r.visibility=n,r},e.createResolvePair=function(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=btt.NONE),void 0===n&&(n=jc.SAMPLE_ZERO),void 0===r&&(r=jc.SAMPLE_ZERO);var s=this.rp.add();return s.reset(t,e,i,n,r),s},e.createCopyPair=function(t,e,i,n,r,s,o,a,h,u){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),void 0===u&&(u=0);var l=this.cp.add();return l.reset(t,e,i,n,r,s,o,a,h,u),l},e.createUploadPair=function(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0);var o=this.up.add();return o.reset(t,e,i,n,r,s),o},e.createMovePair=function(t,e,i,n,r,s,o){void 0===t&&(t=""),void 0===e&&(e=""),void 0===i&&(i=4294967295),void 0===n&&(n=4294967295),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0);var a=this.mp.add();return a.reset(t,e,i,n,r,s,o),a},e.createPipelineStatistics=function(){var t=this.ps.add();return t.reset(),t},t}();function Ott(t,e){t.n(e.type),t.n(e.count)}function Ltt(t,e){e.type=t.n(),e.count=t.n()}var Ntt=function(){function t(t,e){this.source=void 0,this.target=void 0,this.source=t,this.target=e}return t.prototype.equals=function(t){return this.source===t.source&&this.target===t.target},t}(),Ftt=function(){function t(t){this.target=void 0,this.target=t}return t.prototype.equals=function(t){return this.target===t.target},t}();Itt=Symbol.iterator;var ktt=function(){function t(t,e){this.iterator=void 0,this.source=void 0,this.iterator=t,this.source=e}var e=t.prototype;return e[Itt]=function(){return this},e.next=function(){var t=this.iterator.next();return t.done?{value:void 0,done:!0}:{value:new Ntt(this.source,t.value.target),done:!1}},t}();Mtt=Symbol.iterator;var Vtt=function(){function t(t,e){this.iterator=void 0,this.source=void 0,this.iterator=t,this.source=e}var e=t.prototype;return e[Mtt]=function(){return this},e.next=function(){var t=this.iterator.next();return t.done?{value:void 0,done:!0}:{value:new Ntt(t.value.target,this.source),done:!1}},t}();Ptt=Symbol.iterator;var Gtt=function(){function t(t,e){this.graph=void 0,this.iterator=void 0,this.graph=t,this.iterator=e}var e=t.prototype;return e[Ptt]=function(){return this},e.next=function(){var t=this.iterator.next();return t.done?{value:void 0,done:!0}:{value:this.graph.target(t.value),done:!1}},t}();function Utt(t,e,i){var n=t.N,r=i.split("/");if(0===r.length)return e;var s=e,o=0;""===r[0]&&(s=n,++o);for(var a=o;a!==r.length;++a){var h=r[a];if(""!==h&&"."!==h)if(".."!==h){if((s=t.locateChild(s,h))===n)return n}else{if(s===n)return n;s=t.getParent(s)}}return s}var ztt,Htt=function(){function t(){}return t.prototype.terminate=function(){return!1},t}();function Wtt(t){var e=t.v().next();return e.done?t.N:e.value}!function(t){t[t.WHITE=0]="WHITE",t[t.GRAY=1]="GRAY",t[t.GREEN=2]="GREEN",t[t.RED=3]="RED",t[t.BLACK=4]="BLACK"}(ztt||(ztt={}));var jtt=function(t,e,i){this.v=void 0,this.e=void 0,this.iter=void 0,this.v=t,this.e=e,this.iter=i};function Xtt(t,e,i,n,r){var s=null,o=null,a=new Array;for(n.put(e,ztt.GRAY),i.discoverVertex(e,t),o=t.oe(e),r.terminate(e,t)?a.push(new jtt(e,null,null)):a.push(new jtt(e,null,o));a.length;){var h=a.pop();if(e=h.v,s=h.e,o=h.iter,null!==s&&i.finishEdge(s,t),o)for(var u=o.next();!u.done;u=o.next()){var l=u.value,c=l.target;i.examineEdge(l,t);var _=n.get(c);if(_===ztt.WHITE){if(i.treeEdge(l,t),s=l,a.push(new jtt(e,s,o)),e=c,n.put(e,ztt.GRAY),i.discoverVertex(e,t),o=t.oe(e),r.terminate(e,t))break}else _===ztt.GRAY?i.backEdge(l,t):i.forwardOrCrossEdge(l,t),i.finishEdge(l,t)}n.put(e,ztt.BLACK),i.finishVertex(e,t)}}function Ytt(t,e,i,n){if(void 0===n&&(n=null),null!==(n=n||Wtt(t))&&0!==t.nv()){for(var r,s=f(t.v());!(r=s()).done;){var o=r.value;i.put(o,ztt.WHITE),e.initializeVertex(o,t)}var a=new Htt;n!==Wtt(t)&&(e.startVertex(n,t),Xtt(t,n,e,i,a));for(var h,u=f(t.v());!(h=u()).done;){var l=h.value;i.get(l)===ztt.WHITE&&(e.startVertex(l,t),Xtt(t,l,e,i,a))}}}var qtt=function(){function t(){}var e=t.prototype;return e.initializeVertex=function(){},e.startVertex=function(){},e.discoverVertex=function(){},e.examineEdge=function(){},e.treeEdge=function(){},e.backEdge=function(){},e.forwardOrCrossEdge=function(){},e.finishEdge=function(){},e.finishVertex=function(){},t}(),Ktt=function(){function t(t){this.g=void 0,this.g=t,this.N=t.N}var e=t.prototype;return e.edge=function(t,e){return this.g.reference(t,e)},e.source=function(t){return this.g.parent(t)},e.target=function(t){return this.g.child(t)},e.oe=function(t){return this.g.children(t)},e.od=function(t){return this.g.numChildren(t)},e.v=function(){return this.g.v()},e.nv=function(){return this.g.nv()},t}(),Qtt=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.w=n}return t.prototype.reset=function(t,e,i,n){this.x=t,this.y=e,this.z=i,this.w=n},t}(),Ztt=function(){function t(t,e,i,n,r,s,o,a){void 0===t&&(t=""),void 0===e&&(e=ftt.WRITE),void 0===i&&(i=ptt.RENDER_TARGET),void 0===n&&(n=zc.LOAD),void 0===r&&(r=Hc.STORE),void 0===s&&(s=n_.ALL),void 0===o&&(o=new S_),void 0===a&&(a=Uc.NONE),this.slotName1="",this.slotID=0,this.slotName=t,this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=o,this.shaderStageFlags=a}return t.prototype.reset=function(t,e,i,n,r,s,o){this.slotName=t,this.slotName1="",this.accessType=e,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor.reset(),this.slotID=0,this.shaderStageFlags=o},t}(),Jtt=function(){function t(t,e,i,n,r,s){void 0===t&&(t=""),void 0===e&&(e=ftt.READ),void 0===i&&(i=n_.NONE),void 0===n&&(n=mtt.NONE),void 0===r&&(r=new Qtt),void 0===s&&(s=Uc.NONE),this.plane=0,this.name=t,this.accessType=e,this.clearFlags=i,this.clearValueType=n,this.clearValue=r,this.shaderStageFlags=s}return t.prototype.reset=function(t,e,i,n,r){this.name=t,this.accessType=e,this.plane=0,this.clearFlags=i,this.clearValueType=n,this.clearValue.reset(0,0,0,0),this.shaderStageFlags=r},t}(),$tt=function(){function t(){this.dimension=utt.BUFFER,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=Ac.UNKNOWN,this.sampleCount=Pc.X1,this.textureFlags=Ic.NONE,this.flags=ltt.NONE,this.viewType=Dc.TEX2D}return t.prototype.reset=function(){this.dimension=utt.BUFFER,this.alignment=0,this.width=0,this.height=0,this.depthOrArraySize=0,this.mipLevels=0,this.format=Ac.UNKNOWN,this.sampleCount=Pc.X1,this.textureFlags=Ic.NONE,this.flags=ltt.NONE,this.viewType=Dc.TEX2D},t}(),tet=function(){function t(t){void 0===t&&(t=att.MANAGED),this.residency=t}return t.prototype.reset=function(t){this.residency=t},t}(),eet=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.swapchain=t,this.isDepthStencil=e}return t.prototype.reset=function(t,e){this.swapchain=t,this.renderWindow=null,this.currentID=0,this.numBackBuffers=0,this.generation=4294967295,this.isDepthStencil=e},t}(),iet=function(){function t(){this.states=Wc.NONE}return t.prototype.reset=function(){this.states=Wc.NONE},t}(),net=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),ret=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.buffer=t}return t.prototype.reset=function(t){this.buffer=t,this.fenceValue=0},t}(),set=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),oet=function(){function t(t){void 0===t&&(t=null),this.fenceValue=0,this.texture=t}return t.prototype.reset=function(t){this.texture=t,this.fenceValue=0},t}(),aet=function(){function t(){this.unused=0}return t.prototype.reset=function(){this.unused=0},t}(),het=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[]}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0},t}(),uet=function(){this.o=[],this.i=[]},cet=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._subpasses=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=f(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new ktt(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Vtt(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Gtt(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=f(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this._names.length=0,this._subpasses.length=0,this.x.length=0},e.addVertex=function(t,e){var i=new uet,n=this.x.length;return this.x.push(i),this._names.push(t),this._subpasses.push(e),n},e.addEdge=function(t,e){return this.x[t].o.push(new Ftt(e)),this.x[e].i.push(new Ftt(t)),new Ntt(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getSubpass=function(t){return this._subpasses[t]},t}(),_et=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0),this.rasterViews=new Map,this.computeViews=new Map,this.resolvePairs=[],this.viewport=new v_,this.showStatistics=!1,this.subpassID=t,this.count=e,this.quality=i}return t.prototype.reset=function(t,e,i){this.rasterViews.clear(),this.computeViews.clear(),this.resolvePairs.length=0,this.viewport.reset(),this.subpassID=t,this.count=e,this.quality=i,this.showStatistics=!1},t}(),fet=function(){function t(t){void 0===t&&(t=4294967295),this.rasterViews=new Map,this.computeViews=new Map,this.subpassID=t}return t.prototype.reset=function(t){this.rasterViews.clear(),this.computeViews.clear(),this.subpassID=t},t}(),det=function(){function t(){this.rasterViews=new Map,this.computeViews=new Map,this.attachmentIndexMap=new Map,this.textures=new Map,this.subpassGraph=new cet,this.width=0,this.height=0,this.count=1,this.quality=0,this.viewport=new v_,this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1}return t.prototype.reset=function(){this.rasterViews.clear(),this.computeViews.clear(),this.attachmentIndexMap.clear(),this.textures.clear(),this.subpassGraph.clear(),this.width=0,this.height=0,this.count=1,this.quality=0,this.viewport.reset(),this.versionName="",this.version=0,this.hashValue=0,this.showStatistics=!1},t}(),pet=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.clearColors=[],this.clearDepth=0,this.clearStencil=0,this.renderPass=t,this.framebuffer=e}return t.prototype.reset=function(t,e){this.renderPass=t,this.framebuffer=e,this.clearColors.length=0,this.clearDepth=0,this.clearStencil=0},t}(),met=function(){function t(){this.format=Ac.UNKNOWN}return t.prototype.reset=function(){this.format=Ac.UNKNOWN},t}(),get=function(){function t(){this.textureView=null,this.format=Ac.UNKNOWN,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0}return t.prototype.reset=function(){this.textureView=null,this.format=Ac.UNKNOWN,this.indexOrFirstMipLevel=0,this.numMipLevels=0,this.firstArraySlice=0,this.numArraySlices=0,this.firstPlane=0,this.numPlanes=0},t}(),yet=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},vet=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._descs=[],this._traits=[],this._states=[],this._samplerInfo=[],this._valueIndex=new Map,this.renderPasses=new Map,this.nextFenceValue=0,this.version=0}var e=t.prototype;return e.edge=function(t,e){for(var i,n=f(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new ktt(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Vtt(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Gtt(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=f(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.renderPasses.clear(),this.nextFenceValue=0,this.version=0,this._valueIndex.clear(),this._names.length=0,this._descs.length=0,this._traits.length=0,this._states.length=0,this._samplerInfo.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,o,a){void 0===a&&(a=4294967295);var h=new yet(t,e),u=this.x.length;return this.x.push(h),this._names.push(i),this._descs.push(n),this._traits.push(r),this._states.push(s),this._samplerInfo.push(o),this._valueIndex.set(i,u),4294967295!==a&&this.addEdge(a,u),u},e.addEdge=function(t,e){return this.x[t].o.push(new Ftt(e)),this.x[e].i.push(new Ftt(t)),new Ntt(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getDesc=function(t){return this._descs[t]},e.getTraits=function(t){return this._traits[t]},e.getStates=function(t){return this._states[t]},e.getSampler=function(t){return this._samplerInfo[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.managed(i.j);case 1:return t.managedBuffer(i.j);case 2:return t.managedTexture(i.j);case 3:return t.persistentBuffer(i.j);case 4:return t.persistentTexture(i.j);case 5:return t.framebuffer(i.j);case 6:return t.swapchain(i.j);case 7:return t.formatView(i.j);case 8:return t.subresourceView(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=f(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new ktt(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.contains=function(t){return this._valueIndex.has(t)},e.vertex=function(t){return this._valueIndex.get(t)},e.find=function(t){var e=this._valueIndex.get(t);return void 0===e?4294967295:e},t}(),Aet=function(){function t(){this.computeViews=new Map,this.textures=new Map}return t.prototype.reset=function(){this.computeViews.clear(),this.textures.clear()},t}(),Tet=function(){function t(){this.resolvePairs=[]}return t.prototype.reset=function(){this.resolvePairs.length=0},t}(),bet=function(){function t(){this.copyPairs=[],this.uploadPairs=[]}return t.prototype.reset=function(){this.copyPairs.length=0,this.uploadPairs.length=0},t}(),Eet=function(){function t(){this.movePairs=[]}return t.prototype.reset=function(){this.movePairs.length=0},t}(),Cet=function(){function t(){this.computeViews=new Map}return t.prototype.reset=function(){this.computeViews.clear()},t}(),xet=function(){function t(t,e,i){void 0===t&&(t=""),void 0===e&&(e=n_.ALL),void 0===i&&(i=new S_),this.slotName=t,this.clearFlags=e,this.clearColor=i}return t.prototype.reset=function(t,e){this.slotName=t,this.clearFlags=e,this.clearColor.reset()},t}(),wet=function(){function t(t,e,i){void 0===t&&(t=htt.RENDER_OPAQUE),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.viewport=null,this.hint=t,this.phaseID=e,this.passLayoutID=i}return t.prototype.reset=function(t,e,i){this.hint=t,this.phaseID=e,this.passLayoutID=i,this.viewport=null},t}(),Det=function(){function t(t,e,i,n,r,s){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=ctt.NONE),void 0===n&&(n=new gtt),void 0===r&&(r=1),void 0===s&&(s=null),this.scene=t,this.camera=e,this.light=n,this.flags=i,this.cullingFlags=r,this.shadingLight=s}return t.prototype.reset=function(t,e,i,n,r){this.scene=t,this.camera=e,this.light.reset(null,0,!1,null),this.flags=i,this.cullingFlags=n,this.shadingLight=r},t}(),Ret=function(){function t(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r}return t.prototype.reset=function(t,e,i,n,r){this.material=t,this.passID=e,this.threadGroupCountX=i,this.threadGroupCountY=n,this.threadGroupCountZ=r},t}(),Iet=function(){function t(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=ctt.NONE),void 0===n&&(n=null),this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n}return t.prototype.reset=function(t,e,i,n){this.material=t,this.passID=e,this.sceneFlags=i,this.camera=n},t}(),Met=function(){function t(){this.constants=new Map,this.buffers=new Map,this.textures=new Map,this.samplers=new Map,this.custom=""}return t.prototype.reset=function(){this.constants.clear(),this.buffers.clear(),this.textures.clear(),this.samplers.clear(),this.custom=""},t}(),Pet=10,Bet=function(t,e){this.o=[],this.i=[],this.c=[],this.p=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},Oet=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._layoutNodes=[],this._data=[],this._valid=[],this.index=new Map,this.sortedVertices=[]}var e=t.prototype;return e.edge=function(t,e){for(var i,n=f(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new ktt(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Vtt(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Gtt(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=f(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.index.clear(),this.sortedVertices.length=0,this._names.length=0,this._layoutNodes.length=0,this._data.length=0,this._valid.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s,o){void 0===o&&(o=4294967295);var a=new Bet(t,e),h=this.x.length;return this.x.push(a),this._names.push(i),this._layoutNodes.push(n),this._data.push(r),this._valid.push(s),4294967295!==o&&(this.x[o].c.push(new Ftt(h)),a.p.push(new Ftt(o))),h},e.addEdge=function(t,e){return this.x[t].o.push(new Ftt(e)),this.x[e].i.push(new Ftt(t)),new Ntt(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.setName=function(t,e){this._names[t]=e},e.getLayout=function(t){return this._layoutNodes[t]},e.setLayout=function(t,e){this._layoutNodes[t]=e},e.getData=function(t){return this._data[t]},e.getValid=function(t){return this._valid[t]},e.setValid=function(t,e){this._valid[t]=e},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.rasterPass(i.j);case 1:return t.rasterSubpass(i.j);case 2:return t.computeSubpass(i.j);case 3:return t.compute(i.j);case 4:return t.resolve(i.j);case 5:return t.copy(i.j);case 6:return t.move(i.j);case 7:return t.raytrace(i.j);case 8:return t.queue(i.j);case 9:return t.scene(i.j);case Pet:return t.blit(i.j);case 11:return t.dispatch(i.j);case 12:return t.clear(i.j);case 13:return t.viewport(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=f(this.x[t].c);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new ktt(this.x[t].c.values(),t)},e.numChildren=function(t){return this.x[t].c.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].p;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.x[t].c.push(new Ftt(e)),this.x[e].p.push(new Ftt(t)),new Ntt(t,e)},t}();function Let(t){return new Ks((function(){return new t}),16)}var Net,Fet,ket=function(){function t(t){this.renderCommon=void 0,this.cv=Let(Qtt),this.rv=Let(Ztt),this.cv1=Let(Jtt),this.rd=Let($tt),this.rt=Let(tet),this.rs=Let(eet),this.rs1=Let(iet),this.mb=Let(net),this.pb=Let(ret),this.mt=Let(set),this.pt=Let(oet),this.mr=Let(aet),this.s=Let(het),this.sg=Let(cet),this.rs2=Let(_et),this.cs=Let(fet),this.rp=Let(det),this.prpaf=Let(pet),this.fv=Let(met),this.sv=Let(get),this.rg=Let(vet),this.cp=Let(Aet),this.rp1=Let(Tet),this.cp1=Let(bet),this.mp=Let(Eet),this.rp2=Let(Cet),this.cv2=Let(xet),this.rq=Let(wet),this.sd=Let(Det),this.d=Let(Ret),this.b=Let(Iet),this.rd1=Let(Met),this.rg1=Let(Oet),this.renderCommon=t}var e=t.prototype;return e.reset=function(){this.cv.reset(),this.rv.reset(),this.cv1.reset(),this.rd.reset(),this.rt.reset(),this.rs.reset(),this.rs1.reset(),this.mb.reset(),this.pb.reset(),this.mt.reset(),this.pt.reset(),this.mr.reset(),this.s.reset(),this.sg.reset(),this.rs2.reset(),this.cs.reset(),this.rp.reset(),this.prpaf.reset(),this.fv.reset(),this.sv.reset(),this.rg.reset(),this.cp.reset(),this.rp1.reset(),this.cp1.reset(),this.mp.reset(),this.rp2.reset(),this.cv2.reset(),this.rq.reset(),this.sd.reset(),this.d.reset(),this.b.reset(),this.rd1.reset(),this.rg1.reset()},e.createClearValue=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=this.cv.add();return r.reset(t,e,i,n),r},e.createRasterView=function(t,e,i,n,r,s,o){void 0===t&&(t=""),void 0===e&&(e=ftt.WRITE),void 0===i&&(i=ptt.RENDER_TARGET),void 0===n&&(n=zc.LOAD),void 0===r&&(r=Hc.STORE),void 0===s&&(s=n_.ALL),void 0===o&&(o=Uc.NONE);var a=this.rv.add();return a.reset(t,e,i,n,r,s,o),a},e.createComputeView=function(t,e,i,n,r){void 0===t&&(t=""),void 0===e&&(e=ftt.READ),void 0===i&&(i=n_.NONE),void 0===n&&(n=mtt.NONE),void 0===r&&(r=Uc.NONE);var s=this.cv1.add();return s.reset(t,e,i,n,r),s},e.createResourceDesc=function(){var t=this.rd.add();return t.reset(),t},e.createResourceTraits=function(t){void 0===t&&(t=att.MANAGED);var e=this.rt.add();return e.reset(t),e},e.createRenderSwapchain=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!1);var i=this.rs.add();return i.reset(t,e),i},e.createResourceStates=function(){var t=this.rs1.add();return t.reset(),t},e.createManagedBuffer=function(t){void 0===t&&(t=null);var e=this.mb.add();return e.reset(t),e},e.createPersistentBuffer=function(t){void 0===t&&(t=null);var e=this.pb.add();return e.reset(t),e},e.createManagedTexture=function(t){void 0===t&&(t=null);var e=this.mt.add();return e.reset(t),e},e.createPersistentTexture=function(t){void 0===t&&(t=null);var e=this.pt.add();return e.reset(t),e},e.createManagedResource=function(){var t=this.mr.add();return t.reset(),t},e.createSubpass=function(){var t=this.s.add();return t.reset(),t},e.createSubpassGraph=function(){var t=this.sg.add();return t.clear(),t},e.createRasterSubpass=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=1),void 0===i&&(i=0);var n=this.rs2.add();return n.reset(t,e,i),n},e.createComputeSubpass=function(t){void 0===t&&(t=4294967295);var e=this.cs.add();return e.reset(t),e},e.createRasterPass=function(){var t=this.rp.add();return t.reset(),t},e.createPersistentRenderPassAndFramebuffer=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=this.prpaf.add();return i.reset(t,e),i},e.createFormatView=function(){var t=this.fv.add();return t.reset(),t},e.createSubresourceView=function(){var t=this.sv.add();return t.reset(),t},e.createResourceGraph=function(){var t=this.rg.add();return t.clear(),t},e.createComputePass=function(){var t=this.cp.add();return t.reset(),t},e.createResolvePass=function(){var t=this.rp1.add();return t.reset(),t},e.createCopyPass=function(){var t=this.cp1.add();return t.reset(),t},e.createMovePass=function(){var t=this.mp.add();return t.reset(),t},e.createRaytracePass=function(){var t=this.rp2.add();return t.reset(),t},e.createClearView=function(t,e){void 0===t&&(t=""),void 0===e&&(e=n_.ALL);var i=this.cv2.add();return i.reset(t,e),i},e.createRenderQueue=function(t,e,i){void 0===t&&(t=htt.RENDER_OPAQUE),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295);var n=this.rq.add();return n.reset(t,e,i),n},e.createSceneData=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=ctt.NONE),void 0===n&&(n=1),void 0===r&&(r=null);var s=this.sd.add();return s.reset(t,e,i,n,r),s},e.createDispatch=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var s=this.d.add();return s.reset(t,e,i,n,r),s},e.createBlit=function(t,e,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=ctt.NONE),void 0===n&&(n=null);var r=this.b.add();return r.reset(t,e,i,n),r},e.createRenderData=function(){var t=this.rd1.add();return t.reset(),t},e.createRenderGraph=function(){var t=this.rg1.add();return t.clear(),t},t}();!function(t){t[t.BASIC=0]="BASIC",t[t.STANDARD=1]="STANDARD"}(Net||(Net={})),function(t){t[t.NONE=0]="NONE",t[t.INPUT_DEPTH_STENCIL=1]="INPUT_DEPTH_STENCIL",t[t.INPUT_COLOR=2]="INPUT_COLOR",t[t.INPUT_COLOR_MRT=4]="INPUT_COLOR_MRT",t[t.HETEROGENEOUS_SAMPLE_COUNT=8]="HETEROGENEOUS_SAMPLE_COUNT"}(Fet||(Fet={}));var Vet=function(){this.subpass=Fet.NONE},Get=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=bc.UNKNOWN),void 0===i&&(i=1),this.descriptorID=t,this.type=e,this.count=i}return t.prototype.reset=function(t,e,i){this.descriptorID=t,this.type=e,this.count=i},t}(),Uet=function(){function t(t,e,i){void 0===t&&(t=ytt.UNIFORM_BUFFER),void 0===e&&(e=Uc.NONE),void 0===i&&(i=0),this.offset=0,this.descriptors=[],this.type=t,this.visibility=e,this.capacity=i}return t.prototype.reset=function(t,e,i){this.type=t,this.visibility=e,this.offset=0,this.capacity=i,this.descriptors.length=0},t}(),zet=function(){function t(t,e,i,n,r){void 0===t&&(t=4294967295),void 0===e&&(e=0),void 0===i&&(i=[]),void 0===n&&(n=new Map),void 0===r&&(r=new Map),this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.slot=t,this.capacity=e,this.descriptorBlocks=i,this.uniformBlocks=n,this.bindingMap=r}return t.prototype.reset=function(t,e){this.slot=t,this.capacity=e,this.uniformBlockCapacity=0,this.samplerTextureCapacity=0,this.descriptorBlocks.length=0,this.uniformBlocks.clear(),this.bindingMap.clear()},t}(),Het=function(){function t(t,e,i){void 0===t&&(t=new zet),void 0===e&&(e=null),void 0===i&&(i=null),this.descriptorSetLayoutInfo=new tf,this.descriptorSetLayoutData=t,this.descriptorSetLayout=e,this.descriptorSet=i}return t.prototype.reset=function(t,e){this.descriptorSetLayoutData.reset(4294967295,0),this.descriptorSetLayoutInfo.reset(),this.descriptorSetLayout=t,this.descriptorSet=e},t}(),Wet=function(){function t(){this.descriptorSets=new Map}return t.prototype.reset=function(){this.descriptorSets.clear()},t}(),jet=function(){function t(){this.descriptorBindings=new Map}return t.prototype.reset=function(){this.descriptorBindings.clear()},t}(),Xet=function(){function t(){this.layoutData=new Map,this.bindingData=new Map}return t.prototype.reset=function(){this.layoutData.clear(),this.bindingData.clear()},t}(),Yet=function(){function t(){this.passes=[]}return t.prototype.reset=function(){this.passes.length=0},t}(),qet=function(){function t(){this.techniques=new Map}return t.prototype.reset=function(){this.techniques.clear()},t}(),Ket=function(){function t(){this.layout=new Wet,this.pipelineLayout=null}return t.prototype.reset=function(){this.layout.reset(),this.pipelineLayout=null},t}(),Qet=function(){function t(){this.descriptorVisibility=new Map}return t.prototype.reset=function(){this.descriptorVisibility.clear()},t}(),Zet=function(){function t(){this.rootSignature="",this.shaderPrograms=[],this.shaderIndex=new Map,this.pipelineLayout=null}return t.prototype.reset=function(){this.rootSignature="",this.shaderPrograms.length=0,this.shaderIndex.clear(),this.pipelineLayout=null},t}(),Jet=function(t,e){this.o=[],this.i=[],this.t=void 0,this.j=void 0,this.id=t,this.object=e,this.t=t,this.j=e},$et=function(){function t(){this.N=4294967295,this.x=[],this._names=[],this._updateFrequencies=[],this._layouts=[],this.valueNames=[],this.attributeIndex=new Map,this.constantIndex=new Map,this.shaderLayoutIndex=new Map,this.effects=new Map,this.constantMacros=""}var e=t.prototype;return e.edge=function(t,e){for(var i,n=f(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.source=function(t){return t.source},e.target=function(t){return t.target},e.oe=function(t){return new ktt(this.x[t].o.values(),t)},e.od=function(t){return this.x[t].o.length},e.ie=function(t){return new Vtt(this.x[t].i.values(),t)},e.id=function(t){return this.x[t].i.length},e.d=function(t){return this.od(t)+this.id(t)},e.adj=function(t){return new Gtt(this,this.oe(t))},e.v=function(){return this.x.keys()},e.nv=function(){return this.x.length},e.ne=function(){for(var t,e=0,i=f(this.v());!(t=i()).done;){var n=t.value;e+=this.od(n)}return e},e.clear=function(){this.valueNames.length=0,this.attributeIndex.clear(),this.constantIndex.clear(),this.shaderLayoutIndex.clear(),this.effects.clear(),this.constantMacros="",this._names.length=0,this._updateFrequencies.length=0,this._layouts.length=0,this.x.length=0},e.addVertex=function(t,e,i,n,r,s){void 0===s&&(s=4294967295);var o=new Jet(t,e),a=this.x.length;return this.x.push(o),this._names.push(i),this._updateFrequencies.push(n),this._layouts.push(r),4294967295!==s&&this.addEdge(s,a),a},e.addEdge=function(t,e){return this.x[t].o.push(new Ftt(e)),this.x[e].i.push(new Ftt(t)),new Ntt(t,e)},e.vertexName=function(t){return this._names[t]},e.getName=function(t){return this._names[t]},e.getUpdate=function(t){return this._updateFrequencies[t]},e.setUpdate=function(t,e){this._updateFrequencies[t]=e},e.getLayout=function(t){return this._layouts[t]},e.h=function(t,e){return this.x[e].t===t},e.w=function(t){return this.x[t].t},e.object=function(t){return this.x[t].j},e.value=function(t,e){if(this.x[e].t===t)return this.x[e].j;throw Error("value id not match")},e.visitVertex=function(t,e){var i=this.x[e];switch(i.t){case 0:return t.renderStage(i.j);case 1:return t.renderPhase(i.j);default:throw Error("polymorphic type not found")}},e.j=function(t){return this.x[t].j},e.reference=function(t,e){for(var i,n=f(this.x[t].o);!(i=n()).done;)if(e===i.value.target)return!0;return!1},e.parent=function(t){return t.source},e.child=function(t){return t.target},e.children=function(t){return new ktt(this.x[t].o.values(),t)},e.numChildren=function(t){return this.x[t].o.length},e.getParent=function(t){if(4294967295===t)return 4294967295;var e=this.x[t].i;return 0===e.length?4294967295:e[0].target},e.addReference=function(t,e){return this.addEdge(t,e)},e.locateChild=function(t,e){if(4294967295===t){for(var i,n=f(this.x.keys());!(i=n()).done;){var r=i.value;if(0===this.x[r].i.length&&this._names[r]===e)return r}return 4294967295}for(var s,o=f(this.x[t].o);!(s=o()).done;){var a=s.value.target;if(e===this._names[a])return a}return 4294967295},e.locate=function(t){return Utt(this,4294967295,t)},e.locateRelative=function(t,e){return void 0===e&&(e=4294967295),Utt(this,e,t)},e.path=function(t){return function(t,e){if(e===t.N)return"";for(var i=[];e!==t.N;e=t.getParent(e))i.push(t.vertexName(e));for(var n="",r=i.length;r-- >0;)n+="/",n+=i[r];return n}(this,t)},t}();function tit(t,e){e.descriptorID=t.n(),e.type=t.n(),e.count=t.n()}function eit(t,e){var i;e.type=t.n(),e.visibility=t.n(),e.offset=t.n(),e.capacity=t.n(),i=t.n(),e.descriptors.length=i;for(var n=0;n!==i;++n){var r=new Get;tit(t,r),e.descriptors[n]=r}}function iit(t,e){e.slot=t.n(),e.capacity=t.n(),e.uniformBlockCapacity=t.n(),e.samplerTextureCapacity=t.n();var i=0;i=t.n(),e.descriptorBlocks.length=i;for(var n=0;n!==i;++n){var r=new Uet;eit(t,r),e.descriptorBlocks[n]=r}i=t.n();for(var s=0;s!==i;++s){var o=t.n(),a=new B_;stt(t,a),e.uniformBlocks.set(o,a)}i=t.n();for(var h=0;h!==i;++h){var u=t.n(),l=t.n();e.bindingMap.set(u,l)}}function nit(t,e){iit(t,e.descriptorSetLayoutData),function(t,e){var i=t.n();e.bindings.length=i;for(var n=0;n!==i;++n){var r=new $_;ott(t,r),e.bindings[n]=r}}(t,e.descriptorSetLayoutInfo)}function rit(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new Het;nit(t,s),e.descriptorSets.set(r,s)}}function sit(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorBindings.set(r,s)}}function oit(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=new zet;iit(t,s),e.layoutData.set(r,s)}i=t.n();for(var o=0;o!==i;++o){var a=t.n(),h=new jet;sit(t,h),e.bindingData.set(a,h)}}function ait(t,e){var i;i=t.n(),e.passes.length=i;for(var n=0;n!==i;++n){var r=new Xet;oit(t,r),e.passes[n]=r}}function hit(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new Yet;ait(t,s),e.techniques.set(r,s)}}function uit(t,e){rit(t,e.layout)}function lit(t,e){var i;i=t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n();e.descriptorVisibility.set(r,s)}}function cit(t,e){e.rootSignature=t.s();var i=0;i=t.n(),e.shaderPrograms.length=i;for(var n=0;n!==i;++n){var r=new Ket;uit(t,r),e.shaderPrograms[n]=r}i=t.n();for(var s=0;s!==i;++s){var o=t.s(),a=t.n();e.shaderIndex.set(o,a)}}function _it(t,e){var i=t.n();t.n(),t.n(),t.n();for(var n=0;n!==i;++n){var r=t.n(),s=t.n(),o=t.s(),a=t.n(),h=new Wet;switch(rit(t,h),r){case 0:var u=new Qet;lit(t,u),e.addVertex(0,u,o,a,h,s);break;case 1:var l=new Zet;cit(t,l),e.addVertex(1,l,o,a,h,s)}}var c=0;c=t.n(),e.valueNames.length=c;for(var _=0;_!==c;++_)e.valueNames[_]=t.s();c=t.n();for(var f=0;f!==c;++f){var d=t.s(),p=t.n();e.attributeIndex.set(d,p)}c=t.n();for(var m=0;m!==c;++m){var g=t.s(),y=t.n();e.constantIndex.set(g,y)}c=t.n();for(var v=0;v!==c;++v){var S=t.s(),A=t.n();e.shaderLayoutIndex.set(S,A)}c=t.n();for(var T=0;T!==c;++T){var b=t.s(),E=new qet;hit(t,E),e.effects.set(b,E)}}var fit,dit=function(){function t(t){this.colors=void 0,this.colors=new Array(t)}var e=t.prototype;return e.get=function(t){return this.colors[t]},e.put=function(t,e){this.colors[t]=e},t}();function pit(t){switch(t){case bc.BOOL:case bc.INT:case bc.UINT:case bc.FLOAT:return 1;case bc.INT2:case bc.FLOAT2:case bc.UINT2:case bc.BOOL2:return 2;case bc.FLOAT3:case bc.BOOL3:case bc.UINT3:case bc.INT3:return 3;case bc.BOOL4:case bc.FLOAT4:case bc.UINT4:case bc.INT4:case bc.MAT2:return 4;case bc.MAT2X3:case bc.MAT3X2:return 6;case bc.MAT2X4:case bc.MAT4X2:return 8;case bc.MAT3:return 9;case bc.MAT3X4:case bc.MAT4X3:return 12;case bc.MAT4:return 16;default:return 0}}function mit(t,e){var i=zc.CLEAR;return t&n_.COLOR||e!==ptt.RENDER_TARGET||(i=t&cD?zc.CLEAR:zc.LOAD),(t&n_.DEPTH_STENCIL)!==n_.DEPTH_STENCIL&&e===ptt.DEPTH_STENCIL&&(t&n_.DEPTH||(i=zc.LOAD),t&n_.STENCIL||(i=zc.LOAD)),i}function git(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=void 0),s=s||new __;var o=t?t.viewport:new __(0,0,1,1),a=e,h=i;if(s.x=o.x*a,s.y=o.y*h,s.width=o.width*a,s.height=o.height*h,n)switch(n.type){case BD.DIRECTIONAL:var u=n;if(u.shadowFixedArea||u.csmLevel===lT.LEVEL_1)s.x=0,s.y=0,s.width=a,s.height=h;else{var l=v.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*a,s.y=l>0?.5*(1-Math.floor(r/2))*h:.5*Math.floor(r/2)*h,s.width=.5*a,s.height=.5*h}break;case BD.SPOT:s.x=0,s.y=0,s.width=a,s.height=h}return s}function yit(t,e,i,n,r){var s="Camera"+r,o=i.renderArea(),a=o.x,h=o.y,u=i.camera,l="reflectionProbePassColor"+s,c="reflectionProbePassDS"+s;e.containsResource(l)||(e.addRenderWindow(l,Ac.RGBA8,a,h,n),e.addDepthStencil(c,Ac.DEPTH_STENCIL,a,h,att.EXTERNAL)),e.updateRenderWindow(l,n),e.updateDepthStencil(c,a,h);var _=e.addRenderPass(a,h,"default");_.name="ReflectionProbePass"+r,_.setViewport(new v_(0,0,a,h)),_.addRenderTarget(l,mit(u.clearFlag,ptt.RENDER_TARGET),Hc.STORE,new S_(u.clearColor.x,u.clearColor.y,u.clearColor.z,u.clearColor.w)),_.addDepthStencil(c,mit(u.clearFlag,ptt.DEPTH_STENCIL),Hc.STORE,u.clearDepth,u.clearStencil,u.clearFlag);var f=_.addQueue(htt.RENDER_OPAQUE,"reflect-map"),d=new gtt;d.probe=i,f.addSceneOfCamera(t,d,ctt.REFLECTION_PROBE|ctt.OPAQUE_OBJECT),function(t,e,i){var n=v.director.root.pipeline,r=i.pipelineSceneData,s=r.skybox;t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),t.setVec4("cc_cameraPos",new ln(e.position.x,e.position.y,e.position.z,n.getCombineSignY())),t.setVec4("cc_surfaceTransform",new ln(e.surfaceTransform,0,Math.cos(Vi(s.getRotationAngle())),Math.sin(Vi(s.getRotationAngle())))),t.setVec4("cc_screenScale",new ln(r.shadingScale,r.shadingScale,1/r.shadingScale,1/r.shadingScale)),t.setVec4("cc_exposure",new ln(e.exposure,1/e.exposure,r.isHDR?1:0,1/fD.standardExposureValue))}(f,u,e)}function vit(t,e,i){!function(t,e,i){i instanceof xf?t.bindBuffer(e,i):i instanceof Xf?t.bindTexture(e,i):i instanceof Wf&&t.bindSampler(e,i)}(t,e,i)}function Sit(t,e){for(var i,n=f(e.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(t===r.descriptors[s].descriptorID)return r.offset+s;return-1}new Ko(0,0,0,.5,.5,.5),new Ko,function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA",t[t.FXAAHQ=2]="FXAAHQ"}(fit||(fit={})),new(function(){function t(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array,this.validLights=[]}return t.prototype.reset=function(){this.shadowEnabled=!1,this.mainLightShadowNames.length=0,this.spotLightShadowNames.length=0,this.validLights.length=0},t}());var Ait=function(){function t(t,e){void 0===e&&(e=2),this.buffers=[],this.currBuffIdx=0,this.device=void 0,this.currUniform=void 0,this._root=void 0;var i=(this._root=v.director.root).device;this.device=i,this.currUniform=new Float32Array(t/4);for(var n=0;n<e;n++){var r=new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,t,t);this.buffers.push(this.device.createBuffer(r))}}var e=t.prototype;return e.getCurrentBuffer=function(){var t=v.director;return this.currBuffIdx=t.getTotalFrames()%this.buffers.length,this.buffers[this.currBuffIdx]},e.updateData=function(t){this.currUniform.set(t)},e.updateBuffer=function(t,e){var i=e.descriptorSet,n=this.getCurrentBuffer();n.update(this.currUniform),vit(i,t,n)},t}(),Tit=new Map,bit=new Map,Eit=new Map;function Cit(t){var e=Eit.get(t);if(e)return e;var i=v.director.root.pipeline,n=i.layoutGraph.locateChild(i.layoutGraph.N,t),r=i.layoutGraph.getLayout(n).descriptorSets.get(ttt.PER_PASS);return Eit.set(t,r),r}function xit(t,e,i,n){void 0===n&&(n="default"),function(t,e,i,n){var r=n.constants,s=n.samplers,o=n.textures,a=n.buffers,h=v.director.root.pipeline,u=h.layoutGraph,l=Cit(t);bit.clear();for(var c,_=function(){var n=c.value,r=n[0],s=n[1],o=Mit.get(r);if(o)Oit(o,s,l,e,i);else for(var a,h=Array.from(u.constantIndex).find((function(t){return t[0],t[1]===r}))[0],_=f(u.attributeIndex);!(a=_()).done;){var d=a.value,p=d[0],m=d[1],g=Pit(p,t);if(g){var y=Dit(h,p,t);-1!==y?(Mit.set(r,new Iit),(o=Mit.get(r)).buffer=g,o.blockId=m,o.offset=y,Oit(o,s,l,e,i)):Lit(m,e,i,g,l)}}},d=f(r);!(c=d()).done;)_();for(var p,m=l.descriptorSet,g=f(o);!(p=g()).done;){var y=p.value,S=y[0],A=y[1],T=Sit(S,l);if(-1!==T){var b=m.getTexture(T);b&&A===h.defaultShadowTexture&&(b.gpuTexture||b.gpuTextureView&&b.gpuTextureView.gpuTexture)||vit(m,T,A)}}for(var E,C=f(s);!(E=C()).done;){var x=E.value,w=x[0],D=x[1],R=Sit(w,l);-1!==R&&(m.getSampler(R)&&D===h.defaultSampler||vit(m,R,D))}for(var I,M=f(bit);!(I=M()).done;){var P=I.value,B=P[0],O=P[1];Tit.get(B).updateBuffer(O,l)}for(var L,N=f(a);!(L=N()).done;){var F=L.value,k=F[0],V=F[1],G=Sit(k,l);-1!==G&&(m.getBuffer(G)||vit(m,G,V))}m.update()}(n,e,i,t)}function wit(t,e){var i=v.director.root.pipeline.layoutGraph,n=i.locateChild(4294967295,e),r=i.getLayout(n).descriptorSets.get(ttt.PER_PASS).descriptorSetLayoutData,s=i.attributeIndex.get(t);return r.uniformBlocks.get(s)}function Dit(t,e,i){var n=wit(e,i);if(!n)return-1;for(var r,s=0,o=f(n.members);!(r=o()).done;){var a=r.value,h=pit(a.type);if(a.name===t)return s;s+=h*a.count}return-1}var Rit=new Map,Iit=function(){this.offset=-1,this.buffer=[],this.blockId=-1},Mit=new Map;function Pit(t,e){var i=Rit.get(t);if(i)return i;i=[],v.director.root.pipeline.layoutGraph;var n=0,r=wit(t,e);if(!r)return null;for(var s,o=f(r.members);!(s=o()).done;){var a=s.value;n+=pit(a.type)*a.count}return i.length=n,i.fill(0),Rit.set(t,i),i}function Bit(t,e){var i=Tit.get(t);i||(Tit.set(t,new Ait(4*e.length,2)),i=Tit.get(t)),i.updateData(e)}function Oit(t,e,i,n,r){var s=t.blockId,o=t.buffer,a=function(t,e,i){var n=!1;if(i<0||i>t.length)return n;for(var r=Math.min(e.length,t.length-i),s=0;s<r;s++)t[i+s]!==e[s]&&(t[i+s]=e[s],n=!0);return n}(o,e,t.offset),h=Sit(s,i),u=i.descriptorSet;if(a||!u.getBuffer(h)&&-1!==h){var l=""+s+h+r+n;bit.set(l,h),Bit(l,o)}}function Lit(t,e,i,n,r){var s=Sit(t,r);if(-1!==s){var o=""+t+s+i+e;bit.set(o,s),Bit(o,n)}}function Nit(t){return t+"-"}function Fit(t){return!!t}var kit=new ln,Vit=new mn,Git=new S_,Uit=new Vn,zit=new Vn;function Hit(t,e,i,n){var r,s=v.director.root.pipeline,o=i.shadows,a=i.skybox,h=i.shadingScale;e&&(t.setMat4("cc_matView",e.matView),t.setMat4("cc_matViewInv",e.node.worldMatrix),t.setMat4("cc_matProj",e.matProj),t.setMat4("cc_matProjInv",e.matProjInv),t.setMat4("cc_matViewProj",e.matViewProj),t.setMat4("cc_matViewProjInv",e.matViewProjInv),kit.set(e.surfaceTransform,e.cameraUsage,Math.cos(Vi(a.getRotationAngle())),Math.sin(Vi(a.getRotationAngle()))),t.setVec4("cc_surfaceTransform",kit),kit.set(e.exposure,1/e.exposure,i.isHDR?1:0,1/fD.standardExposureValue),t.setVec4("cc_exposure",kit)),e?kit.set(e.position.x,e.position.y,e.position.z,s.getCombineSignY()):kit.set(0,0,0,s.getCombineSignY()),t.setVec4("cc_cameraPos",kit),kit.set(i.shadingScale,i.shadingScale,1/i.shadingScale,1/i.shadingScale),t.setVec4("cc_screenScale",kit);var u=n&&n.mainLight;if(u){var l=u.shadowEnabled&&o.type===hT.ShadowMap?1:0;kit.set(u.direction.x,u.direction.y,u.direction.z,l),t.setVec4("cc_mainLitDir",kit);var c=u.color.x,_=u.color.y,f=u.color.z;u.useColorTemperature&&(c*=u.colorTemperatureRGB.x,_*=u.colorTemperatureRGB.y,f*=u.colorTemperatureRGB.z);var d=u.illuminance;i.isHDR&&e&&(d*=e.exposure),kit.set(c,_,f,d),t.setVec4("cc_mainLitColor",kit)}else kit.set(0,0,1,0),t.setVec4("cc_mainLitDir",kit),kit.set(0,0,0,0),t.setVec4("cc_mainLitColor",kit);var p=i.ambient,m=p.skyColor;i.isHDR?m.w=p.skyIllum*(e?e.exposure:1):m.w=p.skyIllum,kit.set(m.x,m.y,m.z,m.w),t.setVec4("cc_ambientSky",kit),kit.set(p.groundAlbedo.x,p.groundAlbedo.y,p.groundAlbedo.z,a.envmap?null===(r=a.envmap)||void 0===r?void 0:r.mipmapLevel:1),t.setVec4("cc_ambientGround",kit);var g=i.fog,y=g.colorArray;kit.set(y.x,y.y,y.z,y.z),t.setVec4("cc_fogColor",kit),kit.set(g.fogStart,g.fogEnd,g.fogDensity,0),t.setVec4("cc_fogBase",kit),kit.set(g.fogTop,g.fogRange,g.fogAtten,0),t.setVec4("cc_fogAdd",kit),e&&(kit.set(e.nearClip,e.farClip,e.getClipSpaceMinz(),0),t.setVec4("cc_nearFar",kit),kit.set(e.viewport.x,e.viewport.y,h*e.window.width*e.viewport.z,h*e.window.height*e.viewport.w),t.setVec4("cc_viewPort",kit))}var Wit=function(){function t(t,e,i,n,r,s){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),this.subModel=void 0,this.priority=void 0,this.hash=void 0,this.depth=void 0,this.shaderID=void 0,this.passIndex=void 0,this.subModel=t,this.priority=e,this.hash=i,this.depth=n,this.shaderID=r,this.passIndex=s}return t.prototype.update=function(t,e,i,n,r,s){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),this.subModel=t,this.priority=e,this.hash=i,this.depth=n,this.shaderID=r,this.passIndex=s},t}(),jit=new Ks((function(){return new Wit}),8),Xit="CC_USE_RGBE_OUTPUT";function Yit(t,e){for(var i=t.passes,n=0;n<i.length;n++)if(i[n].phaseID===e)return n;return-1}var qit=function(){function t(){this.probeMap=new Array,this.defaultId=function(){var t=v.rendering;return t.getPhaseID(t.getPassID("default"),"default")}()}var e=t.prototype;return e.clear=function(){this.probeMap.length=0},e.applyMacro=function(){for(var t,e=f(this.probeMap);!(t=e()).done;){var i=t.value,n=[{name:Xit,value:!0}];i.patches&&(n=n.concat(i.patches)),i.onMacroPatchesStateChanged(n)}},e.removeMacro=function(){for(var t,e=f(this.probeMap);!(t=e()).done;){var i=t.value;if(i.patches){var n=i.patches.filter((function(t){return t.name!==Xit}));0===n.length?i.onMacroPatchesStateChanged(null):i.onMacroPatchesStateChanged(n)}}},e.addToProbeQueue=function(t,e){for(var i=t.subModels,n=0;n<i.length;n++){var r=i[n];if(!r.passes[0].blendState.targets[0].blend){var s=Yit(r,e),o=!0;s<0&&(s=Yit(r,e=this.defaultId),o=!1),s<0||o||this.probeMap.push(r)}}},t}();function Kit(t,e,i,n){var r=v.director.root.pipeline,s=r.device,o=r.pipelineSceneData,a=o.shadows;if(a.type!==hT.Planar){var h=o.csmLayers,u=wv(s)?0:1,l=r.device.capabilities;switch(a.enabled&&a.type===hT.ShadowMap&&i&&i.node&&i.type===BD.DIRECTIONAL&&h.update(o,e),i.type){case BD.DIRECTIONAL:var c=i;if(a.enabled&&c&&c.shadowEnabled&&a.type===hT.ShadowMap){var _,f,d,p=.1,m=0,g=0;if(c.shadowFixedArea||c.csmLevel===lT.LEVEL_1)_=h.specialLayer.matShadowView,f=h.specialLayer.matShadowProj,d=h.specialLayer.matShadowViewProj,c.shadowFixedArea?(p=c.shadowNear,m=c.shadowFar,g=0):(p=.1,m=h.specialLayer.shadowCameraFar,g=1),kit.set(BD.DIRECTIONAL,u,c.shadowNormalBias,0),t.setVec4("cc_shadowLPNNInfo",kit);else{var y=h.layers[n];_=y.matShadowView,f=y.matShadowProj,d=y.matShadowViewProj,p=y.splitCameraNear,m=y.splitCameraFar,g=c.csmLevel}t.setMat4("cc_matLightView",_),kit.set(f.m10,f.m14,f.m11,f.m15),t.setVec4("cc_shadowProjDepthInfo",kit),kit.set(f.m00,f.m05,1/f.m00,1/f.m05),t.setVec4("cc_shadowProjInfo",kit),t.setMat4("cc_matLightViewProj",d),kit.set(p,m,0,1-c.shadowSaturation),t.setVec4("cc_shadowNFLSInfo",kit),kit.set(BD.DIRECTIONAL,u,c.shadowNormalBias,g),t.setVec4("cc_shadowLPNNInfo",kit),kit.set(a.size.x,a.size.y,c.shadowPcf,c.shadowBias),t.setVec4("cc_shadowWHPBInfo",kit)}break;case BD.SPOT:var S=i;if(a.enabled&&S&&S.shadowEnabled){Vn.invert(Uit,S.node.getWorldMatrix()),t.setMat4("cc_matLightView",Uit),Vn.perspective(zit,S.angle,1,.001,S.range,!0,l.clipSpaceMinZ,l.clipSpaceSignY,0);var A=zit.clone().invert(),T=zit.clone();Vn.multiply(Uit,zit,Uit),t.setMat4("cc_matLightViewProj",Uit),kit.set(.01,i.range,0,0),t.setVec4("cc_shadowNFLSInfo",kit),kit.set(a.size.x,a.size.y,S.shadowPcf,S.shadowBias),t.setVec4("cc_shadowWHPBInfo",kit),kit.set(BD.SPOT,u,S.shadowNormalBias,0),t.setVec4("cc_shadowLPNNInfo",kit),kit.set(T.m10,T.m14,T.m11,T.m15),t.setVec4("cc_shadowProjDepthInfo",kit),kit.set(A.m10,A.m14,A.m11,A.m15),t.setVec4("cc_shadowInvProjDepthInfo",kit),kit.set(T.m00,T.m05,1/T.m00,1/T.m05),t.setVec4("cc_shadowProjInfo",kit)}break;case BD.SPHERE:kit.set(a.size.x,a.size.y,1,0),t.setVec4("cc_shadowWHPBInfo",kit),kit.set(BD.SPHERE,u,0,0),t.setVec4("cc_shadowLPNNInfo",kit);break;case BD.POINT:kit.set(a.size.x,a.size.y,1,0),t.setVec4("cc_shadowWHPBInfo",kit),kit.set(BD.POINT,u,0,0),t.setVec4("cc_shadowLPNNInfo",kit)}Git.set(a.shadowColor.x,a.shadowColor.y,a.shadowColor.z,a.shadowColor.w),t.setColor("cc_shadowColor",Git)}}function Qit(t,e){var i=v.director,n=i.root.pipeline,r=n.device,s=i.getScene(),o=e&&e.scene?e.scene.mainLight:s?s.renderScene.mainLight:null,a=n.pipelineSceneData,h=a.shadows,u=a.csmLayers,l=a.csmSupported,c=wv(r)?0:1;if(o&&h.enabled){if(h.type===hT.ShadowMap){if(o.shadowEnabled){if(o.shadowFixedArea||o.csmLevel===lT.LEVEL_1||!l){var _=u.specialLayer.matShadowView,f=u.specialLayer.matShadowProj,d=u.specialLayer.matShadowViewProj,p=o.shadowNear,m=o.shadowFar;t.setMat4("cc_matLightView",_),kit.set(f.m10,f.m14,f.m11,f.m15),t.setVec4("cc_shadowProjDepthInfo",kit),kit.set(f.m00,f.m05,1/f.m00,1/f.m05),t.setVec4("cc_shadowProjInfo",kit),t.setMat4("cc_matLightViewProj",d),kit.set(p,m,0,1-o.shadowSaturation),t.setVec4("cc_shadowNFLSInfo",kit),kit.set(BD.DIRECTIONAL,c,o.shadowNormalBias,0),t.setVec4("cc_shadowLPNNInfo",kit)}else{for(var g=function(t,e){var i=t.size.x;switch(e.shadowPcf){case uT.HARD:return 0;case uT.SOFT:return 1/(.5*i);case uT.SOFT_2X:return 2/(.5*i);case uT.SOFT_4X:return 3/(.5*i)}return 0}(h,o),y=0;y<o.csmLevel;y++){var S=u.layers[y],A=S.matShadowView;kit.set(A.m00,A.m04,A.m08,g),t.setVec4("cc_csmViewDir0",kit,y),kit.set(A.m01,A.m05,A.m09,S.splitCameraNear),t.setVec4("cc_csmViewDir1",kit,y),kit.set(A.m02,A.m06,A.m10,S.splitCameraFar),t.setVec4("cc_csmViewDir2",kit,y);var T=S.csmAtlas;t.setVec4("cc_csmAtlas",T,y);var b=S.matShadowViewProj;t.setMat4("cc_matCSMViewProj",b,y);var E=S.matShadowProj;kit.set(E.m10,E.m14,E.m11,E.m15),t.setVec4("cc_csmProjDepthInfo",kit,y),kit.set(E.m00,E.m05,1/E.m00,1/E.m05),t.setVec4("cc_csmProjInfo",kit,y)}kit.set(o.csmTransitionRange,0,0,0),t.setVec4("cc_csmSplitsInfo",kit),kit.set(.1,o.shadowDistance,0,1-o.shadowSaturation),t.setVec4("cc_shadowNFLSInfo",kit),kit.set(BD.DIRECTIONAL,c,o.shadowNormalBias,o.csmLevel),t.setVec4("cc_shadowLPNNInfo",kit)}kit.set(h.size.x,h.size.y,o.shadowPcf,o.shadowBias),t.setVec4("cc_shadowWHPBInfo",kit)}}else mn.normalize(Vit,h.normal),kit.set(Vit.x,Vit.y,Vit.z,-h.distance),t.setVec4("cc_planarNDInfo",kit),kit.set(0,0,0,h.planeBias),t.setVec4("cc_shadowWHPBInfo",kit);t.setMathColor("cc_shadowColor",h.shadowColor)}}var Zit=function(){function t(t,e){this._data=void 0,this._lg=void 0,this._vertID=-1,this._currBlock=void 0,this._currStage="",this._currFrequency=ttt.PER_PASS,this._currCount=void 0,this._currConstant=[],this._data=t,this._lg=e}var e=t.prototype;return e.setMat4=function(e,i,n){void 0===n&&(n=0),t.setMat4(this._lg,this._data,e,i,n)},t.setMat4=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);Vn.toArray(o.dataArr,r,16*s),i.constants.set(o.constantID,o.dataArr)},e.setQuaternion=function(e,i,n){void 0===n&&(n=0),t.setQuaternion(this._lg,this._data,e,i,n)},t.setQuaternion=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);In.toArray(o.dataArr,r,4*s),i.constants.set(o.constantID,o.dataArr)},e.setColor=function(e,i,n){void 0===n&&(n=0),t.setColor(this._lg,this._data,e,i,n)},t.setColor=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n),a=4*s;o.dataArr[0+a]=r.x,o.dataArr[1+a]=r.y,o.dataArr[2+a]=r.z,o.dataArr[3+a]=r.w,i.constants.set(o.constantID,o.dataArr)},e.setMathColor=function(e,i,n){void 0===n&&(n=0),t.setMathColor(this._lg,this._data,e,i,n)},t.setMathColor=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);bn.toArray(o.dataArr,r,4*s),i.constants.set(o.constantID,o.dataArr)},t.getConstantInfo=function(t,e,i){var n=t.constantIndex.get(i);if(void 0===n)throw new Error("Constant with name "+i+" not found.");return{constantID:n,dataArr:e.constants.get(n)||[]}},e.setVec4=function(e,i,n){void 0===n&&(n=0),t.setVec4(this._lg,this._data,e,i,n)},t.setVec4=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);ln.toArray(o.dataArr,r,4*s),i.constants.set(o.constantID,o.dataArr)},e.setVec2=function(e,i,n){void 0===n&&(n=0),t.setVec2(this._lg,this._data,e,i,n)},t.setVec2=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);jn.toArray(o.dataArr,r,2*s),i.constants.set(o.constantID,o.dataArr)},e.setFloat=function(e,i,n){void 0===n&&(n=0),t.setFloat(this._lg,this._data,e,i,n)},t.setFloat=function(e,i,n,r,s){void 0===s&&(s=0);var o=t.getConstantInfo(e,i,n);o.dataArr[0+s]=r,i.constants.set(o.constantID,o.dataArr)},e.setArrayBuffer=function(e,i){t.setArrayBuffer(this._lg,this._data,e,i)},t.setArrayBuffer=function(){throw new Error("Method not implemented.")},e.setBuffer=function(e,i){t.setBuffer(this._lg,this._data,e,i)},t.setBuffer=function(t,e,i,n){var r=t.attributeIndex.get(i);e.buffers.set(r,n)},e.setTexture=function(e,i){t.setTexture(this._lg,this._data,e,i)},t.setTexture=function(t,e,i,n){var r=t.attributeIndex.get(i);e.textures.set(r,n)},e.setReadWriteBuffer=function(e,i){t.setReadWriteBuffer(this._lg,this._data,e,i)},t.setReadWriteBuffer=function(t,e,i,n){var r=t.attributeIndex.get(i);e.buffers.set(r,n)},e.setReadWriteTexture=function(e,i){t.setReadWriteTexture(this._lg,this._data,e,i)},t.setReadWriteTexture=function(t,e,i,n){var r=t.attributeIndex.get(i);e.textures.set(r,n)},e.setSampler=function(e,i){t.setSampler(this._lg,this._data,e,i)},t.setSampler=function(t,e,i,n){var r=t.attributeIndex.get(i);e.samplers.set(r,n)},e.getParentLayout=function(){var t=v.director.root.pipeline,e=t.renderGraph.getParent(this._vertID);return t.renderGraph.getLayout(e)},e.getCurrentLayout=function(){return v.director.root.pipeline.renderGraph.getLayout(this._vertID)},e.setBuiltinCameraConstants=function(t){var e=v.director.root.pipeline;this.getParentLayout(),Hit(this,t,e.pipelineSceneData,t.scene)},e.setBuiltinShadowMapConstants=function(){Qit(this,null,this.getParentLayout())},e.setBuiltinDirectionalLightFrustumConstants=function(t,e,i){void 0===i&&(i=0),Kit(this,t,e,i)},e.setBuiltinSpotLightFrustumConstants=function(t){Kit(this,null,t,0)},e.setBuiltinDirectionalLightConstants=function(t){this.setBuiltinShadowMapConstants(t)},e.setBuiltinSphereLightConstants=function(t,e){var i=v.director.root.pipeline.pipelineSceneData;kit.set(t.position.x,t.position.y,t.position.z,BD.SPHERE),this.setVec4("cc_lightPos",kit),kit.set(t.size,t.range,0,0),this.setVec4("cc_lightSizeRangeAngle",kit);var n=i.isHDR;if(kit.set(t.color.x,t.color.y,t.color.z,0),t.useColorTemperature){var r=t.finalColor;kit.x=r.x,kit.y=r.y,kit.z=r.z}kit.w=n?t.luminance*e.exposure*1e4:t.luminance,this.setVec4("cc_lightColor",kit)},e.setBuiltinSpotLightConstants=function(t,e){var i=v.director.root.pipeline.pipelineSceneData,n=i.shadows;kit.set(t.position.x,t.position.y,t.position.z,BD.SPOT),this.setVec4("cc_lightPos",kit),kit.set(t.size,t.range,t.spotAngle,n.enabled&&t.shadowEnabled&&n.type===hT.ShadowMap?1:0),this.setVec4("cc_lightSizeRangeAngle",kit),kit.set(t.direction.x,t.direction.y,t.direction.z,0),this.setVec4("cc_lightDir",kit);var r=i.isHDR;if(kit.set(t.color.x,t.color.y,t.color.z,0),t.useColorTemperature){var s=t.finalColor;kit.x=s.x,kit.y=s.y,kit.z=s.z}kit.w=r?t.luminance*e.exposure*1e4:t.luminance,this.setVec4("cc_lightColor",kit),kit.set(0,0,0,t.angleAttenuationStrength),this.setVec4("cc_lightBoundingSizeVS",kit)},e.setBuiltinPointLightConstants=function(t,e){var i=v.director.root.pipeline.pipelineSceneData;kit.set(t.position.x,t.position.y,t.position.z,BD.POINT),this.setVec4("cc_lightPos",kit),kit.set(0,t.range,0,0),this.setVec4("cc_lightSizeRangeAngle",kit);var n=i.isHDR;if(t.useColorTemperature){var r=t.finalColor;kit.x=r.x,kit.y=r.y,kit.z=r.z}kit.w=n?t.luminance*e.exposure*1e4:t.luminance,kit.set(t.color.x,t.color.y,t.color.z,0),this.setVec4("cc_lightColor",kit)},e.setBuiltinRangedDirectionalLightConstants=function(t,e){var i=v.director.root.pipeline.pipelineSceneData;kit.set(t.position.x,t.position.y,t.position.z,BD.RANGED_DIRECTIONAL),this.setVec4("cc_lightPos",kit),kit.set(t.right.x,t.right.y,t.right.z,0),this.setVec4("cc_lightSizeRangeAngle",kit),kit.set(t.direction.x,t.direction.y,t.direction.z,0),this.setVec4("cc_lightDir",kit);var n=t.scale;kit.set(.5*n.x,.5*n.y,.5*n.z,0),this.setVec4("cc_lightBoundingSizeVS",kit);var r=i.isHDR;if(kit.set(t.color.x,t.color.y,t.color.z,0),t.useColorTemperature){var s=t.finalColor;kit.x=s.x,kit.y=s.y,kit.z=s.z}kit.w=r?t.illuminance*e.exposure:t.illuminance,this.setVec4("cc_lightColor",kit)},e.hasSampler=function(t){var e=this._lg.constantIndex.get(t);return void 0!==e&&this._data.samplers.has(e)},e.hasTexture=function(t){var e=this._lg.constantIndex.get(t);return void 0!==e&&this._data.textures.has(e)},e.setCustomBehavior=function(){throw new Error("Method not implemented.")},n(t,[{key:"name",get:function(){return""},set:function(){}}]),t}(),Jit=function(){function t(){this.instances=new Array}var e=t.prototype;return e.empty=function(){return 0===this.instances.length},e.clear=function(){this.instances.length=0},e.add=function(t,e,i,n){var r=t.subModels[i],s=r.passes[n].priority,o=r.priority,a=r.shaders[n].typedID,h=0|s<<16|o<<8|n,u=t.priority,l=jit.add();l.update(r,u,h,e,a,n),this.instances.push(l)},e.sortOpaqueOrCutout=function(){this.instances.sort((function(t,e){return t.hash!==e.hash?t.hash-e.hash:t.depth!==e.depth?t.depth-e.depth:t.shaderID-e.shaderID}))},e.sortTransparent=function(){this.instances.sort((function(t,e){return t.priority!==e.priority?t.priority-e.priority:t.hash!==e.hash?t.hash-e.hash:t.depth!==e.depth?e.depth-t.depth:t.shaderID-e.shaderID}))},e.recordCommandBuffer=function(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s=null);for(var o,a=f(this.instances);!(o=a()).done;){var h=o.value,u=h.subModel,l=h.passIndex,c=u.inputAssembler,_=u.passes[l],d=u.shaders[l],p=nT.getOrCreatePipelineState(t,_,d,e,c);i.bindPipelineState(p),i.bindDescriptorSet(Jg.MATERIAL,_.descriptorSet),n&&i.bindDescriptorSet(Jg.GLOBAL,n,[r]),s?i.bindDescriptorSet(Jg.LOCAL,u.descriptorSet,s):i.bindDescriptorSet(Jg.LOCAL,u.descriptorSet),i.bindInputAssembler(c),i.draw(c)}},t}(),$it=function(){function t(){this.passInstances=new Map,this.instanceBuffers=new Array}var e=t.prototype;return e.empty=function(){return 0===this.passInstances.size},e.add=function(t,e,i){if(void 0===this.passInstances.get(t)){var n=this.passInstances.size;n>=this.instanceBuffers.length&&this.instanceBuffers.push(new HA(t)),this.passInstances.set(t,n);var r=this.instanceBuffers[n];r.pass=t,r.instances}this.instanceBuffers[this.passInstances.get(t)].merge(e,i)},e.clear=function(){this.passInstances.clear(),this.instanceBuffers.forEach((function(t){t.clear()}))},e.sort=function(){},e.uploadBuffers=function(t){for(var e,i=f(this.passInstances.entries());!(e=i()).done;){var n=e.value;n[0];var r=n[1],s=this.instanceBuffers[r];s.hasPendingModels&&s.uploadBuffers(t)}},e.recordCommandBuffer=function(t,e,i,n,r){void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=null);for(var s,o=f(this.instanceBuffers);!(s=o()).done;){var a=s.value;if(a.hasPendingModels){var h=a.instances,u=a.pass;e.bindDescriptorSet(Jg.MATERIAL,u.descriptorSet);for(var l,c=null,_=f(h);!(l=_()).done;){var d=l.value;if(d.count){var p=nT.getOrCreatePipelineState(nd.gfxDevice,u,d.shader,t,d.ia);c!==p&&(e.bindPipelineState(p),c=p),i&&e.bindDescriptorSet(Jg.GLOBAL,i,[n]),r?e.bindDescriptorSet(Jg.LOCAL,d.descriptorSet,r):e.bindDescriptorSet(Jg.LOCAL,d.descriptorSet,a.dynamicOffsets),e.bindInputAssembler(d.ia),e.draw(d.ia)}}}}},t}(),tnt=function(){function t(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=void 0,this.lightBoundsCulledResultID=void 0,this.renderQueueTarget=void 0,this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i}return t.prototype.update=function(t,e,i){void 0===t&&(t=4294967295),void 0===e&&(e=4294967295),void 0===i&&(i=4294967295),this.frustumCulledResultID=t,this.lightBoundsCulledResultID=e,this.renderQueueTarget=i},t}(),ent=function(){function t(){this.probeQueue=new qit,this.opaqueQueue=new Jit,this.transparentQueue=new Jit,this.opaqueInstancingQueue=new $it,this.transparentInstancingQueue=new $it,this.camera=null,this.sceneFlags=ctt.NONE,this.lightByteOffset=4294967295}var e=t.prototype;return e.sort=function(){this.opaqueQueue.sortOpaqueOrCutout(),this.transparentQueue.sortTransparent(),this.opaqueInstancingQueue.sort(),this.transparentInstancingQueue.sort()},e.update=function(){this.probeQueue.clear(),this.opaqueQueue.clear(),this.transparentQueue.clear(),this.opaqueInstancingQueue.clear(),this.transparentInstancingQueue.clear(),this.camera=null,this.sceneFlags=ctt.NONE,this.lightByteOffset=4294967295},e.empty=function(){return this.opaqueQueue.empty()&&this.transparentQueue.empty()&&this.opaqueInstancingQueue.empty()&&this.transparentInstancingQueue.empty()},e.recordCommands=function(t,e,i){var n=4294967295===this.lightByteOffset?null:[this.lightByteOffset];i&(ctt.OPAQUE|ctt.MASK)&&(this.opaqueQueue.recordCommandBuffer(nd.gfxDevice,e,t,null,0,n),this.opaqueInstancingQueue.recordCommandBuffer(e,t,null,0,n)),i&ctt.BLEND&&(this.transparentInstancingQueue.recordCommandBuffer(e,t,null,0,n),this.transparentQueue.recordCommandBuffer(nd.gfxDevice,e,t,null,0,n))},t}(),int=4294967295;function nnt(t){switch(t){case ytt.UNIFORM_BUFFER:return $c.UNIFORM_BUFFER;case ytt.DYNAMIC_UNIFORM_BUFFER:return $c.DYNAMIC_UNIFORM_BUFFER;case ytt.SAMPLER_TEXTURE:return $c.SAMPLER_TEXTURE;case ytt.SAMPLER:return $c.SAMPLER;case ytt.TEXTURE:return $c.TEXTURE;case ytt.STORAGE_BUFFER:return $c.STORAGE_BUFFER;case ytt.DYNAMIC_STORAGE_BUFFER:return $c.DYNAMIC_STORAGE_BUFFER;case ytt.STORAGE_IMAGE:return $c.STORAGE_IMAGE;case ytt.INPUT_ATTACHMENT:return $c.INPUT_ATTACHMENT;default:return z("DescriptorType not found"),$c.INPUT_ATTACHMENT}}function rnt(t){switch(t){case $c.UNIFORM_BUFFER:return ytt.UNIFORM_BUFFER;case $c.DYNAMIC_UNIFORM_BUFFER:return ytt.DYNAMIC_UNIFORM_BUFFER;case $c.SAMPLER_TEXTURE:return ytt.SAMPLER_TEXTURE;case $c.SAMPLER:return ytt.SAMPLER;case $c.TEXTURE:return ytt.TEXTURE;case $c.STORAGE_BUFFER:return ytt.STORAGE_BUFFER;case $c.DYNAMIC_STORAGE_BUFFER:return ytt.DYNAMIC_STORAGE_BUFFER;case $c.STORAGE_IMAGE:return ytt.STORAGE_IMAGE;case $c.INPUT_ATTACHMENT:return ytt.INPUT_ATTACHMENT;case $c.UNKNOWN:default:return z("DescriptorTypeOrder not found"),ytt.INPUT_ATTACHMENT}}function snt(t,e){return t.locateChild(t.N,e||"default")}function ont(t,e,i){return t.locateChild(e,i)}function ant(t,e,i){return void 0===i?t.locateChild(e,"default"):"number"==typeof i?t.locateChild(e,i.toString()):t.locateChild(e,i)}var hnt,unt,lnt=new Map([["cc_lightPos",Ey.LIGHTS_PER_PASS],["cc_lightColor",Ey.LIGHTS_PER_PASS],["cc_lightSizeRangeAngle",Ey.LIGHTS_PER_PASS],["cc_lightDir",Ey.LIGHTS_PER_PASS],["cc_lightBoundingSizeVS",Ey.LIGHTS_PER_PASS]]);function cnt(t,e){var i=JSON.parse(t[0]),n=JSON.parse(e[0]);return 1e4*i.updateFrequency+1e3*i.parameterType+100*i.descriptorType+i.visibility-(1e4*n.updateFrequency+1e3*n.parameterType+100*n.descriptorType+n.visibility)}function _nt(t,e){var i=t.attributeIndex.get(e);if(void 0===i){var n=t.valueNames.length;return t.attributeIndex.set(e,n),t.valueNames.push(e),n}return i}function fnt(t,e){for(var i=0;i<t.descriptorBlocks.length;++i)for(var n=t.descriptorBlocks[i],r=n.offset,s=0;s<n.descriptors.length;++s){var o=n.descriptors[s],a=new $_;a.binding=r,a.descriptorType=nnt(n.type),a.count=o.count,a.stageFlags=n.visibility,a.immutableSamplers=[],e.bindings.push(a),r+=o.count}}function dnt(t,e){var i=new tf;return fnt(e,i),t?t.createDescriptorSetLayout(i):null}function pnt(t,e){var i=JSON.stringify(e),n=t.get(i);if(n)return n;var r=new Uet(e.descriptorType,e.visibility,0);return t.set(i,r),r}function mnt(t,e,i,n){for(var r=new Map,s=new Map,o=0;o<n.blocks.length;o++){var a=n.blocks[o],h=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.UNIFORM_BUFFER,visibility:a.stageFlags}),u=_nt(t,a.name);h.descriptors.push(new Get(u,bc.UNKNOWN,1)),s.set(u,new B_(i,4294967295,a.name,a.members,1))}for(var l=0;l<n.samplerTextures.length;l++){var c=n.samplerTextures[l],_=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.SAMPLER_TEXTURE,visibility:c.stageFlags}),d=_nt(t,c.name);_.descriptors.push(new Get(d,c.type,c.count))}for(var p=0;p<n.samplers.length;p++){var m=n.samplers[p],g=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.SAMPLER,visibility:m.stageFlags}),y=_nt(t,m.name);g.descriptors.push(new Get(y,bc.SAMPLER,m.count))}for(var v=0;v<n.textures.length;v++){var S=n.textures[v],A=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.TEXTURE,visibility:S.stageFlags}),T=_nt(t,S.name);A.descriptors.push(new Get(T,S.type,S.count))}for(var b=0;b<n.buffers.length;b++){var E=n.buffers[b],C=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.STORAGE_BUFFER,visibility:E.stageFlags}),x=_nt(t,E.name);C.descriptors.push(new Get(x,bc.UNKNOWN,1))}for(var w=0;w<n.images.length;w++){var D=n.images[w],R=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.STORAGE_IMAGE,visibility:D.stageFlags}),I=_nt(t,D.name);R.descriptors.push(new Get(I,D.type,D.count))}for(var M=0;M<n.subpassInputs.length;M++){var P=n.subpassInputs[M],B=pnt(r,{updateFrequency:e,parameterType:_tt.TABLE,descriptorType:ytt.INPUT_ATTACHMENT,visibility:P.stageFlags}),O=_nt(t,P.name);B.descriptors.push(new Get(O,bc.UNKNOWN,P.count))}for(var L,N=Array.from(r).sort(cnt),F=new zet(i,0),k=0,V=f(N);!(L=V()).done;){var G=L.value,U=G[0],W=G[1],j=JSON.parse(U);W.offset=k;for(var X,Y=f(W.descriptors);!(X=Y()).done;){var q=X.value;if(j.descriptorType===ytt.UNIFORM_BUFFER){var K=s.get(q.descriptorID);if(!K){z("Uniform block not found for "+q.descriptorID);continue}H(4294967295===K.binding),K.binding=W.capacity,F.uniformBlocks.set(q.descriptorID,K)}void 0!==F.bindingMap.get(q.descriptorID)&&z("Duplicated descriptor "+q.descriptorID),F.bindingMap.set(q.descriptorID,W.offset+W.capacity),W.capacity+=q.count}k+=W.capacity,F.capacity+=W.capacity,j.descriptorType===ytt.UNIFORM_BUFFER||j.descriptorType===ytt.DYNAMIC_UNIFORM_BUFFER?F.uniformBlockCapacity+=W.capacity:j.descriptorType===ytt.SAMPLER_TEXTURE&&(F.samplerTextureCapacity+=W.capacity),F.descriptorBlocks.push(W)}return F}function gnt(t,e){for(var i=0;i<t.descriptorBlocks.length;++i)for(var n=t.descriptorBlocks[i],r=n.offset,s=0;s<n.descriptors.length;++s){var o=n.descriptors[s],a=new $_;a.binding=r,a.descriptorType=nnt(n.type),a.count=o.count,a.stageFlags=n.visibility,a.immutableSamplers=[],e.bindings.push(a),r+=o.count}}function ynt(t,e,i){var n=t.descriptorSets.get(e);n&&n.descriptorSetLayout?i.setLayouts.push(n.descriptorSetLayout):i.setLayouts.push(hnt)}function vnt(){return hnt}function Snt(){return unt}function Ant(t,e,i,n){if(n<ttt.PER_PASS){var r=t.getLayout(i).descriptorSets.get(n);return r?r.descriptorSetLayout?r.descriptorSetLayout:(z("descriptor set layout not initialized"),hnt):hnt}H(n===ttt.PER_PASS),H(e===t.getParent(i));var s=t.getLayout(e).descriptorSets.get(n);return s?s.descriptorSetLayout?s.descriptorSetLayout:(z("descriptor set layout not initialized"),hnt):hnt}function Tnt(t,e,i,n){if(n<ttt.PER_PASS){var r=t.getLayout(i).descriptorSets.get(n);return r?r.descriptorSetLayout?r.descriptorSetLayout:(z("descriptor set layout not initialized"),null):null}H(n===ttt.PER_PASS),H(e===t.getParent(i));var s=t.getLayout(e).descriptorSets.get(n);return s?s.descriptorSetLayout?s.descriptorSetLayout:(z("descriptor set layout not initialized"),null):null}var bnt=function(){this.frustumCullingKeyRecycle=new Ks((function(){return new Mnt}),8),this.frustumCullingsRecycle=new Ks((function(){return new Fnt}),8),this.lightBoundsCullingRecycle=new Ks((function(){return new Bnt}),8),this.lightBoundsCullingResultRecycle=new Ks((function(){return new Ont}),8),this.lightBoundsCullingKeyRecycle=new Ks((function(){return new Pnt}),8),this.renderQueueRecycle=new Ks((function(){return new ent}),8),this.renderQueueQueryRecycle=new Ks((function(){return new tnt}),8)},Ent=Pm.makeMaskExclude([Pm.BitMask.UI_2D,Pm.BitMask.UI_3D,Pm.BitMask.GIZMOS,Pm.BitMask.EDITOR,Pm.BitMask.SCENE_GIZMO,Pm.BitMask.PROFILER]),Cnt=new WeakMap,xnt="",wnt=0;function Dnt(t){return Cnt.has(t)||Cnt.set(t,++wnt),Cnt.get(t)}function Rnt(t,e,i){void 0===i&&(i=-1),xnt="";var n=t.camera,r=t.light.light,s=t.light.level,o=t.light.probe,a=t.shadingLight;return xnt+=Nit(n?Dnt(n):0),xnt+=Nit(o?Dnt(o):0),xnt+=Nit(-1===i&&r?Dnt(r):0),xnt+=Nit(-1!==i&&a?Dnt(a):0),xnt+=Nit(-1===i?s:0),xnt+=Nit(e?1:0),xnt+=Nit(i)}var Int,Mnt=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=!1),this.sceneData=null,this.castShadows=!1,this.sceneData=t,this.castShadows=e}return t.prototype.update=function(t,e){this.sceneData=t,this.castShadows=e},t}(),Pnt=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=null,this.frustumCullingID=-1,this.sceneData=t,this.frustumCullingID=e}return t.prototype.update=function(t,e){void 0===t&&(t=null),void 0===e&&(e=-1),this.sceneData=t,this.frustumCullingID=e},t}(),Bnt=function(){function t(){this.resultKeyIndex=new Map,this.resultIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}(),Ont=function(){function t(){this.instances=new Array,this.lightByteOffset=4294967295}return t.prototype.update=function(){return this.instances.length=0,this.lightByteOffset=4294967295,this},t}();function Lnt(t,e,i){return t+"-"+e+"-"+i}function Nnt(t){var e=t.split("-");return[parseInt(e[0]),parseInt(e[1]),parseInt(e[2])]}var Fnt=function(){function t(){this.resultIndex=new Map,this.resultKeyIndex=new Map}return t.prototype.update=function(){this.resultIndex.clear(),this.resultKeyIndex.clear()},t}();function knt(t,e){return function(t,e){return t&&(e&t.layer)===t.layer}(t.node,e)||function(t,e){return!!(e&t.visFlags)}(t,e)}function Vnt(t){return Fit((t.node.layer&Ent)===t.node.layer||Ent&t.visFlags)}var Gnt=new Ko;function Unt(t,e,i){var n=t.worldBounds,r=Int.shadows;return i&&r.type===hT.Planar?(Ko.transform(Gnt,n,r.matLight),!gs.aabbFrustum(Gnt,e)):!gs.aabbFrustum(n,e)}function znt(t,e,i,n,r,s){var o,a,h=Int.skybox,u=h.model,l=e.visibility,c=e.clearFlag&cD;!n&&h&&h.enabled&&u&&c&&s.push(u);for(var _,d=f(t.models);!(_=d()).done;){var p=_.value;if(p.enabled&&p.node&&(!n||p.castShadow)&&!t.isCulledByLod(e,p)){var m=p.worldBounds;if(r)if(r.probeType===vD.CUBE){if(!knt(p,l))continue;if(m&&(o=m,a=r.boundingBox,!gs.aabbWithAABB(o,a)))continue;s.push(p)}else Vnt(p)&&s.push(p);else{if(!knt(p,l))continue;if(m&&Unt(p,i,n))continue;s.push(p)}}}}var Hnt=new mn;function Wnt(t,e,i,n,r,s,o){var a=o.probeQueue;n&&a.addToProbeQueue(s,t);for(var h=s.subModels,u=h.length,l=Int.skybox.model,c=function(t,e){var i=0;return e.node&&(mn.subtract(Hnt,e.worldBounds?e.worldBounds.center:e.node.worldPosition,t.position),i=mn.dot(Hnt,t.forward)),i}(r,s),_=0;_<u;++_){var f=h[_],d=f.passes,p=d.length;a.probeMap.includes(f)&&(t=a.defaultId);for(var m=0;m<p;++m)if(s!==l||_||m||!e){var g=d[m];if(t===g.phaseID){var y=g.blendState.targets[0].blend;!i&&y||!e&&!y||(g.batchingScheme===VA.INSTANCING?y?o.transparentInstancingQueue.add(g,f,m):o.opaqueInstancingQueue.add(g,f,m):y?o.transparentQueue.add(s,c,_,m):o.opaqueQueue.add(s,c,_,m))}}else o.opaqueQueue.add(s,c,_,m)}}var jnt,Xnt,Ynt,qnt=new Ko(0,0,0,.5,.5,.5),Knt=new Ko,Qnt=function(){function t(){this.frustumCullings=new Map,this.frustumCullingResults=new Array,this.lightBoundsCullings=new Map,this.lightBoundsCullingResults=new Array,this.renderQueueIndex=new Map,this.renderQueues=new Array,this.renderQueueQueryIndex=new Map,this.cullingPools=new bnt,this.numFrustumCulling=0,this.numLightBoundsCulling=0,this.numRenderQueues=0,this.layoutGraph=void 0,this.renderGraph=void 0,this.enableLightCulling=!0,this.kFilterMask=ctt.SHADOW_CASTER|ctt.REFLECTION_PROBE,this.kDrawMask=ctt.OPAQUE|ctt.MASK|ctt.BLEND,this.kAllMask=this.kFilterMask|this.kDrawMask}var e=t.prototype;return e.resetPool=function(){var t=this.cullingPools;t.frustumCullingKeyRecycle.reset(),t.frustumCullingsRecycle.reset(),t.lightBoundsCullingRecycle.reset(),t.lightBoundsCullingResultRecycle.reset(),t.lightBoundsCullingKeyRecycle.reset(),t.renderQueueRecycle.reset(),t.renderQueueQueryRecycle.reset(),jit.reset()},e.clear=function(){this.resetPool(),this.frustumCullings.clear(),this.frustumCullingResults.length=0,this.lightBoundsCullings.clear(),this.lightBoundsCullingResults.length=0,this.renderQueueIndex.clear(),this.renderQueues.length=0,this.renderQueueQueryIndex.clear(),this.numLightBoundsCulling=0,this.numFrustumCulling=0,this.numRenderQueues=0},e.buildRenderQueues=function(t,e,i){this.layoutGraph=e,this.renderGraph=t,Int=i,this.collectCullingQueries(t),this.batchFrustumCulling(i),this.batchLightBoundsCulling(),this.fillRenderQueues()},e.getOrCreateLightBoundsCulling=function(t,e){var i;if(!(4&t.cullingFlags))return 4294967295;if((null===(i=t.shadingLight)||void 0===i?void 0:i.type)===BD.DIRECTIONAL)return 4294967295;if(!this.enableLightCulling)return 4294967295;var n=t.scene,r=this.lightBoundsCullings.get(n);if(!r){var s=this.cullingPools.lightBoundsCullingRecycle.add();s.update(),this.lightBoundsCullings.set(n,s),r=this.lightBoundsCullings.get(n)}var o=Rnt(t,!1,e),a=r.resultIndex.get(o);if(void 0!==a)return a;var h=this.numLightBoundsCulling++;this.numLightBoundsCulling>this.lightBoundsCullingResults.length&&this.lightBoundsCullingResults.push(this.cullingPools.lightBoundsCullingResultRecycle.add().update()),r.resultIndex.set(o,h);var u=this.cullingPools.lightBoundsCullingKeyRecycle.add();return u.update(t,e),r.resultKeyIndex.set(o,u),h},e.getOrCreateFrustumCulling=function(t){var e=this.renderGraph.j(t),i=e.scene,n=this.frustumCullings.get(i);if(!n){var r=this.cullingPools.frustumCullingsRecycle.add();r.update(),this.frustumCullings.set(i,r),n=this.frustumCullings.get(i)}var s=Fit(e.flags&ctt.SHADOW_CASTER),o=Rnt(e,s),a=n.resultIndex.get(o);if(void 0!==a)return a;var h=this.numFrustumCulling++;this.numFrustumCulling>this.frustumCullingResults.length&&this.frustumCullingResults.push([]),n.resultIndex.set(o,h);var u=this.cullingPools.frustumCullingKeyRecycle.add();return u.update(e,s),n.resultKeyIndex.set(o,u),h},e.getOrCreateRenderQueue=function(t,e,i){var n=this.renderQueueIndex.get(t);if(void 0!==n)return this.renderQueues[n].sceneFlags|=e&this.kDrawMask,n;var r=this.numRenderQueues++;if(this.numRenderQueues>this.renderQueues.length){var s=this.cullingPools.renderQueueRecycle.add();s.update(),this.renderQueues.push(s)}var o=this.renderQueues[r];return this.renderQueueIndex.set(t,r),o.camera=i,o.sceneFlags=e&this.kAllMask,r},e.collectCullingQueries=function(t){for(var e,i=f(t.v());!(e=i()).done;){var n=e.value;if(t.h(9,n)&&t.getValid(n)){var r=t.j(n);if(r.scene){var s=this.getOrCreateFrustumCulling(n),o=this.getOrCreateLightBoundsCulling(r,s),a=t.getParent(n),h=Lnt(s,o,t.j(a).phaseID),u=this.getOrCreateRenderQueue(h,r.flags,r.camera),l=this.cullingPools.renderQueueQueryRecycle.add();l.update(s,o,u),this.renderQueueQueryIndex.set(n,l)}}}},e.uploadInstancing=function(t){for(var e=0;e!==this.numRenderQueues;++e){var i=this.renderQueues[e];i.opaqueInstancingQueue.uploadBuffers(t),i.transparentInstancingQueue.uploadBuffers(t)}},e._getPhaseIdFromScene=function(t){var e=this.renderGraph,i=e.getParent(t);return e.j(i).phaseID},e.getBuiltinShadowFrustum=function(t,e,i,n){var r=t.csmLayers,s=i.csmLevel,o=t.shadows;return o.type===hT.Planar?e.frustum:(o.enabled&&o.type===hT.ShadowMap&&i&&i.node&&r.update(t,e),i.shadowFixedArea||s===lT.LEVEL_1?r.specialLayer.validFrustum:r.layers[n].validFrustum)},e.batchFrustumCulling=function(t){for(var e,i=f(this.frustumCullings);!(e=i()).done;)for(var n,r=e.value,s=r[0],o=r[1],a=f(o.resultIndex);!(n=a()).done;){var h=n.value,u=h[0],l=h[1],c=o.resultKeyIndex.get(u),_=c.sceneData,d=_.light.light,p=_.light.level,m=c.castShadows,g=_.light.probe,y=g?g.camera:_.camera,v=this.frustumCullingResults[l];if(g)znt(s,y,y.frustum,m,g,v);else if(d)switch(d.type){case BD.SPOT:znt(s,y,d.frustum,m,null,v);break;case BD.DIRECTIONAL:znt(s,y,this.getBuiltinShadowFrustum(t,y,d,p),m,null,v)}else znt(s,y,y.frustum,m,null,v)}},e.executeSphereLightCulling=function(t,e,i){for(var n,r=t.aabb,s=f(e);!(n=s()).done;){var o=n.value,a=o.worldBounds;a&&!gs.aabbWithAABB(a,r)||i.push(o)}},e.executeSpotLightCulling=function(t,e,i){for(var n,r=t.aabb,s=t.frustum,o=f(e);!(n=o()).done;){var a=n.value,h=a.worldBounds;(!h||gs.aabbWithAABB(r,h)&&gs.aabbFrustum(h,s))&&i.push(a)}},e.executePointLightCulling=function(t,e,i){for(var n,r=t.aabb,s=f(e);!(n=s()).done;){var o=n.value,a=o.worldBounds;a&&!gs.aabbWithAABB(r,a)||i.push(o)}},e.executeRangedDirectionalLightCulling=function(t,e,i){qnt.transform(t.node.worldMatrix,null,null,null,Knt);for(var n,r=f(e);!(n=r()).done;){var s=n.value,o=s.worldBounds;o&&!gs.aabbWithAABB(Knt,o)||i.push(s)}},e.batchLightBoundsCulling=function(){for(var t,e=f(this.lightBoundsCullings);!(t=e()).done;){var i=t.value;i[0];for(var n,r=i[1],s=f(r.resultIndex);!(n=s()).done;){var o=n.value,a=o[0],h=o[1],u=r.resultKeyIndex.get(a),l=u.sceneData,c=u.frustumCullingID,_=this.frustumCullingResults[c],d=this.lightBoundsCullingResults[h];switch(l.shadingLight.type){case BD.SPHERE:var p=l.shadingLight;this.executeSphereLightCulling(p,_,d.instances);break;case BD.SPOT:var m=l.shadingLight;this.executeSpotLightCulling(m,_,d.instances);break;case BD.POINT:var g=l.shadingLight;this.executePointLightCulling(g,_,d.instances);break;case BD.RANGED_DIRECTIONAL:var y=l.shadingLight;this.executeRangedDirectionalLightCulling(y,_,d.instances);break;case BD.DIRECTIONAL:case BD.UNKNOWN:}}}},e._getModelsByCullingResults=function(t,e){return 4294967295!==t?t<this.lightBoundsCullingResults.length?this.lightBoundsCullingResults[t].instances:[]:e<this.frustumCullingResults.length?this.frustumCullingResults[e]:[]},e.fillRenderQueues=function(){for(var t,e=f(this.renderQueueIndex);!(t=e()).done;){var i=t.value,n=i[0],r=i[1],s=this.renderQueues[r],o=Nnt(n),a=o[0],h=o[1],u=o[2],l=Fit(s.sceneFlags&ctt.BLEND),c=Fit(s.sceneFlags&(ctt.OPAQUE|ctt.MASK)),_=Fit(s.sceneFlags&ctt.SHADOW_CASTER),d=Fit(s.sceneFlags&ctt.REFLECTION_PROBE);if(_||l||c||d){for(var p,m=this._getModelsByCullingResults(h,a),g=s.camera,y=f(m);!(p=y()).done;)Wnt(u,c,l,d,g,p.value,s);s.sort()}}},t}(),Znt=function(){function t(){this.cpuBuffer=void 0,this.programLibrary=void 0,this.device=null,this.elementSize=0,this.maxNumLights=16,this.binding=4294967295,this.resized=!1,this.lightBuffer=void 0,this.firstLightBufferView=null,this.lights=[],this.lightIndex=new Map}var e=t.prototype;return e.init=function(t,e,i){this.device=e,this.programLibrary=t;var n=this.programLibrary.localLayoutData,r=t.layoutGraph.attributeIndex.get("CCForwardLight"),s=n.uniformBlocks.get(r);this.elementSize=function(t,e){return t+(e-1)&~(e-1)}(function(t){for(var e,i=0,n=f(t);!(e=n()).done;){var r=e.value;if(r.count)i+=Af(r.type)*r.count;else{var s=lnt.get(r.name);if(void 0===s)if("cc_joints"!==r.name)z("Invalid uniform count: "+r.name);else{var o=Af(r.type)*Ry.LAYOUT.members[0].count;H(o!==Ry.SIZE),i+=o}else i+=Af(r.type)*s}}return H(!!i),i}(s.members),this.device.capabilities.uboOffsetAlignment),this.maxNumLights=i,this.binding=t.localLayoutData.bindingMap.get(r);var o=this.elementSize*this.maxNumLights;this.lightBuffer=this.device.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,o,this.elementSize)),this.firstLightBufferView=this.device.createBuffer(new C_(this.lightBuffer,0,this.elementSize)),this.cpuBuffer=new Float32Array(o/Float32Array.BYTES_PER_ELEMENT),this.resized=!0},e.buildLights=function(t,e,i){for(var n,r=f(t.lightBoundsCullings);!(n=r()).done;){var s=n.value;s[0];for(var o,a=s[1],h=f(a.resultIndex);!(o=h()).done;){var u=o.value,l=u[0],c=u[1],_=a.resultKeyIndex.get(l).sceneData,d=1;if(_.camera)d=_.camera.exposure;else{if(!_.light.probe||!_.light.probe.camera)throw new Error("Unexpected situation: No camera or probe found.");d=_.light.probe.camera.exposure}var p=this.addLight(_.shadingLight,e,d,i);t.lightBoundsCullingResults[c].lightByteOffset=p}}for(var m,g=f(t.renderQueueQueryIndex);!(m=g()).done;){var y=m.value;y[0];var v=y[1];if(4294967295!==v.lightBoundsCulledResultID){var S=t.lightBoundsCullingResults[v.lightBoundsCulledResultID].lightByteOffset;t.renderQueues[v.renderQueueTarget].lightByteOffset=S}}},e.tryUpdateRenderSceneLocalDescriptorSet=function(t){if(t.lightBoundsCullings.size){for(var e,i=f(t.frustumCullings);!(e=i()).done;){var n=e.value,r=n[0];n[1];for(var s,o=f(r.models);!(s=o()).done;){var a=s.value;if(!a)throw new Error("Unexpected null model.");for(var h,u=f(a.subModels);!(h=u()).done;){var l=h.value.descriptorSet,c=l.getBuffer(this.binding);(this.resized||c!==this.firstLightBufferView)&&(l.bindBuffer(this.binding,this.firstLightBufferView),l.update())}}}this.resized=!1}},e.clear=function(){this.cpuBuffer.fill(0),this.lights.length=0,this.lightIndex.clear()},e.addLight=function(t,e,i,n){var r=this.lightIndex.get(t);if(void 0!==r)return r;if(this.lights.length===this.maxNumLights){this.resized=!0,this.maxNumLights*=2;var s=this.elementSize*this.maxNumLights;this.lightBuffer.resize(s),this.firstLightBufferView=this.device.createBuffer(new C_(this.lightBuffer,0,this.elementSize));var o=this.cpuBuffer;this.cpuBuffer=new Float32Array(s/Float32Array.BYTES_PER_ELEMENT),this.cpuBuffer.set(o)}var a=this.lights.length;this.lights[a]=t,this.lightIndex.set(t,a);var h=this.elementSize/Float32Array.BYTES_PER_ELEMENT*a;return function(t,e,i,n,r,s){var o=new Float32Array(4),a=0,h=0,u=0,l=0;if(t&&t.type===BD.SPHERE){var c=t;o[0]=c.position.x,o[1]=c.position.y,o[2]=c.position.z,o[3]=BD.SPHERE,a=c.size,h=c.range,u=c.luminanceHDR,l=c.luminanceLDR}else if(t&&t.type===BD.SPOT){var _=t;o[0]=_.position.x,o[1]=_.position.y,o[2]=_.position.z,o[3]=BD.SPOT,a=_.size,h=_.range,u=_.luminanceHDR,l=_.luminanceLDR}else if(t&&t.type===BD.POINT){var f=t;o[0]=f.position.x,o[1]=f.position.y,o[2]=f.position.z,o[3]=BD.POINT,a=0,h=f.range,u=f.luminanceHDR,l=f.luminanceLDR}else if(t&&t.type===BD.RANGED_DIRECTIONAL){var d=t;o[0]=d.position.x,o[1]=d.position.y,o[2]=d.position.z,o[3]=BD.RANGED_DIRECTIONAL,a=0,h=0,u=d.illuminanceHDR,l=d.illuminanceLDR}var p=s+Ey.LIGHT_POS_OFFSET;r.set(o,p),p=s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET,o.set([a,h,0,0]),r.set(o,p),p=s+Ey.LIGHT_COLOR_OFFSET;var m=t?t.color:new S_;if(t&&t.useColorTemperature){var g=t.colorTemperatureRGB;r[p++]=m.x*g.x,r[p++]=m.y*g.y,r[p++]=m.z*g.z}else r[p++]=m.x,r[p++]=m.y,r[p++]=m.z;switch(r[p]=e?u*i*1e4:l,t?t.type:BD.UNKNOWN){case BD.SPHERE:r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=0,r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=0;break;case BD.SPOT:var y=t;r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=y.spotAngle,r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=n&&n.enabled&&y.shadowEnabled&&n.type===hT.ShadowMap?1:0,p=s+Ey.LIGHT_DIR_OFFSET;var v=y.direction;r[p++]=v.x,r[p++]=v.y,r[p]=v.z,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+0]=0,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+1]=0,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+2]=0,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+3]=y.angleAttenuationStrength;break;case BD.POINT:r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=0,r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=0;break;case BD.RANGED_DIRECTIONAL:var S=t,A=S.right;r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+0]=A.x,r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+1]=A.y,r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+2]=A.z,r[s+Ey.LIGHT_SIZE_RANGE_ANGLE_OFFSET+3]=0;var T=S.direction;r[s+Ey.LIGHT_DIR_OFFSET+0]=T.x,r[s+Ey.LIGHT_DIR_OFFSET+1]=T.y,r[s+Ey.LIGHT_DIR_OFFSET+2]=T.z,r[s+Ey.LIGHT_DIR_OFFSET+3]=0;var b=S.scale;r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+0]=.5*b.x,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+1]=.5*b.y,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+2]=.5*b.z,r[s+Ey.LIGHT_BOUNDING_SIZE_VS_OFFSET+3]=0}}(t,e,i,n,this.cpuBuffer,h,this.elementSize),a*this.elementSize},e.buildLightBuffer=function(t){t.updateBuffer(this.lightBuffer,this.cpuBuffer,this.lights.length*this.elementSize/Float32Array.BYTES_PER_ELEMENT)},t}(),Jnt=function(){function t(t){void 0===t&&(t=""),this.name=void 0,this.name=t,jnt&&jnt.pipeline.resourceUses.push(t)}var e=t.prototype;return e.checkTexture=function(t){var e=jnt.deviceTextures.get(t),i=jnt.resourceGraph.vertex(this.name),n=jnt.resourceGraph.getDesc(i),r=!1;return e.texture?r=e.texture.width===n.width&&e.texture.height===n.height:e.swapchain&&(r=e.swapchain.width===n.width&&e.swapchain.height===n.height),r},e.createDeviceTex=function(t){if(jnt.deviceTextures.get(this.name)){if(!this.checkTexture(this.name)){var e;null===(e=jnt.deviceTextures.get(this.name).texture)||void 0===e||e.destroy();var i=new trt(this.name,t);jnt.deviceTextures.set(this.name,i)}}else{var n=new trt(this.name,t);jnt.deviceTextures.set(this.name,n)}},e.checkBuffer=function(t){var e=jnt.deviceBuffers.get(t),i=jnt.resourceGraph.vertex(this.name),n=jnt.resourceGraph.getDesc(i);return e.buffer.size>=n.width},e.createDeviceBuf=function(t){if(jnt.deviceBuffers.get(this.name)){if(!this.checkBuffer(this.name)){var e;null===(e=jnt.deviceBuffers.get(this.name).buffer)||void 0===e||e.destroy();var i=new ert(this.name,t);jnt.deviceBuffers.set(this.name,i)}}else{var n=new ert(this.name,t);jnt.deviceBuffers.set(this.name,n)}},e.managed=function(t){this.createDeviceTex(t)},e.managedBuffer=function(t){this.createDeviceBuf(t)},e.managedTexture=function(){},e.persistentBuffer=function(t){this.createDeviceBuf(t)},e.persistentTexture=function(t){this.createDeviceTex(t)},e.framebuffer=function(t){this.createDeviceTex(t)},e.swapchain=function(t){this.createDeviceTex(t)},e.formatView=function(){},e.subresourceView=function(){},n(t,[{key:"resName",set:function(t){this.name=t}}]),t}(),$nt=function(){function t(t){this._name=void 0,this._name=t}return n(t,[{key:"name",get:function(){return this._name}}]),t}(),trt=function(t){function e(e,i){var n;(n=t.call(this,e)||this)._texture=null,n._swapchain=null,n._framebuffer=null,n._desc=null,n._trait=null;var r=jnt.resourceGraph,s=r.vertex(e);if(n._desc=r.getDesc(s),n._trait=r.getTraits(s),i instanceof Xf)return n._texture=i,c(n);if(i instanceof Mf)return n._framebuffer=i,c(n);if(i instanceof eet)return n._swapchain=i.swapchain,c(n);var o=n._desc,a=Dc.TEX2D;switch(o.dimension){case utt.TEXTURE1D:a=Dc.TEX1D;break;case utt.TEXTURE2D:a=Dc.TEX2D;break;case utt.TEXTURE3D:a=Dc.TEX3D}var h=Rc.NONE;return o.flags<t.COLOR_ATTACHMENT&&(h|=Rc.COLOR_ATTACHMENT),o.flags<t.DEPTH_STENCIL_ATTACHMENT&&(h|=Rc.DEPTH_STENCIL_ATTACHMENT),o.flags<t.INPUT_ATTACHMENT&&(h|=Rc.INPUT_ATTACHMENT),o.flags<t.SAMPLED&&(h|=Rc.SAMPLED),o.flags<t.STORAGE&&(h|=Rc.STORAGE),o.flags<t.TRANSFER_SRC&&(h|=Rc.TRANSFER_SRC),o.flags<t.TRANSFER_DST&&(h|=Rc.TRANSFER_DST),n._texture=jnt.device.createTexture(new R_(a,h,o.format,o.width,o.height)),n}return s(e,t),e.prototype.release=function(){this.framebuffer&&(this.framebuffer.destroy(),this._framebuffer=null),this.texture&&(this.texture.destroy(),this._texture=null)},n(e,[{key:"texture",get:function(){return this._texture}},{key:"framebuffer",get:function(){return this._framebuffer},set:function(t){this._framebuffer=t}},{key:"description",get:function(){return this._desc}},{key:"trait",get:function(){return this._trait}},{key:"swapchain",get:function(){return this._swapchain}}]),e}($nt),ert=function(t){function e(e){var i;(i=t.call(this,e)||this)._buffer=void 0;var n=jnt.resourceGraph,r=n.vertex(e),s=n.getDesc(r),o=new E_;return o.size=s.width,o.memUsage=wc.DEVICE,s.flags<t.INDIRECT&&(o.usage|=Ec.INDIRECT),s.flags<t.UNIFORM&&(o.usage|=Ec.UNIFORM),s.flags<t.STORAGE&&(o.usage|=Ec.STORAGE),s.flags<t.TRANSFER_SRC&&(o.usage|=Ec.TRANSFER_SRC),s.flags<t.TRANSFER_DST&&(o.usage|=Ec.TRANSFER_DST),i._buffer=jnt.device.createBuffer(o),i}return s(e,t),e.prototype.release=function(){this._buffer&&(this._buffer.destroy(),this._buffer=null)},n(e,[{key:"buffer",get:function(){return this._buffer}}]),e}($nt),irt=new Float32Array(4),nrt=function(){function t(t,e){this._isUpdate=!1,this._isGatherLight=!1,this._blit=void 0,this._screenQuad=null,this._queue=null,this._stageDesc=void 0,this._lightVolumeBuffer=null,this._lightMeterScale=1e4,this._lightBufferData=void 0,this._blit=t,this._queue=e}var e=t.prototype;return e._createQuadInputAssembler=function(){return jnt.blit.pipelineIAData},e.createScreenQuad=function(){this._screenQuad||(this._screenQuad=this._createQuadInputAssembler())},e._gatherVolumeLights=function(t){if(t.scene){for(var e=jnt.pipeline,i=jnt.commandBuffer,n=t.scene.sphereLights,r=t.scene.spotLights,s=Dr.create(0,0,0,1),o=t.exposure,a=0,h=Cy.LIGHTS_PER_PASS,u=ln.length,l=u*h,c=0;c<n.length&&a<h;c++,++a){var _=n[c];if(Dr.set(s,_.position.x,_.position.y,_.position.z,_.range),gs.sphereFrustum(s,t.frustum)){if(mn.toArray(irt,_.position),irt[3]=0,this._lightBufferData.set(irt,a*u),mn.toArray(irt,_.color),_.useColorTemperature){var f=_.colorTemperatureRGB;irt[0]*=f.x,irt[1]*=f.y,irt[2]*=f.z}e.pipelineSceneData.isHDR?irt[3]=_.luminance*o*this._lightMeterScale:irt[3]=_.luminance,this._lightBufferData.set(irt,a*u+1*l),irt[0]=_.size,irt[1]=_.range,irt[2]=0,this._lightBufferData.set(irt,a*u+2*l)}}for(var d=0;d<r.length&&a<h;d++,++a){var p=r[d];if(Dr.set(s,p.position.x,p.position.y,p.position.z,p.range),gs.sphereFrustum(s,t.frustum)){if(mn.toArray(irt,p.position),irt[3]=1,this._lightBufferData.set(irt,a*u+0*l),mn.toArray(irt,p.color),p.useColorTemperature){var m=p.colorTemperatureRGB;irt[0]*=m.x,irt[1]*=m.y,irt[2]*=m.z}e.pipelineSceneData.isHDR?irt[3]=p.luminance*o*this._lightMeterScale:irt[3]=p.luminance,this._lightBufferData.set(irt,a*u+1*l),irt[0]=p.size,irt[1]=p.range,irt[2]=p.spotAngle,this._lightBufferData.set(irt,a*u+2*l),mn.toArray(irt,p.direction),this._lightBufferData.set(irt,a*u+3*l)}}var g=3*l+3;this._lightBufferData.set([a],g),i.updateBuffer(this._lightVolumeBuffer,this._lightBufferData)}},e.update=function(){this.blit.sceneFlags&ctt.VOLUMETRIC_LIGHTING&&this.blit.camera&&!this._isGatherLight&&(this._gatherVolumeLights(this.blit.camera),this._isGatherLight=!0,this._isUpdate=!1),this._isUpdate||(this._stageDesc.update(),this._isUpdate=!0)},e.reset=function(){this._isUpdate=!1,this._isGatherLight=!1},e.createStageDescriptor=function(){var t=this.blit,e=t.material.passes[t.passID],i=jnt.device;if(this._stageDesc=jnt.blit.stageDescs.get(e),this._stageDesc||(this._stageDesc=i.createDescriptorSet(new ef(e.localSetLayout)),jnt.blit.stageDescs.set(e,this._stageDesc)),this.blit.sceneFlags&ctt.VOLUMETRIC_LIGHTING){this._lightVolumeBuffer=jnt.blit.lightVolumeBuffer;var n=jnt.blit.deferredLitsBufView;this._lightBufferData=jnt.blit.lightBufferData,this._lightBufferData.fill(0),this._stageDesc.bindBuffer(Ey.BINDING,n)}this._stageDesc.bindBuffer(vy.BINDING,jnt.blit.emptyLocalUBO)},n(t,[{key:"screenQuad",get:function(){return this._screenQuad}},{key:"blit",get:function(){return this._blit},set:function(t){this._blit=t}},{key:"stageDesc",get:function(){return this._stageDesc}}]),t}(),rrt=function(){function t(){this._devicePass=void 0,this._hint=htt.NONE,this._phaseID=zA("default"),this._renderPhase=null,this._descSetData=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._queueId=-1}var e=t.prototype;return e.preRecord=function(){},e.postRecord=function(){},e.init=function(t,e,i){this.reset(),this.queueHint=e.hint,this.queueId=i,this._devicePass=t,this._phaseID=v.rendering.getPhaseID(t.passID,jnt.renderGraph.getLayout(i))},e.reset=function(){this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&jnt.commandBuffer.bindDescriptorSet(Jg.COUNT,this._descSetData.descriptorSet)},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=jnt.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.descriptorSets.get(ttt.PER_PHASE)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),srt=function(){function t(){this._renderScenes=[],this._devicePass=void 0,this._hint=htt.NONE,this._graphQueue=void 0,this._phaseID=zA("default"),this._renderPhase=null,this._descSetData=null,this._viewport=null,this._scissor=null,this._layoutID=-1,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,this._blitDesc=null,this._queueId=-1}var e=t.prototype;return e.init=function(t,e,i){this.reset(),this._graphQueue=e,this.queueHint=e.hint;var n=this._viewport=e.viewport;n&&(this._scissor=new __(n.left,n.top,n.width,n.height)),this.queueId=i,this._devicePass=t,this._phaseID=v.rendering.getPhaseID(t.passID,jnt.renderGraph.getLayout(i))},e.createBlitDesc=function(t){this._blitDesc||(this._blitDesc=new nrt(t,this)),this._blitDesc.createScreenQuad(),this._blitDesc.createStageDescriptor()},e.setScene=function(t,e,i){var n=jnt.pools.addDeviceScene();return n.init(this,t,e,i),this._renderScenes.push(n),n},e.reset=function(){var t;this._renderScenes.length=0,this._isUpdateUBO=!1,this._isUploadInstance=!1,this._isUploadBatched=!1,null===(t=this._blitDesc)||void 0===t||t.reset()},e.preRecord=function(){},e.record=function(){this._descSetData&&this._descSetData.descriptorSet&&jnt.commandBuffer.bindDescriptorSet(Jg.COUNT,this._descSetData.descriptorSet),this._renderScenes.forEach((function(t){t.record()}))},e.postRecord=function(){},n(t,[{key:"phaseID",get:function(){return this._phaseID}},{key:"layoutID",get:function(){return this._layoutID},set:function(t){this._layoutID=t;var e=jnt.layoutGraph;this._renderPhase=e.h(1,t)?e.j(t):null;var i=e.getLayout(t);this._descSetData=i.descriptorSets.get(ttt.PER_PHASE)}},{key:"descSetData",get:function(){return this._descSetData}},{key:"renderPhase",get:function(){return this._renderPhase}},{key:"viewport",get:function(){return this._viewport}},{key:"scissor",get:function(){return this._scissor}},{key:"queueId",get:function(){return this._queueId},set:function(t){this._queueId=t}},{key:"isUpdateUBO",get:function(){return this._isUpdateUBO},set:function(t){this._isUpdateUBO=t}},{key:"isUploadInstance",get:function(){return this._isUploadInstance},set:function(t){this._isUploadInstance=t}},{key:"isUploadBatched",get:function(){return this._isUploadBatched},set:function(t){this._isUploadBatched=t}},{key:"graphQueue",get:function(){return this._graphQueue}},{key:"blitDesc",get:function(){return this._blitDesc}},{key:"renderScenes",get:function(){return this._renderScenes}},{key:"queueHint",get:function(){return this._hint},set:function(t){this._hint=t}},{key:"devicePass",get:function(){return this._devicePass}}]),t}(),ort=function(){function t(t,e,i){this._layoutID=0,this._vertID=-1,this._stage=null,this._layout=void 0,this._inputName=void 0,this._descriptorSet=null,this._inputName=i[0],this._layoutID=t,this._vertID=e;var n=jnt.layoutGraph;this._stage=n.j(t),this._layout=n.getLayout(t);var r=this._layout.descriptorSets.get(ttt.PER_PASS);if(r){var s=r.descriptorSet,o=jnt.deviceTextures.get(this._inputName),a=null==o?void 0:o.texture,h=jnt.deviceBuffers.get(this._inputName),u=null==h?void 0:h.buffer;if(!a&&!u)throw Error("Could not find texture with resource name "+this._inputName);for(var l,c=jnt.resourceGraph.vertex(this._inputName),_=jnt.resourceGraph.getSampler(c),d=f(i[1]);!(l=d()).done;)for(var p,m=l.value.name,g=n.attributeIndex.get(m),y=f(r.descriptorSetLayoutData.descriptorBlocks);!(p=y()).done;)for(var v=p.value,S=0;S!==v.descriptors.length;++S)if(g!==v.descriptors[S].descriptorID);else{if(a){s.bindTexture(v.offset+S,a);var A=jnt.renderGraph.getData(this._vertID);s.bindSampler(v.offset+S,A.samplers.get(g)||jnt.device.getSampler(_))}else if(jnt.resourceGraph.getDesc(c).flags<t.STORAGE){var T=i[1][0].accessType!==ftt.READ?Wc.COMPUTE_SHADER_WRITE:Wc.COMPUTE_SHADER_READ_OTHER;s.bindBuffer(v.offset+S,u,0,T)}else s.bindBuffer(v.offset+S,u);this._descriptorSet||(this._descriptorSet=s)}}}return n(t,[{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"layoutID",get:function(){return this._layoutID}},{key:"vertID",get:function(){return this._vertID}},{key:"stage",get:function(){return this._stage}},{key:"layout",get:function(){return this._layout}}]),t}(),art=new v_,hrt=new __,urt=new Jnt,lrt=function(){function t(t,e){this._renderPass=void 0,this._framebuffer=void 0,this._clearColor=[],this._deviceQueues=new Map,this._clearDepth=1,this._clearStencil=0,this._passID=void 0,this._rasterID=void 0,this._rasterPass=void 0,this._layoutName=void 0,this._viewport=null,this._layout=null,this._idxOfRenderData=0,this._rasterID=t,this._rasterPass=e;var i=jnt.device;this._layoutName=jnt.renderGraph.getLayout(t),this._passID=v.rendering.getPassID(this._layoutName);var n=new j_;n.format=Ac.DEPTH_STENCIL;for(var r,s=[],o=[],a=null,h=null,u=null,l=f(e.computeViews);!(r=l()).done;){var c=r.value;this._applyRenderLayout(c)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update();for(var _,d=f(e.rasterViews);!(_=d()).done;){var p=_.value,m=p[0],g=p[1],y=jnt.deviceTextures.get(m);if(y){var S=jnt.resourceGraph,A=S.vertex(m),T=S.object(A);if(y.framebuffer&&T instanceof Mf&&y.framebuffer!==T)y.framebuffer=T;else if(y.texture){var b=S.getDesc(A);y.texture.width===b.width&&y.texture.height===b.height||y.texture.resize(b.width,b.height)}}else this.visitResource(m),y=jnt.deviceTextures.get(m);switch(h||(h=y.swapchain),u||(u=y.framebuffer),g.attachmentType){case ptt.RENDER_TARGET:y.swapchain||y.framebuffer||o.push(y.texture);var E=new W_;E.format=y.description.format,E.sampleCount=y.description.sampleCount,E.loadOp=g.loadOp,E.storeOp=g.storeOp,E.barrier=i.getGeneralBarrier(new K_(g.loadOp===zc.LOAD?Wc.COLOR_ATTACHMENT_WRITE:Wc.NONE,g.storeOp===Hc.STORE?Wc.COLOR_ATTACHMENT_WRITE:Wc.NONE));var C=new S_;C.copy(g.clearColor),this._clearColor.push(C),s.push(E);break;case ptt.DEPTH_STENCIL:n.depthStoreOp=g.storeOp,n.stencilStoreOp=g.storeOp,n.depthLoadOp=g.loadOp,n.stencilLoadOp=g.loadOp,n.barrier=i.getGeneralBarrier(new K_(g.loadOp===zc.LOAD?Wc.DEPTH_STENCIL_ATTACHMENT_WRITE:Wc.NONE,g.storeOp===Hc.STORE?Wc.DEPTH_STENCIL_ATTACHMENT_WRITE:Wc.NONE)),y.swapchain||y.framebuffer?y.swapchain&&(a=y.swapchain.depthStencilTexture):a=y.texture,this._clearDepth=g.clearColor.x,this._clearStencil=g.clearColor.y}}if(0===s.length){var x=new W_;s.push(x)}if(0===o.length&&!h&&!u){var w=i.createTexture(new R_);o.push(w)}var D=new q_;D.colorAttachments=s,(h?h.depthStencilTexture:a)&&(D.depthStencilAttachment=n),this._renderPass=i.createRenderPass(D),this._framebuffer=u||i.createFramebuffer(new J_(this._renderPass,h?[h.colorTexture]:o,h?h.depthStencilTexture:a))}var e=t.prototype;return e.addIdxOfRD=function(){this._idxOfRenderData++},e.visitResource=function(t){var e=jnt.resourceGraph,i=e.vertex(t);urt.resName=t,e.visitVertex(urt,i)},e.addQueue=function(t){this._deviceQueues.set(t.queueId,t)},e.preRecord=function(){jnt.passDescriptorSet=Cit(this.layoutName).descriptorSet},e._applyRenderLayout=function(t){var e=jnt.renderGraph.getLayout(this._rasterID);if(e){var i=jnt.layoutGraph,n=i.locateChild(i.N,e);4294967295!==n&&(this._layout=new ort(n,this._rasterID,t))}},e.getGlobalDescData=function(){var t=jnt.layoutGraph.locateChild(jnt.layoutGraph.N,"default");return jnt.layoutGraph.getLayout(t).descriptorSets.get(ttt.PER_PASS)},e._applyViewport=function(){this._viewport=null;var t=this._rasterPass.viewport;0===t.left&&0===t.top&&0===t.width&&0===t.height||(this._viewport=t)},e._showProfiler=function(t){var e=jnt.pipeline.profiler;if(e&&e.enabled){var i=jnt.profilerDescriptorSet,n=this._renderPass,r=jnt.commandBuffer,s=e.subModels[0],o=s.passes[0],a=s.inputAssembler,h=jnt.device,u=nT.getOrCreatePipelineState(h,o,s.shaders[0],n,a);art.width=t.width,art.height=t.height,r.setViewport(art),r.setScissor(t),r.bindPipelineState(u),r.bindDescriptorSet(Jg.GLOBAL,i),r.bindDescriptorSet(Jg.MATERIAL,o.descriptorSet),r.bindDescriptorSet(Jg.LOCAL,s.descriptorSet),r.bindInputAssembler(a),r.draw(a)}},e.beginPass=function(){var t=this.framebuffer.colorTextures[0];this._applyViewport(t);var e=jnt.commandBuffer;this._viewport?(hrt.x=this._viewport.left,hrt.y=this._viewport.top,hrt.width=this._viewport.width,hrt.height=this._viewport.height):(hrt.y=hrt.x=0,hrt.width=t.width,hrt.height=t.height),e.beginRenderPass(this.renderPass,this.framebuffer,hrt,this.clearColor,this.clearDepth,this.clearStencil),jnt.passDescriptorSet&&e.bindDescriptorSet(Jg.GLOBAL,jnt.passDescriptorSet)},e.endPass=function(){jnt.commandBuffer.endRenderPass()},e.record=function(){this.beginPass();for(var t,e=f(this._deviceQueues.values());!(t=e()).done;)t.value.record();this._rasterPass.showStatistics&&this._showProfiler(hrt),this.endPass()},e.postRecord=function(){},e.resetResource=function(t,e){this._rasterID=t,this._rasterPass=e,this._layoutName=jnt.renderGraph.getLayout(t),this._passID=v.rendering.getPassID(this._layoutName),this._deviceQueues.clear(),this._idxOfRenderData=0;for(var i,n=null,r=[],s=this._framebuffer,o=s.depthStencilTexture,a=s?o:null,h=f(e.computeViews);!(i=h()).done;){var u=i.value;this._applyRenderLayout(u)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update();for(var l,c=jnt.resourceGraph,_=s?s.width:0,d=s?s.height:0,p=0,m=0,g=f(e.rasterViews);!(l=g()).done;){var y=l.value,S=y[0];if(y[1].attachmentType!==ptt.SHADING_RATE){var A=c.vertex(S),T=c.getDesc(A);p=T.width,m=T.height;break}}for(var b,E=!1,C=f(s.colorTextures);!(b=C()).done;){var x=b.value;if(0===(null==x?void 0:x.getTextureHandle())){E=!0;break}}o&&!E&&(E=0===o.getTextureHandle());for(var w,D=p!==_||m!==d||s.needRebuild||E,R=f(e.rasterViews);!(w=R()).done;){var I=w.value,M=I[0],P=I[1],B=jnt.deviceTextures.get(M),O=B;B||(this.visitResource(M),B=jnt.deviceTextures.get(M));var L=jnt.resourceGraph,N=L.vertex(M),F=L.object(N),k=L.getDesc(N);if(B.framebuffer&&F instanceof Mf&&(B.framebuffer!==F||F!==this._framebuffer))n=this._framebuffer=B.framebuffer=F;else if(!O||B.texture&&D){var V=B.texture;switch(O&&V.resize(k.width,k.height),P.attachmentType){case ptt.RENDER_TARGET:r.push(V);break;case ptt.DEPTH_STENCIL:a=V}}}!n&&r.length&&(this._framebuffer.destroy(),this._framebuffer=jnt.device.createFramebuffer(new J_(this._renderPass,r,a)))},n(t,[{key:"indexOfRD",get:function(){return this._idxOfRenderData}},{key:"rasterID",get:function(){return this._rasterID}},{key:"layoutName",get:function(){return this._layoutName}},{key:"passID",get:function(){return this._passID}},{key:"renderLayout",get:function(){return this._layout}},{key:"renderPass",get:function(){return this._renderPass}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"clearColor",get:function(){return this._clearColor}},{key:"clearDepth",get:function(){return this._clearDepth}},{key:"clearStencil",get:function(){return this._clearStencil}},{key:"deviceQueues",get:function(){return this._deviceQueues}},{key:"viewport",get:function(){return this._viewport}}]),t}(),crt=function(){function t(){this._id=void 0,this._pass=void 0}return t.prototype.applyInfo=function(t,e){this._id=t,this._pass=e},n(t,[{key:"id",get:function(){return this._id}},{key:"pass",get:function(){return this._pass}}]),t}(),_rt=function(){function t(t){this._deviceQueues=[],this._passID=void 0,this._layoutName=void 0,this._viewport=null,this._computeInfo=void 0,this._layout=null,this._computeInfo=t,this._layoutName=jnt.renderGraph.getLayout(t.id),this._passID=v.rendering.getPassID(this._layoutName);for(var e,i=f(t.pass.computeViews);!(e=i()).done;){var n=e.value,r=jnt.deviceTextures.get(n[0]);r||(this.visitResource(n[0]),r=jnt.deviceTextures.get(n[0])),this._applyRenderLayout(n)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update()}var e=t.prototype;return e.preRecord=function(){jnt.passDescriptorSet=Cit(this.layoutName).descriptorSet},e.postRecord=function(){},e.visitResource=function(t){var e=jnt.resourceGraph,i=e.vertex(t);urt.resName=t,e.visitVertex(urt,i)},e.addQueue=function(t){this._deviceQueues.push(t)},e._applyRenderLayout=function(t){var e=jnt.renderGraph.getLayout(this._computeInfo.id);if(e){var i=jnt.layoutGraph,n=i.locateChild(i.N,e);4294967295!==n&&(this._layout=new ort(n,this._computeInfo.id,t))}},e.getGlobalDescData=function(){var t=jnt.layoutGraph.locateChild(jnt.layoutGraph.N,"default");return jnt.layoutGraph.getLayout(t).descriptorSets.get(ttt.PER_PASS)},e.record=function(){var t=jnt.commandBuffer;jnt.passDescriptorSet&&t.bindDescriptorSet(Jg.GLOBAL,jnt.passDescriptorSet);for(var e,i=f(this._deviceQueues);!(e=i()).done;)e.value.record();xit(jnt.renderGraph.getData(this._computeInfo.id),-1,0,jnt.renderGraph.getLayout(this._computeInfo.id))},e.resetResource=function(t,e){this._computeInfo.applyInfo(t,e),this._layoutName=jnt.renderGraph.getLayout(t),this._passID=v.rendering.getPassID(this._layoutName),this._deviceQueues.length=0;for(var i,n=f(this._computeInfo.pass.computeViews);!(i=n()).done;){var r=i.value;this._applyRenderLayout(r)}this.renderLayout&&this.renderLayout.descriptorSet&&this.renderLayout.descriptorSet.update()},n(t,[{key:"layoutName",get:function(){return this._layoutName}},{key:"passID",get:function(){return this._passID}},{key:"renderLayout",get:function(){return this._layout}},{key:"deviceQueues",get:function(){return this._deviceQueues}},{key:"computePassInfo",get:function(){return this._computeInfo}}]),t}(),frt=new v_,drt=function(){function t(){this._currentQueue=void 0,this._renderPass=void 0,this._scene=null,this._camera=null,this._sceneData=void 0,this._blit=void 0,this._sceneID=-1}var e=t.prototype;return e.preRecord=function(){this._blit&&(this._currentQueue.createBlitDesc(this._blit),this._currentQueue.blitDesc.update()),jnt.lightResource.buildLightBuffer(jnt.commandBuffer),jnt.lightResource.tryUpdateRenderSceneLocalDescriptorSet(jnt.culling)},e.postRecord=function(){},e.init=function(t,e,i,n){this._currentQueue=t,this._sceneData=i,this._blit=n,this._sceneID=e,this._renderPass=t.devicePass.renderPass;var r=i&&i.camera?i.camera:null;r&&(this._scene=r.scene,this._camera=r)},e._recordUI=function(){var t=this._currentQueue.devicePass.rasterID,e=jnt.renderGraph.getData(t);this._updateGlobal(e,this.sceneID);var i=this._currentQueue.queueId,n=jnt.renderGraph.getData(i);this._updateGlobal(n,this.sceneID),this._currentQueue.isUpdateUBO=!0;for(var r=this.camera.scene.batches,s=0;s<r.length;s++){var o=r[s],a=!1;if(this.camera.visibility&o.visFlags&&(a=!0),a)for(var h=o.shaders.length,u=0;u<h;u++){var l=o.passes[u];if(l.phaseID===this._currentQueue.phaseID){var c=o.shaders[u],_=o.inputAssembler,f=nT.getOrCreatePipelineState(nd.gfxDevice,l,c,this._renderPass,_);jnt.commandBuffer.bindPipelineState(f),jnt.commandBuffer.bindDescriptorSet(Jg.MATERIAL,l.descriptorSet);var d=o.descriptorSet;jnt.commandBuffer.bindDescriptorSet(Jg.LOCAL,d),jnt.commandBuffer.bindInputAssembler(_),jnt.commandBuffer.draw(_)}}}},e._recordBlit=function(){if(this.blit){var t=this.blit,e=t.material.passes[t.passID];e.update();var i=e.getShaderVariant(),n=this._currentQueue.devicePass,r=this._currentQueue.blitDesc.screenQuad.quadIA,s=null;null!==e&&null!==i&&null!==r&&(s=nT.getOrCreatePipelineState(jnt.device,e,i,n.renderPass,r)),s&&(jnt.commandBuffer.bindPipelineState(s),jnt.commandBuffer.bindDescriptorSet(Jg.MATERIAL,e.descriptorSet),jnt.commandBuffer.bindDescriptorSet(Jg.LOCAL,this._currentQueue.blitDesc.stageDesc),jnt.commandBuffer.bindInputAssembler(r),jnt.commandBuffer.draw(r))}},e._updateGlobal=function(t,e){var i=this._currentQueue.devicePass;i.addIdxOfRD(),xit(t,e,i.indexOfRD,jnt.renderGraph.getLayout(i.rasterID))},e._updateRenderData=function(){if(!this._currentQueue.isUpdateUBO){var t=this._currentQueue.devicePass.rasterID,e=jnt.renderGraph.getData(t),i=this.sceneID;this._updateGlobal(e,i);var n=this._currentQueue.queueId,r=jnt.renderGraph.getData(n);this._updateGlobal(r,i);var s=jnt.renderGraph.getData(i);s&&this._updateGlobal(s,i),this._currentQueue.isUpdateUBO=!0}},e._applyViewport=function(){var t=this._currentQueue.viewport;if(t)jnt.commandBuffer.setViewport(t),jnt.commandBuffer.setScissor(this._currentQueue.scissor);else if(!this._currentQueue.devicePass.viewport){var e=this._currentQueue.devicePass.framebuffer.colorTextures[0],i=this.sceneData?this.sceneData.light:null,n=function(t){var e=v.director.root.pipeline.pipelineSceneData;return e.shadows.enabled&&e.shadows.type===hT.ShadowMap&&t&&0!=(t.flags&ctt.SHADOW_CASTER)}(this.sceneData)&&this.sceneData&&i.light?git(this.camera,e.width,e.height,i.light,i.level):git(this.camera,e.width,e.height);frt.left=n.x,frt.top=n.y,frt.width=n.width,frt.height=n.height,jnt.commandBuffer.setViewport(frt),jnt.commandBuffer.setScissor(n)}},e.record=function(){var t=this._currentQueue.devicePass,e=jnt.culling;if(this._updateRenderData(),this._applyViewport(),this.blit)this._recordBlit();else{var i,n=e.renderQueueQueryIndex.get(this.sceneID),r=e.renderQueues[n.renderQueueTarget],s=this.sceneData;Fit(s.flags&ctt.REFLECTION_PROBE)&&r.probeQueue.applyMacro(),r.recordCommands(jnt.commandBuffer,this._renderPass,s.flags),Fit(s.flags&ctt.REFLECTION_PROBE)&&r.probeQueue.removeMacro(),s.flags&ctt.GEOMETRY&&(null===(i=this.camera.geometryRenderer)||void 0===i||i.render(t.renderPass,jnt.commandBuffer,jnt.pipeline.pipelineSceneData)),s.flags&ctt.UI&&this._recordUI()}},n(t,[{key:"blit",get:function(){return this._blit}},{key:"sceneData",get:function(){return this._sceneData}},{key:"sceneID",get:function(){return this._sceneID}},{key:"camera",get:function(){return this._camera}}]),t}(),prt=function(){function t(){this.deviceQueuePool=void 0,this.computeQueuePool=void 0,this.passPool=void 0,this.deviceScenePool=void 0,this.deviceQueuePool=new Ks((function(){return new srt}),16),this.deviceScenePool=new Ks((function(){return new drt}),16),this.computeQueuePool=new Ks((function(){return new rrt}),16),this.passPool=new Ks((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64)}var e=t.prototype;return e.addDeviceQueue=function(){return this.deviceQueuePool.add()},e.addComputeQueue=function(){return this.computeQueuePool.add()},e.addDeviceScene=function(){return this.deviceScenePool.add()},e.reset=function(){this.deviceQueuePool.reset(),this.computeQueuePool.reset(),this.deviceScenePool.reset()},t}(),mrt=new Float32Array(16),grt=new __,yrt=function(){function t(t){this._pipelineIAData=void 0,this._context=void 0,this._width=void 0,this._height=void 0,this._lightVolumeBuffer=void 0,this._lightBufferData=void 0,this._deferredLitsBufView=void 0,this._localUBO=void 0,this._stageDescs=new Map,this._context=t,this._width=t.width,this._height=t.height,this._pipelineIAData=this._createQuadInputAssembler();var e=this._genQuadVertexData(vc.IDENTITY,new __(0,0,t.width,t.height));this._pipelineIAData.quadVB.update(e),this._createLightVolumes(),this._localUBO=t.device.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.DEVICE,vy.SIZE,vy.SIZE))}var e=t.prototype;return e.resize=function(t,e){if(t!==this._width||e!==this._height){grt.y=grt.x=0,grt.width=t,grt.height=e;var i=this._genQuadVertexData(vc.IDENTITY,grt);this._pipelineIAData.quadVB.update(i)}},e._createLightVolumes=function(){var t=this._context.root.device,e=20*Float32Array.BYTES_PER_ELEMENT*Cy.LIGHTS_PER_PASS;e=Math.ceil(e/t.capabilities.uboOffsetAlignment)*t.capabilities.uboOffsetAlignment,this._lightVolumeBuffer=t.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,e,t.capabilities.uboOffsetAlignment)),this._deferredLitsBufView=t.createBuffer(new C_(this._lightVolumeBuffer,0,e)),this._lightBufferData=new Float32Array(e/Float32Array.BYTES_PER_ELEMENT)},e._genQuadVertexData=function(t,e){var i=e.x/this._context.width,n=(e.x+e.width)/this._context.width,r=e.y/this._context.height,s=(e.y+e.height)/this._context.height;if(this._context.root.device.capabilities.screenSpaceSignY>0){var o=s;s=r,r=o}var a=0;switch(t){case vc.IDENTITY:a=0,mrt[a++]=-1,mrt[a++]=-1,mrt[a++]=i,mrt[a++]=s,mrt[a++]=1,mrt[a++]=-1,mrt[a++]=n,mrt[a++]=s,mrt[a++]=-1,mrt[a++]=1,mrt[a++]=i,mrt[a++]=r,mrt[a++]=1,mrt[a++]=1,mrt[a++]=n,mrt[a++]=r;break;case vc.ROTATE_90:a=0,mrt[a++]=-1,mrt[a++]=-1,mrt[a++]=n,mrt[a++]=s,mrt[a++]=1,mrt[a++]=-1,mrt[a++]=n,mrt[a++]=r,mrt[a++]=-1,mrt[a++]=1,mrt[a++]=i,mrt[a++]=s,mrt[a++]=1,mrt[a++]=1,mrt[a++]=i,mrt[a++]=r;break;case vc.ROTATE_180:a=0,mrt[a++]=-1,mrt[a++]=-1,mrt[a++]=i,mrt[a++]=r,mrt[a++]=1,mrt[a++]=-1,mrt[a++]=n,mrt[a++]=r,mrt[a++]=-1,mrt[a++]=1,mrt[a++]=i,mrt[a++]=s,mrt[a++]=1,mrt[a++]=1,mrt[a++]=n,mrt[a++]=s;break;case vc.ROTATE_270:a=0,mrt[a++]=-1,mrt[a++]=-1,mrt[a++]=i,mrt[a++]=r,mrt[a++]=1,mrt[a++]=-1,mrt[a++]=i,mrt[a++]=s,mrt[a++]=-1,mrt[a++]=1,mrt[a++]=n,mrt[a++]=r,mrt[a++]=1,mrt[a++]=1,mrt[a++]=n,mrt[a++]=s}return mrt},e._createQuadInputAssembler=function(){var t=new VI,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=v.director.root.device,r=n.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE|wc.HOST,i,e));if(!r)return t;var s=Uint16Array.BYTES_PER_ELEMENT,o=6*s,a=n.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,o,s));if(!a)return t;var h=new Uint16Array(6);h[0]=0,h[1]=1,h[2]=2,h[3]=1,h[4]=3,h[5]=2,a.update(h.buffer);var u=new Array(2);u[0]=new U_("a_position",Ac.RG32F),u[1]=new U_("a_texCoord",Ac.RG32F);var l=n.createInputAssembler(new H_(u,[r],a));return t.quadIB=a,t.quadVB=r,t.quadIA=l,t},n(t,[{key:"pipelineIAData",get:function(){return this._pipelineIAData}},{key:"deferredLitsBufView",get:function(){return this._deferredLitsBufView}},{key:"lightVolumeBuffer",get:function(){return this._lightVolumeBuffer}},{key:"lightBufferData",get:function(){return this._lightBufferData}},{key:"stageDescs",get:function(){return this._stageDescs}},{key:"emptyLocalUBO",get:function(){return this._localUBO}}]),t}(),vrt=function(){function t(t,e,i,n,r,s,o,a){void 0===a&&(a=null),this.device=void 0,this.pipeline=void 0,this.commandBuffer=void 0,this.pipelineSceneData=void 0,this.resourceGraph=void 0,this.devicePasses=new Map,this.deviceTextures=new Map,this.deviceBuffers=new Map,this.layoutGraph=void 0,this.root=void 0,this.pools=void 0,this.blit=void 0,this.culling=void 0,this.lightResource=new Znt,this.renderGraph=void 0,this.width=void 0,this.height=void 0,this.cullCamera=void 0,this.passDescriptorSet=void 0,this.profilerDescriptorSet=void 0,this.pipeline=t,this.device=e,this.commandBuffer=e.commandBuffer,this.pipelineSceneData=t.pipelineSceneData,this.resourceGraph=i,this.renderGraph=n,this.root=v.director.root,this.layoutGraph=r,this.width=s,this.height=o,this.pools=new prt,this.blit=new yrt(this),this.culling=new Qnt,this.passDescriptorSet=a,this.profilerDescriptorSet=Cit("default").descriptorSet}var e=t.prototype;return e.reset=function(){this.culling.clear(),this.pools.reset(),this.cullCamera=null,this.lightResource.clear()},e.resize=function(t,e){this.width=t,this.height=e,this.blit.resize(t,e)},t}(),Srt=function(){function t(t,e,i,n,r,s){this._context=void 0,this._visitor=void 0,jnt=this._context=new vrt(t,e,i,new Oet,n,r,s);var o=v.rendering.programLib;jnt.lightResource.init(o,e,16)}var e=t.prototype;return e.resize=function(t,e){jnt.resize(t,e)},e._removeDeviceResource=function(){for(var t,e=jnt.pipeline.resourceUses,i=[],n=jnt.deviceTextures,r=f(n);!(t=r()).done;){var s=t.value,o=s[0];s[1];var a=jnt.resourceGraph.vertex(o),h=jnt.resourceGraph.getTraits(a);if(!e.includes(o))switch(h.residency){case att.MANAGED:i.push(o)}}for(var u=0,l=i;u<l.length;u++){var c=l[u];n.get(c).release(),n.delete(c)}for(var _,d=[],p=jnt.deviceBuffers,m=f(p);!(_=m()).done;){var g=_.value,y=g[0];g[1];var v=jnt.resourceGraph.vertex(y),S=jnt.resourceGraph.getTraits(v);if(!e.includes(y))switch(S.residency){case att.MANAGED:d.push(y)}}for(var A=0,T=d;A<T.length;A++){var b=T[A];p.get(b).release(),p.delete(b)}e.length=0},e.execute=function(t){jnt.renderGraph=t,jnt.reset();var e=jnt.commandBuffer,i=jnt.culling;i.buildRenderQueues(t,jnt.layoutGraph,jnt.pipelineSceneData),jnt.lightResource.buildLights(i,jnt.pipelineSceneData.isHDR,jnt.pipelineSceneData.shadows),this._removeDeviceResource(),e.begin(),i.uploadInstancing(e),this._visitor||(this._visitor=new Ert),Ytt(this._visitor.graphView,this._visitor,this._visitor.colorMap),e.end(),jnt.device.queue.submit([e])},e.release=function(){jnt.devicePasses.clear();for(var t,e=f(jnt.deviceTextures);!(t=e()).done;){var i=t.value;i[0],i[1].release()}jnt.deviceTextures.clear();for(var n,r=f(jnt.deviceBuffers);!(n=r()).done;){var s=n.value;s[0],s[1].release()}jnt.deviceBuffers.clear()},t}(),Art=function(){function t(){this.queueID=4294967295,this.sceneID=4294967295,this.passID=4294967295,this.dispatchID=4294967295,this.currPass=void 0,this.currQueue=void 0,this.rg=void 0,this.rg=jnt.renderGraph}var e=t.prototype;return e._isRasterPass=function(t){return jnt.renderGraph.h(0,t)},e.isComputePass=function(t){return jnt.renderGraph.h(3,t)},e.isDispatch=function(t){return jnt.renderGraph.h(11,t)},e._isQueue=function(t){return jnt.renderGraph.h(8,t)},e._isScene=function(t){return jnt.renderGraph.h(9,t)},e._isBlit=function(t){return jnt.renderGraph.h(Pet,t)},e.applyID=function(t){this._isRasterPass(t)?this.passID=t:this._isQueue(t)?this.queueID=t:this._isScene(t)||this._isBlit(t)?this.sceneID=t:this.isComputePass(t)?this.passID=t:this.isDispatch(t)&&(this.dispatchID=t)},t}(),Trt=function(t){function e(){return t.call(this)||this}s(e,t);var i=e.prototype;return i.clear=function(){},i.viewport=function(){},i.rasterPass=function(t){if(this.rg.getValid(this.passID)){var e=jnt.devicePasses,i=t.hashValue;this.currPass=e.get(i),this.currPass?this.currPass.resetResource(this.passID,t):(this.currPass=new lrt(this.passID,t),e.set(i,this.currPass)),this.currPass.preRecord()}},i.rasterSubpass=function(){},i.computeSubpass=function(){},i.resolve=function(){},i.move=function(){},i.raytrace=function(){},i.compute=function(t){if(this.rg.getValid(this.passID)){jnt.devicePasses;var e=new crt;e.applyInfo(this.passID,t),this.currPass=new _rt(e),this.currPass.preRecord(),this.currPass.record()}},i.copy=function(t){if(t.uploadPairs.length)for(var e,i=f(t.uploadPairs);!(e=i()).done;){var n=e.value,r=jnt.deviceBuffers,s=jnt.resourceGraph,o=s.vertex(n.target);urt.resName=n.target,s.visitVertex(urt,o);var a=r.get(n.target);jnt.device.commandBuffer.updateBuffer(a.buffer,n.source,n.source.byteLength)}},i.queue=function(t){if(this.rg.getValid(this.queueID)){var e;this.currPass instanceof lrt?((e=jnt.pools.addDeviceQueue()).init(this.currPass,t,this.queueID),this.currQueue=e,this.currPass.addQueue(e)):((e=jnt.pools.addComputeQueue()).init(this.currPass,t,this.queueID),this.currQueue=e,this.currPass.addQueue(e));var i=this.rg.getLayout(this.queueID);if(i){var n=jnt.layoutGraph;if(this.currPass.renderLayout){var r=n.locateChild(this.currPass.renderLayout.layoutID,i);this.currQueue.layoutID=r}}this.currQueue.preRecord()}},i.scene=function(t){this.rg.getValid(this.sceneID)&&this.currQueue.setScene(this.sceneID,t).preRecord()},i.blit=function(t){this.rg.getValid(this.sceneID)&&this.currQueue.setScene(this.sceneID,void 0,t).preRecord()},i.dispatch=function(t){var e,i=null,n=this.currPass,r=null===(e=t.material)||void 0===e?void 0:e.passes[t.passID];null==r||r.update();var s=null==r?void 0:r.getShaderVariant();if(null!==r&&null!==s){var o=new Gf(s,null==r?void 0:r.pipelineLayout);o.bindPoint=Xc.COMPUTE,i=nd.gfxDevice.createPipelineState(o)}var a=jnt.commandBuffer;if(i){a.bindPipelineState(i);var h=n.renderLayout.descriptorSet;a.bindDescriptorSet(Jg.GLOBAL,h)}var u=t.threadGroupCountX,l=t.threadGroupCountY,c=t.threadGroupCountZ;a.dispatch(new w_(u,l,c))},e}(Art),brt=function(t){function e(){return t.call(this)||this}s(e,t);var i=e.prototype;return i.clear=function(){},i.viewport=function(){},i.rasterPass=function(t){var e=jnt.devicePasses,i=t.hashValue,n=e.get(i);n&&(this.currPass=n,this.currPass.record())},i.rasterSubpass=function(){},i.computeSubpass=function(){},i.resolve=function(){},i.compute=function(){},i.copy=function(){},i.move=function(){},i.raytrace=function(){},i.queue=function(){},i.scene=function(){},i.blit=function(){},i.dispatch=function(){},e}(Art),Ert=function(t){function e(){var e;return(e=t.call(this)||this)._preVisitor=void 0,e._postVisitor=void 0,e._graphView=void 0,e._colorMap=void 0,e._preVisitor=new Trt,e._postVisitor=new brt,e._graphView=new Ktt(jnt.renderGraph),e._colorMap=new dit(jnt.renderGraph.nv()),e}s(e,t);var i=e.prototype;return i.discoverVertex=function(t,e){var i=e.g;this._preVisitor.applyID(t),i.visitVertex(this._preVisitor,t)},i.finishVertex=function(t,e){e.g.visitVertex(this._postVisitor,t)},n(e,[{key:"graphView",get:function(){return this._graphView}},{key:"colorMap",get:function(){return this._colorMap}}]),e}(qtt),Crt=new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP),xrt=new M_(Oc.POINT,Oc.POINT,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP),wrt=function(){function t(t){this._descriptorSetMap=new Map,this._device=t,this._linearSampler=this._device.getSampler(Crt),this._pointSampler=this._device.getSampler(xrt);var e=new tf(Yg.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new ef(this._descriptorSetLayout))}var e=t.prototype;return e.regenLayout=function(){var t=new tf(Yg.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new ef(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 ef(this._descriptorSetLayout));this._descriptorSetMap.set(t,n);for(var r=Xg.UBO_GLOBAL;r<Xg.COUNT;r++)n.bindBuffer(r,i.getBuffer(r)),n.bindSampler(r,i.getSampler(r)),n.bindTexture(r,i.getTexture(r));var s=e.createBuffer(new E_(Ec.UNIFORM|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,sy.SIZE,sy.SIZE));n.bindBuffer(sy.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}(),Drt=new Map,Rrt=function(){function t(t){this.queueID=4294967295,this.sceneID=4294967295,this.passID=4294967295,this.dispatchID=4294967295,this.resID=4294967295,this.context=void 0,this._currPass=null,this._resVisitor=void 0,this.context=t,this._resVisitor=new Mrt(this.context)}var e=t.prototype;return e._isRasterPass=function(t){return this.context.renderGraph.h(0,t)},e._isCopyPass=function(t){return this.context.renderGraph.h(5,t)},e._isCompute=function(t){return this.context.renderGraph.h(3,t)},e._isDispatch=function(t){return this.context.renderGraph.h(11,t)},e._isQueue=function(t){return this.context.renderGraph.h(8,t)},e._isShadowMap=function(t){var e=this._getSceneData(t);return!!e&&e.light&&!!e.light.light&&0!=(e.flags&ctt.SHADOW_CASTER)},e._getSceneData=function(t){return this.context.renderGraph.h(9,t)?this.context.renderGraph.j(t):null},e._isScene=function(t){return this.context.renderGraph.h(9,t)},e._isBlit=function(t){return this.context.renderGraph.h(Pet,t)},e._useResourceInfo=function(){},e._fetchValidPass=function(){var t=this.context.renderGraph;if(this.context.resourceContext,t.getValid(this.passID))return t.setValid(this.queueID,!0),void t.setValid(this.sceneID,!0);var e=this.resID,i=this.context.resourceGraph.vertexName(e);Drt.clear();var n=this._currPass;t.getValid(this.passID);for(var r,s=f(n.rasterViews);!(r=s()).done;){var o=r.value,a=o[0],h=o[1];a!==i||h.accessType===ftt.READ?h.accessType!==ftt.WRITE&&Drt.set(a,h):(t.setValid(this.passID,!0),t.setValid(this.queueID,!0),t.setValid(this.sceneID,!0))}if(t.getValid(this.sceneID)){for(var u,l=f(n.rasterViews);!(u=l()).done;){var c=u.value,_=c[0];c[1],Ort.pipeline.resourceUses.push(_)}for(var d,p,m,g=f(Drt);!(m=g()).done;){var y=m.value,v=y[0];y[1],4294967295!==(p=(d=this.context.resourceGraph).find(v))&&(this._resVisitor.resID=p,d.visitVertex(this._resVisitor,p))}for(var S,A=f(n.computeViews);!(S=A()).done;){var T=S.value,b=T[0];T[1],4294967295!==(p=(d=this.context.resourceGraph).find(b))&&(this._resVisitor.resID=p,d.visitVertex(this._resVisitor,p))}!function(t){for(var e,i="",n=f(t.rasterViews);!(e=n()).done;){var r=e.value,s=r[0],o=r[1];i+=Nit(s),i+=Nit(o.slotName),i+=Nit(o.accessType),i+=Nit(o.attachmentType),i+=Nit(o.loadOp),i+=Nit(o.storeOp),i+=Nit(o.clearFlags),i+=Nit(o.clearColor.x),i+=Nit(o.clearColor.y),i+=Nit(o.clearColor.z),i+=Nit(o.clearColor.w),i+=Nit(o.slotID),i+=Nit(o.shaderStageFlags)}for(var a,h=f(t.computeViews);!(a=h()).done;){var u=a.value,l=u[0],c=u[1];i+=Nit(l);for(var _,d=f(c);!(_=d()).done;){var p=_.value;i+=Nit(p.name),i+=Nit(p.accessType),i+=Nit(p.clearFlags),i+=Nit(p.clearValueType),i+=Nit(p.clearValue.x),i+=Nit(p.clearValue.y),i+=Nit(p.clearValue.z),i+=Nit(p.clearValue.w),i+=Nit(p.shaderStageFlags)}}i+=Nit(t.width),i+=Nit(t.height),i+=Nit(t.viewport.left),i+=Nit(t.viewport.top),i+=Nit(t.viewport.width),i+=Nit(t.viewport.height),i+=Nit(t.viewport.minDepth),i+=Nit(t.viewport.maxDepth),i+=Nit(t.showStatistics?1:0),t.hashValue=function(t){for(var e=0,i=0;i<t.length;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return e}(i)}(n)}},e.applyID=function(t,e){this.resID=e,this._isRasterPass(t)||this._isCopyPass(t)||this._isCompute(t)?this.passID=t:this._isQueue(t)?this.queueID=t:this._isScene(t)||this._isBlit(t)?this.sceneID=t:this._isDispatch(t)&&(this.dispatchID=t)},e.rasterPass=function(t){this._currPass=t},e.rasterSubpass=function(){},e.computeSubpass=function(){},e.compute=function(t){this._currPass=t,Ort.renderGraph.setValid(this.passID,!0)},e.resolve=function(){},e.copy=function(t){var e=Ort.renderGraph;if(!e.getValid(this.passID)){var i=this.context.resourceGraph;this._currPass=t;for(var n,r,s=this.resID,o=i.vertexName(s),a=f(t.copyPairs);!(r=a()).done;){var h=r.value;h.target===o&&(e.setValid(this.passID,!0),4294967295!==(n=i.find(h.source))&&(this._resVisitor.resID=n,i.visitVertex(this._resVisitor,n)))}}},e.move=function(){},e.raytrace=function(){},e.queue=function(){},e.scene=function(){this._fetchValidPass()},e.blit=function(){this._fetchValidPass()},e.dispatch=function(){var t=this.context.renderGraph;t.setValid(this.queueID,!0),t.setValid(this.dispatchID,!0)},e.clear=function(){},e.viewport=function(){},t}(),Irt=function(t){function e(e,i){var n;return(n=t.call(this)||this)._colorMap=void 0,n._graphView=void 0,n._passVisitor=void 0,n._resId=4294967295,n._resId=i,n._passVisitor=new Rrt(e),n._graphView=new Ktt(e.renderGraph),n._colorMap=new dit(e.renderGraph.nv()),n}return s(e,t),e.prototype.discoverVertex=function(t,e){var i=e.g;this._passVisitor.applyID(t,this.resId),i.visitVertex(this._passVisitor,t)},n(e,[{key:"resId",get:function(){return this._resId},set:function(t){this._resId=t,this._colorMap.colors.length=Ort.renderGraph.nv()}},{key:"graphView",get:function(){return this._graphView}},{key:"colorMap",get:function(){return this._colorMap}}]),e}(qtt),Mrt=function(){function t(t){this._context=void 0,this.resID=4294967295,this._passManagerVis=void 0,this._context=t}var e=t.prototype;return e.managedBuffer=function(){},e.managedTexture=function(){},e.managed=function(){this.dependency()},e.persistentBuffer=function(){},e.dependency=function(){this._passManagerVis?this._passManagerVis.resId=this.resID:this._passManagerVis=new Irt(this._context,this.resID),Ytt(this._passManagerVis.graphView,this._passManagerVis,this._passManagerVis.colorMap)},e.persistentTexture=function(){this.dependency()},e.framebuffer=function(){this.dependency()},e.swapchain=function(){this.dependency()},e.formatView=function(){},e.subresourceView=function(){},t}(),Prt=function(){function t(){this.resourceGraph=void 0,this.pipeline=void 0,this.renderGraph=void 0,this.layoutGraph=void 0,this.resourceContext=void 0}return t.prototype.set=function(t,e,i,n){this.pipeline=t,this.resourceGraph=e,this.renderGraph=i,this.layoutGraph=n,this.resourceContext||(this.resourceContext=new Map),this.resourceContext.clear()},t}(),Brt=function(){function t(t,e,i,n){this._resourceGraph=void 0,this._pipeline=void 0,this._layoutGraph=void 0,this._visitor=void 0,this._pipeline=t,this._resourceGraph=i,this._layoutGraph=n,Ort.set(this._pipeline,this._resourceGraph,e,this._layoutGraph),this._visitor=new Lrt(Ort)}return t.prototype.compile=function(t){Ort.set(this._pipeline,this._resourceGraph,t,this._layoutGraph),Ort.pipeline.resourceUses.length=0,this._visitor.colorMap.colors.length=Ort.resourceGraph.nv(),Ytt(this._resourceGraph,this._visitor,this._visitor.colorMap)},t}(),Ort=new Prt,Lrt=function(t){function e(e){var i;return(i=t.call(this)||this)._colorMap=void 0,i._resourceGraph=void 0,i._resVisitor=void 0,i._colorMap=new dit(e.resourceGraph.nv()),i._resourceGraph=e.resourceGraph,i._resVisitor=new Mrt(e),i}return s(e,t),e.prototype.discoverVertex=function(t){var e=this._resourceGraph.getTraits(t);e.residency!==att.MANAGED&&e.residency!==att.MEMORYLESS&&(this._resVisitor.resID=t,this._resourceGraph.visitVertex(this._resVisitor,t))},n(e,[{key:"colorMap",get:function(){return this._colorMap}}]),e}(qtt),Nrt=new ln,Frt=new M_(Oc.POINT,Oc.POINT,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP),krt=function(){function t(){var t=this;this.renderData=new Met,this.layoutGraph=new $et,this.rg=new Oet,this.vertId=-1,this.sceneData=new Det,this.resourceGraph=new vet,this.computePass=new Aet,this.rasterPass=new det,this.rasterSubpass=new _et,this.renderQueue=new wet,this.sceneBuilder=new Ks((function(){return new Vrt(t.renderData,t.layoutGraph,t.rg,t.vertId,t.sceneData)}),16),this.renderPassBuilder=new Ks((function(){return new zrt(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.rasterPass,t.getPipelineSceneData())}),16),this.computeQueueBuilder=new Ks((function(){return new Hrt(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderQueueBuilder=new Ks((function(){return new Grt(t.renderData,t.rg,t.layoutGraph,t.vertId,t.renderQueue,t.getPipelineSceneData())}),16),this.renderSubpassBuilder=new Ks((function(){return new Urt(t.renderData,t.rg,t.layoutGraph,t.vertId,t.rasterSubpass,t.getPipelineSceneData())}),16),this.computePassBuilder=new Ks((function(){return new Wrt(t.renderData,t.rg,t.layoutGraph,t.resourceGraph,t.vertId,t.computePass,t.getPipelineSceneData())}),16),this.samplerInfo=new Ks((function(){return new M_}),16),this.color=new Ks((function(){return new S_}),16),this.renderCommonObjectPool=new Btt,this.renderGraphPool=new ket(this.renderCommonObjectPool),this.viewport=new Ks((function(){return new v_}),16)}var e=t.prototype;return e.getPipelineSceneData=function(){return v.director.root.pipeline.pipelineSceneData},e.createColor=function(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=this.color.add();return r.set(t,e,i,n),r},e.createSamplerInfo=function(t,e,i,n,r,s,o,a){void 0===t&&(t=Oc.LINEAR),void 0===e&&(e=Oc.LINEAR),void 0===i&&(i=Oc.NONE),void 0===n&&(n=Lc.WRAP),void 0===r&&(r=Lc.WRAP),void 0===s&&(s=Lc.WRAP),void 0===o&&(o=0),void 0===a&&(a=Nc.ALWAYS);var h=this.samplerInfo.add();return h.minFilter=t,h.magFilter=e,h.mipFilter=i,h.addressU=n,h.addressV=r,h.addressW=s,h.maxAnisotropy=o,h.cmpFunc=a,h},e.reset=function(){this.sceneBuilder.reset(),this.renderPassBuilder.reset(),this.computePassBuilder.reset(),this.computeQueueBuilder.reset(),this.renderCommonObjectPool.reset(),this.renderGraphPool.reset(),this.viewport.reset(),this.samplerInfo.reset(),this.color.reset(),this.renderQueueBuilder.reset(),this.renderSubpassBuilder.reset()},t}(),Vrt=function(t){function e(e,i,n,r,s){var o;return(o=t.call(this,e,i)||this)._renderGraph=void 0,o._scene=void 0,o._renderGraph=n,o._scene=s,o._vertID=r,o}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r){this._data=t,this._lg=e,this._renderGraph=i,this._scene=r,this._vertID=n},i.useLightFrustum=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=void 0),this._scene.light.light=t,this._scene.light.level=e,this._scene.light.culledByLight=!0,i&&(this._scene.camera=i),!(this._scene.flags&ctt.NON_BUILTIN)){var n=this._renderGraph.getParent(this._vertID),r=this._renderGraph.getParent(n);this._renderGraph.getLayout(r),Kit(this,this._scene.camera,t,e)}},e}(Zit),Grt=function(t){function e(e,i,n,r,s,o){var a;return(a=t.call(this,e,n)||this)._renderGraph=void 0,a._queue=void 0,a._pipeline=void 0,a._renderGraph=i,a._vertID=r,a._queue=s,a._pipeline=o,a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addSceneOfCamera=function(t,e,i,n){void 0===i&&(i=ctt.NONE),void 0===n&&(n="Camera");var r=e.light,s=Ynt.createSceneData(t.scene,t,i,!r||i&ctt.SHADOW_CASTER?1:5,r);this._renderGraph.addVertex(9,s,n,"",Ynt.createRenderData(),!1,this._vertID),this.getParentLayout();var o=v.director.getScene();Hit(this,t,this._pipeline,t.scene||(o?o.renderScene:null)),i&ctt.SHADOW_CASTER||r&&r.type!==BD.DIRECTIONAL?Kit(this,t,r,e.level):Qit(this,t)},i.addScene=function(t,e,i,n){void 0===e&&(e=ctt.NONE),void 0===i&&(i=void 0),void 0===n&&(n=void 0);var r=Ynt.createSceneData(n||t.scene,t,e,!i||e&ctt.SHADOW_CASTER?1:5,i),s=Ynt.createRenderData(),o=this._renderGraph.addVertex(9,r,"Scene","",s,!1,this._vertID);e&ctt.NON_BUILTIN||(this.getParentLayout(),Hit(this,t,this._pipeline,n||t.scene),i&&i.type!==BD.DIRECTIONAL?Kit(this,t,i,0):e&ctt.SHADOW_CASTER||Qit(this,t));var a=Xnt.sceneBuilder.add();return a.update(s,this._lg,this._renderGraph,o,r),a},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=ctt.NONE),void 0===n&&(n="Quad"),this._renderGraph.addVertex(Pet,Ynt.createBlit(t,e,i,null),n,"",Ynt.createRenderData(),!1,this._vertID),this.getParentLayout();var r=v.director.getScene();Hit(this,null,this._pipeline,r?r.renderScene:null),i&ctt.SHADOW_CASTER||Qit(this,null)},i.addCameraQuad=function(t,e,i,n){void 0===n&&(n=ctt.NONE),this._renderGraph.addVertex(Pet,Ynt.createBlit(e,i,n,t),"CameraQuad","",Ynt.createRenderData(),!1,this._vertID),this.getParentLayout();var r=v.director.getScene();Hit(this,t,this._pipeline,t.scene||(r?r.renderScene:null)),n&ctt.SHADOW_CASTER||Qit(this,t)},i.clearRenderTarget=function(t,e){void 0===e&&(e=new S_);var i=Ynt.createClearView(t,n_.COLOR);i.clearColor.copy(e),this._renderGraph.addVertex(12,[i],"ClearRenderTarget","",Ynt.createRenderData(),!1,this._vertID)},i.setViewport=function(t){var e=Xnt.viewport.add();this._queue.viewport=e.copy(t)},i.addCustomCommand=function(){throw new Error("Method not implemented.")},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(Zit),Urt=function(t){function e(e,i,n,r,s,o){var a;(a=t.call(this,e,n)||this)._renderGraph=void 0,a._layoutID=void 0,a._subpass=void 0,a._pipeline=void 0,a._renderGraph=i,a._vertID=r,a._subpass=s,a._pipeline=o;var h=a._renderGraph.getLayout(a._vertID);return a._layoutID=n.locateChild(n.N,h),a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._subpass=r,this._pipeline=s;var o=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,o)},i.addRenderTarget=function(){throw new Error("Method not implemented.")},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDepthStencil=function(t,e,i,n,r,s,o,a,h){throw void 0===r&&(r=zc.CLEAR),void 0===s&&(s=Hc.STORE),void 0===h&&(h=n_.DEPTH_STENCIL),new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(){throw new Error("Method not implemented.")},i.addStorageImage=function(){throw new Error("Method not implemented.")},i.setViewport=function(){throw new Error("Method not implemented.")},i.addQueue=function(t,e){void 0===t&&(t=htt.RENDER_OPAQUE),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=Ynt.createRenderQueue(t,i),r=Ynt.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!1,this._vertID),o=Xnt.renderQueueBuilder.add();return o.update(r,this._renderGraph,this._lg,s,n,this._pipeline),o},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._subpass.showStatistics},set:function(t){this._subpass.showStatistics=t}}]),e}(Zit),zrt=function(t){function e(e,i,n,r,s,o,a){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._resourceGraph=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=o,h._pipeline=a;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,o){this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=o,this._data=t;var a=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,a)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.setVersion=function(t,e){this._pass.versionName=t,this._pass.version=e},i.addRenderTarget=function(t,e,i,n){void 0===e&&(e=zc.CLEAR),void 0===i&&(i=Hc.STORE),void 0===n&&(n=new S_);var r=n_.COLOR;e===zc.LOAD&&(r=n_.NONE);var s=Ynt.createRasterView("",ftt.WRITE,ptt.RENDER_TARGET,e,i,r);s.clearColor.copy(n),this._pass.rasterViews.set(t,s)},i.addDepthStencil=function(t,e,i,n,r,s){void 0===e&&(e=zc.CLEAR),void 0===i&&(i=Hc.STORE),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=n_.DEPTH_STENCIL);var o=Ynt.createRasterView("",ftt.WRITE,ptt.DEPTH_STENCIL,e,i,s);o.clearColor.set(n,r,0,0),this._pass.rasterViews.set(t,o)},i.resolveRenderTarget=function(){},i.resolveDepthStencil=function(){},i._addComputeResource=function(t,e,i){var n,r=Ynt.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null===(n=this._pass.computeViews.get(t))||void 0===n||n.push(r):this._pass.computeViews.set(t,[r])},i.addTexture=function(t,e,i){if(void 0===i&&(i=null),this._addComputeResource(t,ftt.READ,e),i){var n=this._lg.attributeIndex.get(e);this._data.samplers.set(n,i)}},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addRenderSubpass=function(t){void 0===t&&(t="");var e="Raster",i=this._pass.subpassGraph.nv();this._pass.subpassGraph.addVertex(e,Ynt.createSubpass());var n=Ynt.createRasterSubpass(i,1,0),r=Ynt.createRenderData(),s=this._renderGraph.addVertex(1,n,e,t,r,!1),o=Xnt.renderSubpassBuilder.add();return o.update(r,this._renderGraph,this._lg,s,n,this._pipeline),o},i.addQueue=function(t,e){void 0===t&&(t=htt.RENDER_OPAQUE),void 0===e&&(e="default");var i=this._lg.locateChild(this._layoutID,e),n=Ynt.createRenderQueue(t,i),r=Ynt.createRenderData(),s=this._renderGraph.addVertex(8,n,"",e,r,!1,this._vertID),o=Xnt.renderQueueBuilder.add();return o.update(r,this._renderGraph,this._lg,s,n,this._pipeline),o},i.addFullscreenQuad=function(t,e,i,n){void 0===i&&(i=ctt.NONE),void 0===n&&(n="FullscreenQuad");var r=Ynt.createRenderQueue(htt.RENDER_TRANSPARENT),s=this._renderGraph.addVertex(8,r,"Queue","",Ynt.createRenderData(),!1,this._vertID);this._renderGraph.addVertex(Pet,Ynt.createBlit(t,e,i,null),n,"",Ynt.createRenderData(),!1,s)},i.addCameraQuad=function(t,e,i,n,r){void 0===r&&(r="CameraQuad");var s=Ynt.createRenderQueue(htt.RENDER_TRANSPARENT),o=this._renderGraph.addVertex(8,s,"Queue","",Ynt.createRenderData(),!1,this._vertID);this._renderGraph.addVertex(Pet,Ynt.createBlit(e,i,n,t),r,"",Ynt.createRenderData(),!1,o)},i.setViewport=function(t){this._pass.viewport.copy(t)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}},{key:"showStatistics",get:function(){return this._pass.showStatistics},set:function(t){this._pass.showStatistics=t}}]),e}(Zit),Hrt=function(t){function e(e,i,n,r,s,o){var a;return(a=t.call(this,e,n)||this)._renderGraph=void 0,a._queue=void 0,a._pipeline=void 0,a._renderGraph=i,a._vertID=r,a._queue=s,a._pipeline=o,a}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s){this._data=t,this._lg=i,this._renderGraph=e,this._vertID=n,this._queue=r,this._pipeline=s},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addDispatch=function(t,e,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=0),void 0===s&&(s="Dispatch"),this._renderGraph.addVertex(11,Ynt.createDispatch(n,r,t,e,i),s,"",Ynt.createRenderData(),!1,this._vertID)},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(Zit),Wrt=function(t){function e(e,i,n,r,s,o,a){var h;(h=t.call(this,e,n)||this)._renderGraph=void 0,h._resourceGraph=void 0,h._layoutID=void 0,h._pass=void 0,h._pipeline=void 0,h._renderGraph=i,h._resourceGraph=r,h._vertID=s,h._pass=o,h._pipeline=a;var u=h._renderGraph.getLayout(h._vertID);return h._layoutID=n.locateChild(n.N,u),h}s(e,t);var i=e.prototype;return i.update=function(t,e,i,n,r,s,o){this._data=t,this._renderGraph=e,this._lg=i,this._resourceGraph=n,this._vertID=r,this._pass=s,this._pipeline=o;var a=this._renderGraph.getLayout(this._vertID);this._layoutID=i.locateChild(i.N,a)},i.setCustomShaderStages=function(){throw new Error("Method not implemented.")},i.setArrayBuffer=function(){throw new Error("Method not implemented.")},i.addTexture=function(){throw new Error("Method not implemented.")},i.addStorageBuffer=function(t,e,i){this._addComputeResource(t,e,i)},i.addStorageImage=function(t,e,i){this._addComputeResource(t,e,i)},i.addMaterialTexture=function(){throw new Error("Method not implemented.")},i.addQueue=function(t){void 0===t&&(t="default");var e=this._lg.locateChild(this._layoutID,t),i=Ynt.createRenderQueue(htt.RENDER_OPAQUE,e),n=Ynt.createRenderData(),r=this._renderGraph.addVertex(8,i,"",t,n,!1,this._vertID),s=Xnt.computeQueueBuilder.add();return s.update(n,this._renderGraph,this._lg,r,i,this._pipeline),s},i._addComputeResource=function(t,e,i){var n,r=Ynt.createComputeView(i);r.accessType=e,this._pass.computeViews.has(t)?null===(n=this._pass.computeViews.get(t))||void 0===n||n.push(r):this._pass.computeViews.set(t,[r])},n(e,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}]),e}(Zit);!function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.setCustomBehavior=function(){throw new Error("Method not implemented.")},e.addPair=function(t){this._pass.movePairs.push(t)},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}(),function(){function t(t,e,i){this._renderGraph=void 0,this._vertID=void 0,this._pass=void 0,this._renderGraph=t,this._vertID=e,this._pass=i}var e=t.prototype;e.addPair=function(){throw new Error("Method not implemented.")},e.setCustomBehavior=function(){throw new Error("Method not implemented.")},n(t,[{key:"name",get:function(){return this._renderGraph.getName(this._vertID)},set:function(t){this._renderGraph.setName(this._vertID,t)}}])}();var jrt=function(){function t(t){this._width=0,this._height=0,this._usesDeferredPipeline=!1,this._copyPassMat=new oT,this._device=void 0,this._globalDSManager=void 0,this._defaultSampler=void 0,this._globalDescriptorSet=null,this._globalDescriptorSetInfo=null,this._globalDescriptorSetLayout=null,this._profilerDescriptorSet=null,this._macros={},this._pipelineSceneData=new fM,this._constantMacros="",this._lightingMode=dtt.DEFAULT,this._profiler=null,this._cameras=[],this._resourceUses=[],this._layoutGraph=void 0,this._resourceGraph=new vet,this._renderGraph=null,this._compiler=null,this._executor=null,this._customPipelineName="",this._globalDescSetData=void 0,this._combineSignY=0,this._layoutGraph=t}var e=t.prototype;return e.addCustomBuffer=function(){throw new Error("Method not implemented.")},e.addCustomTexture=function(){throw new Error("Method not implemented.")},e.tryAddRenderWindowDepthStencil=function(t,e,i,n){i&&(n?this.addDepthStencilImpl(i,n.depthStencilTexture.format,t,e,att.BACKBUFFER,n):this.addDepthStencilImpl(i,Ac.DEPTH_STENCIL,t,e,att.MANAGED))},e.addRenderWindow=function(t,e,i,n,r,s){var o=this._resourceGraph.find(t);if(4294967295!==o)return this.updateRenderWindow(t,r,s),o;this.tryAddRenderWindowDepthStencil(i,n,s,r.swapchain);var a=new $tt;return a.dimension=utt.TEXTURE2D,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=r.framebuffer.colorTextures[0].format,a.flags=ltt.COLOR_ATTACHMENT,r.swapchain?this._resourceGraph.addVertex(6,new eet(r.swapchain),t,a,new tet(att.BACKBUFFER),new iet,new M_):(a.sampleCount=r.framebuffer.colorTextures[0].info.samples,this._resourceGraph.addVertex(5,r.framebuffer,t,a,new tet(att.EXTERNAL),new iet,new M_))},e.updateRenderWindow=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e.width,r.height=e.height,this.resourceGraph.object(n)!==e.framebuffer&&(this.resourceGraph.x[n].j=e.framebuffer),this.tryAddRenderWindowDepthStencil(e.width,e.height,i,e.swapchain)},e.updateStorageBuffer=function(t,e,i){void 0===i&&(i=Ac.UNKNOWN);var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,i!==Ac.UNKNOWN&&(r.format=i)},e.updateRenderTarget=function(t,e,i,n){void 0===n&&(n=Ac.UNKNOWN);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,n!==Ac.UNKNOWN&&(s.format=n)},e.updateDepthStencil=function(t,e,i,n){void 0===n&&(n=Ac.UNKNOWN);var r=this.resourceGraph.find(t);4294967295!==r&&this.updateDepthStencilImpl(r,e,i,n)},e.updateStorageTexture=function(t,e,i,n){void 0===n&&(n=Ac.UNKNOWN);var r=this.resourceGraph.vertex(t),s=this.resourceGraph.getDesc(r);s.width=e,s.height=i,n!==Ac.UNKNOWN&&(s.format=n)},e.updateShadingRateTexture=function(t,e,i){var n=this.resourceGraph.vertex(t),r=this.resourceGraph.getDesc(n);r.width=e,r.height=i},e.addBuffer=function(t,e,i,n){var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateBuffer(t,e),r;var s=new $tt;return s.dimension=utt.BUFFER,s.width=e,s.flags=i,this._resourceGraph.addVertex(0,new aet,t,s,new tet(n),new iet,new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP))},e.updateBuffer=function(t,e){this.updateResource(t,Ac.UNKNOWN,e,0,0,0,0,Pc.X1)},e.addExternalTexture=function(){throw new Error("Method not implemented.")},e.updateExternalTexture=function(){throw new Error("Method not implemented.")},e.addTexture=function(t,e,i,n,r,s,o,a,h,u,l){var c=this._resourceGraph.find(t);if(4294967295!==c)return this.updateTexture(t,i,n,r,s,o,a,h),c;var _=new $tt;return _.dimension=function(t){switch(t){case Dc.TEX1D:case Dc.TEX1D_ARRAY:return utt.TEXTURE1D;case Dc.TEX2D:case Dc.TEX2D_ARRAY:case Dc.CUBE:return utt.TEXTURE2D;case Dc.TEX3D:return utt.TEXTURE3D}return utt.TEXTURE2D}(e),_.width=n,_.height=r,_.depthOrArraySize=_.dimension===utt.TEXTURE3D?s:o,_.mipLevels=a,_.format=i,_.sampleCount=h,_.flags=u,_.viewType=e,this._resourceGraph.addVertex(0,new aet,t,_,new tet(l),new iet,new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP))},e.updateTexture=function(t,e,i,n,r,s,o,a){this.updateResource(t,e,i,n,r,s,o,a)},e.addResource=function(t,e,i,n,r,s,o,a,h,u,l){var c=this._resourceGraph.find(t);return 4294967295!==c?(this.updateResource(t,i,n,r,s,o,a,h),c):e===utt.BUFFER?this.addBuffer(t,n,u,l):this.addTexture(t,function(t,e){switch(t){case utt.TEXTURE1D:return e>1?Dc.TEX1D_ARRAY:Dc.TEX1D;case utt.TEXTURE2D:return e>1?Dc.TEX2D_ARRAY:Dc.TEX2D;case utt.TEXTURE3D:return Dc.TEX3D;case utt.BUFFER:return Dc.TEX2D}return Dc.TEX2D}(e,o),i,n,r,s,o,a,h,u,l)},e.updateResource=function(t,e,i,n,r,s,o,a){var h=this.resourceGraph.vertex(t),u=this.resourceGraph.getDesc(h);u.width=i,u.height=n,u.depthOrArraySize=u.dimension===utt.TEXTURE3D?r:s,u.mipLevels=o,e!==Ac.UNKNOWN&&(u.format=e),u.sampleCount=a},e.containsResource=function(t){return this._resourceGraph.contains(t)},e.addResolvePass=function(){throw new Error("Method not implemented.")},e.addComputePass=function(t){var e=Ynt.createComputePass(),i=Ynt.createRenderData(),n=this._renderGraph.addVertex(3,e,"Compute",t,i,!1),r=Xnt.computePassBuilder.add();return r.update(i,this._renderGraph,this._layoutGraph,this._resourceGraph,n,e,this._pipelineSceneData),v.director.root.pipeline,r},e.addUploadPass=function(t){for(var e,i=Ynt.createCopyPass(),n=f(t);!(e=n()).done;){var r=e.value;i.uploadPairs.push(r)}this._renderGraph.addVertex(5,i,"UploadPass","",Ynt.createRenderData(),!1)},e.addCopyPass=function(t){for(var e,i=f(t);!(e=i()).done;){var n=e.value,r=n.target,s=this.resourceGraph.find(r),o=this.resourceGraph.getDesc(s),a=this.addRenderPass(o.width,o.height,"copy-pass");a.addRenderTarget(r,zc.CLEAR,Hc.STORE,Xnt.createColor()),a.addTexture(n.source,"outputResultMap"),a.addQueue(htt.NONE).addFullscreenQuad(this._copyPassMat,0,ctt.NONE)}},e._generateConstantMacros=function(){var t="";t+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this._device.getFormatFeatures(Ac.RGBA32F)&(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE)?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(Sc.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",t+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(So.os===po.ANDROID&&So.isBrowser?1:0)+"\n",t+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Pe.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",t+="#define CC_JOINT_UNIFORM_CAPACITY "+Ry.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=t,this._layoutGraph.constantMacros=this._constantMacros},e.setCustomPipelineName=function(t){this._customPipelineName=t,"Deferred"===this._customPipelineName&&(this._usesDeferredPipeline=!0)},e.getGlobalDescriptorSetData=function(){var t=this.layoutGraph.locateChild(this.layoutGraph.N,"default");return this.layoutGraph.getLayout(t).descriptorSets.get(ttt.PER_PASS)},e._initCombineSignY=function(){var t=this._device;this._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},e.getCombineSignY=function(){return this._combineSignY},e._compileMaterial=function(){this._copyPassMat.initialize({effectName:"pipeline/copy-pass"});for(var t=0;t<this._copyPassMat.passes.length;++t)this._copyPassMat.passes[t].tryCompile()},e.activate=function(){this._device=nd.gfxDevice,Xnt=new krt,Ynt=Xnt.renderGraphPool,function(t,e){for(var i=0;i<e._layouts.length;++i)e.getLayout(i).descriptorSets.forEach((function(e){var i=e,n=i.descriptorSetLayoutData;if(t){var r=dnt(t,n);r&&(i.descriptorSetLayout=r,i.descriptorSet=t.createDescriptorSet(new ef(r)))}else fnt(n,i.descriptorSetLayoutInfo)}))}(this._device,this._layoutGraph),this._globalDSManager=new wrt(this._device),this._globalDescSetData=this.getGlobalDescriptorSetData(),this._globalDescriptorSetLayout=this._globalDescSetData.descriptorSetLayout,this._globalDescriptorSetInfo=new ef(this._globalDescriptorSetLayout),this._globalDescriptorSet=this._device.createDescriptorSet(this._globalDescriptorSetInfo),this._profilerDescriptorSet=this._device.createDescriptorSet(this._globalDescriptorSetInfo),this._globalDSManager.globalDescriptorSet=this.globalDescriptorSet,this._compileMaterial(),this.setMacroBool("CC_USE_HDR",this._pipelineSceneData.isHDR),this.setMacroBool("CC_USE_FLOAT_OUTPUT",Pe.ENABLE_FLOAT_OUTPUT&&Dv(this._device)),this._generateConstantMacros(!1),this._pipelineSceneData.activate(this._device),this._initCombineSignY();var e=wv(this._device)?0:1;this.setMacroInt("CC_SHADOWMAP_FORMAT",e);var i=this._device.gfxAPI===yc.WEBGL?1:0;this.setMacroInt("CC_SHADOWMAP_USE_LINEAR_DEPTH",i);var n=v.director.root;return this._defaultSampler=n.device.getSampler(Frt),this.pipelineSceneData.csmSupported=this.device.capabilities.maxFragmentUniformVectors>=t.CSM_UNIFORM_VECTORS+t.GLOBAL_UNIFORM_VECTORS,this.setMacroBool("CC_SUPPORT_CASCADED_SHADOW_MAP",this.pipelineSceneData.csmSupported),this.setMacroInt("CC_SHADOW_TYPE",0),this.setMacroInt("CC_DIR_SHADOW_PCF_TYPE",uT.HARD),this.setMacroInt("CC_DIR_LIGHT_SHADOW_TYPE",0),this.setMacroBool("CC_CASCADED_LAYERS_TRANSITION",!1),this.usesDeferredPipeline&&this.setMacroInt("CC_PIPELINE_TYPE",1),!0},e.destroy=function(){var t,e,i;return null===(t=this._globalDSManager)||void 0===t||t.globalDescriptorSet.destroy(),null===(e=this._globalDSManager)||void 0===e||e.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),!0},e.getMacroString=function(t){var e=this._macros[t];return void 0===e?"":e},e.getMacroInt=function(t){var e=this._macros[t];return void 0===e?0:e},e.getMacroBool=function(t){var e=this._macros[t];return void 0!==e&&e},e.getSamplerInfo=function(t){if(this.containsResource(t)){var e=this._resourceGraph.vertex(t);return this._resourceGraph.getSampler(e)}return null},e.setMacroString=function(t,e){this._macros[t]=e},e.setMacroInt=function(t,e){this._macros[t]=e},e.setMacroBool=function(t,e){this._macros[t]=e},e.onGlobalPipelineStateChanged=function(){var t=v.rendering.getCustomPipeline(Pe.CUSTOM_PIPELINE_NAME);t&&("function"==typeof t.onGlobalPipelineStateChanged&&t.onGlobalPipelineStateChanged(),v.rendering.forceResizeAllWindows())},e.beginSetup=function(){this._renderGraph||(this._renderGraph=new Oet),Xnt.reset()},e.endSetup=function(){this.compile()},e.addStorageBuffer=function(t,e,i,n){void 0===n&&(n=att.MANAGED);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.updateStorageBuffer(t,i,e),r;var s=new $tt;return s.dimension=utt.BUFFER,s.width=i,s.height=1,s.depthOrArraySize=1,s.mipLevels=1,s.format=e,s.flags=ltt.STORAGE,n===att.PERSISTENT?this._resourceGraph.addVertex(3,new ret,t,s,new tet(att.PERSISTENT),new iet,new M_):this._resourceGraph.addVertex(1,new net,t,s,new tet(n),new iet,new M_)},e.addRenderTarget=function(t,e,i,n,r){void 0===r&&(r=att.MANAGED);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateRenderTarget(t,i,n,e),s;var o=new $tt;return o.dimension=utt.TEXTURE2D,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.sampleCount=Pc.X1,o.flags=ltt.COLOR_ATTACHMENT|ltt.SAMPLED,this._resourceGraph.addVertex(0,new aet,t,o,new tet(r),new iet,new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP))},e.updateDepthStencilImpl=function(t,e,i,n,r){var s=this.resourceGraph.getDesc(t);if(s.width=e,s.height=i,r){var o=this.resourceGraph.j(t);o.swapchain=r,s.format=o.swapchain.depthStencilTexture.format}else n!==Ac.UNKNOWN&&(s.format=n)},e.addDepthStencilImpl=function(t,e,i,n,r,s){var o=this._resourceGraph.find(t);if(4294967295!==o)return this.updateDepthStencilImpl(o,i,n,e,s),o;var a=new $tt;return a.dimension=utt.TEXTURE2D,a.width=i,a.height=n,a.depthOrArraySize=1,a.mipLevels=1,a.format=e,a.sampleCount=Pc.X1,a.flags=ltt.DEPTH_STENCIL_ATTACHMENT|ltt.SAMPLED,s?this._resourceGraph.addVertex(6,new eet(s,!0),t,a,new tet(r),new iet,new M_(Oc.POINT,Oc.POINT,Oc.NONE)):this._resourceGraph.addVertex(0,new aet,t,a,new tet(r),new iet,new M_(Oc.POINT,Oc.POINT,Oc.NONE))},e.addDepthStencil=function(t,e,i,n,r){return void 0===r&&(r=att.MANAGED),this.addDepthStencilImpl(t,e,i,n,r)},e.addStorageTexture=function(t,e,i,n,r){void 0===r&&(r=att.MANAGED);var s=this._resourceGraph.find(t);if(4294967295!==s)return this.updateStorageTexture(t,i,n,e),s;var o=new $tt;return o.dimension=utt.TEXTURE2D,o.width=i,o.height=n,o.depthOrArraySize=1,o.mipLevels=1,o.format=e,o.flags=ltt.STORAGE|ltt.SAMPLED,this._resourceGraph.addVertex(0,new aet,t,o,new tet(r),new iet,new M_(Oc.POINT,Oc.POINT,Oc.NONE))},e.addShadingRateTexture=function(t,e,i,n){void 0===n&&(n=att.MANAGED);var r=this._resourceGraph.find(t);if(4294967295!==r)return this.addShadingRateTexture(t,e,i),r;var s=new $tt;return s.dimension=utt.TEXTURE2D,s.width=e,s.height=i,s.depthOrArraySize=1,s.mipLevels=1,s.format=Ac.R8UI,s.flags=ltt.SHADING_RATE|ltt.STORAGE|ltt.SAMPLED,this._resourceGraph.addVertex(0,new aet,t,s,new tet(n),new iet,new M_(Oc.LINEAR,Oc.LINEAR,Oc.NONE,Lc.CLAMP,Lc.CLAMP,Lc.CLAMP))},e.beginFrame=function(){},e.update=function(){},e.endFrame=function(){var t;null===(t=this.renderGraph)||void 0===t||t.clear()},e.compile=function(){if(!this._renderGraph)throw new Error("RenderGraph cannot be built without being created");this._compiler||(this._compiler=new Brt(this,this._renderGraph,this._resourceGraph,this._layoutGraph)),this._compiler.compile(this._renderGraph)},e.execute=function(){if(!this._renderGraph)throw new Error("Cannot run without creating rendergraph");this._executor||(this._executor=new Srt(this,this._device,this._resourceGraph,this.layoutGraph,this.width,this.height)),this._executor.resize(this.width,this.height),this._executor.execute(this._renderGraph)},e._applySize=function(t){var e=this,i=this._width,n=this._height;t.forEach((function(t){var r=t.window;i=Math.max(r.width,i),n=Math.max(r.height,n),e._cameras.includes(t)||e._cameras.push(t)})),i===this._width&&n===this._height||(this._width=i,this._height=n)},e.render=function(t){0!==t.length&&(this._applySize(t),function(t){for(var e=t.length-1;e>=0;--e)if(t[e].window.swapchain)return}(t),this.beginFrame(),this.execute(),this.endFrame())},e.addBuiltinReflectionProbePass=function(t){var e=v.internal.reflectionProbeManager;if(e){var i=e.getProbes();if(0!==i.length)for(var n=0;n<i.length;n++){var r=i[n];r.needRender&&i[n].probeType===vD.PLANAR&&yit(t,this,r,r.realtimePlanarTexture.window,0)}}},e.addRenderPassImpl=function(t,e,i,n,r){void 0===n&&(n=1),void 0===r&&(r=0);var s=Ynt.createRasterPass();s.viewport.width=t,s.viewport.height=e,s.count=n,s.quality=r;var o=Ynt.createRenderData(),a=this._renderGraph.addVertex(0,s,"Raster",i,o,!1),h=Xnt.renderPassBuilder.add();return h.update(o,this._renderGraph,this._layoutGraph,this._resourceGraph,a,s,this._pipelineSceneData),this._updateRasterPassConstants(h,t,e,i),function(t,e){var i=e.skybox,n=v.director.root,r=n.pipeline;if(i.reflectionMap){var s=i.reflectionMap.getGFXTexture(),o=n.device.getSampler(i.reflectionMap.getSamplerInfo());t.setTexture("cc_environment",s),t.setSampler("cc_environment",o)}else{var a=i.envmap?i.envmap:UA.get("default-cube-texture");if(a){var h=a.getGFXTexture(),u=n.device.getSampler(a.getSamplerInfo());t.setTexture("cc_environment",h),t.setSampler("cc_environment",u)}}var l=i.diffuseMap?i.diffuseMap:UA.get("default-cube-texture");if(l){var c=l.getGFXTexture(),_=n.device.getSampler(l.getSamplerInfo());t.setTexture("cc_diffuseMap",c),t.setSampler("cc_diffuseMap",_)}t.hasSampler("cc_shadowMap")||t.setSampler("cc_shadowMap",r.defaultSampler),t.hasTexture("cc_shadowMap")||t.setTexture("cc_shadowMap",r.defaultShadowTexture),t.hasSampler("cc_spotShadowMap")||t.setSampler("cc_spotShadowMap",r.defaultSampler),t.hasTexture("cc_spotShadowMap")||t.setTexture("cc_spotShadowMap",r.defaultShadowTexture)}(h,this._pipelineSceneData),h},e.addRenderPass=function(t,e,i){return void 0===i&&(i="default"),this.addRenderPassImpl(t,e,i)},e.addMultisampleRenderPass=function(t,e,i,n,r){return void 0===r&&(r="default"),this.addRenderPassImpl(t,e,r,i,n)},e.getDescriptorSetLayout=function(t,e){var i=this._layoutGraph,n=i.shaderLayoutIndex.get(t);return i.getLayout(n).descriptorSets.get(e).descriptorSetLayout},e._updateRasterPassConstants=function(t,e,i){var n=v.director,r=n.root,s=e,o=i;r.pipeline.layoutGraph,Nrt.set(r.cumulativeTime,r.frameTime,n.getTotalFrames()),t.setVec4("cc_time",Nrt),Nrt.set(s,o,1/s,1/o),t.setVec4("cc_screenSize",Nrt),Nrt.set(s,o,1/s,1/o),t.setVec4("cc_nativeSize",Nrt);var a=r.debugView;if(Nrt.set(0,0,0,0),a){for(var h=[a.singleMode,0,0,0],u=0;u<17;u++){var l=u%8;h[1+(u>>3)]+=(a.isCompositeModeEnabled(u)?1:0)*Math.pow(10,l)}h[3]+=(a.lightingWithAlbedo?1:0)*Math.pow(10,6),h[3]+=(a.csmLayerColoration?1:0)*Math.pow(10,7),Nrt.set(h[0],h[1],h[2],h[3])}t.setVec4("cc_debug_view_mode",Nrt)},n(t,[{key:"type",get:function(){return Net.BASIC}},{key:"capabilities",get:function(){return new Vet}},{key:"enableCpuLightCulling",get:function(){return!this._executor||this._executor._context.culling.enableLightCulling},set:function(t){this._executor&&(this._executor._context.culling.enableLightCulling=t)}},{key:"globalDescriptorSetData",get:function(){return this._globalDescSetData}},{key:"defaultSampler",get:function(){return this._defaultSampler}},{key:"defaultShadowTexture",get:function(){return xv(this.device)}},{key:"device",get:function(){return this._device}},{key:"lightingMode",get:function(){return this._lightingMode},set:function(t){this._lightingMode=t}},{key:"usesDeferredPipeline",get:function(){return this._usesDeferredPipeline}},{key:"macros",get:function(){return this._macros}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._globalDSManager.globalDescriptorSet}},{key:"profilerDescriptorSet",get:function(){return this._profilerDescriptorSet}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet}},{key:"globalDescriptorSetInfo",get:function(){return this._globalDescriptorSetInfo}},{key:"commandBuffers",get:function(){return[this._device.commandBuffer]}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){throw new Error("Method not implemented.")}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale=t}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"renderGraph",get:function(){return this._renderGraph}},{key:"resourceGraph",get:function(){return this._resourceGraph}},{key:"layoutGraph",get:function(){return this._layoutGraph}},{key:"resourceUses",get:function(){return this._resourceUses}}]),t}();jrt.MAX_BLOOM_FILTER_PASS_NUM=6,jrt.CSM_UNIFORM_VECTORS=61,jrt.GLOBAL_UNIFORM_VECTORS=64,function(){function t(){this.capacity=0,this.size=0,this.buffer=void 0,this.dataView=void 0,this.capacity=4096,this.buffer=new Uint8Array(this.capacity),this.dataView=new DataView(this.buffer.buffer)}var e=t.prototype;e.b=function(t){var e=this.size+1;e>this.capacity&&this.reserve(e),this.dataView.setUint8(this.size,t?1:0),this.size=e},e.n=function(t){var e=this.size+8;e>this.capacity&&this.reserve(e),this.dataView.setFloat64(this.size,t,!0),this.size=e},e.s=function(t){this.n(t.length);var e=this.size+t.length;e>this.capacity&&this.reserve(e);for(var i=0;i<t.length;i++)this.dataView.setUint8(this.size+i,t.charCodeAt(i));this.size=e},e.reserve=function(t){var e=Math.max(t,2*this.capacity),i=this.buffer;this.buffer=new Uint8Array(e),this.buffer.set(i),this.dataView=new DataView(this.buffer.buffer),this.capacity=e},n(t,[{key:"data",get:function(){return this.buffer.buffer.slice(0,this.size)}}])}();var Xrt=function(){function t(t,e){this.offset=0,this.dataView=void 0,this.dataView=new DataView(t,e)}var e=t.prototype;return e.b=function(){return 0!==this.dataView.getUint8(this.offset++)},e.n=function(){var t=this.dataView.getFloat64(this.offset,!0);return this.offset+=8,t},e.s=function(){var t=this.n(),e=String.fromCharCode.apply(null,Array.from(new Uint8Array(this.dataView.buffer,this.offset,t)));return this.offset+=t,e},t}(),Yrt=function(t,e,i,n,r){this.programInfo=t,this.shaderInfo=e,this.attributes=i,this.blockSizes=n,this.handleMap=r},qrt=function(){this.programInfos=new Map,this.programProxies=new Map},Krt=[2,1,3,0];function Qrt(t,e){var i=r({},e);return i.effectName=t,nS(i),i}function Zrt(t,e){for(var i,n=f(t.blocks);!(i=n()).done;){var r=i.value;if(r.name===e)return{set:r.set,binding:r.binding}}for(var s,o=f(t.buffers);!(s=o()).done;){var a=s.value;if(a.name===e)return{set:a.set,binding:a.binding}}for(var h,u=f(t.samplerTextures);!(h=u()).done;){var l=h.value;if(l.name===e)return{set:l.set,binding:l.binding}}for(var c,_=f(t.samplers);!(c=_()).done;){var d=c.value;if(d.name===e)return{set:d.set,binding:d.binding}}for(var p,m=f(t.textures);!(p=m()).done;){var g=p.value;if(g.name===e)return{set:g.set,binding:g.binding}}for(var y,v=f(t.images);!(y=v()).done;){var S=y.value;if(S.name===e)return{set:S.set,binding:S.binding}}for(var A,T=f(t.subpassInputs);!(A=T()).done;){var b=A.value;if(b.name===e)return{set:b.set,binding:b.binding}}throw z("binding not found in shaderInfo!")}function Jrt(t,e){for(var i=e,n=/layout\s*\(([^)])+\)\s+uniform\s+(\b\w+\b\s+)?sampler(\w+)\s+(\b\w+\b)/g,r=n.exec(i);r;){var s=Zrt(t,r[4]),o="layout(set = "+s.set+", binding = "+s.binding+") uniform "+(r[2]?r[2]:"")+" sampler"+r[3]+" "+r[4];i=i.replace(r[0],o),r=n.exec(i)}for(var a=/layout\s*\(([^)]+)\)\s*(readonly|writeonly)?\s*\b((uniform\s*|buffer\s*|image2D\s*){1,2})\b\s*(\b\w+\b)\s*[{;]/g,h=a.exec(i);h;){var u=Zrt(t,h[5]),l=u.set,c=u.binding,_=h[2]?h[2]:"",f=" {";h[3].includes("image")&&(f=";");var d=h[1],p="layout("+(d=(d=d.replace(/set\s*=\s*\d+/g,"set = "+l)).replace(/binding\s*=\s*\d+/g,"binding = "+c))+") "+_+" "+h[3]+" "+h[5]+f;i=i.replace(h[0],p),h=a.exec(i)}return i}function $rt(t,e){!function(t,e){"glsl4"===aS(nd.gfxDevice)&&(e.glsl4.vert&&(e.glsl4.vert=Jrt(t,e.glsl4.vert)),e.glsl4.frag&&(e.glsl4.frag=Jrt(t,e.glsl4.frag)),e.glsl4.compute&&(e.glsl4.compute=Jrt(t,e.glsl4.compute)))}(t,e);for(var i,n=Krt[ttt.PER_BATCH],r=f(e.blocks);!(i=r()).done;){for(var s,o=i.value,a=!1,h=f(t.blocks);!(s=h()).done;){var u=s.value;if(u.set===n&&u.name===o.name){o.binding=u.binding,a=!0;break}}a||z("Block "+o.name+" not found in shader "+t.name)}}function tst(t,e,i,n,r){for(var s,o=f(t.descriptorBlocks);!(s=o()).done;){var a=s.value,h=a.visibility,u=a.offset;switch(a.type){case ytt.UNIFORM_BUFFER:for(var l,c=f(e.blocks);!(l=c()).done;){var _=l.value;_.stageFlags===h&&(r.push(tS(_.members)),n.blocks.push(new B_(i,u,_.name,_.members.map((function(t){return new P_(t.name,t.type,t.count)})),1)),++u)}break;case ytt.DYNAMIC_UNIFORM_BUFFER:break;case ytt.SAMPLER_TEXTURE:for(var d,p=f(e.samplerTextures);!(d=p()).done;){var m=d.value;m.stageFlags===h&&(n.samplerTextures.push(new O_(i,u,m.name,m.type,m.count)),++u)}break;case ytt.SAMPLER:for(var g,y=f(e.samplers);!(g=y()).done;){var v=g.value;v.stageFlags===h&&(n.samplers.push(new L_(i,u,v.name,v.count)),++u)}break;case ytt.TEXTURE:for(var S,A=f(e.textures);!(S=A()).done;){var T=S.value;T.stageFlags===h&&(n.textures.push(new N_(i,u,T.name,T.type,T.count)),++u)}break;case ytt.STORAGE_BUFFER:for(var b,E=f(e.buffers);!(b=E()).done;){var C=b.value;C.stageFlags===h&&(n.buffers.push(new k_(i,u,C.name,1,C.memoryAccess)),++u)}break;case ytt.DYNAMIC_STORAGE_BUFFER:break;case ytt.STORAGE_IMAGE:for(var x,w=f(e.images);!(x=w()).done;){var D=x.value;D.stageFlags===h&&(n.images.push(new F_(i,u,D.name,D.type,D.count,D.memoryAccess)),++u)}break;case ytt.INPUT_ATTACHMENT:for(var R,I=f(e.subpassInputs);!(R=I()).done;){var M=R.value;M.stageFlags===h&&(n.subpassInputs.push(new V_(i,M.binding,M.name,M.count)),++u)}}}}function est(t,e,i,n,r){for(var s,o=f(e.descriptorBlocks);!(s=o()).done;){var a=s.value,h=a.offset;switch(a.type){case ytt.UNIFORM_BUFFER:for(var u,l=f(a.descriptors);!(u=l()).done;){var c=u.value,_=e.uniformBlocks.get(c.descriptorID);void 0!==_?(r.push(tS(_.members)),n.blocks.push(new B_(i,h,t[c.descriptorID],_.members.map((function(t){return new P_(t.name,t.type,t.count)})),1)),++h):z("Failed to find uniform block "+c.descriptorID+" in layout")}h!==a.offset+a.capacity&&z("Uniform buffer binding mismatch for set "+i);break;case ytt.DYNAMIC_UNIFORM_BUFFER:break;case ytt.SAMPLER_TEXTURE:for(var d,p=f(a.descriptors);!(d=p()).done;){var m=d.value;n.samplerTextures.push(new O_(i,h,t[m.descriptorID],m.type,m.count)),++h}break;case ytt.SAMPLER:for(var g,y=f(a.descriptors);!(g=y()).done;){var v=g.value;n.samplers.push(new L_(i,h,t[v.descriptorID],v.count)),++h}break;case ytt.TEXTURE:for(var S,A=f(a.descriptors);!(S=A()).done;){var T=S.value;n.textures.push(new N_(i,h,t[T.descriptorID],T.type,T.count)),++h}break;case ytt.STORAGE_BUFFER:for(var b,E=f(a.descriptors);!(b=E()).done;){var C=b.value;n.buffers.push(new k_(i,h,t[C.descriptorID],1,xc.READ_WRITE)),++h}break;case ytt.DYNAMIC_STORAGE_BUFFER:break;case ytt.STORAGE_IMAGE:for(var x,w=f(a.descriptors);!(x=w()).done;){var D=x.value;n.images.push(new F_(i,h,t[D.descriptorID],D.type,D.count,xc.READ_WRITE)),++h}break;case ytt.INPUT_ATTACHMENT:for(var R,I=f(a.descriptors);!(R=I()).done;){var M=R.value;n.subpassInputs.push(new V_(i,h,t[M.descriptorID],M.count)),++h}}}}function ist(t,e,i,n,r,s){var o=[null,null,null,null],a=null,h=new z_,u=new Array,l=e.descriptorSets.get(ttt.PER_PASS);l&&(o[ttt.PER_PASS]=l.descriptorSetLayoutData,est(t.valueNames,l.descriptorSetLayoutData,Krt[ttt.PER_PASS],h,u));var c=i.descriptorSets.get(ttt.PER_PHASE);c&&(o[ttt.PER_PHASE]=c.descriptorSetLayoutData,est(t.valueNames,c.descriptorSetLayoutData,Krt[ttt.PER_PHASE],h,u));var _=n.descriptors[ttt.PER_BATCH];if(r){var d=r.layout.descriptorSets.get(ttt.PER_BATCH);d&&(o[ttt.PER_BATCH]=d.descriptorSetLayoutData,est(t.valueNames,d.descriptorSetLayoutData,Krt[ttt.PER_BATCH],h,u))}else{var p=i.descriptorSets.get(ttt.PER_BATCH);p&&(o[ttt.PER_BATCH]=p.descriptorSetLayoutData,tst(p.descriptorSetLayoutData,_,Krt[ttt.PER_BATCH],h,u))}var m=n.descriptors[ttt.PER_INSTANCE];if(r)if(s)a=qg,function(t,e,i,n){for(var r=Krt[ttt.PER_INSTANCE],s=function(){var s=t.blocks[o],a=e.layouts[s.name],h=a&&e.bindings.find((function(t){return t.binding===a.binding}));if(!(a&&h&&h.descriptorType&df))return console.warn("builtin UBO '"+s.name+"' not available!"),1;n.push(tS(s.members)),i.blocks.push(new B_(r,h.binding,s.name,s.members.map((function(t){return new P_(t.name,t.type,t.count)})),1))},o=0;o<t.blocks.length;o++)s();for(var a=function(){var n=t.samplerTextures[h],s=e.layouts[n.name],o=s&&e.bindings.find((function(t){return t.binding===s.binding}));if(!(s&&o&&o.descriptorType&pf))return console.warn("builtin samplerTexture '"+n.name+"' not available!"),1;i.samplerTextures.push(new O_(r,o.binding,n.name,n.type,n.count))},h=0;h<t.samplerTextures.length;h++)a()}(m,qg,h,u);else{var g=r.layout.descriptorSets.get(ttt.PER_INSTANCE);g&&(o[ttt.PER_INSTANCE]=g.descriptorSetLayoutData,est(t.valueNames,g.descriptorSetLayoutData,Krt[ttt.PER_INSTANCE],h,u))}else{var y=i.descriptorSets.get(ttt.PER_INSTANCE);y&&(o[ttt.PER_INSTANCE]=y.descriptorSetLayoutData,tst(y.descriptorSetLayoutData,m,Krt[ttt.PER_INSTANCE],h,u))}return function(t,e,i){var n,r,s,o,a=new Array(4),h=(null===(n=t[ttt.PER_PASS])||void 0===n?void 0:n.uniformBlockCapacity)||0,u=(null===(r=t[ttt.PER_PHASE])||void 0===r?void 0:r.uniformBlockCapacity)||0,l=(null===(s=t[ttt.PER_BATCH])||void 0===s?void 0:s.uniformBlockCapacity)||0,c=e?function(t){for(var e,i=0,n=f(t.bindings);!(e=n()).done;){var r=e.value;r.descriptorType!==$c.UNIFORM_BUFFER&&r.descriptorType!==$c.DYNAMIC_UNIFORM_BUFFER||(i+=r.count)}return i}(e):(null===(o=t[ttt.PER_INSTANCE])||void 0===o?void 0:o.uniformBlockCapacity)||0;a[Krt[ttt.PER_PASS]]=h,a[Krt[ttt.PER_PHASE]]=u,a[Krt[ttt.PER_BATCH]]=l,a[Krt[ttt.PER_INSTANCE]]=c;var _=0+h,d=_+u,p=d+c,m=new Array(4);m[Krt[ttt.PER_PASS]]=0,m[Krt[ttt.PER_PHASE]]=_,m[Krt[ttt.PER_BATCH]]=p,m[Krt[ttt.PER_INSTANCE]]=d,function(t,e){for(var i,n=f(e);!(i=n()).done;){var r=i.value;r.flattened=t[r.set]+r.binding}}(m,i.blocks);var g,y,v,S=0+((null===(g=t[ttt.PER_PASS])||void 0===g?void 0:g.samplerTextureCapacity)||0),A=S+((null===(y=t[ttt.PER_PHASE])||void 0===y?void 0:y.samplerTextureCapacity)||0),T=A+(e?function(t){for(var e,i=0,n=f(t.bindings);!(e=n()).done;){var r=e.value;r.descriptorType!==$c.UNIFORM_BUFFER&&r.descriptorType!==$c.DYNAMIC_UNIFORM_BUFFER&&(i+=r.count)}return i}(e):(null===(v=t[ttt.PER_INSTANCE])||void 0===v?void 0:v.samplerTextureCapacity)||0),b=new Array(4);b[Krt[ttt.PER_PASS]]=0,b[Krt[ttt.PER_PHASE]]=S,b[Krt[ttt.PER_BATCH]]=T,b[Krt[ttt.PER_INSTANCE]]=A,function(t,e,i){for(var n,r=f(i);!(n=r()).done;){var s=n.value;s.flattened=t[s.set]+s.binding-e[s.set]}}(b,a,i.samplerTextures)}(o,a,h),h.stages.push(new G_(Uc.VERTEX,"")),h.stages.push(new G_(Uc.FRAGMENT,"")),[h,u]}var nst=function(){function t(t,e){void 0===e&&(e=null),this.shader=void 0,this.pipelineState=null,this.shader=t,this.pipelineState=e}return n(t,[{key:"name",get:function(){return this.shader.name}}]),t}();function rst(t,e){for(var i in t.layouts){var n=t.layouts[i];if(n.binding===e){H(n.name===i);var r=bc.UNKNOWN;return(n instanceof O_||n instanceof F_)&&(r=n.type),[n.name,r]}}return z("descriptor not found"),["",bc.UNKNOWN]}function sst(t,e){for(var i,n=new zet,r=f(e.bindings);!(i=r()).done;){var s=i.value,o=rst(e,s.binding),a=o[0],h=o[1],u=_nt(t,a),l=rnt(s.descriptorType),c=new Uet(l,s.stageFlags,s.count);c.offset=s.binding,c.descriptors.push(new Get(u,h,s.count)),n.descriptorBlocks.push(c),void 0!==n.bindingMap.get(u)&&z("duplicate descriptor name '"+a+"'"),n.bindingMap.set(u,s.binding);var _=e.layouts[a];_ instanceof B_&&n.uniformBlocks.set(u,_)}return n}function ost(t,e,i,n,r,s){var o=mnt(i,ttt.PER_BATCH,Krt[ttt.PER_BATCH],e.descriptors[ttt.PER_BATCH]),a=new Het(o);if(gnt(a.descriptorSetLayoutData,a.descriptorSetLayoutInfo),r.layout.descriptorSets.set(ttt.PER_BATCH,a),s){var h=sst(i,qg),u=new Het(h);if(gnt(u.descriptorSetLayoutData,u.descriptorSetLayoutInfo),qg.bindings.length!==u.descriptorSetLayoutInfo.bindings.length)z("local descriptor set layout inconsistent");else for(var l=0;l!==qg.bindings.length;++l){var c=qg.bindings[l],_=u.descriptorSetLayoutInfo.bindings[l];c.binding===_.binding&&c.descriptorType===_.descriptorType&&c.count===_.count&&c.stageFlags===_.stageFlags||z("local descriptor set layout inconsistent")}r.layout.descriptorSets.set(ttt.PER_INSTANCE,u)}else{var f=mnt(i,ttt.PER_INSTANCE,Krt[ttt.PER_INSTANCE],e.descriptors[ttt.PER_INSTANCE]),d=new Het(f);gnt(d.descriptorSetLayoutData,d.descriptorSetLayoutInfo),r.layout.descriptorSets.set(ttt.PER_INSTANCE,d)}var p=n.shaderPrograms.length;n.shaderIndex.set(t,p),n.shaderPrograms.push(r)}function ast(t,e,i,n,r){H(r<ttt.PER_PHASE);var s=e.j(i),o=s.shaderIndex.get(n);if(void 0===o)return vnt();var a=s.shaderPrograms[o].layout.descriptorSets.get(r);return void 0===a?vnt():(a.descriptorSetLayout||(a.descriptorSetLayout=t.createDescriptorSetLayout(a.descriptorSetLayoutInfo)),a.descriptorSetLayout)}function hst(t,e,i,n,r){H(r<ttt.PER_PHASE);var s=e.j(i),o=s.shaderIndex.get(n);if(void 0===o)return null;var a=s.shaderPrograms[o].layout.descriptorSets.get(r);return void 0===a?null:(a.descriptorSetLayout||(a.descriptorSetLayout=t.createDescriptorSetLayout(a.descriptorSetLayoutInfo)),a.descriptorSetLayout)}function ust(t,e,i){var n=i.program,r=snt(t,i.pass);if(r===int)return z("Invalid render pass, program: "+n),[int,int,int,null,int];var s=i.subpass&&""!==i.subpass&&!0,o=s?ont(t,r,i.subpass):int;if(s&&o===int)return z("Invalid render subpass, program: "+n),[int,int,int,null,int];var a=ant(t,o===int?r:o,i.phase);if(a===int)return z("Invalid render phase, program: "+n),[int,int,int,null,int];for(var h=null,u=int,l=0;l<e.shaders.length;++l){var c=e.shaders[l];if(c.name===n){h=c,u=l;break}}return[r,o,a,h,u]}function lst(t){return void 0===t.descriptors?(z("No descriptors in shader: "+t.name+", please reimport ALL effects"),1):0}var cst=function(){function t(t){this.layoutGraph=void 0,this.phases=new Map,this.mergeHighFrequency=!1,this.fixedLocal=!0,this.localLayoutData=new zet,this.localDescriptorSetLayout=null,this.emptyDescriptorSetLayout=null,this.emptyPipelineLayout=null,this.pipeline=null,this.device=null,this.layoutGraph=t;for(var e,i=f(t.v());!(e=i()).done;){var n=e.value;t.h(1,n)&&this.phases.set(n,new qrt)}}var e=t.prototype;return e.init=function(t){if(this.device!==t){this.device=t,this.emptyDescriptorSetLayout=this.device.createDescriptorSetLayout(new tf),this.emptyPipelineLayout=this.device.createPipelineLayout(new nf);var e=Math.floor((this.device.capabilities.maxVertexUniformVectors-38)/3);e=e<256?e:256,Ry.initLayout(e);for(var i,n=this.layoutGraph,r=f(n.v());!(i=r()).done;)for(var s,o=i.value,a=f(n.getLayout(o).descriptorSets);!(s=a()).done;){var h=s.value;h[0];var u=h[1];gnt(u.descriptorSetLayoutData,u.descriptorSetLayoutInfo),u.descriptorSetLayout=this.device.createDescriptorSetLayout(u.descriptorSetLayoutInfo),H(!!u.descriptorSetLayout),u.descriptorSet=this.device.createDescriptorSet(new ef(u.descriptorSetLayout)),H(!!u.descriptorSet)}for(var l,c=f(n.v());!(l=c()).done;){var _=l.value;if(n.h(1,_)){var d=_,p=n.getParent(d),m=n.getLayout(p),g=n.getLayout(d),y=new nf;ynt(m,ttt.PER_PASS,y),ynt(g,ttt.PER_PHASE,y),ynt(g,ttt.PER_BATCH,y),ynt(g,ttt.PER_INSTANCE,y),n.j(d).pipelineLayout=this.device.createPipelineLayout(y)}}var v=qg;this.localLayoutData=sst(n,v);var S,A=new tf;gnt(this.localLayoutData,A),this.localDescriptorSetLayout=this.device.createDescriptorSetLayout(A),H(!!this.localDescriptorSetLayout);for(var T,b=0,E=f(this.localLayoutData.descriptorBlocks);!(T=E()).done;){var C=T.value;if(C.type===ytt.UNIFORM_BUFFER||C.type===ytt.DYNAMIC_UNIFORM_BUFFER)for(var x,w=f(C.descriptors);!(x=w()).done;)b+=x.value.count}H(7===b),S=this.device,this.layoutGraph.constantMacros,S.getFormatFeatures(Ac.RGBA32F),Mc.RENDER_TARGET,Mc.SAMPLED_TEXTURE,S.capabilities.maxVertexUniformVectors,S.capabilities.maxFragmentUniformVectors,S.hasFeature(Sc.INPUT_ATTACHMENT_BENEFIT),Ry.JOINT_UNIFORM_CAPACITY}},e.addEffect=function(t){for(var e,i=this.layoutGraph,n=f(t.techniques);!(e=n()).done;)for(var r,s=f(e.value.passes);!(r=s()).done;){var o=r.value,a=o.program,h=ust(i,t,o),u=h[0],l=h[1],c=h[2],_=h[3];if(null===_||lst(_))z("program: "+a+" not found");else{H(u!==int&&c!==int);var d=l===int?u:l,p=i.getLayout(d),m=i.getLayout(c),g=this.phases.get(c);void 0===g&&(g=new qrt,this.phases.set(c,g));var y=g.programInfos,v=Qrt(t.name,_),S=null;if(!this.mergeHighFrequency){var A=i.j(c);ost(a,_,i,A,S=new Ket,this.fixedLocal)}var T=ist(i,p,m,_,S,this.fixedLocal),b=T[0],E=T[1];$rt(b,v);for(var C,x=eS(b),w=new Array,D=f(v.attributes);!(C=D()).done;){var R=C.value;w.push(new U_(R.name,R.format,R.isNormalized,0,R.isInstanced,R.location))}var I=new Yrt(v,b,w,E,x);y.set(_.name,I)}}},e.precompileEffect=function(t,e){for(var i,n=this,r=this.layoutGraph,s=f(e.techniques);!(i=s()).done;)for(var o,a=function(){var i=o.value,s=i.program,a=ust(r,e,i),h=a[0];a[1];var u=a[2],l=a[3],c=a[4];if(null===l||lst(l))return z("program: "+s+" not valid"),0;H(h!==int&&u!==int&&c!==int);var _=e.combinations[c];if(!_)return 0;rS(_).forEach((function(e){return n.getProgramVariant(t,u,s,e)}))},h=f(i.value.passes);!(o=h()).done;)a()},e.getProgramInfo=function(t,e){return H(t!==int),this.phases.get(t).programInfos.get(e).programInfo},e.getShaderInfo=function(t,e){return H(t!==int),this.phases.get(t).programInfos.get(e).shaderInfo},e.getKey=function(t,e,i){H(t!==int);var n=this.phases.get(t);if(void 0===n)return z("Invalid render phase, program: "+e),"";var r=n.programInfos.get(e);return void 0===r?(z("Invalid program, program: "+e),""):Zv(r.programInfo,i)},e.getProgramVariant=function(t,e,i,n,r){var s;void 0===r&&(r=null),Object.assign(n,null===(s=this.pipeline)||void 0===s?void 0:s.macros),H(e!==int);var o=this.phases.get(e);if(void 0===o)return z("Invalid render phase, program: "+i),null;var a=o.programInfos.get(i);if(void 0===a)return z("Invalid program, program: "+i),null;var h=a.programInfo;null===r&&(r=Zv(h,n));var u=o.programProxies,l=u.get(r);if(void 0!==l)return l;var c=Yv(n,h.defines),_=this.layoutGraph.constantMacros+h.constantMacros+c.reduce((function(t,e){return t+"#define "+e.name+" "+e.value+"\n"}),""),f=h.glsl3,d=aS(t);d?f=h[d]:et(16346);var p=a.shaderInfo;f.compute?(p.stages[0].source=_+f.compute,p.stages[0].stage=Uc.COMPUTE,p.stages.length=1):(p.stages[0].source=_+f.vert,p.stages[1].source=_+f.frag),p.attributes=Qv(h,a.attributes,n),p.name=qv(i,c);var m=t.createShader(p),g=new nst(m);return u.set(r,g),g},e.getMaterialDescriptorSetLayout=function(t,e,i){if(this.mergeHighFrequency){H(e!==int);var n=this.layoutGraph.getParent(e);return Ant(this.layoutGraph,n,e,ttt.PER_BATCH)}return ast(t,this.layoutGraph,e,i,ttt.PER_BATCH)},e.getLocalDescriptorSetLayout=function(t,e,i){if(this.mergeHighFrequency){H(e!==int);var n=this.layoutGraph.getParent(e);return Ant(this.layoutGraph,n,e,ttt.PER_INSTANCE)}return ast(t,this.layoutGraph,e,i,ttt.PER_INSTANCE)},e.getBlockSizes=function(t,e){H(t!==int);var i=this.phases.get(t);if(!i)return z("Invalid render phase, program: "+e),[];var n=i.programInfos.get(e);return n?n.blockSizes:(z("Invalid program, program: "+e),[])},e.getHandleMap=function(t,e){H(t!==int);var i=this.phases.get(t);if(!i)return z("Invalid render phase, program: "+e),{};var n=i.programInfos.get(e);return n?n.handleMap:(z("Invalid program, program: "+e),{})},e.getPipelineLayout=function(t,e,i){if(this.mergeHighFrequency)return H(e!==int),this.layoutGraph.j(e).pipelineLayout;var n=this.layoutGraph,r=n.j(e),s=r.shaderIndex.get(i);if(void 0===s)return Snt();var o=r.shaderPrograms[s];if(o.pipelineLayout)return o.pipelineLayout;var a=n.getParent(e);if(a===int)return Snt();var h=new nf,u=Tnt(this.layoutGraph,a,e,ttt.PER_PASS);u&&h.setLayouts.push(u);var l=Tnt(this.layoutGraph,a,e,ttt.PER_PHASE);l&&h.setLayouts.push(l);var c=hst(t,n,e,i,ttt.PER_BATCH);c&&h.setLayouts.push(c);var _=hst(t,n,e,i,ttt.PER_INSTANCE);return _&&h.setLayouts.push(_),o.pipelineLayout=t.createPipelineLayout(h),o.pipelineLayout},e.getProgramID=function(t,e){return function(t,e,i){H(e!==t.N);var n=t.j(e).shaderIndex.get(i);return void 0===n?int:n}(this.layoutGraph,t,e)},e.getDescriptorNameID=function(t){return function(t,e){var i=t.attributeIndex.get(e);return void 0===i?int:i}(this.layoutGraph,t)},e.getDescriptorName=function(t){return function(t,e){return e>=t.valueNames.length?"":t.valueNames[e]}(this.layoutGraph,t)},t}(),_st=null,fst=!1;function dst(){fst=!0}var pst=[],mst=4294967295,gst=new $et,yst=new cst(gst),vst=new Map,Sst=Object.freeze({__proto__:null,INVALID_ID:mst,enableEffectImport:!0,programLib:yst,createCustomPipeline:function(){var t=new jrt(gst),e=Pe.CUSTOM_PIPELINE_NAME;return t.setCustomPipelineName(e),yst.pipeline=t,t},customPipelineBuilderMap:vst,setCustomPipeline:function(t,e){vst.set(t,e),dst()},getCustomPipeline:function(t){var e=vst.get(t);return e||(e=vst.get("Forward")),e},init:function(t,e){if(e&&e.byteLength>=8){var i=new Uint8Array(e);if(new DataView(i.buffer,i.byteOffset,8).getUint32(0)===mst){var n=new $M.Inflate(new Uint8Array(i.buffer,i.byteOffset+8)).decompress();_it(new Xrt(n.buffer,n.byteOffset),gst)}else _it(new Xrt(i.buffer,i.byteOffset),gst)}!function(t,e){hnt=t.createDescriptorSetLayout(new tf),unt=t.createPipelineLayout(new nf);for(var i,n=f(e.v());!(i=n()).done;)for(var r,s=i.value,o=f(e.getLayout(s).descriptorSets);!(r=o()).done;){var a=r.value;a[0];var h=a[1];null!==h.descriptorSetLayout&&U("descriptor set layout already initialized. It will be overwritten"),gnt(h.descriptorSetLayoutData,h.descriptorSetLayoutInfo),h.descriptorSetLayout=t.createDescriptorSetLayout(h.descriptorSetLayoutInfo)}for(var u,l=f(e.v());!(u=l()).done;){var c=u.value;if(e.h(1,c)){var _=e.getParent(c),d=c,p=e.getLayout(_),m=e.getLayout(d),g=new nf;ynt(p,ttt.PER_PASS,g),ynt(m,ttt.PER_PHASE,g),ynt(m,ttt.PER_BATCH,g),ynt(m,ttt.PER_INSTANCE,g),e.j(d).pipelineLayout=t.createPipelineLayout(g)}}}(t,gst)},destroy:function(){!function(t){for(var e,i=f(t.v());!(e=i()).done;)for(var n,r=e.value,s=f(t.getLayout(r).descriptorSets);!(n=s()).done;){var o=n.value;o[0];var a=o[1];null!==a.descriptorSetLayout&&a.descriptorSetLayout.destroy()}unt.destroy(),hnt.destroy()}(gst)},getPassID:function(t){return snt(gst,t)},getSubpassID:function(t,e){return ont(gst,t,e)},getPhaseID:function(t,e){return ant(gst,t,e)},completePhaseName:function(t){return"number"==typeof t?t.toString():"string"==typeof t?t:"default"},get UpdateFrequency(){return ttt},ParameterType:_tt,get ResourceResidency(){return att},get QueueHint(){return htt},get ResourceDimension(){return utt},get ResourceFlags(){return ltt},TaskType:{SYNC:0,ASYNC:1},get SceneFlags(){return ctt},LightingMode:dtt,AttachmentType:ptt,get AccessType(){return ftt},ClearValueType:mtt,LightInfo:gtt,DescriptorTypeOrder:ytt,Descriptor:vtt,DescriptorBlock:Stt,DescriptorBlockFlattened:Att,DescriptorBlockIndex:Ttt,ResolveFlags:btt,ResolvePair:Ett,CopyPair:Ctt,UploadPair:xtt,MovePair:wtt,PipelineStatistics:Dtt,RenderCommonObjectPool:Btt,saveLightInfo:function(t,e){t.n(e.level),t.b(e.culledByLight)},loadLightInfo:function(t,e){e.level=t.n(),e.culledByLight=t.b()},saveDescriptor:Ott,loadDescriptor:Ltt,saveDescriptorBlock:function(t,e){t.n(e.descriptors.size);for(var i,n=f(e.descriptors);!(i=n()).done;){var r=i.value,s=r[0],o=r[1];t.s(s),Ott(t,o)}t.n(e.uniformBlocks.size);for(var a,h=f(e.uniformBlocks);!(a=h()).done;){var u=a.value,l=u[0],c=u[1];t.s(l),rtt(t,c)}t.n(e.capacity),t.n(e.count)},loadDescriptorBlock:function(t,e){var i=0;i=t.n();for(var n=0;n!==i;++n){var r=t.s(),s=new vtt;Ltt(t,s),e.descriptors.set(r,s)}i=t.n();for(var o=0;o!==i;++o){var a=t.s(),h=new B_;stt(t,h),e.uniformBlocks.set(a,h)}e.capacity=t.n(),e.count=t.n()},saveDescriptorBlockFlattened:function(t,e){t.n(e.descriptorNames.length);for(var i,n=f(e.descriptorNames);!(i=n()).done;){var r=i.value;t.s(r)}t.n(e.uniformBlockNames.length);for(var s,o=f(e.uniformBlockNames);!(s=o()).done;){var a=s.value;t.s(a)}t.n(e.descriptors.length);for(var h,u=f(e.descriptors);!(h=u()).done;)Ott(t,h.value);t.n(e.uniformBlocks.length);for(var l,c=f(e.uniformBlocks);!(l=c()).done;)rtt(t,l.value);t.n(e.capacity),t.n(e.count)},loadDescriptorBlockFlattened:function(t,e){var i=0;i=t.n(),e.descriptorNames.length=i;for(var n=0;n!==i;++n)e.descriptorNames[n]=t.s();i=t.n(),e.uniformBlockNames.length=i;for(var r=0;r!==i;++r)e.uniformBlockNames[r]=t.s();i=t.n(),e.descriptors.length=i;for(var s=0;s!==i;++s){var o=new vtt;Ltt(t,o),e.descriptors[s]=o}i=t.n(),e.uniformBlocks.length=i;for(var a=0;a!==i;++a){var h=new B_;stt(t,h),e.uniformBlocks[a]=h}e.capacity=t.n(),e.count=t.n()},saveDescriptorBlockIndex:function(t,e){t.n(e.updateFrequency),t.n(e.parameterType),t.n(e.descriptorType),t.n(e.visibility)},loadDescriptorBlockIndex:function(t,e){e.updateFrequency=t.n(),e.parameterType=t.n(),e.descriptorType=t.n(),e.visibility=t.n()},saveResolvePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.resolveFlags),t.n(e.mode),t.n(e.mode1)},loadResolvePair:function(t,e){e.source=t.s(),e.target=t.s(),e.resolveFlags=t.n(),e.mode=t.n(),e.mode1=t.n()},saveCopyPair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.sourceMostDetailedMip),t.n(e.sourceFirstSlice),t.n(e.sourcePlaneSlice),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},loadCopyPair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.sourceMostDetailedMip=t.n(),e.sourceFirstSlice=t.n(),e.sourcePlaneSlice=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},saveMovePair:function(t,e){t.s(e.source),t.s(e.target),t.n(e.mipLevels),t.n(e.numSlices),t.n(e.targetMostDetailedMip),t.n(e.targetFirstSlice),t.n(e.targetPlaneSlice)},loadMovePair:function(t,e){e.source=t.s(),e.target=t.s(),e.mipLevels=t.n(),e.numSlices=t.n(),e.targetMostDetailedMip=t.n(),e.targetFirstSlice=t.n(),e.targetPlaneSlice=t.n()},savePipelineStatistics:function(t,e){t.n(e.numRenderPasses),t.n(e.numManagedTextures),t.n(e.totalManagedTextures),t.n(e.numUploadBuffers),t.n(e.numUploadBufferViews),t.n(e.numFreeUploadBuffers),t.n(e.numFreeUploadBufferViews),t.n(e.numDescriptorSets),t.n(e.numFreeDescriptorSets),t.n(e.numInstancingBuffers),t.n(e.numInstancingUniformBlocks)},loadPipelineStatistics:function(t,e){e.numRenderPasses=t.n(),e.numManagedTextures=t.n(),e.totalManagedTextures=t.n(),e.numUploadBuffers=t.n(),e.numUploadBufferViews=t.n(),e.numFreeUploadBuffers=t.n(),e.numFreeUploadBufferViews=t.n(),e.numDescriptorSets=t.n(),e.numFreeDescriptorSets=t.n(),e.numInstancingBuffers=t.n(),e.numInstancingUniformBlocks=t.n()},get PipelineType(){return Net},get SubpassCapabilities(){return Fet},PipelineCapabilities:Vet,packRGBE:function(t){var e=Math.max(Math.max(t.x,t.y),t.z),i=128;e>1e-4&&(i=Math.log(e)/Math.log(1.1),i=Ni((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=function(t,e,i){if(e>i){var n=e;e=i,i=n}return t<e?e:t>i?i:t}(t.multiplyScalar(n),new mn(0,0,0),new mn(1,1,1));r.multiplyScalar(255);var s,o,a=Cn(r).add((s=r.subtract(Cn(r)))<(o=new mn(.5,.5,.5))?o:s);return new ln(a.x/255,a.y/255,a.z/255,i/255)},setEditorPipelineSettings:function(t){_st=t,fst=!0},getEditorPipelineSettings:function(){return _st},forceResizeAllWindows:dst,defaultWindowResize:function(t,e,i,n){t.addRenderWindow(e.colorName,Ac.BGRA8,i,n,e),t.addDepthStencil(e.depthStencilName,Ac.DEPTH_STENCIL,i,n);var r=e.renderWindowId,s=wv(t.device)?Ac.R32F:Ac.RGBA8,o=t.pipelineSceneData.shadows.size;t.addRenderTarget("ShadowMap"+r,s,o.x,o.y),t.addDepthStencil("ShadowDepth"+r,Ac.DEPTH_STENCIL,o.x,o.y)},dispatchResizeEvents:function(t,e,i){if(e.windowResize){for(var n,r=f(t);!(n=r()).done;){var s=n.value;if(s.window.isRenderWindowResized()||fst){var o=Math.max(Math.floor(s.window.width),1),a=Math.max(Math.floor(s.window.height),1);e.windowResize(i,s.window,s,o,a),pst.push(s.window)}}for(var h,u=f(pst);!(h=u()).done;)h.value.setRenderWindowResizeHandled();pst.length=0,fst=!1}}});t("eC",Sst),v.rendering=Sst;var Ast=Object.setPrototypeOf,Tst={};Tst||(Tst={}),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],o=s.armature;null!==o._armatureData&&(o.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}(Tst||(Tst={})),console.warn||(console.warn=function(){}),console.assert||(console.assert=function(){}),Date.now||(Date.now=function(){return(new Date).getTime()}),Ast=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}(Tst||(Tst={})),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,o=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,o+=this.tx*t.b),this.a=e,this.b=i,this.c=n,this.d=r,this.tx=s,this.ty=o,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 o=t*n-e*i;if(0===o)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;o=1/o;var a=this.a=n*o;return e=this.b=-e*o,i=this.c=-i*o,n=this.d=t*o,this.tx=-(a*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,o=e?0:this.tx,a=e?0:this.ty,h=t.x,u=t.y,l=h+t.width,c=u+t.height,_=i*h+r*u+o,f=n*h+s*u+a,d=i*l+r*u+o,p=n*l+s*u+a,m=i*l+r*c+o,g=n*l+s*c+a,y=i*h+r*c+o,v=n*h+s*c+a,S=0;_>d&&(S=_,_=d,d=S),m>y&&(S=m,m=y,y=S),t.x=Math.floor(_<m?_:m),t.width=Math.ceil((d>y?d:y)-t.x),f>p&&(S=f,f=p,p=S),g>v&&(S=g,g=v,v=S),t.y=Math.floor(f<g?f:g),t.height=Math.ceil((p>v?p:v)-t.y)},t}();t.Matrix=e}(Tst||(Tst={})),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}(Tst||(Tst={})),function(t){var e=function(){function t(t,e,i,n,r,s,o,a){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===o&&(o=0),void 0===a&&(a=0),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=i,this.blueMultiplier=n,this.alphaOffset=r,this.redOffset=s,this.greenOffset=o,this.blueOffset=a}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}(Tst||(Tst={})),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}(Tst||(Tst={})),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}(Tst||(Tst={})),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 Ast(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 Ast(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}(Tst||(Tst={})),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 Ast(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}(Tst||(Tst={})),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 Ast(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 o in this.constraints){var a=this.constraints[o];if(a.root===r&&this.sortedBones.indexOf(a.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 Ast(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 Ast(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 Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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 Ast(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 Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return Ast(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}(Tst||(Tst={})),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 Ast(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 Ast(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 Ast(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 Ast(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 o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.boundingBox=null,e}return Ast(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=o;var a=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.vertices=new e,i.curveLengths=[],i}return Ast(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=a;var h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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 Ast(e,t),e.toString=function(){return"[class dragonBones.RectangleBoundingBoxData]"},e._computeOutCode=function(t,e,i,n,r,s){var o=0;return t<i?o|=1:t>r&&(o|=2),e<n?o|=4:e>s&&(o|=8),o},e.rectangleIntersectsSegment=function(t,i,n,r,s,o,a,h,u,l,c){void 0===u&&(u=null),void 0===l&&(l=null),void 0===c&&(c=null);var _=t>s&&t<a&&i>o&&i<h,f=n>s&&n<a&&r>o&&r<h;if(_&&f)return-1;for(var d=0,p=e._computeOutCode(t,i,s,o,a,h),m=e._computeOutCode(n,r,s,o,a,h);;){if(0==(p|m)){d=2;break}if(0!=(p&m))break;var g=0,y=0,v=0,S=0!==p?p:m;0!=(4&S)?(g=t+(n-t)*(o-i)/(r-i),y=o,null!==c&&(v=.5*-Math.PI)):0!=(8&S)?(g=t+(n-t)*(h-i)/(r-i),y=h,null!==c&&(v=.5*Math.PI)):0!=(2&S)?(y=i+(r-i)*(a-t)/(n-t),g=a,null!==c&&(v=0)):0!=(1&S)&&(y=i+(r-i)*(s-t)/(n-t),g=s,null!==c&&(v=Math.PI)),S===p?(t=g,i=y,p=e._computeOutCode(t,i,s,o,a,h),null!==c&&(c.x=v)):(n=g,r=y,m=e._computeOutCode(n,r,s,o,a,h),null!==c&&(c.y=v))}return d&&(_?(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)):f?(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,o,a){void 0===s&&(s=null),void 0===o&&(o=null),void 0===a&&(a=null);var h=.5*this.width,u=.5*this.height;return e.rectangleIntersectsSegment(t,i,n,r,-h,-u,h,u,s,o,a)},e}(e);t.RectangleBoundingBoxData=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,i,n,r,s,o,a,h,u,l){void 0===h&&(h=null),void 0===u&&(u=null),void 0===l&&(l=null);var c=o/a,_=c*c,f=i-t,d=(n*=c)-(e*=c),p=Math.sqrt(f*f+d*d),m=f/p,g=d/p,y=(r-t)*m+(s-e)*g,v=o*o,S=v-(t*t+e*e)+y*y,A=0;if(S>=0){var T=Math.sqrt(S),b=y-T,E=y+T,C=b<0?-1:b<=p?0:1,x=E<0?-1:E<=p?0:1,w=C*x;if(w<0)return-1;0===w&&(-1===C?(A=2,i=t+E*m,n=(e+E*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*_,i/v),l.y=l.x+Math.PI)):1===x?(A=1,t+=b*m,e=(e+b*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*_,t/v),l.y=l.x+Math.PI)):(A=3,null!==h&&(h.x=t+b*m,h.y=(e+b*g)/c,null!==l&&(l.x=Math.atan2(h.y/v*_,h.x/v))),null!==u&&(u.x=t+E*m,u.y=(e+E*g)/c,null!==l&&(l.y=Math.atan2(u.y/v*_,u.x/v)))))}return A},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,o,a){return void 0===s&&(s=null),void 0===o&&(o=null),void 0===a&&(a=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,o,a)},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 Ast(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,i,n,r,s,o,a){void 0===s&&(s=null),void 0===o&&(o=null),void 0===a&&(a=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,_=0,f=r[h-2],d=r[h-1],p=0,m=0,g=0,y=0,v=0,S=0,A=0;A<h;A+=2){var T=r[A],b=r[A+1];f===T&&(f=T+1e-4),d===b&&(d=b+1e-4);var E=f-T,C=d-b,x=f*b-d*T,w=u*C-l*E,D=(c*E-u*x)/w;if((D>=f&&D<=T||D>=T&&D<=f)&&(0===u||D>=t&&D<=i||D>=i&&D<=t)){var R=(c*C-l*x)/w;if((R>=d&&R<=b||R>=b&&R<=d)&&(0===l||R>=e&&R<=n||R>=n&&R<=e)){if(null===o){g=D,y=R,v=D,S=R,_++,null!==a&&(a.x=Math.atan2(b-d,T-f)-.5*Math.PI,a.y=a.x);break}var I=D-t;I<0&&(I=-I),0===_?(p=I,m=I,g=D,y=R,v=D,S=R,null!==a&&(a.x=Math.atan2(b-d,T-f)-.5*Math.PI,a.y=a.x)):(I<p&&(p=I,g=D,y=R,null!==a&&(a.x=Math.atan2(b-d,T-f)-.5*Math.PI)),I>m&&(m=I,v=D,S=R,null!==a&&(a.y=Math.atan2(b-d,T-f)-.5*Math.PI))),_++}}f=T,d=b}return 1===_?(null!==s&&(s.x=g,s.y=y),null!==o&&(o.x=g,o.y=y),null!==a&&(a.y=a.x+Math.PI)):_>1&&(_++,null!==s&&(s.x=g,s.y=y),null!==o&&(o.x=v,o.y=S)),_},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 o=this.vertices[s+1],a=this.vertices[n+1];if(a<e&&o>=e||o<e&&a>=e){var h=this.vertices[s],u=this.vertices[n];(e-a)*(h-u)/(o-a)+u<t&&(i=!i)}s=n}return i},e.prototype.intersectsSegment=function(t,n,r,s,o,a,h){void 0===o&&(o=null),void 0===a&&(a=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,o,a,h)),u},e}(e);t.PolygonBoundingBoxData=r}(Tst||(Tst={})),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 Ast(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,o=this.slotTimelines[t];s<o.length;s++)o[s].returnToPool();delete this.slotTimelines[t]}for(var t in this.constraintTimelines){for(var a=0,h=this.constraintTimelines[t];a<h.length;a++)h[a].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 o=s[r];for(i=0,n=(u=new Array(e)).length;i<n;++i)u[i]=-1;this.boneCachedFrameIndices[o.name]=u}for(var a=0,h=this.parent.sortedSlots;a<h.length;a++){var u,l=h[a];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 Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.boneMask=[],e}return Ast(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 o=s[r];this.boneMask.indexOf(o.name)<0&&n.contains(o)&&this.boneMask.push(o.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,o=t.getBones();s<o.length;s++){var a=o[s],h=this.boneMask.indexOf(a.name);h>=0&&r.contains(a)&&this.boneMask.splice(h,1)}else for(var u=0,l=t.getBones();u<l.length;u++)(a=l[u])!==r&&(r.contains(a)||this.boneMask.push(a.name))}},e}(t.BaseObject);t.AnimationConfig=e}(Tst||(Tst={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.textures={},e}return Ast(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 Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e.bones=[],e}return Ast(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}(Tst||(Tst={})),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 Ast(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 o=0,a=this._actions;o<a.length;o++)a[o].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 o=n?r:t[e+r];if(!(o<0||o>=s)){var a=i[o],h=this.getSlot(a.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,o=this._actions;s<o.length;s++){var a=o[s],h=a.actionData;if(null!==h&&0===h.type)if(null!==a.slot)null!==(c=a.slot.childArmature)&&c.animation.fadeIn(h.name);else if(null!==a.bone)for(var u=0,l=this.getSlots();u<l.length;u++){var c,_=l[u];_.parent===a.bone&&null!==(c=_.childArmature)&&c.animation.fadeIn(h.name)}else this._animation.fadeIn(h.name);a.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!==(o=this.getBone(t))&&(o.invalidUpdate(),e))for(var i=0,n=this._slots;i<n.length;i++)(u=n[i]).parent===o&&u.invalidUpdate()}else{for(var r=0,s=this._bones;r<s.length;r++){var o;(o=s[r]).invalidUpdate()}if(e)for(var a=0,h=this._slots;a<h.length;a++){var u;(u=h[a]).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,o){void 0===r&&(r=null),void 0===s&&(s=null),void 0===o&&(o=null);for(var a=t===i,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=null,g=null,y=0,v=this._slots;y<v.length;y++){var S=v[y];if(S.intersectsSegment(t,e,i,n,r,s,o)>0){if(null===r&&null===s){m=S;break}var A;null!==r&&((A=a?r.y-e:r.x-t)<0&&(A=-A),(null===m||A<h)&&(h=A,l=r.x,c=r.y,m=S,o&&(d=o.x))),null!==s&&((A=s.x-t)<0&&(A=-A),(null===g||A>u)&&(u=A,_=s.x,f=s.y,g=S,null!==o&&(p=o.y)))}}return null!==m&&null!==r&&(r.x=l,r.y=c,null!==o&&(o.x=d)),null!==g&&null!==s&&(s.x=_,s.y=f,null!==o&&(o.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}(Tst||(Tst={})),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 Ast(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}(Tst||(Tst={})),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 Ast(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,o=this.offset,a=this.animationPose,h=this._parent,u=this._armature.flipX,l=this._armature.flipY===t.DragonBones.yDown,c=null!==h,_=0;if(1===this.offsetMode?null!==s?(n.x=s.x+o.x+a.x,n.scaleX=s.scaleX*o.scaleX*a.scaleX,n.scaleY=s.scaleY*o.scaleY*a.scaleY,t.DragonBones.yDown?(n.y=s.y+o.y+a.y,n.skew=s.skew+o.skew+a.skew,n.rotation=s.rotation+o.rotation+a.rotation):(n.y=s.y-o.y+a.y,n.skew=s.skew-o.skew+a.skew,n.rotation=s.rotation-o.rotation+a.rotation)):(n.copyFrom(o),t.DragonBones.yDown||(n.y=-n.y,n.skew=-n.skew,n.rotation=-n.rotation),n.add(a)):0===this.offsetMode?null!==s?n.copyFrom(s).add(a):n.copyFrom(a):(c=!1,n.copyFrom(o),t.DragonBones.yDown||(n.y=-n.y,n.skew=-n.skew,n.rotation=-n.rotation)),c){var f=0===h._boneData.type?h.globalTransformMatrix:h._getGlobalTransformMatrix(n.x,n.y);if(i.inheritScale)i.inheritRotation||(h.updateGlobalTransform(),_=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=_),n.toMatrix(r),r.concat(f),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=f.a*d+f.c*p+f.tx,n.y=f.b*d+f.d*p+f.ty}else u&&(n.x=-n.x),l&&(n.y=-n.y);i.inheritRotation?(h.updateGlobalTransform(),_=h.global.scaleX<0?n.rotation+h.global.rotation+Math.PI:n.rotation+h.global.rotation,f.a*f.d-f.b*f.c<0&&(_-=2*n.rotation,(u!==l||i.inheritReflection)&&(n.skew+=Math.PI),t.DragonBones.yDown||(n.skew=-n.skew)),n.rotation=_):(u||l)&&(u&&l?_=n.rotation+Math.PI:(_=u?Math.PI-n.rotation:-n.rotation,n.skew+=Math.PI),n.rotation=_),n.toMatrix(r)}}else(u||l)&&(u&&(n.x=-n.x),l&&(n.y=-n.y),u&&l?_=n.rotation+Math.PI:(_=u?Math.PI-n.rotation:-n.rotation,n.skew+=Math.PI),n.rotation=_),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++)(o=n[i])._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 r=0,s=this._armature._constraints;r<s.length;r++){var o;(o=s[r])._root===this&&o.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 a=t>=0;this._localDirty&&this._updateGlobalTransformMatrix(a),a&&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}(Tst||(Tst={})),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 Ast(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,o,a,h,u,l,c,_){var f=o-r,d=a-s,p=h-r,m=u-s;l.rotation=Math.atan2(d,f),l.skew=Math.atan2(m,p)-.5*Math.PI-l.rotation,_&&(l.rotation+=Math.PI),l.scaleX=Math.sqrt(f*f+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],o=t[n+1]+i[n],a=this._parent._getGlobalTransformMatrix(s,o);e[n]=a.a*s+a.c*o+a.tx,e[n+1]=a.b*s+a.d*o+a.ty}else{var h=this._parent.globalTransformMatrix;for(n=0,r=t.length;n<r;n+=2)s=t[n]+i[n],o=t[n+1]+i[n+1],e[n]=h.a*s+h.c*o+h.tx,e[n+1]=h.b*s+h.d*o+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],o=this._vertices[e],a=this._vertices[e+1],h=this._vertices[e-t],u=this._vertices[e-t+1],l=i+.5*(o-i),c=n+.5*(a-n),_=l+.5*(r+.5*(h-r)-l),f=c+.5*(s+.5*(u-s)-c),d=r+.5*(o-r),p=s+.5*(a-s),m=h+.5*(o-h),g=u+.5*(a-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<-n||n<t||i<-n||n<i)return this.globalTransformMatrix;var r=!1,s=200,o=this._boneData,a=o.segmentX,h=o.segmentY,u=2*o.segmentX,l=this._dX,c=this._dY,_=Math.floor((t+s)/l),f=Math.floor((i+s)/c),d=0,p=_*l-s,m=f*c-s,g=this._matrixCahce,y=e._helpMatrix;if(t<-s){if(i<-s||i>=s)return this.globalTransformMatrix;if(d=7*(2*(a*(h+1)+2*a+h+f)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[d]>0)y.copyFromArray(g,d+1);else{var v=f*(u+2),S=this._hullCache[4],A=this._hullCache[5],T=this._hullCache[2]-(h-f)*S,b=this._hullCache[3]-(h-f)*A,E=this._vertices;r?this._getAffineTransform(-s,m+c,800,c,E[v+u+2],E[v+u+3],T+S,b+A,E[v],E[v+1],e._helpTransform,y,!0):this._getAffineTransform(-n,m,800,c,T,b,E[v],E[v+1],T+S,b+A,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<-s||i>=s)return this.globalTransformMatrix;d=7*(2*(a*(h+1)+a+f)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=(f+1)*(u+2)-2,S=this._hullCache[4],A=this._hullCache[5],T=this._hullCache[0]+f*S,b=this._hullCache[1]+f*A,E=this._vertices,r?this._getAffineTransform(n,m+c,800,c,T+S,b+A,E[v+u+2],E[v+u+3],T,b,e._helpTransform,y,!0):this._getAffineTransform(s,m,800,c,E[v],E[v+1],T,b,E[v+u+2],E[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<-s){if(t<-s||t>=s)return this.globalTransformMatrix;d=7*(a*(h+1)+2*_+((r=i>this._kY*(t-p-l)-n)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*_,S=this._hullCache[10],A=this._hullCache[11],T=this._hullCache[8]+_*S,b=this._hullCache[9]+_*A,E=this._vertices,r?this._getAffineTransform(p+l,-s,l,800,E[v+2],E[v+3],E[v],E[v+1],T+S,b+A,e._helpTransform,y,!0):this._getAffineTransform(p,-n,l,800,T,b,T+S,b+A,E[v],E[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<-s||t>=s)return this.globalTransformMatrix;d=7*(2*(a*(h+1)+a+h+f)+((r=i>this._kY*(t-p-l)+s)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=h*(u+2)+2*_,S=this._hullCache[10],A=this._hullCache[11],T=this._hullCache[6]-(a-_)*S,b=this._hullCache[7]-(a-_)*A,E=this._vertices,r?this._getAffineTransform(p+l,n,l,800,T+S,b+A,T,b,E[v+2],E[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,s,l,800,E[v],E[v+1],E[v+2],E[v+3],T,b,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*(a*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),E=this._vertices,r?this._getAffineTransform(p+l,m+c,l,c,E[v+u+4],E[v+u+5],E[v+u+2],E[v+u+3],E[v+2],E[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,m,l,c,E[v],E[v+1],E[v+2],E[v+3],E[v+u+2],E[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 o=0;o<s;++o)this._deformVertices[o]=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++)(a=r[n])._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 s=0,o=this._armature._constraints;s<o.length;s++){var a;(a=o[s])._root===this&&a.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,_=2*this.global.y,f=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,f),this._hullCache[0]=f.x,this._hullCache[1]=f.y,this._hullCache[2]=c-f.x,this._hullCache[3]=_-f.y,this.globalTransformMatrix.transformPoint(0,this._dY,f,!0),this._hullCache[4]=f.x,this._hullCache[5]=f.y,this.globalTransformMatrix.transformPoint(200,1e3,f),this._hullCache[6]=f.x,this._hullCache[7]=f.y,this._hullCache[8]=c-f.x,this._hullCache[9]=_-f.y,this.globalTransformMatrix.transformPoint(this._dX,0,f,!0),this._hullCache[10]=f.x,this._hullCache[11]=f.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(Tst||(Tst={})),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 Ast(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n<r.length;n++)null!==(a=r[n])&&a!==this._rawDisplay&&a!==this._meshDisplay&&i.indexOf(a)<0&&i.push(a);for(var s=0,o=i;s<o.length;s++){var a;(a=o[s])instanceof t.Armature?a.dispose():this._disposeDisplay(a,!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,o=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?o=this._displayData.vertices:null!==s&&(2===s.type||4===s.type)&&(o=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||o!==n||this._textureData!==r){if(null===o&&null!==this._textureData){var a=this._displayData,h=this._textureData.parent.scale*this._armature._armatureData.scale,u=this._textureData.frame;this._pivotX=a.pivot.x,this._pivotY=a.pivot.y;var l=null!==u?u:this._textureData.region,c=l.width,_=l.height;this._textureData.rotated&&null===u&&(c=l.height,_=l.width),this._pivotX*=c*h,this._pivotY*=_*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,o!==n?(null===this._deformVertices&&(this._deformVertices=t.BaseObject.borrowObject(t.DeformVertices)),this._deformVertices.init(o,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 o=this._displayIndex<this._rawDisplayDatas.length?this._rawDisplayDatas[this._displayIndex]:null;null===o&&(o=this._getDefaultRawDisplayData(this._displayIndex)),null!==o&&1===o.type&&(s=o.actions)}if(null!==s&&s.length>0)for(var a=0,h=s;a<h.length;a++){var u=h[a],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,o,a){if(void 0===s&&(s=null),void 0===o&&(o=null),void 0===a&&(a=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,o,a);return h>0&&(1===h||2===h?null!==s?(this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==o&&(o.x=s.x,o.y=s.y)):null!==o&&this.globalTransformMatrix.transformPoint(o.x,o.y,o):(null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==o&&this.globalTransformMatrix.transformPoint(o.x,o.y,o)),null!==a&&(this.globalTransformMatrix.transformPoint(Math.cos(a.x),Math.sin(a.x),i._helpPoint,!0),a.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(a.y),Math.sin(a.y),i._helpPoint,!0),a.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 o=0,a=n;o<a.length;o++){var h;(h=a[o])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}(Tst||(Tst={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ast(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 Ast(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,o=this._bone.globalTransformMatrix,a=o.a*e,h=o.b*e,u=a*a+h*h,l=Math.sqrt(u),c=s.x-r.x,_=s.y-r.y,f=c*c+_*_,d=Math.sqrt(f),p=s.rotation,m=r.rotation,g=Math.atan2(_,c),y=(c=n.x-r.x)*c+(_=n.y-r.y)*_,v=Math.sqrt(y),S=0;if(l+d<=v||v+l<=d||v+d<=l)S=Math.atan2(n.y-r.y,n.x-r.x),l+d<=v||d<l&&(S+=Math.PI);else{var A=(f-u+y)/(2*y),T=Math.sqrt(f-A*A*y)/v,b=r.x+c*A,E=r.y+_*A,C=-_*T,x=c*T,w=!1,D=i.parent;if(null!==D){var R=D.globalTransformMatrix;w=R.a*R.d-R.b*R.c<0}w!==this._bendPositive?(s.x=b-C,s.y=E-x):(s.x=b+C,s.y=E+x),S=Math.atan2(s.y-r.y,s.x-r.x)}var I=t.Transform.normalizeRadian(S-g);r.rotation=m+I*this._weight,r.toMatrix(i.globalTransformMatrix);var M=g+I*this._weight;s.x=r.x+Math.cos(M)*d,s.y=r.y+Math.sin(M)*d;var P=Math.atan2(n.y-s.y,n.x-s.x);s.scaleX<0&&(P+=Math.PI),s.rotation=r.rotation+p-m+t.Transform.normalizeRadian(P-I-p)*this._weight,s.toMatrix(o)},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 Ast(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,o=t.offset,a=r[o+0],h=r[o+2];this._pathGlobalVertices.length=2*a;var u=t.weight;if(null!==u)for(var l=this._pathSlot._deformVertices.bones,c=u.bones.length,_=u.offset,f=r[_+1],d=_+2+c,p=(E=0,0);E<a;E++){for(var m=0,g=0,y=0,v=r[d++];y<v;y++){var S=l[r[d++]];if(null!==S){S.updateByConstraint(),b=S.globalTransformMatrix;var A=s[f++];x=s[f++]*n,w=s[f++]*n,m+=(b.a*x+b.c*w+b.tx)*A,g+=(b.b*x+b.d*w+b.ty)*A}}this._pathGlobalVertices[p++]=m,this._pathGlobalVertices[p++]=g}else{var T=this._pathSlot.parent;T.updateByConstraint();for(var b=T.globalTransformMatrix,E=0,C=h;E<a;E+=2){var x=s[C++]*n,w=s[C++]*n,D=b.a*x+b.c*w+b.tx,R=b.b*x+b.d*w+b.ty;this._pathGlobalVertices[E]=D,this._pathGlobalVertices[E+1]=R}}},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],o=this._positions,a=this._spaces,h=t.closed,u=Array(),l=2*s,c=l/6,_=-1,f=this.position;o.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,S,A,T,b,E=u[0],C=u[1],x=0,w=0,D=0,R=0,I=0,M=0,P=(z=0,2);z<c;z++,P+=6)x=u[P],w=u[P+1],D=u[P+2],R=u[P+3],S=2*(m=.1875*(E-2*x+D))+(y=.09375*(3*(x-D)-E+(I=u[P+4]))),A=2*(g=.1875*(C-2*w+R))+(v=.09375*(3*(w-R)-C+(M=u[P+5]))),T=.75*(x-E)+m+.16666667*y,b=.75*(w-C)+g+.16666667*v,d+=Math.sqrt(T*T+b*b),T+=S,b+=A,S+=y,A+=v,d+=Math.sqrt(T*T+b*b),T+=S,b+=A,d+=Math.sqrt(T*T+b*b),T+=S+y,b+=A+v,d+=Math.sqrt(T*T+b*b),p[z]=d,E=I,C=M;if(n&&(f*=d),r)for(z=0;z<e;z++)a[z]*=d;for(var B=this._segments,O=0,L=(z=0,H=0,W=0,0);z<e;z++,H+=3){var N=f+=a[z];if(h)(N%=d)<0&&(N+=d),W=0;else{if(N<0)continue;if(N>d)continue}for(;;W++){var F=p[W];if(!(N>F)){0===W?N/=F:N=(N-(G=p[W-1]))/(F-G);break}}if(W!==_){_=W;var k=6*W;for(E=u[k],C=u[k+1],x=u[k+2],w=u[k+3],D=u[k+4],R=u[k+5],S=2*(m=.03*(E-2*x+D))+(y=.006*(3*(x-D)-E+(I=u[k+6]))),A=2*(g=.03*(C-2*w+R))+(v=.006*(3*(w-R)-C+(M=u[k+7]))),T=.3*(x-E)+m+.16666667*y,b=.3*(w-C)+g+.16666667*v,O=Math.sqrt(T*T+b*b),B[0]=O,k=1;k<8;k++)T+=S,b+=A,S+=y,A+=v,O+=Math.sqrt(T*T+b*b),B[k]=O;T+=S,b+=A,O+=Math.sqrt(T*T+b*b),B[8]=O,T+=S+y,b+=A+v,O+=Math.sqrt(T*T+b*b),B[9]=O,L=0}for(N*=O;;L++){var V=B[L];if(!(N>V)){var G;0===L?N/=V:N=L+(N-(G=B[L-1]))/(V-G);break}}this.addCurvePosition(.1*N,E,C,x,w,D,R,I,M,o,H,i)}}else{var U=t.curveLengths;if(d=U[c-=h?1:2],n&&(f*=d),r)for(var z=0;z<e;z++)a[z]*=d;u.length=8;z=0;for(var H=0,W=0;z<e;z++,H+=3){if(f+=a[z],h)(f%=d)<0&&(f+=d),W=0;else{if(f<0)continue;if(f>d)continue}for(var j=0;;W++){var X=U[W];if(!(f>X)){if(0===W)j=f/X;else{var Y=U[W-1];j=(f-Y)/(X-Y)}break}}W!==_&&(_=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],o,H,i)}}},i.prototype.addCurvePosition=function(t,e,i,n,r,s,o,a,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]=a,u[l+1]=h,void(u[l+2]=0);var _=1-t,f=_*_,d=t*t,p=f*_,m=f*t*3,g=_*d*3,y=t*d,v=p*e+m*n+g*s+y*a,S=p*i+m*r+g*o+y*h;u[l]=v,u[l+1]=S,u[l+2]=c?Math.atan2(S-(p*i+m*r+g*o),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 o=i.positionMode,a=i.spacingMode,h=i.rotateMode,u=this._bones,l=0===a,c=2===h,_=0===h,f=u.length,d=_?f: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++){(M=u[g]).updateByConstraint();var v=M._boneData.length,S=v*(P=M.globalTransformMatrix).a,A=v*P.b,T=Math.sqrt(S*S+A*A);c&&(this._boneLengths[g]=T),m[g+1]=(v+p)*T/v}}else for(g=0;g<d;g++)m[g]=p;this._computeBezierCurve(n,d,_,1===o,2===a);var b,E=this._positions,C=this.rotateOffset,x=E[0],w=E[1];0===C?b=1===h:(b=!1,null!==(M=e.parent)&&(C*=(P=M.globalTransformMatrix).a*P.d-P.b*P.c>0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var D=this.rotateMix,R=this.translateMix,I=(g=0,3);g<f;g++,I+=3){var M,P;(M=u[g]).updateByConstraint(),(P=M.globalTransformMatrix).tx+=(x-P.tx)*R,P.ty+=(w-P.ty)*R;var B=(S=E[I])-x,O=(A=E[I+1])-w;if(c){var L=this._boneLengths[g],N=(Math.sqrt(B*B+O*O)/L-1)*D+1;P.a*=N,P.b*=N}if(x=S,w=A,D>0){var F=P.a,k=P.b,V=P.c,G=P.d,U=void 0,z=void 0,H=void 0;if(U=_?E[I-1]:Math.atan2(O,B),U-=Math.atan2(k,F),b){z=Math.cos(U),H=Math.sin(U);var W=M._boneData.length;x+=(W*(z*F-H*k)-B)*D,w+=(W*(H*F+z*k)-O)*D}else U+=C;U>t.Transform.PI?U-=t.Transform.PI_D:U<-t.Transform.PI&&(U+=t.Transform.PI_D),U*=D,z=Math.cos(U),H=Math.sin(U),P.a=z*F-H*k,P.b=H*F+z*k,P.c=z*V-H*G,P.d=H*V+z*G}M.global.fromMatrix(P)}this.dirty=!1}}},i.prototype.invalidUpdate=function(){},i}(e);t.PathConstraint=n}(Tst||(Tst={})),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 o=this._animatebles[i];null!==o?this._animatebles[i-n]=o: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}(Tst||(Tst={})),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 Ast(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,o=this._animationStates;s<o.length;s++)null===(u=o[s])._parent&&u.layer===t.layer&&u.group===t.group&&u.fadeOut(t.fadeOutTime,t.pauseFadeOut);break;case 4:for(var a=0,h=this._animationStates;a<h.length;a++){var u;null===(u=h[a])._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 o=s[r];o._cachedFrameIndices=i.getBoneCachedFrameIndices(o.name)}for(var a=0,h=this._armature.getSlots();a<h.length;a++){var u=h[a],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 _=0,f=0;_<e;++_){var d;(d=this._animationStates[_])._fadeState>0&&d._subFadeState>0?(f++,this._armature._dragonBones.bufferObject(d),this._animationDirty=!0,this._lastAnimationState===d&&(this._lastAnimationState=null)):(f>0&&(this._animationStates[_-f]=d),d.advanceTime(t,0)),_===e-1&&f>0&&(this._animationStates.length-=f,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 o=s[r];if(o._animationData===n)return o}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 a=t.BaseObject.borrowObject(t.AnimationState);if(a.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(a.layer>this._animationStates[u].layer){h=!0,this._animationStates.splice(u,0,a);break}if(u!==l-1&&a.layer>this._animationStates[u+1].layer){h=!0,this._animationStates.splice(u+1,0,a);break}}h||this._animationStates.push(a)}else this._animationStates.push(a);for(var c=0,_=this._armature.getSlots();c<_.length;c++){var f=_[c].childArmature;null!==f&&f.inheritAnimation&&f.animation.hasAnimation(i)&&null===f.animation.getState(i)&&f.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,a.layer,null,0);null!==m&&(m.resetToPose=!1,m._parent=a,m.stop())}return d&&(this._lockUpdate=!1),this._lockUpdate||(e.fadeInTime<=0&&this._armature.advanceTime(0),this._lastAnimationState=a),a},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,o){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===o&&(o=3),console.warn("Deprecated."),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.fadeOutMode=o,this._animationConfig.playTimes=n,this._animationConfig.layer=r,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==s?s:"";var a=this._animations[t];return a&&i>0&&(this._animationConfig.timeScale=a.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}(Tst||(Tst={})),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 Ast(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 o=0,a=this._constraintTimelines;o<a.length;o++)a[o].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++)switch((_=s[r]).type){case 30:(f=t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint=n,f.init(this._armature,this,_),this._constraintTimelines.push(f)}else this.resetToPose&&((f=t.BaseObject.borrowObject(t.IKConstraintTimelineState)).constraint=n,f.init(this._armature,this,null),this._constraintTimelines.push(f),this._poseTimelines.push(f))}for(var o=0,a=this._armature.animation.getStates();o<a.length;o++){var h,u=a[o];if(u._parent===this&&null!==(h=this._animationData.getAnimationTimelines(u.name)))for(var l=0,c=h;l<c.length;l++){var _;switch((_=c[l]).type){case 40:var f;(f=t.BaseObject.borrowObject(t.AnimationTimelineState)).animationState=u,f.init(this._armature,this,_),this._animationTimelines.push(f)}}}},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,o=this._armature.getBones();s<o.length;s++){var a=o[s],h=a.name;if(this.containsBoneMask(h))if(h in e)delete e[h];else if(0===a._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,_=u;c<_.length;c++)switch((M=_[c]).type){case 10:(y=t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone=a,y.bonePose=l,y.init(this._armature,this,M),this._boneTimelines.push(y);break;case 11:(y=t.BaseObject.borrowObject(t.BoneTranslateTimelineState)).bone=a,y.bonePose=l,y.init(this._armature,this,M),this._boneTimelines.push(y);break;case 12:(y=t.BaseObject.borrowObject(t.BoneRotateTimelineState)).bone=a,y.bonePose=l,y.init(this._armature,this,M),this._boneTimelines.push(y);break;case 13:(y=t.BaseObject.borrowObject(t.BoneScaleTimelineState)).bone=a,y.bonePose=l,y.init(this._armature,this,M),this._boneTimelines.push(y)}else this.resetToPose&&((y=t.BaseObject.borrowObject(t.BoneAllTimelineState)).bone=a,y.bonePose=l,y.init(this._armature,this,null),this._boneTimelines.push(y),this._poseTimelines.push(y))}else if(1===a._boneData.type)if(null!==(u=this._animationData.getSurfaceTimelines(h)))for(var f=0,d=u;f<d.length;f++)switch((M=d[f]).type){case 50:(y=t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface=a,y.init(this._armature,this,M),this._surfaceTimelines.push(y)}else this.resetToPose&&((y=t.BaseObject.borrowObject(t.SurfaceTimelineState)).surface=a,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={},S=[],A=0,T=this._slotTimelines;A<T.length;A++)(h=(y=T[A]).slot.name)in v||(v[h]=[]),v[h].push(y);for(var b=0,E=this._armature.getSlots();b<E.length;b++){var C=E[b],x=C.parent.name;if(this.containsBoneMask(x))if(h=C.name,u=this._animationData.getSlotTimelines(h),h in v)delete v[h];else{var w=!1,D=!1;if(S.length=0,null!==u)for(var R=0,I=u;R<I.length;R++){var M;switch((M=I[R]).type){case 20:(y=t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot=C,y.init(this._armature,this,M),this._slotTimelines.push(y),w=!0;break;case 21:(y=t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot=C,y.init(this._armature,this,M),this._slotTimelines.push(y),D=!0;break;case 22:(y=t.BaseObject.borrowObject(t.DeformTimelineState)).slot=C,y.init(this._armature,this,M),this._slotTimelines.push(y),S.push(y.vertexOffset)}}if(this.resetToPose&&(w||((y=t.BaseObject.borrowObject(t.SlotDislayTimelineState)).slot=C,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y)),D||((y=t.BaseObject.borrowObject(t.SlotColorTimelineState)).slot=C,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y)),null!==C.rawDisplayDatas))for(var P=0,B=C.rawDisplayDatas;P<B.length;P++){var O=B[P];if(null!==O&&2===O.type){var L=O.vertices.offset;S.indexOf(L)<0&&((y=t.BaseObject.borrowObject(t.DeformTimelineState)).vertexOffset=L,y.slot=C,y.init(this._armature,this,null),this._slotTimelines.push(y),this._poseTimelines.push(y))}}}}for(var p in v)for(var N=0,F=v[p];N<F.length;N++)y=F[N],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,o=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(o),n){var a=2*i;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*a)/a}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(o),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(o),(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(o),0!==c&&p.blend(c)}if(this.displayControl)for(u=0,l=this._slotTimelines.length;u<l;++u){var _=(p=this._slotTimelines[u]).slot.displayController;null!==_&&_!==this.name&&_!==this.group||p.playState<=0&&p.update(o)}for(u=0,l=this._constraintTimelines.length;u<l;++u)(p=this._constraintTimelines[u]).playState<=0&&p.update(o);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(o),0!==c&&p.blend(c)}if(0===this._fadeState){if(this._subFadeState>0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var f=0,d=this._poseTimelines;f<d.length;f++){var p;(p=d[f])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++)(_=n[i]).fadeOut();for(var r=0,s=this._surfaceTimelines;r<s.length;r++)(_=s[r]).fadeOut();for(var o=0,a=this._slotTimelines;o<a.length;o++)(_=a[o]).fadeOut();for(var h=0,u=this._constraintTimelines;h<u.length;h++)(_=u[h]).fadeOut();for(var l=0,c=this._animationTimelines;l<c.length;l++){var _;(_=c[l]).animationState.fadeOut(t,e),_.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,o=r;s<o.length;s++){var a=o[s],h=this._boneMask.indexOf(a.name);h>=0&&n.contains(a)&&this._boneMask.splice(h,1)}else for(var u=0,l=r;u<l.length;u++)(a=l[u])!==n&&(n.contains(a)||this._boneMask.push(a.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 0!=(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 Ast(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}(Tst||(Tst={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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 Ast(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),o=0===s?0:e[n+s-1];return 1e-4*(o+((s===r-1?1e4:e[n+s])-o)*(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 Ast(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 Ast(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 Ast(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e}(i);t.ConstraintTimelineState=s}(Tst||(Tst={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ast(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,o=0;o<r;++o){var a=s[this._frameArray[n+2+o]];if(0===a.type)(h=t.BaseObject.borrowObject(t.EventObject)).time=this._frameArray[n]/this._frameRate,h.animationState=this._animationState,t.EventObject.actionDataToInstance(a,h,this._armature),this._armature._bufferAction(h,!0);else{var h,u=10===a.type?t.EventObject.FRAME_EVENT:t.EventObject.SOUND_EVENT;(11===a.type||i.hasDBEventListener(u))&&((h=t.BaseObject.borrowObject(t.EventObject)).time=this._frameArray[n]/this._frameRate,h.animationState=this._animationState,t.EventObject.actionDataToInstance(a,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 o=t.BaseObject.borrowObject(t.EventObject);o.type=t.EventObject.START,o.armature=this._armature,o.animationState=this._animationState,this._armature._dragonBones.bufferEvent(o)}}var a=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),_=this._frameIndices[l.frameIndicesOffset+c];if(this._frameIndex!==_){var f=this._frameIndex;if(this._frameIndex=_,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[l.offset+5+this._frameIndex],a){if(f<0){var d=Math.floor(r*this._frameRate);f=this._frameIndices[l.frameIndicesOffset+d],this.currentPlayTimes===n&&f===_&&(f=-1)}for(;f>=0;){var p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(f),null!==h&&0===f&&(this._armature._dragonBones.bufferEvent(h),h=null),f>0?f--:f=this._frameCount-1,f===_)break}}else for(f<0&&(d=Math.floor(r*this._frameRate),f=this._frameIndices[l.frameIndicesOffset+d],p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate,this.currentPlayTimes===n&&(r<=m?f>0?f--:f=this._frameCount-1:f===_&&(f=-1)));f>=0&&(f<this._frameCount-1?f++:f=0,p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate,this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(f),null!==h&&0===f&&(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&&(a||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 Ast(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 Ast(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 Ast(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 Ast(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 o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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=o;var a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return Ast(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=a;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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 Ast(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 Ast(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 o=0;o<this._valueCount;++o)this._delta[o]=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 Ast(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 _=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._floats=[0,0,0,0,0,0],e}return Ast(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=_}(Tst||(Tst={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ast(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}(Tst||(Tst={})),function(t){var e=function(){function e(){}return e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":return 0;case"movieclip":return 1;default:return 0}},e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":return 0;case"surface":return 1;default:return 0}},e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4;default:return 0}},e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":return 0;case"ellipse":return 1;case"polygon":return 2;default:return 0}},e._getActionType=function(t){switch(t.toLowerCase()){case"play":return 0;case"frame":return 10;case"sound":return 11;default:return 0}},e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":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;default:return 0}},e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":return 1;case"fixed":return 0;default:return 1}},e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":return 0;case"percent":return 2;case"fixed":return 1;default:return 0}},e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":return 0;case"chain":return 1;case"chainscale":return 2;default:return 0}},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],o=0,a=s.length;o<a;o++){var h=s[o],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}(Tst||(Tst={})),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 Ast(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,o=r.length;s<o;++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,o,a,h,u){var l=1-h,c=l*l,_=h*h,f=l*c,d=3*h*c,p=3*l*_,m=h*_;u.x=f*t+d*i+p*r+m*o,u.y=f*e+d*n+p*s+m*a},n.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r<s;++r){for(var o=(r+1)/(s+1);(n+6<i?t[n+6]:1)<o;)n+=6;for(var a=n>=0&&n+6<i,h=a?t[n]:0,u=a?t[n+1]:0,l=t[n+2],c=t[n+3],_=t[n+4],f=t[n+5],d=a?t[n+6]:1,p=a?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),o-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,o){for(var a=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,h=this._parseActionData(e,r,s,o),u=0,l=null,c=0,_=h;c<_.length;c++){var f=_[c];this._armature.addAction(f,!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(a+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],o=t.BaseObject.borrowObject(t.CanvasData);t.DataParser.COLOR in s?o.hasBackground=!0:o.hasBackground=!1,o.color=n._getNumber(s,t.DataParser.COLOR,0),o.x=n._getNumber(s,t.DataParser.X,0)*r.scale,o.y=n._getNumber(s,t.DataParser.Y,0)*r.scale,o.width=n._getNumber(s,t.DataParser.WIDTH,0)*r.scale,o.height=n._getNumber(s,t.DataParser.HEIGHT,0)*r.scale,r.canvas=o}if(t.DataParser.AABB in e){var a=e[t.DataParser.AABB];r.aabb.x=n._getNumber(a,t.DataParser.X,0)*r.scale,r.aabb.y=n._getNumber(a,t.DataParser.Y,0)*r.scale,r.aabb.width=n._getNumber(a,t.DataParser.WIDTH,0)*r.scale,r.aabb.height=n._getNumber(a,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,""),_=this._parseBone(l);if(c.length>0){var f=r.getBone(c);null!==f?_.parent=f:(c in this._cacheBones||(this._cacheBones[c]=[]),this._cacheBones[c].push(_))}if(_.name in this._cacheBones){for(var d=0,p=this._cacheBones[_.name];d<p.length;d++)p[d].parent=_;delete this._cacheBones[_.name]}r.addBone(_),this._rawBones.push(_)}if(t.DataParser.IK in e)for(var m=0,g=e[t.DataParser.IK];m<g.length;m++){var y=g[m];(D=this._parseIKConstraint(y))&&r.addConstraint(D)}if(r.sortBones(),t.DataParser.SLOT in e)for(var v=0,S=0,A=e[t.DataParser.SLOT];S<A.length;S++){var T=A[S];r.addSlot(this._parseSlot(T,v++))}if(t.DataParser.SKIN in e)for(var b=0,E=e[t.DataParser.SKIN];b<E.length;b++){var C=E[b];r.addSkin(this._parseSkin(C))}if(t.DataParser.PATH_CONSTRAINT in e)for(var x=0,w=e[t.DataParser.PATH_CONSTRAINT];x<w.length;x++){var D,R=w[x];(D=this._parsePathConstraint(R))&&r.addConstraint(D)}for(var I=0,M=this._cacheRawMeshes.length;I<M;++I){var P=this._cacheRawMeshes[I];t.DataParser.GLUE_WEIGHTS in P&&t.DataParser.GLUE_MESHES in P&&this._parseMeshGlue(P,this._cacheMeshes[I])}for(I=0,M=this._cacheRawMeshes.length;I<M;++I){var B=this._cacheRawMeshes[I],O=n._getString(B,t.DataParser.SHARE,"");if(0!==O.length){var L=n._getString(B,t.DataParser.SKIN,t.DataParser.DEFAULT_NAME);0===L.length&&(L=t.DataParser.DEFAULT_NAME);var N=r.getMesh(L,"",O);null!==N&&this._cacheMeshes[I].vertices.shareFrom(N.vertices)}}if(t.DataParser.ANIMATION in e)for(var F=0,k=e[t.DataParser.ANIMATION];F<k.length;F++){var V=k[F],G=this._parseAnimation(V);r.addAnimation(G)}if(t.DataParser.DEFAULT_ACTIONS in e)for(var U=0,z=this._parseActionData(e[t.DataParser.DEFAULT_ACTIONS],0,null,null);U<z.length;U++){var H=z[U];r.addAction(H,!0),0===H.type&&null!==(G=r.getAnimation(H.name))&&(r.defaultAnimation=G)}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 X in this._rawBones.length=0,this._cacheRawMeshes.length=0,this._cacheMeshes.length=0,this._armature=null,this._weightSlotPose)delete this._weightSlotPose[X];for(var X in this._weightBonePoses)delete this._weightBonePoses[X];for(var X in this._cacheBones)delete this._cacheBones[X];for(var X in this._slotChildActions)delete this._slotChildActions[X];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 o=e[t.DataParser.VERTICES],a=0,h=s.vertices.length;a<h;++a)a<o.length?s.vertices[a]=o[a]*i:s.vertices[a]=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 o=e[t.DataParser.BONES];if(null===o||0===o.length)return null;var a=t.BaseObject.borrowObject(t.PathConstraintData);a.name=n._getString(e,t.DataParser.NAME,""),a.type=1,a.pathSlot=i,a.pathDisplayData=s,a.target=i.parent,a.positionMode=t.DataParser._getPositionMode(n._getString(e,t.DataParser.POSITION_MODE,"")),a.spacingMode=t.DataParser._getSpacingMode(n._getString(e,t.DataParser.SPACING_MODE,"")),a.rotateMode=t.DataParser._getRotateMode(n._getString(e,t.DataParser.ROTATE_MODE,"")),a.position=n._getNumber(e,t.DataParser.POSITION,0),a.spacing=n._getNumber(e,t.DataParser.SPACING,0),a.rotateOffset=n._getNumber(e,t.DataParser.ROTATE_OFFSET,0),a.rotateMix=n._getNumber(e,t.DataParser.ROTATE_MIX,1),a.translateMix=n._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var h=0,u=o;h<u.length;h++){var l=u[h],c=this._armature.getBone(l);null!==c&&(a.AddBone(c),null===a.root&&(a.root=c))}return a},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,o=r;s<o.length;s++){var a=o[s],h=n._getString(a,t.DataParser.NAME,""),u=this._armature.getSlot(h);if(null!==u){if(this._slot=u,t.DataParser.DISPLAY in a)for(var l=0,c=a[t.DataParser.DISPLAY];l<c.length;l++){var _=c[l];_?i.addDisplay(h,this._parseDisplay(_)):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,o=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 a=o=t.BaseObject.borrowObject(t.ImageDisplayData);a.name=i,a.path=r.length>0?r:i,this._parsePivot(e,a);break;case 1:var h=o=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 _=this._skin.getDisplays(this._slot.name);if(null===_?0===this._slot.displayIndex:this._slot.displayIndex===_.length){for(var f=0,d=this._slotChildActions[this._slot.name];f<d.length;f++)c=d[f],h.addAction(c);delete this._slotChildActions[this._slot.name]}}break;case 2:var p=o=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=o=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=o=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 S=0,A=y.length;S<A;++S)v.curveLengths[S]=y[S];this._parsePath(e,v)}return null!==o&&t.DataParser.TRANSFORM in e&&this._parseTransform(e[t.DataParser.TRANSFORM],o.transform,this._armature.scale),o},n.prototype._parsePath=function(e,i){var r=e[t.DataParser.VERTICES],s=n._getNumber(e,t.DataParser.VERTEX_COUNT,0),o=this._floatArray.length,a=this._intArray.length;if(i.vertices.offset=a,this._intArray.length+=2,this._intArray[a+0]=s,this._intArray[a+2]=o,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,_=this._intArray.length,f=this._floatArray.length,d=this._armature.sortedBones,p=t.BaseObject.borrowObject(t.WeightData);for(p.count=c,p.offset=_,this._intArray.length+=2+l+s+c,this._intArray[_+0]=l,this._intArray[_+1]=f,D=0;D<l;D++){var m=u[D],g=this._rawBones[m];p.addBone(g),this._intArray[_+2+D]=d.indexOf(g)}this._floatArray.length+=3*c,D=0;for(var y=0,v=0,S=_+2+l,A=f;D<c;D++){var T=h[y++];this._intArray[S++]=T;for(var b=0;b<T;b++){var E=h[y++],C=h[y++],x=r[v++],w=r[v++];this._intArray[S++]=u.indexOf(E),this._floatArray[A++]=C,this._floatArray[A++]=x,this._floatArray[A++]=w}}i.vertices.weight=p}else{this._floatArray.length+=r.length;for(var D=0,R=r.length;D<R;++D)this._floatArray[o+D]=r[D]}},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],o=Math.floor(n.length/2),a=Math.floor(s.length/3),h=this._floatArray.length,u=h+2*o,l=this._intArray.length,c=this._skin.name+"_"+this._slot.name+"_"+i.name;i.vertices.offset=l,this._intArray.length+=4+3*a,this._intArray[l+0]=o,this._intArray[l+1]=a,this._intArray[l+2]=h;for(var _=0,f=3*a;_<f;++_)this._intArray[l+4+_]=s[_];for(this._floatArray.length+=2*o+2*o,_=0,f=2*o;_<f;++_)this._floatArray[h+_]=n[_],this._floatArray[u+_]=r[_];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),S=this._floatArray.length,A=Math.floor(d.length-o)/2,T=this._intArray.length,b=t.BaseObject.borrowObject(t.WeightData);for(b.count=A,b.offset=T,y.length=v,this._intArray.length+=2+v+o+A,this._intArray[T+1]=S,_=0;_<v;++_){var E=m[7*_],C=this._rawBones[E];b.addBone(C),y[_]=E,this._intArray[T+2+_]=g.indexOf(C)}this._floatArray.length+=3*A,this._helpMatrixA.copyFromArray(p,0),_=0;for(var x=0,w=T+2+v,D=S;_<o;++_){var R=2*_,I=this._intArray[w++]=d[x++],M=this._floatArray[h+R],P=this._floatArray[h+R+1];this._helpMatrixA.transformPoint(M,P,this._helpPoint),M=this._helpPoint.x,P=this._helpPoint.y;for(var B=0;B<I;++B){E=d[x++];var O=y.indexOf(E);this._helpMatrixB.copyFromArray(m,7*O+1),this._helpMatrixB.invert(),this._helpMatrixB.transformPoint(M,P,this._helpPoint),this._intArray[w++]=O,this._floatArray[D++]=d[x++],this._floatArray[D++]=this._helpPoint.x,this._floatArray[D++]=this._helpPoint.y}}i.vertices.weight=b,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 o=0,a=r.length;o<a;o+=2){var h=r[o]*n,u=r[o+1]*n;t.DragonBones.webAssembly?(s.set(o,h),s.set(o+1,u)):(s[o]=h,s[o+1]=u),0===o?(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 o=0,a=0;o<s;++o){var h=r[o];this._parseActionDataInFrame(h,a,null,null),a+=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 _=0,f=e[t.DataParser.SURFACE];_<f.length;_++){c=f[_];var d=n._getString(c,t.DataParser.NAME,"");this._surface=this._armature.getBone(d),null!==this._surface&&(null!==(D=this._parseTimeline(c,null,t.DataParser.FRAME,50,!1,!0,0,this._parseSurfaceFrame))&&this._animation.addSurfaceTimeline(this._surface,D),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),S=n._getString(c,t.DataParser.SLOT,""),A=n._getString(c,t.DataParser.NAME,"");0===v.length&&(v=t.DataParser.DEFAULT_NAME),this._slot=this._armature.getSlot(S),this._mesh=this._armature.getMesh(v,S,A),null!==this._slot&&null!==this._mesh&&(null!==(D=this._parseTimeline(c,null,t.DataParser.FRAME,22,!1,!0,0,this._parseSlotFFDFrame))&&this._animation.addSlotTimeline(this._slot,D),this._slot=null,this._mesh=null)}if(t.DataParser.IK in e)for(var T=0,b=e[t.DataParser.IK];T<b.length;T++){c=b[T];var E=n._getString(c,t.DataParser.NAME,""),C=this._armature.getConstraint(E);null!==C&&null!==(D=this._parseTimeline(c,null,t.DataParser.FRAME,30,!0,!1,2,this._parseIKConstraintFrame))&&this._animation.addConstraintTimeline(C,D)}if(t.DataParser.ANIMATION in e)for(var x=0,w=e[t.DataParser.ANIMATION];x<w.length;x++){c=w[x];var D,R=n._getString(c,t.DataParser.NAME,"");null!==(D=this._parseTimeline(c,null,t.DataParser.FRAME,40,!0,!1,2,this._parseAnimationFrame))&&this._animation.addAnimationTimeline(R,D)}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,o,a,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 _=this._frameIntArray.length,f=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]=a?_-this._animation.frameIntOffset:h?f-this._animation.frameFloatOffset:0,this._timeline=d,d.type=o,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,S=0,A=0,T=0;v<m;++v){if(A+T<=v&&S<c){var b=r[S];A=v,T=S===c-1?this._animation.frameCount-A:b instanceof i?this._actionFrames[S+1].frameStart-A:n._getNumber(b,t.DataParser.DURATION,1),this._timelineArray[p+5+S]=l.call(this,b,A,T)-this._animation.frameOffset,S++}t.DragonBones.webAssembly?g.set(y+v,S-1):g[y+v]=S-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 o=r+1;this._helpArray.length=o,this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray),this._frameArray.length+=2+this._helpArray.length,this._frameArray[s+1]=2,this._frameArray[s+2]=o;for(var a=0;a<o;++a)this._frameArray[s+3+a]=Math.round(1e4*this._helpArray[a])}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 o=this._armature.sortedSlots.length,a=new Array(o-s.length/2),h=new Array(o),u=0;u<a.length;++u)a[u]=0;for(var l=0;l<o;++l)h[l]=-1;for(var c=0,_=0,f=0,d=s.length;f<d;f+=2){for(var p=s[f],m=s[f+1];c!==p;)a[_++]=c++;h[c+m]=c++}for(;c<o;)a[_++]=c++;this._frameArray.length+=1+o,this._frameArray[r+1]=o;for(var g=o;g--;)-1===h[g]?this._frameArray[r+2+g]=a[--_]||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 o=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[a++]=this._helpTransform.x,this._frameFloatArray[a++]=this._helpTransform.y,this._frameFloatArray[a++]=s,this._frameFloatArray[a++]=this._helpTransform.skew,this._frameFloatArray[a++]=this._helpTransform.scaleX,this._frameFloatArray[a++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,i,this._bone,this._slot),o},n.prototype._parseBoneTranslateFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.X,0),this._frameFloatArray[o++]=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 o=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=s,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,o},n.prototype._parseBoneScaleFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.X,1),this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.Y,1),s},n.prototype._parseSurfaceFrame=function(e,i,r){var s=this._frameFloatArray.length,o=this._parseTweenFrame(e,i,r),a=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 _=0;_<2*u;_+=2)l=_<h||_-h>=a.length?0:a[_-h],c=_+1<h||_+1-h>=a.length?0:a[_+1-h],this._frameFloatArray[s+_]=l,this._frameFloatArray[s+_+1]=c;if(0===i){var f=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[f+0]=0,this._frameIntArray[f+1]=this._frameFloatArray.length-s,this._frameIntArray[f+2]=this._frameFloatArray.length-s,this._frameIntArray[f+3]=0,this._frameIntArray[f+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=f-this._animation.frameIntOffset}return o},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 o=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var a in o){this._parseColorTransform(o,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,o=this._parseTweenFrame(e,i,r),a=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,_=0,f=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===a?(_=0,f=0):(_=g<h||g-h>=a.length?0:a[g-h],f=g+1<h||g+1-h>=a.length?0:a[g+1-h]),null!==c){var y=this._weightBonePoses[l],v=this._intArray[d++];this._helpMatrixA.transformPoint(_,f,this._helpPoint,!0),_=this._helpPoint.x,f=this._helpPoint.y;for(var S=0;S<v;++S){var A=this._intArray[d++];this._helpMatrixB.copyFromArray(y,7*A+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]=_,this._frameFloatArray[s+g+1]=f;if(0===i){var T=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[T+0]=this._mesh.vertices.offset,this._frameIntArray[T+1]=this._frameFloatArray.length-s,this._frameIntArray[T+2]=this._frameFloatArray.length-s,this._frameIntArray[T+3]=0,this._frameIntArray[T+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=T-this._animation.frameIntOffset}return o},n.prototype._parseIKConstraintFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),o=this._frameIntArray.length;return this._frameIntArray.length+=2,this._frameIntArray[o++]=n._getBoolean(e,t.DataParser.BEND_POSITIVE,!0)?1:0,this._frameIntArray[o++]=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),o=this._frameIntArray.length;return this._frameIntArray.length+=2,this._frameIntArray[o++]=n._getNumber(e,t.DataParser.VALUE,0),this._frameIntArray[o++]=Math.round(100*n._getNumber(e,t.DataParser.WEIGHT,1)),s},n.prototype._parseActionData=function(e,i,r,s){var o=new Array;if("string"==typeof e)(l=t.BaseObject.borrowObject(t.ActionData)).type=i,l.name=e,l.bone=r,l.slot=s,o.push(l);else if(e instanceof Array)for(var a=0,h=e;a<h.length;a++){var u=h[a],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 _=n._getString(u,t.DataParser.SLOT,"");l.slot=this._armature.getSlot(_)}else l.slot=s;var f=null;if(t.DataParser.INTS in u){null===f&&(f=t.BaseObject.borrowObject(t.UserData));for(var d=0,p=u[t.DataParser.INTS];d<p.length;d++){var m=p[d];f.addInt(m)}}if(t.DataParser.FLOATS in u){null===f&&(f=t.BaseObject.borrowObject(t.UserData));for(var g=0,y=u[t.DataParser.FLOATS];g<y.length;g++)m=y[g],f.addFloat(m)}if(t.DataParser.STRINGS in u){null===f&&(f=t.BaseObject.borrowObject(t.UserData));for(var v=0,S=u[t.DataParser.STRINGS];v<S.length;v++)m=S[v],f.addString(m)}l.data=f,o.push(l)}return o},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,o=this._timelineArray.length*Uint16Array.BYTES_PER_ELEMENT,a=e+i+n+r+s+o;if(t.DragonBones.webAssembly){for(var h=t.webAssemblyModule.HEAP16.buffer,u=t.webAssemblyModule._malloc(a),l=new Int16Array(h,u,this._intArray.length),c=new Float32Array(h,u+e,this._floatArray.length),_=new Int16Array(h,u+e+i,this._frameIntArray.length),f=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)_[m]=this._frameIntArray[m];for(m=0,g=this._frameFloatArray.length;m<g;++m)f[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,o)}else{var y=new ArrayBuffer(a);for(l=new Int16Array(y,0,this._intArray.length),c=new Float32Array(y,e,this._floatArray.length),_=new Int16Array(y,e+i,this._frameIntArray.length),f=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)_[m]=this._frameIntArray[m];for(m=0,g=this._frameFloatArray.length;m<g;++m)f[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=_,this._data.frameFloatArray=f,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 o=t.BaseObject.borrowObject(t.DragonBonesData);if(o.version=r,o.name=n._getString(e,t.DataParser.NAME,""),o.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,24),0===o.frameRate&&(o.frameRate=24),t.DataParser.ARMATURE in e){this._data=o,this._parseArray(e);for(var a=0,h=e[t.DataParser.ARMATURE];a<h.length;a++){var u=h[a];o.addArmature(this._parseArmature(u,i))}this._data.binary||this._modifyArray(),t.DataParser.STAGE in e?o.stage=o.getArmature(n._getString(e,t.DataParser.STAGE,"")):o.armatureNames.length>0&&(o.stage=o.getArmature(o.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),o}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 o=e[t.DataParser.SUB_TEXTURE],a=0,h=o.length;a<h;++a){var u=o[a],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),_=n._getNumber(u,t.DataParser.FRAME_HEIGHT,-1);c>0&&_>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=_),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}(Tst||(Tst={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ast(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,o=0,a=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,a=128,r=h-192):this._inRange(h,224,239)?(s=2,a=2048,r=h-224):this._inRange(h,240,244)&&(s=3,a=65536,r=h-240),r*=Math.pow(64,s),e=null);else if(this._inRange(h,128,191))if(o+=1,r+=(h-128)*Math.pow(64,s-o),o!==s)e=null;else{var u=r,l=a;r=0,s=0,o=0,a=0,e=this._inRange(u,l,1114111)&&!this._inRange(u,55296,57343)?u:h}else r=0,s=0,o=0,a=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 o=0,a=this._animation.frameCount+1,h=this._data.frameIndices;t.DragonBones.webAssembly?(o=h.size(),h.resize(o+a,0)):(o=h.length,h.length+=a),r.frameIndicesOffset=o;for(var u=0,l=0,c=0,_=0;u<a;++u)c+_<=u&&l<s&&(c=this._frameArrayBuffer[this._animation.frameOffset+this._timelineArrayBuffer[r.offset+5+l]],_=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(o+u,l-1):h[o+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],o=this._intArrayBuffer[n+0];r.offset=n;for(var a=0;a<o;++a){var h=this._intArrayBuffer[n+2+a];r.addBone(this._rawBones[h])}for(var u=n+2+o,l=0,c=(a=0,s);a<c;++a){var _=this._intArrayBuffer[u++];l+=_,u+=_}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 o=r[s];t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var a=this._armature.getBone(s);if(null!==a)for(var h=0,u=o.length;h<u;h+=2){var l=o[h],c=o[h+1],_=this._parseBinaryTimeline(l,c);this._animation.addBoneTimeline(a,_)}}}if(t.DataParser.SURFACE in e)for(var s in r=e[t.DataParser.SURFACE]){o=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var f=this._armature.getBone(s);if(null!==f)for(h=0,u=o.length;h<u;h+=2)l=o[h],c=o[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addSurfaceTimeline(f,_)}if(t.DataParser.SLOT in e)for(var s in r=e[t.DataParser.SLOT]){o=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var d=this._armature.getSlot(s);if(null!==d)for(h=0,u=o.length;h<u;h+=2)l=o[h],c=o[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addSlotTimeline(d,_)}if(t.DataParser.CONSTRAINT in e)for(var s in r=e[t.DataParser.CONSTRAINT]){o=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s));var p=this._armature.getConstraint(s);if(null!==p)for(h=0,u=o.length;h<u;h+=2)l=o[h],c=o[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addConstraintTimeline(p,_)}if(t.DataParser.ANIMATION in e)for(var s in r=e[t.DataParser.ANIMATION])for(o=r[s],t.DragonBones.webAssembly&&(s=this._getUTF16Key(s)),h=0,u=o.length;h<u;h+=2)l=o[h],c=o[h+1],_=this._parseBinaryTimeline(l,c),this._animation.addAnimationTimeline(s,_);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],o=i[7],a=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),_=new Float32Array(this._binary,this._binaryOffset+i[6],o/Float32Array.BYTES_PER_ELEMENT),f=new Int16Array(this._binary,this._binaryOffset+i[8],a/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+o+a+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,S=g.length;v<S;++v)y[v]=g[v];t.webAssemblyModule.setDataBinary(this._data,m,n,r,s,o,a,h),this._intArrayBuffer=u,this._floatArrayBuffer=l,this._frameIntArrayBuffer=c,this._frameFloatArrayBuffer=_,this._frameArrayBuffer=f,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=_,this._data.frameArray=this._frameArrayBuffer=f,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),o=this._decodeUTF8(s),a=JSON.parse(o);return this._binaryOffset=12+r,this._binary=t,e.prototype.parseDragonBonesData.call(this,a,i)},i.getInstance=function(){return null===i._binaryDataParserInstance&&(i._binaryDataParserInstance=new i),i._binaryDataParserInstance},i._binaryDataParserInstance=null,i}(t.ObjectDataParser);t.BinaryDataParser=e}(Tst||(Tst={})),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=(a=n[i]).getTexture(e)))return h;if(this.autoSearch)for(var r in this._textureAtlasDataMap)for(var s=0,o=this._textureAtlasDataMap[r];s<o.length;s++){var a,h;if((a=o[s]).autoSearch&&null!==(h=a.getTexture(e)))return h}return null},e.prototype._fillBuildArmaturePackage=function(t,e,i,n,r){var s=null,o=null;if(e.length>0&&e in this._dragonBonesDataMap&&(o=(s=this._dragonBonesDataMap[e]).getArmature(i)),null===o&&(0===e.length||this.autoSearch))for(var a in this._dragonBonesDataMap)if(s=this._dragonBonesDataMap[a],(0===e.length||s.autoSearch)&&null!==(o=s.getArmature(i))){e=a;break}if(null!==o){if(t.dataName=e,t.textureAtlasName=r,t.data=s,t.armature=o,t.skin=null,n.length>0&&(t.skin=o.getSkin(n),null===t.skin&&this.autoSearch))for(var a in this._dragonBonesDataMap){var h=this._dragonBonesDataMap[a].getArmature(n);if(null!==h){t.skin=h.defaultSkin;break}}return null===t.skin&&(t.skin=o.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 o in r.displays){var a=r.getDisplays(o);s[o]=a}if(n!==r)for(var o in n.displays)a=n.getDisplays(o),s[o]=a;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,_=this._buildSlot(e,l,i);if(_.rawDisplayDatas=c,null!==c){for(var f=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?f.push(this._getSlotDisplay(e,m,null,_)):f.push(null)}_._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 o=t.BaseObject.borrowObject(t.IKConstraint);o.init(s,i),i._addConstraint(o);break;case 1:var a=t.BaseObject.borrowObject(t.PathConstraint);a.init(s,i),i._addConstraint(a);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,o=null;switch(i.type){case 0:var a=i;null!==e&&e.textureAtlasName.length>0&&(a.texture=this._getTextureData(e.textureAtlasName,i.path)),null===a.texture&&(a.texture=this._getTextureData(s,i.path)),o=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)),o=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 _=0,f=c;_<f.length;_++){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}o=l}return o},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 o=this._buildTextureAtlasData(null,null);if(!r.parseTextureAtlasData(null,o,n)){o.returnToPool();break}this.addTextureAtlasData(o,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 o=this._buildArmature(s);return this._buildBones(s,o),this._buildSlots(s,o),this._buildConstraints(s,o),o.invalidUpdate(null,!0),o.advanceTime(0),o},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,o=r.length;s<o;++s)r[s]||(r[s]=null)}if(null!==i){var a=e.rawDisplayDatas,h=null;a&&(t.DragonBones.webAssembly?n<a.size()&&(h=a.get(n)):n<a.length&&(h=a[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 o=this.getArmatureData(e,t||"");if(!o||!o.defaultSkin)return!1;var a=o.defaultSkin.getDisplay(i,n);return!!a&&(this.replaceDisplay(r,a,s),!0)},e.prototype.replaceSlotDisplayList=function(e,i,n,r){var s=this.getArmatureData(i,e||"");if(!s||!s.defaultSkin)return!1;var o=s.defaultSkin.getDisplays(n);if(!o)return!1;for(var a=0,h=0,u=t.DragonBones.webAssembly?o.size():o.length;h<u;++h){var l=t.DragonBones.webAssembly?o.get(h):o[h];this.replaceDisplay(r,l,a++)}return!0},e.prototype.replaceSkin=function(e,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null);for(var s=!1,o=i.parent.defaultSkin,a=0,h=e.getSlots();a<h.length;a++){var u=h[a];if(!(null!==r&&r.indexOf(u.name)>=0)){var l=i.getDisplays(u.name);if(l||(null!==o&&i!==o&&(l=o.getDisplays(u.name)),l)){var c=t.DragonBones.webAssembly?l.size():l.length,_=u.displayList;_.length=c;for(var f=0,d=c;f<d;++f){var p=t.DragonBones.webAssembly?l.get(f):l[f];_[f]=null!==p?this._getSlotDisplay(null,p,null,u):null}s=!0,u.rawDisplayDatas=l,u.displayList=_}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,o={};for(var a in s)o[a]=s[a];for(var a in i.animations)o[a]=i.animations[a];e.animation.animations=o}for(var h=0,u=e.getSlots();h<u.length;h++)for(var l=u[h],c=0,_=0,f=l.displayList;_<f.length;_++){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}(Tst||(Tst={})),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}}(Tst||(Tst={}));var bst,Est,Cst,xst,wst,Dst,Rst,Ist,Mst,Pst,Bst,Ost,Lst=Tst.DragonBones,Nst=Tst.BaseObject,Fst=Tst.Matrix,kst=Tst.Transform,Vst=Tst.ColorTransform,Gst=Tst.Point,Ust=Tst.Rectangle,zst=Tst.UserData,Hst=Tst.ActionData,Wst=Tst.DragonBonesData,jst=Tst.ArmatureData,Xst=Tst.BoneData,Yst=Tst.SurfaceData,qst=Tst.SlotData,Kst=Tst.ConstraintData,Qst=Tst.IKConstraintData,Zst=Tst.PathConstraintData,Jst=Tst.CanvasData,$st=Tst.SkinData,tot=Tst.VerticesData,eot=Tst.DisplayData,iot=Tst.ImageDisplayData,not=Tst.ArmatureDisplayData,rot=Tst.MeshDisplayData,sot=Tst.BoundingBoxDisplayData,oot=Tst.PathDisplayData,aot=Tst.WeightData,hot=Tst.BoundingBoxData,uot=Tst.RectangleBoundingBoxData,lot=Tst.EllipseBoundingBoxData,cot=Tst.PolygonBoundingBoxData,_ot=Tst.AnimationData,fot=Tst.TimelineData,dot=Tst.AnimationConfig,pot=Tst.TextureAtlasData,mot=Tst.TextureData,got=Tst.DeformVertices,yot=Tst.Armature,vot=Tst.TransformObject,Sot=Tst.Bone,Aot=Tst.Surface,Tot=Tst.Slot,bot=Tst.Constraint,Eot=Tst.IKConstraint,Cot=Tst.PathConstraint,xot=Tst.WorldClock,wot=Tst.Animation,Dot=Tst.AnimationState,Rot=Tst.BonePose,Iot=Tst.BlendState,Mot=Tst.TimelineState,Pot=Tst.TweenTimelineState,Bot=Tst.BoneTimelineState,Oot=Tst.SlotTimelineState,Lot=Tst.ConstraintTimelineState,Not=Tst.ActionTimelineState,Fot=Tst.ZOrderTimelineState,kot=Tst.BoneAllTimelineState,Vot=Tst.BoneTranslateTimelineState,Got=Tst.BoneRotateTimelineState,Uot=Tst.BoneScaleTimelineState,zot=Tst.SurfaceTimelineState,Hot=Tst.SlotDislayTimelineState,Wot=Tst.SlotColorTimelineState,jot=Tst.DeformTimelineState,Xot=Tst.IKConstraintTimelineState,Yot=Tst.AnimationTimelineState,qot=Tst.EventObject,Kot=Tst.DataParser,Qot=Tst.ObjectDataParser,Zot=Tst.ActionFrame,Jot=Tst.BinaryDataParser,$ot=Tst.BaseFactory,tat=Tst.BuildArmaturePackage,eat=Tst.BinaryOffset,iat=Tst.ArmatureType,nat=Tst.BoneType,rat=Tst.DisplayType,sat=Tst.BoundingBoxType,oat=Tst.ActionType,aat=Tst.BlendMode,hat=Tst.TweenType,uat=Tst.TimelineType,lat=Ta,cat=lat("dragonBones.CCTextureAtlasData")(bst=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 Nst.borrowObject(_at)},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 Zn(i.region.x,i.region.y,i.region.height,i.region.width):(n=new Zn(i.region.x,i.region.y,i.region.width,i.region.height),i.spriteFrame=new wP,i.spriteFrame.texture=t,i.spriteFrame.rect=n)}}else for(var r in this.textures)this.textures[r].spriteFrame=null}}]),e}(pot))||bst,_at=lat("dragonBones.CCTextureData")(Est=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}(mot))||Est,fat=Ta("dragonBones.CCSlot")(Cst=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 Vn,e._worldMatrix=new Vn,e._worldMatrixDirty=!0,e._visible=!1,e._color=new bn,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):Vn.copy(this._worldMatrix,this._matrix),this._worldMatrixDirty=!1},i._onClear=function(){t.prototype._onClear.call(this),this._localVertices.length=0,this._indices.length=0,Vn.identity(this._matrix),Vn.identity(this._worldMatrix),this._worldMatrixDirty=!0,this._color=new bn,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,o=s.width,a=s.height,h=r.region;if(0!==o&&0!==a){var u=null!==this._deformVertices&&this._display===this._meshDisplay?this._deformVertices.verticesData:null;if(u){var l=u.data,c=l.intArray,_=l.floatArray,f=c[u.offset+eat.MeshVertexCount],d=c[u.offset+eat.MeshTriangleCount],p=c[u.offset+eat.MeshFloatOffset];p<0&&(p+=65536);for(var m=p+2*f,g=this._armature._armatureData.scale,y=0,v=2*f;y<v;y+=2)e[n++]=_[p+y]*g,e[n++]=-_[p+y+1]*g,u.rotated?(e[n++]=(h.x+(1-_[m+y])*h.width)/o,e[n++]=(h.y+_[m+y+1]*h.height)/a):(e[n++]=(h.x+_[m+y]*h.width)/o,e[n++]=(h.y+_[m+y+1]*h.height)/a);for(var S=0;S<3*d;++S)t[i++]=c[u.offset+eat.MeshVertexIndices+S];e.length=n,t.length=i,u.weight&&this._identityTransform()}else{var A=h.x/o,T=(h.y+h.height)/a,b=(h.x+h.width)/o,E=h.y/a;e[n++]=0,e[n++]=0,e[n++]=A,e[n++]=T,e[n++]=h.width,e[n++]=0,e[n++]=b,e[n++]=T,e[n++]=0,e[n++]=h.height,e[n++]=A,e[n++]=E,e[n++]=h.width,e[n++]=h.height,e[n++]=b,e[n++]=E,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 "+o+" x "+a)}},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,o=this._localVertices;if(r){var a=n.data,h=a.intArray,u=a.floatArray,l=h[n.offset+eat.MeshVertexCount],c=h[r.offset+eat.WeigthFloatOffset];c<0&&(c+=65536);for(var _=0,f=r.offset+eat.WeigthBoneIndices+i.length,d=c,p=0,m=0;_<l;_++,m+=4){for(var g=h[f++],y=0,v=0,S=0;S<g;++S){var A=i[h[f++]];if(null!==A){var T=A.globalTransformMatrix,b=u[d++],E=u[d++]*t,C=u[d++]*t;s&&(E+=e[p++],C+=e[p++]),y+=(T.a*E+T.c*C+T.tx)*b,v+=(T.b*E+T.d*C+T.ty)*b}}o[m]=y,o[m+1]=-v}}else if(s){var x=this._parent._boneData.type!==nat.Bone,w=n.data,D=w.intArray,R=w.floatArray,I=D[n.offset+eat.MeshVertexCount],M=D[n.offset+eat.MeshFloatOffset];M<0&&(M+=65536);for(var P=0,B=I,O=0;P<B;P++,O+=4){var L=R[M+2*P]*t+e[2*P],N=R[M+2*P+1]*t+e[2*P+1];if(x){var F=this._parent._getGlobalTransformMatrix(L,N);o[O]=F.a*L+F.c*N+F.tx,o[O+1]=-F.b*L+F.d*N+F.ty}else o[O]=L,o[O+1]=-N}}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,o=e.m05,a=e.m12,h=e.m13,u=i.m00,l=i.m01,c=i.m04,_=i.m05,f=i.m12,d=i.m13;0!==r||0!==s?(t.m00=u*n+l*s,t.m01=u*r+l*o,t.m04=c*n+_*s,t.m05=c*r+_*o,t.m12=n*f+s*d+a,t.m13=r*f+o*d+h):(t.m00=u*n,t.m01=l*o,t.m04=c*n,t.m05=_*o,t.m12=n*f+a,t.m13=o*d+h)},e}(Tot))||Cst,dat=Ta("dragonBones.CCArmatureDisplay")(xst=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 lo,e}s(e,t);var i=e.prototype;return i.hasEvent=function(){return U("Method not implemented."),!1},i.addEvent=function(){U("Method not implemented.")},i.removeEvent=function(){U("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 mn(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._uiProps.uiTransformComp)||void 0===e?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}(eot))||xst,pat=Ta("CCFactory")(((Dst=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 dat;return e._dragonBones=new Lst(i),FI.getScheduler()&&(MM.on(IM.EVENT_RESTART,e.onRestart,c(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(){rc.enableForTarget(this),FI.getScheduler().scheduleUpdate(this,Jl.Priority.HIGH,!1)},i.update=function(t){this._dragonBones.advanceTime(t)},i.getDragonBonesDataByRawData=function(t){return(t instanceof ArrayBuffer?$ot._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 xg).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=Nst.borrowObject(cat),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,o=!1,a=e.length-1;a>=0;a--)if(s>=e[a]._zOrder){e.splice(a+1,0,r),o=!0;break}o||e.unshift(r)}this._slots=e},i._buildArmature=function(t){var e=Nst.borrowObject(yot);e._skinData=t.skin,e._animation=Nst.borrowObject(wot),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new dat;return e.init(t.armature,i,i,this._dragonBones),e},i._buildSlot=function(t,e,i){var n=Nst.borrowObject(fat),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}($ot))._factory=null,wst=Dst))||wst,mat=1/60,gat=[],yat=[],vat=0,Sat=0,Aat=0,Tat=null,bat=null,Eat=0,Cat=0,xat=0,wat=0,Dat=0,Rat=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(mat),this._frameIdx++,this.updateFrame(e,this._frameIdx),this.totalTime+=mat}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){Aat=0,vat=0,Sat=0,Tat=null,bat=null,Eat=0,Cat=0,xat=0,wat=0,Dat=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),wat>0&&(r[wat-1].vfOffset=Aat),r.length=wat,s.length=vat;var o=xat-1;if(o>=0)if(Cat>0){var a=n[o];a.indexCount=Cat,a.vfCount=9*Eat,a.vertexCount=Eat,n.length=xat}else n.length=xat-1;if(0!==n.length){var h,u=i.vertices,l=Aat/5,c=9*l;(!u||u.length<Aat)&&(u=i.vertices=new Float32Array(c));for(var _=0,f=0;_<c;)u[_]=gat[f++],u[_+1]=gat[f++],u[_+3]=gat[f++],u[_+4]=gat[f++],h=gat[f++],u[_+5]=(255&h)/255,u[_+6]=(h>>8&255)/255,u[_+7]=(h>>16&255)/255,u[_+8]=(h>>24&255)/255,_+=9;var d=i.indices;(!d||d.length<Sat)&&(d=i.indices=new Uint16Array(Sat));for(var p=0;p<Sat;p++)d[p]=yat[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,o,a,h,u,l,c=this._tempColors,_=this._tempSegments,f=this._tempBoneInfos,d=t._slots,p=t._bones;if(this._enableCacheAttachedInfo)for(var m=0,g=p.length;m<g;m++,vat++){var y=p[m],v=f[vat];v||(v=f[vat]={globalTransformMatrix:new Fst});var S=y.globalTransformMatrix;v.globalTransformMatrix.copyFrom(S)}for(var A=0,T=d.length;A<T;A++)if((r=d[A])._visible&&r._displayData)if(r.updateWorldMatrix(),o=r._color,r.childArmature)this._traverseArmature(r.childArmature,e*o.a/255);else if(h=r.getTexture()){Tat===h.nativeUrl&&bat===r._blendMode||(Tat=h.nativeUrl,bat=r._blendMode,(u=xat-1)>=0&&(Cat>0?((l=_[u]).indexCount=Cat,l.vertexCount=Eat,l.vfCount=9*Eat):xat--),_[xat]={tex:h,blendMode:r._blendMode,indexCount:0,vertexCount:0,vfCount:0},xat++,Cat=0,Eat=0),a=(o.a*e<<24>>>0)+(o.b<<16)+(o.g<<8)+o.r,Dat!==a&&(Dat=a,wat>0&&(c[wat-1].vfOffset=Aat),c[wat++]={r:o.r,g:o.g,b:o.b,a:o.a*e,vfOffset:0}),i=r._localVertices,n=r._indices,s=r._worldMatrix;for(var b=0,E=i.length;b<E;)Ist=i[b++],Mst=i[b++],gat[Aat++]=Ist*s.m00+Mst*s.m04+s.m12,gat[Aat++]=Ist*s.m01+Mst*s.m05+s.m13,gat[Aat++]=i[b++],gat[Aat++]=i[b++],gat[Aat++]=a;for(var C=0,x=n.length;C<x;C++)yat[Sat++]=Eat+n[C];Cat+=n.length,Eat+=i.length/4}},t}(),Iat=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 o=pat.getInstance().buildArmatureDisplay(e,i,"",n);if(!o||!o._armature)return null;if(r=o._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 o=t+"#"+e;(s=this._animationPool[o])?delete this._animationPool[o]:(s=new Rat)._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}();Rst=Iat,Iat.FrameTime=mat,Iat.sharedCache=new Rst;var Mat,Pat,Bat,Oat,Lat,Nat,Fat,kat,Vat=Ma,Gat=Ta("dragonBones.DragonBonesAsset")((Bst=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)._dragonBonesJson=Ost&&Ost(),e._factory=null,e._dragonBonesJsonData=void 0,e._armaturesEnum=null,e}s(e,t);var i=e.prototype;return i.constructctor=function(){this.reset()},i.createNode=function(t){var e=new xg(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||pat.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:U("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=be(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 o in r)r.hasOwnProperty(o)&&(n[o]=s+1,s++);return be(n)}return null},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(Iat.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}(Fd),Ost=fa(Bst.prototype,"_dragonBonesJson",[Vat],(function(){return""})),Pst=Bst))||Pst;v.internal.DragonBonesAsset=Gat;var Uat,zat=Ma,Hat=eh,Wat=(Mat=Ta("dragonBones.DragonBonesAtlasAsset"),Pat=Hat(Dm),Mat((Oat=function(t){function e(){var e;return(e=t.call(this)||this)._atlasJson=Lat&&Lat(),e._texture=Nat&&Nat(),e._atlasJsonData=Fat&&Fat(),e._factory=null,e._textureAtlasData=kat&&kat(),e._clear(),e}s(e,t);var i=e.prototype;return i.createNode=function(t){var e=new xg(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&&(Iat.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}(Fd),Lat=fa(Oat.prototype,"_atlasJson",[zat],(function(){return""})),Nat=fa(Oat.prototype,"_texture",[zat,Pat],(function(){return null})),Fat=fa(Oat.prototype,"_atlasJsonData",[zat],(function(){return{}})),kat=fa(Oat.prototype,"_textureAtlasData",[zat],(function(){return null})),Bat=Oat))||Bat);v.internal.DragonBonesAtlasAsset=Wat;var jat,Xat,Yat,qat,Kat,Qat,Zat,Jat,$at,tht,eht,iht,nht,rht,sht,oht,aht,hht,uht,lht,cht,_ht,fht,dht,pht,mht,ght,yht,vht,Sht,Aht,Tht,bht,Eht,Cht=new Vn,xht=Ta("dragonBones.AttachUtil")(Uat=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,o=this._armatureDisplay.socketNodes,a=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]:a[u.boneIndex];c&&(i=l,n=c.globalTransformMatrix,r=void 0,(r=Cht).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=Cht)}else o.delete(u.path),s.splice(h,1)}}},t}())||Uat,wht=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,FI.registerSystem(e.ID,e._instance,Jl.Priority.HIGH)),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}(Jl);wht.ID="ARMATURE",wht._instance=void 0,v.internal.ArmatureSystem=wht,function(t){t[t.default=-1]="default"}(Aht||(Aht={})),xe(Aht),function(t){t[t["<None>"]=0]="<None>"}(Tht||(Tht={})),xe(Tht),function(t){t[t.REALTIME=0]="REALTIME"}(bht||(bht={})),xe(Tht),function(t){t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(Eht||(Eht={})),xe(Eht);var Dht=Ta,Rht=Ma,Iht=eh,Mht=_h,Pht=(jat=Dht("dragonBones.ArmatureDisplay.DragonBoneSocket"),Xat=Iht(xg),jat((qat=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=Kat&&Kat(),this.target=Qat&&Qat(),this.boneIndex=null,this.path=t,this.target=e},Kat=fa(qat.prototype,"path",[Rht],(function(){return""})),Qat=fa(qat.prototype,"target",[Xat,Rht],(function(){return null})),Yat=qat))||Yat);ie(Pht,"dragonBones.ArmatureDisplay.DragonBoneSocket");var Bht=(Zat=Dht("dragonBones.ArmatureDisplay"),Jat=Iht(Gat),$at=Iht(Wat),tht=Iht(Aht),eht=Iht(Tht),iht=Iht([Pht]),nht=Iht(oT),Zat(((Sht=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).playTimes=oht&&oht(),e.premultipliedAlpha=aht&&aht(),e._armature=null,e.attachUtil=void 0,e._defaultArmatureIndexValue=hht&&hht(),e._dragonAsset=uht&&uht(),e._dragonAtlasAsset=lht&&lht(),e._armatureName=cht&&cht(),e._animationName=_ht&&_ht(),e._animationIndexValue=fht&&fht(),e._preCacheMode=-1,e._cacheMode=Eht.REALTIME,e._defaultCacheModeValue=dht&&dht(),e._timeScale=pht&&pht(),e._playTimes=mht&&mht(),e._debugBones=ght&&ght(),e._enableBatch=yht&&yht(),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 Ks((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumArmatures=be({}),e._enumAnimations=be({}),e._socketNodes=new Map,e._cachedSockets=new Map,e._sockets=vht&&vht(),e._inited=void 0,e._drawInfoList=[],e._cacheModeEnum=void 0,e._eventTarget=new lo,e._inited=!1,e.attachUtil=new xht,e.initFactory(),pi(c(e),"_animationIndex",e._enumAnimations),pi(c(e),"_defaultArmatureIndex",e._enumArmatures),e._useVertexOpacity=!0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new nO),this._drawInfoList[t]},e.initFactory=function(){this._factory=pat.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 pT({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 UA.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(),o=s.indexOffset,a=0;a<this._drawList.length;a++){this._drawIdx=a;var h=this._drawList.data[a];h.texture&&t.commitMiddleware(this,s,o+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 this._cacheMode!==Eht.REALTIME},e.onEnable=function(){t.prototype.onEnable.call(this),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.add(this._armature),this._flushAssembler(),wht.getInstance().add(this)},e.onDisable=function(){t.prototype.onDisable.call(this),this._armature&&!this.isAnimationCached()&&this._factory._dragonBones.clock.remove(this._armature),wht.getInstance().remove(this)},e._emitCacheCompleteEvent=function(){this._eventTarget.emit(qot.LOOP_COMPLETE),this._eventTarget.emit(qot.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=Iat.FrameTime;0===this._accTime&&0===this._playCount&&this._eventTarget.emit(qot.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,this._cacheMode===Eht.PRIVATE_CACHE?(this._armatureCache.dispose(),this._armatureCache=null,this._armature=null):this._cacheMode===Eht.SHARED_CACHE?(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=new xg("DEBUG_DRAW_NODE");t.hideFlags|=$s.Flags.DontSave|$s.Flags.HideInHierarchy;var e=t.addComponent(RF);e.lineWidth=1,e.strokeColor=new bn(255,0,0,255),this._debugDraw=e}this._debugDraw.node.parent=this.node}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&&(this._preCacheMode===Eht.PRIVATE_CACHE?this._armatureCache.dispose():this._preCacheMode===Eht.REALTIME&&this._armature.dispose(),this._armatureCache=null,this._armature=null,this._displayProxy=null,this._frameCache=null,this._curFrame=null,this._playing=!1,this._preCacheMode=-1),this._cacheMode===Eht.SHARED_CACHE?this._armatureCache=Iat.sharedCache:this._cacheMode===Eht.PRIVATE_CACHE&&(this._armatureCache=new Iat,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=Eht.REALTIME)),this._preCacheMode=this._cacheMode,this._cacheMode===Eht.REALTIME){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(this._cacheMode!==Eht.REALTIME&&this.debugBones&&U("Debug bones is invalid in cached mode"),this._armature){var e=this._armature.armatureData.aabb;this.node._uiProps.uiTransformComp.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=f(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=be({}),this._armature?Object.assign(this._cacheModeEnum,Eht):Object.assign(this._cacheModeEnum,bht),pi(this,"_defaultCacheMode",this._cacheModeEnum)},e._updateAnimEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getAnimsEnum(this.armatureName):Tht,this._enumAnimations=be({}),Object.assign(this._enumAnimations,t||Tht),be.update(this._enumAnimations),pi(this,"_animationIndex",this._enumAnimations)},e._updateArmatureEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getArmatureEnum():Aht,this._enumArmatures=be({}),Object.assign(this._enumArmatures,t||Aht),be.update(this._enumArmatures),pi(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(),o=new Map,a=0;a<s.length;a++)s[a]._boneIndex=a;for(var h=0;h<s.length;h++)e(h,s,o);for(var u,l=f(o.keys());!(u=l()).done;){var c=u.value;t.set(""+n+o.get(c),c)}for(var _=r.getSlots(),d=0;d<_.length;d++)_[d].childArmature&&i(_[d].name,_[d].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 AO(rO.DYNAMIC);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 et(7400,this.name);e=i[this._defaultArmatureIndex]}void 0!==e?this.armatureName=e:et(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):et(7402,this.name)}}else this.animationName=""}},{key:"_defaultCacheMode",get:function(){return this._defaultCacheModeValue},set:function(t){if(this._defaultCacheModeValue=t,this._defaultCacheMode!==Eht.REALTIME&&this._armature&&!Iat.canCache(this._armature))return this._defaultCacheMode=Eht.REALTIME,void U("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}(JO)).AnimationCacheMode=Eht,m((sht=Sht).prototype,"dragonAsset",[Jat],Object.getOwnPropertyDescriptor(sht.prototype,"dragonAsset"),sht.prototype),m(sht.prototype,"dragonAtlasAsset",[$at],Object.getOwnPropertyDescriptor(sht.prototype,"dragonAtlasAsset"),sht.prototype),m(sht.prototype,"_defaultArmatureIndex",[tht],Object.getOwnPropertyDescriptor(sht.prototype,"_defaultArmatureIndex"),sht.prototype),m(sht.prototype,"_animationIndex",[eht],Object.getOwnPropertyDescriptor(sht.prototype,"_animationIndex"),sht.prototype),m(sht.prototype,"timeScale",[Rht],Object.getOwnPropertyDescriptor(sht.prototype,"timeScale"),sht.prototype),oht=fa(sht.prototype,"playTimes",[Rht],(function(){return-1})),aht=fa(sht.prototype,"premultipliedAlpha",[Rht],(function(){return!1})),m(sht.prototype,"sockets",[iht],Object.getOwnPropertyDescriptor(sht.prototype,"sockets"),sht.prototype),hht=fa(sht.prototype,"_defaultArmatureIndexValue",[Rht],(function(){return Aht.default})),uht=fa(sht.prototype,"_dragonAsset",[Rht],(function(){return null})),lht=fa(sht.prototype,"_dragonAtlasAsset",[Rht],(function(){return null})),cht=fa(sht.prototype,"_armatureName",[Rht],(function(){return""})),_ht=fa(sht.prototype,"_animationName",[Rht],(function(){return""})),fht=fa(sht.prototype,"_animationIndexValue",[Rht],(function(){return 0})),dht=fa(sht.prototype,"_defaultCacheModeValue",[Rht],(function(){return Eht.REALTIME})),pht=fa(sht.prototype,"_timeScale",[Rht],(function(){return 1})),mht=fa(sht.prototype,"_playTimes",[Rht],(function(){return-1})),ght=fa(sht.prototype,"_debugBones",[Rht],(function(){return!1})),yht=fa(sht.prototype,"_enableBatch",[Rht],(function(){return!1})),vht=fa(sht.prototype,"_sockets",[Rht],(function(){return[]})),m(sht.prototype,"customMaterial",[Mht,nht],Object.getOwnPropertyDescriptor(sht.prototype,"customMaterial"),sht.prototype),rht=sht))||rht);v.internal.ArmatureDisplay=Bht;var Oht,Lht,Nht,Fht,kht,Vht,Ght,Uht,zht,Hht,Wht,jht=new bn(255,0,0,255),Xht=new bn(0,0,255,255),Yht=new bn(0,255,0,255),qht=0,Kht=0,Qht=0,Zht=0,Jht=0,$ht=0,tut=0,eut=0,iut=0,nut=new Float32Array(4),rut=new mn(0,0,0),sut=new Vn,out=null,aut=null;function hut(t,e){if(!t)return null;var i,n;switch(e){case 1:i=kht?kc.ONE:kc.SRC_ALPHA,n=kc.ONE;break;case 10:i=kc.DST_COLOR,n=kc.ONE_MINUS_SRC_ALPHA;break;case 12:i=kc.ONE,n=kc.ONE_MINUS_SRC_COLOR;break;case 0:default:i=kht?kc.ONE:kc.SRC_ALPHA,n=kc.ONE_MINUS_SRC_ALPHA}return Hht.getMaterialForBlend(i,n)}function uut(t,e){var i=t.a*e*Fht,n=kht?i/255:1,r=t.r*Oht*n/255,s=t.g*Lht*n/255,o=t.b*Nht*n/255;nut[0]=r,nut[1]=s,nut[2]=o,nut[3]=kht?1:i/255}var lut=null,cut={accessor:lut,vCount:32767,ensureAccessor:function(){if(!lut){var t=FI.root.device,e=FI.root.batcher2D,i=GB;this.accessor=lut=new tO(t,i,this.vCount),e.registerBufferAccessor(Number.parseInt("DRAGONBONES",36),lut)}return this.accessor},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 o=i[s],a=o._localVertices.length%4;n+=0===a?o._localVertices.length/4:(o._localVertices.length-a)/4+1,r+=o._indices.length}(e=EO.add(GB,this.accessor)).resize(n,r),e.indices&&r===e.indices.length||(e.indices=new Uint16Array(r))}return e},updateRenderData:function(t){Hht=t,t._armature&&function(t){var e=t._armature;if(e&&null!==t.renderData){Vht=!0,kht=t.premultipliedAlpha,t.drawList.reset(),Hht=t,t.node,Ght=t.renderData,Hht=t,Wht=0,out=null;var i=t.color;Oht=i.r/255,Lht=i.g/255,Nht=i.b/255,Fht=t.node._uiProps.opacity,4294967295!==bn.toUint32(i)&&(Wht|=1);var n=t.node.getWorldMatrix();if(qht=0,Qht=0,Zht=0,Jht=0,$ht=0,iut=0,tut=Hht.maxVertexCount,eut=Hht.maxIndexCount,t.isAnimationCached())!function(t,e){if(t){var i=t.segments;if(0!==i.length){var n=null,r=t.vertices,s=t.indices,o=0,a=0,h=0,u=0,l=0,c=t.colors,_=c[l++],f=_.vfOffset;uut(_,1);for(var d=Ght,p=d.chunk.vb,m=d.indices,g=0,y=i.length;g<y;g++){var v=i[g];if(n=hut(v.tex,v.blendMode)){if(out||(out=n),Vht||n.hash!==out.hash||v.tex&&v.tex!==aut){Vht=!1;var S=$ht-iut;S>0&&(Hht._requestDrawData(out,aut,iut,S),iut=$ht),out=n,aut=v.tex}Kht=v.vertexCount,Jht=v.indexCount,o=d.chunk.vertexOffset;for(var A=$ht,T=$ht+Jht;A<T;A++)m[A]=o+Qht+s[h++];u=v.vfCount;var b=r.subarray(a,u);p.set(b,a);var E=0;if(e)for(var C=0,x=Kht;C<x;C++)rut.x=p[E],rut.y=p[E+1],rut.z=0,rut.transformMat4(e),p[E]=rut.x,p[E+1]=rut.y,p[E+2]=rut.z,E+=9;if(1&Wht)for(var w=a/9*5,D=a,R=a+u;D<R;D+=9,w+=5)w>=f&&(uut(_=c[l++],1),f=_.vfOffset),p.set(nut,D+5);a+=u,Qht+=Kht,$ht+=Jht,Kht=0,Jht=0}}var I=$ht-iut;aut&&I>0&&Hht._requestDrawData(out,aut,iut,I)}}}(t._curFrame,n);else{_ut(e,1,n);var r=t._debugDraw;if(t.debugBones&&r){r.clear(),r.lineWidth=5,r.strokeColor=jht,r.fillColor=Xht;for(var s=e.getBones(),o=0,a=s.length;o<a;o++){var h=s[o],u=Math.max(h.boneData.length,5),l=h.globalTransformMatrix.tx,c=h.globalTransformMatrix.ty,_=l+h.globalTransformMatrix.a*u,f=c+h.globalTransformMatrix.b*u;r.moveTo(l,c),r.lineTo(_,f),r.stroke(),r.circle(l,c,2*Math.PI),r.fill(),0===o&&(r.fillColor=Yht)}}}lut.getMeshBuffer(Ght.chunk.bufferId).setDirty(),Hht=void 0}}(t)},updateColor:function(t){t&&(Hht=t).markForUpdateRenderData()}};function _ut(t,e,i){var n=Ght;zht=n.chunk.vb,Uht=n.indices;for(var r,s,o,a,h,u,l=t._slots,c=0,_=l.length;c<_;c++)if(a=(h=l[c])._color,h._visible&&h._displayData)if(i?Vn.multiply(h._worldMatrix,i,h._matrix):Vn.copy(h._worldMatrix,h._matrix),h.childArmature)_ut(h.childArmature,a.a/255,h._worldMatrix);else if(r=hut(h.getTexture(),h._blendMode)){out||(out=r);var f=h.getTexture();if(Vht||r.hash!==out.hash||f&&aut!==f){Vht=!1;var d=$ht-iut;d>0&&(Hht._requestDrawData(out,aut,iut,d),iut=$ht),aut=f,out=r}uut(a,e),sut.set(h._worldMatrix),s=h._localVertices,Kht=s.length/4,qht=9*Kht,o=h._indices,Jht=o.length;var p=!1;if(Qht+Kht>tut&&(tut=Qht+Kht,p=!0),$ht+Jht>eut&&(eut=$ht+Jht,p=!0),p){var m=Uht,g=n.chunk.vertexOffset;n.resizeAndCopy(tut,eut>n.indexCount?eut:n.indexCount),zht=n.chunk.vb,eut>Uht.length&&(Uht=n.indices=new Uint16Array(eut));for(var y=n.chunk.vertexOffset-g,v=0;v<$ht;++v)Uht[v]=m[v]+y}for(var S=0,A=s.length,T=Zht;S<A;T+=9)rut.x=s[S++],rut.y=s[S++],rut.z=0,rut.transformMat4(sut),zht[T]=rut.x,zht[T+1]=rut.y,zht[T+2]=rut.z,zht[T+3]=s[S++],zht[T+4]=s[S++],zht.set(nut,T+5);for(var b=n.chunk.vertexOffset,E=0,C=o.length,x=$ht;E<C;E++,x++)Uht[x]=Qht+o[E]+b;Zht+=qht,Qht+=Kht,$ht+=Jht,Kht=0,Jht=0}u=$ht-iut,aut&&u>0&&(Hht._requestDrawData(out,aut,iut,u),iut=$ht),Hht.maxIndexCount<eut&&(Hht.maxIndexCount=eut),Hht.maxVertexCount<tut&&(Hht.maxVertexCount=tut)}v.internal.DragonBonesAssembler=cut;var fut,dut,put,mut={getAssembler:function(){return cut}};Bht.Assembler=mut,function(t){t[t.FFD=0]="FFD",t[t.AdjustColor=10]="AdjustColor",t[t.BevelFilter=11]="BevelFilter",t[t.BlurFilter=12]="BlurFilter",t[t.DropShadowFilter=13]="DropShadowFilter",t[t.GlowFilter=14]="GlowFilter",t[t.GradientBevelFilter=15]="GradientBevelFilter",t[t.GradientGlowFilter=16]="GradientGlowFilter"}(fut||(fut={})),function(t){t[t.Frame=0]="Frame",t[t.Sound=1]="Sound"}(dut||(dut={})),function(t){t[t.None=0]="None",t[t.SameLayer=1]="SameLayer",t[t.SameGroup=2]="SameGroup",t[t.SameLayerAndGroup=3]="SameLayerAndGroup",t[t.All=4]="All"}(put||(put={})),t("eD",Object.freeze({__proto__:null,get ExtensionType(){return fut},get EventType(){return dut},get AnimationFadeOutMode(){return put},CCFactory:pat,CCSlot:fat,CCTextureAtlasData:cat,CCTextureData:_at,CCArmatureDisplay:dat,AnimationCache:Rat,ArmatureCache:Iat,DragonBonesAsset:Gat,DragonBonesAtlasAsset:Wat,timeScale:1,get AnimationCacheMode(){return Eht},DragonBoneSocket:Pht,ArmatureDisplay:Bht,AttachUtil:xht,simpleDragonBoneAssembler:mut,DragonBones:Lst,BaseObject:Nst,Matrix:Fst,Transform:kst,ColorTransform:Vst,Point:Gst,Rectangle:Ust,UserData:zst,ActionData:Hst,DragonBonesData:Wst,ArmatureData:jst,BoneData:Xst,SurfaceData:Yst,SlotData:qst,ConstraintData:Kst,IKConstraintData:Qst,PathConstraintData:Zst,CanvasData:Jst,SkinData:$st,VerticesData:tot,DisplayData:eot,ImageDisplayData:iot,ArmatureDisplayData:not,MeshDisplayData:rot,BoundingBoxDisplayData:sot,PathDisplayData:oot,WeightData:aot,BoundingBoxData:hot,RectangleBoundingBoxData:uot,EllipseBoundingBoxData:lot,PolygonBoundingBoxData:cot,AnimationData:_ot,TimelineData:fot,AnimationConfig:dot,TextureAtlasData:pot,TextureData:mot,DeformVertices:got,Armature:yot,TransformObject:vot,Bone:Sot,Surface:Aot,Slot:Tot,Constraint:bot,IKConstraint:Eot,PathConstraint:Cot,WorldClock:xot,Animation:wot,AnimationState:Dot,BonePose:Rot,BlendState:Iot,TimelineState:Mot,TweenTimelineState:Pot,BoneTimelineState:Bot,SlotTimelineState:Oot,ConstraintTimelineState:Lot,ActionTimelineState:Not,ZOrderTimelineState:Fot,BoneAllTimelineState:kot,BoneTranslateTimelineState:Vot,BoneRotateTimelineState:Got,BoneScaleTimelineState:Uot,SurfaceTimelineState:zot,SlotDislayTimelineState:Hot,SlotColorTimelineState:Wot,DeformTimelineState:jot,IKConstraintTimelineState:Xot,AnimationTimelineState:Yot,EventObject:qot,DataParser:Kot,ObjectDataParser:Qot,ActionFrame:Zot,BinaryDataParser:Jot,BaseFactory:$ot,BuildArmaturePackage:tat,BinaryOffset:eat,ArmatureType:iat,BoneType:nat,DisplayType:rat,BoundingBoxType:sat,ActionType:oat,BlendMode:aat,TweenType:hat,TimelineType:uat}));var gut,yut=new mn,vut=new mn,Sut=new mn,Aut=new mn,Tut=new mn,but=new mn,Eut=new mn,Cut=new mn,xut=new mn,wut=new mn;!function(t){t[t.LINE=0]="LINE",t[t.DASHED_LINE=1]="DASHED_LINE",t[t.TRIANGLE=2]="TRIANGLE"}(gut||(gut={}));var Dut=function(){function t(){this._maxVertices=0,this._vertexCount=0,this._stride=0,this._vertices=void 0,this._buffer=void 0,this._inputAssembler=void 0}var e=t.prototype;return e.init=function(t,e,i,n){this._maxVertices=e,this._vertexCount=0,this._stride=i,this._vertices=new Float32Array(e*i/Float32Array.BYTES_PER_ELEMENT),this._buffer=t.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,e*i,i)),this._inputAssembler=t.createInputAssembler(new H_(n,[this._buffer],null))},e.getCount=function(){return Math.min(this._vertexCount,this._maxVertices)},e.empty=function(){return 0===this._vertexCount},e.reset=function(){this._vertexCount=0},e.update=function(){if(!this.empty()){var t=this.getCount()*this._stride;this._buffer.update(this._vertices,t)}},e.destroy=function(){this._inputAssembler&&this._inputAssembler.destroy(),this._buffer&&this._buffer.destroy()},t}(),Rut=function(){this.lines=[],this.dashedLines=[],this.triangles=[];for(var t=0;t<2;t++)this.lines[t]=new Dut,this.dashedLines[t]=new Dut,this.triangles[t]=new Dut},Iut=t("eE",function(){function t(){this._device=null,this._buffers=void 0,this._buffers=new Rut}var e=t.prototype;return e.activate=function(t,e){this._device=t;for(var i=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA32F)],n=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_NORMAL,Ac.RGBA32F),new U_(a_.ATTR_COLOR,Ac.RGBA32F)],r=e?e.maxLines:3e4,s=e?e.maxDashedLines:1e4,o=e?e.maxTriangles:1e4,a=Float32Array.BYTES_PER_ELEMENT*(mn.length+bn.length),h=Float32Array.BYTES_PER_ELEMENT*(mn.length+ln.length+bn.length),u=0;u<2;u++)this._buffers.lines[u].init(this._device,2*r,a,i),this._buffers.dashedLines[u].init(this._device,2*s,a,i),this._buffers.triangles[u].init(this._device,3*o,h,n)},e.render=function(t,e,i){for(var n=i.geometryRendererPasses,r=i.geometryRendererShaders,s=0,o=[1,2],a=0;a<2;a++){var h=this._buffers.lines[a];if(!h.empty()){var u=new x_;u.vertexCount=h.getCount();for(var l=0;l<o[a];l++){var c=n[s+l],_=r[s+l],f=nT.getOrCreatePipelineState(this._device,c,_,t,h._inputAssembler);e.bindPipelineState(f),e.bindDescriptorSet(Jg.MATERIAL,c.descriptorSet),e.bindInputAssembler(h._inputAssembler),e.draw(u)}}s+=o[a]}for(var d=0;d<2;d++){var p=this._buffers.dashedLines[d];if(!p.empty()){var m=new x_;m.vertexCount=p.getCount();for(var g=0;g<o[d];g++){var y=n[s+g],v=r[s+g],S=nT.getOrCreatePipelineState(this._device,y,v,t,p._inputAssembler);e.bindPipelineState(S),e.bindDescriptorSet(Jg.MATERIAL,y.descriptorSet),e.bindInputAssembler(p._inputAssembler),e.draw(m)}}s+=o[d]}for(var A=0;A<2;A++){var T=this._buffers.triangles[A];if(!T.empty()){var b=new x_;b.vertexCount=T.getCount();for(var E=0;E<o[A];E++){var C=n[s+E],x=r[s+E],w=nT.getOrCreatePipelineState(this._device,C,x,t,T._inputAssembler);e.bindPipelineState(w),e.bindDescriptorSet(Jg.MATERIAL,C.descriptorSet),e.bindInputAssembler(T._inputAssembler),e.draw(b)}}s+=o[A]}this.reset()},e.destroy=function(){for(var t=0;t<2;t++)this._buffers.lines[t].destroy(),this._buffers.dashedLines[t].destroy(),this._buffers.triangles[t].destroy()},e.empty=function(){for(var t=0;t<2;t++)if(!this._buffers.lines[t].empty()||!this._buffers.dashedLines[t].empty()||!this._buffers.triangles[t].empty())return!1;return!0},e.update=function(){for(var t=0;t<2;t++)this._buffers.lines[t].update(),this._buffers.dashedLines[t].update(),this._buffers.triangles[t].update()},e.reset=function(){for(var t=0;t<2;t++)this._buffers.lines[t].reset(),this._buffers.dashedLines[t].reset(),this._buffers.triangles[t].reset()},e.addDashedLine=function(t,e,i,n){void 0===n&&(n=!0);var r=this._buffers.dashedLines[n?1:0];if(r._vertexCount+2>r._maxVertices)$(12008);else{var s=r._vertexCount*(mn.length+bn.length);mn.toArray(r._vertices,t,s),s+=mn.length,bn.toArray(r._vertices,i,s),s+=bn.length,mn.toArray(r._vertices,e,s),s+=mn.length,bn.toArray(r._vertices,i,s),r._vertexCount+=2}},e.addLine=function(t,e,i,n){void 0===n&&(n=!0);var r=this._buffers.lines[n?1:0];if(r._vertexCount+2>r._maxVertices)$(12008);else{var s=r._vertexCount*(mn.length+bn.length);mn.toArray(r._vertices,t,s),s+=mn.length,bn.toArray(r._vertices,i,s),s+=bn.length,mn.toArray(r._vertices,e,s),s+=mn.length,bn.toArray(r._vertices,i,s),r._vertexCount+=2}},e.addTriangle=function(t,e,i,n,r,s,o){if(void 0===r&&(r=!0),void 0===s&&(s=!0),void 0===o&&(o=!1),r)return this.addLine(t,e,n,s),this.addLine(e,i,n,s),void this.addLine(i,t,n,s);var a=this._buffers.triangles[s?1:0];if(a._vertexCount+3>a._maxVertices)$(12009);else{var h=new ln(ln.ZERO);if(!o){var u=new mn(e.x-t.x,e.y-t.y,e.z-t.z),l=new mn(i.x-t.x,i.y-t.y,i.z-t.z),c=new mn;mn.normalize(c,mn.cross(c,u,l)),h.set(c.x,c.y,c.z,1)}var _=a._vertexCount*(mn.length+ln.length+bn.length);mn.toArray(a._vertices,t,_),_+=mn.length,ln.toArray(a._vertices,h,_),_+=ln.length,bn.toArray(a._vertices,n,_),_+=bn.length,mn.toArray(a._vertices,e,_),_+=mn.length,ln.toArray(a._vertices,h,_),_+=ln.length,bn.toArray(a._vertices,n,_),_+=bn.length,mn.toArray(a._vertices,i,_),_+=mn.length,ln.toArray(a._vertices,h,_),_+=ln.length,bn.toArray(a._vertices,n,_),a._vertexCount+=3}},e.addQuad=function(t,e,i,n,r,s,o,a){void 0===s&&(s=!0),void 0===o&&(o=!0),void 0===a&&(a=!1),s?(this.addLine(t,e,r,o),this.addLine(e,i,r,o),this.addLine(i,n,r,o),this.addLine(n,t,r,o)):(this.addTriangle(t,e,i,r,s,o,a),this.addTriangle(t,i,n,r,s,o,a))},e.addBoundingBox=function(t,e,i,n,r,s,o){void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===o&&(o=new Vn),yut.set(t.center.x-t.halfExtents.x,t.center.y-t.halfExtents.y,t.center.z-t.halfExtents.z),vut.set(t.center.x+t.halfExtents.x,t.center.y+t.halfExtents.y,t.center.z+t.halfExtents.z),Sut.set(yut.x,yut.y,yut.z),Aut.set(vut.x,yut.y,yut.z),Tut.set(yut.x,vut.y,yut.z),but.set(vut.x,vut.y,yut.z),Eut.set(yut.x,yut.y,vut.z),Cut.set(vut.x,yut.y,vut.z),xut.set(yut.x,vut.y,vut.z),wut.set(vut.x,vut.y,vut.z),s&&(mn.transformMat4(Sut,Sut,o),mn.transformMat4(Aut,Aut,o),mn.transformMat4(Tut,Tut,o),mn.transformMat4(but,but,o),mn.transformMat4(Eut,Eut,o),mn.transformMat4(Cut,Cut,o),mn.transformMat4(xut,xut,o),mn.transformMat4(wut,wut,o)),i?(this.addLine(xut,wut,e,n),this.addLine(wut,but,e,n),this.addLine(but,Tut,e,n),this.addLine(Tut,xut,e,n),this.addLine(Eut,Cut,e,n),this.addLine(Cut,Aut,e,n),this.addLine(Aut,Sut,e,n),this.addLine(Sut,Eut,e,n),this.addLine(xut,Eut,e,n),this.addLine(wut,Cut,e,n),this.addLine(but,Aut,e,n),this.addLine(Tut,Sut,e,n)):(this.addQuad(Eut,Cut,wut,xut,e,i,n,r),this.addQuad(Cut,Aut,but,wut,e,i,n,r),this.addQuad(Aut,Sut,Tut,but,e,i,n,r),this.addQuad(Sut,Eut,xut,Tut,e,i,n,r),this.addQuad(xut,wut,but,Tut,e,i,n,r),this.addQuad(Sut,Aut,Cut,Eut,e,i,n,r))},e.addCross=function(t,e,i,n){void 0===n&&(n=!0);var r=.5*e,s=new mn(t.x-r,t.y,t.z),o=new mn(t.x+r,t.y,t.z);this.addLine(s,o,i,n),s.set(t.x,t.y-r,t.z),o.set(t.x,t.y+r,t.z),this.addLine(s,o,i,n),s.set(t.x,t.y,t.z-r),o.set(t.x,t.y,t.z+r),this.addLine(s,o,i,n)},e.addFrustum=function(t,e,i){void 0===i&&(i=!0);var n=t.vertices;this.addLine(n[0],n[1],e,i),this.addLine(n[1],n[2],e,i),this.addLine(n[2],n[3],e,i),this.addLine(n[3],n[0],e,i),this.addLine(n[4],n[5],e,i),this.addLine(n[5],n[6],e,i),this.addLine(n[6],n[7],e,i),this.addLine(n[7],n[4],e,i),this.addLine(n[0],n[4],e,i),this.addLine(n[1],n[5],e,i),this.addLine(n[2],n[6],e,i),this.addLine(n[3],n[7],e,i)},e.addCapsule=function(t,e,i,n,r,s,o,a,h,u,l){void 0===r&&(r=32),void 0===s&&(s=8),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!1),void 0===u&&(u=!1),void 0===l&&(l=Vn.IDENTITY);for(var c=2*Math.PI/r,_=Math.PI/2/s,f=new mn(t.x,t.y-i/2,t.z),d=new mn(t.x,t.y+i/2,t.z),p=new Array,m=new Array,g=0;g<s+1;g++){for(var y=new Array,v=new Array,S=g*_,A=Math.sin(S),T=Math.cos(S),b=0;b<r+1;b++){var E=b*c,C=Math.sin(E),x=Math.cos(E),w=new mn(e*A*x,e*T,e*A*C),D=new mn(f.x+w.x,f.y-w.y,f.z+w.z),R=new mn(d.x+w.x,d.y+w.y,d.z+w.z);y.push(D),v.push(R)}p.push(y),m.push(v)}if(u)for(var I=0;I<s+1;I++)for(var M=0;M<r+1;M++)mn.transformMat4(p[I][M],p[I][M],l),mn.transformMat4(m[I][M],m[I][M],l);for(var P=0;P<s;P++)for(var B=0;B<r;B++)this.addTriangle(p[P+1][B],p[P][B+1],p[P][B],n,o,a,h),this.addTriangle(p[P+1][B],p[P+1][B+1],p[P][B+1],n,o,a,h),this.addTriangle(m[P][B],m[P+1][B+1],m[P+1][B],n,o,a,h),this.addTriangle(m[P][B],m[P][B+1],m[P+1][B+1],n,o,a,h);for(var O=p[s],L=m[s],N=0;N<r;N++)this.addTriangle(L[N],O[N+1],O[N],n,o,a,h),this.addTriangle(L[N],L[N+1],O[N+1],n,o,a,h)},e.addCylinder=function(t,e,i,n,r,s,o,a,h,u){void 0===r&&(r=32),void 0===s&&(s=!0),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===h&&(h=!1),void 0===u&&(u=Vn.IDENTITY);for(var l=2*Math.PI/r,c=new mn(t.x,t.y-i/2,t.z),_=new mn(t.x,t.y+i/2,t.z),f=new Array,d=new Array,p=0;p<r+1;p++){var m=p*l,g=new mn(e*Math.cos(m),0,e*Math.sin(m)),y=new mn(g.x+c.x,g.y+c.y,g.z+c.z),v=new mn(g.x+_.x,g.y+_.y,g.z+_.z);f.push(y),d.push(v)}if(h){mn.transformMat4(c,c,u),mn.transformMat4(_,_,u);for(var S=0;S<r+1;S++)mn.transformMat4(f[S],f[S],u),mn.transformMat4(d[S],d[S],u)}for(var A=0;A<r;A++)this.addTriangle(_,d[A+1],d[A],n,s,o,a),this.addTriangle(c,f[A],f[A+1],n,s,o,a),this.addTriangle(d[A],f[A+1],f[A],n,s,o,a),this.addTriangle(d[A],d[A+1],f[A+1],n,s,o,a)},e.addCone=function(t,e,i,n,r,s,o,a,h,u){void 0===r&&(r=32),void 0===s&&(s=!0),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===h&&(h=!1),void 0===u&&(u=Vn.IDENTITY);for(var l=2*Math.PI/r,c=new mn(t.x,t.y-i/2,t.z),_=new mn(t.x,t.y+i/2,t.z),f=new Array,d=0;d<r+1;d++){var p=new mn(e*Math.cos(d*l),0,e*Math.sin(d*l)),m=new mn(p.x+c.x,p.y+c.y,p.z+c.z);f.push(m)}if(h){mn.transformMat4(c,c,u),mn.transformMat4(_,_,u);for(var g=0;g<r+1;g++)mn.transformMat4(f[g],f[g],u)}for(var y=0;y<r;y++)this.addTriangle(_,f[y+1],f[y],n,s,o,a),this.addTriangle(c,f[y],f[y+1],n,s,o,a)},e.addCircle=function(t,e,i,n,r,s,o){void 0===n&&(n=32),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===o&&(o=Vn.IDENTITY);for(var a=2*Math.PI/n,h=new Array,u=0;u<n+1;u++){var l=new mn(e*Math.cos(u*a),0,e*Math.sin(u*a)),c=new mn(l.x+t.x,l.y+t.y,l.z+t.z);h.push(c)}if(s)for(var _=0;_<n+1;_++)mn.transformMat4(h[_],h[_],o);for(var f=0;f<n;f++)this.addLine(h[f],h[f+1],i,r)},e.addArc=function(t,e,i,n,r,s,o,a,h){void 0===s&&(s=32),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===h&&(h=Vn.IDENTITY);for(var u=Vi(n),l=(Vi(r)-u)/s,c=new Array,_=0;_<s+1;_++){var f=new mn(e*Math.cos(_*l+u),0,e*Math.sin(_*l+u)),d=new mn(f.x+t.x,f.y+t.y,f.z+t.z);c.push(d)}if(a)for(var p=0;p<s+1;p++)mn.transformMat4(c[p],c[p],h);for(var m=0;m<s;m++)this.addLine(c[m],c[m+1],i,o)},e.addPolygon=function(t,e,i,n,r,s,o,a,h){void 0===n&&(n=6),void 0===r&&(r=!0),void 0===s&&(s=!0),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===h&&(h=Vn.IDENTITY),r?this.addCircle(t,e,i,n,s,a,h):this.addDisc(t,e,i,n,r,s,o,a,h)},e.addDisc=function(t,e,i,n,r,s,o,a,h){void 0===n&&(n=32),void 0===r&&(r=!0),void 0===s&&(s=!0),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===h&&(h=Vn.IDENTITY);for(var u=2*Math.PI/n,l=new Array,c=new mn(t),_=0;_<n+1;_++){var f=new mn(e*Math.cos(_*u),0,e*Math.sin(_*u)),d=new mn(f.x+c.x,f.y+c.y,f.z+c.z);l.push(d)}if(a){mn.transformMat4(c,c,h);for(var p=0;p<n+1;p++)mn.transformMat4(l[p],l[p],h)}for(var m=0;m<n;m++)this.addTriangle(c,l[m],l[m+1],i,r,s,o);if(!r)for(var g=0;g<n;g++)this.addTriangle(c,l[g+1],l[g],i,r,s,o)},e.addSector=function(t,e,i,n,r,s,o,a,h,u,l){void 0===s&&(s=32),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!1),void 0===u&&(u=!1),void 0===l&&(l=Vn.IDENTITY);for(var c=Vi(n),_=(Vi(r)-c)/s,f=new Array,d=new mn(t),p=0;p<s+1;p++){var m=new mn(e*Math.cos(p*_),0,e*Math.sin(p*_)),g=new mn(m.x+d.x,m.y+d.y,m.z+d.z);f.push(g)}if(u){mn.transformMat4(d,d,l);for(var y=0;y<s+1;y++)mn.transformMat4(f[y],f[y],l)}for(var v=0;v<s;v++)this.addTriangle(d,f[v],f[v+1],i,o,a,h);if(!o)for(var S=0;S<s;S++)this.addTriangle(d,f[S+1],f[S],i,o,a,h)},e.addSphere=function(t,e,i,n,r,s,o,a,h,u){void 0===n&&(n=32),void 0===r&&(r=16),void 0===s&&(s=!0),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===h&&(h=!1),void 0===u&&(u=Vn.IDENTITY);for(var l=2*Math.PI/n,c=Math.PI/r,_=new Array,f=0;f<r+1;f++){for(var d=new Array,p=f*c,m=Math.sin(p),g=Math.cos(p),y=0;y<n+1;y++){var v=y*l,S=Math.sin(v),A=Math.cos(v),T=new mn(e*m*A,e*g,e*m*S),b=new mn(t.x+T.x,t.y+T.y,t.z+T.z);d.push(b)}_.push(d)}if(h)for(var E=0;E<r+1;E++)for(var C=0;C<n+1;C++)mn.transformMat4(_[E][C],_[E][C],u);for(var x=0;x<r;x++)for(var w=0;w<n;w++)this.addTriangle(_[x][w],_[x+1][w+1],_[x+1][w],i,s,o,a),this.addTriangle(_[x][w],_[x][w+1],_[x+1][w+1],i,s,o,a)},e.addTorus=function(t,e,i,n,r,s,o,a,h,u,l){void 0===r&&(r=32),void 0===s&&(s=16),void 0===o&&(o=!0),void 0===a&&(a=!0),void 0===h&&(h=!1),void 0===u&&(u=!1),void 0===l&&(l=Vn.IDENTITY);for(var c=2*Math.PI/r,_=2*Math.PI/s,f=new Array,d=0;d<r+1;d++){for(var p=new Array,m=d*c,g=Math.sin(m),y=Math.cos(m),v=0;v<s+1;v++){var S=v*_,A=Math.sin(S),T=Math.cos(S),b=new mn((e+i*T)*y,i*A,(e+i*T)*g),E=new mn(t.x+b.x,t.y+b.y,t.z+b.z);p.push(E)}f.push(p)}if(u)for(var C=0;C<r+1;C++)for(var x=0;x<s+1;x++)mn.transformMat4(f[C][x],f[C][x],l);for(var w=0;w<r;w++)for(var D=0;D<s;D++)this.addTriangle(f[w][D+1],f[w+1][D],f[w][D],n,o,a,h),this.addTriangle(f[w][D+1],f[w+1][D+1],f[w+1][D],n,o,a,h)},e.addOctahedron=function(t,e,i,n,r,s,o,a){void 0===n&&(n=!0),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===o&&(o=!1),void 0===a&&(a=Vn.IDENTITY);var h=new Array;if(h.push(new mn(e+t.x,t.y,t.z)),h.push(new mn(t.x,t.y,t.z-e)),h.push(new mn(-e+t.x,t.y,t.z)),h.push(new mn(t.x,t.y,t.z+e)),h.push(new mn(t.x,t.y+e,t.z)),h.push(new mn(t.x,t.y-e,t.z)),o)for(var u=0;u<h.length;u++)mn.transformMat4(h[u],h[u],a);n?(this.addLine(h[0],h[1],i,r),this.addLine(h[1],h[2],i,r),this.addLine(h[2],h[3],i,r),this.addLine(h[3],h[0],i,r),this.addLine(h[0],h[4],i,r),this.addLine(h[1],h[4],i,r),this.addLine(h[2],h[4],i,r),this.addLine(h[3],h[4],i,r),this.addLine(h[0],h[5],i,r),this.addLine(h[1],h[5],i,r),this.addLine(h[2],h[5],i,r),this.addLine(h[3],h[5],i,r)):(this.addTriangle(h[0],h[1],h[4],i,n,r,s),this.addTriangle(h[1],h[2],h[4],i,n,r,s),this.addTriangle(h[2],h[3],h[4],i,n,r,s),this.addTriangle(h[3],h[0],h[4],i,n,r,s),this.addTriangle(h[0],h[3],h[5],i,n,r,s),this.addTriangle(h[3],h[2],h[5],i,n,r,s),this.addTriangle(h[2],h[1],h[5],i,n,r,s),this.addTriangle(h[1],h[0],h[5],i,n,r,s))},e.addBezier=function(t,e,i,n,r,s,o,a,h){void 0===s&&(s=32),void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===h&&(h=Vn.IDENTITY);var u=1/s,l=new Array,c=new mn(t),_=new mn(e),f=new mn(i),d=new mn(n);a&&(mn.transformMat4(c,c,h),mn.transformMat4(_,_,h),mn.transformMat4(f,f,h),mn.transformMat4(d,d,h));for(var p=0;p<s+1;p++){var m=p*u,g=(1-m)*(1-m)*(1-m),y=3*m*(1-m)*(1-m),v=3*m*m*(1-m),S=m*m*m,A=new mn(g*c.x+y*_.x+v*f.x+S*d.x,g*c.y+y*_.y+v*f.y+S*d.y,g*c.z+y*_.z+v*f.z+S*d.z);l.push(A)}for(var T=0;T<s;T++)this.addLine(l[T],l[T+1],r,o)},e.addSpline=function(t,e,i,n,r,s,o,a){void 0===i&&(i=4294967295),void 0===n&&(n=.5),void 0===r&&(r=32),void 0===s&&(s=!0),void 0===o&&(o=!1),void 0===a&&(a=Vn.IDENTITY);var h=r+1,u=t.getPoints(h,i);o&&u.forEach((function(t){t.transformMat4(a)}));for(var l=0;l<r;l++)this.addLine(u[l],u[l+1],e,s);if(n>0&&4294967295===i)for(var c=new bn(255-e.r,255-e.g,255-e.b,e.a),_=t.getKnotCount(),f=t.knots,d=0;d<_;d++){var p=f[d];o&&(p=p.clone().transformMat4(a)),this.addCross(p,n,c,s)}},e.addMesh=function(t,e,i,n,r,s){void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===s&&(s=Vn.IDENTITY);for(var o=0;o<e.length;o+=3){var a=new mn(t.x+e[o].x,t.y+e[o].y,t.z+e[o].z),h=new mn(t.x+e[o+1].x,t.y+e[o+1].y,t.z+e[o+1].z),u=new mn(t.x+e[o+2].x,t.y+e[o+2].y,t.z+e[o+2].z);r&&(mn.transformMat4(a,a,s),mn.transformMat4(h,h,s),mn.transformMat4(u,u,s)),this.addLine(a,h,i,n),this.addLine(h,u,i,n),this.addLine(u,a,i,n)}},e.addIndexedMesh=function(t,e,i,n,r,s,o){void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===o&&(o=Vn.IDENTITY);for(var a=0;a<i.length;a+=3){var h=new mn(t.x+e[i[a]].x,t.y+e[i[a]].y,t.z+e[i[a]].z),u=new mn(t.x+e[i[a+1]].x,t.y+e[i[a+1]].y,t.z+e[i[a+1]].z),l=new mn(t.x+e[i[a+2]].x,t.y+e[i[a+2]].y,t.z+e[i[a+2]].z);s&&(mn.transformMat4(h,h,o),mn.transformMat4(u,u,o),mn.transformMat4(l,l,o)),this.addLine(h,u,n,r),this.addLine(u,l,n,r),this.addLine(l,h,n,r)}},t}());v.internal.GeometryRenderer=Iut;var Mut,Put=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 o=0;o<i.length;++o)for(var a=i[o],h=0;h<a.count;h++)s.push({type:a.descriptorType,gpuBuffer:null,gpuTexture:null,gpuSampler:null})},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&df){var i=this._buffers[e];i&&(t[e].gpuBuffer=i.gpuBuffer||i.gpuBufferView)}else t[e].type&pf&&(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}(Bf);!function(t){t[t.RGBA16F_EXT=34842]="RGBA16F_EXT",t[t.RGB16F_EXT=34843]="RGB16F_EXT",t[t.RGBA32F_EXT=34836]="RGBA32F_EXT",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",t[t.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",t[t.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",t[t.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",t[t.SRGB_EXT=35904]="SRGB_EXT",t[t.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",t[t.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"}(Mut||(Mut={}));var But=function(){function t(){}return t.setInstance=function(e){t._instance=e},n(t,null,[{key:"instance",get:function(){return t._instance}}]),t}();function Out(t,e){switch(t){case Ac.R8:return e.UNSIGNED_BYTE;case Ac.R8SN:return e.BYTE;case Ac.R8UI:return e.UNSIGNED_BYTE;case Ac.R8I:return e.BYTE;case Ac.R16F:return Mut.HALF_FLOAT_OES;case Ac.R16UI:return e.UNSIGNED_SHORT;case Ac.R16I:return e.SHORT;case Ac.R32F:return e.FLOAT;case Ac.R32UI:return e.UNSIGNED_INT;case Ac.R32I:return e.INT;case Ac.RG8:return e.UNSIGNED_BYTE;case Ac.RG8SN:return e.BYTE;case Ac.RG8UI:return e.UNSIGNED_BYTE;case Ac.RG8I:return e.BYTE;case Ac.RG16F:return Mut.HALF_FLOAT_OES;case Ac.RG16UI:return e.UNSIGNED_SHORT;case Ac.RG16I:return e.SHORT;case Ac.RG32F:return e.FLOAT;case Ac.RG32UI:return e.UNSIGNED_INT;case Ac.RG32I:return e.INT;case Ac.RGB8:case Ac.SRGB8:return e.UNSIGNED_BYTE;case Ac.RGB8SN:return e.BYTE;case Ac.RGB8UI:return e.UNSIGNED_BYTE;case Ac.RGB8I:return e.BYTE;case Ac.RGB16F:return Mut.HALF_FLOAT_OES;case Ac.RGB16UI:return e.UNSIGNED_SHORT;case Ac.RGB16I:return e.SHORT;case Ac.RGB32F:return e.FLOAT;case Ac.RGB32UI:return e.UNSIGNED_INT;case Ac.RGB32I:return e.INT;case Ac.BGRA8:case Ac.RGBA8:case Ac.SRGB8_A8:return e.UNSIGNED_BYTE;case Ac.RGBA8SN:return e.BYTE;case Ac.RGBA8UI:return e.UNSIGNED_BYTE;case Ac.RGBA8I:return e.BYTE;case Ac.RGBA16F:return Mut.HALF_FLOAT_OES;case Ac.RGBA16UI:return e.UNSIGNED_SHORT;case Ac.RGBA16I:return e.SHORT;case Ac.RGBA32F:return e.FLOAT;case Ac.RGBA32UI:return e.UNSIGNED_INT;case Ac.RGBA32I:return e.INT;case Ac.R5G6B5:return e.UNSIGNED_SHORT_5_6_5;case Ac.R11G11B10F:return e.FLOAT;case Ac.RGB5A1:return e.UNSIGNED_SHORT_5_5_5_1;case Ac.RGBA4:return e.UNSIGNED_SHORT_4_4_4_4;case Ac.RGB10A2:return e.UNSIGNED_BYTE;case Ac.RGB10A2UI:return e.UNSIGNED_INT;case Ac.RGB9E5:return e.UNSIGNED_BYTE;case Ac.DEPTH:return e.UNSIGNED_INT;case Ac.DEPTH_STENCIL:return Mut.UNSIGNED_INT_24_8_WEBGL;case Ac.BC1:case Ac.BC1_SRGB:case Ac.BC2:case Ac.BC2_SRGB:case Ac.BC3:case Ac.BC3_SRGB:case Ac.BC4:return e.UNSIGNED_BYTE;case Ac.BC4_SNORM:return e.BYTE;case Ac.BC5:return e.UNSIGNED_BYTE;case Ac.BC5_SNORM:return e.BYTE;case Ac.BC6H_SF16:case Ac.BC6H_UF16:return e.FLOAT;case Ac.BC7:case Ac.BC7_SRGB:case Ac.ETC_RGB8:case Ac.ETC2_RGB8:case Ac.ETC2_SRGB8:case Ac.ETC2_RGB8_A1:case Ac.ETC2_SRGB8_A1:case Ac.EAC_R11:return e.UNSIGNED_BYTE;case Ac.EAC_R11SN:return e.BYTE;case Ac.EAC_RG11:return e.UNSIGNED_BYTE;case Ac.EAC_RG11SN:return e.BYTE;case Ac.PVRTC_RGB2:case Ac.PVRTC_RGBA2:case Ac.PVRTC_RGB4:case Ac.PVRTC_RGBA4:case Ac.PVRTC2_2BPP:case Ac.PVRTC2_4BPP:return e.UNSIGNED_BYTE;case Ac.ASTC_RGBA_4X4:case Ac.ASTC_RGBA_5X4:case Ac.ASTC_RGBA_5X5:case Ac.ASTC_RGBA_6X5:case Ac.ASTC_RGBA_6X6:case Ac.ASTC_RGBA_8X5:case Ac.ASTC_RGBA_8X6:case Ac.ASTC_RGBA_8X8:case Ac.ASTC_RGBA_10X5:case Ac.ASTC_RGBA_10X6:case Ac.ASTC_RGBA_10X8:case Ac.ASTC_RGBA_10X10:case Ac.ASTC_RGBA_12X10:case Ac.ASTC_RGBA_12X12:case Ac.ASTC_SRGBA_4X4:case Ac.ASTC_SRGBA_5X4:case Ac.ASTC_SRGBA_5X5:case Ac.ASTC_SRGBA_6X5:case Ac.ASTC_SRGBA_6X6:case Ac.ASTC_SRGBA_8X5:case Ac.ASTC_SRGBA_8X6:case Ac.ASTC_SRGBA_8X8:case Ac.ASTC_SRGBA_10X5:case Ac.ASTC_SRGBA_10X6:case Ac.ASTC_SRGBA_10X8:case Ac.ASTC_SRGBA_10X10:case Ac.ASTC_SRGBA_12X10:case Ac.ASTC_SRGBA_12X12:default:return e.UNSIGNED_BYTE}}function Lut(t,e){switch(t){case bc.BOOL:return e.BOOL;case bc.BOOL2:return e.BOOL_VEC2;case bc.BOOL3:return e.BOOL_VEC3;case bc.BOOL4:return e.BOOL_VEC4;case bc.INT:return e.INT;case bc.INT2:return e.INT_VEC2;case bc.INT3:return e.INT_VEC3;case bc.INT4:return e.INT_VEC4;case bc.UINT:return e.UNSIGNED_INT;case bc.FLOAT:return e.FLOAT;case bc.FLOAT2:return e.FLOAT_VEC2;case bc.FLOAT3:return e.FLOAT_VEC3;case bc.FLOAT4:return e.FLOAT_VEC4;case bc.MAT2:return e.FLOAT_MAT2;case bc.MAT3:return e.FLOAT_MAT3;case bc.MAT4:return e.FLOAT_MAT4;case bc.SAMPLER2D:return e.SAMPLER_2D;case bc.SAMPLER_CUBE:return e.SAMPLER_CUBE;default:return et(16311),bc.UNKNOWN}}function Nut(t){switch(t){case bc.BOOL:case bc.BOOL2:case bc.BOOL3:case bc.BOOL4:case bc.INT:case bc.INT2:case bc.INT3:case bc.INT4:case bc.UINT:return Int32Array;case bc.FLOAT:case bc.FLOAT2:case bc.FLOAT3:case bc.FLOAT4:case bc.MAT2:case bc.MAT3:case bc.MAT4:return Float32Array;default:return et(16312),Float32Array}}function Fut(t,e){switch(t){case e.BOOL:return bc.BOOL;case e.BOOL_VEC2:return bc.BOOL2;case e.BOOL_VEC3:return bc.BOOL3;case e.BOOL_VEC4:return bc.BOOL4;case e.INT:return bc.INT;case e.INT_VEC2:return bc.INT2;case e.INT_VEC3:return bc.INT3;case e.INT_VEC4:return bc.INT4;case e.UNSIGNED_INT:return bc.UINT;case e.FLOAT:return bc.FLOAT;case e.FLOAT_VEC2:return bc.FLOAT2;case e.FLOAT_VEC3:return bc.FLOAT3;case e.FLOAT_VEC4:return bc.FLOAT4;case e.FLOAT_MAT2:return bc.MAT2;case e.FLOAT_MAT3:return bc.MAT3;case e.FLOAT_MAT4:return bc.MAT4;case e.SAMPLER_2D:return bc.SAMPLER2D;case e.SAMPLER_CUBE:return bc.SAMPLER_CUBE;default:return et(16313),bc.UNKNOWN}}function kut(t,e){switch(t){case e.BOOL:return 4;case e.BOOL_VEC2:return 8;case e.BOOL_VEC3:return 12;case e.BOOL_VEC4:return 16;case e.INT:return 4;case e.INT_VEC2:return 8;case e.INT_VEC3:return 12;case e.INT_VEC4:return 16;case e.UNSIGNED_INT:case e.FLOAT:return 4;case e.FLOAT_VEC2:return 8;case e.FLOAT_VEC3:return 12;case e.FLOAT_VEC4:case e.FLOAT_MAT2:return 16;case e.FLOAT_MAT3:return 36;case e.FLOAT_MAT4:return 64;case e.SAMPLER_2D:case e.SAMPLER_CUBE:return 4;default:return et(16314),0}}function Vut(t,e){switch(t){case e.FLOAT_MAT2:return 2;case e.FLOAT_MAT3:return 3;case e.FLOAT_MAT4:return 4;default:return 1}}But._instance=null;var Gut,Uut=[512,513,514,515,516,517,518,519],zut=[0,7680,7681,7682,7683,5386,34055,34056],Hut=[32774,32778,32779,32775,32776],Wut=[0,1,770,772,771,773,768,774,769,775,776,32769,32770,32771,32772];!function(t){t[t.BEGIN_RENDER_PASS=0]="BEGIN_RENDER_PASS",t[t.END_RENDER_PASS=1]="END_RENDER_PASS",t[t.BIND_STATES=2]="BIND_STATES",t[t.DRAW=3]="DRAW",t[t.UPDATE_BUFFER=4]="UPDATE_BUFFER",t[t.COPY_BUFFER_TO_TEXTURE=5]="COPY_BUFFER_TO_TEXTURE",t[t.BLIT_TEXTURE=6]="BLIT_TEXTURE",t[t.COUNT=7]="COUNT"}(Gut||(Gut={}));var jut=function(t){this.refCount=0,this.cmdType=t},Xut=function(t){function e(){var e;return(e=t.call(this,Gut.BEGIN_RENDER_PASS)||this).gpuRenderPass=null,e.gpuFramebuffer=null,e.renderArea=new __,e.clearFlag=n_.NONE,e.clearColors=[],e.clearDepth=1,e.clearStencil=0,e}return s(e,t),e.prototype.clear=function(){this.gpuFramebuffer=null,this.clearColors.length=0},e}(jut),Yut=function(t){function e(){var e;return(e=t.call(this,Gut.BIND_STATES)||this).gpuPipelineState=null,e.gpuInputAssembler=null,e.gpuDescriptorSets=[],e.dynamicOffsets=[],e.dynamicStates=new cf,e}return s(e,t),e.prototype.clear=function(){this.gpuPipelineState=null,this.gpuDescriptorSets.length=0,this.gpuInputAssembler=null,this.dynamicOffsets.length=0},e}(jut),qut=function(t){function e(){var e;return(e=t.call(this,Gut.DRAW)||this).drawInfo=new x_,e}return s(e,t),e.prototype.clear=function(){},e}(jut),Kut=function(t){function e(){var e;return(e=t.call(this,Gut.UPDATE_BUFFER)||this).gpuBuffer=null,e.buffer=null,e.offset=0,e.size=0,e}return s(e,t),e.prototype.clear=function(){this.gpuBuffer=null,this.buffer=null},e}(jut),Qut=function(t){function e(){var e;return(e=t.call(this,Gut.COPY_BUFFER_TO_TEXTURE)||this).gpuTexture=null,e.buffers=[],e.regions=[],e}return s(e,t),e.prototype.clear=function(){this.gpuTexture=null,this.buffers.length=0,this.regions.length=0},e}(jut),Zut=function(t){function e(){var e;return(e=t.call(this,Gut.BLIT_TEXTURE)||this).srcTexture=null,e.dstTexture=null,e.regions=[],e.filter=Oc.LINEAR,e}return s(e,t),e.prototype.clear=function(){this.srcTexture=null,this.dstTexture=null,this.regions.length=0},e}(jut),Jut=function(){function t(){this.cmds=new Qs(1),this.beginRenderPassCmds=new Qs(1),this.bindStatesCmds=new Qs(1),this.drawCmds=new Qs(1),this.updateBufferCmds=new Qs(1),this.copyBufferToTextureCmds=new Qs(1),this.blitTextureCmds=new Qs(1)}return t.prototype.clearCmds=function(t){this.beginRenderPassCmds.length&&(t.beginRenderPassCmdPool.freeCmds(this.beginRenderPassCmds),this.beginRenderPassCmds.clear()),this.bindStatesCmds.length&&(t.bindStatesCmdPool.freeCmds(this.bindStatesCmds),this.bindStatesCmds.clear()),this.drawCmds.length&&(t.drawCmdPool.freeCmds(this.drawCmds),this.drawCmds.clear()),this.updateBufferCmds.length&&(t.updateBufferCmdPool.freeCmds(this.updateBufferCmds),this.updateBufferCmds.clear()),this.copyBufferToTextureCmds.length&&(t.copyBufferToTextureCmdPool.freeCmds(this.copyBufferToTextureCmds),this.copyBufferToTextureCmds.clear()),this.blitTextureCmds.length&&(t.blitTextureCmdPool.freeCmds(this.blitTextureCmds),this.blitTextureCmds.clear()),this.cmds.clear()},t}();function $ut(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&wc.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&Ec.VERTEX){e.glTarget=i.ARRAY_BUFFER;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),olt.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&Ec.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var o=i.createBuffer();o&&(e.glBuffer=o,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),olt.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else e.usage&Ec.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&Ec.INDIRECT||e.usage&Ec.TRANSFER_DST||e.usage&Ec.TRANSFER_SRC||et(16315),e.glTarget=i.NONE)}function tlt(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),olt.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),olt.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}function elt(t,e,i,n,r){if(e.usage&Ec.UNIFORM)ArrayBuffer.isView(i)?e.vf32.set(i,n/Float32Array.BYTES_PER_ELEMENT):e.vf32.set(new Float32Array(i),n/Float32Array.BYTES_PER_ELEMENT);else if(e.usage&Ec.INDIRECT){e.indirects.clearDraws();for(var s=i.drawInfos,o=0;o<s.length;++o)e.indirects.setDrawInfo(n+o,s[o])}else{var a=i,h=t.gl,u=t.stateCache;switch(e.glTarget){case h.ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),olt.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer);break;case h.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&u.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),u.glVAO=null),olt.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer);break;default:return void et(16316)}So.os===po.IOS&&e.memUsage&wc.HOST&&0===n&&r===a.byteLength?h.bufferData(e.glTarget,a,h.DYNAMIC_DRAW):r===a.byteLength?h.bufferSubData(e.glTarget,n,a):h.bufferSubData(e.glTarget,n,a.slice(0,r))}}function ilt(t,e){for(var i,n=t.gl,r=function(){var t=e.gpuStages[s],i=0,r="",o=1;switch(t.type){case Uc.VERTEX:r="VertexShader",i=n.VERTEX_SHADER;break;case Uc.FRAGMENT:r="FragmentShader",i=n.FRAGMENT_SHADER;break;default:return et(16322),{v:void 0}}var a=n.createShader(i);if(a&&(t.glShader=a,n.shaderSource(t.glShader,t.source),n.compileShader(t.glShader),!n.getShaderParameter(t.glShader,n.COMPILE_STATUS))){et(16323,r,e.name),et(16324,t.source.replace(/^|\n/g,(function(){return"\n"+o+++" "}))),z(n.getShaderInfoLog(t.glShader));for(var h=0;h<e.gpuStages.length;h++){var u=e.gpuStages[s];u.glShader&&(n.deleteShader(u.glShader),u.glShader=null)}return{v:void 0}}},s=0;s<e.gpuStages.length;s++)if(i=r())return i.v;var o=n.createProgram();if(o){e.glProgram=o;for(var a=0;a<e.gpuStages.length;a++){var h=e.gpuStages[a];n.attachShader(e.glProgram,h.glShader)}if(n.linkProgram(e.glProgram),t.extensions.destroyShadersImmediately)for(var u=0;u<e.gpuStages.length;u++){var l=e.gpuStages[u];l.glShader&&(n.detachShader(e.glProgram,l.glShader),n.deleteShader(l.glShader),l.glShader=null)}if(!n.getProgramParameter(e.glProgram,n.LINK_STATUS))return et(16326,e.name),void z(n.getProgramInfoLog(e.glProgram));Z(16325,e.name);var c=n.getProgramParameter(e.glProgram,n.ACTIVE_ATTRIBUTES);e.glInputs=new Array(c);for(var _=0;_<c;++_){var f=n.getActiveAttrib(e.glProgram,_);if(f){var d,p=f.name.indexOf("[");d=-1!==p?f.name.substr(0,p):f.name;var m=n.getAttribLocation(e.glProgram,d),g=Fut(f.type,n),y=kut(f.type,n);e.glInputs[_]={binding:m,name:d,type:g,stride:y,count:f.size,size:y*f.size,glType:f.type,glLoc:m}}}if(e.blocks.length>0){e.glBlocks=new Array(e.blocks.length);for(var S=0;S<e.blocks.length;++S){var A=e.blocks[S],T={set:A.set,binding:A.binding,name:A.name,size:0,glUniforms:new Array(A.members.length),glActiveUniforms:[]};e.glBlocks[S]=T;for(var b=0;b<A.members.length;++b){var E=A.members[b],C=Lut(E.type,n),x=kut(C,n),w=x*E.count;T.glUniforms[b]={binding:-1,name:E.name,type:E.type,stride:x,count:E.count,size:w,offset:0,glType:C,glLoc:null,array:null}}}}for(var D=0;D<e.subpassInputs.length;++D){var R=e.subpassInputs[D];e.samplerTextures.push(new O_(R.set,R.binding,R.name,bc.SAMPLER2D,R.count))}if(e.samplerTextures.length>0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var I=0;I<e.samplerTextures.length;++I){var M=e.samplerTextures[I];e.glSamplerTextures[I]={set:M.set,binding:M.binding,name:M.name,type:M.type,count:M.count,units:[],glUnits:null,glType:Lut(M.type,n),glLoc:null}}}for(var P=n.getProgramParameter(e.glProgram,n.ACTIVE_UNIFORMS),B=0;B<P;++B){var O=n.getActiveUniform(e.glProgram,B);if(O&&O.type!==n.SAMPLER_2D&&O.type!==n.SAMPLER_CUBE){var L=n.getUniformLocation(e.glProgram,O.name);if(t.extensions.isLocationActive(L)){var N,F=O.name.indexOf("[");N=-1!==F?O.name.substr(0,F):O.name;for(var k=0;k<e.glBlocks.length;k++)for(var V=e.glBlocks[k],G=0;G<V.glUniforms.length;G++){var U=V.glUniforms[G];if(U.name===N){U.glLoc=L,U.count=O.size,U.size=U.stride*U.count,U.array=new(Nut(U.type))(U.size/4),V.glActiveUniforms.push(U);break}}}}}for(var H=0;H<e.glBlocks.length;H++)for(var W=e.glBlocks[H],j=0;j<W.glUniforms.length;j++){var X=W.glUniforms[j];X.offset=W.size/4,W.size+=X.size}var Y=[],q=[],K=t.bindingMappings,Q=t.stateCache.texUnitCacheMap;if(v.rendering&&v.rendering.enableEffectImport)for(var J=0;J<e.samplerTextures.length;++J){var $=e.samplerTextures[J],tt=n.getUniformLocation(e.glProgram,$.name);t.extensions.isLocationActive(tt)&&(Y.push(e.glSamplerTextures[J]),q.push(tt)),void 0===Q[$.name]&&(Q[$.name]=$.flattened%t.capabilities.maxTextureUnits)}else{for(var it=0,nt=0;nt<e.blocks.length;++nt)e.blocks[nt].set===K.flexibleSet&&it++;for(var rt=0,st=0;st<e.samplerTextures.length;++st){var ot=e.samplerTextures[st],at=n.getUniformLocation(e.glProgram,ot.name);if(t.extensions.isLocationActive(at)&&(Y.push(e.glSamplerTextures[st]),q.push(at)),void 0===Q[ot.name]){var ht=ot.binding+K.samplerTextureOffsets[ot.set]+rt;ot.set===K.flexibleSet&&(ht-=it),Q[ot.name]=ht%t.capabilities.maxTextureUnits,rt+=ot.count-1}}}if(Y.length){for(var ut=[],lt=0;lt<Y.length;++lt){var ct=Y[lt],_t=Q[ct.name];if(void 0!==_t){ct.glLoc=q[lt];for(var ft=0;ft<ct.count;++ft){for(;ut[_t];)_t=(_t+1)%t.capabilities.maxTextureUnits;ct.units.push(_t),ut[_t]=!0}}}for(var dt=0,pt=0;pt<Y.length;++pt){var mt=Y[pt];if(!t.extensions.isLocationActive(mt.glLoc)){mt.glLoc=q[pt];for(var gt=0;gt<mt.count;++gt){for(;ut[dt];)dt=(dt+1)%t.capabilities.maxTextureUnits;void 0===Q[mt.name]&&(Q[mt.name]=dt),mt.units.push(dt),ut[dt]=!0}}}t.stateCache.glProgram!==e.glProgram&&n.useProgram(e.glProgram);for(var yt=0;yt<Y.length;yt++){var vt=Y[yt];vt.glUnits=new Int32Array(vt.units),n.uniform1iv(vt.glLoc,vt.glUnits)}t.stateCache.glProgram!==e.glProgram&&n.useProgram(t.stateCache.glProgram)}for(var St=0;St<e.glBlocks.length;)e.glBlocks[St].glActiveUniforms.length?St++:(e.glBlocks[St]=e.glBlocks[e.glBlocks.length-1],e.glBlocks.length--);e.glSamplerTextures=Y}}function nlt(t,e){if(e.glProgram){var i=t.gl;if(!t.extensions.destroyShadersImmediately)for(var n=0;n<e.gpuStages.length;n++){var r=e.gpuStages[n];r.glShader&&(i.detachShader(e.glProgram,r.glShader),i.deleteShader(r.glShader),r.glShader=null)}i.deleteProgram(e.glProgram),t.stateCache.glProgram===e.glProgram&&(t.gl.useProgram(null),t.stateCache.glProgram=null),e.glProgram=null}}function rlt(t,e){var i=t.gl;e.glAttribs=new Array(e.attributes.length);for(var n=[0,0,0,0,0,0,0,0],r=0;r<e.attributes.length;++r){var s=e.attributes[r],o=void 0!==s.stream?s.stream:0,a=e.gpuVertexBuffers[o],h=Out(s.format,i),u=ff[s.format].size;e.glAttribs[r]={name:s.name,glBuffer:a.glBuffer,glType:h,size:u,count:ff[s.format].count,stride:a.stride,componentCount:Vut(h,i),isNormalized:void 0!==s.isNormalized&&s.isNormalized,isInstanced:void 0!==s.isInstanced&&s.isInstanced,offset:n[o]},n[o]+=u}}function slt(t,e){for(var i=e.glVAOs.values(),n=i.next(),r=t.extensions.OES_vertex_array_object,s=t.stateCache.glVAO;!n.done;)r.deleteVertexArrayOES(n.value),s===n.value&&(r.bindVertexArrayOES(null),s=null),n=i.next();t.stateCache.glVAO=s,e.glVAOs.clear()}var olt={gpuPipelineState:null,gpuInputAssembler:null,glPrimitive:0},alt=new __;function hlt(t,e,i,n,r,s,o){var a=t.gl,h=t.stateCache,u=0;if(i&&(alt.x=n.x<<i.lodLevel,alt.y=n.y<<i.lodLevel,alt.width=n.width<<i.lodLevel,alt.height=n.height<<i.lodLevel),i&&e){h.glFramebuffer!==i.glFramebuffer&&(a.bindFramebuffer(a.FRAMEBUFFER,i.glFramebuffer),h.glFramebuffer=i.glFramebuffer),h.viewport.left===alt.x&&h.viewport.top===alt.y&&h.viewport.width===alt.width&&h.viewport.height===alt.height||(a.viewport(alt.x,alt.y,alt.width,alt.height),h.viewport.left=alt.x,h.viewport.top=alt.y,h.viewport.width=alt.width,h.viewport.height=alt.height),h.scissorRect.x===alt.x&&h.scissorRect.y===alt.y&&h.scissorRect.width===alt.width&&h.scissorRect.height===alt.height||(a.scissor(alt.x,alt.y,alt.width,alt.height),h.scissorRect.x=alt.x,h.scissorRect.y=alt.y,h.scissorRect.width=alt.width,h.scissorRect.height=alt.height);var l=r.length;t.extensions.WEBGL_draw_buffers||(l=1);for(var c=0;c<l;++c){var _=e.colorAttachments[c];if(_.format!==Ac.UNKNOWN)switch(_.loadOp){case zc.LOAD:break;case zc.CLEAR:h.bs.targets[0].blendColorMask!==Gc.ALL&&a.colorMask(!0,!0,!0,!0);var f=r[0];a.clearColor(f.x,f.y,f.z,f.w),u|=a.COLOR_BUFFER_BIT;break;case zc.DISCARD:}}if(e.depthStencilAttachment&&e.depthStencilAttachment.format!==Ac.UNKNOWN){switch(e.depthStencilAttachment.depthLoadOp){case zc.LOAD:break;case zc.CLEAR:h.dss.depthWrite||a.depthMask(!0),a.clearDepth(s),u|=a.DEPTH_BUFFER_BIT;break;case zc.DISCARD:}if(ff[e.depthStencilAttachment.format].hasStencil)switch(e.depthStencilAttachment.stencilLoadOp){case zc.LOAD:break;case zc.CLEAR:h.dss.stencilWriteMaskFront||a.stencilMaskSeparate(a.FRONT,65535),h.dss.stencilWriteMaskBack||a.stencilMaskSeparate(a.BACK,65535),a.clearStencil(o),u|=a.STENCIL_BUFFER_BIT;break;case zc.DISCARD:}}if(u&&a.clear(u),u&a.COLOR_BUFFER_BIT){var d=h.bs.targets[0].blendColorMask;if(d!==Gc.ALL){var p=(d&Gc.R)!==Gc.NONE,m=(d&Gc.G)!==Gc.NONE,g=(d&Gc.B)!==Gc.NONE,y=(d&Gc.A)!==Gc.NONE;a.colorMask(p,m,g,y)}}u&a.DEPTH_BUFFER_BIT&&!h.dss.depthWrite&&a.depthMask(!1),u&a.STENCIL_BUFFER_BIT&&(h.dss.stencilWriteMaskFront||a.stencilMaskSeparate(a.FRONT,0),h.dss.stencilWriteMaskBack||a.stencilMaskSeparate(a.BACK,0))}}function ult(t,e,i,n,r,s){var o,a,h,u=t.gl,l=t.stateCache,c=e&&e.gpuShader,_=!1;if(e&&olt.gpuPipelineState!==e){if(olt.gpuPipelineState=e,olt.glPrimitive=e.glPrimitive,e.gpuShader){var f=e.gpuShader.glProgram;l.glProgram!==f&&(u.useProgram(f),l.glProgram=f,_=!0)}var d=e.rs;if(d){if(l.rs.cullMode!==d.cullMode){switch(d.cullMode){case Qc.NONE:u.disable(u.CULL_FACE);break;case Qc.FRONT:u.enable(u.CULL_FACE),u.cullFace(u.FRONT);break;case Qc.BACK:u.enable(u.CULL_FACE),u.cullFace(u.BACK)}l.rs.cullMode=d.cullMode}var p=d.isFrontFaceCCW;l.rs.isFrontFaceCCW!==p&&(u.frontFace(p?u.CCW:u.CW),l.rs.isFrontFaceCCW=p),l.rs.depthBias===d.depthBias&&l.rs.depthBiasSlop===d.depthBiasSlop||(u.polygonOffset(d.depthBias,d.depthBiasSlop),l.rs.depthBias=d.depthBias,l.rs.depthBiasSlop=d.depthBiasSlop),l.rs.lineWidth!==d.lineWidth&&(u.lineWidth(d.lineWidth),l.rs.lineWidth=d.lineWidth)}var m=e.dss;m&&(l.dss.depthTest!==m.depthTest&&(m.depthTest?u.enable(u.DEPTH_TEST):u.disable(u.DEPTH_TEST),l.dss.depthTest=m.depthTest),l.dss.depthWrite!==m.depthWrite&&(u.depthMask(m.depthWrite),l.dss.depthWrite=m.depthWrite),l.dss.depthFunc!==m.depthFunc&&(u.depthFunc(Uut[m.depthFunc]),l.dss.depthFunc=m.depthFunc),l.dss.stencilTestFront===m.stencilTestFront&&l.dss.stencilTestBack===m.stencilTestBack||(m.stencilTestFront||m.stencilTestBack?u.enable(u.STENCIL_TEST):u.disable(u.STENCIL_TEST),l.dss.stencilTestFront=m.stencilTestFront,l.dss.stencilTestBack=m.stencilTestBack),l.dss.stencilFuncFront===m.stencilFuncFront&&l.dss.stencilRefFront===m.stencilRefFront&&l.dss.stencilReadMaskFront===m.stencilReadMaskFront||(u.stencilFuncSeparate(u.FRONT,Uut[m.stencilFuncFront],m.stencilRefFront,m.stencilReadMaskFront),l.dss.stencilFuncFront=m.stencilFuncFront,l.dss.stencilRefFront=m.stencilRefFront,l.dss.stencilReadMaskFront=m.stencilReadMaskFront),l.dss.stencilFailOpFront===m.stencilFailOpFront&&l.dss.stencilZFailOpFront===m.stencilZFailOpFront&&l.dss.stencilPassOpFront===m.stencilPassOpFront||(u.stencilOpSeparate(u.FRONT,zut[m.stencilFailOpFront],zut[m.stencilZFailOpFront],zut[m.stencilPassOpFront]),l.dss.stencilFailOpFront=m.stencilFailOpFront,l.dss.stencilZFailOpFront=m.stencilZFailOpFront,l.dss.stencilPassOpFront=m.stencilPassOpFront),l.dss.stencilWriteMaskFront!==m.stencilWriteMaskFront&&(u.stencilMaskSeparate(u.FRONT,m.stencilWriteMaskFront),l.dss.stencilWriteMaskFront=m.stencilWriteMaskFront),l.dss.stencilFuncBack===m.stencilFuncBack&&l.dss.stencilRefBack===m.stencilRefBack&&l.dss.stencilReadMaskBack===m.stencilReadMaskBack||(u.stencilFuncSeparate(u.BACK,Uut[m.stencilFuncBack],m.stencilRefBack,m.stencilReadMaskBack),l.dss.stencilFuncBack=m.stencilFuncBack,l.dss.stencilRefBack=m.stencilRefBack,l.dss.stencilReadMaskBack=m.stencilReadMaskBack),l.dss.stencilFailOpBack===m.stencilFailOpBack&&l.dss.stencilZFailOpBack===m.stencilZFailOpBack&&l.dss.stencilPassOpBack===m.stencilPassOpBack||(u.stencilOpSeparate(u.BACK,zut[m.stencilFailOpBack],zut[m.stencilZFailOpBack],zut[m.stencilPassOpBack]),l.dss.stencilFailOpBack=m.stencilFailOpBack,l.dss.stencilZFailOpBack=m.stencilZFailOpBack,l.dss.stencilPassOpBack=m.stencilPassOpBack),l.dss.stencilWriteMaskBack!==m.stencilWriteMaskBack&&(u.stencilMaskSeparate(u.BACK,m.stencilWriteMaskBack),l.dss.stencilWriteMaskBack=m.stencilWriteMaskBack));var g=e.bs;if(g){l.bs.isA2C!==g.isA2C&&(g.isA2C?u.enable(u.SAMPLE_ALPHA_TO_COVERAGE):u.disable(u.SAMPLE_ALPHA_TO_COVERAGE),l.bs.isA2C=g.isA2C),l.bs.blendColor.x===g.blendColor.x&&l.bs.blendColor.y===g.blendColor.y&&l.bs.blendColor.z===g.blendColor.z&&l.bs.blendColor.w===g.blendColor.w||(u.blendColor(g.blendColor.x,g.blendColor.y,g.blendColor.z,g.blendColor.w),l.bs.blendColor.x=g.blendColor.x,l.bs.blendColor.y=g.blendColor.y,l.bs.blendColor.z=g.blendColor.z,l.bs.blendColor.w=g.blendColor.w);var y=g.targets[0],v=l.bs.targets[0];v.blend!==y.blend&&(y.blend?u.enable(u.BLEND):u.disable(u.BLEND),v.blend=y.blend),v.blendEq===y.blendEq&&v.blendAlphaEq===y.blendAlphaEq||(u.blendEquationSeparate(Hut[y.blendEq],Hut[y.blendAlphaEq]),v.blendEq=y.blendEq,v.blendAlphaEq=y.blendAlphaEq),v.blendSrc===y.blendSrc&&v.blendDst===y.blendDst&&v.blendSrcAlpha===y.blendSrcAlpha&&v.blendDstAlpha===y.blendDstAlpha||(u.blendFuncSeparate(Wut[y.blendSrc],Wut[y.blendDst],Wut[y.blendSrcAlpha],Wut[y.blendDstAlpha]),v.blendSrc=y.blendSrc,v.blendDst=y.blendDst,v.blendSrcAlpha=y.blendSrcAlpha,v.blendDstAlpha=y.blendDstAlpha),v.blendColorMask!==y.blendColorMask&&(u.colorMask((y.blendColorMask&Gc.R)!==Gc.NONE,(y.blendColorMask&Gc.G)!==Gc.NONE,(y.blendColorMask&Gc.B)!==Gc.NONE,(y.blendColorMask&Gc.A)!==Gc.NONE),v.blendColorMask=y.blendColorMask)}}if(e&&e.gpuPipelineLayout&&c){for(var S=c.glBlocks.length,A=e.gpuPipelineLayout.dynamicOffsetIndices,T=0;T<S;T++){var b=c.glBlocks[T],E=n[b.set],C=E&&E.descriptorIndices[b.binding],x=C>=0&&E.gpuDescriptors[C],w=null,D=0;if(x&&x.gpuBuffer){var R=x.gpuBuffer,I=A[b.set],M=I&&I[b.binding];M>=0&&(D=r[M]),"vf32"in R?w=R.vf32:(D+=R.offset,w=R.gpuBuffer.vf32),D>>=2}if(w)for(var P=b.glActiveUniforms.length,B=0;B<P;B++){var O=b.glActiveUniforms[B];switch(O.glType){case u.BOOL:case u.INT:for(var L=0;L<O.array.length;++L){var N=O.offset+D+L;if(w[N]!==O.array[L]){for(var F=L,k=N;F<O.array.length;++F,++k)O.array[F]=w[k];u.uniform1iv(O.glLoc,O.array);break}}break;case u.BOOL_VEC2:case u.INT_VEC2:for(var V=0;V<O.array.length;++V){var G=O.offset+D+V;if(w[G]!==O.array[V]){for(var U=V,z=G;U<O.array.length;++U,++z)O.array[U]=w[z];u.uniform2iv(O.glLoc,O.array);break}}break;case u.BOOL_VEC3:case u.INT_VEC3:for(var H=0;H<O.array.length;++H){var W=O.offset+D+H;if(w[W]!==O.array[H]){for(var j=H,X=W;j<O.array.length;++j,++X)O.array[j]=w[X];u.uniform3iv(O.glLoc,O.array);break}}break;case u.BOOL_VEC4:case u.INT_VEC4:for(var Y=0;Y<O.array.length;++Y){var q=O.offset+D+Y;if(w[q]!==O.array[Y]){for(var K=Y,Q=q;K<O.array.length;++K,++Q)O.array[K]=w[Q];u.uniform4iv(O.glLoc,O.array);break}}break;case u.FLOAT:for(var Z=0;Z<O.array.length;++Z){var J=O.offset+D+Z;if(w[J]!==O.array[Z]){for(var $=Z,tt=J;$<O.array.length;++$,++tt)O.array[$]=w[tt];u.uniform1fv(O.glLoc,O.array);break}}break;case u.FLOAT_VEC2:for(var et=0;et<O.array.length;++et){var it=O.offset+D+et;if(w[it]!==O.array[et]){for(var nt=et,rt=it;nt<O.array.length;++nt,++rt)O.array[nt]=w[rt];u.uniform2fv(O.glLoc,O.array);break}}break;case u.FLOAT_VEC3:for(var st=0;st<O.array.length;++st){var ot=O.offset+D+st;if(w[ot]!==O.array[st]){for(var at=st,ht=ot;at<O.array.length;++at,++ht)O.array[at]=w[ht];u.uniform3fv(O.glLoc,O.array);break}}break;case u.FLOAT_VEC4:for(var ut=0;ut<O.array.length;++ut){var lt=O.offset+D+ut;if(w[lt]!==O.array[ut]){for(var ct=ut,_t=lt;ct<O.array.length;++ct,++_t)O.array[ct]=w[_t];u.uniform4fv(O.glLoc,O.array);break}}break;case u.FLOAT_MAT2:for(var ft=0;ft<O.array.length;++ft){var dt=O.offset+D+ft;if(w[dt]!==O.array[ft]){for(var pt=ft,mt=dt;pt<O.array.length;++pt,++mt)O.array[pt]=w[mt];u.uniformMatrix2fv(O.glLoc,!1,O.array);break}}break;case u.FLOAT_MAT3:for(var gt=0;gt<O.array.length;++gt){var yt=O.offset+D+gt;if(w[yt]!==O.array[gt]){for(var vt=gt,St=yt;vt<O.array.length;++vt,++St)O.array[vt]=w[St];u.uniformMatrix3fv(O.glLoc,!1,O.array);break}}break;case u.FLOAT_MAT4:for(var At=0;At<O.array.length;++At){var Tt=O.offset+D+At;if(w[Tt]!==O.array[At]){for(var bt=At,Et=Tt;bt<O.array.length;++bt,++Et)O.array[bt]=w[Et];u.uniformMatrix4fv(O.glLoc,!1,O.array);break}}}}}for(var Ct=c.glSamplerTextures.length,xt=0;xt<Ct;xt++)for(var wt=c.glSamplerTextures[xt],Dt=n[wt.set],Rt=Dt&&Dt.descriptorIndices[wt.binding],It=Rt>=0&&Dt.gpuDescriptors[Rt],Mt=wt.units.length,Pt=0;Pt<Mt;Pt++){var Bt=wt.units[Pt];if(It&&It.gpuSampler){if(It.gpuTexture&&It.gpuTexture.size>0){var Ot=It.gpuTexture,Lt=l.glTexUnits[Bt];Lt.glTexture!==Ot.glTexture&&(l.texUnit!==Bt&&(u.activeTexture(u.TEXTURE0+Bt),l.texUnit=Bt),Ot.glTexture?u.bindTexture(Ot.glTarget,Ot.glTexture):u.bindTexture(Ot.glTarget,t.nullTex2D.gpuTexture.glTexture),Lt.glTexture=Ot.glTexture);var Nt=It.gpuSampler;Ot.isPowerOf2?(o=Nt.glWrapS,a=Nt.glWrapT):(o=u.CLAMP_TO_EDGE,a=u.CLAMP_TO_EDGE),h=Ot.isPowerOf2?Ot.mipLevel<=1&&(Nt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Nt.glMinFilter===u.LINEAR_MIPMAP_LINEAR)?u.LINEAR:Nt.glMinFilter:Nt.glMinFilter===u.LINEAR||Nt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Nt.glMinFilter===u.LINEAR_MIPMAP_LINEAR?u.LINEAR:u.NEAREST,Ot.glWrapS!==o&&(l.texUnit!==Bt&&(u.activeTexture(u.TEXTURE0+Bt),l.texUnit=Bt),u.texParameteri(Ot.glTarget,u.TEXTURE_WRAP_S,o),Ot.glWrapS=o),Ot.glWrapT!==a&&(l.texUnit!==Bt&&(u.activeTexture(u.TEXTURE0+Bt),l.texUnit=Bt),u.texParameteri(Ot.glTarget,u.TEXTURE_WRAP_T,a),Ot.glWrapT=a),Ot.glMinFilter!==h&&(l.texUnit!==Bt&&(u.activeTexture(u.TEXTURE0+Bt),l.texUnit=Bt),u.texParameteri(Ot.glTarget,u.TEXTURE_MIN_FILTER,h),Ot.glMinFilter=h),Ot.glMagFilter!==Nt.glMagFilter&&(l.texUnit!==Bt&&(u.activeTexture(u.TEXTURE0+Bt),l.texUnit=Bt),u.texParameteri(Ot.glTarget,u.TEXTURE_MAG_FILTER,Nt.glMagFilter),Ot.glMagFilter=Nt.glMagFilter)}It=Dt.gpuDescriptors[++Rt]}}}if(i&&c&&(_||olt.gpuInputAssembler!==i)){olt.gpuInputAssembler=i;var Ft=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var kt=t.extensions.OES_vertex_array_object,Vt=i.glVAOs.get(c.glProgram);if(!Vt){var Gt;Vt=kt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,Vt),kt.bindVertexArrayOES(Vt),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Ut=c.glInputs.length,zt=0;zt<Ut;zt++){var Ht=c.glInputs[zt];Gt=null;for(var Wt=i.glAttribs.length,jt=0;jt<Wt;jt++){var Xt=i.glAttribs[jt];if(Xt.name===Ht.name){Gt=Xt;break}}if(Gt){l.glArrayBuffer!==Gt.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,Gt.glBuffer),l.glArrayBuffer=Gt.glBuffer);for(var Yt=0;Yt<Gt.componentCount;++Yt){var qt=Ht.glLoc+Yt,Kt=Gt.offset+Gt.size*Yt;u.enableVertexAttribArray(qt),l.glCurrentAttribLocs[qt]=!0,u.vertexAttribPointer(qt,Gt.count,Gt.glType,Gt.isNormalized,Gt.stride,Kt),Ft&&Ft.vertexAttribDivisorANGLE(qt,Gt.isInstanced?1:0)}}}var Qt=i.gpuIndexBuffer;Qt&&u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,Qt.glBuffer),kt.bindVertexArrayOES(null),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null}l.glVAO!==Vt&&(kt.bindVertexArrayOES(Vt),l.glVAO=Vt)}else{for(var Zt=0;Zt<t.capabilities.maxVertexAttributes;++Zt)l.glCurrentAttribLocs[Zt]=!1;for(var Jt=c.glInputs.length,$t=0;$t<Jt;$t++){for(var te=c.glInputs[$t],ee=null,ie=i.glAttribs.length,ne=0;ne<ie;ne++){var re=i.glAttribs[ne];if(re.name===te.name){ee=re;break}}if(ee){l.glArrayBuffer!==ee.glBuffer&&(u.bindBuffer(u.ARRAY_BUFFER,ee.glBuffer),l.glArrayBuffer=ee.glBuffer);for(var se=0;se<ee.componentCount;++se){var oe=te.glLoc+se,ae=ee.offset+ee.size*se;!l.glEnabledAttribLocs[oe]&&oe>=0&&(u.enableVertexAttribArray(oe),l.glEnabledAttribLocs[oe]=!0),l.glCurrentAttribLocs[oe]=!0,u.vertexAttribPointer(oe,ee.count,ee.glType,ee.isNormalized,ee.stride,ae),Ft&&Ft.vertexAttribDivisorANGLE(oe,ee.isInstanced?1:0)}}}var he=i.gpuIndexBuffer;he&&l.glElementArrayBuffer!==he.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,he.glBuffer),l.glElementArrayBuffer=he.glBuffer);for(var ue=0;ue<t.capabilities.maxVertexAttributes;++ue)l.glEnabledAttribLocs[ue]!==l.glCurrentAttribLocs[ue]&&(u.disableVertexAttribArray(ue),l.glEnabledAttribLocs[ue]=!1)}}if(e&&e.dynamicStates.length)for(var le=e.dynamicStates.length,ce=0;ce<le;ce++)switch(e.dynamicStates[ce]){case Zc.LINE_WIDTH:l.rs.lineWidth!==s.lineWidth&&(u.lineWidth(s.lineWidth),l.rs.lineWidth=s.lineWidth);break;case Zc.DEPTH_BIAS: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 Zc.BLEND_CONSTANTS:var _e=s.blendConstant;l.bs.blendColor.x===_e.x&&l.bs.blendColor.y===_e.y&&l.bs.blendColor.z===_e.z&&l.bs.blendColor.w===_e.w||(u.blendColor(_e.x,_e.y,_e.z,_e.w),l.bs.blendColor.copy(_e));break;case Zc.STENCIL_WRITE_MASK:var fe=s.stencilStatesFront,de=s.stencilStatesBack;l.dss.stencilWriteMaskFront!==fe.writeMask&&(u.stencilMaskSeparate(u.FRONT,fe.writeMask),l.dss.stencilWriteMaskFront=fe.writeMask),l.dss.stencilWriteMaskBack!==de.writeMask&&(u.stencilMaskSeparate(u.BACK,de.writeMask),l.dss.stencilWriteMaskBack=de.writeMask);break;case Zc.STENCIL_COMPARE_MASK:var pe=s.stencilStatesFront,me=s.stencilStatesBack;l.dss.stencilRefFront===pe.reference&&l.dss.stencilReadMaskFront===pe.compareMask||(u.stencilFuncSeparate(u.FRONT,Uut[l.dss.stencilFuncFront],pe.reference,pe.compareMask),l.dss.stencilRefFront=pe.reference,l.dss.stencilReadMaskFront=pe.compareMask),l.dss.stencilRefBack===me.reference&&l.dss.stencilReadMaskBack===me.compareMask||(u.stencilFuncSeparate(u.BACK,Uut[l.dss.stencilFuncBack],me.reference,me.compareMask),l.dss.stencilRefBack=me.reference,l.dss.stencilReadMaskBack=me.compareMask)}}function llt(t,e){var i=t.gl,n=t.extensions,r=n.ANGLE_instanced_arrays,s=n.WEBGL_multi_draw,o=olt.gpuInputAssembler,a=olt.glPrimitive;if(o){var h=o.gpuIndexBuffer;if(o.gpuIndirectBuffer){var u=o.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(a,u.counts,0,o.glIndexType,u.byteOffsets,0,u.instances,0,u.drawCount):s.multiDrawElementsWEBGL(a,u.counts,0,o.glIndexType,u.byteOffsets,0,u.drawCount);else for(var c=0;c<u.drawCount;c++)u.instances[c]&&r?r.drawElementsInstancedANGLE(a,u.counts[c],o.glIndexType,u.byteOffsets[c],u.instances[c]):i.drawElements(a,u.counts[c],o.glIndexType,u.byteOffsets[c])}else if(s)u.instancedDraw?s.multiDrawArraysInstancedWEBGL(a,u.offsets,0,u.counts,0,u.instances,0,u.drawCount):s.multiDrawArraysWEBGL(a,u.offsets,0,u.counts,0,u.drawCount);else for(var _=0;_<u.drawCount;_++)u.instances[_]&&r?r.drawArraysInstancedANGLE(a,u.offsets[_],u.counts[_],u.instances[_]):i.drawArrays(a,u.offsets[_],u.counts[_])}else if(e.instanceCount&&r)if(h){if(e.indexCount>0){var f=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(a,e.indexCount,o.glIndexType,f,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(a,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;i.drawElements(a,e.indexCount,o.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(a,e.firstVertex,e.vertexCount)}}var clt=new Array(Gut.COUNT);function _lt(t,e){clt.fill(0);for(var i=0;i<e.cmds.length;++i){var n=e.cmds.array[i],r=clt[n]++;switch(n){case Gut.BEGIN_RENDER_PASS:var s=e.beginRenderPassCmds.array[r];hlt(t,s.gpuRenderPass,s.gpuFramebuffer,s.renderArea,s.clearColors,s.clearDepth,s.clearStencil);break;case Gut.BIND_STATES:var o=e.bindStatesCmds.array[r];ult(t,o.gpuPipelineState,o.gpuInputAssembler,o.gpuDescriptorSets,o.dynamicOffsets,o.dynamicStates);break;case Gut.DRAW:llt(t,e.drawCmds.array[r].drawInfo);break;case Gut.UPDATE_BUFFER:var a=e.updateBufferCmds.array[r];elt(t,a.gpuBuffer,a.buffer,a.offset,a.size);break;case Gut.COPY_BUFFER_TO_TEXTURE:var h=e.copyBufferToTextureCmds.array[r];plt(t,h.buffers,h.gpuTexture,h.regions);break;case Gut.BLIT_TEXTURE:var u=e.blitTextureCmds.array[r];mlt(t,u.srcTexture,u.dstTexture,u.regions,u.filter)}}}var flt=new Uint8Array(1);function dlt(t,e,i,n,r){var s=bf(e).height,o=yf(e,r.width,r.height,r.depth),a=yf(e,n.width,1,1),h=yf(e,n.width,n.height,1),u=yf(e,r.width,1,1),l=Tf(ff[e]);flt.byteLength<o&&(flt=new Uint8Array(o));for(var c=0,_=i,f=0;f<r.depth;f++){_=i+h*f;for(var d=0;d<r.height;d+=s)flt.subarray(c,c+u).set(new Uint8Array(t.buffer,t.byteOffset+_,u)),c+=u,_+=a}var p=o/l.BYTES_PER_ELEMENT;return rt(Number.isInteger(p),9101),new l(flt.buffer,0,p)}function plt(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var o=0,a=0,h=ff[i.format],u=Tf(h),l=h.isCompressed,c=bf(i.format),_=new f_,f=new c_,d=new f_;switch(i.glTarget){case r.TEXTURE_2D:for(var p=0;p<n.length;p++){var m=n[p],g=m.texSubres.mipLevel;f.x=0===m.texOffset.x?0:Ef(m.texOffset.x,c.width),f.y=0===m.texOffset.y?0:Ef(m.texOffset.y,c.height),_.width=m.texExtent.width<c.width?m.texExtent.width:Ef(m.texExtent.width,c.width),_.height=m.texExtent.height<c.height?m.texExtent.width:Ef(m.texExtent.height,c.height),d.width=m.buffStride>0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,v=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,S=void 0,A=e[o++];if(d.width===_.width&&d.height===_.height){var T=yf(i.format,y,v,1)/u.BYTES_PER_ELEMENT;rt(Number.isInteger(T),9101),S=new u(A.buffer,A.byteOffset+m.buffOffset,T)}else S=dlt(A,i.format,m.buffOffset,d,_);l?i.glInternalFmt===Mut.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,v,0,S):r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,v,i.glFormat,S):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,v,i.glFormat,i.glType,S)}break;case r.TEXTURE_CUBE_MAP:for(var b=0;b<n.length;b++){var E=n[b],C=E.texSubres.mipLevel;f.x=0===E.texOffset.x?0:Ef(E.texOffset.x,c.width),f.y=0===E.texOffset.y?0:Ef(E.texOffset.y,c.height),_.width=E.texExtent.width<c.width?E.texExtent.width:Ef(E.texExtent.width,c.width),_.height=E.texExtent.height<c.height?E.texExtent.width:Ef(E.texExtent.height,c.height),d.width=E.buffStride>0?E.buffStride:_.width,d.height=E.buffTexHeight>0?E.buffTexHeight:_.height;var x=E.texExtent.width+f.x===i.width>>C?E.texExtent.width:_.width,w=E.texExtent.height+f.y===i.height>>C?E.texExtent.height:_.height,D=E.texSubres.baseArrayLayer+E.texSubres.layerCount;for(a=E.texSubres.baseArrayLayer;a<D;++a){var R=void 0,I=e[o++];if(d.width===_.width&&d.height===_.height){var M=yf(i.format,x,w,1)/u.BYTES_PER_ELEMENT;rt(Number.isInteger(M),9101),R=new u(I.buffer,I.byteOffset+E.buffOffset,M)}else R=dlt(I,i.format,E.buffOffset,d,_);l?i.glInternalFmt===Mut.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,C,i.glInternalFmt,x,w,0,R):r.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,C,f.x,f.y,x,w,i.glFormat,R):r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,C,f.x,f.y,x,w,i.glFormat,i.glType,R)}}break;default:et(16327)}i.flags&Ic.GEN_MIPMAP&&r.generateMipmap(i.glTarget)}function mlt(t,e,i,n,r){t.blitManager.draw(e,i,n,r)}var glt=function(){function t(){this.drawCount=0,this.drawByIndex=!1,this.instancedDraw=!1,this._capacity=4,this.counts=new Int32Array(this._capacity),this.offsets=new Int32Array(this._capacity),this.instances=new Int32Array(this._capacity),this.byteOffsets=new Int32Array(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=qi(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}(),ylt=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=But.instance.gl,e=But.instance.bindingMappingInfo.maxBlockCounts[0];this._gpuShader={name:"Blit Pass",blocks:[new B_(0,0,"BlitParams",[new P_("tilingOffsetSrc",bc.FLOAT4,1),new P_("tilingOffsetDst",bc.FLOAT4,1)],1)],samplerTextures:[new O_(0,e,"textureSrc",bc.SAMPLER2D,1)],subpassInputs:[],gpuStages:[{type:Uc.VERTEX,source:"\n precision mediump float;\n\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n \n uniform vec4 tilingOffsetSrc;\n uniform vec4 tilingOffsetDst;\n \n varying vec2 v_texCoord;\n \n void 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:Uc.FRAGMENT,source:"\n precision mediump float;\n uniform sampler2D textureSrc;\n\n varying vec2 v_texCoord;\n \n void main() {\n gl_FragColor = texture2D(textureSrc, v_texCoord);\n }",glShader:null}],glProgram:null,glInputs:[],glUniforms:[],glBlocks:[],glSamplerTextures:[]},ilt(But.instance,this._gpuShader),this._gpuDescriptorSetLayout={bindings:[new $_(0,$c.UNIFORM_BUFFER,1,Uc.VERTEX),new $_(e,$c.SAMPLER_TEXTURE,1,Uc.FRAGMENT)],dynamicBindings:[],descriptorIndices:[],descriptorCount:e+1};for(var i=0;i<e;i++)this._gpuDescriptorSetLayout.descriptorIndices[i]=0;this._gpuDescriptorSetLayout.descriptorIndices.push(1),this._gpuPipelineLayout={gpuSetLayouts:[this._gpuDescriptorSetLayout],dynamicOffsetCount:0,dynamicOffsetOffsets:[0],dynamicOffsetIndices:[[]]},this._gpuPipelineState={glPrimitive:t.TRIANGLE_STRIP,gpuShader:this._gpuShader,gpuPipelineLayout:this._gpuPipelineLayout,rs:null,dss:new Ff(!1,!1),bs:null,dynamicStates:[],gpuRenderPass:null},this._gpuVertexBuffer={usage:Ec.VERTEX,memUsage:wc.DEVICE,size:16*Float32Array.BYTES_PER_ELEMENT,stride:4*Float32Array.BYTES_PER_ELEMENT,buffer:null,vf32:null,indirects:new glt,glTarget:0,glBuffer:null},$ut(But.instance,this._gpuVertexBuffer),But.instance.memoryStatus.bufferSize+=this._gpuVertexBuffer.size;var n=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);elt(But.instance,this._gpuVertexBuffer,n,0,n.length),this._gpuInputAssembler={attributes:[new U_("a_position",Ac.RG32F),new U_("a_texCoord",Ac.RG32F)],gpuVertexBuffers:[this._gpuVertexBuffer],gpuIndexBuffer:null,gpuIndirectBuffer:null,glAttribs:[],glIndexType:0,glVAOs:new Map},rlt(But.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:Ec.UNIFORM,memUsage:wc.DEVICE,size:8*Float32Array.BYTES_PER_ELEMENT,stride:8*Float32Array.BYTES_PER_ELEMENT,buffer:this._uniformBuffer,vf32:null,indirects:new glt,glTarget:0,glBuffer:null},$ut(But.instance,this._gpuUniformBuffer),But.instance.memoryStatus.bufferSize+=this._gpuUniformBuffer.size,this._gpuDescriptorSet={gpuDescriptors:[{type:$c.UNIFORM_BUFFER,gpuBuffer:this._gpuUniformBuffer,gpuTexture:null,gpuSampler:null},{type:$c.SAMPLER_TEXTURE,gpuBuffer:null,gpuTexture:null,gpuSampler:null}],descriptorIndices:this._gpuDescriptorSetLayout.descriptorIndices},this._drawInfo=new x_(4,0,0,0,0,0,0),this._glFramebuffer=But.instance.gl.createFramebuffer()}var e=t.prototype;return e.destroy=function(){this._glFramebuffer&&(But.instance.gl.deleteFramebuffer(this._glFramebuffer),this._glFramebuffer=null),this._gpuVertexBuffer&&(But.instance.memoryStatus.bufferSize-=this._gpuVertexBuffer.size,tlt(But.instance,this._gpuVertexBuffer)),this._gpuUniformBuffer&&(But.instance.memoryStatus.bufferSize-=this._gpuUniformBuffer.size,tlt(But.instance,this._gpuUniformBuffer)),this._gpuShader&&nlt(But.instance,this._gpuShader),this._gpuInputAssembler&&slt(But.instance,this._gpuInputAssembler)},e.draw=function(t,e,i,n){var r=But.instance,s=r.gl,o=r.stateCache,a=o.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=n===Oc.POINT?this._gpuPointSampler:this._gpuLinearSampler;var u=ff[e.format],l=s.COLOR_ATTACHMENT0;u.hasStencil?l=s.DEPTH_STENCIL_ATTACHMENT:u.hasDepth&&(l=s.DEPTH_ATTACHMENT);var c=i.map((function(t,e){return e}));c.sort((function(t,e){return i[t].srcSubres.mipLevel-i[e].srcSubres.mipLevel})),o.glFramebuffer!==this._glFramebuffer&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,this._glFramebuffer),o.glFramebuffer=this._glFramebuffer);var _=i[0].dstSubres.mipLevel;e.glTexture?s.framebufferTexture2D(s.FRAMEBUFFER,l,e.glTarget,e.glTexture,_):s.framebufferRenderbuffer(s.FRAMEBUFFER,l,s.RENDERBUFFER,e.glRenderbuffer);for(var f=0;f<c.length;++f){var d=i[c[f]];t.glTexture&&_!==d.srcSubres.mipLevel&&(_=d.srcSubres.mipLevel,s.framebufferTexture2D(s.FRAMEBUFFER,l,e.glTarget,e.glTexture,_));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,elt(r,this._gpuUniformBuffer,this._uniformBuffer,0,this._uniformBuffer.length*Float32Array.BYTES_PER_ELEMENT),ult(r,this._gpuPipelineState,this._gpuInputAssembler,[this._gpuDescriptorSet],[],null),llt(r,this._drawInfo)}o.glFramebuffer!==a&&(r.gl.bindFramebuffer(r.gl.FRAMEBUFFER,a),o.glFramebuffer=a);var v=o.viewport;s.viewport(v.left,v.top,v.width,v.height);var S=o.scissorRect;s.scissor(S.x,S.y,S.width,S.height)}},t}(),vlt=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,this._usage&Ec.UNIFORM&&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 glt,glTarget:0,glBuffer:null},this._usage&Ec.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),$ut(But.instance,this._gpuBuffer),But.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(tlt(But.instance,this._gpuBuffer),But.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)$(16379);else{var e=this._size;e!==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&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&wc.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Ec.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),olt.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null):e.usage&Ec.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),olt.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&Ec.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&Ec.INDIRECT||e.usage&Ec.TRANSFER_DST||e.usage&Ec.TRANSFER_SRC||et(16315),e.glTarget=i.NONE)}(But.instance,this._gpuBuffer),But.instance.memoryStatus.bufferSize-=e,But.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?$(16380):(i=void 0!==e?e:this._usage&Ec.INDIRECT?0:t.byteLength,elt(But.instance,this._gpuBuffer,t,0,i))},n(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(xf),Slt=function(){function t(t,e){this._freeIdx=0,this._frees=new Array(e),this._freeCmds=new Qs(e);for(var i=0;i<e;++i)this._frees[i]=new t;this._freeIdx=e-1}var e=t.prototype;return e.alloc=function(t){if(this._freeIdx<0){var e=2*this._frees.length,i=this._frees;this._frees=new Array(e);for(var n=e-i.length,r=0;r<n;++r)this._frees[r]=new t;for(var s=n,o=0;s<e;++s,++o)this._frees[s]=i[o];this._freeIdx+=n}var a=this._frees[this._freeIdx];return this._frees[this._freeIdx--]=null,++a.refCount,a},e.free=function(t){0==--t.refCount&&this._freeCmds.push(t)},e.freeCmds=function(t){for(var e=0;e<t.length;++e)0==--t.array[e].refCount&&this._freeCmds.push(t.array[e])},e.release=function(){for(var t=0;t<this._freeCmds.length;++t){var e=this._freeCmds.array[t];e.clear(),this._frees[++this._freeIdx]=e}this._freeCmds.clear()},t}(),Alt=function(){function t(){this.beginRenderPassCmdPool=new Slt(Xut,1),this.bindStatesCmdPool=new Slt(Yut,1),this.drawCmdPool=new Slt(qut,1),this.updateBufferCmdPool=new Slt(Kut,1),this.copyBufferToTextureCmdPool=new Slt(Qut,1),this.blitTextureCmdPool=new Slt(Zut,1)}var e=t.prototype;return e.clearCmds=function(t){t.beginRenderPassCmds.length&&(this.beginRenderPassCmdPool.freeCmds(t.beginRenderPassCmds),t.beginRenderPassCmds.clear()),t.bindStatesCmds.length&&(this.bindStatesCmdPool.freeCmds(t.bindStatesCmds),t.bindStatesCmds.clear()),t.drawCmds.length&&(this.drawCmdPool.freeCmds(t.drawCmds),t.drawCmds.clear()),t.updateBufferCmds.length&&(this.updateBufferCmdPool.freeCmds(t.updateBufferCmds),t.updateBufferCmds.clear()),t.copyBufferToTextureCmds.length&&(this.copyBufferToTextureCmdPool.freeCmds(t.copyBufferToTextureCmds),t.copyBufferToTextureCmds.clear()),t.blitTextureCmds.length&&(this.blitTextureCmdPool.freeCmds(t.blitTextureCmds),t.blitTextureCmds.clear()),t.cmds.clear()},e.releaseCmds=function(){this.beginRenderPassCmdPool.release(),this.bindStatesCmdPool.release(),this.drawCmdPool.release(),this.updateBufferCmdPool.release(),this.copyBufferToTextureCmdPool.release(),this.blitTextureCmdPool.release()},t}(),Tlt=function(t){function e(){var e;return(e=t.call(this)||this).cmdPackage=new Jut,e._cmdAllocator=new Alt,e._isInRenderPass=!1,e._curGPUPipelineState=null,e._curGPUInputAssembler=null,e._curGPUDescriptorSets=[],e._curDynamicOffsets=Array(8).fill(0),e._curDynamicStates=new cf,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=But.instance.bindingMappings.blockOffsets.length,i=0;i<e;i++)this._curGPUDescriptorSets.push(null)},i.destroy=function(){this._cmdAllocator.clearCmds(this.cmdPackage)},i.begin=function(){this._cmdAllocator.clearCmds(this.cmdPackage),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(t,e,i,n,r,s){var o=this._cmdAllocator.beginRenderPassCmdPool.alloc(Xut);o.gpuRenderPass=t.gpuRenderPass,o.gpuFramebuffer=e.gpuFramebuffer,o.renderArea.copy(i),o.clearColors.length=n.length;for(var a=0;a<n.length;++a)o.clearColors[a]=n[a];o.clearDepth=r,o.clearStencil=s,this.cmdPackage.beginRenderPassCmds.push(o),this.cmdPackage.cmds.push(Gut.BEGIN_RENDER_PASS),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?void 0:r.gpuPipelineLayout;if(s){for(var o=this._curDynamicOffsets,a=s.dynamicOffsetOffsets[t],h=0;h<i.length;h++)o[a+h]=i[h];this._isStateInvalied=!0}}},i.bindInputAssembler=function(t){var e=t.gpuInputAssembler;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;t&Jc.FRONT&&i.writeMask!==e&&(i.writeMask=e,this._isStateInvalied=!0),t&Jc.BACK&&n.writeMask!==e&&(n.writeMask=e,this._isStateInvalied=!0)},i.setStencilCompareMask=function(t,e,i){var n=this._curDynamicStates.stencilStatesFront,r=this._curDynamicStates.stencilStatesBack;t&Jc.FRONT&&(n.compareMask===i&&n.reference===e||(n.reference=e,n.compareMask=i,this._isStateInvalied=!0)),t&Jc.BACK&&(r.compareMask===i&&r.reference===e||(r.reference=e,r.compareMask=i,this._isStateInvalied=!0))},i.draw=function(t){if(this._type===i_.PRIMARY&&this._isInRenderPass||this._type===i_.SECONDARY){this._isStateInvalied&&this.bindStates();var e="drawInfo"in t?t.drawInfo:t,i=this._cmdAllocator.drawCmdPool.alloc(qut);i.drawInfo.copy(e),this.cmdPackage.drawCmds.push(i),this.cmdPackage.cmds.push(Gut.DRAW),++this._numDrawCalls,this._numInstances+=e.instanceCount;var n=e.indexCount||e.vertexCount;if(this._curGPUPipelineState)switch(this._curGPUPipelineState.glPrimitive){case 4:this._numTris+=n/3*Math.max(e.instanceCount,1);break;case 5:case 6:this._numTris+=(n-2)*Math.max(e.instanceCount,1)}}else et(16328)},i.updateBuffer=function(t,e,i){if(this._type===i_.PRIMARY&&!this._isInRenderPass||this._type===i_.SECONDARY){var n=t.gpuBuffer;if(n){var r,s=this._cmdAllocator.updateBufferCmdPool.alloc(Kut),o=0;t.usage&Ec.INDIRECT||(o=void 0!==i?i:e.byteLength),r=e,s.gpuBuffer=n,s.buffer=r,s.offset=0,s.size=o,this.cmdPackage.updateBufferCmds.push(s),this.cmdPackage.cmds.push(Gut.UPDATE_BUFFER)}}else et(16329)},i.copyBuffersToTexture=function(t,e,i){if(this._type===i_.PRIMARY&&!this._isInRenderPass||this._type===i_.SECONDARY){var n=e.gpuTexture;if(n){var r=this._cmdAllocator.copyBufferToTextureCmdPool.alloc(Qut);r&&(r.gpuTexture=n,r.regions=i,r.buffers=t,this.cmdPackage.copyBufferToTextureCmds.push(r),this.cmdPackage.cmds.push(Gut.COPY_BUFFER_TO_TEXTURE))}}else et(16330)},i.execute=function(t,e){for(var i=0;i<e;++i){for(var n=t[i],r=0;r<n.cmdPackage.beginRenderPassCmds.length;++r){var s=n.cmdPackage.beginRenderPassCmds.array[r];++s.refCount,this.cmdPackage.beginRenderPassCmds.push(s)}for(var o=0;o<n.cmdPackage.bindStatesCmds.length;++o){var a=n.cmdPackage.bindStatesCmds.array[o];++a.refCount,this.cmdPackage.bindStatesCmds.push(a)}for(var h=0;h<n.cmdPackage.drawCmds.length;++h){var u=n.cmdPackage.drawCmds.array[h];++u.refCount,this.cmdPackage.drawCmds.push(u)}for(var l=0;l<n.cmdPackage.updateBufferCmds.length;++l){var c=n.cmdPackage.updateBufferCmds.array[l];++c.refCount,this.cmdPackage.updateBufferCmds.push(c)}for(var _=0;_<n.cmdPackage.copyBufferToTextureCmds.length;++_){var f=n.cmdPackage.copyBufferToTextureCmds.array[_];++f.refCount,this.cmdPackage.copyBufferToTextureCmds.push(f)}for(var d=0;d<n.cmdPackage.blitTextureCmds.length;++d){var p=n.cmdPackage.blitTextureCmds.array[d];++p.refCount,this.cmdPackage.blitTextureCmds.push(p)}this.cmdPackage.cmds.concat(n.cmdPackage.cmds.array),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.pipelineBarrier=function(){},i.bindStates=function(){var t=this._cmdAllocator.bindStatesCmdPool.alloc(Yut);t&&(t.gpuPipelineState=this._curGPUPipelineState,Array.prototype.push.apply(t.gpuDescriptorSets,this._curGPUDescriptorSets),Array.prototype.push.apply(t.dynamicOffsets,this._curDynamicOffsets),t.gpuInputAssembler=this._curGPUInputAssembler,t.dynamicStates.copy(this._curDynamicStates),this.cmdPackage.bindStatesCmds.push(t),this.cmdPackage.cmds.push(Gut.BIND_STATES),this._isStateInvalied=!1)},i.blitTexture=function(t,e,i,n){var r=this._cmdAllocator.blitTextureCmdPool.alloc(Zut);r.srcTexture=t.gpuTexture,r.dstTexture=e.gpuTexture,r.regions=i,r.filter=n,++this._numDrawCalls,this.cmdPackage.blitTextureCmds.push(r),this.cmdPackage.cmds.push(Gut.BLIT_TEXTURE)},e}(wf),blt=function(t){function e(){var e;return(e=t.call(this)||this)._gpuFramebuffer=null,e._gpuColorTextures=[],e._gpuDepthStencilTexture=void 0,e}s(e,t);var i=e.prototype;return i.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=[],o=0;o<t.colorTextures.length;++o){var a=t.colorTextures[o];a&&(s.push(a.gpuTexture),r=a.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},function(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=[],s=n.createFramebuffer();if(s){e.glFramebuffer=s,t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,e.glFramebuffer);for(var o=0;o<e.gpuColorTextures.length;++o){var a=e.gpuColorTextures[o];a&&(a.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,a.glTarget,a.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+o,n.RENDERBUFFER,a.glRenderbuffer),r.push(n.COLOR_ATTACHMENT0+o),e.width=Math.min(e.width,a.width),e.height=Math.min(e.height,a.height))}var h=e.gpuDepthStencilTexture;if(h){var u=ff[h.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;h.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,u,h.glTarget,h.glTexture,0):n.framebufferRenderbuffer(n.FRAMEBUFFER,u,n.RENDERBUFFER,h.glRenderbuffer),e.width=Math.min(e.width,h.width),e.height=Math.min(e.height,h.height)}t.extensions.WEBGL_draw_buffers&&t.extensions.WEBGL_draw_buffers.drawBuffersWEBGL(r);var l=n.checkFramebufferStatus(n.FRAMEBUFFER);if(l!==n.FRAMEBUFFER_COMPLETE)switch(l){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:et(16318);break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:et(16319);break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:et(16320);break;case n.FRAMEBUFFER_UNSUPPORTED:et(16321)}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(But.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?void 0:e.glTexture,this._width=this._gpuFramebuffer.width,this._height=this._gpuFramebuffer.height},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=But.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null,this._gpuColorTextures.length=0,this._gpuDepthStencilTexture=null)},n(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}},{key:"needRebuild",get:function(){if(this.gpuFramebuffer){for(var t,e=0;e<this.gpuFramebuffer.gpuColorTextures.length;e++)if(this.gpuFramebuffer.gpuColorTextures[e].glTexture!==this._gpuColorTextures[e])return!0;if((null===(t=this.gpuFramebuffer.gpuDepthStencilTexture)||void 0===t?void 0:t.glTexture)!==this._gpuDepthStencilTexture)return!0}return!1}}]),e}(Mf),Elt=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.gpuBuffer&&(i[n]=r.gpuBuffer)}var s=null,o=0;if(t.indexBuffer&&(s=t.indexBuffer.gpuBuffer))switch(s.stride){case 1:o=5121;break;case 2:o=5123;break;case 4:o=5125;break;default:et(16332)}var a=null;t.indirectBuffer&&(a=t.indirectBuffer.gpuBuffer),this._gpuInputAssembler={attributes:t.attributes,gpuVertexBuffers:i,gpuIndexBuffer:s,gpuIndirectBuffer:a,glAttribs:[],glIndexType:o,glVAOs:new Map},rlt(But.instance,this._gpuInputAssembler)}else et(16331)},i.destroy=function(){var t=But.instance;this._gpuInputAssembler&&t.extensions.useVAO&&slt(t,this._gpuInputAssembler),this._gpuInputAssembler=null},n(e,[{key:"gpuInputAssembler",get:function(){return this._gpuInputAssembler}}]),e}(Pf),Clt=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 o=this._descriptorIndices=Array(i+1).fill(-1),a=0;a<this._bindings.length;a++){var h=this._bindings[a];this._bindingIndices[h.binding]=a,o[h.binding]=n[a]}for(var u=[],l=0;l<this._bindings.length;l++){var c=this._bindings[l];if(c.descriptorType&mf)for(var _=0;_<c.count;_++)u.push(c.binding)}this._gpuDescriptorSetLayout={bindings:this._bindings,dynamicBindings:u,descriptorIndices:o,descriptorCount:e}},i.destroy=function(){this._bindings.length=0},n(e,[{key:"gpuDescriptorSetLayout",get:function(){return this._gpuDescriptorSetLayout}}]),e}(Of),xlt=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 o=this._setLayouts[s],a=o.gpuDescriptorSetLayout.dynamicBindings,h=Array(o.bindingIndices.length).fill(-1),u=0;u<a.length;u++){var l=a[u];h[l]<0&&(h[l]=n+u)}i.push(o.gpuDescriptorSetLayout),e.push(h),r.push(n),n+=a.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}(Lf),wlt=[0,1,3,2,0,0,0,4,5,6,0,0,0,0],Dlt=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:wlt[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}(Uf),Rlt=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){hlt(But.instance,t.gpuRenderPass,e.gpuFramebuffer,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;llt(But.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 et(16328)},i.setViewport=function(t){var e=But.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=But.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)et(16329);else{var n,r=t.gpuBuffer;r&&(n=void 0!==i?i:t.usage&Ec.INDIRECT?0:e.byteLength,elt(But.instance,r,e,0,n))}},i.copyBuffersToTexture=function(t,e,i){if(this._isInRenderPass)et(16330);else{var n=e.gpuTexture;n&&plt(But.instance,t,n,i)}},i.execute=function(t,e){for(var i=0;i<e;++i){var n=t[i];_lt(But.instance,n.cmdPackage),this._numDrawCalls+=n._numDrawCalls,this._numInstances+=n._numInstances,this._numTris+=n._numTris}},i.bindStates=function(){ult(But.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;mlt(But.instance,r,s,i,n)},e}(Tlt),Ilt=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}(zf),Mlt=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}(Hf),Plt=[10497,33648,33071,33071],Blt=function(t){function e(e,i){var n;(n=t.call(this,e,i)||this)._gpuSampler=null;var r,s,o=n._info.minFilter,a=n._info.magFilter,h=n._info.mipFilter;r=o===Oc.LINEAR||o===Oc.ANISOTROPIC?h===Oc.LINEAR||h===Oc.ANISOTROPIC?9987:h===Oc.POINT?9985:9729:h===Oc.LINEAR||h===Oc.ANISOTROPIC?9986:h===Oc.POINT?9984:9728,s=a===Oc.LINEAR||a===Oc.ANISOTROPIC?9729:9728;var u=Plt[n._info.addressU],l=Plt[n._info.addressV],c=Plt[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}(Wf),Olt=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&&(nlt(But.instance,this._gpuShader),this._gpuShader=null)},n(e,[{key:"gpuShader",get:function(){return null===this._gpuShader.glProgram&&ilt(But.instance,this._gpuShader),this._gpuShader}}]),e}(jf),Llt=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 v_,this.scissorRect=new __(0,0,0,0),this.rs=new Nf,this.dss=new Ff,this.bs=new Vf,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}(),Nlt=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=t,n=t;"texture"in t&&(i=n.texture.info,this._isTextureView=!0),this._info.copy(i),this._isPowerOf2=gf(this._info.width)&&gf(this._info.height),this._size=vf(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,this._isTextureView?(this._viewInfo.copy(n),this._lodLevel=n.baseLevel,this._gpuTexture=n.texture._gpuTexture):(this._gpuTexture={type:i.type,format:i.format,usage:i.usage,width:i.width,height:i.height,depth:i.depth,size:this._size,arrayLayer:i.layerCount,mipLevel:i.levelCount,samples:i.samples,flags:i.flags,isPowerOf2:this._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},this._gpuTexture.isSwapchainTexture||(function(t,e){var i=t.gl;e.glFormat=e.glInternalFmt=function(t,e){switch(t){case Ac.A8:return e.ALPHA;case Ac.L8:return e.LUMINANCE;case Ac.LA8:return e.LUMINANCE_ALPHA;case Ac.RGB8:case Ac.RGB16F:case Ac.RGB32F:return e.RGB;case Ac.BGRA8:case Ac.RGBA8:case Ac.SRGB8_A8:case Ac.RGBA16F:case Ac.RGBA32F:return e.RGBA;case Ac.R5G6B5:return e.RGB;case Ac.RGB5A1:case Ac.RGBA4:return e.RGBA;case Ac.DEPTH:return e.DEPTH_COMPONENT;case Ac.DEPTH_STENCIL:return e.DEPTH_STENCIL;case Ac.BC1:return Mut.COMPRESSED_RGB_S3TC_DXT1_EXT;case Ac.BC1_ALPHA:return Mut.COMPRESSED_RGBA_S3TC_DXT1_EXT;case Ac.BC1_SRGB:return Mut.COMPRESSED_SRGB_S3TC_DXT1_EXT;case Ac.BC1_SRGB_ALPHA:return Mut.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case Ac.BC2:return Mut.COMPRESSED_RGBA_S3TC_DXT3_EXT;case Ac.BC2_SRGB:return Mut.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case Ac.BC3:return Mut.COMPRESSED_RGBA_S3TC_DXT5_EXT;case Ac.BC3_SRGB:return Mut.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case Ac.ETC_RGB8:return Mut.COMPRESSED_RGB_ETC1_WEBGL;case Ac.ETC2_RGB8:return Mut.COMPRESSED_RGB8_ETC2;case Ac.ETC2_SRGB8:return Mut.COMPRESSED_SRGB8_ETC2;case Ac.ETC2_RGB8_A1:return Mut.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case Ac.ETC2_SRGB8_A1:return Mut.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;case Ac.ETC2_RGBA8:return Mut.COMPRESSED_RGBA8_ETC2_EAC;case Ac.ETC2_SRGB8_A8:return Mut.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;case Ac.EAC_R11:return Mut.COMPRESSED_R11_EAC;case Ac.EAC_R11SN:return Mut.COMPRESSED_SIGNED_R11_EAC;case Ac.EAC_RG11:return Mut.COMPRESSED_RG11_EAC;case Ac.EAC_RG11SN:return Mut.COMPRESSED_SIGNED_RG11_EAC;case Ac.PVRTC_RGB2:return Mut.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;case Ac.PVRTC_RGBA2:return Mut.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;case Ac.PVRTC_RGB4:return Mut.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;case Ac.PVRTC_RGBA4:return Mut.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;case Ac.ASTC_RGBA_4X4:return Mut.COMPRESSED_RGBA_ASTC_4x4_KHR;case Ac.ASTC_RGBA_5X4:return Mut.COMPRESSED_RGBA_ASTC_5x4_KHR;case Ac.ASTC_RGBA_5X5:return Mut.COMPRESSED_RGBA_ASTC_5x5_KHR;case Ac.ASTC_RGBA_6X5:return Mut.COMPRESSED_RGBA_ASTC_6x5_KHR;case Ac.ASTC_RGBA_6X6:return Mut.COMPRESSED_RGBA_ASTC_6x6_KHR;case Ac.ASTC_RGBA_8X5:return Mut.COMPRESSED_RGBA_ASTC_8x5_KHR;case Ac.ASTC_RGBA_8X6:return Mut.COMPRESSED_RGBA_ASTC_8x6_KHR;case Ac.ASTC_RGBA_8X8:return Mut.COMPRESSED_RGBA_ASTC_8x8_KHR;case Ac.ASTC_RGBA_10X5:return Mut.COMPRESSED_RGBA_ASTC_10x5_KHR;case Ac.ASTC_RGBA_10X6:return Mut.COMPRESSED_RGBA_ASTC_10x6_KHR;case Ac.ASTC_RGBA_10X8:return Mut.COMPRESSED_RGBA_ASTC_10x8_KHR;case Ac.ASTC_RGBA_10X10:return Mut.COMPRESSED_RGBA_ASTC_10x10_KHR;case Ac.ASTC_RGBA_12X10:return Mut.COMPRESSED_RGBA_ASTC_12x10_KHR;case Ac.ASTC_RGBA_12X12:return Mut.COMPRESSED_RGBA_ASTC_12x12_KHR;case Ac.ASTC_SRGBA_4X4:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;case Ac.ASTC_SRGBA_5X4:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;case Ac.ASTC_SRGBA_5X5:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;case Ac.ASTC_SRGBA_6X5:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;case Ac.ASTC_SRGBA_6X6:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;case Ac.ASTC_SRGBA_8X5:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;case Ac.ASTC_SRGBA_8X6:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;case Ac.ASTC_SRGBA_8X8:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;case Ac.ASTC_SRGBA_10X5:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;case Ac.ASTC_SRGBA_10X6:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;case Ac.ASTC_SRGBA_10X8:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;case Ac.ASTC_SRGBA_10X10:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;case Ac.ASTC_SRGBA_12X10:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;case Ac.ASTC_SRGBA_12X12:return Mut.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;default:return et(16310),e.RGBA}}(e.format,i),e.glType=Out(e.format,i);var n=e.width,r=e.height;switch(e.type){case Dc.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&et(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!ff[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var o=t.stateCache.glTexUnits[t.stateCache.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),o.glTexture=e.glTexture),ff[e.format].isCompressed)for(var a=0;a<e.mipLevel;++a){var h=yf(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,a,e.glInternalFmt,n,r,0,u),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var l=0;l<e.mipLevel;++l)i.texImage2D(i.TEXTURE_2D,l,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case Ac.R5G6B5:return e.RGB565;case Ac.RGB5A1:return e.RGB5_A1;case Ac.RGBA4:return e.RGBA4;case Ac.RGBA16F:return Mut.RGBA16F_EXT;case Ac.RGBA32F:return Mut.RGBA32F_EXT;case Ac.SRGB8_A8:return Mut.SRGB8_ALPHA8_EXT;case Ac.DEPTH:return e.DEPTH_COMPONENT16;case Ac.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return et(16309),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case Dc.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&et(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),ff[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d<e.mipLevel;++d){var p=yf(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,d,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var y=0;y<e.mipLevel;++y)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,y,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:et(16317),e.type=Dc.TEX2D,e.glTarget=i.TEXTURE_2D}}(But.instance,this._gpuTexture),But.instance.memoryStatus.textureSize+=this._size),this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s<n.length;s++)n[s].glTexture===e.glTexture&&(i.activeTexture(i.TEXTURE0+s),r=s,i.bindTexture(e.glTarget,null),n[s].glTexture=null);t.stateCache.texUnit=r,e.glTexture=null}if(e.glRenderbuffer){var o=t.stateCache.glRenderbuffer;i.deleteRenderbuffer(e.glRenderbuffer),o===e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,null),o=null),e.glRenderbuffer=null}}(But.instance,this._gpuTexture),But.instance.memoryStatus.textureSize-=this._size,this._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){if(this._info.width!==t||this._info.height!==i){this._info.levelCount===e.getLevelCount(this._info.width,this._info.height)?this._info.levelCount=e.getLevelCount(t,i):this._info.levelCount>1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=vf(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,this._gpuTexture.isSwapchainTexture||(function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Dc.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&et(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var o=t.stateCache.glTexUnits[t.stateCache.texUnit];if(o.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),o.glTexture=e.glTexture),ff[e.format].isCompressed)for(var a=0;a<e.mipLevel;++a){var h=yf(e.format,n,r,1),u=new Uint8Array(h);i.compressedTexImage2D(i.TEXTURE_2D,a,e.glInternalFmt,n,r,0,u),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}else for(var l=0;l<e.mipLevel;++l)i.texImage2D(i.TEXTURE_2D,l,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;case Dc.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&et(9100,c,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),ff[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d<e.mipLevel;++d){var p=yf(e.format,n,r,1),m=new Uint8Array(p);i.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+f,d,e.glInternalFmt,n,r,0,m),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var y=0;y<e.mipLevel;++y)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+g,y,e.glInternalFmt,n,r,0,e.glFormat,e.glType,null),n=Math.max(1,n>>1),r=Math.max(1,r>>1)}break;default:et(16317),e.type=Dc.TEX2D,e.glTarget=i.TEXTURE_2D}}}(But.instance,this._gpuTexture),But.instance.memoryStatus.textureSize-=n,But.instance.memoryStatus.textureSize+=this._size))}},i.initAsSwapchainTexture=function(t){var e=new R_;e.format=t.format,e.usage=ff[t.format].hasDepth?Rc.DEPTH_STENCIL_ATTACHMENT:Rc.COLOR_ATTACHMENT,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}(Xf),Flt="webglcontextlost";function klt(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 Vlt(t){var e={EXT_texture_filter_anisotropic:klt(t,"EXT_texture_filter_anisotropic"),EXT_blend_minmax:klt(t,"EXT_blend_minmax"),EXT_frag_depth:klt(t,"EXT_frag_depth"),EXT_shader_texture_lod:klt(t,"EXT_shader_texture_lod"),EXT_sRGB:klt(t,"EXT_sRGB"),OES_vertex_array_object:klt(t,"OES_vertex_array_object"),EXT_color_buffer_half_float:klt(t,"EXT_color_buffer_half_float"),WEBGL_color_buffer_float:klt(t,"WEBGL_color_buffer_float"),WEBGL_compressed_texture_etc1:klt(t,"WEBGL_compressed_texture_etc1"),WEBGL_compressed_texture_etc:klt(t,"WEBGL_compressed_texture_etc"),WEBGL_compressed_texture_pvrtc:klt(t,"WEBGL_compressed_texture_pvrtc"),WEBGL_compressed_texture_s3tc:klt(t,"WEBGL_compressed_texture_s3tc"),WEBGL_compressed_texture_s3tc_srgb:klt(t,"WEBGL_compressed_texture_s3tc_srgb"),WEBGL_debug_shaders:klt(t,"WEBGL_debug_shaders"),WEBGL_draw_buffers:klt(t,"WEBGL_draw_buffers"),WEBGL_lose_context:klt(t,"WEBGL_lose_context"),WEBGL_depth_texture:klt(t,"WEBGL_depth_texture"),OES_texture_half_float:klt(t,"OES_texture_half_float"),OES_texture_half_float_linear:klt(t,"OES_texture_half_float_linear"),OES_texture_float:klt(t,"OES_texture_float"),OES_texture_float_linear:klt(t,"OES_texture_float_linear"),OES_standard_derivatives:klt(t,"OES_standard_derivatives"),OES_element_index_uint:klt(t,"OES_element_index_uint"),ANGLE_instanced_arrays:klt(t,"ANGLE_instanced_arrays"),WEBGL_debug_renderer_info:klt(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 So.os===po.IOS&&14===So.osMainVersion&&So.isBrowser||(e.WEBGL_compressed_texture_astc=klt(t,"WEBGL_compressed_texture_astc")),So.os!==po.ANDROID&&So.os!==po.IOS&&(e.WEBGL_multi_draw=klt(t,"WEBGL_multi_draw")),So.browserType===co.UC&&(e.ANGLE_instanced_arrays=null),(So.os===po.IOS&&So.osMainVersion<=10||So.os===po.ANDROID)&&(e.destroyShadersImmediately=!1),e.isLocationActive=function(t){return!!t&&-1!==t.id},e.noCompressedTexSubImage2D=!0,e.OES_vertex_array_object&&(e.useVAO=!0),e}var Glt=function(t){function e(){var e;return(e=t.call(this)||this).stateCache=new Llt,e.cmdAllocator=new Alt,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){this._canvas=t.windowHandle,this._webGLContextLostHandler=this._onWebGLContextLost.bind(this),this._canvas.addEventListener(Flt,this._onWebGLContextLost);var e=But.instance.gl;this.stateCache.initialize(But.instance.capabilities.maxTextureUnits,But.instance.capabilities.maxVertexAttributes),this._extensions=Vlt(e),function(t){t.activeTexture(t.TEXTURE0),t.pixelStorei(t.PACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_ALIGNMENT,1),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!1),t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.frontFace(t.CCW),t.disable(t.POLYGON_OFFSET_FILL),t.polygonOffset(0,0),t.enable(t.DEPTH_TEST),t.depthMask(!0),t.depthFunc(t.LESS),t.depthRange(0,1),t.stencilFuncSeparate(t.FRONT,t.ALWAYS,1,65535),t.stencilOpSeparate(t.FRONT,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.FRONT,65535),t.stencilFuncSeparate(t.BACK,t.ALWAYS,1,65535),t.stencilOpSeparate(t.BACK,t.KEEP,t.KEEP,t.KEEP),t.stencilMaskSeparate(t.BACK,65535),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.disable(t.BLEND),t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.colorMask(!0,!0,!0,!0),t.blendColor(0,0,0,0)}(e);var i=Ac.RGBA8,n=Ac.DEPTH_STENCIL,r=e.getParameter(e.DEPTH_BITS),s=e.getParameter(e.STENCIL_BITS);r&&s?n=Ac.DEPTH_STENCIL:r&&(n=Ac.DEPTH),this._colorTexture=new Nlt,this._colorTexture.initAsSwapchainTexture({swapchain:this,format:i,width:t.width,height:t.height}),this._depthStencilTexture=new Nlt,this._depthStencilTexture.initAsSwapchainTexture({swapchain:this,format:n,width:t.width,height:t.height}),this.nullTex2D=But.instance.createTexture(new R_(Dc.TEX2D,Rc.SAMPLED,Ac.RGBA8,2,2,Ic.GEN_MIPMAP)),this.nullTexCube=But.instance.createTexture(new R_(Dc.CUBE,Rc.SAMPLED,Ac.RGBA8,2,2,Ic.GEN_MIPMAP,6));var o=new y_;o.texExtent.width=2,o.texExtent.height=2;var a=new Uint8Array(this.nullTex2D.size);a.fill(0),But.instance.copyBuffersToTexture([a],this.nullTex2D,[o]),o.texSubres.layerCount=6,But.instance.copyBuffersToTexture([a,a,a,a,a,a],this.nullTexCube,[o]),this._blitManager=new ylt},i.destroy=function(){this._canvas&&this._webGLContextLostHandler&&(this._canvas.removeEventListener(Flt,this._webGLContextLostHandler),this._webGLContextLostHandler=null),this.nullTex2D&&(this.nullTex2D.destroy(),this.nullTex2D=null),this.nullTexCube&&(this.nullTexCube.destroy(),this.nullTexCube=null),this._blitManager&&(this._blitManager.destroy(),this._blitManager=null),this._extensions=null,this._canvas=null},i.resize=function(t,e){this._colorTexture.width===t&&this._colorTexture.height===e||(W("Resizing swapchain: "+t+"x"+e),this._canvas.width=t,this._canvas.height=e,this._colorTexture.resize(t,e),this._depthStencilTexture.resize(t,e))},i._onWebGLContextLost=function(t){$(11e3),U(t)},n(e,[{key:"extensions",get:function(){return this._extensions}},{key:"blitManager",get:function(){return this._blitManager}}]),e}(If),Ult=t("eF",function(t){function e(){var e;return(e=t.call(this)||this)._swapchain=null,e._context=null,e._bindingMappings=null,e._textureExclusive=new Array(Ac.COUNT),e}s(e,t);var i=e.prototype;return i.initialize=function(t){But.setInstance(this),this._gfxAPI=yc.WEBGL;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 o=e.setIndices[s],a=e.setIndices[s-1];i[o]=e.maxBlockCounts[a]+i[a],n[o]=e.maxSamplerTextureCounts[a]+n[a]}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=function(t){var e=null;try{var i={alpha:Pe.ENABLE_TRANSPARENT_CANVAS,antialias:Pe.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}(Df.canvas);if(!l)return et(16333),!1;this._queue=this.createQueue(new of(t_.GRAPHICS)),this._cmdBuff=this.createCommandBuffer(new sf(this._queue)),this._caps.maxVertexAttributes=l.getParameter(l.MAX_VERTEX_ATTRIBS),this._caps.maxVertexUniformVectors=l.getParameter(l.MAX_VERTEX_UNIFORM_VECTORS),this._caps.maxFragmentUniformVectors=l.getParameter(l.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxTextureUnits=l.getParameter(l.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureUnits=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxTextureSize=l.getParameter(l.MAX_TEXTURE_SIZE),this._caps.maxCubeMapTextureSize=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxArrayTextureLayers=0,this._caps.max3DTextureSize=0,this._caps.maxUniformBufferBindings=16;var c=l.getSupportedExtensions(),_="";if(c)for(var d,p=f(c);!(d=p()).done;)_+=d.value+" ";var m=Vlt(l);m.WEBGL_debug_renderer_info?(this._renderer=l.getParameter(m.WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL),this._vendor=l.getParameter(m.WEBGL_debug_renderer_info.UNMASKED_VENDOR_WEBGL)):(this._renderer=l.getParameter(l.RENDERER),this._vendor=l.getParameter(l.VENDOR));var g=l.getParameter(l.VERSION);this._features.fill(!1),this.initFormatFeatures(m),m.EXT_blend_minmax&&(this._features[Sc.BLEND_MINMAX]=!0),m.OES_element_index_uint&&(this._features[Sc.ELEMENT_INDEX_UINT]=!0),m.ANGLE_instanced_arrays&&(this._features[Sc.INSTANCED_ARRAYS]=!0),m.WEBGL_draw_buffers&&(this._features[Sc.MULTIPLE_RENDER_TARGETS]=!0);var y="";return this.getFormatFeatures(Ac.ETC_RGB8)&&(y+="etc1 "),this.getFormatFeatures(Ac.ETC2_RGB8)&&(y+="etc2 "),this.getFormatFeatures(Ac.BC1)&&(y+="dxt "),this.getFormatFeatures(Ac.PVRTC_RGB2)&&(y+="pvrtc "),this.getFormatFeatures(Ac.ASTC_RGBA_4X4)&&(y+="astc "),W("WebGL device initialized."),W("RENDERER: "+this._renderer),W("VENDOR: "+this._vendor),W("VERSION: "+g),W("COMPRESSED_FORMAT: "+y),W("EXTENSIONS: "+_),!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){this._formatFeatures.fill(Mc.NONE),this._textureExclusive.fill(!0);var e=Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE|Mc.LINEAR_FILTER;this._formatFeatures[Ac.RGB8]=e,this._formatFeatures[Ac.R5G6B5]=e,this._textureExclusive[Ac.R5G6B5]=!1,this._formatFeatures[Ac.RGBA8]=e,this._formatFeatures[Ac.RGBA4]=e,this._textureExclusive[Ac.RGBA4]=!1,this._formatFeatures[Ac.RGB5A1]=e,this._textureExclusive[Ac.RGB5A1]=!1,this._formatFeatures[Ac.DEPTH]=Mc.RENDER_TARGET,this._textureExclusive[Ac.DEPTH]=!1,this._formatFeatures[Ac.DEPTH_STENCIL]=Mc.RENDER_TARGET,this._textureExclusive[Ac.DEPTH_STENCIL]=!1,this._formatFeatures[Ac.R8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RG8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGB8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGBA8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.R8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RG8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGB8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGBA8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.R8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RG8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGB8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGBA8I]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.R8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RG8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGB8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGBA8UI]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.R32F]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RG32F]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGB32F]|=Mc.VERTEX_ATTRIBUTE,this._formatFeatures[Ac.RGBA32F]|=Mc.VERTEX_ATTRIBUTE,t.EXT_sRGB&&(this._formatFeatures[Ac.SRGB8]=e,this._formatFeatures[Ac.SRGB8_A8]=e,this._textureExclusive[Ac.SRGB8_A8]=!1),t.WEBGL_depth_texture&&(this._formatFeatures[Ac.DEPTH]|=e,this._formatFeatures[Ac.DEPTH_STENCIL]|=e),t.WEBGL_color_buffer_float&&(this._formatFeatures[Ac.RGB32F]|=Mc.RENDER_TARGET,this._formatFeatures[Ac.RGBA32F]|=Mc.RENDER_TARGET,this._textureExclusive[Ac.RGB32F]=!1,this._textureExclusive[Ac.RGBA32F]=!1),t.EXT_color_buffer_half_float&&(this._formatFeatures[Ac.RGB16F]|=Mc.RENDER_TARGET,this._formatFeatures[Ac.RGBA16F]|=Mc.RENDER_TARGET,this._textureExclusive[Ac.RGB16F]=!1,this._textureExclusive[Ac.RGBA16F]=!1),t.OES_texture_float&&(this._formatFeatures[Ac.RGB32F]|=Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE,this._formatFeatures[Ac.RGBA32F]|=Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE),t.OES_texture_half_float&&(this._formatFeatures[Ac.RGB16F]|=Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE,this._formatFeatures[Ac.RGBA16F]|=Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE),t.OES_texture_float_linear&&(this._formatFeatures[Ac.RGB32F]|=Mc.LINEAR_FILTER,this._formatFeatures[Ac.RGBA32F]|=Mc.LINEAR_FILTER),t.OES_texture_half_float_linear&&(this._formatFeatures[Ac.RGB16F]|=Mc.LINEAR_FILTER,this._formatFeatures[Ac.RGBA16F]|=Mc.LINEAR_FILTER);var i=Mc.SAMPLED_TEXTURE|Mc.LINEAR_FILTER;t.WEBGL_compressed_texture_etc1&&(this._formatFeatures[Ac.ETC_RGB8]=i),t.WEBGL_compressed_texture_etc&&(this._formatFeatures[Ac.ETC2_RGB8]=i,this._formatFeatures[Ac.ETC2_RGBA8]=i,this._formatFeatures[Ac.ETC2_SRGB8]=i,this._formatFeatures[Ac.ETC2_SRGB8_A8]=i,this._formatFeatures[Ac.ETC2_RGB8_A1]=i,this._formatFeatures[Ac.ETC2_SRGB8_A1]=i),t.WEBGL_compressed_texture_s3tc&&(this._formatFeatures[Ac.BC1]=i,this._formatFeatures[Ac.BC1_ALPHA]=i,this._formatFeatures[Ac.BC1_SRGB]=i,this._formatFeatures[Ac.BC1_SRGB_ALPHA]=i,this._formatFeatures[Ac.BC2]=i,this._formatFeatures[Ac.BC2_SRGB]=i,this._formatFeatures[Ac.BC3]=i,this._formatFeatures[Ac.BC3_SRGB]=i),t.WEBGL_compressed_texture_pvrtc&&(this._formatFeatures[Ac.PVRTC_RGB2]|=i,this._formatFeatures[Ac.PVRTC_RGBA2]|=i,this._formatFeatures[Ac.PVRTC_RGB4]|=i,this._formatFeatures[Ac.PVRTC_RGBA4]|=i),t.WEBGL_compressed_texture_astc&&(this._formatFeatures[Ac.ASTC_RGBA_4X4]|=i,this._formatFeatures[Ac.ASTC_RGBA_5X4]|=i,this._formatFeatures[Ac.ASTC_RGBA_5X5]|=i,this._formatFeatures[Ac.ASTC_RGBA_6X5]|=i,this._formatFeatures[Ac.ASTC_RGBA_6X6]|=i,this._formatFeatures[Ac.ASTC_RGBA_8X5]|=i,this._formatFeatures[Ac.ASTC_RGBA_8X6]|=i,this._formatFeatures[Ac.ASTC_RGBA_8X8]|=i,this._formatFeatures[Ac.ASTC_RGBA_10X5]|=i,this._formatFeatures[Ac.ASTC_RGBA_10X6]|=i,this._formatFeatures[Ac.ASTC_RGBA_10X8]|=i,this._formatFeatures[Ac.ASTC_RGBA_10X10]|=i,this._formatFeatures[Ac.ASTC_RGBA_12X10]|=i,this._formatFeatures[Ac.ASTC_RGBA_12X12]|=i,this._formatFeatures[Ac.ASTC_SRGBA_4X4]|=i,this._formatFeatures[Ac.ASTC_SRGBA_5X4]|=i,this._formatFeatures[Ac.ASTC_SRGBA_5X5]|=i,this._formatFeatures[Ac.ASTC_SRGBA_6X5]|=i,this._formatFeatures[Ac.ASTC_SRGBA_6X6]|=i,this._formatFeatures[Ac.ASTC_SRGBA_8X5]|=i,this._formatFeatures[Ac.ASTC_SRGBA_8X6]|=i,this._formatFeatures[Ac.ASTC_SRGBA_8X8]|=i,this._formatFeatures[Ac.ASTC_SRGBA_10X5]|=i,this._formatFeatures[Ac.ASTC_SRGBA_10X6]|=i,this._formatFeatures[Ac.ASTC_SRGBA_10X8]|=i,this._formatFeatures[Ac.ASTC_SRGBA_10X10]|=i,this._formatFeatures[Ac.ASTC_SRGBA_12X10]|=i,this._formatFeatures[Ac.ASTC_SRGBA_12X12]|=i)},i.createCommandBuffer=function(t){var e=new(t.type===i_.PRIMARY?Rlt:Tlt);return e.initialize(t),e},i.createSwapchain=function(t){var e=new Glt;return this._swapchain=e,e.initialize(t),e},i.createBuffer=function(t){var e=new vlt;return e.initialize(t),e},i.createTexture=function(t){var e=new Nlt;return e.initialize(t),e},i.createDescriptorSet=function(t){var e=new Put;return e.initialize(t),e},i.createShader=function(t){var e=new Olt;return e.initialize(t),e},i.createInputAssembler=function(t){var e=new Elt;return e.initialize(t),e},i.createRenderPass=function(t){var e=new Mlt;return e.initialize(t),e},i.createFramebuffer=function(t){var e=new blt;return e.initialize(t),e},i.createDescriptorSetLayout=function(t){var e=new Clt;return e.initialize(t),e},i.createPipelineLayout=function(t){var e=new xlt;return e.initialize(t),e},i.createPipelineState=function(t){var e=new Dlt;return e.initialize(t),e},i.createQueue=function(t){var e=new Ilt;return e.initialize(t),e},i.getSampler=function(t){var e=Wf.computeHash(t);return this._samplers.has(e)||this._samplers.set(e,new Blt(t,e)),this._samplers.get(e)},i.getSwapchains=function(){return[this._swapchain]},i.getGeneralBarrier=function(t){var e=Yf.computeHash(t);return this._generalBarrierss.has(e)||this._generalBarrierss.set(e,new Yf(t,e)),this._generalBarrierss.get(e)},i.getTextureBarrier=function(t){var e=qf.computeHash(t);return this._textureBarriers.has(e)||this._textureBarriers.set(e,new qf(t,e)),this._textureBarriers.get(e)},i.getBufferBarrier=function(t){var e=Kf.computeHash(t);return this._bufferBarriers.has(e)||this._bufferBarriers.set(e,new Kf(t,e)),this._bufferBarriers.get(e)},i.copyBuffersToTexture=function(t,e,i){plt(this,t,e.gpuTexture,i)},i.copyTextureToBuffers=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache,o=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,o);var a=0,h=0,u=1,l=1;switch(e.glTarget){case r.TEXTURE_2D:for(var c=0;c<n.length;c++){var _=n[c];r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,e.glTarget,e.glTexture,_.texSubres.mipLevel),a=_.texOffset.x,h=_.texOffset.y,u=_.texExtent.width,l=_.texExtent.height,r.readPixels(a,h,u,l,e.glFormat,e.glType,i[c])}break;default:z("Unsupported GL texture type, copy texture to buffers failed.")}r.bindFramebuffer(r.FRAMEBUFFER,null),s.glFramebuffer=null,r.deleteFramebuffer(o)}(this,t.gpuTexture,e,i)},i.copyTexImagesToTexture=function(t,e,i){!function(t,e,i,n){var r=t.gl,s=t.stateCache.glTexUnits[t.stateCache.texUnit];s.glTexture!==i.glTexture&&(r.bindTexture(i.glTarget,i.glTexture),s.glTexture=i.glTexture);var o=0,a=0;switch(i.glTarget){case r.TEXTURE_2D:for(var h=0;h<n.length;h++){var u=n[h];r.texSubImage2D(r.TEXTURE_2D,u.texSubres.mipLevel,u.texOffset.x,u.texOffset.y,i.glFormat,i.glType,e[o++])}break;case r.TEXTURE_CUBE_MAP:for(var l=0;l<n.length;l++){var c=n[l],_=c.texSubres.baseArrayLayer+c.texSubres.layerCount;for(a=c.texSubres.baseArrayLayer;a<_;++a)r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+a,c.texSubres.mipLevel,c.texOffset.x,c.texOffset.y,i.glFormat,i.glType,e[o++])}break;default:et(16327)}i.flags&Ic.GEN_MIPMAP&&i.isPowerOf2&&r.generateMipmap(i.glTarget)}(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}(Df));function zlt(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),o=(n.y-i.y)*(e.x-t.x)-(n.x-i.x)*(e.y-t.y);if(0!==o){var a=r/o,h=s/o;if(a>=0&&a<=1&&h>=0&&h<=1)return!0}return!1}v.WebGLDevice=Ult;var Hlt=new jn,Wlt=new jn,jlt=new jn,Xlt=new jn;function Ylt(t,e,i){for(var n=i.length,r=0;r<n;++r)if(zlt(t,e,i[r],i[(r+1)%n]))return!0;return!1}function qlt(t,e){for(var i=!1,n=t.x,r=t.y,s=e.length,o=0,a=s-1;o<s;a=o++){var h=e[o].x,u=e[o].y,l=e[a].x,c=e[a].y;u>r!=c>r&&n<(l-h)*(r-u)/(c-u)+h&&(i=!i)}return i}function Klt(t,e,i,n){var r,s=i.x-e.x,o=i.y-e.y,a=s*s+o*o,h=((t.x-e.x)*s+(t.y-e.y)*o)/a;return r=n?a?h<0?e:h>1?i:Hlt.set(e.x+h*s,e.y+h*o):e:Hlt.set(e.x+h*s,e.y+h*o),s=t.x-r.x,o=t.y-r.y,Math.sqrt(s*s+o*o)}var Qlt=t("eG",(function(){}));Qlt.lineLine=zlt,Qlt.lineRect=function(t,e,i){var n=Hlt.set(i.x,i.y),r=Wlt.set(i.x,i.yMax),s=jlt.set(i.xMax,i.yMax),o=Xlt.set(i.xMax,i.y);return!!(zlt(t,e,n,r)||zlt(t,e,r,s)||zlt(t,e,s,o)||zlt(t,e,o,n))},Qlt.linePolygon=Ylt,Qlt.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,o=e.x,a=e.y,h=e.x+e.width,u=e.y+e.height;return i<=h&&r>=o&&n<=u&&s>=a},Qlt.rectPolygon=function(t,e){var i=Hlt.set(t.x,t.y),n=Wlt.set(t.x,t.yMax),r=jlt.set(t.xMax,t.yMax),s=Xlt.set(t.xMax,t.y);if(Ylt(i,n,e))return!0;if(Ylt(n,r,e))return!0;if(Ylt(r,s,e))return!0;if(Ylt(s,i,e))return!0;for(var o=0,a=e.length;o<a;++o)if(t.contains(e[o]))return!0;return!!(qlt(i,e)||qlt(n,e)||qlt(r,e)||qlt(s,e))},Qlt.rectCircle=function(t,e,i){var n=e.x,r=e.y,s=t.x,o=t.y,a=t.width,h=t.height,u=n,l=r;n<s?u=s:n>s+a&&(u=s+a),r<o?l=o:r>o+h&&(l=o+h);var c=n-u,_=r-l;return Math.sqrt(c*c+_*_)<=i},Qlt.polygonPolygon=function(t,e){var i,n;for(i=0,n=t.length;i<n;++i)if(Ylt(t[i],t[(i+1)%n],e))return!0;for(i=0,n=e.length;i<n;++i)if(qlt(e[i],t))return!0;for(i=0,n=t.length;i<n;++i)if(qlt(t[i],e))return!0;return!1},Qlt.circleCircle=function(t,e,i,n){return jn.distance(t,i)<e+n},Qlt.polygonCircle=function(t,e,i){var n=e;if(qlt(n,t))return!0;for(var r=0,s=t.length;r<s;r++)if(Klt(n,0===r?t[t.length-1]:t[r-1],t[r],!0)<i)return!0;return!1},Qlt.pointInPolygon=qlt,Qlt.pointLineDistance=Klt;var Zlt,Jlt,$lt,tct,ect,ict,nct,rct,sct,oct,act,hct,uct,lct,cct,_ct,fct,dct,pct,mct,gct,yct,vct,Sct,Act,Tct,bct,Ect,Cct,xct,wct,Dct,Rct,Ict,Mct=t("eH",be({UNIFORM:0,ADAPTIVE:1})),Pct=t("eI",function(){function t(){}return t.generate=function(t){switch(t.method){case Mct.UNIFORM:return this.doGenerateUniform(t);case Mct.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 mn(0,0,0),n=new mn((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 o=0;o<t.nProbesZ;o++)i.z=o*n.z+t.minPos.z,e.push(new mn(i))}}return e},t.doGenerateAdaptive=function(t){return this.doGenerateUniform(t)},t}()),Bct=Ta,Oct=Ma,Lct=new xn,Nct=new mn(0,0,0),Fct=new mn(0,0,0),kct=new mn(0,0,0),Vct=new mn(0,0,0),Gct=new mn(0,0,0),Uct=new mn(0,0,0),zct=new mn(0,0,0),Hct=t("eJ",Bct("cc.Vertex")((Jlt=function(t){this.position=$lt&&$lt(),this.normal=tct&&tct(),this.coefficients=ect&&ect(),this.position.set(t)},$lt=fa(Jlt.prototype,"position",[Oct],(function(){return new mn(0,0,0)})),tct=fa(Jlt.prototype,"normal",[Oct],(function(){return new mn(0,0,0)})),ect=fa(Jlt.prototype,"coefficients",[Oct],(function(){return[]})),Zlt=Jlt))||Zlt),Wct=(ict=function(){function t(t,e,i,n){this.tetrahedron=nct&&nct(),this.index=rct&&rct(),this.vertex0=sct&&sct(),this.vertex1=oct&&oct(),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}(),nct=fa(ict.prototype,"tetrahedron",[Oct],(function(){return-1})),rct=fa(ict.prototype,"index",[Oct],(function(){return-1})),sct=fa(ict.prototype,"vertex0",[Oct],(function(){return-1})),oct=fa(ict.prototype,"vertex1",[Oct],(function(){return-1})),ict),jct=(act=function(){function t(t,e,i,n,r,s){this.invalid=hct&&hct(),this.isOuterFace=uct&&uct(),this.tetrahedron=lct&&lct(),this.index=cct&&cct(),this.vertex0=_ct&&_ct(),this.vertex1=fct&&fct(),this.vertex2=dct&&dct(),this.vertex3=pct&&pct(),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}(),hct=fa(act.prototype,"invalid",[Oct],(function(){return!1})),uct=fa(act.prototype,"isOuterFace",[Oct],(function(){return!0})),lct=fa(act.prototype,"tetrahedron",[Oct],(function(){return-1})),cct=fa(act.prototype,"index",[Oct],(function(){return-1})),_ct=fa(act.prototype,"vertex0",[Oct],(function(){return-1})),fct=fa(act.prototype,"vertex1",[Oct],(function(){return-1})),dct=fa(act.prototype,"vertex2",[Oct],(function(){return-1})),pct=fa(act.prototype,"vertex3",[Oct],(function(){return-1})),act),Xct=t("eK",Bct("cc.CircumSphere")((gct=function(){function t(){this.center=yct&&yct(),this.radiusSquared=vct&&vct()}return t.prototype.init=function(t,e,i,n){Lct.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),Lct.invert(),Lct.transpose(),Nct.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))),mn.transformMat3(this.center,Nct,Lct),this.radiusSquared=mn.squaredDistance(t,this.center)},t}(),yct=fa(gct.prototype,"center",[Oct],(function(){return new mn(0,0,0)})),vct=fa(gct.prototype,"radiusSquared",[Oct],(function(){return 0})),mct=gct))||mct),Yct=t("eL",Bct("cc.Tetrahedron")((Act=function(){function t(t,e,i,n,r){if(void 0===r&&(r=-1),this.invalid=Tct&&Tct(),this.vertex0=bct&&bct(),this.vertex1=Ect&&Ect(),this.vertex2=Cct&&Cct(),this.vertex3=xct&&xct(),this.neighbours=wct&&wct(),this.matrix=Dct&&Dct(),this.offset=Rct&&Rct(),this.sphere=Ict&&Ict(),this.vertex0=e,this.vertex1=i,this.vertex2=n,this.vertex3=r,r>=0){var s=t._probes,o=s[this.vertex0].position,a=s[this.vertex1].position,h=s[this.vertex2].position,u=s[this.vertex3].position;this.sphere.init(o,a,h,u)}}var e=t.prototype;return e.isInCircumSphere=function(t){return mn.squaredDistance(t,this.sphere.center)<this.sphere.radiusSquared-Bi},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}(),Tct=fa(Act.prototype,"invalid",[Oct],(function(){return!1})),bct=fa(Act.prototype,"vertex0",[Oct],(function(){return-1})),Ect=fa(Act.prototype,"vertex1",[Oct],(function(){return-1})),Cct=fa(Act.prototype,"vertex2",[Oct],(function(){return-1})),xct=fa(Act.prototype,"vertex3",[Oct],(function(){return-1})),wct=fa(Act.prototype,"neighbours",[Oct],(function(){return[-1,-1,-1,-1]})),Dct=fa(Act.prototype,"matrix",[Oct],(function(){return new xn})),Rct=fa(Act.prototype,"offset",[Oct],(function(){return new mn(0,0,0)})),Ict=fa(Act.prototype,"sphere",[Oct],(function(){return new Xct})),Sct=Act))||Sct),qct=t("eM",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 mn(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),e=new mn(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 mn(0,0,0);mn.add(r,t,e),mn.multiplyScalar(r,r,.5);var s=new mn(0,0,0);mn.subtract(s,e,t);var o=10*Math.max(s.x,s.y,s.z),a=new mn(r.x,r.y+o,r.z),h=new mn(r.x-o,r.y-o,r.z-o),u=new mn(r.x-o,r.y-o,r.z+o),l=new mn(r.x+o,r.y-o,r.z),c=this._probes.length;return this._probes.push(new Hct(a)),this._probes.push(new Hct(h)),this._probes.push(new Hct(u)),this._probes.push(new Hct(l)),this._tetrahedrons.push(new Yct(this,c,c+1,c+2,c+3)),r},e.addTriangle=function(t,e,i,n,r,s,o){t<this._triangles.length?this._triangles[t].set(e,i,n,r,s,o):this._triangles.push(new jct(e,i,n,r,s,o))},e.addEdge=function(t,e,i,n,r){t<this._edges.length?this._edges[t].set(e,i,n,r):this._edges.push(new Wct(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 o=s+1;o<i;o++)if(this._triangles[s].isSame(this._triangles[o])){this._triangles[s].invalid=!0,this._triangles[o].invalid=!0;break}this._tetrahedrons=this._tetrahedrons.filter((function(t){return!t.invalid}));for(var a=0;a<i;a++){var h=this._triangles[a];h.invalid||this._tetrahedrons.push(new Yct(this,h.vertex0,h.vertex1,h.vertex2,t))}},e.reorder=function(t){this._tetrahedrons.sort((function(e,i){return mn.squaredDistance(e.sphere.center,t)-mn.squaredDistance(i.sphere.center,t)}))},e.computeAdjacency=function(){for(var t=new mn(0,0,0),e=new mn(0,0,0),i=new mn(0,0,0),n=new mn(0,0,0),r=this._tetrahedrons.length,s=0,o=0;o<this._tetrahedrons.length;o++){var a=this._tetrahedrons[o];this.addTriangle(s,o,0,a.vertex1,a.vertex3,a.vertex2,a.vertex0),this.addTriangle(s+1,o,1,a.vertex0,a.vertex2,a.vertex3,a.vertex1),this.addTriangle(s+2,o,2,a.vertex0,a.vertex3,a.vertex1,a.vertex2),this.addTriangle(s+3,o,3,a.vertex0,a.vertex1,a.vertex2,a.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],_=this._probes[this._triangles[h].vertex2],f=this._probes[this._triangles[h].vertex3];mn.subtract(e,c.position,l.position),mn.subtract(i,_.position,l.position),mn.cross(t,e,i),mn.subtract(n,f.position,l.position);var d=mn.dot(t,n);d>0&&mn.negate(t,t),mn.add(l.normal,l.normal,t),mn.add(c.normal,c.normal,t),mn.add(_.normal,_.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 Yct(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,S=r;S<this._tetrahedrons.length;S++){var A=this._tetrahedrons[S];this.addEdge(v,S,0,A.vertex1,A.vertex2),this.addEdge(v+1,S,1,A.vertex2,A.vertex0),this.addEdge(v+2,S,2,A.vertex0,A.vertex1),v+=3}for(var T=0;T<v;T++)for(var b=T+1;b<v;b++)this._edges[T].isSame(this._edges[b])&&(this._tetrahedrons[this._edges[T].tetrahedron].neighbours[this._edges[T].index]=this._edges[b].tetrahedron,this._tetrahedrons[this._edges[b].tetrahedron].neighbours[this._edges[b].index]=this._edges[T].tetrahedron);for(var E=0;E<this._probes.length;E++)this._probes[E].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,mn.subtract(Fct,i[0],i[2]),mn.subtract(kct,e[0],e[2]),mn.subtract(Vct,i[1],i[2]),mn.subtract(Gct,e[1],e[2]),Uct.set(i[2]),mn.negate(zct,e[2]);var n=[];n[0]=kct.y*Gct.z-kct.z*Gct.y,n[3]=-kct.x*Gct.z+kct.z*Gct.x,n[6]=kct.x*Gct.y-kct.y*Gct.x,n[9]=Fct.x*Gct.y*zct.z-Fct.y*Gct.x*zct.z+kct.x*Vct.y*zct.z-kct.y*Vct.x*zct.z+Fct.z*Gct.x*zct.y-Fct.z*Gct.y*zct.x+kct.z*Vct.x*zct.y-kct.z*Vct.y*zct.x-Fct.x*Gct.z*zct.y+Fct.y*Gct.z*zct.x-kct.x*Vct.z*zct.y+kct.y*Vct.z*zct.x,n[9]-=Uct.x*n[0]+Uct.y*n[3]+Uct.z*n[6],n[1]=kct.y*Vct.z+Fct.y*Gct.z-kct.z*Vct.y-Fct.z*Gct.y,n[4]=-Fct.x*Gct.z-kct.x*Vct.z+Fct.z*Gct.x+kct.z*Vct.x,n[7]=Fct.x*Gct.y-Fct.y*Gct.x+kct.x*Vct.y-kct.y*Vct.x,n[10]=Fct.x*Vct.y*zct.z-Fct.y*Vct.x*zct.z-Fct.x*Vct.z*zct.y+Fct.y*Vct.z*zct.x+Fct.z*Vct.x*zct.y-Fct.z*Vct.y*zct.x,n[10]-=Uct.x*n[1]+Uct.y*n[4]+Uct.z*n[7],n[2]=-Fct.z*Vct.y+Fct.y*Vct.z,n[5]=-Fct.x*Vct.z+Fct.z*Vct.x,n[8]=Fct.x*Vct.y-Fct.y*Vct.x,n[11]=0,n[11]-=Uct.x*n[2]+Uct.y*n[5]+Uct.z*n[8];var r=kct.x*Gct.y*zct.z-kct.y*Gct.x*zct.z+kct.z*Gct.x*zct.y-kct.z*Gct.y*zct.x+kct.y*Gct.z*zct.x-kct.x*Gct.z*zct.y;if(Math.abs(r)>Bi)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}()),Kct=t("eN",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),o=n*Math.sin(r);return new mn(s,o,i)},t.uniformSampleSphereAll=function(t){for(var e=Math.floor(Math.sqrt(t)),i=e,n=[],r=1/e,s=1/i,o=0;o<e;o++)for(var a=(o+.5)*r,h=0;h<i;h++){var u=(h+.5)*s,l=this.uniformSampleSphere(a,u);n.push(l)}return n},t.uniformSpherePdf=function(){return 1/(4*Math.PI)},t}()),Qct=t("eO",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 ln(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 ln(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 ln(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 ln(e[4].x*this.basisOverPI[4],e[5].x*this.basisOverPI[5],e[6].x*this.basisOverPI[6],e[7].x*this.basisOverPI[7]),o=new ln(e[4].y*this.basisOverPI[4],e[5].y*this.basisOverPI[5],e[6].y*this.basisOverPI[6],e[7].y*this.basisOverPI[7]),a=new ln(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 mn(e[8].x*this.basisOverPI[8],e[8].y*this.basisOverPI[8],e[8].z*this.basisOverPI[8]),u=new mn(0,0,0),l=new ln(t.x,t.y,t.z,1);u.x=ln.dot(i,l),u.y=ln.dot(n,l),u.z=ln.dot(r,l);var c=new ln(t.x*t.y,t.y*t.z,t.z*t.z,t.z*t.x),_=t.x*t.x-t.y*t.y;return u.x+=ln.dot(s,c),u.y+=ln.dot(o,c),u.z+=ln.dot(a,c),mn.scaleAndAdd(u,u,h,_),u},t.evaluate=function(t,e){for(var i=new mn(0,0,0),n=e.length,r=0;r<n;r++){var s=e[r];mn.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/(Kct.uniformSpherePdf()*n),s=[],o=0;o<i;o++){for(var a=new mn(0,0,0),h=0;h<n;h++)mn.scaleAndAdd(a,a,e[h],this.evaluateBasis(o,t[h]));mn.multiplyScalar(a,a,r),s.push(a)}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),o=new mn(0,0,0);mn.multiplyScalar(o,t[s],this.lambda(n)*e[n]),i.push(o)}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);mn.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}());Qct.LMAX=2,Qct.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)}],Qct.basisOverPI=[.0897936,.155527,.155527,.155527,.347769,.347769,.301177,.347769,.173884],v.internal.SH=Qct;var Zct,Jct,$ct,t_t,e_t,i_t,n_t,r_t=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,o=i/2+t*t*t/27-t*e/6,a=s*s*s+o*o;if(a>0){var h=Math.sqrt(a);n.push(Math.cbrt(-o+h)+Math.cbrt(-o-h))}else if(a<0){var u=Math.acos(-o*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===o)n.push(0);else{var l=Math.cbrt(o);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}(),s_t=new mn(0,0,0),o_t=new mn(0,0,0),a_t=new mn(0,0,0),h_t=new mn(0,0,0),u_t=new mn(0,0,0),l_t=new mn(0,0,0),c_t=new mn(0,0,0),__t=new mn(0,0,0),f_t=new mn(0,0,0),d_t=new mn(0,0,0),p_t=new mn(0,0,0),m_t=new mn(0,0,0),g_t=new mn(0,0,0),y_t=new mn(0,0,0),v_t=new mn(0,0,0),S_t=t("eP",(Zct=Ta("cc.LightProbesData"),Jct=eh([Hct]),$ct=eh([Yct]),Zct((e_t=function(){function t(){this._probes=i_t&&i_t(),this._tetrahedrons=n_t&&n_t()}var e=t.prototype;return e.empty=function(){return 0===this._probes.length||0===this._tetrahedrons.length},e.reset=function(){this._probes.length=0,this._tetrahedrons.length=0},e.updateProbes=function(t){this._probes.length=t.length;for(var e=this._probes.length,i=0;i<e;i++){var n=this._probes[i];if(n)n.position.set(t[i]);else{n=new Hct(t[i]);for(var r=0;r<Qct.getBasisCount();r++)n.coefficients[r]=mn.ZERO;this._probes[i]=n}}},e.updateTetrahedrons=function(){var t=new qct(this._probes);this._tetrahedrons=t.build()},e.getInterpolationSHCoefficients=function(t,e,i){if(!this.hasCoefficients())return!1;var n=Qct.getBasisCount(),r=this._tetrahedrons[t],s=this._probes[r.vertex0].coefficients,o=this._probes[r.vertex1].coefficients,a=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 mn(0,0,0),mn.scaleAndAdd(i[u],i[u],s[u],e.x),mn.scaleAndAdd(i[u],i[u],o[u],e.y),mn.scaleAndAdd(i[u],i[u],a[u],e.z),mn.scaleAndAdd(i[u],i[u],h[u],e.w);else for(var l=0;l<n;l++)i[l]=new mn(0,0,0),mn.scaleAndAdd(i[l],i[l],s[l],e.x),mn.scaleAndAdd(i[l],i[l],o[l],e.y),mn.scaleAndAdd(i[l],i[l],a[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,o=0;o<n;o++){var a=this._tetrahedrons[e];if(this.getBarycentricCoord(t,a,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?a.neighbours[0]:i.y<i.z&&i.y<i.w?a.neighbours[1]:i.z<i.w?a.neighbours[2]:a.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(mn.subtract(s_t,e,t),mn.subtract(o_t,i,t),mn.cross(a_t,s_t,o_t),a_t.lengthSqr()<=Bi)return new mn(0,0,0);var r=a_t.clone();r.normalize();var s=1/r.dot(a_t);mn.subtract(h_t,t,n),mn.subtract(u_t,e,n),mn.subtract(l_t,i,n),mn.cross(c_t,u_t,l_t);var o=r.dot(c_t)*s;mn.cross(__t,l_t,h_t);var a=r.dot(__t)*s;return new mn(o,a,1-o-a)},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 mn(0,0,0);mn.subtract(n,t,this._probes[e.vertex3].position),mn.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,o=this._probes[i.vertex2].position;mn.subtract(d_t,s,r),mn.subtract(p_t,o,r),mn.cross(f_t,d_t,p_t),mn.subtract(m_t,e,r);var a=mn.dot(m_t,f_t);if(a<0)n.set(0,0,0,-1);else{var h=new mn(0,0,0);mn.transformMat3(h,e,i.matrix),mn.add(h,h,i.offset),a=-1===i.vertex3?r_t.getCubicUniqueRoot(h.x,h.y,h.z):r_t.getQuadraticUniqueRoot(h.x,h.y,h.z),mn.scaleAndAdd(g_t,r,this._probes[i.vertex0].normal,a),mn.scaleAndAdd(y_t,s,this._probes[i.vertex1].normal,a),mn.scaleAndAdd(v_t,o,this._probes[i.vertex2].normal,a);var u=t.getTriangleBarycentricCoord(g_t,y_t,v_t,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}(),i_t=fa(e_t.prototype,"_probes",[Ma,Jct],(function(){return[]})),n_t=fa(e_t.prototype,"_tetrahedrons",[Ma,$ct],(function(){return[]})),t_t=e_t))||t_t));v.internal.LightProbesData=S_t;var A_t,T_t,b_t,E_t,C_t,x_t,w_t,D_t,R_t,I_t,M_t,P_t,B_t,O_t,L_t,N_t=t("eQ",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}());v.internal.LightProbes=N_t,t("eR",(A_t=Ta("cc.LightProbeGroup"),T_t=eh([mn]),b_t=eh(Mct),E_t=eh(ei),C_t=eh(ei),x_t=eh(ei),A_t(w_t=Ca((D_t=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=R_t&&R_t(),e._method=I_t&&I_t(),e._minPos=M_t&&M_t(),e._maxPos=P_t&&P_t(),e._nProbesX=B_t&&B_t(),e._nProbesY=O_t&&O_t(),e._nProbesZ=L_t&&L_t(),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=Pct.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),this.node.scene.globals.lightProbeInfo.syncData(this.node,this.probes),this.node.scene.globals.lightProbeInfo.update(t),e&&this.node.emit(Nm.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}(Lp),R_t=fa(D_t.prototype,"_probes",[Ma],(function(){return[]})),I_t=fa(D_t.prototype,"_method",[Ma],(function(){return Mct.UNIFORM})),M_t=fa(D_t.prototype,"_minPos",[Ma],(function(){return new mn(-5,-5,-5)})),P_t=fa(D_t.prototype,"_maxPos",[Ma],(function(){return new mn(5,5,5)})),B_t=fa(D_t.prototype,"_nProbesX",[Ma],(function(){return 3})),O_t=fa(D_t.prototype,"_nProbesY",[Ma],(function(){return 3})),L_t=fa(D_t.prototype,"_nProbesZ",[Ma],(function(){return 3})),m(D_t.prototype,"probes",[T_t],Object.getOwnPropertyDescriptor(D_t.prototype,"probes"),D_t.prototype),m(D_t.prototype,"method",[b_t],Object.getOwnPropertyDescriptor(D_t.prototype,"method"),D_t.prototype),m(D_t.prototype,"nProbesX",[E_t],Object.getOwnPropertyDescriptor(D_t.prototype,"nProbesX"),D_t.prototype),m(D_t.prototype,"nProbesY",[C_t],Object.getOwnPropertyDescriptor(D_t.prototype,"nProbesY"),D_t.prototype),m(D_t.prototype,"nProbesZ",[x_t],Object.getOwnPropertyDescriptor(D_t.prototype,"nProbesZ"),D_t.prototype),w_t=D_t))||w_t)||w_t));var F_t,k_t,V_t,G_t,U_t,z_t,H_t,W_t,j_t,X_t,Y_t,q_t,K_t,Q_t,Z_t,J_t,$_t,tft,eft,ift,nft,rft,sft,oft,aft,hft,uft,lft,cft=t("eS",(F_t=Ta("cc.Billboard"),k_t=eh(Dm),V_t=eh(Dm),F_t((U_t=function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._texture=z_t&&z_t(),e._height=H_t&&H_t(),e._width=W_t&&W_t(),e._rotation=j_t&&j_t(),e._techIndex=X_t&&X_t(),e._model=null,e._mesh=null,e._material=null,e._uniform=new ln(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=dP({primitiveMode:Yc.TRIANGLE_LIST,positions:[0,0,0,0,0,0,0,0,0,0,0,0],uvs:[0,0,1,0,0,1,1,1],colors:[bn.WHITE.r,bn.WHITE.g,bn.WHITE.b,bn.WHITE.a,bn.WHITE.r,bn.WHITE.g,bn.WHITE.b,bn.WHITE.a,bn.WHITE.r,bn.WHITE.g,bn.WHITE.b,bn.WHITE.a,bn.WHITE.r,bn.WHITE.g,bn.WHITE.b,bn.WHITE.a],attributes:[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F),new U_(a_.ATTR_COLOR,Ac.RGBA8UI,!0)],indices:[0,1,2,1,2,3]},void 0,{calculateBounds:!1});var t=this._model=v.director.root.createModel(ND,this.node);t.node=t.transform=this.node,null==this._material&&(this._material=new oT,this._material.copy(UA.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*Gi(this._rotation))/100},set:function(t){this._rotation=Vi(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)||void 0===e||null===(i=e.effectAsset)||void 0===i?void 0:i.techniques;n&&t>=n.length&&(t=n.length-1),t<0&&(t=0),this._techIndex=t,this.updateTechnique()}}]),i}(Lp),z_t=fa(U_t.prototype,"_texture",[k_t],(function(){return null})),m(U_t.prototype,"texture",[V_t],Object.getOwnPropertyDescriptor(U_t.prototype,"texture"),U_t.prototype),H_t=fa(U_t.prototype,"_height",[Ma],(function(){return 0})),W_t=fa(U_t.prototype,"_width",[Ma],(function(){return 0})),j_t=fa(U_t.prototype,"_rotation",[Ma],(function(){return 0})),X_t=fa(U_t.prototype,"_techIndex",[Ma],(function(){return 0})),G_t=U_t))||G_t)),_ft=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RGBA32F),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0)],fft=new mn,dft=new mn,pft=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=xD.LINE,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=_ft;t<e.length;t++){var i=e[t];i.offset=this._vertSize,this._vertSize+=ff[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 E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,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 o=this._device.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,(this._capacity-1)*this._indexCount*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));return o.update(i),this._iaVertCount=this._capacity*this._vertCount,this._iaIndexCount=(this._capacity-1)*this._indexCount,this._subMeshData=new jI([t],_ft,Yc.TRIANGLE_LIST,o),this.initSubModel(0,this._subMeshData,this._material),e},i.addLineVertexData=function(t,e,i){if(t.length>1){var n=0;mn.subtract(fft,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++]=fft.x,this._vdataF32[n++]=fft.y,this._vdataF32[n++]=fft.z,this._vdataUint32[n++]=bn.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++]=fft.x,this._vdataF32[n++]=fft.y,this._vdataF32[n++]=fft.z,this._vdataUint32[n++]=bn.toUint32(i.evaluate(0,1));for(var r=1;r<t.length-1;r++){mn.subtract(fft,t[r-1],t[r]),mn.subtract(dft,t[r+1],t[r]),mn.subtract(dft,dft,fft);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++]=dft.x,this._vdataF32[n++]=dft.y,this._vdataF32[n++]=dft.z,this._vdataUint32[n++]=bn.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++]=dft.x,this._vdataF32[n++]=dft.y,this._vdataF32[n++]=dft.z,this._vdataUint32[n++]=bn.toUint32(i.evaluate(s,1))}mn.subtract(fft,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++]=fft.x,this._vdataF32[n++]=fft.y,this._vdataF32[n++]=fft.z,this._vdataUint32[n++]=bn.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++]=fft.x,this._vdataF32[n++]=fft.y,this._vdataF32[n++]=fft.z,this._vdataUint32[n++]=bn.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}(ND),mft=Ei.Attr.setClassAttr,gft=[["mode","constant","multiplier"],["mode","spline","multiplier"],["mode","splineMin","splineMax","multiplier"],["mode","constantMin","constantMax","multiplier"]],yft=be({Constant:0,Curve:1,TwoCurves:2,TwoConstants:3}),vft=t("eW",Ta("cc.CurveRange")(((q_t=function(){function t(){this.constant=0,this.constantMin=0,this.constantMax=0,this.multiplier=1,this._mode=yft.Constant}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){default:case yft.Constant:return this.constant;case yft.Curve:return this.spline.evaluate(t)*this.multiplier;case yft.TwoCurves:return ki(this.splineMin.evaluate(t),this.splineMax.evaluate(t),e)*this.multiplier;case yft.TwoConstants:return ki(this.constantMin,this.constantMax,e)}},e.getMax=function(){switch(this._mode){default:case yft.Constant:return this.constant;case yft.Curve:return this.multiplier;case yft.TwoConstants:return this.constantMax;case yft.TwoCurves:return this.multiplier}},e.isZero=function(){switch(this._mode){default:case yft.Constant:return Li(this.constant,0,Bi);case yft.Curve:return Li(this.multiplier,0,Bi);case yft.TwoConstants:return Li(Math.max(Math.abs(this.constantMax),Math.abs(this.constantMin)),0,Bi);case yft.TwoCurves:return Li(this.multiplier,0,Bi)}},e._onBeforeSerialize=function(){return gft[this._mode]},n(t,[{key:"mode",get:function(){return this._mode},set:function(t){switch(this._mode=t,t){case yft.Constant:case yft.TwoConstants:break;case yft.Curve:this.spline||(this.spline=Bl());break;case yft.TwoCurves:this.splineMax||(this.splineMax=Bl()),this.splineMin||(this.splineMin=Bl())}}},{key:"curve",get:function(){var t;return null!==(t=this._curve)&&void 0!==t?t:this._curve=new Il(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 Il(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 Il(this.splineMax)},set:function(t){this._curveMax=t,this.splineMax=t._internalCurve}}]),t}()).Mode=yft,Y_t=q_t))||Y_t);function Sft(t,e,i){switch(t.mode){case yft.Constant:return t.constant;case yft.Curve:return t.spline.evaluate(e)*t.multiplier;case yft.TwoCurves:return 0===i?t.splineMin.evaluate(e)*t.multiplier:t.splineMax.evaluate(e)*t.multiplier;case yft.TwoConstants:return 0===i?t.constantMin:t.constantMax;default:return 0}}function Aft(t){switch(t.mode){case yft.TwoConstants:case yft.TwoCurves:return 2;default:return 1}}function Tft(t,e,i,n){return null===t||i!==t.width||n!==t.height?(t&&t.destroy(),t=function(t,e,i){var n=new sp({width:e,height:i,_data:t,_compressed:!1,format:kd.RGBA32F}),r=new Dm;return r.setFilters(Gd.NEAREST,Gd.NEAREST),r.setMipFilter(Gd.NONE),r.setWrapMode(Vd.CLAMP_TO_EDGE,Vd.CLAMP_TO_EDGE,Vd.CLAMP_TO_EDGE),r.image=n,r}(e,i,n)):t.uploadData(e),t}function bft(t,e,i,n,r,s,o){var a=Math.max(Aft(n),Aft(r),Aft(s)),h=i*a*4;null!==e&&e.length===h||(e=new Float32Array(i*a*4));for(var u=[n,r,s],l=1/(i-1),c=0;c<a;c++)for(var _=0;_<3;_++)for(var f=u[_],d=0,p=0,m=0;m<i;m++){var g=Sft(f,l*m,c);p=o?g:(d+=g)/(m+1),e[4*(c*i+m)+_]=p}return{texture:Tft(t,e,i,a),texdata:e}}Ei.fastDefine("cc.CurveRange",vft,{multiplier:1,constantMax:0,constantMin:0,constant:0,mode:yft.Constant,splineMax:Object.freeze(Bl()),splineMin:Object.freeze(Bl()),spline:Object.freeze(Bl())}),mft(vft,"multiplier","visible",!0),mft(vft,"constantMax","visible",!0),mft(vft,"constantMin","visible",!0),mft(vft,"constant","visible",!0),pi(vft,"mode",yft),mft(vft,"mode","visible",!0),mft(vft,"splineMax","type","Object"),mft(vft,"splineMax","ctor",Cu),mft(vft,"splineMax","visible",!0),mft(vft,"splineMin","type","Object"),mft(vft,"splineMin","ctor",Cu),mft(vft,"splineMin","visible",!0),mft(vft,"spline","type","Object"),mft(vft,"spline","ctor",Cu),mft(vft,"spline","visible",!0);var Eft,Cft,xft,wft,Dft,Rft,Ift,Mft,Pft,Bft,Oft,Lft,Nft,Fft,kft,Vft,Gft,Uft,zft,Hft,Wft=be({Color:0,Gradient:1,TwoColors:2,TwoGradients:3,RandomColor:4}),jft=new bn,Xft=new bn,Yft=t("eX",(K_t=Ta("cc.GradientRange"),Q_t=eh(Wft),Z_t=eh(El),J_t=eh(El),$_t=eh(El),tft=eh(Wft),K_t(((lft=function(){function t(){this.color=nft&&nft(),this.colorMin=rft&&rft(),this.colorMax=sft&&sft(),this.gradient=oft&&oft(),this.gradientMin=aft&&aft(),this.gradientMax=hft&&hft(),this._mode=uft&&uft(),this._color=bn.WHITE.clone()}var e=t.prototype;return e.evaluate=function(t,e){switch(this._mode){case Wft.Color:return this.color;case Wft.TwoColors:return bn.lerp(this._color,this.colorMin,this.colorMax,e),this._color;case Wft.RandomColor:return this.gradient.getRandomColor(this._color);case Wft.Gradient:return this.gradient.evaluateFast(this._color,t);case Wft.TwoGradients:return bn.lerp(this._color,this.gradientMin.evaluateFast(jft,t),this.gradientMax.evaluateFast(Xft,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}()).Mode=Wft,m((ift=lft).prototype,"mode",[Q_t],Object.getOwnPropertyDescriptor(ift.prototype,"mode"),ift.prototype),nft=fa(ift.prototype,"color",[Ma],(function(){return bn.WHITE.clone()})),rft=fa(ift.prototype,"colorMin",[Ma],(function(){return bn.WHITE.clone()})),sft=fa(ift.prototype,"colorMax",[Ma],(function(){return bn.WHITE.clone()})),oft=fa(ift.prototype,"gradient",[Z_t],(function(){return new El})),aft=fa(ift.prototype,"gradientMin",[J_t],(function(){return new El})),hft=fa(ift.prototype,"gradientMax",[$_t],(function(){return new El})),uft=fa(ift.prototype,"_mode",[tft],(function(){return Wft.Color})),eft=ift))||eft));function qft(t,e,i){switch(t.mode){case Wft.Color:return t.color;case Wft.TwoColors:return 0===i?t.colorMin:t.colorMax;case Wft.RandomColor:return t.gradient.getRandomColor(jft);case Wft.Gradient:return t.gradient.evaluateFast(jft,e);case Wft.TwoGradients:return 0===i?t.gradientMin.evaluateFast(jft,e):t.gradientMax.evaluateFast(jft,e);default:return t.color}}var Kft={CC_USE_WORLD_SPACE:!1,CC_USE_WORLD_SCALE:!0},Qft=t("eT",(Eft=Ta("cc.Line"),Cft=eh(Dm),xft=eh(Dm),wft=eh(oT),Dft=eh([mn]),Rft=eh([mn]),Ift=eh(vft),Mft=eh(Yft),Pft=eh(jn),Bft=eh(jn),Eft((Lft=function(t){function e(){var e;return(e=t.call(this)||this)._texture=Nft&&Nft(),e._material=Fft&&Fft(),e._worldSpace=kft&&kft(),e._positions=Vft&&Vft(),e._width=Gft&&Gft(),e._color=Uft&&Uft(),e._tile=zft&&zft(),e._tile_offset=new ln,e._offset=Hft&&Hft(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){var t=v.director.root.createModel(pft);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=UA.get("default-trail-material");this.material=e}var i=this.getMaterialInstance(0);i&&(Kft.CC_USE_WORLD_SPACE=this.worldSpace,i.recompileShaders(Kft),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&&(Kft.CC_USE_WORLD_SPACE=this.worldSpace,n.recompileShaders(Kft),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&&(Kft.CC_USE_WORLD_SPACE=this.worldSpace,e.recompileShaders(Kft),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}(MV),Nft=fa(Lft.prototype,"_texture",[Cft],(function(){return null})),m(Lft.prototype,"texture",[xft],Object.getOwnPropertyDescriptor(Lft.prototype,"texture"),Lft.prototype),Fft=fa(Lft.prototype,"_material",[Ma],(function(){return null})),m(Lft.prototype,"lineMaterial",[wft],Object.getOwnPropertyDescriptor(Lft.prototype,"lineMaterial"),Lft.prototype),m(Lft.prototype,"sharedMaterials",[_h,Ma],Object.getOwnPropertyDescriptor(Lft.prototype,"sharedMaterials"),Lft.prototype),kft=fa(Lft.prototype,"_worldSpace",[Ma],(function(){return!1})),Vft=fa(Lft.prototype,"_positions",[Dft],(function(){return[]})),m(Lft.prototype,"positions",[Rft],Object.getOwnPropertyDescriptor(Lft.prototype,"positions"),Lft.prototype),m(Lft.prototype,"width",[Ift],Object.getOwnPropertyDescriptor(Lft.prototype,"width"),Lft.prototype),Gft=fa(Lft.prototype,"_width",[Ma],(function(){return new vft})),m(Lft.prototype,"color",[Mft],Object.getOwnPropertyDescriptor(Lft.prototype,"color"),Lft.prototype),Uft=fa(Lft.prototype,"_color",[Ma],(function(){return new Yft})),zft=fa(Lft.prototype,"_tile",[Ma],(function(){return new jn(1,1)})),m(Lft.prototype,"tile",[Pft],Object.getOwnPropertyDescriptor(Lft.prototype,"tile"),Lft.prototype),Hft=fa(Lft.prototype,"_offset",[Ma],(function(){return new jn(0,0)})),m(Lft.prototype,"offset",[Bft],Object.getOwnPropertyDescriptor(Lft.prototype,"offset"),Lft.prototype),Oft=Lft))||Oft)),Zft=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 mn(0,0,0),this.velocity=new mn(0,0,0),this.animatedVelocity=new mn(0,0,0),this.ultimateVelocity=new mn(0,0,0),this.angularVelocity=new mn(0,0,0),this.axisOfRotation=new mn(0,0,0),this.rotation=new mn(0,0,0),this.startEuler=new mn(0,0,0),this.startRotation=new In,this.startRotated=!1,this.deltaQuat=new In,this.deltaMat=new Vn,this.localMat=new Vn,this.startSize=new mn(0,0,0),this.size=new mn(0,0,0),this.startColor=bn.WHITE.clone(),this.color=bn.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}();Zft.INDENTIFY_NEG_QUAT=10,Zft.R2D=180/Math.PI;var Jft,$ft,tdt,edt,idt,ndt,rdt="colorModule",sdt="rotationModule",odt="sizeModule",adt="textureModule",hdt="noiseModule",udt=["sizeModule","colorModule","forceModule","velocityModule","limitModule","rotationModule","textureModule","noiseModule"],ldt=["_colorOverLifetimeModule","_shapeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule","_trailModule"],cdt=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}(),_dt=be({World:0,Local:1,Custom:2}),fdt=be({Pause:0,PauseAndCatchup:1,AlwaysSimulate:2}),ddt=be({World:0,Local:1,View:2}),pdt=be({Billboard:0,StrecthedBillboard:1,HorizontalBillboard:2,VerticalBillboard:3,Mesh:4}),mdt=be({Box:0,Circle:1,Cone:2,Sphere:3,Hemisphere:4}),gdt=be({Base:0,Edge:1,Shell:2,Volume:3}),ydt=be({Random:0,Loop:1,PingPong:2}),vdt=be({Particles:0}),Sdt=be({Stretch:0}),Adt=new mn(0,0,-1);function Tdt(t,e,i,n){return e!==t?(t===_dt.World||Vn.invert(i,i),Vn.getRotation(n,i),!0):(In.set(n,0,0,0,1),!1)}function bdt(t,e){jn.set(t,Math.cos(e),Math.sin(e))}function Edt(t){var e=Hi(-1,1),i=Hi(0,2*Math.PI),n=Math.sqrt(1-e*e),r=n*Math.cos(i),s=n*Math.sin(i);mn.set(t,r,s,e)}function Cdt(t,e,i){Edt(t),mn.multiplyScalar(t,t,e+(i-e)*Ui())}function xdt(t,e,i,n){bdt(t,n),t.z=0,mn.multiplyScalar(t,t,e+(i-e)*Ui())}function wdt(t){for(var e=0;e<t.length;e++){var i=e+Wi(0,t.length-e),n=t[i];t[i]=t[e],t[e]=n}}function Ddt(){var t=Hi(-1,1);return 0===t&&t++,b(t)}function Rdt(t){var e=vft.Mode;switch(t.mode){case e.TwoCurves:case e.TwoConstants:return!0;default:return!1}}var Idt,Mdt,Pdt,Bdt,Odt,Ldt,Ndt,Fdt,kdt,Vdt,Gdt,Udt,zdt,Hdt,Wdt,jdt,Xdt,Ydt,qdt,Kdt,Qdt,Zdt,Jdt,$dt,tpt,ept,ipt,npt,rpt,spt,opt,apt,hpt,upt,lpt,cpt,_pt,fpt,dpt,ppt=(Jft=Ta("cc.ColorOvertimeModule"),$ft=eh(Yft),Jft((edt=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)._enable=idt&&idt(),e.color=ndt&&ndt(),e.name=rdt,e}return s(e,t),e.prototype.animate=function(t){t.color.set(t.startColor);var e=function(t){var e=Yft.Mode;switch(t.mode){case e.TwoGradients:case e.TwoColors:return!0;default:return!1}}(this.color)?ji(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}(cdt),idt=fa(edt.prototype,"_enable",[Ma],(function(){return!1})),ndt=fa(edt.prototype,"color",[$ft,Ma],(function(){return new Yft})),tdt=edt))||tdt),mpt=212165,gpt=new mn,ypt=(Idt=Ta("cc.ForceOvertimeModule"),Mdt=eh(vft),Pdt=eh(vft),Bdt=eh(vft),Odt=eh(_dt),Idt((Ndt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Fdt&&Fdt(),e.x=kdt&&kdt(),e.y=Vdt&&Vdt(),e.z=Gdt&&Gdt(),e.space=Udt&&Udt(),e.randomized=!1,e.rotation=void 0,e.needTransform=void 0,e.name="forceModule",e.rotation=new In,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=Tdt(t,this.space,e,this.rotation)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=Rdt(this.x)?ji(t.randomSeed+mpt):0,r=Rdt(this.y)?ji(t.randomSeed+mpt):0,s=Rdt(this.z)?ji(t.randomSeed+mpt):0,o=mn.set(gpt,this.x.evaluate(i,n),this.y.evaluate(i,r),this.z.evaluate(i,s));this.needTransform&&mn.transformQuat(o,o,this.rotation),mn.scaleAndAdd(t.velocity,t.velocity,o,e),mn.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}(cdt),Fdt=fa(Ndt.prototype,"_enable",[Ma],(function(){return!1})),kdt=fa(Ndt.prototype,"x",[Mdt,Ma],(function(){return new vft})),Vdt=fa(Ndt.prototype,"y",[Pdt,Ma],(function(){return new vft})),Gdt=fa(Ndt.prototype,"z",[Bdt,Ma],(function(){return new vft})),Udt=fa(Ndt.prototype,"space",[Odt,Ma],(function(){return _dt.Local})),Ldt=Ndt))||Ldt),vpt=23541,Spt=new mn,Apt=new mn,Tpt=(zdt=Ta("cc.LimitVelocityOvertimeModule"),Hdt=eh(vft),Wdt=eh(vft),jdt=eh(vft),Xdt=eh(vft),Ydt=eh(_dt),zdt((Kdt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=Qdt&&Qdt(),e.limitX=Zdt&&Zdt(),e.limitY=Jdt&&Jdt(),e.limitZ=$dt&&$dt(),e.limit=tpt&&tpt(),e.dampen=ept&&ept(),e.separateAxes=ipt&&ipt(),e.space=npt&&npt(),e.drag=null,e.multiplyDragByParticleSize=!1,e.multiplyDragByParticleVelocity=!1,e.name="limitModule",e.rotation=void 0,e.needTransform=void 0,e.rotation=new In,e.needTransform=!1,e.needUpdate=!0,e}s(e,t);var i=e.prototype;return i.update=function(t,e){this.needTransform=Tdt(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Spt;if(this.separateAxes){var n=Rdt(this.limitX)?ji(t.randomSeed+vpt):0,r=Rdt(this.limitY)?ji(t.randomSeed+vpt):0,s=Rdt(this.limitZ)?ji(t.randomSeed+vpt):0;mn.set(Apt,this.limitX.evaluate(e,n),this.limitY.evaluate(e,r),this.limitZ.evaluate(e,s)),this.needTransform&&mn.transformQuat(Apt,Apt,this.rotation),mn.set(i,bpt(t.ultimateVelocity.x,Apt.x,this.dampen),bpt(t.ultimateVelocity.y,Apt.y,this.dampen),bpt(t.ultimateVelocity.z,Apt.z,this.dampen))}else{mn.normalize(i,t.ultimateVelocity);var o=Rdt(this.limit)?ji(t.randomSeed+vpt):0;mn.multiplyScalar(i,i,bpt(t.ultimateVelocity.length(),this.limit.evaluate(e,o),this.dampen))}mn.copy(t.ultimateVelocity,i),mn.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}(cdt),Qdt=fa(Kdt.prototype,"_enable",[Ma],(function(){return!1})),Zdt=fa(Kdt.prototype,"limitX",[Hdt,Ma],(function(){return new vft})),Jdt=fa(Kdt.prototype,"limitY",[Wdt,Ma],(function(){return new vft})),$dt=fa(Kdt.prototype,"limitZ",[jdt,Ma],(function(){return new vft})),tpt=fa(Kdt.prototype,"limit",[Xdt,Ma],(function(){return new vft})),ept=fa(Kdt.prototype,"dampen",[Ma],(function(){return 3})),ipt=fa(Kdt.prototype,"separateAxes",[Ma],(function(){return!1})),npt=fa(Kdt.prototype,"space",[Ydt,Ma],(function(){return _dt.Local})),qdt=Kdt))||qdt);function bpt(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 Ept,Cpt,xpt,wpt,Dpt,Rpt,Ipt,Mpt,Ppt,Bpt,Opt,Lpt,Npt,Fpt,kpt,Vpt,Gpt,Upt,zpt,Hpt,Wpt,jpt,Xpt,Ypt,qpt,Kpt,Qpt,Zpt,Jpt,$pt,tmt,emt,imt,nmt,rmt,smt,omt,amt,hmt,umt,lmt,cmt,_mt,fmt,dmt,pmt,mmt,gmt,ymt,vmt,Smt,Amt,Tmt,bmt,Emt,Cmt,xmt,wmt,Dmt,Rmt,Imt,Mmt,Pmt,Bmt,Omt,Lmt,Nmt,Fmt,kmt,Vmt,Gmt,Umt,zmt,Hmt,Wmt,jmt,Xmt,Ymt,qmt,Kmt,Qmt,Zmt,Jmt,$mt,tgt,egt,igt=125292,ngt=(rpt=Ta("cc.RotationOvertimeModule"),spt=eh(vft),opt=eh(vft),apt=eh(vft),rpt((upt=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)._enable=lpt&&lpt(),e._separateAxes=cpt&&cpt(),e.x=_pt&&_pt(),e.y=fpt&&fpt(),e.z=dpt&&dpt(),e.name=sdt,e._startMat=new Vn,e._matRot=new Vn,e._quatRot=new In,e._otherEuler=new mn,e}s(e,t);var i=e.prototype;return i._processRotation=function(t){var e=t.particleSystem.processor.getInfo().renderMode;e!==pdt.Mesh&&e===pdt.StrecthedBillboard&&this._quatRot.set(0,0,0,1),In.normalize(this._quatRot,this._quatRot),this._quatRot.w<0&&(this._quatRot.x+=Zft.INDENTIFY_NEG_QUAT)},i.animate=function(t,e){var i=1-t.remainingLifetime/t.startLifetime,n=Rdt(this.z)?ji(t.randomSeed+igt):0,r=t.particleSystem.processor.getInfo().renderMode;if(this._separateAxes&&r!==pdt.VerticalBillboard&&r!==pdt.HorizontalBillboard){var s=Rdt(this.x)?ji(t.randomSeed+igt):0,o=Rdt(this.y)?ji(t.randomSeed+igt):0;In.fromEuler(t.deltaQuat,this.x.evaluate(i,s)*e*Zft.R2D,this.y.evaluate(i,o)*e*Zft.R2D,this.z.evaluate(i,n)*e*Zft.R2D)}else In.fromEuler(t.deltaQuat,0,0,this.z.evaluate(i,n)*e*Zft.R2D);t.deltaMat=Vn.fromQuat(t.deltaMat,t.deltaQuat),t.localMat=t.localMat.multiply(t.deltaMat),t.startRotated||(r!==pdt.Mesh&&(r===pdt.StrecthedBillboard?t.startEuler.set(0,0,0):r!==pdt.Billboard&&t.startEuler.set(0,0,t.startEuler.z)),In.fromEuler(t.startRotation,t.startEuler.x*Zft.R2D,t.startEuler.y*Zft.R2D,t.startEuler.z*Zft.R2D),t.startRotated=!0),this._startMat=Vn.fromQuat(this._startMat,t.startRotation),this._matRot=this._startMat.multiply(t.localMat),Vn.getRotation(this._quatRot,this._matRot),this._processRotation(t,Zft.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}(cdt),lpt=fa(upt.prototype,"_enable",[Ma],(function(){return!1})),cpt=fa(upt.prototype,"_separateAxes",[Ma],(function(){return!1})),_pt=fa(upt.prototype,"x",[spt,Ma],(function(){return new vft})),fpt=fa(upt.prototype,"y",[opt,Ma],(function(){return new vft})),dpt=fa(upt.prototype,"z",[apt,Ma],(function(){return new vft})),hpt=upt))||hpt),rgt=39825,sgt=(Ept=Ta("cc.SizeOvertimeModule"),Cpt=eh(vft),xpt=eh(vft),wpt=eh(vft),Dpt=eh(vft),Ept((Ipt=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)._enable=Mpt&&Mpt(),e.separateAxes=Ppt&&Ppt(),e.size=Bpt&&Bpt(),e.x=Opt&&Opt(),e.y=Lpt&&Lpt(),e.z=Npt&&Npt(),e.name=odt,e}return s(e,t),e.prototype.animate=function(t){if(this.separateAxes){var e=1-t.remainingLifetime/t.startLifetime,i=Rdt(this.x)?ji(t.randomSeed+rgt):0,n=Rdt(this.y)?ji(t.randomSeed+rgt):0,r=Rdt(this.z)?ji(t.randomSeed+rgt):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=Rdt(this.size)?ji(t.randomSeed+rgt):0;mn.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}(cdt),Mpt=fa(Ipt.prototype,"_enable",[Ma],(function(){return!1})),Ppt=fa(Ipt.prototype,"separateAxes",[Ma],(function(){return!1})),Bpt=fa(Ipt.prototype,"size",[Cpt,Ma],(function(){return new vft})),Opt=fa(Ipt.prototype,"x",[xpt,Ma],(function(){return new vft})),Lpt=fa(Ipt.prototype,"y",[wpt,Ma],(function(){return new vft})),Npt=fa(Ipt.prototype,"z",[Dpt,Ma],(function(){return new vft})),Rpt=Ipt))||Rpt),ogt=be({Grid:0}),agt=be({WholeSheet:0,SingleRow:1}),hgt=(Fpt=Ta("cc.TextureAnimationModule"),kpt=Pa("numTilesX"),Vpt=Pa("numTilesY"),Gpt=eh(ogt),Upt=eh(ogt),zpt=eh(agt),Hpt=eh(vft),Wpt=eh(vft),Fpt((Xpt=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)._enable=Ypt&&Ypt(),e._numTilesX=qpt&&qpt(),e._numTilesY=Kpt&&Kpt(),e._mode=Qpt&&Qpt(),e.animation=Zpt&&Zpt(),e.frameOverTime=Jpt&&Jpt(),e.startFrame=$pt&&$pt(),e.cycleCount=tmt&&tmt(),e._flipU=emt&&emt(),e._flipV=imt&&imt(),e._uvChannelMask=nmt&&nmt(),e.randomRow=rmt&&rmt(),e.rowIndex=smt&&smt(),e.name=adt,e}s(e,t);var i=e.prototype;return i.init=function(t){t.startRow=Math.floor(Ui()*this.numTilesY)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Rdt(this.startFrame)?ji(t.randomSeed+90794):0,n=Rdt(this.frameOverTime)?ji(t.randomSeed+90794):0,r=this.startFrame.evaluate(e,i)/(this.numTilesX*this.numTilesY);if(this.animation===agt.WholeSheet)t.frameIndex=Ki(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1);else if(this.animation===agt.SingleRow){var s=1/this.numTilesY;if(this.randomRow){var o=Ki(this.cycleCount*(this.frameOverTime.evaluate(e,n)+r),1),a=t.startRow*s,h=a+s;t.frameIndex=ki(a,h,o)}else{var u=this.rowIndex*s,l=u+s;t.frameIndex=ki(u,l,Ki(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!==ogt.Grid&&z("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(){z("particle texture animation's flipU is not supported!")}},{key:"flipV",get:function(){return this._flipV},set:function(){z("particle texture animation's flipV is not supported!")}},{key:"uvChannelMask",get:function(){return this._uvChannelMask},set:function(){z("particle texture animation's uvChannelMask is not supported!")}}]),e}(cdt),Ypt=fa(Xpt.prototype,"_enable",[Ma],(function(){return!1})),qpt=fa(Xpt.prototype,"_numTilesX",[kpt],(function(){return 0})),Kpt=fa(Xpt.prototype,"_numTilesY",[Vpt],(function(){return 0})),Qpt=fa(Xpt.prototype,"_mode",[Gpt],(function(){return ogt.Grid})),m(Xpt.prototype,"mode",[Upt],Object.getOwnPropertyDescriptor(Xpt.prototype,"mode"),Xpt.prototype),Zpt=fa(Xpt.prototype,"animation",[zpt,Ma],(function(){return agt.WholeSheet})),Jpt=fa(Xpt.prototype,"frameOverTime",[Hpt,Ma],(function(){return new vft})),$pt=fa(Xpt.prototype,"startFrame",[Wpt,Ma],(function(){return new vft})),tmt=fa(Xpt.prototype,"cycleCount",[Ma],(function(){return 0})),emt=fa(Xpt.prototype,"_flipU",[Ma],(function(){return 0})),imt=fa(Xpt.prototype,"_flipV",[Ma],(function(){return 0})),nmt=fa(Xpt.prototype,"_uvChannelMask",[Ma],(function(){return-1})),rmt=fa(Xpt.prototype,"randomRow",[Ma],(function(){return!1})),smt=fa(Xpt.prototype,"rowIndex",[Ma],(function(){return 0})),jpt=Xpt))||jpt),ugt=197866,lgt=new mn,cgt=(omt=Ta("cc.VelocityOvertimeModule"),amt=eh(vft),hmt=eh(vft),umt=eh(vft),lmt=eh(vft),cmt=eh(_dt),omt((fmt=function(t){function e(){var e;return(e=t.call(this)||this)._enable=dmt&&dmt(),e.x=pmt&&pmt(),e.y=mmt&&mmt(),e.z=gmt&&gmt(),e.speedModifier=ymt&&ymt(),e.space=vmt&&vmt(),e.rotation=void 0,e.needTransform=void 0,e.name="velocityModule",e.rotation=new In,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=Tdt(t,this.space,e,this.rotation)},i.animate=function(t){var e=1-t.remainingLifetime/t.startLifetime,i=Rdt(this.x)?ji(t.randomSeed^ugt):0,n=Rdt(this.y)?ji(156497^t.randomSeed):0,r=Rdt(this.z)?ji(984136^t.randomSeed):0,s=Rdt(this.speedModifier)?ji(t.randomSeed+ugt):0,o=mn.set(lgt,this.x.evaluate(e,i),this.y.evaluate(e,n),this.z.evaluate(e,r));this.needTransform&&mn.transformQuat(o,o,this.rotation),mn.add(t.animatedVelocity,t.animatedVelocity,o),mn.add(t.ultimateVelocity,t.velocity,t.animatedVelocity),mn.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}(cdt),dmt=fa(fmt.prototype,"_enable",[Ma],(function(){return!1})),pmt=fa(fmt.prototype,"x",[amt,Ma],(function(){return new vft})),mmt=fa(fmt.prototype,"y",[hmt,Ma],(function(){return new vft})),gmt=fa(fmt.prototype,"z",[umt,Ma],(function(){return new vft})),ymt=fa(fmt.prototype,"speedModifier",[lmt,Ma],(function(){return new vft})),vmt=fa(fmt.prototype,"space",[cmt,Ma],(function(){return _dt.Local})),_mt=fmt))||_mt),_gt=t("eY",(Smt=Ta("cc.Burst"),Amt=eh(vft),Smt((bmt=function(){function t(){this._time=Emt&&Emt(),this._repeatCount=Cmt&&Cmt(),this.repeatInterval=xmt&&xmt(),this.count=wmt&&wmt(),this._remainingCount=void 0,this._curTime=void 0,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=Ki(t.time-t.startDelay.evaluate(0,1),t.duration)-e;i=i>0?i:0;var n=Ki(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}(),Emt=fa(bmt.prototype,"_time",[Ma],(function(){return 0})),Cmt=fa(bmt.prototype,"_repeatCount",[Ma],(function(){return 1})),xmt=fa(bmt.prototype,"repeatInterval",[Ma],(function(){return 1})),wmt=fa(bmt.prototype,"count",[Amt,Ma],(function(){return new vft})),Tmt=bmt))||Tmt)),fgt=new mn(0,0,0),dgt=[0,0,0],pgt=new mn(.5,.5,.5),mgt=(Dmt=Ta("cc.ShapeModule"),Rmt=eh(mdt),Imt=Pa("shapeType"),Mmt=eh(mdt),Pmt=eh(gdt),Bmt=eh(ydt),Omt=eh(vft),Dmt((Nmt=function(){function t(){this._enable=Fmt&&Fmt(),this._shapeType=kmt&&kmt(),this.emitFrom=Vmt&&Vmt(),this.alignToDirection=Gmt&&Gmt(),this.randomDirectionAmount=Umt&&Umt(),this.sphericalDirectionAmount=zmt&&zmt(),this.randomPositionAmount=Hmt&&Hmt(),this.radius=Wmt&&Wmt(),this.radiusThickness=jmt&&jmt(),this.arcMode=Xmt&&Xmt(),this.arcSpread=Ymt&&Ymt(),this.arcSpeed=qmt&&qmt(),this.length=Kmt&&Kmt(),this.boxThickness=Qmt&&Qmt(),this._position=Zmt&&Zmt(),this._rotation=Jmt&&Jmt(),this._scale=$mt&&$mt(),this._arc=tgt&&tgt(),this._angle=egt&&egt(),this.mat=new Vn,this.quat=new In,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 mdt.Box:!function(t,e,i,n){switch(t){case gdt.Volume:r=i,s=pgt,mn.set(r,Hi(-s.x,s.x),Hi(-s.y,s.y),Hi(-s.z,s.z));break;case gdt.Shell:dgt[0]=Hi(-.5,.5),dgt[1]=Hi(-.5,.5),dgt[2]=.5*Ddt(),wdt(dgt),ggt(dgt,e),mn.set(i,dgt[0],dgt[1],dgt[2]);break;case gdt.Edge:dgt[0]=Hi(-.5,.5),dgt[1]=.5*Ddt(),dgt[2]=.5*Ddt(),wdt(dgt),ggt(dgt,e),mn.set(i,dgt[0],dgt[1],dgt[2]);break;default:U(t+" is not supported for box emitter.")}var r,s;mn.copy(n,Adt)}(this.emitFrom,this.boxThickness,t.position,t.velocity);break;case mdt.Circle:!function(t,e,i,n,r){xdt(n,t*(1-e),t,i),mn.normalize(r,n)}(this.radius,this.radiusThickness,this.generateArcAngle(),t.position,t.velocity);break;case mdt.Cone:!function(t,e,i,n,r,s,o,a){switch(t){case gdt.Base:xdt(o,e*(1-i),e,n),jn.multiplyScalar(a,o,Math.sin(r)),a.z=-Math.cos(r)*e,mn.normalize(a,a),o.z=0;break;case gdt.Shell:bdt(o,n),jn.multiplyScalar(a,o,Math.sin(r)),a.z=-Math.cos(r),mn.normalize(a,a),jn.multiplyScalar(o,o,e),o.z=0;break;case gdt.Volume:xdt(o,e*(1-i),e,n),jn.multiplyScalar(a,o,Math.sin(r)),a.z=-Math.cos(r)*e,mn.normalize(a,a),o.z=0,mn.add(o,o,mn.multiplyScalar(fgt,a,s*Ui()/-a.z));break;default:U(t+" is not supported for cone emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,this.generateArcAngle(),this._angle,this.length,t.position,t.velocity);break;case mdt.Sphere:!function(t,e,i,n,r){switch(t){case gdt.Volume:Cdt(n,e*(1-i),e),mn.normalize(r,n);break;case gdt.Shell:Edt(n),mn.multiplyScalar(n,n,e),mn.normalize(r,n);break;default:U(t+" is not supported for sphere emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;case mdt.Hemisphere:!function(t,e,i,n,r){switch(t){case gdt.Volume:Cdt(n,e*(1-i),e),n.z>0&&(n.z*=-1),mn.normalize(r,n);break;case gdt.Shell:Edt(n),mn.multiplyScalar(n,n,e),n.z>0&&(n.z*=-1),mn.normalize(r,n);break;default:U(t+" is not supported for hemisphere emitter.")}}(this.emitFrom,this.radius,this.radiusThickness,t.position,t.velocity);break;default:U(this.shapeType+" shapeType is not supported by ShapeModule.")}if(this.randomPositionAmount>0&&(t.position.x+=Hi(-this.randomPositionAmount,this.randomPositionAmount),t.position.y+=Hi(-this.randomPositionAmount,this.randomPositionAmount),t.position.z+=Hi(-this.randomPositionAmount,this.randomPositionAmount)),mn.transformQuat(t.velocity,t.velocity,this.quat),mn.transformMat4(t.position,t.position,this.mat),this.sphericalDirectionAmount>0){var e=mn.normalize(fgt,t.position);mn.lerp(t.velocity,t.velocity,e,this.sphericalDirectionAmount)}this.lastTime=this.particleSystem.time},e.constructMat=function(){In.fromEuler(this.quat,this._rotation.x,this._rotation.y,this._rotation.z),Vn.fromRTS(this.mat,this.quat,this._position,this._scale)},e.generateArcAngle=function(){if(this.arcMode===ydt.Random)return Hi(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 ydt.Loop:return Ki(t,this._arc);case ydt.PingPong:return Qi(t,this._arc);default:return Ki(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 Gi(this._arc)},set:function(t){this._arc=Vi(t)}},{key:"angle",get:function(){return Math.round(100*Gi(this._angle))/100},set:function(t){this._angle=Vi(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 mdt.Box:this.emitFrom===gdt.Base&&(this.emitFrom=gdt.Volume);break;case mdt.Cone:this.emitFrom===gdt.Edge&&(this.emitFrom=gdt.Base);break;case mdt.Sphere:case mdt.Hemisphere:this.emitFrom!==gdt.Base&&this.emitFrom!==gdt.Edge||(this.emitFrom=gdt.Volume)}}}]),t}(),Fmt=fa(Nmt.prototype,"_enable",[Ma],(function(){return!1})),kmt=fa(Nmt.prototype,"_shapeType",[Rmt,Imt],(function(){return mdt.Cone})),m(Nmt.prototype,"shapeType",[Mmt],Object.getOwnPropertyDescriptor(Nmt.prototype,"shapeType"),Nmt.prototype),Vmt=fa(Nmt.prototype,"emitFrom",[Pmt,Ma],(function(){return gdt.Volume})),Gmt=fa(Nmt.prototype,"alignToDirection",[Ma],(function(){return!1})),Umt=fa(Nmt.prototype,"randomDirectionAmount",[Ma],(function(){return 0})),zmt=fa(Nmt.prototype,"sphericalDirectionAmount",[Ma],(function(){return 0})),Hmt=fa(Nmt.prototype,"randomPositionAmount",[Ma],(function(){return 0})),Wmt=fa(Nmt.prototype,"radius",[Ma],(function(){return 1})),jmt=fa(Nmt.prototype,"radiusThickness",[Ma],(function(){return 1})),Xmt=fa(Nmt.prototype,"arcMode",[Bmt,Ma],(function(){return ydt.Random})),Ymt=fa(Nmt.prototype,"arcSpread",[Ma],(function(){return 0})),qmt=fa(Nmt.prototype,"arcSpeed",[Omt,Ma],(function(){return new vft})),Kmt=fa(Nmt.prototype,"length",[Ma],(function(){return 5})),Qmt=fa(Nmt.prototype,"boxThickness",[Ma],(function(){return new mn(0,0,0)})),Zmt=fa(Nmt.prototype,"_position",[Ma],(function(){return new mn(0,0,0)})),Jmt=fa(Nmt.prototype,"_rotation",[Ma],(function(){return new mn(0,0,0)})),$mt=fa(Nmt.prototype,"_scale",[Ma],(function(){return new mn(1,1,1)})),tgt=fa(Nmt.prototype,"_arc",[Ma],(function(){return Vi(360)})),egt=fa(Nmt.prototype,"_angle",[Ma],(function(){return Vi(25)})),Lmt=Nmt))||Lmt);function ggt(t,e){e.x>0&&(t[0]+=.5*Hi(-e.x,e.x),t[0]=Ni(t[0],-.5,.5)),e.y>0&&(t[1]+=.5*Hi(-e.y,e.y),t[1]=Ni(t[1],-.5,.5)),e.z>0&&(t[2]+=.5*Hi(-e.z,e.z),t[2]=Ni(t[2],-.5,.5))}var ygt=[0,0,1,0,0,1,1,1],vgt=[0,0,0,1,0,0,0,1,0,1,1,0],Sgt=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=xD.PARTICLE_BATCH,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,nd.gfxDevice.hasFeature(Sc.INSTANCED_ARRAYS)?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=f(this._vertAttrs);!(i=n()).done;){var r=i.value;r.offset=this._vertAttribSize,this._vertAttribSize+=ff[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=f(this._vertAttrs);!(i=n()).done;){var r=i.value;0===r.stream?(r.offset=this._vertAttribSize,this._vertAttribSize+=ff[r.format].size):1===r.stream&&(r.offset=this._vertAttribSizeStatic,this._vertAttribSizeStatic+=ff[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 E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,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 t.name===a_.ATTR_TEX_COORD}))].offset;this._mesh.copyAttribute(0,a_.ATTR_TEX_COORD,e,this._vertAttribSize,i);var n=this._vertAttrs.findIndex((function(t){return t.name===a_.ATTR_TEX_COORD3}));if(i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,a_.ATTR_POSITION,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,this._mesh.copyAttribute(0,a_.ATTR_NORMAL,e,this._vertAttribSize,i),i=this._vertAttrs[n++].offset,!this._mesh.copyAttribute(0,a_.ATTR_COLOR,e,this._vertAttribSize,i))for(var r=new Uint32Array(e),s=0;s<this._vertCount;++s)r[s*this._vertAttrsFloatCount+i/4]=bn.toUint32(bn.WHITE);for(var o=new Float32Array(e),a=1;a<this._capacity;a++)o.copyWithin(a*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,_=0;_<this._capacity;++_){var f=4*_;h[c++]=f,h[c++]=f+1,h[c++]=f+2,h[c++]=f+3,h[c++]=f+2,h[c++]=f+1}var d=this._device.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,this._bufferSize*this._indexCount*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));return d.update(h),this._iaVertCount=this._capacity*this._vertCount,this._iaIndexCount=this._capacity*this._indexCount,this._subMeshData=new jI([t],this._vertAttrs,Yc.TRIANGLE_LIST,d),this.initSubModel(0,this._subMeshData,this._material),e},i.createSubMeshDataInsDynamic=function(){this._insBuffers.length=0,this.destroySubMeshData();var t=this._device.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,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 E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,this._vertAttribSizeStatic*this._vertCount,this._vertAttribSizeStatic)),e=new ArrayBuffer(this._vertAttribSizeStatic*this._vertCount);if(this._mesh){var i=this._vertAttrs.findIndex((function(t){return t.name===a_.ATTR_TEX_COORD})),n=this._vertAttrs[i].offset;if(this._mesh.copyAttribute(0,a_.ATTR_TEX_COORD,e,this._vertAttribSizeStatic,n),i=this._vertAttrs.findIndex((function(t){return t.name===a_.ATTR_TEX_COORD3})),n=this._vertAttrs[i++].offset,this._mesh.copyAttribute(0,a_.ATTR_POSITION,e,this._vertAttribSizeStatic,n),n=this._vertAttrs[i++].offset,this._mesh.copyAttribute(0,a_.ATTR_NORMAL,e,this._vertAttribSizeStatic,n),n=this._vertAttrs[i++].offset,!this._mesh.copyAttribute(0,a_.ATTR_COLOR,e,this._vertAttribSizeStatic,n))for(var r=new Uint32Array(e),s=0;s<this._vertCount;++s)r[s*this._vertStaticAttrsFloatCount+n/4]=bn.toUint32(bn.WHITE)}else for(var o=new Float32Array(e),a=0;a<vgt.length;++a)o[a]=vgt[a];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 E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,this._indexCount*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));u.update(h),this._insIndices=u,this._iaVertCount=this._vertCount,this._iaIndexCount=this._indexCount,this._insBuffers.push(t)},i.createInsSubmesh=function(){this._subMeshData=new jI(this._insBuffers,this._vertAttrs,Yc.TRIANGLE_LIST,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++]=ygt[2*r],this._vdataF32[s++]=t.rotation.x,this._vdataF32[s++]=t.rotation.y,this._vdataF32[s++]=t.rotation.z,this._vdataF32[s++]=ygt[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,o=0,a=0;a<t;++a)r=a*n,s=this._vdataF32[r+this._startTimeOffset],this._vdataF32[r+this._lifeTimeOffset]-(e-s)<i&&(o=--t*n,this._vdataF32.copyWithin(r,o,o+n),a--);return t},i.updateGPUParticlesIns=function(t,e,i){for(var n=this._vertAttrsFloatCount,r=0,s=0,o=0,a=0;a<t;++a)r=a*n,s=this._vdataF32[r+this._startTimeOffset],this._vdataF32[r+this._lifeTimeOffset]-(e-s)<i&&(o=--t*n,this._vdataF32.copyWithin(r,o,o+n),a--);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}(ND),Agt=function(){function t(t){this._particleSystem=null,this._model=null,this._renderInfo=null,this._vertAttrs=[],this._useInstance=void 0,this._renderInfo=t,nd.gfxDevice.hasFeature(Sc.INSTANCED_ARRAYS)?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&&(v.director.root.destroyModel(this._model),this._model=null)},e.attachToScene=function(){var t;this._model&&(this._model.scene&&this.detachFromScene(),null===(t=this._particleSystem)||void 0===t||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(this._renderInfo.renderMode===pdt.Mesh?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=v.director.root.createModel(Sgt),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}(),Tgt=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 mn,this.noiseSpeed=new mn,this.noiseFrequency=0,this.noiseAbs=new mn,this.noiseAmplitude=new mn,this.octaves=new mn,this.dt=0,this.point=new mn,this.result=new mn,this.mixOut=new jn,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),o=0;o<256;o++)s[256+o]=s[o]=this.permutation[o];var a=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),_=this.fade(i),f=s[a]+h,d=s[f]+u,p=s[f+1]+u,m=s[a+1]+h,g=s[m]+u,y=s[m+1]+u;return n+this.scale(this.lerp(_,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,o=r<4?i:12===r||14===r?e:n;return(0==(1&r)?s:-s)+(0==(2&r)?o:-o)},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,o){var a=s,h=0;if(h+=this.noise(t*a,e*a,i*a,-1,1),1===o.x)return h;for(var u=1,l=1,c=1;c<o.x;++c)u*=o.y,a*=o.z,l+=u,h+=this.noise(t*a,e*a,i*a,-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,o=(n-.5*i)/i+this.noiseSpeed.y*this.dt,a=this.getNoise(s,o,0,this.dt,this.accSpeed,this.noiseFrequency,this.octaves);t[n*e+r]=.5*(a+1)}},t}(),bgt=new ln,Egt=new mn,Cgt=new Vn,xgt=new Vn,wgt=new In;new mn;var Dgt=["_colorOverLifetimeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule","_noiseModule"],Rgt=[0,0,1,0,0,1,1,1],Igt=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD2,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0)],Mgt=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD2,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0),new U_(a_.ATTR_COLOR1,Ac.RGB32F)],Pgt=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD2,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0),new U_(a_.ATTR_TEX_COORD3,Ac.RGB32F),new U_(a_.ATTR_NORMAL,Ac.RGB32F),new U_(a_.ATTR_COLOR1,Ac.RGBA8,!0)],Bgt=[new U_(a_.ATTR_TEX_COORD4,Ac.RGBA32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD2,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0,0,!0),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F,!1,1)],Ogt=[new U_(a_.ATTR_TEX_COORD4,Ac.RGBA32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD2,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0,0,!0),new U_(a_.ATTR_COLOR1,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F,!1,1)],Lgt=[new U_(a_.ATTR_TEX_COORD4,Ac.RGBA32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD2,Ac.RGB32F,!1,0,!0),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0,0,!0),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F,!1,1),new U_(a_.ATTR_TEX_COORD3,Ac.RGB32F,!1,1),new U_(a_.ATTR_NORMAL,Ac.RGB32F,!1,1),new U_(a_.ATTR_COLOR1,Ac.RGBA8,!0,1)],Ngt={parent:null,owner:null,subModelIdx:0},Fgt=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=new mn,this.texcoord=new mn,this.size=new mn,this.rotation=new mn,this.color=0,this.velocity=null},kgt=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=new Array,i._fillDataFunc=null,i._uScaleHandle=0,i._uLenHandle=0,i._uNodeRotHandle=0,i._alignSpace=ddt.View,i._inited=!1,i._localMat=new Vn,i._gravity=new ln,i.noise=new Tgt,i._model=null,i._frameTile_velLenScale=new ln(1,1,0,0),i._tmp_velLenScale=i._frameTile_velLenScale.clone(),i._node_scale=new mn,i._particleVertexData=new Fgt,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 Ks((function(){return new Zft(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)||void 0===e||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;Dgt.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=udt.length;e<i;e++){var n=this._animateList.get(udt[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=udt.length;n<r;n++){var s=this._animateList.get(udt[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(this._renderInfo.renderMode===pdt.Mesh||this._alignSpace!==ddt.View){var e;if(this._alignSpace===ddt.Local)null===(e=this._particleSystem)||void 0===e||e.node.getRotation(wgt);else if(this._alignSpace===ddt.World){var i;null===(i=this._particleSystem)||void 0===i||i.node.getWorldRotation(wgt)}else if(this._alignSpace===ddt.View){var n,r;wgt.set(0,0,0,1);var s=null===(n=this._particleSystem)||void 0===n||null===(r=n.node.scene.renderScene)||void 0===r?void 0:r.cameras;if(void 0!==s)for(var o=0;o<(null==s?void 0:s.length);++o){var a=s[o];if((a.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){In.fromViewUp(wgt,a.forward);break}}}else wgt.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,wgt)}},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?void 0:e.scaleSpace){case _dt.Local:null===(i=this._particleSystem)||void 0===i||i.node.getScale(r);break;case _dt.World:null===(n=this._particleSystem)||void 0===n||n.node.getWorldScale(r)}t.setUniform(this._uScaleHandle,bgt.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(Cgt);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 o=!i.gravityModifier.isZero();if(o){if(i.simulationSpace===_dt.Local){var a=i.node.getRotation();Vn.fromQuat(this._localMat,a),this._localMat.transpose()}if(i.node.parent){var h=i.node.parent.getWorldRotation();Vn.fromQuat(xgt,h),xgt.transpose()}}for(var u=function(n){var a=e._particles.data[n];if(a.remainingLifetime-=t,mn.set(a.animatedVelocity,0,0,0),a.remainingLifetime<0)return s&&r.removeParticle(a),e._particles.removeAt(n),--n,l=n,1;if(o){var h=Rdt(i.gravityModifier)?ji(a.randomSeed):0;if(i.simulationSpace===_dt.Local){var u=1-a.remainingLifetime/a.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,Li(c,0,Bi)||(i.node.parent&&(e._gravity=e._gravity.transformMat4(xgt)),e._gravity=e._gravity.transformMat4(e._localMat),a.velocity.x+=e._gravity.x,a.velocity.y+=e._gravity.y,a.velocity.z+=e._gravity.z)}else a.velocity.y-=9.8*i.gravityModifier.evaluate(1-a.remainingLifetime/a.startLifetime,h)*t}mn.copy(a.ultimateVelocity,a.velocity),e._runAnimateList.forEach((function(e){e.animate(a,t)})),mn.scaleAndAdd(a.position,a.position,a.ultimateVelocity,t),s&&r.animate(a,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===hdt&&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(){this._renderInfo.renderMode===pdt.Mesh?this._fillDataFunc=this._fillMeshData:this._renderInfo.renderMode===pdt.StrecthedBillboard?this._fillDataFunc=this._fillStrecthedData:this._fillDataFunc=this._fillNormalData},i._fillMeshData=function(t,e,i){var n=e/4;mn.copy(this._particleVertexData.position,t.position),Egt.z=i,mn.copy(this._particleVertexData.texcoord,Egt),mn.copy(this._particleVertexData.size,t.size),mn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=bn.toUint32(t.color),this._model.addParticleVertexData(n,this._particleVertexData)},i._fillStrecthedData=function(t,e,i){if(this._useInstance)this._fillStrecthedDataIns(t,e,i);else for(var n=0;n<4;++n)mn.copy(this._particleVertexData.position,t.position),Egt.x=Rgt[2*n],Egt.y=Rgt[2*n+1],Egt.z=i,mn.copy(this._particleVertexData.texcoord,Egt),mn.copy(this._particleVertexData.size,t.size),mn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=bn.toUint32(t.color),this._particleVertexData.velocity=t.ultimateVelocity,this._model.addParticleVertexData(e++,this._particleVertexData)},i._fillStrecthedDataIns=function(t,e,i){var n=e/4;mn.copy(this._particleVertexData.position,t.position),Egt.z=i,mn.copy(this._particleVertexData.texcoord,Egt),mn.copy(this._particleVertexData.size,t.size),mn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=bn.toUint32(t.color),this._particleVertexData.velocity=t.ultimateVelocity,this._model.addParticleVertexData(n,this._particleVertexData)},i._fillNormalData=function(t,e,i){if(this._useInstance)this._fillNormalDataIns(t,e,i);else for(var n=0;n<4;++n)mn.copy(this._particleVertexData.position,t.position),Egt.x=Rgt[2*n],Egt.y=Rgt[2*n+1],Egt.z=i,mn.copy(this._particleVertexData.texcoord,Egt),mn.copy(this._particleVertexData.size,t.size),mn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=bn.toUint32(t.color),this._model.addParticleVertexData(e++,this._particleVertexData)},i._fillNormalDataIns=function(t,e,i){var n=e/4;mn.copy(this._particleVertexData.position,t.position),Egt.z=i,mn.copy(this._particleVertexData.texcoord,Egt),mn.copy(this._particleVertexData.size,t.size),mn.copy(this._particleVertexData.rotation,t.rotation),this._particleVertexData.color=bn.toUint32(t.color),this._model.addParticleVertexData(n,this._particleVertexData)},i.updateVertexAttrib=function(){if(this._renderInfo.renderMode===pdt.Mesh&&this._renderInfo.mesh){var t=this._renderInfo.mesh.readAttributeFormat(0,a_.ATTR_COLOR);if(t){for(var e=Ac.RGBA8,i=0;i<ff.length;++i)if(ff[i].name===t.name){e=i;break}this._vertAttrs[7]=new U_(a_.ATTR_COLOR1,e,!0,this._useInstance?1:0)}else{var n=Ac.RGBA8;this._vertAttrs[7]=new U_(a_.ATTR_COLOR1,n,!0,this._useInstance?1:0)}}},i._setVertexAttrib=function(){if(this._useInstance)this._setVertexAttribIns();else switch(this._renderInfo.renderMode){case pdt.StrecthedBillboard:this._vertAttrs=Mgt.slice();break;case pdt.Mesh:this._vertAttrs=Pgt.slice();break;default:this._vertAttrs=Igt.slice()}},i._setVertexAttribIns=function(){switch(this._renderInfo.renderMode){case pdt.StrecthedBillboard:this._vertAttrs=Ogt.slice();break;case pdt.Mesh:this._vertAttrs=Lgt.slice();break;default:this._vertAttrs=Bgt.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&&(Ngt.parent=UA.get("default-particle-material"),Ngt.owner=this._particleSystem,Ngt.subModelIdx=0,this._defaultMat=new pT(Ngt),Ngt.parent=null,Ngt.owner=null,Ngt.subModelIdx=0,null!==this._renderInfo.mainTexture&&this._defaultMat.setProperty("mainTexture",this._renderInfo.mainTexture));var i=t.getMaterialInstance(0)||this._defaultMat;t.simulationSpace===_dt.World?this._defines.CC_USE_WORLD_SPACE=!0:this._defines.CC_USE_WORLD_SPACE=!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;r===pdt.Billboard?this._defines.CC_RENDER_MODE=0:r===pdt.StrecthedBillboard?(this._defines.CC_RENDER_MODE=1,s.z=this._renderInfo.velocityScale,s.w=this._renderInfo.lengthScale):r===pdt.HorizontalBillboard?this._defines.CC_RENDER_MODE=2:r===pdt.VerticalBillboard?this._defines.CC_RENDER_MODE=3:r===pdt.Mesh?this._defines.CC_RENDER_MODE=4:U("particle system renderMode "+r+" not support.");var o=t._textureAnimationModule;o&&o.enable?(ln.copy(this._tmp_velLenScale,s),jn.set(this._tmp_velLenScale,o.numTilesX,o.numTilesY),n.setUniform(this._uLenHandle,this._tmp_velLenScale)):n.setUniform(this._uLenHandle,s);var a,h=this._particleSystem._rotationOvertimeModule;a=!!h&&h.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=a,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){t.simulationSpace===_dt.World||e.space===_dt.World?this._trailDefines.CC_USE_WORLD_SPACE=!0:this._trailDefines.CC_USE_WORLD_SPACE=!1;var i=t.getMaterialInstance(1);null===i&&null===this._defaultTrailMat&&(Ngt.parent=UA.get("default-trail-material"),Ngt.owner=this._particleSystem,Ngt.subModelIdx=1,this._defaultTrailMat=new pT(Ngt),Ngt.parent=null,Ngt.owner=null,Ngt.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}(Agt),Vgt=new ln,Ggt=new Vn,Ugt=new ln,zgt=new In,Hgt=new In;new mn;var Wgt,jgt,Xgt,Ygt,qgt,Kgt,Qgt,Zgt,Jgt,$gt,tyt,eyt,iyt,nyt,ryt,syt,oyt,ayt,hyt,uyt,lyt,cyt=32,_yt="a_position_starttime",fyt="a_size_uv",dyt="a_rotation_uv",pyt="a_color",myt="a_dir_life",gyt="a_rndSeed",yyt="a_size_fid",vyt="a_rotation",Syt=[new U_(_yt,Ac.RGBA32F),new U_(fyt,Ac.RGBA32F),new U_(dyt,Ac.RGBA32F),new U_(pyt,Ac.RGBA32F),new U_(myt,Ac.RGBA32F),new U_(gyt,Ac.R32F)],Ayt=[new U_(_yt,Ac.RGBA32F),new U_(fyt,Ac.RGBA32F),new U_(dyt,Ac.RGBA32F),new U_(pyt,Ac.RGBA32F),new U_(myt,Ac.RGBA32F),new U_(gyt,Ac.R32F),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD3,Ac.RGB32F),new U_(a_.ATTR_NORMAL,Ac.RGB32F),new U_(a_.ATTR_COLOR1,Ac.RGBA8,!0)],Tyt=[new U_(_yt,Ac.RGBA32F,!1,0,!0),new U_(yyt,Ac.RGBA32F,!1,0,!0),new U_(vyt,Ac.RGB32F,!1,0,!0),new U_(pyt,Ac.RGBA32F,!1,0,!0),new U_(myt,Ac.RGBA32F,!1,0,!0),new U_(gyt,Ac.R32F,!1,0,!0),new U_("a_uv",Ac.RGB32F,!1,1)],byt=[new U_(_yt,Ac.RGBA32F,!1,0,!0),new U_(yyt,Ac.RGBA32F,!1,0,!0),new U_(vyt,Ac.RGB32F,!1,0,!0),new U_(pyt,Ac.RGBA32F,!1,0,!0),new U_(myt,Ac.RGBA32F,!1,0,!0),new U_(gyt,Ac.R32F,!1,0,!0),new U_(a_.ATTR_TEX_COORD,Ac.RGB32F,!1,1),new U_(a_.ATTR_TEX_COORD3,Ac.RGB32F,!1,1),new U_(a_.ATTR_NORMAL,Ac.RGB32F,!1,1),new U_(a_.ATTR_COLOR1,Ac.RGBA8,!0,1)],Eyt={parent:null,owner:null,subModelIdx:0},Cyt=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=ddt.View,i._inited=!1,i._frameTile_velLenScale=new ln(1,1,0,0),i._unifrom_velLenScale=i._frameTile_velLenScale.clone(),i._tmp_velLenScale=i._frameTile_velLenScale.clone(),i._node_scale=new mn,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 Zft(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?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?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(this._renderInfo.renderMode===pdt.Mesh||this._alignSpace!==ddt.View){var e;if(this._alignSpace===ddt.Local)null===(e=this._particleSystem)||void 0===e||e.node.getRotation(Hgt);else if(this._alignSpace===ddt.World){var i;null===(i=this._particleSystem)||void 0===i||i.node.getWorldRotation(Hgt)}else if(this._alignSpace===ddt.View){var n,r;Hgt.set(0,0,0,1);var s=null===(n=this._particleSystem)||void 0===n||null===(r=n.node.scene.renderScene)||void 0===r?void 0:r.cameras;if(void 0!==s&&this._particleSystem)for(var o=0;o<(null==s?void 0:s.length);++o){var a=s[o];if((a.visibility&this._particleSystem.node.layer)===this._particleSystem.node.layer){In.fromViewUp(Hgt,a.forward);break}}}else Hgt.set(0,0,0,1);t.setUniform(this._uNodeRotHandle,Hgt)}},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?void 0:e.scaleSpace){case _dt.Local:this._particleSystem.node.getScale(i);break;case _dt.World:this._particleSystem.node.getWorldScale(i)}t.setUniform(t.getHandle("scale"),Vgt.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];Ugt.x=this._particleSystem.time,Ugt.y=t,i.setUniform(this._uTimeHandle,Ugt),this._particleSystem.node.getWorldRotation(zgt),i.setUniform(this._uRotHandle,zgt),this.doUpdateRotation(i)}}},i.initShaderUniform=function(t){var e,i,n,r,s,o,a=t.passes[0];this._uTimeHandle=a.getHandle("u_timeDelta"),this._uRotHandle=a.getHandle("u_worldRot"),this._uNodeRotHandle=a.getHandle("nodeRotation"),this.doUpdateScale(a),a.setUniform(a.getHandle("frameTile_velLenScale"),this._unifrom_velLenScale),Ugt.x=cyt,Ugt.y=.03125,a.setUniform(a.getHandle("u_sampleInfo"),Ugt);var h=!1,u=null===(e=this._particleSystem)||void 0===e?void 0:e._forceOvertimeModule;if(h=!!u&&u.enable,this._defines.FORCE_OVER_TIME_MODULE_ENABLE=h,h){var l=bft(this._forceTexture,this._forceData,cyt,u.x,u.y,u.z);this._forceTexture=l.texture,this._forceData=l.texdata;var c=a.getHandle("force_over_time_tex0"),_=YA.getBindingFromHandle(c);a.bindSampler(_,this._forceTexture.getGFXSampler()),a.bindTexture(_,this._forceTexture.getGFXTexture());var f=a.getHandle("u_force_space");a.setUniform(f,u.space);var d=a.getHandle("u_force_mode");a.setUniform(d,this._forceTexture.height)}var p=null===(i=this._particleSystem)||void 0===i?void 0:i._velocityOvertimeModule;if(h=!!p&&p.enable,this._defines.VELOCITY_OVER_TIME_MODULE_ENABLE=h,h){var m=function(t,e,i,n,r,s,o){var a=Math.max(Aft(n),Aft(r),Aft(s),Aft(o)),h=i*a*4;null!==e&&e.length===h||(e=new Float32Array(i*a*4));for(var u=[n,r,s,o],l=0;l<a;l++)for(var c=0;c<4;c++)for(var _=u[c],f=0,d=0,p=0;p<i;p++){var m=Sft(_,.03225806451612903*p,l);d=(f+=m)/(p+1),e[4*(l*i+p)+c]=d}return{texture:Tft(t,e,i,a),texdata:e}}(this._velocityTexture,this._velocityData,cyt,p.x,p.y,p.z,p.speedModifier);this._velocityTexture=m.texture,this._velocityData=m.texdata;var g=a.getHandle("velocity_over_time_tex0"),y=YA.getBindingFromHandle(g);a.bindSampler(y,this._velocityTexture.getGFXSampler()),a.bindTexture(y,this._velocityTexture.getGFXTexture());var v=a.getHandle("u_velocity_space");a.setUniform(v,p.space);var S=a.getHandle("u_velocity_mode");a.setUniform(S,this._velocityTexture.height)}var A=null===(n=this._particleSystem)||void 0===n?void 0:n._colorOverLifetimeModule;if(h=!!A&&A.enable,this._defines.COLOR_OVER_TIME_MODULE_ENABLE=h,h){var T=function(t,e,i,n){var r=function(t){switch(t.mode){case Wft.TwoColors:case Wft.TwoGradients:return 2;default:return 1}}(n),s=i*r*4;null!==e&&e.length===s||(e=new Uint8Array(i*r*4));for(var o=1/(i-1),a=0,h=0;h<r;h++)for(var u=0;u<i;u++){var l=qft(n,o*u,h);e[a]=l.r,e[a+1]=l.g,e[a+2]=l.b,e[a+3]=l.a,a+=4}return null!==t&&i===t.width&&r===t.height||(t&&t.destroy(),(t=new Dm).create(i,r,kd.RGBA8888),t.setFilters(Gd.LINEAR,Gd.LINEAR),t.setWrapMode(Vd.CLAMP_TO_EDGE,Vd.CLAMP_TO_EDGE)),t.uploadData(e),{texture:t,texdata:e}}(this._colorTexture,this._colorData,cyt,A.color);this._colorTexture=T.texture,this._colorData=T.texdata;var b=a.getHandle("color_over_time_tex0"),E=YA.getBindingFromHandle(b);a.bindSampler(E,this._colorTexture.getGFXSampler()),a.bindTexture(E,this._colorTexture.getGFXTexture());var C=a.getHandle("u_color_mode");a.setUniform(C,this._colorTexture.height)}var x,w=null===(r=this._particleSystem)||void 0===r?void 0:r._rotationOvertimeModule;if(h=!!w&&w.enable,this._defines.ROTATION_OVER_TIME_MODULE_ENABLE=h,h&&(x=w.separateAxes?bft(this._rotationTexture,this._rotationData,cyt,w.x,w.y,w.z):function(t,e,i,n){var r=Aft(n),s=128*r;null!==e&&e.length===s||(e=new Float32Array(128*r));for(var o=0,a=0;a<r;a++)for(var h=0;h<32;h++){var u=Sft(n,.03225806451612903*h,a);e[o+2]=u,o+=4}return{texture:Tft(t,e,32,r),texdata:e}}(this._rotationTexture,this._rotationData,0,w.z),this._rotationTexture=x.texture,this._rotationData=x.texdata,this._rotationTexture)){var D=a.getHandle("rotation_over_time_tex0"),R=YA.getBindingFromHandle(D);a.bindSampler(R,this._rotationTexture.getGFXSampler()),a.bindTexture(R,this._rotationTexture.getGFXTexture());var I=a.getHandle("u_rotation_mode");a.setUniform(I,this._rotationTexture.height)}var M,P=null===(s=this._particleSystem)||void 0===s?void 0:s._sizeOvertimeModule;if(h=!!P&&P.enable,this._defines.SIZE_OVER_TIME_MODULE_ENABLE=h,h&&(M=P.separateAxes?bft(this._sizeTexture,this._sizeData,cyt,P.x,P.y,P.z,!0):function(t,e,i,n){var r=Aft(n),s=128*r;null!==e&&e.length===s||(e=new Float32Array(128*r));for(var o=0,a=0,h=0;h<r;h++){0;for(var u=0;u<32;u++){var l=Sft(n,.03225806451612903*u,h);o=l,e[a]=o,e[a+1]=o,e[a+2]=o,a+=4}}return{texture:Tft(t,e,32,r),texdata:e}}(this._sizeTexture,this._sizeData,0,P.size),this._sizeTexture=M.texture,this._sizeData=M.texdata,this._sizeTexture)){var B=a.getHandle("size_over_time_tex0"),O=YA.getBindingFromHandle(B);a.bindSampler(O,this._sizeTexture.getGFXSampler()),a.bindTexture(O,this._sizeTexture.getGFXTexture());var L=a.getHandle("u_size_mode");a.setUniform(L,this._sizeTexture.height)}var N=null===(o=this._particleSystem)||void 0===o?void 0:o._textureAnimationModule;if(h=!!N&&N.enable,this._defines.TEXTURE_ANIMATION_MODULE_ENABLE=h,h){var F=function(t,e,i,n,r){var s=Math.max(Aft(n),Aft(r)),o=i*s*4;null!==e&&e.length===o||(e=new Float32Array(i*s*4));for(var a=[n,r],h=0;h<s;h++)for(var u=0;u<2;u++)for(var l=a[u],c=0,_=0;_<i;_++){var f=Sft(l,.03225806451612903*_,h);c=f,e[4*(h*i+_)+u]=c}return{texture:Tft(t,e,i,s),texdata:e}}(this._animTexture,this._animData,cyt,N.startFrame,N.frameOverTime);this._animTexture=F.texture,this._animData=F.texdata;var k=a.getHandle("texture_animation_tex0"),V=YA.getBindingFromHandle(k);a.bindSampler(V,this._animTexture.getGFXSampler()),a.bindTexture(V,this._animTexture.getGFXTexture());var G=a.getHandle("u_anim_info");Ugt.x=this._animTexture.height,Ugt.y=N.numTilesX*N.numTilesY,Ugt.z=N.cycleCount,a.setUniform(G,Ugt)}this._defines.USE_VK_SHADER=nd.gfxDevice.gfxAPI===yc.VULKAN,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(this._renderInfo.renderMode===pdt.Mesh&&this._renderInfo.mesh){var t=this._renderInfo.mesh.readAttributeFormat(0,a_.ATTR_COLOR);if(t){for(var e=Ac.RGBA8,i=0;i<ff.length;++i)if(ff[i].name===t.name){e=i;break}this._vertAttrs[9]=new U_(a_.ATTR_COLOR1,e,!0,this._useInstance?1:0)}else{var n=Ac.RGBA8;this._vertAttrs[9]=new U_(a_.ATTR_COLOR1,n,!0,this._useInstance?1:0)}}},i._setVertexAttrib=function(){if(this._useInstance)this._setVertexAttribIns();else switch(this._renderInfo.renderMode){case pdt.StrecthedBillboard:this._vertAttrs=Syt.slice();break;case pdt.Mesh:this._vertAttrs=Ayt.slice();break;default:this._vertAttrs=Syt.slice()}},i._setVertexAttribIns=function(){switch(this._renderInfo.renderMode){case pdt.StrecthedBillboard:this._vertAttrs=Tyt.slice();break;case pdt.Mesh:this._vertAttrs=byt.slice();break;default:this._vertAttrs=Tyt.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&&(Eyt.parent=UA.get("default-particle-gpu-material"),Eyt.owner=t,Eyt.subModelIdx=0,this._defaultMat=new pT(Eyt),Eyt.parent=null,Eyt.owner=null,Eyt.subModelIdx=0,null!==this._renderInfo.mainTexture&&this._defaultMat.setProperty("mainTexture",this._renderInfo.mainTexture));var i=t.getMaterialInstance(0)||this._defaultMat;t.node.getWorldMatrix(Ggt),t.simulationSpace===_dt.World?this._defines.CC_USE_WORLD_SPACE=!0:this._defines.CC_USE_WORLD_SPACE=!1;var n=this._renderInfo.renderMode;n===pdt.Billboard?this._defines.CC_RENDER_MODE=0:n===pdt.StrecthedBillboard?(this._defines.CC_RENDER_MODE=1,this._frameTile_velLenScale.z=this._renderInfo.velocityScale,this._frameTile_velLenScale.w=this._renderInfo.lengthScale):n===pdt.HorizontalBillboard?this._defines.CC_RENDER_MODE=2:n===pdt.VerticalBillboard?this._defines.CC_RENDER_MODE=3:n===pdt.Mesh?this._defines.CC_RENDER_MODE=4:U("particle system renderMode "+n+" not support.");var r=t._textureAnimationModule;r&&r.enable?(jn.set(this._frameTile_velLenScale,r.numTilesX,r.numTilesY),ln.copy(this._unifrom_velLenScale,this._frameTile_velLenScale)):(this._tmp_velLenScale.z=this._frameTile_velLenScale.z,this._tmp_velLenScale.w=this._frameTile_velLenScale.w,ln.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}(Agt);function xyt(){var t=FI.root.device;return!!(t.capabilities.maxVertexTextureUnits>=8&&t.getFormatFeatures(Ac.RGBA32F)&(Mc.RENDER_TARGET|Mc.SAMPLED_TEXTURE))||(v.warn("Maybe the device has restrictions on vertex textures or does not support float textures."),!1)}var wyt,Dyt,Ryt,Iyt,Myt,Pyt,Byt,Oyt,Lyt,Nyt,Fyt,kyt,Vyt,Gyt,Uyt,zyt,Hyt,Wyt,jyt,Xyt,Yyt,qyt,Kyt,Qyt,Zyt,Jyt,$yt,tvt,evt,ivt,nvt,rvt,svt,ovt,avt,hvt,uvt,lvt,cvt,_vt,fvt,dvt,pvt,mvt,gvt,yvt,vvt,Svt,Avt,Tvt,bvt,Evt,Cvt,xvt,wvt,Dvt,Rvt,Ivt,Mvt,Pvt,Bvt,Ovt,Lvt,Nvt,Fvt,kvt,Vvt,Gvt,Uvt,zvt,Hvt,Wvt,jvt,Xvt,Yvt,qvt,Kvt,Qvt,Zvt,Jvt,$vt,tSt,eSt,iSt,nSt,rSt,sSt,oSt,aSt,hSt,uSt,lSt,cSt,_St,fSt,dSt,pSt,mSt,gSt,ySt,vSt,SSt,ASt,TSt,bSt,ESt,CSt,xSt,wSt,DSt,RSt,ISt,MSt,PSt,BSt,OSt,LSt,NSt,FSt,kSt,VSt,GSt,USt,zSt,HSt,WSt,jSt,XSt,YSt,qSt,KSt,QSt,ZSt,JSt,$St,tAt,eAt,iAt,nAt,rAt,sAt,oAt,aAt,hAt,uAt,lAt=(Wgt=Ta("cc.ParticleSystemRenderer"),jgt=eh(pdt),Xgt=eh(pdt),Ygt=eh(rP),qgt=eh(oT),Kgt=eh(oT),Qgt=eh(oT),Zgt=eh(oT),Jgt=eh(ddt),Wgt(((lyt=function(){function t(){this._renderMode=eyt&&eyt(),this._velocityScale=iyt&&iyt(),this._lengthScale=nyt&&nyt(),this._mesh=ryt&&ryt(),this._cpuMaterial=syt&&syt(),this._gpuMaterial=oyt&&oyt(),this._mainTexture=ayt&&ayt(),this._useGPU=hyt&&hyt(),this._alignSpace=uyt&&uyt(),this._particleSystem=null}var e=t.prototype;return e.create=function(t){null===this._particleSystem?this._particleSystem=t:this._particleSystem!==t&&et(6033)},e.onInit=function(t){this.create(t);var e=this._useGPU&&xyt();this._particleSystem.processor?et(6034):(this._particleSystem.processor=e?new Cyt(this):new kgt(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,$(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&&xyt();!t&&this.cpuMaterial&&(this.particleMaterial=this.cpuMaterial),t&&this.gpuMaterial&&(this.particleMaterial=this.gpuMaterial),this._particleSystem.processor=t?new Cyt(this):new kgt(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(null!==t){var e=t.effectName;-1!==e.indexOf("particle")&&-1===e.indexOf("particle-gpu")?(this._cpuMaterial=t,this.particleMaterial=this._cpuMaterial):$(6035)}}},{key:"gpuMaterial",get:function(){return this._gpuMaterial},set:function(t){null!==t&&(-1!==t.effectName.indexOf("particle-gpu")?(this._gpuMaterial=t,this.particleMaterial=this._gpuMaterial):$(6035))}},{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&&(xyt()?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}()).AlignmentSpace=ddt,m((tyt=lyt).prototype,"renderMode",[jgt],Object.getOwnPropertyDescriptor(tyt.prototype,"renderMode"),tyt.prototype),eyt=fa(tyt.prototype,"_renderMode",[Xgt,Ma],(function(){return pdt.Billboard})),iyt=fa(tyt.prototype,"_velocityScale",[Ma],(function(){return 1})),nyt=fa(tyt.prototype,"_lengthScale",[Ma],(function(){return 1})),ryt=fa(tyt.prototype,"_mesh",[Ma],(function(){return null})),m(tyt.prototype,"mesh",[Ygt],Object.getOwnPropertyDescriptor(tyt.prototype,"mesh"),tyt.prototype),m(tyt.prototype,"particleMaterial",[qgt],Object.getOwnPropertyDescriptor(tyt.prototype,"particleMaterial"),tyt.prototype),m(tyt.prototype,"cpuMaterial",[Kgt],Object.getOwnPropertyDescriptor(tyt.prototype,"cpuMaterial"),tyt.prototype),syt=fa(tyt.prototype,"_cpuMaterial",[Ma],(function(){return null})),m(tyt.prototype,"gpuMaterial",[Qgt],Object.getOwnPropertyDescriptor(tyt.prototype,"gpuMaterial"),tyt.prototype),oyt=fa(tyt.prototype,"_gpuMaterial",[Ma],(function(){return null})),m(tyt.prototype,"trailMaterial",[Zgt],Object.getOwnPropertyDescriptor(tyt.prototype,"trailMaterial"),tyt.prototype),ayt=fa(tyt.prototype,"_mainTexture",[Ma],(function(){return null})),hyt=fa(tyt.prototype,"_useGPU",[Ma],(function(){return!1})),m(tyt.prototype,"alignSpace",[Jgt],Object.getOwnPropertyDescriptor(tyt.prototype,"alignSpace"),tyt.prototype),uyt=fa(tyt.prototype,"_alignSpace",[Ma],(function(){return ddt.View})),$gt=tyt))||$gt),cAt=Math.cos(Vi(100)),_At={position:new mn,velocity:new mn},fAt=new In,dAt=new mn,pAt=new mn,mAt=new bn,gAt=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 mn,lifetime:0,width:0,velocity:new mn,direction:0,color:new bn})}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 mn,lifetime:0,width:0,velocity:new mn,direction:0,color:new bn}),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}(),yAt=(wyt=Ta("cc.TrailModule"),Dyt=eh(vdt),Ryt=eh(vft),Iyt=eh(_dt),Myt=eh(Sdt),Pyt=eh(vft),Byt=eh(Yft),Oyt=eh(Yft),Lyt=eh(_dt),wyt((Fyt=function(){var t=e.prototype;function e(){this._enable=kyt&&kyt(),this.mode=Vyt&&Vyt(),this.lifeTime=Gyt&&Gyt(),this._minParticleDistance=Uyt&&Uyt(),this.existWithParticles=zyt&&zyt(),this.textureMode=Hyt&&Hyt(),this.widthFromParticle=Wyt&&Wyt(),this.widthRatio=jyt&&jyt(),this.colorFromParticle=Xyt&&Xyt(),this.colorOverTrail=Yyt&&Yyt(),this.colorOvertime=qyt&&qyt(),this._space=Kyt&&Kyt(),this._particleSystem=Qyt&&Qyt(),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 Vn,this._iaVertCount=0,this._iaIndexCount=0,this._inited=void 0,this._vertAttrs=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RGBA32F),new U_(a_.ATTR_TEX_COORD1,Ac.RGB32F),new U_(a_.ATTR_COLOR,Ac.RGBA8,!0)],this._vertSize=0;for(var t,e=f(this._vertAttrs);!(t=e()).done;){var i=t.value;this._vertSize+=ff[i.format].size}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,o=t.bursts.length;s<o;s++)e+=t.bursts[s].getMaxCount(t)*Math.ceil(i/r);this.lifeTime.getMax()<1&&$(6036),this._trailNum=Math.ceil(i*Math.ceil(this.lifeTime.getMax())*60*(n*r+e)),this._trailSegments=new qs((function(){return new gAt(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&&(FI.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._defaultTrailMat,this._trailModel&&this._trailModel.setSubModelMaterial(0,this._material))},t.update=function(){this._trailLifetime=this.lifeTime.evaluate(this._particleSystem.time,1),this.space===_dt.World&&this._particleSystem.simulationSpace===_dt.Local?(this._needTransform=!0,this._particleSystem.node.getWorldMatrix(this._psTransform),this._particleSystem.node.getWorldRotation(fAt)):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?mn.transformMat4(dAt,t.position,this._psTransform):mn.copy(dAt,t.position),!(n&&(i.iterateElement(this,this._updateTrailElement,t,e),mn.squaredDistance(n.position,dAt)<this._minSquaredDistance))&&(n=i.addElement())){mn.copy(n.position,dAt),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);mn.subtract(s.velocity,n.position,s.position)}else if(r>2){var o=i.getElement(i.end-2),a=i.getElement(i.end-3);mn.subtract(dAt,a.position,o.position),mn.subtract(pAt,n.position,o.position),mn.subtract(o.velocity,pAt,dAt),mn.equals(mn.ZERO,o.velocity)&&mn.copy(o.velocity,dAt),mn.normalize(o.velocity,o.velocity),this._checkDirectionReverse(o,a)}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=f(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,o=s-n.start,a=1/o,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/o,1),r,1-c*a,c,5)}this._needTransform?mn.transformMat4(_At.position,i.position,this._psTransform):mn.copy(_At.position,i.position);var _=this._trailModel;if(_&&_.node.invalidateChildren(Om.POSITION),1===o||2===o){var d=n.getElement(n.end-1);mn.subtract(d.velocity,_At.position,d.position),this._vbF32[this.vbOffset-this._vertSize/4-4]=d.velocity.x,this._vbF32[this.vbOffset-this._vertSize/4-3]=d.velocity.y,this._vbF32[this.vbOffset-this._vertSize/4-2]=d.velocity.z,this._vbF32[this.vbOffset-4]=d.velocity.x,this._vbF32[this.vbOffset-3]=d.velocity.y,this._vbF32[this.vbOffset-2]=d.velocity.z,mn.subtract(_At.velocity,_At.position,d.position),this._checkDirectionReverse(_At,d)}else if(o>2){var p=n.getElement(n.end-1),m=n.getElement(n.end-2);mn.subtract(dAt,m.position,p.position),mn.subtract(pAt,_At.position,p.position),mn.normalize(dAt,dAt),mn.normalize(pAt,pAt),mn.subtract(p.velocity,pAt,dAt),mn.normalize(p.velocity,p.velocity),this._checkDirectionReverse(p,m),this.vbOffset-=this._vertSize/4*2,this.ibOffset-=6,this._fillVertexBuffer(p,this.colorOverTrail.evaluate(a,1),r,a,o-1,5),mn.subtract(_At.velocity,_At.position,p.position),mn.normalize(_At.velocity,_At.velocity),this._checkDirectionReverse(_At,p)}this.widthFromParticle?_At.width=i.size.x*this.widthRatio.evaluate(0,1):_At.width=this.widthRatio.evaluate(0,1),_At.color=i.color,mn.equals(_At.velocity,mn.ZERO)?this.ibOffset-=3:this._fillVertexBuffer(_At,this.colorOverTrail.evaluate(0,1),r,0,o,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=v.director.root.createModel(ND))},t.rebuild=function(){var t=FI.root.device,e=t.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,this._vertSize*(this._trailNum+1)*2,this._vertSize)),i=new ArrayBuffer(this._vertSize*(this._trailNum+1)*2);this._vbF32=new Float32Array(i),this._vbUint32=new Uint32Array(i),e.update(i);var n=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.HOST|wc.DEVICE,6*Math.max(1,this._trailNum)*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT));this._iBuffer=new Uint16Array(6*Math.max(1,this._trailNum)),n.update(this._iBuffer),this._iaVertCount=2*(this._trailNum+1),this._iaIndexCount=6*this._trailNum,this._subMeshData=new jI([e],this._vertAttrs,Yc.TRIANGLE_LIST,n);var r=this._trailModel;r&&this._material&&(r.node=r.transform=this._particleSystem.node,r.visFlags=this._particleSystem.visibility,r.initSubModel(0,this._subMeshData,this._material),r.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,mAt.set(t.color),mAt.multiply(e),this._vbUint32[this.vbOffset++]=bn.toUint32(mAt),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++]=bn.toUint32(mAt),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){mn.dot(t.velocity,e.velocity)<cAt?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}(),kyt=fa(Fyt.prototype,"_enable",[Ma],(function(){return!1})),Vyt=fa(Fyt.prototype,"mode",[Dyt,Ma],(function(){return vdt.Particles})),Gyt=fa(Fyt.prototype,"lifeTime",[Ryt,Ma],(function(){return new vft})),Uyt=fa(Fyt.prototype,"_minParticleDistance",[Ma],(function(){return.1})),m(Fyt.prototype,"space",[Iyt],Object.getOwnPropertyDescriptor(Fyt.prototype,"space"),Fyt.prototype),zyt=fa(Fyt.prototype,"existWithParticles",[Ma],(function(){return!0})),Hyt=fa(Fyt.prototype,"textureMode",[Myt,Ma],(function(){return Sdt.Stretch})),Wyt=fa(Fyt.prototype,"widthFromParticle",[Ma],(function(){return!0})),jyt=fa(Fyt.prototype,"widthRatio",[Pyt,Ma],(function(){return new vft})),Xyt=fa(Fyt.prototype,"colorFromParticle",[Ma],(function(){return!1})),Yyt=fa(Fyt.prototype,"colorOverTrail",[Byt,Ma],(function(){return new Yft})),qyt=fa(Fyt.prototype,"colorOvertime",[Oyt,Ma],(function(){return new Yft})),Kyt=fa(Fyt.prototype,"_space",[Lyt],(function(){return _dt.World})),Qyt=fa(Fyt.prototype,"_particleSystem",[Ma],(function(){return null})),Nyt=Fyt))||Nyt),vAt=new Vn,SAt=new Vn,AAt=new In,TAt=new mn,bAt=["_colorOverLifetimeModule","_sizeOvertimeModule","_velocityOvertimeModule","_forceOvertimeModule","_limitVelocityOvertimeModule","_rotationOvertimeModule","_textureAnimationModule"],EAt=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=new Array,this._localMat=new Vn,this._gravity=new ln,this.minPos=new mn,this.maxPos=new mn,this._nodePos=new mn,this._nodeSize=new mn,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;bAt.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=udt.length;e<i;e++){var n=this._animateList.get(udt[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(Om.POSITION),n.simulationSpace===_dt.World&&(r.getWorldMatrix(vAt),r.getWorldRotation(AAt));for(var o=0;o<t;++o){var a=new Zft(n);a.particleSystem=n,a.reset();var h=ji(Wi(0,T));n._shapeModule&&n._shapeModule.enable?n._shapeModule.emit(a):(mn.set(a.position,0,0,0),mn.copy(a.velocity,Adt)),n._textureAnimationModule&&n._textureAnimationModule.enable&&n._textureAnimationModule.init(a);var u=n.startSpeed.evaluate(s,h);mn.multiplyScalar(a.velocity,a.velocity,u),n.simulationSpace===_dt.World&&(mn.transformMat4(a.position,a.position,vAt),mn.transformQuat(a.velocity,a.velocity,AAt)),mn.copy(a.ultimateVelocity,a.velocity),mn.set(a.rotation,0,0,0),n.startSize3D?mn.set(a.startSize,n.startSizeX.evaluate(s,h),n.startSizeY.evaluate(s,h),n.startSizeZ.evaluate(s,h)):(mn.set(a.startSize,n.startSizeX.evaluate(s,h),1,1),a.startSize.y=a.startSize.x),mn.copy(a.size,a.startSize),a.startLifetime=n.startLifetime.evaluate(s,h)+e,a.remainingLifetime=a.startLifetime,i.push(a)}},e._updateParticles=function(t,e){var i=this,n=this._particleSystem;switch(n.node.getWorldMatrix(vAt),n.scaleSpace){case _dt.Local:n.node.getScale(TAt);break;case _dt.World:n.node.getWorldScale(TAt)}if(this._updateList.forEach((function(){})),n.simulationSpace===_dt.Local){var r=n.node.getRotation();Vn.fromQuat(this._localMat,r),this._localMat.transpose()}n.node.parent&&(n.node.parent.getWorldMatrix(SAt),SAt.invert());for(var s=function(){var r=e[o];if(r.remainingLifetime-=t,mn.set(r.animatedVelocity,0,0,0),n.gravityModifier.mode!==yft.Constant||0!==n.gravityModifier.constant){var s=Rdt(n.gravityModifier)?ji(r.randomSeed):0;if(n.simulationSpace===_dt.Local){var a=9.8*-n.gravityModifier.evaluate(1-r.remainingLifetime/r.startLifetime,s)*t;i._gravity.x=0,i._gravity.y=a,i._gravity.z=0,i._gravity.w=1,Li(a,0,Bi)||(n.node.parent&&(i._gravity=i._gravity.transformMat4(SAt)),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}mn.copy(r.ultimateVelocity,r.velocity),i._runAnimateList.forEach((function(e){e.animate(r,t)})),mn.scaleAndAdd(r.position,r.position,r.ultimateVelocity,t)},o=0;o<e.length;++o)s()},e._calculateBounding=function(t){var e=new mn,i=new mn,n=new mn,r=new mn,s=new mn(1,1,1);if(this._processor.getInfo().renderMode===pdt.Mesh){var o=this._processor.getInfo().mesh;if(o&&o.struct.minPosition&&o.struct.maxPosition){var a=new Ko;Ko.fromPoints(a,o.struct.minPosition,o.struct.maxPosition);var h=Math.max(a.halfExtents.x,a.halfExtents.y,a.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];mn.multiply(e,TAt,c.size),mn.multiply(e,e,s),i.set(c.position),this._particleSystem.simulationSpace!==_dt.World&&mn.transformMat4(i,i,u),t&&0===l?(mn.subtract(this.minPos,i,e),mn.add(this.maxPos,i,e)):(mn.subtract(n,i,e),mn.add(r,i,e),mn.min(this.minPos,this.minPos,n),mn.max(this.maxPos,this.maxPos,r))}},e.calculatePositions=function(){this._emit(this._particleSystem.capacity,0,this._particlesAll);var t=Rdt(this._particleSystem.startLifetime)?ji(Wi(0,T)):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}(),CAt=Ma,xAt=eh,wAt=(Zyt=Ta("cc.NoiseModule"),Jyt=xAt(ii),$yt=xAt(ii),tvt=xAt(ii),evt=xAt(ii),ivt=xAt(ii),nvt=xAt(ii),rvt=xAt(ii),svt=xAt(ii),ovt=xAt(ii),avt=xAt(ii),hvt=xAt(ei),uvt=xAt(ii),lvt=xAt(ii),Zyt((_vt=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)._enable=fvt&&fvt(),e._strengthX=dvt&&dvt(),e._strengthY=pvt&&pvt(),e._strengthZ=mvt&&mvt(),e._noiseSpeedX=gvt&&gvt(),e._noiseSpeedY=yvt&&yvt(),e._noiseSpeedZ=vvt&&vvt(),e._noiseFrequency=Svt&&Svt(),e._remapX=Avt&&Avt(),e._remapY=Tvt&&Tvt(),e._remapZ=bvt&&bvt(),e._octaves=Evt&&Evt(),e._octaveMultiplier=Cvt&&Cvt(),e._octaveScale=xvt&&xvt(),e.name=hdt,e.noise=new Tgt,e.samplePosition=new mn,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*Ui(),1*Ui(),1*Ui()),this.noise.setSamplePoint(this.samplePosition),this.noise.getNoiseParticle();var i=this.noise.getResult();i.multiply3f(Ui(),Ui(),Ui()),mn.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}(cdt),fvt=fa(_vt.prototype,"_enable",[CAt],(function(){return!1})),m(_vt.prototype,"strengthX",[Jyt],Object.getOwnPropertyDescriptor(_vt.prototype,"strengthX"),_vt.prototype),dvt=fa(_vt.prototype,"_strengthX",[CAt],(function(){return 10})),m(_vt.prototype,"strengthY",[$yt],Object.getOwnPropertyDescriptor(_vt.prototype,"strengthY"),_vt.prototype),pvt=fa(_vt.prototype,"_strengthY",[CAt],(function(){return 10})),m(_vt.prototype,"strengthZ",[tvt],Object.getOwnPropertyDescriptor(_vt.prototype,"strengthZ"),_vt.prototype),mvt=fa(_vt.prototype,"_strengthZ",[CAt],(function(){return 10})),m(_vt.prototype,"noiseSpeedX",[evt],Object.getOwnPropertyDescriptor(_vt.prototype,"noiseSpeedX"),_vt.prototype),gvt=fa(_vt.prototype,"_noiseSpeedX",[CAt],(function(){return 0})),m(_vt.prototype,"noiseSpeedY",[ivt],Object.getOwnPropertyDescriptor(_vt.prototype,"noiseSpeedY"),_vt.prototype),yvt=fa(_vt.prototype,"_noiseSpeedY",[CAt],(function(){return 0})),m(_vt.prototype,"noiseSpeedZ",[nvt],Object.getOwnPropertyDescriptor(_vt.prototype,"noiseSpeedZ"),_vt.prototype),vvt=fa(_vt.prototype,"_noiseSpeedZ",[CAt],(function(){return 0})),m(_vt.prototype,"noiseFrequency",[rvt],Object.getOwnPropertyDescriptor(_vt.prototype,"noiseFrequency"),_vt.prototype),Svt=fa(_vt.prototype,"_noiseFrequency",[CAt],(function(){return 1})),m(_vt.prototype,"remapX",[svt],Object.getOwnPropertyDescriptor(_vt.prototype,"remapX"),_vt.prototype),Avt=fa(_vt.prototype,"_remapX",[CAt],(function(){return 0})),m(_vt.prototype,"remapY",[ovt],Object.getOwnPropertyDescriptor(_vt.prototype,"remapY"),_vt.prototype),Tvt=fa(_vt.prototype,"_remapY",[CAt],(function(){return 0})),m(_vt.prototype,"remapZ",[avt],Object.getOwnPropertyDescriptor(_vt.prototype,"remapZ"),_vt.prototype),bvt=fa(_vt.prototype,"_remapZ",[CAt],(function(){return 0})),m(_vt.prototype,"octaves",[hvt],Object.getOwnPropertyDescriptor(_vt.prototype,"octaves"),_vt.prototype),Evt=fa(_vt.prototype,"_octaves",[CAt],(function(){return 1})),m(_vt.prototype,"octaveMultiplier",[uvt],Object.getOwnPropertyDescriptor(_vt.prototype,"octaveMultiplier"),_vt.prototype),Cvt=fa(_vt.prototype,"_octaveMultiplier",[CAt],(function(){return.5})),m(_vt.prototype,"octaveScale",[lvt],Object.getOwnPropertyDescriptor(_vt.prototype,"octaveScale"),_vt.prototype),xvt=fa(_vt.prototype,"_octaveScale",[CAt],(function(){return 2})),cvt=_vt))||cvt),DAt=new Vn,RAt=new In,IAt=Object.getOwnPropertyDescriptor(ZO.prototype,"sharedMaterials"),MAt=t("eU",(wvt=Ta("cc.ParticleSystem"),Dvt=Ea(99),Rvt=eh(Yft),Ivt=eh(_dt),Mvt=Pa("startSize"),Pvt=eh(vft),Bvt=eh(vft),Ovt=eh(vft),Lvt=eh(vft),Nvt=eh(vft),Fvt=eh(vft),kvt=eh(vft),Vvt=Pa("startRotation"),Gvt=eh(vft),Uvt=eh(vft),zvt=eh(_dt),Hvt=eh(vft),Wvt=eh(vft),jvt=eh(vft),Xvt=eh([_gt]),Yvt=eh(ni),qvt=eh(fdt),Kvt=eh(ii),Qvt=eh(ii),Zvt=eh(ii),Jvt=Pa("enableCulling"),$vt=eh(ppt),tSt=eh(ppt),eSt=eh(mgt),iSt=eh(mgt),nSt=eh(sgt),rSt=eh(sgt),sSt=eh(cgt),oSt=eh(cgt),aSt=eh(ypt),hSt=eh(ypt),uSt=eh(Tpt),lSt=eh(Tpt),cSt=eh(ngt),_St=eh(ngt),fSt=eh(hgt),dSt=eh(hgt),pSt=eh(wAt),mSt=eh(wAt),gSt=eh(yAt),ySt=eh(yAt),vSt=eh(lAt),wvt(SSt=Dvt(((uAt=function(t){function e(){var e;return(e=t.call(this)||this).startColor=TSt&&TSt(),e.scaleSpace=bSt&&bSt(),e.startSize3D=ESt&&ESt(),e.startSizeX=CSt&&CSt(),e.startSizeY=xSt&&xSt(),e.startSizeZ=wSt&&wSt(),e.startSpeed=DSt&&DSt(),e.startRotation3D=RSt&&RSt(),e.startRotationX=ISt&&ISt(),e.startRotationY=MSt&&MSt(),e.startRotationZ=PSt&&PSt(),e.startDelay=BSt&&BSt(),e.startLifetime=OSt&&OSt(),e.duration=LSt&&LSt(),e.loop=NSt&&NSt(),e.simulationSpeed=FSt&&FSt(),e.playOnAwake=kSt&&kSt(),e.gravityModifier=VSt&&VSt(),e.rateOverTime=GSt&&GSt(),e.rateOverDistance=USt&&USt(),e.bursts=zSt&&zSt(),e._renderCulling=HSt&&HSt(),e._cullingMode=WSt&&WSt(),e._aabbHalfX=jSt&&jSt(),e._aabbHalfY=XSt&&XSt(),e._aabbHalfZ=YSt&&YSt(),e._dataCulling=qSt&&qSt(),e._colorOverLifetimeModule=KSt&&KSt(),e._shapeModule=QSt&&QSt(),e._sizeOvertimeModule=ZSt&&ZSt(),e._velocityOvertimeModule=JSt&&JSt(),e._forceOvertimeModule=$St&&$St(),e._limitVelocityOvertimeModule=tAt&&tAt(),e._rotationOvertimeModule=eAt&&eAt(),e._textureAnimationModule=iAt&&iAt(),e._noiseModule=nAt&&nAt(),e._trailModule=rAt&&rAt(),e.renderer=sAt&&sAt(),e._isPlaying=void 0,e._isPaused=void 0,e._isStopped=void 0,e._isEmitting=void 0,e._needToRestart=void 0,e._needRefresh=void 0,e._time=void 0,e._emitRateTimeCounter=void 0,e._emitRateDistanceCounter=void 0,e._oldWPos=void 0,e._curWPos=void 0,e._boundingBox=void 0,e._culler=void 0,e._oldPos=void 0,e._curPos=void 0,e._isCulled=void 0,e._isSimulating=void 0,e._customData1=void 0,e._customData2=void 0,e._subEmitters=void 0,e._needAttach=void 0,e._prewarm=oAt&&oAt(),e._capacity=aAt&&aAt(),e._simulationSpace=hAt&&hAt(),e.processor=null,e.rateOverTime.constant=10,e.startLifetime.constant=5,e.startSizeX.constant=1,e.startSpeed.constant=5,e._isPlaying=!1,e._isPaused=!1,e._isStopped=!0,e._isEmitting=!1,e._needToRestart=!1,e._needRefresh=!0,e._needAttach=!1,e._time=0,e._emitRateTimeCounter=0,e._emitRateDistanceCounter=0,e._oldWPos=new mn,e._curWPos=new mn,e._boundingBox=null,e._culler=null,e._oldPos=null,e._curPos=null,e._isCulled=!1,e._isSimulating=!0,e._customData1=new jn,e._customData2=new jn,e._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?U("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();for(var t,e=f(this.bursts);!(t=e()).done;)t.value.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){jn.set(this._customData1,t,e)},i.setCustomData2=function(t,e){jn.set(this._customData2,t,e)},i.onDestroy=function(){var t;this.stop(),null!==(t=this.processor.getModel())&&void 0!==t&&t.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene()),v.director.off(v.Director.EVENT_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),v.director.on(v.Director.EVENT_BEFORE_COMMIT,this.beforeRender,this),this.playOnAwake&&this.play(),this.processor.onEnable(),this._trailModule&&this._trailModule.onEnable()},i.onDisable=function(){v.director.off(v.Director.EVENT_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){this._boundingBox&&(this._culler||(this._culler=new EAt(this)),this._culler.calculatePositions(),Ko.fromPoints(this._boundingBox,this._culler.minPos,this._culler.maxPos),t?(this.aabbHalfX=this._boundingBox.halfExtents.x,this.aabbHalfY=this._boundingBox.halfExtents.y,this.aabbHalfZ=this._boundingBox.halfExtents.z):(this.aabbHalfX?this.setBoundingX(this.aabbHalfX):this.aabbHalfX=this._boundingBox.halfExtents.x,this.aabbHalfY?this.setBoundingY(this.aabbHalfY):this.aabbHalfY=this._boundingBox.halfExtents.y,this.aabbHalfZ?this.setBoundingZ(this.aabbHalfZ):this.aabbHalfZ=this._boundingBox.halfExtents.z),this._culler.clear())},i.update=function(t){var e,i,n=t*this.simulationSpeed;if(this.renderCulling){var r;if(this._boundingBox||(this._boundingBox=new Ko,this._calculateBounding(!1)),this._curPos||(this._curPos=new mn),this.node.getWorldPosition(this._curPos),this._oldPos||(this._oldPos=new mn,this._oldPos.set(this._curPos)),!this._curPos.equals(this._oldPos)&&this._boundingBox&&this._culler){var s=this._curPos.x-this._oldPos.x,o=this._curPos.y-this._oldPos.y,a=this._curPos.z-this._oldPos.z,h=this._boundingBox.center;h.x+=s,h.y+=o,h.z+=a,this._culler.setBoundingBoxCenter(h.x,h.y,h.z),this._oldPos.set(this._curPos)}var u=null===(r=this.node.scene.renderScene)||void 0===r?void 0:r.cameras,l=!0;if(void 0!==u&&this._boundingBox)for(var c=0;c<u.length;++c){var _=u[c];if((_.visibility&this.node.layer)===this.node.layer&&gs.aabbFrustum(this._boundingBox,_.frustum)){l=!1;break}}if(l){if(this._cullingMode!==fdt.AlwaysSimulate&&(this._isSimulating=!1),this._isCulled||(this.processor.detachFromScene(),this._isCulled=!0),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._cullingMode===fdt.PauseAndCatchup&&(this._time+=n),this._cullingMode!==fdt.AlwaysSimulate)return}else this._isCulled&&(this._attachToScene(),this._isCulled=!1),this._isSimulating||(this._isSimulating=!0);if(!this._isSimulating)return}else this._boundingBox&&(this._boundingBox=null),this._culler&&(this._culler.clear(),this._culler.destroy(),this._culler=null),this._isSimulating=!0;if(this._isPlaying)this._time+=n,this._emit(n),0!==this.processor.updateParticles(n)||this._isEmitting||this.stop();else{var f=(this.getMaterialInstance(0)||this.processor.getDefaultMaterial()).passes[0];this.processor.updateRotation(f),this.processor.updateScale(f)}this._needAttach&&this.getParticleCount()>0&&!this._isCulled&&(null!==(e=this.processor.getModel())&&void 0!==e&&e.scene||this.processor.attachToScene(),this._trailModule&&this._trailModule.enable&&(null!==(i=this._trailModule.getModel())&&void 0!==i&&i.scene||this._trailModule._attachToScene()),this._needAttach=!1);!this.renderer.useGPU&&this._trailModule&&this._trailModule.enable&&(this._trailModule.inited||(this._trailModule.clear(),this._trailModule.destroy(),this._trailModule.onInit(this),this._trailModule.enable=!1,this._trailModule.enable=!0))},i.beforeRender=function(){var t,e;this.getParticleCount()<=0?null!==(e=this.processor.getModel())&&void 0!==e&&e.scene&&(this.processor.detachFromScene(),this._trailModule&&this._trailModule.enable&&this._trailModule._detachFromScene(),this._needAttach=!1):null!==(t=this.processor.getModel())&&void 0!==t&&t.scene||(this._needAttach=!0),this._isPlaying&&(this.processor.updateRenderData(),this.processor.beforeRender(),this._trailModule&&this._trailModule.enable&&(this._trailModule.updateRenderData(),this._trailModule.beforeRender()))},i._onVisibilityChange=function(t){this.processor.model&&(this.processor.model.visFlags=t)},i.emit=function(t,e){var i=this._time%this.duration/this.duration;this._needRefresh&&(this.node.invalidateChildren(Om.POSITION),this._needRefresh=!1),this._simulationSpace===_dt.World&&(this.node.getWorldMatrix(DAt),this.node.getWorldRotation(RAt));for(var n=0;n<t;++n){var r=this.processor.getFreeParticle();if(null===r)return;r.particleSystem=this,r.reset();var s=ji(Wi(0,T));this._shapeModule&&this._shapeModule.enable?this._shapeModule.emit(r):(mn.set(r.position,0,0,0),mn.copy(r.velocity,Adt)),this._textureAnimationModule&&this._textureAnimationModule.enable&&this._textureAnimationModule.init(r);var o=this.startSpeed.evaluate(i,s);mn.multiplyScalar(r.velocity,r.velocity,o),this._simulationSpace===_dt.World&&(mn.transformMat4(r.position,r.position,DAt),mn.transformQuat(r.velocity,r.velocity,RAt)),mn.copy(r.ultimateVelocity,r.velocity),this.startRotation3D?r.startEuler.set(this.startRotationX.evaluate(i,s),this.startRotationY.evaluate(i,s),this.startRotationZ.evaluate(i,s)):r.startEuler.set(0,0,this.startRotationZ.evaluate(i,s)),r.rotation.set(r.startEuler),this.startSize3D?mn.set(r.startSize,this.startSizeX.evaluate(i,s),this.startSizeY.evaluate(i,s),this.startSizeZ.evaluate(i,s)):(mn.set(r.startSize,this.startSizeX.evaluate(i,s),1,1),r.startSize.y=r.startSize.x),mn.copy(r.size,r.startSize),r.startColor.set(this.startColor.evaluate(i,s)),r.color.set(r.startColor),r.startLifetime=this.startLifetime.evaluate(i,s)+e,r.remainingLifetime=r.startLifetime,r.randomSeed=Wi(0,233280),r.loopCount++,this.processor.setNewParticle(r)}},i._prewarmSystem=function(){this.startDelay.mode=yft.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.startDelay.evaluate(0,1);if(this._time>e){if(this._time>this.duration+e&&(this.loop||(this._isEmitting=!1)),!this._isEmitting)return;if(this._emitRateTimeCounter+=this.rateOverTime.evaluate(this._time/this.duration,1)*t,this._emitRateTimeCounter>1){var i=Math.floor(this._emitRateTimeCounter);this._emitRateTimeCounter-=i,this.emit(i,t)}var n=this.rateOverDistance.evaluate(this._time/this.duration,1);if(n>0){mn.copy(this._oldWPos,this._curWPos),this.node.getWorldPosition(this._curWPos);var r=mn.distance(this._curWPos,this._oldWPos);this._emitRateDistanceCounter+=r*n}if(this._emitRateDistanceCounter>1){var s=Math.floor(this._emitRateDistanceCounter);this._emitRateDistanceCounter-=s,this.emit(s,t)}for(var o,a=f(this.bursts);!(o=a()).done;)o.value.update(this,t)}},i._resetPosition=function(){this.node.getWorldPosition(this._oldWPos),mn.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!ldt.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 Ko,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 IAt.get.call(this)},set:function(t){IAt.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}(MV)).CullingMode=fdt,TSt=fa((ASt=uAt).prototype,"startColor",[Rvt,Ma],(function(){return new Yft})),bSt=fa(ASt.prototype,"scaleSpace",[Ivt,Ma],(function(){return _dt.Local})),ESt=fa(ASt.prototype,"startSize3D",[Ma],(function(){return!1})),CSt=fa(ASt.prototype,"startSizeX",[Mvt,Pvt],(function(){return new vft})),xSt=fa(ASt.prototype,"startSizeY",[Bvt,Ma],(function(){return new vft})),wSt=fa(ASt.prototype,"startSizeZ",[Ovt,Ma],(function(){return new vft})),DSt=fa(ASt.prototype,"startSpeed",[Lvt,Ma],(function(){return new vft})),RSt=fa(ASt.prototype,"startRotation3D",[Ma],(function(){return!1})),ISt=fa(ASt.prototype,"startRotationX",[Nvt,Ma],(function(){return new vft})),MSt=fa(ASt.prototype,"startRotationY",[Fvt,Ma],(function(){return new vft})),PSt=fa(ASt.prototype,"startRotationZ",[kvt,Vvt],(function(){return new vft})),BSt=fa(ASt.prototype,"startDelay",[Gvt,Ma],(function(){return new vft})),OSt=fa(ASt.prototype,"startLifetime",[Uvt,Ma],(function(){return new vft})),LSt=fa(ASt.prototype,"duration",[Ma],(function(){return 5})),NSt=fa(ASt.prototype,"loop",[Ma],(function(){return!0})),m(ASt.prototype,"simulationSpace",[zvt,Ma],Object.getOwnPropertyDescriptor(ASt.prototype,"simulationSpace"),ASt.prototype),FSt=fa(ASt.prototype,"simulationSpeed",[Ma],(function(){return 1})),kSt=fa(ASt.prototype,"playOnAwake",[Ma],(function(){return!0})),VSt=fa(ASt.prototype,"gravityModifier",[Hvt,Ma],(function(){return new vft})),GSt=fa(ASt.prototype,"rateOverTime",[Wvt,Ma],(function(){return new vft})),USt=fa(ASt.prototype,"rateOverDistance",[jvt,Ma],(function(){return new vft})),zSt=fa(ASt.prototype,"bursts",[Xvt,Ma],(function(){return[]})),m(ASt.prototype,"renderCulling",[Yvt],Object.getOwnPropertyDescriptor(ASt.prototype,"renderCulling"),ASt.prototype),HSt=fa(ASt.prototype,"_renderCulling",[Ma],(function(){return!1})),m(ASt.prototype,"cullingMode",[qvt],Object.getOwnPropertyDescriptor(ASt.prototype,"cullingMode"),ASt.prototype),WSt=fa(ASt.prototype,"_cullingMode",[Ma],(function(){return fdt.Pause})),m(ASt.prototype,"aabbHalfX",[Kvt],Object.getOwnPropertyDescriptor(ASt.prototype,"aabbHalfX"),ASt.prototype),jSt=fa(ASt.prototype,"_aabbHalfX",[Ma],(function(){return 0})),m(ASt.prototype,"aabbHalfY",[Qvt],Object.getOwnPropertyDescriptor(ASt.prototype,"aabbHalfY"),ASt.prototype),XSt=fa(ASt.prototype,"_aabbHalfY",[Ma],(function(){return 0})),m(ASt.prototype,"aabbHalfZ",[Zvt],Object.getOwnPropertyDescriptor(ASt.prototype,"aabbHalfZ"),ASt.prototype),YSt=fa(ASt.prototype,"_aabbHalfZ",[Ma],(function(){return 0})),qSt=fa(ASt.prototype,"_dataCulling",[Ma,Jvt],(function(){return!1})),m(ASt.prototype,"sharedMaterials",[_h,Ma],Object.getOwnPropertyDescriptor(ASt.prototype,"sharedMaterials"),ASt.prototype),KSt=fa(ASt.prototype,"_colorOverLifetimeModule",[$vt],(function(){return null})),m(ASt.prototype,"colorOverLifetimeModule",[tSt],Object.getOwnPropertyDescriptor(ASt.prototype,"colorOverLifetimeModule"),ASt.prototype),QSt=fa(ASt.prototype,"_shapeModule",[eSt],(function(){return null})),m(ASt.prototype,"shapeModule",[iSt],Object.getOwnPropertyDescriptor(ASt.prototype,"shapeModule"),ASt.prototype),ZSt=fa(ASt.prototype,"_sizeOvertimeModule",[nSt],(function(){return null})),m(ASt.prototype,"sizeOvertimeModule",[rSt],Object.getOwnPropertyDescriptor(ASt.prototype,"sizeOvertimeModule"),ASt.prototype),JSt=fa(ASt.prototype,"_velocityOvertimeModule",[sSt],(function(){return null})),m(ASt.prototype,"velocityOvertimeModule",[oSt],Object.getOwnPropertyDescriptor(ASt.prototype,"velocityOvertimeModule"),ASt.prototype),$St=fa(ASt.prototype,"_forceOvertimeModule",[aSt],(function(){return null})),m(ASt.prototype,"forceOvertimeModule",[hSt],Object.getOwnPropertyDescriptor(ASt.prototype,"forceOvertimeModule"),ASt.prototype),tAt=fa(ASt.prototype,"_limitVelocityOvertimeModule",[uSt],(function(){return null})),m(ASt.prototype,"limitVelocityOvertimeModule",[lSt],Object.getOwnPropertyDescriptor(ASt.prototype,"limitVelocityOvertimeModule"),ASt.prototype),eAt=fa(ASt.prototype,"_rotationOvertimeModule",[cSt],(function(){return null})),m(ASt.prototype,"rotationOvertimeModule",[_St],Object.getOwnPropertyDescriptor(ASt.prototype,"rotationOvertimeModule"),ASt.prototype),iAt=fa(ASt.prototype,"_textureAnimationModule",[fSt],(function(){return null})),m(ASt.prototype,"textureAnimationModule",[dSt],Object.getOwnPropertyDescriptor(ASt.prototype,"textureAnimationModule"),ASt.prototype),nAt=fa(ASt.prototype,"_noiseModule",[pSt],(function(){return null})),m(ASt.prototype,"noiseModule",[mSt],Object.getOwnPropertyDescriptor(ASt.prototype,"noiseModule"),ASt.prototype),rAt=fa(ASt.prototype,"_trailModule",[gSt],(function(){return null})),m(ASt.prototype,"trailModule",[ySt],Object.getOwnPropertyDescriptor(ASt.prototype,"trailModule"),ASt.prototype),sAt=fa(ASt.prototype,"renderer",[vSt,Ma],(function(){return new lAt})),oAt=fa(ASt.prototype,"_prewarm",[Ma],(function(){return!1})),aAt=fa(ASt.prototype,"_capacity",[Ma],(function(){return 100})),hAt=fa(ASt.prototype,"_simulationSpace",[Ma],(function(){return _dt.Local})),SSt=ASt))||SSt)||SSt)),PAt=t("eV",function(){function t(){}return t.instantiate=function(t){this.registeredSceneEvent||(FI.on(LI.EVENT_BEFORE_SCENE_LAUNCH,this.onSceneUnload,this),this.registeredSceneEvent=!0);var e=t._uuid;if(!this.particleSystemPool.has(e)){var i=new qs((function(){return SJ(t)||new xg}),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)||void 0===e||null===(i=e.asset)||void 0===i?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=f(t.getComponentsInChildren(MAt));!(e=i()).done;)e.value.play()},t.stop=function(t){for(var e,i=f(t.getComponentsInChildren(MAt));!(e=i()).done;)e.value.stop()},t.onSceneUnload=function(){this.particleSystemPool.forEach((function(t){return t.destroy()})),this.particleSystemPool.clear()},t}());PAt.particleSystemPool=new Map,PAt.registeredSceneEvent=!1,ut(_gt.prototype,"Burst.prototype",[{name:"minCount"},{name:"maxCount"}]),ht(MAt.prototype,"ParticleSystem.prototype",[{name:"enableCulling",newName:"dataCulling"}]),v.ParticleSystemComponent=MAt,ie(MAt,"cc.ParticleSystemComponent"),v.BillboardComponent=cft,ie(cft,"cc.BillboardComponent"),v.LineComponent=Qft,ie(Qft,"cc.LineComponent"),v.ParticleUtils=PAt;var BAt,OAt,LAt,NAt=be({GRAVITY:0,RADIUS:1}),FAt=be({FREE:0,RELATIVE:1,GROUPED:2}),kAt=new jn(0,0),VAt=new jn,GAt=new jn,UAt=new jn,zAt=new jn,HAt=new ln,WAt=WB(GB),jAt=function(){this.pos=new jn(0,0),this.startPos=new jn(0,0),this.color=new bn(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 jn(0,0),this.aspectRatio=1,this.dir=new jn(0,0),this.radialAccel=0,this.tangentialAccel=0,this.angle=0,this.degreesPerSecond=0,this.radius=0,this.deltaRadius=0},XAt=new(function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e.prototype.get=function(){return this._get()||new jAt},e}(ue))((function(t){t.pos.set(kAt),t.startPos.set(kAt),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(kAt),t.aspectRatio=1,t.dir.set(kAt),t.radialAccel=0,t.tangentialAccel=0,t.angle=0,t.degreesPerSecond=0,t.radius=0,t.deltaRadius=0}),1024),YAt=function(){function t(t){this.particles=[],this.active=!1,this.uvFilled=0,this.finished=!1,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)XAt.put(t[e]);t.length=0,this.renderData&&this.renderData.resize(0,0)},e.emitParticle=function(t){var e=this.sys,i=XAt.get();this.particles.push(i),i.timeToLive=e.life+e.lifeVar*(Ui()-.5)*2;var n=i.timeToLive=Math.max(0,i.timeToLive);i.pos.x=e.sourcePos.x+e.posVar.x*(Ui()-.5)*2,i.pos.y=e.sourcePos.y+e.posVar.y*(Ui()-.5)*2;var r,s,o,a,h=e.startColor,u=e.startColorVar,l=e.endColor,c=e.endColorVar;i.color.r=r=je(h.r+u.r*(Ui()-.5)*2,0,255),i.color.g=s=je(h.g+u.g*(Ui()-.5)*2,0,255),i.color.b=o=je(h.b+u.b*(Ui()-.5)*2,0,255),i.color.a=a=je(h.a+u.a*(Ui()-.5)*2,0,255),i.deltaColor.r=(je(l.r+c.r*(Ui()-.5)*2,0,255)-r)/n,i.deltaColor.g=(je(l.g+c.g*(Ui()-.5)*2,0,255)-s)/n,i.deltaColor.b=(je(l.b+c.b*(Ui()-.5)*2,0,255)-o)/n,i.deltaColor.a=(je(l.a+c.a*(Ui()-.5)*2,0,255)-a)/n;var _=e.startSize+e.startSizeVar*(Ui()-.5)*2;if(_=Math.max(0,_),i.size=_,-1===e.endSize)i.deltaSize=0;else{var f=e.endSize+e.endSizeVar*(Ui()-.5)*2;f=Math.max(0,f),i.deltaSize=(f-_)/n}var d=e.startSpin+e.startSpinVar*(Ui()-.5)*2,p=e.endSpin+e.endSpinVar*(Ui()-.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=Xe(e.angle+this._worldRotation+e.angleVar*(Ui()-.5)*2);if(e.emitterMode===NAt.GRAVITY){var g=e.speed+e.speedVar*(Ui()-.5)*2;i.dir.x=Math.cos(m),i.dir.y=Math.sin(m),i.dir.multiplyScalar(g),i.radialAccel=e.radialAccel+e.radialAccelVar*(Ui()-.5)*2,i.tangentialAccel=e.tangentialAccel+e.tangentialAccelVar*(Ui()-.5)*2,e.rotationIsDir&&(i.rotation=-Ye(Math.atan2(i.dir.y,i.dir.x)))}else{var y=e.startRadius+e.startRadiusVar*(Ui()-.5)*2,v=e.endRadius+e.endRadiusVar*(Ui()-.5)*2;i.radius=y,i.deltaRadius=-1===e.endRadius?0:(v-y)/n,i.angle=m,i.degreesPerSecond=Xe(e.rotatePerS+e.rotatePerSVar*(Ui()-.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,o=r;o<s;o++){var a=o*WAt*4;i[a+3]=n[0],i[a+4]=n[1],i[a+12]=n[2],i[a+13]=n[3],i[a+21]=n[4],i[a+22]=n[5],i[a+30]=n[6],i[a+31]=n[7]}this.uvFilled=s}},e.updateParticleBuffer=function(t,e,i,n){var r=i.vData,s=e.x,o=e.y,a=t.size,h=a,u=t.aspectRatio;u>1?h=a/u:a=h*u;var l=a/2,c=h/2;if(t.rotation){var _=-l,f=-c,d=l,p=c,m=-Xe(t.rotation),g=Math.cos(m),y=Math.sin(m);r[n]=_*g-f*y+s,r[n+1]=_*y+f*g+o,r[n+2]=0,r[n+9]=d*g-f*y+s,r[n+10]=d*y+f*g+o,r[n+11]=0,r[n+18]=_*g-p*y+s,r[n+19]=_*y+p*g+o,r[n+20]=0,r[n+27]=d*g-p*y+s,r[n+28]=d*y+p*g+o,r[n+29]=0}else r[n]=s-l,r[n+1]=o-c,r[n+2]=0,r[n+9]=s+l,r[n+10]=o-c,r[n+11]=0,r[n+18]=s-l,r[n+19]=o+c,r[n+20]=0,r[n+27]=s+l,r[n+28]=o+c,r[n+29]=0;var v=t.color;HAt.x=v.r/255,HAt.y=v.g/255,HAt.z=v.b/255,HAt.w=v.a/255,ln.toArray(r,HAt,n+5),ln.toArray(r,HAt,n+14),ln.toArray(r,HAt,n+23),ln.toArray(r,HAt,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===FAt.FREE){this._worldRotation=function(t){for(var e=0,i=t;i;)e+=i.eulerAngles.z,i=i.parent;return e}(n);var s=n.worldMatrix;VAt.x=s.m12,VAt.y=s.m13}else i.positionType===FAt.RELATIVE?(this._worldRotation=n.eulerAngles.z,VAt.x=n.position.x,VAt.y=n.position.y):this._worldRotation=0;if(this.active&&i.emissionRate){var o=1/i.emissionRate;for(r.length<i.totalParticles&&(this.emitCounter+=t);r.length<i.totalParticles&&this.emitCounter>o;)this.emitParticle(VAt),this.emitCounter-=o;this.elapsed+=t,-1!==i.duration&&i.duration<this.elapsed&&i.stopSystem()}var a=this.renderData,h=r.length;a.reset(),this.requestData(4*h,6*h),h>this.uvFilled&&this.updateUVs();for(var u=0;u<r.length;){GAt.x=GAt.y=UAt.x=UAt.y=zAt.x=zAt.y=0;var l=r[u];if(l.timeToLive-=t,l.timeToLive>0){if(i.emitterMode===NAt.GRAVITY){var c=zAt,_=GAt,f=UAt;(l.pos.x||l.pos.y)&&(_.set(l.pos),_.normalize()),f.set(_),_.multiplyScalar(l.radialAccel);var d=f.x;f.x=-f.y,f.y=d,f.multiplyScalar(l.tangentialAccel),c.set(_),c.add(f),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=GAt;p.set(l.pos),i.positionType!==FAt.GROUPED&&p.add(l.startPos);var m=WAt*u*4;this.updateParticleBuffer(l,p,a,m),++u}else{var g=r[u];u!==r.length-1&&(r[u]=r[r.length-1]),XAt.put(g),r.length--,a.resize(a.vertexCount-4,a.indexCount-6)}}this.renderData.material=this.sys.getRenderMaterial(0),this.renderData.frame=this.sys._renderSpriteFrame,a.setRenderDrawInfoAttributes(),0!==r.length||this.active||this.readyToPlay||(this.finished=!0,i._finishedSimulation())},e.requestData=function(t,e){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 o=4*s;r[i++]=o,r[i++]=o+1,r[i++]=o+2,r[i++]=o+1,r[i++]=o+3,r[i++]=o+2}},e.initDrawInfo=function(){this.renderData.setRenderDrawInfoAttributes()},t}(),qAt=Ma,KAt=t("f1",Ta("cc.ParticleAsset")((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).spriteFrame=LAt&&LAt(),e}return s(e,t),e}(Fd),LAt=fa(OAt.prototype,"spriteFrame",[qAt],(function(){return null})),BAt=OAt))||BAt);v.ParticleAsset=KAt;for(var QAt=function(){function t(t){var e,i=this;this.pos=8,this.palette=[],this.imgData=[],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.data=t,this.transparency={indexed:[],rgb:0,grayscale:0};for(var n=0,r=0,s=0;;){s=this.readUInt32();var o=function(){var t=[];for(n=0;n<4;++n)t.push(String.fromCharCode(i.data[i.pos++]));return t}.call(this).join("");switch(o){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(s);break;case"fcTL":e&&this.animation.frames.push(e),this.pos+=4,e={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()};var a=this.readUInt16(),h=this.readUInt16()||100;e.delay=1e3*a/h,e.disposeOp=this.data[this.pos++],e.blendOp=this.data[this.pos++],e.data=[];break;case"IDAT":case"fdAT":for("fdAT"===o&&(this.pos+=4,s-=4),t=(null!=e?e.data:void 0)||this.imgData,n=0;s>=0?n<s:n>s;s>=0?++n:--n)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:this.transparency.indexed=this.read(s);var u=255-this.transparency.indexed.length;if(u>0)for(r=0;u>=0?r<u:r>u;u>=0?++r:--r)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(s)[0];break;case 2:this.transparency.rgb=this.read(s)}break;case"tEXt":var l=this.read(s),c=l.indexOf(0),_=String.fromCharCode.apply(String,l.slice(0,c));this.text[_]=String.fromCharCode.apply(String,l.slice(c+1));break;case"IEND":e&&this.animation.frames.push(e),this.colors=function(){switch(i.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this);var f=this.colorType;this.hasAlphaChannel=4===f||6===f;var d=this.colors+(this.hasAlphaChannel?1:0);return this.pixelBitlength=this.bits*d,this.colorSpace=function(){switch(i.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData instanceof Uint8Array||(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=s}if(this.pos+=4,this.pos>this.data.length)throw new Error(st(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(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[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 $M.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,o=0,a=0,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0,y=0,v=0,S=0,A=0,T=0,b=0;o<r;){switch(t[o++]){case 0:for(l=c=0;c<i;l=c+=1)n[a++]=t[o++];break;case 1:for(l=_=0;_<i;l=_+=1)h=t[o++],m=l<e?0:n[a-e],n[a++]=(h+m)%256;break;case 2:for(l=f=0;f<i;l=f+=1)h=t[o++],u=(l-l%e)/e,T=s&&n[(s-1)*i+u*e+l%e],n[a++]=(T+h)%256;break;case 3:for(l=d=0;d<i;l=d+=1)h=t[o++],u=(l-l%e)/e,m=l<e?0:n[a-e],T=s&&n[(s-1)*i+u*e+l%e],n[a++]=(h+Math.floor((m+T)/2))%256;break;case 4:for(l=p=0;p<i;l=p+=1)h=t[o++],u=(l-l%e)/e,m=l<e?0:n[a-e],0===s?T=b=0:(T=n[(s-1)*i+u*e+l%e],b=u&&n[(s-1)*i+(u-1)*e+l%e]),g=m+T-b,y=Math.abs(g-m),S=Math.abs(g-T),A=Math.abs(g-b),v=y<=S&&y<=A?m:S<=A?T:b,n[a++]=(h+v)%256;break;default:throw new Error(st(6018,t[o-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,o=s.length,a=i||e,h=0,u=0,l=0,c=0;if(1===r)for(;h<o;)l=i?4*e[h/4]:u,c=a[l++],s[h++]=c,s[h++]=c,s[h++]=c,s[h++]=n?a[l++]:255,u=l;else for(;h<o;)l=i?4*e[h/4]:u,s[h++]=a[l++],s[h++]=a[l++],s[h++]=a[l++],s[h++]=n?a[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,o=0,a=0,h=t.length;a<h;o=a+=3)i[n++]=t[o],i[n++]=t[o+1],i[n++]=t[o+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"),i=e.createImageData(this.width,this.height);return this.copyToImageData(i,this.decodePixels(null)),e.putImageData(i,0,0)},t}(),ZAt=function(){function t(){this._littleEndian=!1,this._tiffData=[],this._fileDirectories=[]}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(st(6019));this._littleEndian=!1}return this._littleEndian},e.hasTowel=function(){if(42!==this.getUint16(2))throw RangeError(st(6020));return!0},e.getFieldTypeName=function(t){return t in $At?$At[t]:null},e.getFieldTagName=function(t){return t in JAt?JAt[t]:(K(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 o=0;o<i;o++){var a=s*o;s>=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+a)),r.push(this.getUint32(n+a+4))):K(8e3):r.push(this.getBytes(s,n+a))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},e.getBytes=function(t,e){if(t<=0)K(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);K(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,o=0,a=0;return r<=0?K(6023):r<=8?(o=24+i,a=this.getUint8(n)):r<=16?(o=16+i,a=this.getUint16(n)):r<=32?(o=i,a=this.getUint32(n)):K(6022),{bits:a<<o>>>s,byteOffset:n+Math.floor(r/8),bitOffset:r%8}},e.parseFileDirectory=function(t){var e=this.getUint16(t),i=[],n=0,r=0;for(n=t+2,r=0;r<e;n+=12,r++){var s=this.getUint16(n),o=this.getUint16(n+2),a=this.getUint32(n+4),h=this.getUint32(n+8),u=this.getFieldTagName(s),l=this.getFieldTypeName(o),c=this.getFieldValues(u,l,a,h);i[u]={type:l,values:c}}this._fileDirectories.push(i);var _=this.getUint32(n);0!==_&&this.parseFileDirectory(_)},e.clampColorSample=function(t,e){var i=Math.pow(2,8-e);return Math.floor(t*i+(i-1))},e.parseTIFF=function(t,e){var i=this;if(e=e||A.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],o=r.ImageLength.values[0];this._canvas.width=s,this._canvas.height=o;var a=[],h=r.Compression?r.Compression.values[0]:1,u=r.SamplesPerPixel.values[0],l=[],c=0,_=!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 f=0;c%8==0&&(_=!0,f=c/8);var d,p=r.StripOffsets.values,m=p.length;if(r.StripByteCounts)d=r.StripByteCounts.values;else{if(K(8003),1!==m)throw Error(st(6024));d=[Math.ceil(s*o*c/8)]}for(var g=1,y=1,v=0;v<m;v++){var S=p[v];a[v]=[];for(var T=d[v],b=0,E=0,C=1,x=!0,w=[],D=0,R=0,I=0;b<T;b+=C)switch(h){case 1:w=[];for(var M=0;M<u;M++){var P=l[M];if(!P.hasBytesPerSample){var B=this.getBits(P.bitsPerSample,S+b,E);throw w.push(B.bits),b=B.byteOffset-S,E=B.bitOffset,RangeError(st(6025))}var O=P.bytesPerSample*M;w.push(this.getBytes(P.bytesPerSample,S+b+O))}if(a[v].push(w),!_)throw C=0,RangeError(st(6026));C=f;break;case 2:case 3:case 4:case 5:case 6:case 7:break;case 32773:if(x){x=!1;var L=this.getUint8(S+b);L>=0&&L<=127?g=L+1:L>=-127&&L<=-1?y=1-L:x=!0}else{for(var N=this.getUint8(S+b),F=0;F<y;F++){var k=l[R];if(!k.hasBytesPerSample)throw RangeError(st(6025));I=I<<8*D|N,++D===k.bytesPerSample&&(w.push(I),I=D=0,R++),R===u&&(a[v].push(w),w=[],R=0)}0==--g&&(x=!0)}C=1}}if(e.getContext){var V=this._canvas.getContext("2d");V.fillStyle="rgba(255, 255, 255, 0)";var G=r.RowsPerStrip?r.RowsPerStrip.values[0]:o,U=a.length,z=o%G,H=0===z?G:z,W=G,j=0,X=r.PhotometricInterpretation.values[0],Y=[],q=0;r.ExtraSamples&&(Y=r.ExtraSamples.values,q=Y.length);var Q=[],Z=0;r.ColorMap&&(Q=r.ColorMap.values,Z=Math.pow(2,l[0].bitsPerSample));for(var J=0;J<U;J++){J+1===U&&(W=H);for(var $=a[J].length,tt=j*J,et=0,it=0;et<W&&it<$;et++)for(var nt=function(){var t=a[J][it],e=0,n=0,r=0,s=1;if(q>0)for(var o=0;o<q;o++)if(1===Y[o]||2===Y[o]){s=t[3+o]/256;break}switch(X){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===Q)throw Error(st(6027));var u=t[0];e=i.clampColorSample(Q[u],16),n=i.clampColorSample(Q[Z+u],16),r=i.clampColorSample(Q[2*Z+u],16);break;default:throw RangeError(st(6028,X))}V.fillStyle="rgba("+e+", "+n+", "+r+", "+s+")",V.fillRect(rt,tt+et,1,1)},rt=0;rt<s;rt++,it++)nt();j=W}}return this._canvas}},t}(),JAt={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"},$At={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE"},tTt=new Array(123),eTt=0;eTt<123;++eTt)tTt[eTt]=64;for(var iTt=0;iTt<64;++iTt)tTt["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(iTt)]=iTt;var nTt={name:"Jacob__Codec__Base64",decode:function(t){var e,i,n,r,s,o,a=[],h=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<t.length;)e=tTt[t.charCodeAt(h++)]<<2|(r=tTt[t.charCodeAt(h++)])>>4,i=(15&r)<<4|(s=tTt[t.charCodeAt(h++)])>>2,n=(3&s)<<6|(o=tTt[t.charCodeAt(h++)]),a.push(String.fromCharCode(e)),64!==s&&a.push(String.fromCharCode(i)),64!==o&&a.push(String.fromCharCode(n));return a.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),o=[];for(i=0,r=s.length/e;i<r;i++)for(o[i]=0,n=e-1;n>=0;--n)o[i]+=s.charCodeAt(i*e+n)<<8*n;return o}},rTt=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(rTt.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};rTt.gunzip=function(t){return t.constructor===Array||t.constructor,new rTt(t).gunzip()[0][0]},rTt.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},rTt.LITERALS=288,rTt.NAMEMAX=256,rTt.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],rTt.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],rTt.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],rTt.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],rTt.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],rTt.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rTt.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},rTt.prototype.readByte=function(){return this.bits+=8,this.bytepos<this.data.length?this.data.charCodeAt(this.bytepos++):-1},rTt.prototype.byteAlign=function(){this.bb=1},rTt.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},rTt.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=rTt.bitReverse[e]>>8-t),e},rTt.prototype.flushBuffer=function(){this.bIdx=0},rTt.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},rTt.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]++}},rTt.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},rTt.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},rTt.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},rTt.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((o=rTt.bitReverse[this.readBits(7)]>>1)>23?(o=o<<1|this.readBit())>199?o=(o-=128)<<1|this.readBit():(o-=48)>143&&(o+=136):o+=256,o<256)this.addBuffer(o);else{if(256===o)break;for(o-=257,d=this.readBits(rTt.cplext[o])+rTt.cplens[o],o=rTt.bitReverse[this.readBits(5)]>>3,rTt.cpdext[o]>8?(p=this.readBits(8),p|=this.readBits(rTt.cpdext[o]-8)<<8):p=this.readBits(rTt.cpdext[o]),p+=rTt.cpdist[o],o=0;o<d;o++){var s=this.buf32k[this.bIdx-p&32767];this.addBuffer(s)}}else if(2===e){var o,a,h,u,l,c=new Array(320);for(h=257+this.readBits(5),u=1+this.readBits(5),l=4+this.readBits(4),o=0;o<19;o++)c[o]=0;for(o=0;o<l;o++)c[rTt.border[o]]=this.readBits(3);for(d=this.distanceTree.length,i=0;i<d;i++)this.distanceTree[i]=new rTt.HufNode;if(this.CreateTree(this.distanceTree,19,c,0))return this.flushBuffer(),1;for(a=h+u,i=0;i<a;)if((o=this.DecodeValue(this.distanceTree))<16)c[i++]=o;else if(16===o){var _;if(i+(o=3+this.readBits(2))>a)return this.flushBuffer(),1;for(_=i?c[i-1]:0;o--;)c[i++]=_}else{if(i+(o=17===o?3+this.readBits(3):11+this.readBits(7))>a)return this.flushBuffer(),1;for(;o--;)c[i++]=0}for(d=this.literalTree.length,i=0;i<d;i++)this.literalTree[i]=new rTt.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 rTt.HufNode;var f=new Array;for(i=h;i<c.length;i++)f[i-h]=c[i];if(this.CreateTree(this.distanceTree,u,f,0))return this.flushBuffer(),1;for(;;)if((o=this.DecodeValue(this.literalTree))>=256){var d,p;if(0==(o-=256))break;for(o--,d=this.readBits(rTt.cplext[o])+rTt.cplens[o],o=this.DecodeValue(this.distanceTree),rTt.cpdext[o]>8?(p=this.readBits(8),p|=this.readBits(rTt.cpdext[o]-8)<<8):p=this.readBits(rTt.cpdext[o]),p+=rTt.cpdist[o];d--;)s=this.buf32k[this.bIdx-p&32767],this.addBuffer(s)}else this.addBuffer(o)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},rTt.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]},rTt.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<rTt.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()}},rTt.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<rTt.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 sTt,oTt,aTt,hTt,uTt,lTt,cTt,_Tt,fTt,dTt,pTt,mTt,gTt,yTt,vTt,STt,ATt,TTt,bTt,ETt,CTt,xTt,wTt,DTt,RTt,ITt,MTt,PTt,BTt,OTt,LTt,NTt,FTt,kTt,VTt,GTt,UTt,zTt,HTt,WTt,jTt,XTt,YTt,qTt,KTt,QTt,ZTt,JTt,$Tt,tbt,ebt,ibt,nbt,rbt={name:"Jacob__Codec"};function sbt(t){var e=t.parent,i=t.getComponent(gbt);return e&&i?sbt(e):t.getComponentsInChildren(gbt)}rbt.Base64=nTt,rbt.GZip=rTt,rbt.unzip=function(){return rbt.GZip.gunzip.apply(rbt.GZip,arguments)},rbt.unzipBase64=function(){var t=rbt.Base64.decode.apply(rbt.Base64,arguments);try{return rbt.GZip.gunzip.call(rbt.GZip,t)}catch(e){return t.slice(7)}},rbt.unzipBase64AsArray=function(t,e){e=e||1;var i,n,r,s=this.unzipBase64(t),o=[];for(i=0,r=s.length/e;i<r;i++)for(o[i]=0,n=e-1;n>=0;--n)o[i]+=s.charCodeAt(i*e+n)<<8*n;return o},rbt.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),o=[];for(i=0,r=s.length/e;i<r;i++)for(o[i]=0,n=e-1;n>=0;--n)o[i]+=s.charCodeAt(i*e+n)<<8*n;return o},function(t){t[t.JPG=0]="JPG",t[t.PNG=1]="PNG",t[t.TIFF=2]="TIFF",t[t.WEBP=3]="WEBP",t[t.PVR=4]="PVR",t[t.ETC=5]="ETC",t[t.S3TC=6]="S3TC",t[t.ATITC=7]="ATITC",t[t.TGA=8]="TGA",t[t.RAWDATA=9]="RAWDATA",t[t.UNKNOWN=10]="UNKNOWN"}(nbt||(nbt={}));var obt,abt,hbt,ubt,lbt,cbt,_bt,fbt,dbt,pbt,mbt,gbt=t("eZ",(sTt=Ta("cc.ParticleSystem2D"),oTt=eh(KAt),aTt=eh(wP),hTt=eh(FAt),uTt=eh(NAt),lTt=Pa("preview"),sTt(((ibt=function(t){function e(){var e;return(e=t.call(this)||this).duration=fTt&&fTt(),e.emissionRate=dTt&&dTt(),e.life=pTt&&pTt(),e.lifeVar=mTt&&mTt(),e.angle=gTt&&gTt(),e.angleVar=yTt&&yTt(),e.startSize=vTt&&vTt(),e.startSizeVar=STt&&STt(),e.endSize=ATt&&ATt(),e.endSizeVar=TTt&&TTt(),e.startSpin=bTt&&bTt(),e.startSpinVar=ETt&&ETt(),e.endSpin=CTt&&CTt(),e.endSpinVar=xTt&&xTt(),e.sourcePos=wTt&&wTt(),e.posVar=DTt&&DTt(),e.emitterMode=RTt&&RTt(),e.gravity=ITt&&ITt(),e.speed=MTt&&MTt(),e.speedVar=PTt&&PTt(),e.tangentialAccel=BTt&&BTt(),e.tangentialAccelVar=OTt&&OTt(),e.radialAccel=LTt&<t(),e.radialAccelVar=NTt&&NTt(),e.rotationIsDir=FTt&&FTt(),e.startRadius=kTt&&kTt(),e.startRadiusVar=VTt&&VTt(),e.endRadius=GTt&>t(),e.endRadiusVar=UTt&&UTt(),e.rotatePerS=zTt&&zTt(),e.rotatePerSVar=HTt&&HTt(),e.aspectRatio=1,e.playOnLoad=WTt&&WTt(),e.autoRemoveOnFinish=jTt&&jTt(),e._preview=XTt&&XTt(),e._custom=YTt&&YTt(),e._file=qTt&&qTt(),e._spriteFrame=KTt&&KTt(),e._totalParticles=QTt&&QTt(),e._startColor=ZTt&&ZTt(),e._startColorVar=JTt&&JTt(),e._endColor=$Tt&&$Tt(),e._endColorVar=tbt&&tbt(),e._positionType=ebt&&ebt(),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._simulator.renderData&&this._assembler&&this._assembler.removeData(this._simulator.renderData)},i.initProperties=function(){this._previewTimer=null,this._focused=!1,this.aspectRatio=1,this._simulator=new YAt(this)},i.onFocusInEditor=function(){this._focused=!0;for(var t=sbt(this.node),e=0;e<t.length;++e)t[e]._startPreview()},i.onLostFocusInEditor=function(){this._focused=!1;for(var t=sbt(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._flushAssembler=function(){var t=e.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._assembler&&this._assembler.createData&&(this._simulator.renderData=this._assembler.createData(this),this._simulator.renderData.particleInitRenderDrawInfo(this.renderEntity),this._simulator.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 et(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;NA.loadAny(n,(function(e,n){e?(t.spriteFrameUuid=void 0,i._initTextureWithDictionary(t),z(e)):i.spriteFrame=n}))}else{var r=Io(this._plistFile,t.textureFileName||"");if(t.textureFileName)NA.loadRemote(r,(function(e,n){e?(t.textureFileName=void 0,i._initTextureWithDictionary(t),z(e)):i.spriteFrame=n?wP.createWithImage(n):wP.createWithImage(UA.get("white-texture"))}));else if(t.textureImageData){var s=t.textureImageData;if(!(s&&s.length>0))return!1;var o=r;this.file&&(o+="-"+this.file.uuid);var a=NA.assets.get(o);if(!a){var h=rbt.unzipBase64AsArray(s,1);if(!h)return $(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]?nbt.PNG:e.length>2&&(73===e[0]&&73===e[1]||77===e[0]&&77===e[1]||255===e[0]&&216===e[1])?nbt.TIFF:nbt.UNKNOWN;if(u!==nbt.TIFF&&u!==nbt.PNG)return $(6031,this._file.name),!1;var l=A.document.createElement("canvas");u===nbt.PNG?new QAt(h).render(l):(this._tiffReader||(this._tiffReader=new ZAt),this._tiffReader.parseTIFF(h,l)),a=new sp(l),NA.assets.add(o,a)}a||$(6032,this._file.name),this.spriteFrame=a?wP.createWithImage(a):wP.createWithImage(UA.get("white-texture"))}}return!0},i._initWithDictionary=function(t){this._useFile=!0,this.totalParticles=parseInt(t.maxParticles||0),this.life=parseFloat(t.particleLifespan||0),this.lifeVar=parseFloat(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=parseFloat(t.duration||0),this._srcBlendFactor=parseInt(t.blendFuncSource||kc.SRC_ALPHA),this._dstBlendFactor=parseInt(t.blendFuncDestination||kc.ONE_MINUS_SRC_ALPHA);var i=this._startColor;i.r=255*parseFloat(t.startColorRed||0),i.g=255*parseFloat(t.startColorGreen||0),i.b=255*parseFloat(t.startColorBlue||0),i.a=255*parseFloat(t.startColorAlpha||0);var n=this._startColorVar;n.r=255*parseFloat(t.startColorVarianceRed||0),n.g=255*parseFloat(t.startColorVarianceGreen||0),n.b=255*parseFloat(t.startColorVarianceBlue||0),n.a=255*parseFloat(t.startColorVarianceAlpha||0);var r=this._endColor;r.r=255*parseFloat(t.finishColorRed||0),r.g=255*parseFloat(t.finishColorGreen||0),r.b=255*parseFloat(t.finishColorBlue||0),r.a=255*parseFloat(t.finishColorAlpha||0);var s=this._endColorVar;if(s.r=255*parseFloat(t.finishColorVarianceRed||0),s.g=255*parseFloat(t.finishColorVarianceGreen||0),s.b=255*parseFloat(t.finishColorVarianceBlue||0),s.a=255*parseFloat(t.finishColorVarianceAlpha||0),this.startSize=parseFloat(t.startParticleSize||0),this.startSizeVar=parseFloat(t.startParticleSizeVariance||0),this.endSize=parseFloat(t.finishParticleSize||0),this.endSizeVar=parseFloat(t.finishParticleSizeVariance||0),this.positionType=parseFloat(void 0!==t.positionType?t.positionType:FAt.FREE),this.sourcePos.set(0,0),this.posVar.set(parseFloat(t.sourcePositionVariancex||0),parseFloat(t.sourcePositionVariancey||0)),this.angle=parseFloat(t.angle||0),this.angleVar=parseFloat(t.angleVariance||0),this.startSpin=parseFloat(t.rotationStart||0),this.startSpinVar=parseFloat(t.rotationStartVariance||0),this.endSpin=parseFloat(t.rotationEnd||0),this.endSpinVar=parseFloat(t.rotationEndVariance||0),this.emitterMode=parseInt(t.emitterType||NAt.GRAVITY),this.emitterMode===NAt.GRAVITY){this.gravity.set(parseFloat(t.gravityx||0),parseFloat(t.gravityy||0)),this.speed=parseFloat(t.speed||0),this.speedVar=parseFloat(t.speedVariance||0),this.radialAccel=parseFloat(t.radialAcceleration||0),this.radialAccelVar=parseFloat(t.radialAccelVariance||0),this.tangentialAccel=parseFloat(t.tangentialAcceleration||0),this.tangentialAccelVar=parseFloat(t.tangentialAccelVariance||0);var o=t.rotationIsDir||"";null!==o?(o=o.toString().toLowerCase(),this.rotationIsDir="true"===o||"1"===o):this.rotationIsDir=!1}else{if(this.emitterMode!==NAt.RADIUS)return $(6009),!1;this.startRadius=parseFloat(t.maxRadius||0),this.startRadiusVar=parseFloat(t.maxRadiusVariance||0),this.endRadius=parseFloat(t.minRadius||0),this.endRadiusVar=parseFloat(t.minRadiusVariance||0),this.rotatePerS=parseFloat(t.rotatePerSecond||0),this.rotatePerSVar=parseFloat(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!==FAt.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===FAt.RELATIVE?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node.parent):this.positionType===FAt.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===FAt.RELATIVE?(this._renderEntity.setRenderTransform(this.node.parent),this._renderEntity.setUseLocal(!0)):this.positionType===FAt.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}(JO)).EmitterMode=NAt,ibt.PositionType=FAt,ibt.DURATION_INFINITY=-1,ibt.START_SIZE_EQUAL_TO_END_SIZE=-1,ibt.START_RADIUS_EQUAL_TO_END_RADIUS=-1,m((_Tt=ibt).prototype,"file",[oTt],Object.getOwnPropertyDescriptor(_Tt.prototype,"file"),_Tt.prototype),m(_Tt.prototype,"spriteFrame",[aTt],Object.getOwnPropertyDescriptor(_Tt.prototype,"spriteFrame"),_Tt.prototype),fTt=fa(_Tt.prototype,"duration",[Ma],(function(){return-1})),dTt=fa(_Tt.prototype,"emissionRate",[Ma],(function(){return 10})),pTt=fa(_Tt.prototype,"life",[Ma],(function(){return 1})),mTt=fa(_Tt.prototype,"lifeVar",[Ma],(function(){return 0})),m(_Tt.prototype,"color",[_h],Object.getOwnPropertyDescriptor(_Tt.prototype,"color"),_Tt.prototype),gTt=fa(_Tt.prototype,"angle",[Ma],(function(){return 90})),yTt=fa(_Tt.prototype,"angleVar",[Ma],(function(){return 20})),vTt=fa(_Tt.prototype,"startSize",[Ma],(function(){return 50})),STt=fa(_Tt.prototype,"startSizeVar",[Ma],(function(){return 0})),ATt=fa(_Tt.prototype,"endSize",[Ma],(function(){return 0})),TTt=fa(_Tt.prototype,"endSizeVar",[Ma],(function(){return 0})),bTt=fa(_Tt.prototype,"startSpin",[Ma],(function(){return 0})),ETt=fa(_Tt.prototype,"startSpinVar",[Ma],(function(){return 0})),CTt=fa(_Tt.prototype,"endSpin",[Ma],(function(){return 0})),xTt=fa(_Tt.prototype,"endSpinVar",[Ma],(function(){return 0})),wTt=fa(_Tt.prototype,"sourcePos",[Ma],(function(){return jn.ZERO.clone()})),DTt=fa(_Tt.prototype,"posVar",[Ma],(function(){return jn.ZERO.clone()})),m(_Tt.prototype,"positionType",[hTt],Object.getOwnPropertyDescriptor(_Tt.prototype,"positionType"),_Tt.prototype),RTt=fa(_Tt.prototype,"emitterMode",[Ma,uTt],(function(){return NAt.GRAVITY})),ITt=fa(_Tt.prototype,"gravity",[Ma],(function(){return jn.ZERO.clone()})),MTt=fa(_Tt.prototype,"speed",[Ma],(function(){return 180})),PTt=fa(_Tt.prototype,"speedVar",[Ma],(function(){return 50})),BTt=fa(_Tt.prototype,"tangentialAccel",[Ma],(function(){return 80})),OTt=fa(_Tt.prototype,"tangentialAccelVar",[Ma],(function(){return 0})),LTt=fa(_Tt.prototype,"radialAccel",[Ma],(function(){return 0})),NTt=fa(_Tt.prototype,"radialAccelVar",[Ma],(function(){return 0})),FTt=fa(_Tt.prototype,"rotationIsDir",[Ma],(function(){return!1})),kTt=fa(_Tt.prototype,"startRadius",[Ma],(function(){return 0})),VTt=fa(_Tt.prototype,"startRadiusVar",[Ma],(function(){return 0})),GTt=fa(_Tt.prototype,"endRadius",[Ma],(function(){return 0})),UTt=fa(_Tt.prototype,"endRadiusVar",[Ma],(function(){return 0})),zTt=fa(_Tt.prototype,"rotatePerS",[Ma],(function(){return 0})),HTt=fa(_Tt.prototype,"rotatePerSVar",[Ma],(function(){return 0})),WTt=fa(_Tt.prototype,"playOnLoad",[Ma],(function(){return!0})),jTt=fa(_Tt.prototype,"autoRemoveOnFinish",[Ma],(function(){return!1})),XTt=fa(_Tt.prototype,"_preview",[lTt],(function(){return!0})),YTt=fa(_Tt.prototype,"_custom",[Ma],(function(){return!1})),qTt=fa(_Tt.prototype,"_file",[Ma],(function(){return null})),KTt=fa(_Tt.prototype,"_spriteFrame",[Ma],(function(){return null})),QTt=fa(_Tt.prototype,"_totalParticles",[Ma],(function(){return 150})),ZTt=fa(_Tt.prototype,"_startColor",[Ma],(function(){return new bn(255,255,255,255)})),JTt=fa(_Tt.prototype,"_startColorVar",[Ma],(function(){return new bn(0,0,0,0)})),$Tt=fa(_Tt.prototype,"_endColor",[Ma],(function(){return new bn(255,255,255,0)})),tbt=fa(_Tt.prototype,"_endColorVar",[Ma],(function(){return new bn(0,0,0,0)})),ebt=fa(_Tt.prototype,"_positionType",[Ma],(function(){return FAt.FREE})),cTt=_Tt))||cTt)),ybt=function(){function t(t,e){this.point=new jn,this.dir=new jn,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}(),vbt=t("e_",(obt=Ta("cc.MotionStreak"),abt=eh(Dm),obt(((mbt=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)._preview=lbt&&lbt(),e._fadeTime=cbt&&cbt(),e._minSeg=_bt&&_bt(),e._stroke=fbt&&fbt(),e._texture=dbt&&dbt(),e._fastMode=pbt&&pbt(),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,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}(JO)).Point=ybt,m((ubt=mbt).prototype,"texture",[abt],Object.getOwnPropertyDescriptor(ubt.prototype,"texture"),ubt.prototype),lbt=fa(ubt.prototype,"_preview",[Ma],(function(){return!1})),cbt=fa(ubt.prototype,"_fadeTime",[Ma],(function(){return 1})),_bt=fa(ubt.prototype,"_minSeg",[Ma],(function(){return 1})),fbt=fa(ubt.prototype,"_stroke",[Ma],(function(){return 64})),dbt=fa(ubt.prototype,"_texture",[Ma],(function(){return null})),pbt=fa(ubt.prototype,"_fastMode",[Ma],(function(){return!1})),hbt=ubt))||hbt));new jn;var Sbt,Abt=new jn,Tbt=new jn;function bbt(t,e){return t.x=-e.y,t.y=e.x,t}var Ebt={createData:function(t){var e=t.requestRenderData();return e.dataLength=4,e.resize(16,42),e},update:function(t,e){var i,n=t.stroke/2,r=t.node.worldMatrix,s=r.m12,o=r.m13,a=t.points;if(a.length>1){var h=a[0],u=h.point.x-s,l=h.point.y-o;u*u+l*l<t.minSeg&&(i=h)}i||(i=new vbt.Point,a.unshift(i)),i.setPoint(s,o),i.time=t.fadeTime+e;var c,_=0;if(!(a.length<2)){var f=t.renderData;this.updateRenderDataCache(t,f);var d=t.color,p=d.r,m=d.g,g=d.b,y=d.a,v=a[1];v.distance=jn.subtract(Tbt,i.point,v.point).length(),Tbt.normalize(),v.setDir(Tbt.x,Tbt.y),i.setDir(Tbt.x,Tbt.y),f.dataLength=2*a.length;for(var S=f.data,A=t.fadeTime,T=!1,b=a.length-1;b>=0;b--){var E=a[b],C=E.point,x=E.dir;if(E.time-=e,E.time<0)a.splice(b,1);else{var w=E.time/A,D=a[b-1];if(!T){if(!D){a.splice(b,1);continue}C.x=D.point.x-x.x*w,C.y=D.point.y-x.y*w}T=!0,bbt(Abt,x);var R=w*y,I=_;S[I].x=C.x+Abt.x*n,S[I].y=C.y+Abt.y*n,S[I].u=1,S[I].v=w,S[I].color.set(p,m,g,R),S[I+=1].x=C.x-Abt.x*n,S[I].y=C.y-Abt.y*n,S[I].u=0,S[I].v=w,S[I].color.set(p,m,g,R),_+=2}}c=_<=2?0:3*(_-2),f.resize(_,c)}},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 o=s*i;r[o+0]=n[s].x,r[o+1]=n[s].y,r[o+2]=n[s].z,r[o+3]=n[s].u,r[o+4]=n[s].v,bn.toArray(r,n[s].color,o+5)}},createQuadIndices:function(t,e){var i=t.renderData.chunk.meshBuffer.indexOffset;Sbt=null,Sbt=new Uint16Array(e);for(var n=0,r=e;n<r;n+=2){var s=0+n;Sbt[i++]=s,Sbt[i++]=s+2,Sbt[i++]=s+1,Sbt[i++]=s+1,Sbt[i++]=s+2,Sbt[i++]=s+3}},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()},updateRenderData:function(){},updateColor:function(){},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=e.vertexCount,s=e.indexCount,o=i.vb,a=0,h=0;h<r;h++){var u=n[h];o[a++]=u.x,o[a++]=u.y,o[a++]=u.z,o[a++]=u.u,o[a++]=u.v,bn.toArray(o,u.color,a),a+=4}i.bufferId;for(var l=i.vertexOffset,c=i.meshBuffer,_=i.meshBuffer.iData,f=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()}},Cbt=t("e$",{getAssembler:function(){return Ebt}});vbt.Assembler=Cbt;var xbt,wbt,Dbt,Rbt,Ibt,Mbt={maxParticleDeltaTime:0,createData:function(){return CO.add()},removeData:function(t){CO.remove(t)},updateRenderData:function(){},fillBuffers:function(){}},Pbt=t("f0",{getAssembler:function(){return Mbt.maxParticleDeltaTime||(Mbt.maxParticleDeltaTime=v.game.frameTime/1e3*2),Mbt}});gbt.Assembler=Pbt,t("f4",xbt),function(t){t[t.Static=0]="Static",t[t.Kinematic=1]="Kinematic",t[t.Dynamic=2]="Dynamic",t[t.Animated=3]="Animated"}(xbt||t("f4",xbt={})),be(xbt),t("f5",wbt),function(t){t[t.None=0]="None",t[t.BOX=1]="BOX",t[t.CIRCLE=2]="CIRCLE",t[t.POLYGON=3]="POLYGON"}(wbt||t("f5",wbt={})),be(wbt),t("f6",Dbt),function(t){t[t.None=0]="None",t[t.DISTANCE=1]="DISTANCE",t[t.SPRING=2]="SPRING",t[t.WHEEL=3]="WHEEL",t[t.MOUSE=4]="MOUSE",t[t.FIXED=5]="FIXED",t[t.SLIDER=6]="SLIDER",t[t.RELATIVE=7]="RELATIVE",t[t.HINGE=8]="HINGE"}(Dbt||t("f6",Dbt={})),be(Dbt),t("f7",Rbt),function(t){t[t.DEFAULT=1]="DEFAULT"}(Rbt||t("f7",Rbt={})),be(Rbt),t("f8",Ibt),function(t){t[t.Closest=0]="Closest",t[t.Any=1]="Any",t[t.AllClosest=2]="AllClosest",t[t.All=3]="All"}(Ibt||t("f8",Ibt={}));var Bbt,Obt=t("f9",{None:"none-contact",BEGIN_CONTACT:"begin-contact",END_CONTACT:"end-contact",PRE_SOLVE:"pre-solve",POST_SOLVE:"post-solve"});t("fa",Bbt),function(t){t[t.None=0]="None",t[t.Shape=1]="Shape",t[t.Joint=2]="Joint",t[t.Aabb=4]="Aabb",t[t.Pair=8]="Pair",t[t.CenterOfMass=16]="CenterOfMass",t[t.Particle=32]="Particle",t[t.Controller=64]="Controller",t[t.All=63]="All"}(Bbt||t("fa",Bbt={}));var Lbt=t("fb",32),Nbt=t("f3",{id:"",switchTo:function(t){var e=Nbt;Nbt.physicsWorld&&t!==Nbt.id&&null!=Nbt.backend[t]?(G("[PHYSICS2D]: switch from "+Nbt.id+" to "+t+"."),e.id=t,e.wrapper=Nbt.backend[t],e.physicsWorld=kbt()):(G("[PHYSICS2D]: using "+e.id+"."),e.physicsWorld=kbt())},register:function(t,e){if(G("[PHYSICS2D]: register "+t+"."),Nbt.backend[t]=e,!Nbt.physicsWorld||Nbt.id===t){var i=Nbt;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0}),Fbt=function(){return 0};function kbt(){return new Nbt.wrapper.PhysicsWorld}var Vbt={impl:null,rigidBody:null,isAwake:!1,isSleeping:!1,initialize:Fbt,setType:Fbt,setLinearDamping:Fbt,setAngularDamping:Fbt,setGravityScale:Fbt,setFixedRotation:Fbt,setAllowSleep:Fbt,isActive:Fbt,setActive:Fbt,wakeUp:Fbt,sleep:Fbt,getMass:Fbt,getInertia:Fbt,getLinearVelocity:Fbt,setLinearVelocity:Fbt,getLinearVelocityFromWorldPoint:Fbt,getAngularVelocity:Fbt,setAngularVelocity:Fbt,getLocalVector:Fbt,getWorldVector:Fbt,getLocalPoint:Fbt,getWorldPoint:Fbt,getLocalCenter:Fbt,getWorldCenter:Fbt,applyForce:Fbt,applyForceToCenter:Fbt,applyTorque:Fbt,applyLinearImpulse:Fbt,applyLinearImpulseToCenter:Fbt,applyAngularImpulse:Fbt,onEnable:Fbt,onDisable:Fbt,onDestroy:Fbt},Gbt={INITED:!1};var Ubt={INITED:!1},zbt={impl:null,initialize:Fbt,apply:Fbt,setDampingRatio:Fbt,setFrequency:Fbt,setMaxForce:Fbt,setTarget:Fbt,setDistance:Fbt,setAngularOffset:Fbt,setCorrectionFactor:Fbt,setLinearOffset:Fbt,setMaxLength:Fbt,setMaxTorque:Fbt,setLowerLimit:Fbt,setUpperLimit:Fbt,setMaxMotorForce:Fbt,setMaxMotorTorque:Fbt,setMotorSpeed:Fbt,enableLimit:Fbt,enableMotor:Fbt,setLowerAngle:Fbt,setUpperAngle:Fbt};function Hbt(t,e){return t(e={exports:{}},e.exports),e.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var Wbt,jbt=Hbt((function(t,e){!function(t){function e(t,e){return void 0!==t?t:e}var i=1e37,r=1e-5,o=r*r,a=3.14159265359,h=.1,l=.008,c=2/180*a,_=.016,d=.2,p=8/180*a,m=.5*a,g=2.4674011002726646,y=-1,v=.75,S=.25,A=256,T=.01,b=2/180*a;var E=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}(),C=new E(2,3,2);function x(t,e){for(var i=new Array(t),n=0;n<t;++n)i[n]=e(n);return i}function w(t,e){void 0===e&&(e=0);for(var i=new Array(t),n=0;n<t;++n)i[n]=e;return i}var D=a/180,R=180/a,I=2*a,M=Math.abs;function P(t,e){return t<e?t:e}function B(t,e){return t>e?t:e}function O(t,e,i){return t<e?e:t>i?i:t}var L=isFinite;function N(t){return t*t}function F(t){return 1/Math.sqrt(t)}var k=Math.sqrt,V=Math.pow;var G=Math.cos,U=Math.sin,z=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=P(this.x,t.x),this.y=P(this.y,t.y),this},e.SelfMaxV=function(t){return this.x=B(this.x,t.x),this.y=B(this.y,t.y),this},e.SelfAbs=function(){return this.x=M(this.x),this.y=M(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 x(e,(function(){return new t}))},t.AbsV=function(t,e){return e.x=M(t.x),e.y=M(t.y),e},t.MinV=function(t,e,i){return i.x=P(t.x,e.x),i.y=P(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=B(t.x,e.x),i.y=B(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=O(t.x,e.x,i.x),n.y=O(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),o=Math.sin(e);return i.x=s*n-o*r,i.y=o*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 X=new j(0,0),Y=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,o=e.x,a=e.y,h=e.z;return i.x=r*h-s*a,i.y=s*o-n*h,i.z=n*a-r*o,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}();Y.ZERO=new Y(0,0,0),Y.s_t0=new Y;var q=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,o=this.ey.y,a=n*o-r*s;return 0!==a&&(a=1/a),i.x=a*(o*t-r*e),i.y=a*(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=M(i.x),e.ex.y=M(i.y),e.ey.x=M(n.x),e.ey.y=M(n.y),e},t.MulMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,o=e.y;return i.x=n.x*s+r.x*o,i.y=n.y*s+r.y*o,i},t.MulTMV=function(t,e,i){var n=t.ex,r=t.ey,s=e.x,o=e.y;return i.x=n.x*s+n.y*o,i.y=r.x*s+r.y*o,i},t.AddMM=function(t,e,i){var n=t.ex,r=t.ey,s=e.ex,o=e.ey;return i.ex.x=n.x+s.x,i.ex.y=n.y+s.y,i.ey.x=r.x+o.x,i.ey.y=r.y+o.y,i},t.MulMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,o=t.ey.y,a=e.ex.x,h=e.ex.y,u=e.ey.x,l=e.ey.y;return i.ex.x=n*a+s*h,i.ex.y=r*a+o*h,i.ey.x=n*u+s*l,i.ey.y=r*u+o*l,i},t.MulTMM=function(t,e,i){var n=t.ex.x,r=t.ex.y,s=t.ey.x,o=t.ey.y,a=e.ex.x,h=e.ex.y,u=e.ey.x,l=e.ey.y;return i.ex.x=n*a+r*h,i.ex.y=s*a+o*h,i.ey.x=n*u+r*l,i.ey.y=s*u+o*l,i},t}();q.IDENTITY=new q;var K=function(){function t(){this.data=new Float32Array([1,0,0,0,1,0,0,0,1]),this.ex=new Y(this.data.subarray(0,3)),this.ey=new Y(this.data.subarray(3,6)),this.ez=new Y(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,o=this.ex.z,a=this.ey.x,h=this.ey.y,u=this.ey.z,l=this.ez.x,c=this.ez.y,_=this.ez.z,f=r*(h*_-u*c)+s*(u*l-a*_)+o*(a*c-h*l);return 0!==f&&(f=1/f),n.x=f*(t*(h*_-u*c)+e*(u*l-a*_)+i*(a*c-h*l)),n.y=f*(r*(e*_-i*c)+s*(i*l-t*_)+o*(t*c-e*l)),n.z=f*(r*(h*i-u*e)+s*(u*t-a*i)+o*(a*e-h*t)),n},e.Solve22=function(t,e,i){var n=this.ex.x,r=this.ey.x,s=this.ex.y,o=this.ey.y,a=n*o-r*s;return 0!==a&&(a=1/a),i.x=a*(o*t-r*e),i.y=a*(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=Y.DotV3V3(this.ex,Y.CrossV3V3(this.ey,this.ez,Y.s_t0));0!==e&&(e=1/e);var i=this.ex.x,n=this.ey.x,r=this.ez.x,s=this.ey.y,o=this.ez.y,a=this.ez.z;t.ex.x=e*(s*a-o*o),t.ex.y=e*(r*o-n*a),t.ex.z=e*(n*o-r*s),t.ey.x=t.ex.y,t.ey.y=e*(i*a-r*r),t.ey.z=e*(r*n-i*o),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}();K.IDENTITY=new K;var Q=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,o=e.s;return i.s=r*s+n*o,i.c=n*s-r*o,i},t.MulTRR=function(t,e,i){var n=t.c,r=t.s,s=e.c,o=e.s;return i.s=n*o-r*s,i.c=n*s+r*o,i},t.MulRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,o=e.y;return i.x=n*s-r*o,i.y=r*s+n*o,i},t.MulTRV=function(t,e,i){var n=t.c,r=t.s,s=e.x,o=e.y;return i.x=n*s+r*o,i.y=-r*s+n*o,i},t}();Q.IDENTITY=new Q;var Z=function(){function t(){this.p=new j,this.q=new Q}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,o=e.y;return i.x=n*s-r*o+t.p.x,i.y=r*s+n*o+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,o=e.y-t.p.y;return i.x=n*s+r*o,i.y=-r*s+n*o,i},t.MulXX=function(t,e,i){return Q.MulRR(t.q,e.q,i.q),j.AddVV(Q.MulRV(t.q,e.p,i.p),t.p,i.p),i},t.MulTXX=function(t,e,i){return Q.MulTRR(t.q,e.q,i.q),Q.MulTRV(t.q,j.SubVV(e.p,t.p,i.p),i.p),i},t}();Z.IDENTITY=new Z;var J,$=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(Q.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=I*Math.floor(this.a0/I);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,o="number"==typeof e[3]?e[3]:1;this.data=new Float32Array([n,r,s,o])}}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),o=i*(e.a-t.a);t.r+=n,t.g+=r,t.b+=s,t.a+=o,e.r-=n,e.g-=r,e.b-=s,e.a-=o},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),(J=t.b2DrawFlags||(t.b2DrawFlags={}))[J.e_none=0]="e_none",J[J.e_shapeBit=1]="e_shapeBit",J[J.e_jointBit=2]="e_jointBit",J[J.e_aabbBit=4]="e_aabbBit",J[J.e_pairBit=8]="e_pairBit",J[J.e_centerOfMassBit=16]="e_centerOfMassBit",J[J.e_particleBit=32]="e_particleBit",J[J.e_controllerBit=64]="e_controllerBit",J[J.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=x(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}(),ot=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}(),at=function(){function t(){this.proxyA=new st,this.proxyB=new st,this.transformA=new Z,this.transformB=new Z,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 o=this.m_vertices,a=0;a<this.m_count;++a){var h=o[a];h.indexA=t.indexA[a],h.indexB=t.indexB[a];var u=e.GetVertex(h.indexA),l=n.GetVertex(h.indexB);Z.MulXV(i,u,h.wA),Z.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,_=this.GetMetric();(_<.5*c||2*c<_||_<r)&&(this.m_count=0)}if(0===this.m_count){var f=o[0];f.indexA=0,f.indexB=0;var d=e.GetVertex(0),p=n.GetVertex(0);Z.MulXV(i,d,f.wA),Z.MulXV(s,p,f.wB),j.SubVV(f.wB,f.wA,f.w),f.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: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);case 3:default:return t.SetZero()}},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: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));default:return 0}},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 o=1/(s+r);this.m_v1.a=s*o,this.m_v2.a=r*o,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),o=j.DotVV(i,r),a=-s,h=j.SubVV(n,e,t.s_e13),u=j.DotVV(e,h),l=j.DotVV(n,h),c=-u,_=j.SubVV(n,i,t.s_e23),f=j.DotVV(i,_),d=j.DotVV(n,_),p=-f,m=j.CrossVV(r,h),g=m*j.CrossVV(i,n),y=m*j.CrossVV(n,e),v=m*j.CrossVV(e,i);if(a<=0&&c<=0)return this.m_v1.a=1,void(this.m_count=1);if(o>0&&a>0&&v<=0){var S=1/(o+a);return this.m_v1.a=o*S,this.m_v2.a=a*S,void(this.m_count=2)}if(l>0&&c>0&&y<=0){var A=1/(l+c);return this.m_v1.a=l*A,this.m_v3.a=c*A,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(o<=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 T=1/(d+p);return this.m_v2.a=d*T,this.m_v3.a=p*T,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var b=1/(g+y+v);this.m_v1.a=g*b,this.m_v2.a=y*b,this.m_v3.a=v*b,this.m_count=3},t}();lt.s_e12=new j,lt.s_e13=new j,lt.s_e23=new j;var ct=new lt,_t=[0,0,0],ft=[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,a=n.proxyB,h=n.transformA,u=n.transformB,l=ct;l.ReadCache(i,s,h,a,u);for(var c=l.m_vertices,_=_t,f=ft,d=0,p=0;p<20;){d=l.m_count;for(var m=0;m<d;++m)_[m]=c[m].indexA,f[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()<o)break;var y=c[l.m_count];y.indexA=s.GetSupport(Q.MulTRV(h.q,j.NegV(g,j.s_t0),gt)),Z.MulXV(h,s.GetVertex(y.indexA),y.wA),y.indexB=a.GetSupport(Q.MulTRV(u.q,g,yt)),Z.MulXV(u,a.GetVertex(y.indexB),y.wB),j.SubVV(y.wB,y.wA,y.w),++p,++t.b2_gjkIters;for(var v=!1,S=0;S<d;++S)if(y.indexA===_[S]&&y.indexB===f[S]){v=!0;break}if(v)break;++l.m_count}if(t.b2_gjkMaxIters=B(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 A=s.m_radius,T=a.m_radius;if(e.distance>A+T&&e.distance>r){e.distance-=A+T;var b=j.SubVV(e.pointB,e.pointA,mt);b.Normalize(),e.pointA.SelfMulAdd(A,b),e.pointB.SelfMulSub(T,b)}else{var E=j.MidVV(e.pointA,e.pointB,dt);e.pointA.Copy(E),e.pointB.Copy(E),e.distance=0}}}var St,At=new j,Tt=new lt,bt=new j,Et=new j,Ct=new j,xt=new j,wt=new j,Dt=new j;(St=t.b2ContactFeatureType||(t.b2ContactFeatureType={}))[St.e_vertex=0]="e_vertex",St[St.e_face=1]="e_face";var Rt,It=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}(),Mt=function(){function t(){this.cf=new It}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}(),Pt=function(){function t(){this.localPoint=new j,this.normalImpulse=0,this.tangentImpulse=0,this.id=new Mt}t.MakeArray=function(e){return x(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}();(Rt=t.b2ManifoldType||(t.b2ManifoldType={}))[Rt.e_unknown=-1]="e_unknown",Rt[Rt.e_circles=0]="e_circles",Rt[Rt.e_faceA=1]="e_faceA",Rt[Rt.e_faceB=2]="e_faceB";var Bt,Ot=function(){function e(){this.points=Pt.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}(),Lt=function(){function e(){this.normal=new j,this.points=j.MakeArray(2),this.separations=w(2)}return e.prototype.Initialize=function(i,n,r,s,a){if(0!==i.pointCount)switch(i.type){case t.b2ManifoldType.e_circles:this.normal.Set(1,0);var h=Z.MulXV(n,i.localPoint,e.Initialize_s_pointA),u=Z.MulXV(s,i.points[0].localPoint,e.Initialize_s_pointB);j.DistanceSquaredVV(h,u)>o&&j.SubVV(u,h,this.normal).SelfNormalize();var l=j.AddVMulSV(h,r,this.normal,e.Initialize_s_cA),c=j.SubVMulSV(u,a,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:Q.MulRV(n.q,i.localNormal,this.normal);for(var _=Z.MulXV(n,i.localPoint,e.Initialize_s_planePoint),f=0;f<i.pointCount;++f){var d=Z.MulXV(s,i.points[f].localPoint,e.Initialize_s_clipPoint),p=r-j.DotVV(j.SubVV(d,_,j.s_t0),this.normal),m=j.AddVMulSV(d,p,this.normal,e.Initialize_s_cA),g=j.SubVMulSV(d,a,this.normal,e.Initialize_s_cB);j.MidVV(m,g,this.points[f]),this.separations[f]=j.DotVV(j.SubVV(g,m,j.s_t0),this.normal)}break;case t.b2ManifoldType.e_faceB:Q.MulRV(s.q,i.localNormal,this.normal);for(var y=Z.MulXV(s,i.localPoint,e.Initialize_s_planePoint),v=0;v<i.pointCount;++v){var S=Z.MulXV(n,i.points[v].localPoint,e.Initialize_s_clipPoint),A=a-j.DotVV(j.SubVV(S,y,j.s_t0),this.normal),T=j.AddVMulSV(S,A,this.normal,e.Initialize_s_cB),b=j.SubVMulSV(S,r,this.normal,e.Initialize_s_cA);j.MidVV(b,T,this.points[v]),this.separations[v]=j.DotVV(j.SubVV(b,T,j.s_t0),this.normal)}this.normal.SelfNeg()}},e}();Lt.Initialize_s_pointA=new j,Lt.Initialize_s_pointB=new j,Lt.Initialize_s_cA=new j,Lt.Initialize_s_cB=new j,Lt.Initialize_s_planePoint=new j,Lt.Initialize_s_clipPoint=new j,(Bt=t.b2PointState||(t.b2PointState={}))[Bt.b2_nullState=0]="b2_nullState",Bt[Bt.b2_addState=1]="b2_addState",Bt[Bt.b2_persistState=2]="b2_persistState",Bt[Bt.b2_removeState=3]="b2_removeState";var Nt=function(){function t(){this.v=new j,this.id=new Mt}return t.MakeArray=function(e){return x(e,(function(){return new t}))},t.prototype.Copy=function(t){return this.v.Copy(t.v),this.id.Copy(t.id),this},t}(),Ft=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}(),kt=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}(),Vt=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=P(this.lowerBound.x,t.lowerBound.x),this.lowerBound.y=P(this.lowerBound.y,t.lowerBound.y),this.upperBound.x=B(this.upperBound.x,t.upperBound.x),this.upperBound.y=B(this.upperBound.y,t.upperBound.y),this},e.Combine2=function(t,e){return this.lowerBound.x=P(t.lowerBound.x,e.lowerBound.x),this.lowerBound.y=P(t.lowerBound.y,e.lowerBound.y),this.upperBound.x=B(t.upperBound.x,e.upperBound.x),this.upperBound.y=B(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=-i,s=i,o=e.p1.x,a=e.p1.y,h=e.p2.x-e.p1.x,u=e.p2.y-e.p1.y,l=M(h),c=M(u),_=t.normal;if(l<r){if(o<this.lowerBound.x||this.upperBound.x<o)return!1}else{var f=1/h,d=(this.lowerBound.x-o)*f,p=(this.upperBound.x-o)*f,m=-1;if(d>p){var g=d;d=p,p=g,m=1}if(d>n&&(_.x=m,_.y=0,n=d),n>(s=P(s,p)))return!1}if(c<r){if(a<this.lowerBound.y||this.upperBound.y<a)return!1}else{var y=1/u,v=(this.lowerBound.y-a)*y,S=(this.upperBound.y-a)*y,A=-1;if(v>S){var T=v;v=S,S=T,A=1}if(v>n&&(_.x=0,_.y=A,n=v),n>(s=P(s,S)))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 Gt(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 o=0,a=i[0],h=i[1],u=j.DotVV(n,a.v)-r,l=j.DotVV(n,h.v)-r;if(u<=0&&e[o++].Copy(a),l<=0&&e[o++].Copy(h),u*l<0){var c=u/(u-l),_=e[o].v;_.x=a.v.x+c*(h.v.x-a.v.x),_.y=a.v.y+c*(h.v.y-a.v.y);var f=e[o].id;f.cf.indexA=s,f.cf.indexB=a.id.cf.indexB,f.cf.typeA=t.b2ContactFeatureType.e_vertex,f.cf.typeB=t.b2ContactFeatureType.e_face,++o}return o}var zt=new at,Ht=new ot,Wt=new ht;function jt(t,e,i,n,r,s){var o=zt.Reset();o.proxyA.SetShape(t,e),o.proxyB.SetShape(i,n),o.transformA.Copy(r),o.transformB.Copy(s),o.useRadii=!0;var a=Ht.Reset();a.count=0;var h=Wt.Reset();return vt(h,a,o),h.distance<1e-4}function Xt(t){if(null===t)throw new Error;return t}var Yt=function(){function t(t){void 0===t&&(t=0),this.m_id=0,this.aabb=new Vt,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}(),qt=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 o=j.CrossOneV(s,t.s_v),a=j.AbsV(o,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=P(n.x,l),u.lowerBound.y=P(n.y,c),u.upperBound.x=B(n.x,l),u.upperBound.y=B(n.y,c);var _=this.m_stack.Reset();for(_.Push(this.m_root);_.GetCount()>0;){var f=_.Pop();if(null!==f&&Gt(f.aabb,u)){var d=f.aabb.GetCenter(),p=f.aabb.GetExtents();if(!(M(j.DotVV(o,j.SubVV(n,d,j.s_t0)))-j.DotVV(a,p)>0))if(f.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=h;var g=i(m,f);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=P(n.x,l),u.lowerBound.y=P(n.y,c),u.upperBound.x=B(n.x,l),u.upperBound.y=B(n.y,c))}else _.Push(f.child1),_.Push(f.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 Yt(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=Xt(n.child1),s=Xt(n.child2),o=n.aabb.GetPerimeter(),a=t.s_combinedAABB;a.Combine2(n.aabb,i);var h=a.GetPerimeter(),u=2*h,l=2*(h-o),c=void 0,_=t.s_aabb,f=void 0;r.IsLeaf()?(_.Combine2(i,r.aabb),c=_.GetPerimeter()+l):(_.Combine2(i,r.aabb),f=r.aabb.GetPerimeter(),c=_.GetPerimeter()-f+l);var d=void 0;if(s.IsLeaf()?(_.Combine2(i,s.aabb),d=_.GetPerimeter()+l):(_.Combine2(i,s.aabb),f=s.aabb.GetPerimeter(),d=_.GetPerimeter()-f+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=Xt((g=this.Balance(g)).child1),v=Xt(g.child2);g.height=1+B(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=Xt(t.parent),i=e&&e.parent,n=Xt(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=Xt((r=this.Balance(r)).child1),o=Xt(r.child2);r.aabb.Combine2(s.aabb,o.aabb),r.height=1+B(s.height,o.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=Xt(t.child1),i=Xt(t.child2),n=i.height-e.height;if(n>1){var r=Xt(i.child1),s=Xt(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+B(e.height,s.height),i.height=1+B(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+B(e.height,r.height),i.height=1+B(t.height,s.height)),i}if(n<-1){var o=Xt(e.child1),a=Xt(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,o.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+B(i.height,a.height),e.height=1+B(t.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+B(i.height,o.height),e.height=1+B(t.height,a.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+B(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=Xt(t.child1),i=Xt(t.child2);this.ValidateStructure(e),this.ValidateStructure(i)}},e.ValidateMetrics=function(e){if(null!==e&&!e.IsLeaf()){var i=Xt(e.child1),n=Xt(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=Xt(t.child1),n=Xt(t.child2);return B(e,M(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 Kt(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Qt(t,e){return t<e}qt.s_r=new j,qt.s_v=new j,qt.s_abs_v=new j,qt.s_segmentAABB=new Vt,qt.s_subInput=new Ft,qt.s_combinedAABB=new Vt,qt.s_aabb=new Vt,qt.s_node_id=0;var Zt=function(t,e){this.proxyA=t,this.proxyB=e},Jt=function(){function t(){this.m_tree=new qt,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,function(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Qt);for(var r=e,s=[],o=0;;){for(;r+1<i;i++){var a=t[r+Math.floor(Math.random()*(i-r))];s[o++]=i;for(var h=r-1;;){for(;n(t[++h],a););for(;n(a,t[--i]););if(h>=i)break;Kt(t,h,i)}}if(0===o)break;r=i,i=s[--o]}}(this.m_pairBuffer,0,this.m_pairCount,$t);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 o=this.m_pairBuffer[r];if(o.proxyA.m_id!==s.proxyA.m_id||o.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 $t(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 te,ee=new Z,ie=new Z,ne=new j,re=new j,se=new j,oe=new j,ae=new j,he=function(){this.proxyA=new st,this.proxyB=new st,this.sweepA=new $,this.sweepB=new $,this.tMax=0};(te=t.b2TOIOutputState||(t.b2TOIOutputState={}))[te.e_unknown=0]="e_unknown",te[te.e_failed=1]="e_failed",te[te.e_overlapped=2]="e_overlapped",te[te.e_touching=3]="e_touching",te[te.e_separated=4]="e_separated";var ue,le=function(){this.state=t.b2TOIOutputState.e_unknown,this.t=0};(ue=t.b2SeparationFunctionType||(t.b2SeparationFunctionType={}))[ue.e_unknown=-1]="e_unknown",ue[ue.e_points=0]="e_points",ue[ue.e_faceA=1]="e_faceA",ue[ue.e_faceB=2]="e_faceB";var ce=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,o){this.m_proxyA=i,this.m_proxyB=r;var a=e.count;this.m_sweepA.Copy(n),this.m_sweepB.Copy(s);var h=ee,u=ie;if(this.m_sweepA.GetTransform(h,o),this.m_sweepB.GetTransform(u,o),1===a){this.m_type=t.b2SeparationFunctionType.e_points;var l=this.m_proxyA.GetVertex(e.indexA[0]),c=this.m_proxyB.GetVertex(e.indexB[0]),_=Z.MulXV(h,l,ne),f=Z.MulXV(u,c,re);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=Q.MulRV(u.q,this.m_axis,se);j.MidVV(p,m,this.m_localPoint);var y=Z.MulXV(u,this.m_localPoint,re),v=this.m_proxyA.GetVertex(e.indexA[0]),S=Z.MulXV(h,v,ne),A=j.DotVV(j.SubVV(S,y,j.s_t0),g);return A<0&&(this.m_axis.SelfNeg(),A=-A),A}this.m_type=t.b2SeparationFunctionType.e_faceA;var T=this.m_proxyA.GetVertex(e.indexA[0]),b=this.m_proxyA.GetVertex(e.indexA[1]);j.CrossVOne(j.SubVV(b,T,j.s_t0),this.m_axis).SelfNormalize();var E=Q.MulRV(h.q,this.m_axis,se);j.MidVV(T,b,this.m_localPoint);var C=Z.MulXV(h,this.m_localPoint,ne),x=this.m_proxyB.GetVertex(e.indexB[0]),w=Z.MulXV(u,x,re),D=j.DotVV(j.SubVV(w,C,j.s_t0),E);return D<0&&(this.m_axis.SelfNeg(),D=-D),D},i.FindMinSeparation=function(e,i,n){var r=ee,s=ie;switch(this.m_sweepA.GetTransform(r,n),this.m_sweepB.GetTransform(s,n),this.m_type){case t.b2SeparationFunctionType.e_points:var o=Q.MulTRV(r.q,this.m_axis,oe),a=Q.MulTRV(s.q,j.NegV(this.m_axis,j.s_t0),ae);e[0]=this.m_proxyA.GetSupport(o),i[0]=this.m_proxyB.GetSupport(a);var h=this.m_proxyA.GetVertex(e[0]),u=this.m_proxyB.GetVertex(i[0]),l=Z.MulXV(r,h,ne),c=Z.MulXV(s,u,re);return j.DotVV(j.SubVV(c,l,j.s_t0),this.m_axis);case t.b2SeparationFunctionType.e_faceA:var _=Q.MulRV(r.q,this.m_axis,se),f=Z.MulXV(r,this.m_localPoint,ne),d=Q.MulTRV(s.q,j.NegV(_,j.s_t0),ae);e[0]=-1,i[0]=this.m_proxyB.GetSupport(d);var p=this.m_proxyB.GetVertex(i[0]),m=Z.MulXV(s,p,re);return j.DotVV(j.SubVV(m,f,j.s_t0),_);case t.b2SeparationFunctionType.e_faceB:var g=Q.MulRV(s.q,this.m_axis,se),y=Z.MulXV(s,this.m_localPoint,re),v=Q.MulTRV(r.q,j.NegV(g,j.s_t0),oe);i[0]=-1,e[0]=this.m_proxyA.GetSupport(v);var S=this.m_proxyA.GetVertex(e[0]),A=Z.MulXV(r,S,ne);return j.DotVV(j.SubVV(A,y,j.s_t0),g);default:return e[0]=-1,i[0]=-1,0}},i.Evaluate=function(e,i,n){var r=ee,s=ie;switch(this.m_sweepA.GetTransform(r,n),this.m_sweepB.GetTransform(s,n),this.m_type){case t.b2SeparationFunctionType.e_points:var o=this.m_proxyA.GetVertex(e),a=this.m_proxyB.GetVertex(i),h=Z.MulXV(r,o,ne),u=Z.MulXV(s,a,re);return j.DotVV(j.SubVV(u,h,j.s_t0),this.m_axis);case t.b2SeparationFunctionType.e_faceA:var l=Q.MulRV(r.q,this.m_axis,se),c=Z.MulXV(r,this.m_localPoint,ne),_=this.m_proxyB.GetVertex(i),f=Z.MulXV(s,_,re);return j.DotVV(j.SubVV(f,c,j.s_t0),l);case t.b2SeparationFunctionType.e_faceB:var d=Q.MulRV(s.q,this.m_axis,se),p=Z.MulXV(s,this.m_localPoint,re),m=this.m_proxyA.GetVertex(e),g=Z.MulXV(r,m,ne);return j.DotVV(j.SubVV(g,p,j.s_t0),d);default:return 0}},e}(),_e=new it,fe=new ot,de=new at,pe=new ht,me=new ce,ge=[0],ye=[0],ve=new $,Se=new $;function Ae(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,o=B(8,B(r.m_count,s.m_count)),a=ve.Copy(i.sweepA),h=Se.Copy(i.sweepB);a.Normalize(),h.Normalize();var u=i.tMax,c=r.m_radius+s.m_radius,_=B(l,c-.024),f=.002,d=0,p=0,m=fe;m.count=0;var g=de;for(g.proxyA.Copy(i.proxyA),g.proxyB.Copy(i.proxyB),g.useRadii=!1;;){var y=ee,v=ie;a.GetTransform(y,d),h.GetTransform(v,d),g.transformA.Copy(y),g.transformB.Copy(v);var S=pe;if(vt(S,m,g),S.distance<=0){e.state=t.b2TOIOutputState.e_overlapped,e.t=0;break}if(S.distance<_+f){e.state=t.b2TOIOutputState.e_touching,e.t=d;break}var A=me;A.Initialize(m,r,a,s,h,d);for(var T=!1,b=u,E=0;;){var C=ge,x=ye,w=A.FindMinSeparation(C,x,b);if(w>_+f){e.state=t.b2TOIOutputState.e_separated,e.t=u,T=!0;break}if(w>_-f){d=b;break}var D=A.Evaluate(C[0],x[0],d);if(D<_-f){e.state=t.b2TOIOutputState.e_failed,e.t=d,T=!0;break}if(D<=_+f){e.state=t.b2TOIOutputState.e_touching,e.t=d,T=!0;break}for(var R=0,I=d,P=b;;){var O;O=1&R?I+(_-D)*(P-I)/(w-D):.5*(I+P),++R,++t.b2_toiRootIters;var L=A.Evaluate(C[0],x[0],O);if(M(L-_)<f){b=O;break}if(L>_?(I=O,D=L):(P=O,w=L),50===R)break}if(t.b2_toiMaxRootIters=B(t.b2_toiMaxRootIters,R),++E===o)break}if(++p,++t.b2_toiIters,T)break;if(20===p){e.state=t.b2TOIOutputState.e_failed,e.t=d;break}}t.b2_toiMaxIters=B(t.b2_toiMaxIters,p);var N=n.GetMilliseconds();t.b2_toiMaxTime=B(t.b2_toiMaxTime,N),t.b2_toiTime+=N}var Te=new j,be=new j;function Ee(e,i,n,r,s){e.pointCount=0;var o=Z.MulXV(n,i.m_p,Te),a=Z.MulXV(s,r.m_p,be),h=j.DistanceSquaredVV(o,a),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,xe=new j,we=new j;function De(e,n,s,o,a){e.pointCount=0;for(var h=Z.MulXV(a,o.m_p,Ce),u=Z.MulTXV(s,h,xe),l=0,c=-i,_=n.m_radius+o.m_radius,f=n.m_count,d=n.m_vertices,p=n.m_normals,m=0;m<f;++m){var g=j.DotVV(p[m],j.SubVV(u,d[m],j.s_t0));if(g>_)return;g>c&&(c=g,l=m)}var y=l,v=(y+1)%f,S=d[y],A=d[v];if(c<r)return e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[l]),j.MidVV(S,A,e.localPoint),e.points[0].localPoint.Copy(o.m_p),void(e.points[0].id.key=0);var T=j.DotVV(j.SubVV(u,S,j.s_t0),j.SubVV(A,S,j.s_t1)),b=j.DotVV(j.SubVV(u,A,j.s_t0),j.SubVV(S,A,j.s_t1));if(T<=0){if(j.DistanceSquaredVV(u,S)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(u,S,e.localNormal).SelfNormalize(),e.localPoint.Copy(S),e.points[0].localPoint.Copy(o.m_p),e.points[0].id.key=0}else if(b<=0){if(j.DistanceSquaredVV(u,A)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,j.SubVV(u,A,e.localNormal).SelfNormalize(),e.localPoint.Copy(A),e.points[0].localPoint.Copy(o.m_p),e.points[0].id.key=0}else{var E=j.MidVV(S,A,we);if(j.DotVV(j.SubVV(u,E,j.s_t1),p[y])>_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[y]).SelfNormalize(),e.localPoint.Copy(E),e.points[0].localPoint.Copy(o.m_p),e.points[0].id.key=0}}var Re=new j,Ie=new j,Me=new j,Pe=new j;function Be(t,e,n,r,s){for(var o=t.m_vertices,a=t.m_normals,h=r.m_count,u=r.m_vertices,l=Q.MulRV(e.q,a[n],Re),c=Q.MulTRV(s.q,l,Ie),_=0,f=i,d=0;d<h;++d){var p=j.DotVV(u[d],c);p<f&&(f=p,_=d)}var m=Z.MulXV(e,o[n],Me),g=Z.MulXV(s,u[_],Pe);return j.DotVV(j.SubVV(g,m,j.s_t0),l)}var Oe=new j,Le=new j;function Ne(t,e,n,r,s){for(var o=e.m_count,a=e.m_normals,h=j.SubVV(Z.MulXV(s,r.m_centroid,j.s_t0),Z.MulXV(n,e.m_centroid,j.s_t1),Oe),u=Q.MulTRV(n.q,h,Le),l=0,c=-i,_=0;_<o;++_){var f=j.DotVV(a[_],u);f>c&&(c=f,l=_)}var d=Be(e,n,l,r,s),p=(l+o-1)%o,m=Be(e,n,p,r,s),g=(l+1)%o,y=Be(e,n,g,r,s),v=0,S=0,A=0;if(m>d&&m>y)A=-1,v=p,S=m;else{if(!(y>d))return t[0]=l,d;A=1,v=g,S=y}for(;(d=Be(e,n,l=-1===A?(v+o-1)%o:(v+1)%o,r,s))>S;)v=l,S=d;return t[0]=v,S}var Fe=new j;var ke=Nt.MakeArray(2),Ve=Nt.MakeArray(2),Ge=Nt.MakeArray(2),Ue=[0],ze=[0],He=new j,We=new j,je=new j,Xe=new j,Ye=new j,qe=new j,Ke=new j,Qe=new j;function Ze(e,n,r,s,o){e.pointCount=0;var a=n.m_radius+s.m_radius,h=Ue;h[0]=0;var u=Ne(h,n,r,s,o);if(!(u>a)){var l=ze;l[0]=0;var c=Ne(l,s,o,n,r);if(!(c>a)){var _,f,d,p,m=0,g=0;c>.98*u+.001?(_=s,f=n,d=o,p=r,m=l[0],e.type=t.b2ManifoldType.e_faceB,g=1):(_=n,f=s,d=r,p=o,m=h[0],e.type=t.b2ManifoldType.e_faceA,g=0);var y=ke;!function(e,n,r,s,o,a){for(var h=n.m_normals,u=o.m_count,l=o.m_vertices,c=o.m_normals,_=Q.MulTRV(a.q,Q.MulRV(r.q,h[s],j.s_t0),Fe),f=0,d=i,p=0;p<u;++p){var m=j.DotVV(_,c[p]);m<d&&(d=m,f=p)}var g=f,y=(g+1)%u,v=e[0];Z.MulXV(a,l[g],v.v);var S=v.id.cf;S.indexA=s,S.indexB=g,S.typeA=t.b2ContactFeatureType.e_face,S.typeB=t.b2ContactFeatureType.e_vertex;var A=e[1];Z.MulXV(a,l[y],A.v);var T=A.id.cf;T.indexA=s,T.indexB=y,T.typeA=t.b2ContactFeatureType.e_face,T.typeB=t.b2ContactFeatureType.e_vertex}(y,_,d,m,f,p);var v=_.m_count,S=_.m_vertices,A=m,T=(m+1)%v,b=S[A],E=S[T],C=j.SubVV(E,b,He);C.Normalize();var x=j.CrossVOne(C,We),w=j.MidVV(b,E,je),D=Q.MulRV(d.q,C,Ye),R=j.CrossVOne(D,Xe),I=Z.MulXV(d,b,Ke),M=Z.MulXV(d,E,Qe),P=j.DotVV(R,I),B=-j.DotVV(D,I)+a,O=j.DotVV(D,M)+a,L=Ve,N=Ge;if(!(Ut(L,y,j.NegV(D,qe),B,A)<2||Ut(N,L,D,O,T)<2)){e.localNormal.Copy(x),e.localPoint.Copy(w);for(var F=0,k=0;k<2;++k){var V=N[k];if(j.DotVV(R,V.v)-P<=a){var G=e.points[F];if(Z.MulTXV(p,V.v,G.localPoint),G.id.Copy(V.id),g){var U=G.id.cf;G.id.cf.indexA=U.indexB,G.id.cf.indexB=U.indexA,G.id.cf.typeA=U.typeB,G.id.cf.typeB=U.typeA}++F}}e.pointCount=F}}}}var Je,$e=new j,ti=new j,ei=new j,ii=new j,ni=new j,ri=new j,si=new j,oi=new Mt;function ai(e,i,n,r,s){e.pointCount=0;var o=Z.MulTXV(n,Z.MulXV(s,r.m_p,j.s_t0),$e),a=i.m_vertex1,h=i.m_vertex2,u=j.SubVV(h,a,ti),l=j.DotVV(u,j.SubVV(h,o,j.s_t0)),c=j.DotVV(u,j.SubVV(o,a,j.s_t0)),_=i.m_radius+r.m_radius,f=oi;if(f.cf.indexB=0,f.cf.typeB=t.b2ContactFeatureType.e_vertex,c<=0){var d=a,p=j.SubVV(o,d,ei);if(j.DotVV(p,p)>_*_)return;if(i.m_hasVertex0){var m=i.m_vertex0,g=a,y=j.SubVV(g,m,ii);if(j.DotVV(y,j.SubVV(g,o,j.s_t0))>0)return}return f.cf.indexA=0,f.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(f),void e.points[0].localPoint.Copy(r.m_p)}if(l<=0){var v=h,S=j.SubVV(o,v,ei);if(j.DotVV(S,S)>_*_)return;if(i.m_hasVertex3){var A=i.m_vertex3,T=h,b=j.SubVV(A,T,ni);if(j.DotVV(b,j.SubVV(o,T,j.s_t0))>0)return}return f.cf.indexA=1,f.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(f),void e.points[0].localPoint.Copy(r.m_p)}var E=j.DotVV(u,u),C=ri;C.x=1/E*(l*a.x+c*h.x),C.y=1/E*(l*a.y+c*h.y);var x=j.SubVV(o,C,ei);if(!(j.DotVV(x,x)>_*_)){var w=si.Set(-u.y,u.x);j.DotVV(w,j.SubVV(o,a,j.s_t0))<0&&w.Set(-w.x,-w.y),w.Normalize(),f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(w),e.localPoint.Copy(a),e.points[0].id.Copy(f),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"}(Je||(Je={}));var hi,ui=function(){this.type=Je.e_unknown,this.index=0,this.separation=0},li=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"}(hi||(hi={}));var ci=function(){function e(){this.m_polygonB=new li,this.m_xf=new Z,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=hi.e_isolated,this.m_type2=hi.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,o){Z.MulTXX(r,o,this.m_xf),Z.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 a=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,_=0,f=!1,d=!1;if(a){var p=j.SubVV(this.m_v1,this.m_v0,e.s_edge0);p.Normalize(),this.m_normal0.Set(p.y,-p.x),f=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,_=j.DotVV(this.m_normal2,j.SubVV(this.m_centroidB,this.m_v2,j.s_t0))}a&&h?f&&d?(this.m_front=c>=0||l>=0||_>=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())):f?(this.m_front=c>=0||l>=0&&_>=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=_>=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&&_>=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())):a?f?(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||_>=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&&_>=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),Z.MulXV(this.m_xf,s.m_vertices[g],this.m_polygonB.vertices[g]),Q.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!==Je.e_unknown&&!(y.separation>this.m_radius)){var v=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(v.type!==Je.e_unknown&&v.separation>this.m_radius)){var S;S=v.type===Je.e_unknown?y:v.separation>.98*y.separation+.001?v:y;var A=e.s_ie,T=e.s_rf;if(S.type===Je.e_edgeA){i.type=t.b2ManifoldType.e_faceA;for(var b=0,E=j.DotVV(this.m_normal,this.m_polygonB.normals[0]),C=1;C<this.m_polygonB.count;++C){var x=j.DotVV(this.m_normal,this.m_polygonB.normals[C]);x<E&&(E=x,b=C)}var w=b,D=(w+1)%this.m_polygonB.count,R=A[0];R.v.Copy(this.m_polygonB.vertices[w]),R.id.cf.indexA=0,R.id.cf.indexB=w,R.id.cf.typeA=t.b2ContactFeatureType.e_face,R.id.cf.typeB=t.b2ContactFeatureType.e_vertex;var I=A[1];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,this.m_front?(T.i1=0,T.i2=1,T.v1.Copy(this.m_v1),T.v2.Copy(this.m_v2),T.normal.Copy(this.m_normal1)):(T.i1=1,T.i2=0,T.v1.Copy(this.m_v2),T.v2.Copy(this.m_v1),T.normal.Copy(this.m_normal1).SelfNeg())}else{i.type=t.b2ManifoldType.e_faceB;var M=A[0];M.v.Copy(this.m_v1),M.id.cf.indexA=0,M.id.cf.indexB=S.index,M.id.cf.typeA=t.b2ContactFeatureType.e_vertex,M.id.cf.typeB=t.b2ContactFeatureType.e_face;var P=A[1];P.v.Copy(this.m_v2),P.id.cf.indexA=0,P.id.cf.indexB=S.index,P.id.cf.typeA=t.b2ContactFeatureType.e_vertex,P.id.cf.typeB=t.b2ContactFeatureType.e_face,T.i1=S.index,T.i2=(T.i1+1)%this.m_polygonB.count,T.v1.Copy(this.m_polygonB.vertices[T.i1]),T.v2.Copy(this.m_polygonB.vertices[T.i2]),T.normal.Copy(this.m_polygonB.normals[T.i1])}T.sideNormal1.Set(T.normal.y,-T.normal.x),T.sideNormal2.Copy(T.sideNormal1).SelfNeg(),T.sideOffset1=j.DotVV(T.sideNormal1,T.v1),T.sideOffset2=j.DotVV(T.sideNormal2,T.v2);var B=e.s_clipPoints1,O=e.s_clipPoints2;if(!(Ut(B,A,T.sideNormal1,T.sideOffset1,T.i1)<2||Ut(O,B,T.sideNormal2,T.sideOffset2,T.i2)<2)){S.type===Je.e_edgeA?(i.localNormal.Copy(T.normal),i.localPoint.Copy(T.v1)):(i.localNormal.Copy(s.m_normals[T.i1]),i.localPoint.Copy(s.m_vertices[T.i1]));for(var L=0,N=0;N<2;++N)if(j.DotVV(T.normal,j.SubVV(O[N].v,T.v1,j.s_t0))<=this.m_radius){var F=i.points[L];S.type===Je.e_edgeA?(Z.MulTXV(this.m_xf,O[N].v,F.localPoint),F.id.Copy(O[N].id)):(F.localPoint.Copy(O[N].v),F.id.cf.typeA=O[N].id.cf.typeB,F.id.cf.typeB=O[N].id.cf.typeA,F.id.cf.indexA=O[N].id.cf.indexB,F.id.cf.indexB=O[N].id.cf.indexA),++L}i.pointCount=L}}}},n.ComputeEdgeSeparation=function(t){var e=t;e.type=Je.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 n=t;n.type=Je.e_unknown,n.index=-1,n.separation=-i;for(var r=e.s_perp.Set(-this.m_normal.y,this.m_normal.x),s=0;s<this.m_polygonB.count;++s){var o=j.NegV(this.m_polygonB.normals[s],e.s_n),a=P(j.DotVV(o,j.SubVV(this.m_polygonB.vertices[s],this.m_v1,j.s_t0)),j.DotVV(o,j.SubVV(this.m_polygonB.vertices[s],this.m_v2,j.s_t0)));if(a>this.m_radius)return n.type=Je.e_edgeB,n.index=s,n.separation=a,n;if(j.DotVV(o,r)>=0){if(j.DotVV(j.SubVV(o,this.m_upperLimit,j.s_t0),this.m_normal)<-c)continue}else if(j.DotVV(j.SubVV(o,this.m_lowerLimit,j.s_t0),this.m_normal)<-c)continue;a>n.separation&&(n.type=Je.e_edgeB,n.index=s,n.separation=a)}return n},e}();ci.s_edge1=new j,ci.s_edge0=new j,ci.s_edge2=new j,ci.s_ie=Nt.MakeArray(2),ci.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},ci.s_clipPoints1=Nt.MakeArray(2),ci.s_clipPoints2=Nt.MakeArray(2),ci.s_edgeAxis=new ui,ci.s_polygonAxis=new ui,ci.s_n=new j,ci.s_perp=new j;var _i=new ci;function fi(t,e,i,n,r){_i.Collide(t,e,i,n,r)}var di,pi=function(){this.mass=0,this.center=new j(0,0),this.I=0};(di=t.b2ShapeType||(t.b2ShapeType={}))[di.e_unknown=-1]="e_unknown",di[di.e_circleShape=0]="e_circleShape",di[di.e_edgeShape=1]="e_edgeShape",di[di.e_polygonShape=2]="e_polygonShape",di[di.e_chainShape=3]="e_chainShape",di[di.e_shapeTypeCount=4]="e_shapeTypeCount";var mi=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}(),gi=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=Z.MulXV(t,this.m_p,i.TestPoint_s_center),r=j.SubVV(e,n,i.TestPoint_s_d);return j.DotVV(r,r)<=N(this.m_radius)},n.ComputeDistance=function(t,e,n){var r=Z.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=Z.MulXV(n,this.m_p,i.RayCast_s_position),o=j.SubVV(e.p1,s,i.RayCast_s_s),a=j.DotVV(o,o)-N(this.m_radius),h=j.SubVV(e.p2,e.p1,i.RayCast_s_r),u=j.DotVV(o,h),l=j.DotVV(h,h),c=u*u-l*a;if(c<0||l<r)return!1;var _=-(u+k(c));return 0<=_&&_<=e.maxFraction*l&&(_/=l,t.fraction=_,j.AddVMulSV(o,_,h,t.normal).SelfNormalize(),!0)},n.ComputeAABB=function(t,e){var n=Z.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=N(this.m_radius);t.mass=e*a*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=Z.MulXV(i,this.m_p,new j),o=-(j.DotVV(t,s)-e);if(o<-this.m_radius+r)return 0;if(o>this.m_radius)return n.Copy(s),a*this.m_radius*this.m_radius;var h=this.m_radius*this.m_radius,u=o*o,l=h*(H(o/this.m_radius)+a/2)+o*k(h-u),c=-2/3*V(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}(mi);gi.TestPoint_s_center=new j,gi.TestPoint_s_d=new j,gi.ComputeDistance_s_center=new j,gi.RayCast_s_position=new j,gi.RayCast_s_s=new j,gi.RayCast_s_r=new j,gi.ComputeAABB_s_p=new j;var yi=function(e){function n(){var i;return(i=e.call(this,t.b2ShapeType.e_polygonShape,_)||this).m_centroid=new j(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}s(n,e);var r=n.prototype;return r.Clone=function(){return(new n).Copy(this)},r.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},r.GetChildCount=function(){return 1},r.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)},r._Set=function(t,e){if(e<3)return this.SetAsBox(1,1);for(var i=e,r=[],s=0;s<i;++s){for(var o=t(s),a=!0,h=0;h<r.length;++h)if(j.DistanceSquaredVV(o,r[h])<16e-6){a=!1;break}a&&r.push(o)}if((i=r.length)<3)return this.SetAsBox(1,1);for(var u=0,l=r[0].x,c=1;c<i;++c){var _=r[c].x;(_>l||_===l&&r[c].y<r[u].y)&&(u=c,l=_)}for(var f=[],d=0,p=u;;){f[d]=p;for(var m=0,g=1;g<i;++g)if(m!==p){var y=j.SubVV(r[m],r[f[d]],n.Set_s_r),v=j.SubVV(r[g],r[f[d]],n.Set_s_v),S=j.CrossVV(y,v);S<0&&(m=g),0===S&&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 A=0;A<d;++A)this.m_vertices[A].Copy(r[f[A]]);for(var T=0;T<d;++T){var b=this.m_vertices[T],E=this.m_vertices[(T+1)%d],C=j.SubVV(E,b,j.s_t0);j.CrossVOne(C,this.m_normals[T]).SelfNormalize()}return n.ComputeCentroid(this.m_vertices,d,this.m_centroid),this},r.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 Z;r.SetPosition(i),r.SetRotationAngle(n);for(var s=0;s<this.m_count;++s)Z.MulXV(r,this.m_vertices[s],this.m_vertices[s]),Q.MulRV(r.q,this.m_normals[s],this.m_normals[s])}return this},r.TestPoint=function(t,e){for(var i=Z.MulTXV(t,e,n.TestPoint_s_pLocal),r=0;r<this.m_count;++r)if(j.DotVV(this.m_normals[r],j.SubVV(i,this.m_vertices[r],j.s_t0))>0)return!1;return!0},r.ComputeDistance=function(t,e,r){for(var s=Z.MulTXV(t,e,n.ComputeDistance_s_pLocal),o=-i,a=n.ComputeDistance_s_normalForMaxDistance.Copy(s),h=0;h<this.m_count;++h){var u=j.DotVV(this.m_normals[h],j.SubVV(s,this.m_vertices[h],j.s_t0));u>o&&(o=u,a.Copy(this.m_normals[h]))}if(o>0){for(var l=n.ComputeDistance_s_minDistance.Copy(a),c=o*o,_=0;_<this.m_count;++_){var f=j.SubVV(s,this.m_vertices[_],n.ComputeDistance_s_distance),d=f.LengthSquared();c>d&&(l.Copy(f),c=d)}return Q.MulRV(t.q,l,r),r.Normalize(),Math.sqrt(c)}return Q.MulRV(t.q,a,r),o},r.RayCast=function(t,e,i){for(var r=Z.MulTXV(i,e.p1,n.RayCast_s_p1),s=Z.MulTXV(i,e.p2,n.RayCast_s_p2),o=j.SubVV(s,r,n.RayCast_s_d),a=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)),_=j.DotVV(this.m_normals[l],o);if(0===_){if(c<0)return!1}else _<0&&c<a*_?(a=c/_,u=l):_>0&&c<h*_&&(h=c/_);if(h<a)return!1}return u>=0&&(t.fraction=a,Q.MulRV(i.q,this.m_normals[u],t.normal),!0)},r.ComputeAABB=function(t,e){for(var i=Z.MulXV(e,this.m_vertices[0],t.lowerBound),r=t.upperBound.Copy(i),s=0;s<this.m_count;++s){var o=Z.MulXV(e,this.m_vertices[s],n.ComputeAABB_s_v);j.MinV(o,i,i),j.MaxV(o,r,r)}var a=this.m_radius;i.SelfSubXY(a,a),r.SelfAddXY(a,a)},r.ComputeMass=function(t,e){for(var i=n.ComputeMass_s_center.SetZero(),r=0,s=0,o=n.ComputeMass_s_s.SetZero(),a=0;a<this.m_count;++a)o.SelfAdd(this.m_vertices[a]);o.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],o,n.ComputeMass_s_e1),c=j.SubVV(this.m_vertices[(u+1)%this.m_count],o,n.ComputeMass_s_e2),_=j.CrossVV(l,c),f=.5*_;r+=f,i.SelfAdd(j.MulSV(f*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*_*(d*d+m*d+m*m+p*p+g*p+g*g)}t.mass=e*r,i.SelfMul(1/r),j.AddVV(i,o,t.center),t.I=e*s,t.I+=t.mass*(j.DotVV(t.center,t.center)-j.DotVV(i,i))},r.Validate=function(){for(var t=0;t<this.m_count;++t)for(var e=t,i=(t+1)%this.m_count,r=this.m_vertices[e],s=j.SubVV(this.m_vertices[i],r,n.Validate_s_e),o=0;o<this.m_count;++o)if(o!==e&&o!==i){var a=j.SubVV(this.m_vertices[o],r,n.Validate_s_v);if(j.CrossVV(s,a)<0)return!1}return!0},r.SetupDistanceProxy=function(t){t.m_vertices=this.m_vertices,t.m_count=this.m_count,t.m_radius=this.m_radius},r.ComputeSubmergedArea=function(t,e,i,r){for(var s=Q.MulTRV(i.q,t,n.ComputeSubmergedArea_s_normalL),o=e-j.DotVV(t,i.p),a=[],h=0,u=-1,l=-1,c=!1,_=0;_<this.m_count;++_){a[_]=j.DotVV(s,this.m_vertices[_])-o;var f=a[_]<-1e-5;_>0&&(f?c||(u=_-1,h++):c&&(l=_-1,h++)),c=f}switch(h){case 0:if(c){var d=n.ComputeSubmergedArea_s_md;return this.ComputeMass(d,1),Z.MulXV(i,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-a[u])/(a[m]-a[u]),v=(0-a[l])/(a[g]-a[l]),S=n.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),A=n.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),T=0,b=n.ComputeSubmergedArea_s_center.SetZero(),E=this.m_vertices[m],C=m;C!==g;){p=(C=(C+1)%this.m_count)===g?A:this.m_vertices[C];var x=.5*((E.x-S.x)*(p.y-S.y)-(E.y-S.y)*(p.x-S.x));T+=x,b.x+=x*(S.x+E.x+p.x)/3,b.y+=x*(S.y+E.y+p.y)/3,E=p}return b.SelfMul(1/T),Z.MulXV(i,b,r),T},r.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)},n.ComputeCentroid=function(t,e,i){var r=i;r.SetZero();for(var s=0,o=n.ComputeCentroid_s_pRef.SetZero(),a=1/3,h=0;h<e;++h){var u=o,l=t[h],c=t[(h+1)%e],_=j.SubVV(l,u,n.ComputeCentroid_s_e1),f=j.SubVV(c,u,n.ComputeCentroid_s_e2),d=.5*j.CrossVV(_,f);s+=d,r.x+=d*a*(u.x+l.x+c.x),r.y+=d*a*(u.y+l.y+c.y)}return r.SelfMul(1/s),r},n}(mi);yi.Set_s_r=new j,yi.Set_s_v=new j,yi.TestPoint_s_pLocal=new j,yi.ComputeDistance_s_pLocal=new j,yi.ComputeDistance_s_normalForMaxDistance=new j,yi.ComputeDistance_s_minDistance=new j,yi.ComputeDistance_s_distance=new j,yi.RayCast_s_p1=new j,yi.RayCast_s_p2=new j,yi.RayCast_s_d=new j,yi.ComputeAABB_s_v=new j,yi.ComputeMass_s_center=new j,yi.ComputeMass_s_s=new j,yi.ComputeMass_s_e1=new j,yi.ComputeMass_s_e2=new j,yi.Validate_s_e=new j,yi.Validate_s_v=new j,yi.ComputeSubmergedArea_s_normalL=new j,yi.ComputeSubmergedArea_s_md=new pi,yi.ComputeSubmergedArea_s_intoVec=new j,yi.ComputeSubmergedArea_s_outoVec=new j,yi.ComputeSubmergedArea_s_center=new j,yi.ComputeCentroid_s_pRef=new j,yi.ComputeCentroid_s_e1=new j,yi.ComputeCentroid_s_e2=new j;var vi=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_edgeShape,_)||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=Z.MulXV(t,this.m_vertex1,i.ComputeDistance_s_v1),s=Z.MulXV(t,this.m_vertex2,i.ComputeDistance_s_v2),o=j.SubVV(e,r,i.ComputeDistance_s_d),a=j.SubVV(s,r,i.ComputeDistance_s_s),h=j.DotVV(o,a);if(h>0){var u=j.DotVV(a,a);h>u?j.SubVV(e,s,o):o.SelfMulSub(h/u,a)}return n.Copy(o),n.Normalize()},n.RayCast=function(t,e,n){var r=Z.MulTXV(n,e.p1,i.RayCast_s_p1),s=Z.MulTXV(n,e.p2,i.RayCast_s_p2),o=j.SubVV(s,r,i.RayCast_s_d),a=this.m_vertex1,h=this.m_vertex2,u=j.SubVV(h,a,i.RayCast_s_e),l=t.normal.Set(u.y,-u.x).SelfNormalize(),c=j.DotVV(l,j.SubVV(a,r,j.s_t0)),_=j.DotVV(l,o);if(0===_)return!1;var f=c/_;if(f<0||e.maxFraction<f)return!1;var d=j.AddVMulSV(r,f,o,i.RayCast_s_q),p=j.SubVV(h,a,i.RayCast_s_r),m=j.DotVV(p,p);if(0===m)return!1;var g=j.DotVV(j.SubVV(d,a,j.s_t0),p)/m;return!(g<0||1<g||(t.fraction=f,Q.MulRV(n.q,t.normal,t.normal),c>0&&t.normal.SelfNeg(),0))},n.ComputeAABB=function(t,e){var n=Z.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),r=Z.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}(mi);vi.ComputeDistance_s_v1=new j,vi.ComputeDistance_s_v2=new j,vi.ComputeDistance_s_d=new j,vi.ComputeDistance_s_s=new j,vi.RayCast_s_p1=new j,vi.RayCast_s_p2=new j,vi.RayCast_s_d=new j,vi.RayCast_s_e=new j,vi.RayCast_s_q=new j,vi.RayCast_s_r=new j,vi.ComputeAABB_s_v1=new j,vi.ComputeAABB_s_v2=new j;var Si=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_chainShape,_)||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],o=Z.MulXV(e,r,i.ComputeAABB_s_v1),a=Z.MulXV(e,s,i.ComputeAABB_s_v2);j.MinV(o,a,t.lowerBound),j.MaxV(o,a,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}(mi);Si.ComputeDistance_s_edgeShape=new vi,Si.RayCast_s_edgeShape=new vi,Si.ComputeAABB_s_v1=new j,Si.ComputeAABB_s_v2=new j;var Ai=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}();Ai.DEFAULT=new Ai;var Ti=function(){this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.isSensor=!1,this.filter=new Ai},bi=function(){function t(t,e){this.aabb=new Vt,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}();bi.Synchronize_s_aabb1=new Vt,bi.Synchronize_s_aabb2=new Vt;var Ei,Ci=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 Ai,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,Ai.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 pi),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 bi(this,t)},i.DestroyProxies=function(){for(var t,e=f(this.m_proxies);!(t=e()).done;)t.value.Reset();this.m_proxies.length=0},i.TouchProxies=function(){for(var t,e=f(this.m_proxies);!(t=e()).done;)t.value.Touch()},i.SynchronizeProxies=function(t,e,i){for(var n,r=f(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}();(Ei=t.b2BodyType||(t.b2BodyType={}))[Ei.b2_unknown=-1]="b2_unknown",Ei[Ei.b2_staticBody=0]="b2_staticBody",Ei[Ei.b2_kinematicBody=1]="b2_kinematicBody",Ei[Ei.b2_dynamicBody=2]="b2_dynamicBody";var xi,wi,Di=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 Z,this.m_xf0=new Z,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 mi?this.CreateFixtureShapeDensity(t,e):this.CreateFixtureDef(t)},n.CreateFixtureDef=function(t){if(this.m_world.IsLocked())throw new Error;var e=new Ci(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(),o=r.GetFixtureB();t!==s&&t!==o||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),Z.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),Z.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),Z.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 Z.MulXV(this.m_xf,t,e)},n.GetWorldVector=function(t,e){return Q.MulRV(this.m_xf.q,t,e)},n.GetLocalPoint=function(t,e){return Z.MulTXV(this.m_xf,t,e)},n.GetLocalVector=function(t,e){return Q.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),Q.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),Q.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),Q.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}();Di.CreateFixtureShapeDensity_s_def=new Ti,Di.SetMassData_s_oldCenter=new j,Di.ResetMassData_s_localCenter=new j,Di.ResetMassData_s_oldCenter=new j,Di.ResetMassData_s_massData=new pi,Di.SynchronizeFixtures_s_xf1=new Z,Di.SynchronizeFixtures_s_displacement=new j,(wi=t.b2JointType||(t.b2JointType={}))[wi.e_unknownJoint=0]="e_unknownJoint",wi[wi.e_revoluteJoint=1]="e_revoluteJoint",wi[wi.e_prismaticJoint=2]="e_prismaticJoint",wi[wi.e_distanceJoint=3]="e_distanceJoint",wi[wi.e_pulleyJoint=4]="e_pulleyJoint",wi[wi.e_mouseJoint=5]="e_mouseJoint",wi[wi.e_gearJoint=6]="e_gearJoint",wi[wi.e_wheelJoint=7]="e_wheelJoint",wi[wi.e_weldJoint=8]="e_weldJoint",wi[wi.e_frictionJoint=9]="e_frictionJoint",wi[wi.e_ropeJoint=10]="e_ropeJoint",wi[wi.e_motorJoint=11]="e_motorJoint",wi[wi.e_areaJoint=12]="e_areaJoint",(xi=t.b2LimitState||(t.b2LimitState={}))[xi.e_inactiveLimit=0]="e_inactiveLimit",xi[xi.e_atLowerLimit=1]="e_atLowerLimit",xi[xi.e_atUpperLimit=2]="e_atUpperLimit",xi[xi.e_equalLimits=3]="e_equalLimits";var Ri=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}(),Ii=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}(),Mi=function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e},Pi=function(){function i(i){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_edgeA=new Ii(this),this.m_edgeB=new Ii(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}(),Bi=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}(Mi),Oi=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 Q,n.m_qB=new Q,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,o=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,_=this.m_qA.SetAngle(n),f=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),Q.MulRV(_,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),Q.MulRV(f,this.m_lalcB,this.m_rB),this.m_u.x=o.x+this.m_rB.x-e.x-this.m_rA.x,this.m_u.y=o.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*a*this.m_frequencyHz,S=2*this.m_mass*this.m_dampingRatio*v,A=this.m_mass*v*v,T=t.step.dt;this.m_gamma=T*(S+T*A),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*T*A*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 b=j.MulSV(this.m_impulse,this.m_u,i.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,b),s-=this.m_invIA*j.CrossVV(this.m_rA,b),u.SelfMulAdd(this.m_invMassB,b),c+=this.m_invIB*j.CrossVV(this.m_rB,b)}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,o=j.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),a=j.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),h=j.DotVV(this.m_u,j.SubVV(a,o,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,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s),h=Q.MulRV(o,this.m_lalcA,this.m_rA),u=Q.MulRV(a,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 _=this.m_u.Normalize()-this.m_length;_=O(_,-.2,d);var f=-this.m_mass*_,p=j.MulSV(f,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,M(_)<l},i}(Pi);Oi.InitVelocityConstraints_s_P=new j,Oi.SolveVelocityConstraints_s_vpA=new j,Oi.SolveVelocityConstraints_s_vpB=new j,Oi.SolveVelocityConstraints_s_P=new j,Oi.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}(Mi),Ni=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=w(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 Bi;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 o=n.m_bodies[s],a=n.m_bodies[(s+1)%n.m_bodies.length],h=o.GetWorldCenter(),u=a.GetWorldCenter();n.m_targetLengths[s]=j.DistanceVV(h,u),n.m_targetArea+=j.CrossVV(h,u),r.Initialize(o,a,h,u),n.m_joints[s]=o.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,o=this.m_deltas[e];j.SubVV(s,r,o)}if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;for(var a=0;a<this.m_bodies.length;++a){var h=this.m_bodies[a],u=t.velocities[h.m_islandIndex].v,l=this.m_deltas[a];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,o=this.m_deltas[n];e+=o.LengthSquared()/r.GetMass(),i+=j.CrossVV(s,o)}var a=-2*i/e;this.m_impulse+=a;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*a,l.y+=u.m_invMass*-c.x*.5*a}},n.SolvePositionConstraints=function(t){for(var e=0,i=0,n=0;n<this.m_bodies.length;++n){var s=this.m_bodies[n],o=this.m_bodies[(n+1)%this.m_bodies.length],a=t.positions[s.m_islandIndex].c,h=t.positions[o.m_islandIndex].c,u=j.SubVV(h,a,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(a,h)}i*=.5;for(var _=.5*(this.m_targetArea-i)/e,f=!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(_);var S=v.LengthSquared();S>N(d)&&v.SelfMul(d/k(S)),S>N(l)&&(f=!1),g.x+=v.x,g.y+=v.y}return f},i}(Pi),Fi=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}(Mi),ki=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 q,n.m_angularMass=0,n.m_qA=new Q,n.m_qB=new Q,n.m_lalcA=new j,n.m_lalcB=new j,n.m_K=new q,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,o=t.velocities[this.m_indexB].w,a=this.m_qA.SetAngle(e),h=this.m_qB.SetAngle(r);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var u=Q.MulRV(a,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var l=Q.MulRV(h,this.m_lalcB,this.m_rB),c=this.m_invMassA,_=this.m_invMassB,f=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=-f*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=f+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-=f*(j.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(_,m),o+=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=o},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,o=this.m_invMassA,a=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=s-n,_=-this.m_angularMass*c,f=this.m_angularImpulse,d=l*this.m_maxTorque;this.m_angularImpulse=O(this.m_angularImpulse+_,-d,d),n-=h*(_=this.m_angularImpulse-f),s+=u*_;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=q.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(o,m),n-=h*j.CrossVV(this.m_rA,m),r.SelfMulAdd(a,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}(Pi);ki.SolveVelocityConstraints_s_Cdot_v2=new j,ki.SolveVelocityConstraints_s_impulseV=new j,ki.SolveVelocityConstraints_s_oldImpulseV=new j;var Vi=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_gearJoint)||this).ratio=1,i}return s(i,e),i}(Mi),Gi=function(i){function n(n){var r,s,o;(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 Q,r.m_qB=new Q,r.m_qC=new Q,r.m_qD=new Q,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 a=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 _=n.joint1;r.m_localAnchorC.Copy(_.m_localAnchorA),r.m_localAnchorA.Copy(_.m_localAnchorB),r.m_referenceAngleA=_.m_referenceAngle,r.m_localAxisC.Copy(_.m_localXAxisA);var f=r.m_localAnchorC,d=Q.MulTRV(u.q,j.AddVV(Q.MulRV(a.q,r.m_localAnchorA,j.s_t0),j.SubVV(a.p,u.p,j.s_t1),j.s_t0),j.s_t0);s=j.DotVV(j.SubVV(d,f,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(),o=m-y-r.m_referenceAngleB}else{var S=n.joint2;r.m_localAnchorD.Copy(S.m_localAnchorA),r.m_localAnchorB.Copy(S.m_localAnchorB),r.m_referenceAngleB=S.m_referenceAngle,r.m_localAxisD.Copy(S.m_localXAxisA);var A=r.m_localAnchorD,T=Q.MulTRV(g.q,j.AddVV(Q.MulRV(p.q,r.m_localAnchorB,j.s_t0),j.SubVV(p.p,g.p,j.s_t1),j.s_t0),j.s_t0);o=j.DotVV(j.SubVV(T,A,j.s_t0),r.m_localAxisD)}return r.m_ratio=e(n.ratio,1),r.m_constant=s+r.m_ratio*o,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,o=e.positions[this.m_indexB].a,a=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,_=e.positions[this.m_indexD].a,f=e.velocities[this.m_indexD].v,d=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(o),g=this.m_qC.SetAngle(u),y=this.m_qD.SetAngle(_);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=Q.MulRV(g,this.m_localAxisC,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var S=Q.MulRV(g,this.m_lalcC,n.InitVelocityConstraints_s_rC);j.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var A=Q.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(v),this.m_JwC=j.CrossVV(S,v),this.m_JwA=j.CrossVV(A,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 T=Q.MulRV(y,this.m_localAxisD,n.InitVelocityConstraints_s_u);j.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var b=Q.MulRV(y,this.m_lalcD,n.InitVelocityConstraints_s_rD);j.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var E=Q.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);j.MulSV(this.m_ratio,T,this.m_JvBD),this.m_JwD=this.m_ratio*j.CrossVV(b,T),this.m_JwB=this.m_ratio*j.CrossVV(E,T),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,a.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,f.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,o=t.velocities[this.m_indexC].w,a=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,a,j.s_t0));u+=this.m_JwA*i-this.m_JwC*o+(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),o-=this.m_iC*l*this.m_JwC,a.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=o,t.velocities[this.m_indexD].w=h},r.SolvePositionConstraints=function(e){var i,r,s,o,a,h,u=e.positions[this.m_indexA].c,l=e.positions[this.m_indexA].a,c=e.positions[this.m_indexB].c,_=e.positions[this.m_indexB].a,f=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(_),v=this.m_qC.SetAngle(d),S=this.m_qD.SetAngle(m),A=this.m_JvAC,T=this.m_JvBD,b=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)A.SetZero(),s=1,a=1,b+=this.m_iA+this.m_iC,i=l-d-this.m_referenceAngleA;else{var E=Q.MulRV(v,this.m_localAxisC,n.SolvePositionConstraints_s_u),C=Q.MulRV(v,this.m_lalcC,n.SolvePositionConstraints_s_rC),x=Q.MulRV(g,this.m_lalcA,n.SolvePositionConstraints_s_rA);A.Copy(E),a=j.CrossVV(C,E),s=j.CrossVV(x,E),b+=this.m_mC+this.m_mA+this.m_iC*a*a+this.m_iA*s*s;var w=this.m_lalcC,D=Q.MulTRV(v,j.AddVV(x,j.SubVV(u,f,j.s_t0),j.s_t0),j.s_t0);i=j.DotVV(j.SubVV(D,w,j.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)T.SetZero(),o=this.m_ratio,h=this.m_ratio,b+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=_-m-this.m_referenceAngleB;else{var R=Q.MulRV(S,this.m_localAxisD,n.SolvePositionConstraints_s_u),I=Q.MulRV(S,this.m_lalcD,n.SolvePositionConstraints_s_rD),M=Q.MulRV(y,this.m_lalcB,n.SolvePositionConstraints_s_rB);j.MulSV(this.m_ratio,R,T),h=this.m_ratio*j.CrossVV(I,R),o=this.m_ratio*j.CrossVV(M,R),b+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*o*o;var P=this.m_lalcD,B=Q.MulTRV(S,j.AddVV(M,j.SubVV(c,p,j.s_t0),j.s_t0),j.s_t0);r=j.DotVV(j.SubVV(B,P,j.s_t0),this.m_localAxisD)}var O=i+this.m_ratio*r-this.m_constant,L=0;return b>0&&(L=-O/b),u.SelfMulAdd(this.m_mA*L,A),l+=this.m_iA*L*s,c.SelfMulAdd(this.m_mB*L,T),_+=this.m_iB*L*o,f.SelfMulSub(this.m_mC*L,A),d-=this.m_iC*L*a,p.SelfMulSub(this.m_mD*L,T),m-=this.m_iD*L*h,e.positions[this.m_indexA].a=l,e.positions[this.m_indexB].a=_,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}(Pi);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 Ui=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}(Mi),zi=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 q,n.m_angularMass=0,n.m_qA=new Q,n.m_qB=new Q,n.m_K=new q,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,o=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(i),l=this.m_qB.SetAngle(o),c=Q.MulRV(u,j.SubVV(this.m_linearOffset,this.m_localCenterA,j.s_t0),this.m_rA),_=Q.MulRV(l,j.NegV(this.m_localCenterB,j.s_t0),this.m_rB),f=this.m_invMassA,d=this.m_invMassB,p=this.m_invIA,m=this.m_invIB,g=this.m_K;if(g.ex.x=f+d+p*c.y*c.y+m*_.y*_.y,g.ex.y=-p*c.x*c.y-m*_.x*_.y,g.ey.x=g.ex.y,g.ey.y=f+d+p*c.x*c.x+m*_.x*_.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,_,j.s_t0),j.AddVV(e,c,j.s_t1),this.m_linearError),this.m_angularError=o-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(f,y),r-=p*(j.CrossVV(c,y)+this.m_angularImpulse),a.SelfMulAdd(d,y),h+=m*(j.CrossVV(_,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,o=this.m_invMassA,a=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=t.step.inv_dt,_=s-n+c*this.m_correctionFactor*this.m_angularError,f=-this.m_angularMass*_,d=this.m_angularImpulse,p=l*this.m_maxTorque;this.m_angularImpulse=O(this.m_angularImpulse+f,-p,p),n-=h*(f=this.m_angularImpulse-d),s+=u*f;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=q.MulMV(this.m_linearMass,y,i.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),S=i.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(v);var A=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>A*A&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(A)),j.SubVV(this.m_linearImpulse,S,v),e.SelfMulSub(o,v),n-=h*j.CrossVV(m,v),r.SelfMulAdd(a,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}(Pi);zi.SolveVelocityConstraints_s_Cdot_v2=new j,zi.SolveVelocityConstraints_s_impulse_v2=new j,zi.SolveVelocityConstraints_s_oldImpulse_v2=new j;var Hi=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}(Mi),Wi=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 q,n.m_C=new j,n.m_qB=new Q,n.m_lalcB=new j,n.m_K=new q,n.m_targetA.Copy(e(i.target,j.ZERO)),Z.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),o=this.m_bodyB.GetMass(),h=2*a*this.m_frequencyHz,u=2*o*this.m_dampingRatio*h,l=o*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),Q.MulRV(s,this.m_lalcB,this.m_rB);var _=this.m_K;_.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,_.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,_.ey.x=_.ex.y,_.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,_.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=q.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),o=i.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var a=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>a*a&&this.m_impulse.SelfMul(a/this.m_impulse.Length()),j.SubVV(this.m_impulse,o,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}(Pi);Wi.SolveVelocityConstraints_s_Cdot=new j,Wi.SolveVelocityConstraints_s_impulse=new j,Wi.SolveVelocityConstraints_s_oldImpulse=new j;var ji=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}(Mi),Xi=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 Y(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 K,r.m_K3=new K,r.m_K2=new q,r.m_motorMass=0,r.m_qA=new Q,r.m_qB=new Q,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,o=e.velocities[this.m_indexA].w,a=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),_=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var f=Q.MulRV(c,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var d=Q.MulRV(_,this.m_lalcB,this.m_rB),p=j.AddVV(j.SubVV(a,i,j.s_t0),j.SubVV(d,f,j.s_t1),n.InitVelocityConstraints_s_d),m=this.m_invMassA,g=this.m_invMassB,y=this.m_invIA,v=this.m_invIB;if(Q.MulRV(c,this.m_localXAxisA,this.m_axis),this.m_a1=j.CrossVV(j.AddVV(p,f,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),Q.MulRV(c,this.m_localYAxisA,this.m_perp),this.m_s1=j.CrossVV(j.AddVV(p,f,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 S=j.DotVV(this.m_axis,p);M(this.m_upperTranslation-this.m_lowerTranslation)<.016?this.m_limitState=t.b2LimitState.e_equalLimits:S<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):S>=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 A=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),T=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,b=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(m,A),o-=y*T,u.SelfMulAdd(g,A),l+=v*b}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=o,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,o=e.velocities[this.m_indexB].w,a=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*o-this.m_a1*r,_=this.m_motorMass*(this.m_motorSpeed-c),f=this.m_motorImpulse,d=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=O(this.m_motorImpulse+_,-d,d),_=this.m_motorImpulse-f;var p=j.MulSV(_,this.m_axis,n.SolveVelocityConstraints_s_P),m=_*this.m_a1,g=_*this.m_a2;i.SelfMulSub(a,p),r-=u*m,s.SelfMulAdd(h,p),o+=l*g}var y=j.DotVV(this.m_perp,j.SubVV(s,i,j.s_t0))+this.m_s2*o-this.m_s1*r,v=o-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var S=j.DotVV(this.m_axis,j.SubVV(s,i,j.s_t0))+this.m_a2*o-this.m_a1*r,A=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),T=this.m_K.Solve33(-y,-v,-S,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(T),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=B(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=P(this.m_impulse.z,0));var b=-y-(this.m_impulse.z-A.z)*this.m_K.ez.x,E=-v-(this.m_impulse.z-A.z)*this.m_K.ez.y,C=this.m_K.Solve22(b,E,n.SolveVelocityConstraints_s_f2r);C.x+=A.x,C.y+=A.y,this.m_impulse.x=C.x,this.m_impulse.y=C.y,T.x=this.m_impulse.x-A.x,T.y=this.m_impulse.y-A.y,T.z=this.m_impulse.z-A.z;var x=j.AddVV(j.MulSV(T.x,this.m_perp,j.s_t0),j.MulSV(T.z,this.m_axis,j.s_t1),n.SolveVelocityConstraints_s_P),w=T.x*this.m_s1+T.y+T.z*this.m_a1,D=T.x*this.m_s2+T.y+T.z*this.m_a2;i.SelfMulSub(a,x),r-=u*w,s.SelfMulAdd(h,x),o+=l*D}else{var R=this.m_K.Solve22(-y,-v,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=R.x,this.m_impulse.y+=R.y;var I=j.MulSV(R.x,this.m_perp,n.SolveVelocityConstraints_s_P),M=R.x*this.m_s1+R.y,L=R.x*this.m_s2+R.y;i.SelfMulSub(a,I),r-=u*M,s.SelfMulAdd(h,I),o+=l*L}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=o},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,o=this.m_qA.SetAngle(i),a=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,_=this.m_invIA,f=this.m_invIB,p=Q.MulRV(o,this.m_lalcA,this.m_rA),m=Q.MulRV(a,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=Q.MulRV(o,this.m_localXAxisA,this.m_axis),v=j.CrossVV(j.AddVV(g,p,j.s_t0),y),S=j.CrossVV(m,y),A=Q.MulRV(o,this.m_localYAxisA,this.m_perp),T=j.CrossVV(j.AddVV(g,p,j.s_t0),A),b=j.CrossVV(m,A),E=n.SolvePositionConstraints_s_impulse,C=j.DotVV(A,g),x=s-i-this.m_referenceAngle,w=M(C),D=M(x),R=!1,I=0;if(this.m_enableLimit){var P=j.DotVV(y,g);M(this.m_upperTranslation-this.m_lowerTranslation)<.016?(I=O(P,-.2,d),w=B(w,M(P)),R=!0):P<=this.m_lowerTranslation?(I=O(P-this.m_lowerTranslation+l,-.2,0),w=B(w,this.m_lowerTranslation-P),R=!0):P>=this.m_upperTranslation&&(I=O(P-this.m_upperTranslation-l,0,d),w=B(w,P-this.m_upperTranslation),R=!0)}if(R){var L=h+u+_*T*T+f*b*b,N=_*T+f*b,F=_*T*v+f*b*S,k=_+f;0===k&&(k=1);var V=_*v+f*S,G=h+u+_*v*v+f*S*S,U=this.m_K3;U.ex.SetXYZ(L,N,F),U.ey.SetXYZ(N,k,V),U.ez.SetXYZ(F,V,G),E=U.Solve33(-C,-x,-I,E)}else{var z=h+u+_*T*T+f*b*b,H=_*T+f*b,W=_+f;0===W&&(W=1);var X=this.m_K2;X.ex.Set(z,H),X.ey.Set(H,W);var Y=X.Solve(-C,-x,n.SolvePositionConstraints_s_impulse1);E.x=Y.x,E.y=Y.y,E.z=0}var q=j.AddVV(j.MulSV(E.x,A,j.s_t0),j.MulSV(E.z,y,j.s_t1),n.SolvePositionConstraints_s_P),K=E.x*T+E.y+E.z*v,Z=E.x*b+E.y+E.z*S;return e.SelfMulSub(h,q),i-=_*K,r.SelfMulAdd(u,q),s+=f*Z,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,w<=l&&D<=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=Q.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=Q.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),o=j.SubVV(s,r,j.s_t2),a=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(o,j.CrossSV(l,a,j.s_t0))+j.DotVV(a,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}(Pi);Xi.InitVelocityConstraints_s_d=new j,Xi.InitVelocityConstraints_s_P=new j,Xi.SolveVelocityConstraints_s_P=new j,Xi.SolveVelocityConstraints_s_f2r=new j,Xi.SolveVelocityConstraints_s_f1=new Y,Xi.SolveVelocityConstraints_s_df3=new Y,Xi.SolveVelocityConstraints_s_df2=new j,Xi.SolvePositionConstraints_s_d=new j,Xi.SolvePositionConstraints_s_impulse=new Y,Xi.SolvePositionConstraints_s_impulse1=new j,Xi.SolvePositionConstraints_s_P=new j,Xi.GetJointTranslation_s_pA=new j,Xi.GetJointTranslation_s_pB=new j,Xi.GetJointTranslation_s_d=new j,Xi.GetJointTranslation_s_axis=new j;var Yi=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,o){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=o},i}(Mi),qi=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 Q,n.m_qB=new Q,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,o=t.positions[this.m_indexB].c,a=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(a);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),Q.MulRV(l,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),Q.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(o).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var _=this.m_uA.Length(),f=this.m_uB.Length();_>.08?this.m_uA.SelfMul(1/_):this.m_uA.SetZero(),f>.08?this.m_uB.SelfMul(1/f):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,o=j.AddVCrossSV(e,n,this.m_rA,i.SolveVelocityConstraints_s_vpA),a=j.AddVCrossSV(r,s,this.m_rB,i.SolveVelocityConstraints_s_vpB),h=-j.DotVV(this.m_uA,o)-this.m_ratio*j.DotVV(this.m_uB,a),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,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=Q.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=Q.MulRV(a,this.m_lalcB,this.m_rB),c=this.m_uA.Copy(e).SelfAdd(h).SelfSub(this.m_groundAnchorA),_=this.m_uB.Copy(r).SelfAdd(u).SelfSub(this.m_groundAnchorB),f=c.Length(),d=_.Length();f>.08?c.SelfMul(1/f):c.SetZero(),d>.08?_.SelfMul(1/d):_.SetZero();var p=j.CrossVV(h,c),m=j.CrossVV(u,_),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 S=this.m_constant-f-this.m_ratio*d,A=M(S),T=-v*S,b=j.MulSV(-T,c,i.SolvePositionConstraints_s_PA),E=j.MulSV(-this.m_ratio*T,_,i.SolvePositionConstraints_s_PB);return e.SelfMulAdd(this.m_invMassA,b),n+=this.m_invIA*j.CrossVV(h,b),r.SelfMulAdd(this.m_invMassB,E),s+=this.m_invIB*j.CrossVV(u,E),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,A<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}(Pi);qi.InitVelocityConstraints_s_PA=new j,qi.InitVelocityConstraints_s_PB=new j,qi.SolveVelocityConstraints_s_vpA=new j,qi.SolveVelocityConstraints_s_vpB=new j,qi.SolveVelocityConstraints_s_PA=new j,qi.SolveVelocityConstraints_s_PB=new j,qi.SolvePositionConstraints_s_PA=new j,qi.SolvePositionConstraints_s_PB=new j,qi.GetCurrentLengthA_s_p=new j,qi.GetCurrentLengthB_s_p=new j;var Ki=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}(Mi),Qi=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 Y,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 K,r.m_motorMass=0,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_qA=new Q,r.m_qB=new Q,r.m_lalcA=new j,r.m_lalcB=new j,r.m_K=new q,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,o=e.positions[this.m_indexB].a,a=e.velocities[this.m_indexB].v,h=e.velocities[this.m_indexB].w,u=this.m_qA.SetAngle(i),l=this.m_qB.SetAngle(o);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),Q.MulRV(u,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),Q.MulRV(l,this.m_lalcB,this.m_rB);var _=this.m_invMassA,f=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=o-i-this.m_referenceAngle;M(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(_,y),s-=d*(j.CrossVV(this.m_rA,y)+this.m_motorImpulse+this.m_impulse.z),a.SelfMulAdd(f,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,o=e.velocities[this.m_indexB].w,a=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 _=o-r-this.m_motorSpeed,f=-this.m_motorMass*_,d=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=O(this.m_motorImpulse+f,-p,p),r-=u*(f=this.m_motorImpulse-d),o+=l*f}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var m=j.SubVV(j.AddVCrossSV(s,o,this.m_rB,j.s_t0),j.AddVCrossSV(i,r,this.m_rA,j.s_t1),n.SolveVelocityConstraints_s_Cdot1),g=o-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,S=-m.y+this.m_impulse.z*this.m_mass.ez.y,A=this.m_mass.Solve22(v,S,n.SolveVelocityConstraints_s_reduced_v2);y.x=A.x,y.y=A.y,y.z=-this.m_impulse.z,this.m_impulse.x+=A.x,this.m_impulse.y+=A.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 T=-m.x+this.m_impulse.z*this.m_mass.ez.x,b=-m.y+this.m_impulse.z*this.m_mass.ez.y,E=this.m_mass.Solve22(T,b,n.SolveVelocityConstraints_s_reduced_v2);y.x=E.x,y.y=E.y,y.z=-this.m_impulse.z,this.m_impulse.x+=E.x,this.m_impulse.y+=E.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(y);var C=n.SolveVelocityConstraints_s_P.Set(y.x,y.y);i.SelfMulSub(a,C),r-=u*(j.CrossVV(this.m_rA,C)+y.z),s.SelfMulAdd(h,C),o+=l*(j.CrossVV(this.m_rB,C)+y.z)}else{var x=j.SubVV(j.AddVCrossSV(s,o,this.m_rB,j.s_t0),j.AddVCrossSV(i,r,this.m_rA,j.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),w=this.m_mass.Solve22(-x.x,-x.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=w.x,this.m_impulse.y+=w.y,i.SelfMulSub(a,w),r-=u*j.CrossVV(this.m_rA,w),s.SelfMulAdd(h,w),o+=l*j.CrossVV(this.m_rB,w)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=o},r.SolvePositionConstraints=function(e){var i,r=e.positions[this.m_indexA].c,s=e.positions[this.m_indexA].a,o=e.positions[this.m_indexB].c,a=e.positions[this.m_indexB].a,h=this.m_qA.SetAngle(s),u=this.m_qB.SetAngle(a),_=0,f=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!f){var d=a-s-this.m_referenceAngle,m=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var g=O(d-this.m_lowerAngle,-.13962634015955555,p);m=-this.m_motorMass*g,_=M(g)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){var y=d-this.m_lowerAngle;_=-y,y=O(y+c,-.13962634015955555,0),m=-this.m_motorMass*y}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){var v=d-this.m_upperAngle;_=v,v=O(v-c,0,p),m=-this.m_motorMass*v}s-=this.m_invIA*m,a+=this.m_invIB*m}h.SetAngle(s),u.SetAngle(a),j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var S=Q.MulRV(h,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var A=Q.MulRV(u,this.m_lalcB,this.m_rB),T=j.SubVV(j.AddVV(o,A,j.s_t0),j.AddVV(r,S,j.s_t1),n.SolvePositionConstraints_s_C_v2);i=T.Length();var b=this.m_invMassA,E=this.m_invMassB,C=this.m_invIA,x=this.m_invIB,w=this.m_K;w.ex.x=b+E+C*S.y*S.y+x*A.y*A.y,w.ex.y=-C*S.x*S.y-x*A.x*A.y,w.ey.x=w.ex.y,w.ey.y=b+E+C*S.x*S.x+x*A.x*A.x;var D=w.Solve(T.x,T.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return r.SelfMulSub(b,D),s-=C*j.CrossVV(S,D),o.SelfMulAdd(E,D),a+=x*j.CrossVV(A,D),e.positions[this.m_indexA].a=s,e.positions[this.m_indexB].a=a,i<=l&&_<=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}(Pi);Qi.InitVelocityConstraints_s_P=new j,Qi.SolveVelocityConstraints_s_P=new j,Qi.SolveVelocityConstraints_s_Cdot_v2=new j,Qi.SolveVelocityConstraints_s_Cdot1=new j,Qi.SolveVelocityConstraints_s_impulse_v3=new Y,Qi.SolveVelocityConstraints_s_reduced_v2=new j,Qi.SolveVelocityConstraints_s_impulse_v2=new j,Qi.SolvePositionConstraints_s_C_v2=new j,Qi.SolvePositionConstraints_s_impulse=new j;var Zi=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}(Mi),Ji=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 Q,r.m_qB=new Q,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,o=e.velocities[this.m_indexA].w,a=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,_=this.m_qA.SetAngle(r),f=this.m_qB.SetAngle(h);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),Q.MulRV(_,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),Q.MulRV(f,this.m_lalcB,this.m_rB),this.m_u.Copy(a).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),o-=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=o,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,o=j.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),a=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(a,o,j.s_t0));h<0&&(u+=t.step.inv_dt*h);var l=-this.m_mass*u,c=this.m_impulse;this.m_impulse=P(0,this.m_impulse+l),l=this.m_impulse-c;var _=j.MulSV(l,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,_),i-=this.m_invIA*j.CrossVV(this.m_rA,_),r.SelfMulAdd(this.m_invMassB,_),s+=this.m_invIB*j.CrossVV(this.m_rB,_),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,o=this.m_qA.SetAngle(i),a=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=Q.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=Q.MulRV(a,this.m_lalcB,this.m_rB),c=this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(h),_=c.Normalize(),f=_-this.m_maxLength;f=O(f,0,d);var p=-this.m_mass*f,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,_-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}(Pi);Ji.InitVelocityConstraints_s_P=new j,Ji.SolveVelocityConstraints_s_vpA=new j,Ji.SolveVelocityConstraints_s_vpB=new j,Ji.SolveVelocityConstraints_s_P=new j,Ji.SolvePositionConstraints_s_P=new j;var $i=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}(Mi),tn=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 Y(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 K,n.m_qA=new Q,n.m_qB=new Q,n.m_lalcA=new j,n.m_lalcB=new j,n.m_K=new K,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,o=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),Q.MulRV(u,this.m_lalcA,this.m_rA),j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),Q.MulRV(l,this.m_lalcB,this.m_rB);var c=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=c+_+this.m_rA.y*this.m_rA.y*f+this.m_rB.y*this.m_rB.y*d,p.ey.x=-this.m_rA.y*this.m_rA.x*f-this.m_rB.y*this.m_rB.x*d,p.ez.x=-this.m_rA.y*f-this.m_rB.y*d,p.ex.y=p.ey.x,p.ey.y=c+_+this.m_rA.x*this.m_rA.x*f+this.m_rB.x*this.m_rB.x*d,p.ez.y=this.m_rA.x*f+this.m_rB.x*d,p.ex.z=p.ez.x,p.ey.z=p.ez.y,p.ez.z=f+d,this.m_frequencyHz>0){p.GetInverse22(this.m_mass);var m=f+d,g=m>0?1/m:0,y=s-e-this.m_referenceAngle,v=2*a*this.m_frequencyHz,S=2*g*this.m_dampingRatio*v,A=g*v*v,T=t.step.dt;this.m_gamma=T*(S+T*A),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*T*A*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 b=i.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(c,b),r-=f*(j.CrossVV(this.m_rA,b)+this.m_impulse.z),o.SelfMulAdd(_,b),h+=d*(j.CrossVV(this.m_rB,b)+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,o=this.m_invMassA,a=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 _=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),f=K.MulM33XY(this.m_mass,_.x,_.y,i.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=f.x,this.m_impulse.y+=f.y;var d=f;e.SelfMulSub(o,d),n-=h*j.CrossVV(this.m_rA,d),r.SelfMulAdd(a,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=K.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(o,y),n-=h*(j.CrossVV(this.m_rA,y)+g.z),r.SelfMulAdd(a,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,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,_=this.m_invIA,f=this.m_invIB;j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=Q.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,g=Q.MulRV(a,this.m_lalcB,this.m_rB),y=this.m_K;if(y.ex.x=h+u+d.y*d.y*_+g.y*g.y*f,y.ey.x=-d.y*d.x*_-g.y*g.x*f,y.ez.x=-d.y*_-g.y*f,y.ex.y=y.ey.x,y.ey.y=h+u+d.x*d.x*_+g.x*g.x*f,y.ez.y=d.x*_+g.x*f,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 S=y.Solve22(v.x,v.y,i.SolvePositionConstraints_s_P).SelfNeg();e.SelfMulSub(h,S),n-=_*j.CrossVV(d,S),r.SelfMulAdd(u,S),s+=f*j.CrossVV(g,S)}else{var A=j.SubVV(j.AddVV(r,g,j.s_t0),j.AddVV(e,d,j.s_t1),i.SolvePositionConstraints_s_C1),T=s-n-this.m_referenceAngle;p=A.Length(),m=M(T);var b=y.Solve33(A.x,A.y,T,i.SolvePositionConstraints_s_impulse).SelfNeg(),E=i.SolvePositionConstraints_s_P.Set(b.x,b.y);e.SelfMulSub(h,E),n-=_*(j.CrossVV(this.m_rA,E)+b.z),r.SelfMulAdd(u,E),s+=f*(j.CrossVV(this.m_rB,E)+b.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}(Pi);tn.InitVelocityConstraints_s_P=new j,tn.SolveVelocityConstraints_s_Cdot1=new j,tn.SolveVelocityConstraints_s_impulse1=new j,tn.SolveVelocityConstraints_s_impulse=new Y,tn.SolveVelocityConstraints_s_P=new j,tn.SolvePositionConstraints_s_C1=new j,tn.SolvePositionConstraints_s_P=new j,tn.SolvePositionConstraints_s_impulse=new Y;var en=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}(Mi),nn=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 Q,n.m_qB=new Q,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,o=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,_=t.positions[this.m_indexB].a,f=t.velocities[this.m_indexB].v,d=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(h),m=this.m_qB.SetAngle(_);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var g=Q.MulRV(p,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var y=Q.MulRV(m,this.m_lalcB,this.m_rB),v=j.SubVV(j.AddVV(c,y,j.s_t0),j.AddVV(o,g,j.s_t1),i.InitVelocityConstraints_s_d);if(Q.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){Q.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 S=e+n+r*this.m_sAx*this.m_sAx+s*this.m_sBx*this.m_sBx;if(S>0){this.m_springMass=1/S;var A=j.DotVV(v,this.m_ax),T=2*a*this.m_frequencyHz,b=2*this.m_springMass*this.m_dampingRatio*T,E=this.m_springMass*T*T,C=t.step.dt;this.m_gamma=C*(b+C*E),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=A*C*E*this.m_gamma,this.m_springMass=S+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 x=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),w=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,D=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;u.SelfMulSub(this.m_invMassA,x),l-=this.m_invIA*w,f.SelfMulAdd(this.m_invMassB,x),d+=this.m_invIB*D}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,o=t.velocities[this.m_indexA].v,a=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,o,j.s_t0))+this.m_sBx*u-this.m_sAx*a,c=-this.m_springMass*(l+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=c;var _=j.MulSV(c,this.m_ax,i.SolveVelocityConstraints_s_P),f=c*this.m_sAx,d=c*this.m_sBx;o.SelfMulSub(e,_),a-=r*f,h.SelfMulAdd(n,_);var p=(u+=s*d)-a-this.m_motorSpeed,m=-this.m_motorMass*p,g=this.m_motorImpulse,y=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=O(this.m_motorImpulse+m,-y,y),a-=r*(m=this.m_motorImpulse-g),u+=s*m;var v=j.DotVV(this.m_ay,j.SubVV(h,o,j.s_t0))+this.m_sBy*u-this.m_sAy*a,S=-this.m_mass*v;this.m_impulse+=S;var A=j.MulSV(S,this.m_ay,i.SolveVelocityConstraints_s_P),T=S*this.m_sAy,b=S*this.m_sBy;o.SelfMulSub(e,A),a-=r*T,h.SelfMulAdd(n,A),u+=s*b,t.velocities[this.m_indexA].w=a,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,o=this.m_qA.SetAngle(n),a=this.m_qB.SetAngle(s);j.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=Q.MulRV(o,this.m_lalcA,this.m_rA);j.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u,c=Q.MulRV(a,this.m_lalcB,this.m_rB),_=j.AddVV(j.SubVV(r,e,j.s_t0),j.SubVV(c,h,j.s_t1),i.SolvePositionConstraints_s_d),f=Q.MulRV(o,this.m_localYAxisA,this.m_ay),d=j.CrossVV(j.AddVV(_,h,j.s_t0),f),p=j.CrossVV(c,f),m=j.DotVV(_,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,f,i.SolvePositionConstraints_s_P),v=u*d,S=u*p;return e.SelfMulSub(this.m_invMassA,y),n-=this.m_invIA*v,r.SelfMulAdd(this.m_invMassB,y),s+=this.m_invIB*S,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,M(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=Q.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=Q.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),o=j.SubVV(s,r,j.s_t2),a=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(o,j.CrossSV(l,a,j.s_t0))+j.DotVV(a,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}(Pi);function rn(t,e){return k(t*e)}function sn(t,e){return t>e?t:e}nn.InitVelocityConstraints_s_d=new j,nn.InitVelocityConstraints_s_P=new j,nn.SolveVelocityConstraints_s_P=new j,nn.SolvePositionConstraints_s_d=new j,nn.SolvePositionConstraints_s_P=new j;var on=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}(),an=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 on(this),this.m_nodeB=new on(this),this.m_indexA=0,this.m_indexB=0,this.m_manifold=new Ot,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new Ot}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=rn(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=sn(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=rn(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=sn(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(),o=r||s,a=this.m_fixtureA.GetBody(),h=this.m_fixtureB.GetBody(),u=a.GetTransform(),l=h.GetTransform();if(o){var c=this.GetShapeA(),_=this.GetShapeB();i=jt(c,this.m_indexA,_,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 f=0;f<this.m_manifold.pointCount;++f){var d=this.m_manifold.points[f];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&&(a.SetAwake(!0),h.SetAwake(!0))}this.m_touchingFlag=i,!n&&i&&t&&t.BeginContact(this),n&&!i&&t&&t.EndContact(this),!o&&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 Ae(r,n),r.t},t}();an.ComputeTOI_s_input=new he,an.ComputeTOI_s_output=new le;var hn=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){Ee(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(an),un=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){Ze(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(an),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){De(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(an),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){ai(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(an),_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){fi(t,this.GetShapeA(),e,this.GetShapeB(),i)},e}(an),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,i,n){var r=e.Evaluate_s_edge;this.GetShapeA().GetChildEdge(r,this.m_indexA),ai(t,r,i,this.GetShapeB(),n)},e}(an);fn.Evaluate_s_edge=new vi;var 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,i,n){var r=e.Evaluate_s_edge;this.GetShapeA().GetChildEdge(r,this.m_indexA),fi(t,r,i,this.GetShapeB(),n)},e}(an);dn.Evaluate_s_edge=new vi;var pn=function(){this.pool=[],this.createFcn=null,this.destroyFcn=null,this.primary=!1},mn=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 o(t){r.push(t)}this.m_registers[i][n].pool=r,this.m_registers[i][n].createFcn=s,this.m_registers[i][n].destroyFcn=o,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=o,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 pn}this.AddType(hn.Create,hn.Destroy,t.b2ShapeType.e_circleShape,t.b2ShapeType.e_circleShape),this.AddType(ln.Create,ln.Destroy,t.b2ShapeType.e_polygonShape,t.b2ShapeType.e_circleShape),this.AddType(un.Create,un.Destroy,t.b2ShapeType.e_polygonShape,t.b2ShapeType.e_polygonShape),this.AddType(cn.Create,cn.Destroy,t.b2ShapeType.e_edgeShape,t.b2ShapeType.e_circleShape),this.AddType(_n.Create,_n.Destroy,t.b2ShapeType.e_edgeShape,t.b2ShapeType.e_polygonShape),this.AddType(fn.Create,fn.Destroy,t.b2ShapeType.e_chainShape,t.b2ShapeType.e_circleShape),this.AddType(dn.Create,dn.Destroy,t.b2ShapeType.e_chainShape,t.b2ShapeType.e_polygonShape)},i.Create=function(t,e,i,n){var r=t.GetType(),s=i.GetType(),o=this.m_registers[r][s];if(o.createFcn){var a=o.createFcn();return o.primary?a.Reset(t,e,i,n):a.Reset(i,n,t,e),a}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}(),gn=function(){function t(){}var e=t.prototype;return e.SayGoodbyeJoint=function(){},e.SayGoodbyeFixture=function(){},e.SayGoodbyeParticleGroup=function(){},e.SayGoodbyeParticle=function(){},t}(),yn=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(),o=i.GetFilterData();return s.groupIndex===o.groupIndex&&0!==s.groupIndex?s.groupIndex>0:0!=(s.maskBits&o.categoryBits)&&0!=(s.categoryBits&o.maskBits)},i.ShouldCollideFixtureParticle=function(){return!0},i.ShouldCollideParticleParticle=function(){return!0},e}();yn.b2_defaultFilter=new yn;var vn=function(){this.normalImpulses=w(2),this.tangentImpulses=w(2),this.count=0},Sn=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}();Sn.b2_defaultListener=new Sn;var An=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}(),bn=function(){function e(){this.m_broadPhase=new Jt,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=yn.b2_defaultFilter,this.m_contactListener=Sn.b2_defaultListener,this.m_contactFactory=new mn}var i=e.prototype;return i.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,o=i.GetBody(),a=n.GetBody();if(o!==a){for(var h=a.GetContactList();h;){if(h.other===o){var u=h.contact.GetFixtureA(),l=h.contact.GetFixtureB(),c=h.contact.GetChildIndexA(),_=h.contact.GetChildIndexB();if(u===i&&l===n&&c===r&&_===s)return;if(u===n&&l===i&&c===s&&_===r)return}h=h.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var f=this.m_contactFactory.Create(i,r,n,s);null!==f&&(i=f.GetFixtureA(),n=f.GetFixtureB(),r=f.GetChildIndexA(),s=f.GetChildIndexB(),o=i.m_body,a=n.m_body,f.m_prev=null,f.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=f),this.m_contactList=f,f.m_nodeA.other=a,f.m_nodeA.prev=null,f.m_nodeA.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=f.m_nodeA),o.m_contactList=f.m_nodeA,f.m_nodeB.other=o,f.m_nodeB.prev=null,f.m_nodeB.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=f.m_nodeB),a.m_contactList=f.m_nodeB,i.IsSensor()||n.IsSensor()||(o.SetAwake(!0),a.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(),o=i.GetBody(),a=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=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody,l=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody;if(u||l){var c=i.m_proxies[r].treeNode,_=n.m_proxies[s].treeNode;if(Gt(c.aabb,_.aabb))e.Update(this.m_contactListener),e=e.m_next;else{var f=e;e=f.m_next,this.Destroy(f)}}else e=e.m_next}},e}(),En=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}(),Cn=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}(),xn=function(){function t(){this.c=new j,this.a=0}return t.MakeArray=function(e){return x(e,(function(){return new t}))},t}(),wn=function(){function t(){this.v=new j,this.w=0}return t.MakeArray=function(e){return x(e,(function(){return new t}))},t}(),Dn=function(){this.step=new Cn},Rn=!1,In=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 x(e,(function(){return new t}))},t}(),Mn=function(){function t(){this.points=In.MakeArray(2),this.normal=new j,this.tangent=new j,this.normalMass=new q,this.K=new q,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 x(e,(function(){return new t}))},t}(),Pn=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 x(t,(function(){return new e}))},e}(),Bn=function(){this.step=new Cn,this.count=0},On=function(){function e(){this.normal=new j,this.point=new j,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var o=e.Initialize_s_pointA,a=e.Initialize_s_pointB,h=e.Initialize_s_planePoint,u=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:Z.MulXV(n,i.localPoint,o),Z.MulXV(r,i.localPoints[0],a),j.SubVV(a,o,this.normal).SelfNormalize(),j.MidVV(o,a,this.point),this.separation=j.DotVV(j.SubVV(a,o,j.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:Q.MulRV(n.q,i.localNormal,this.normal),Z.MulXV(n,i.localPoint,h),Z.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:Q.MulRV(r.q,i.localNormal,this.normal),Z.MulXV(r,i.localPoint,h),Z.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}();On.Initialize_s_pointA=new j,On.Initialize_s_pointB=new j,On.Initialize_s_planePoint=new j,On.Initialize_s_clipPoint=new j;var Ln=function(){function t(){this.m_step=new Cn,this.m_positionConstraints=Pn.MakeArray(1024),this.m_velocityConstraints=Mn.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=B(2*this.m_positionConstraints.length,this.m_count);this.m_positionConstraints.length<e;)this.m_positionConstraints[this.m_positionConstraints.length]=new Pn;if(this.m_velocityConstraints.length<this.m_count)for(var i=B(2*this.m_velocityConstraints.length,this.m_count);this.m_velocityConstraints.length<i;)this.m_velocityConstraints[this.m_velocityConstraints.length]=new Mn;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,o=r.m_fixtureB,a=s.GetShape(),h=o.GetShape(),u=a.m_radius,l=h.m_radius,c=s.GetBody(),_=o.GetBody(),f=r.GetManifold(),d=f.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=_.m_islandIndex,p.invMassA=c.m_invMass,p.invMassB=_.m_invMass,p.invIA=c.m_invI,p.invIB=_.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=_.m_islandIndex,m.invMassA=c.m_invMass,m.invMassB=_.m_invMass,m.localCenterA.Copy(c.m_sweep.localCenter),m.localCenterB.Copy(_.m_sweep.localCenter),m.invIA=c.m_invI,m.invIB=_.m_invI,m.localNormal.Copy(f.localNormal),m.localPoint.Copy(f.localPoint),m.pointCount=d,m.radiusA=u,m.radiusB=l,m.type=f.type;for(var g=0;g<d;++g){var y=f.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],o=this.m_positionConstraints[r],a=o.radiusA,h=o.radiusB,u=this.m_contacts[s.contactIndex].GetManifold(),l=s.indexA,c=s.indexB,_=s.invMassA,f=s.invMassB,d=s.invIA,p=s.invIB,m=o.localCenterA,g=o.localCenterB,y=this.m_positions[l].c,v=this.m_positions[l].a,S=this.m_velocities[l].v,A=this.m_velocities[l].w,T=this.m_positions[c].c,b=this.m_positions[c].a,E=this.m_velocities[c].v,C=this.m_velocities[c].w;e.q.SetAngle(v),i.q.SetAngle(b),j.SubVV(y,Q.MulRV(e.q,m,j.s_t0),e.p),j.SubVV(T,Q.MulRV(i.q,g,j.s_t0),i.p),n.Initialize(u,e,a,i,h),s.normal.Copy(n.normal),j.CrossVOne(s.normal,s.tangent);for(var x=s.pointCount,w=0;w<x;++w){var D=s.points[w];j.SubVV(n.points[w],y,D.rA),j.SubVV(n.points[w],T,D.rB);var R=j.CrossVV(D.rA,s.normal),I=j.CrossVV(D.rB,s.normal),M=_+f+d*R*R+p*I*I;D.normalMass=M>0?1/M:0;var P=s.tangent,B=j.CrossVV(D.rA,P),O=j.CrossVV(D.rB,P),L=_+f+d*B*B+p*O*O;D.tangentMass=L>0?1/L:0,D.velocityBias=0;var N=j.DotVV(s.normal,j.SubVV(j.AddVCrossSV(E,C,D.rB,j.s_t0),j.AddVCrossSV(S,A,D.rA,j.s_t1),j.s_t0));N<-1&&(D.velocityBias+=-s.restitution*N)}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,o=n.invMassA,a=n.invIA,h=n.invMassB,u=n.invIB,l=n.pointCount,c=this.m_velocities[r].v,_=this.m_velocities[r].w,f=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),_-=a*j.CrossVV(y.rA,e),c.SelfMulSub(o,e),d+=u*j.CrossVV(y.rB,e),f.SelfMulAdd(h,e)}this.m_velocities[r].w=_,this.m_velocities[s].w=d}},e.SolveVelocityConstraints=function(){for(var e=t.SolveVelocityConstraints_s_dv,i=(t.SolveVelocityConstraints_s_dv1,t.SolveVelocityConstraints_s_dv2,t.SolveVelocityConstraints_s_P),n=(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,0);n<this.m_count;++n){for(var r=this.m_velocityConstraints[n],s=r.indexA,o=r.indexB,a=r.invMassA,h=r.invIA,u=r.invMassB,l=r.invIB,c=r.pointCount,_=this.m_velocities[s].v,f=this.m_velocities[s].w,d=this.m_velocities[o].v,p=this.m_velocities[o].w,m=r.normal,g=r.tangent,y=r.friction,v=0;v<c;++v){var S=r.points[v];j.SubVV(j.AddVCrossSV(d,p,S.rB,j.s_t0),j.AddVCrossSV(_,f,S.rA,j.s_t1),e);var A=j.DotVV(e,g)-r.tangentSpeed,T=S.tangentMass*-A,b=y*S.normalImpulse,E=O(S.tangentImpulse+T,-b,b);T=E-S.tangentImpulse,S.tangentImpulse=E,j.MulSV(T,g,i),_.SelfMulSub(a,i),f-=h*j.CrossVV(S.rA,i),d.SelfMulAdd(u,i),p+=l*j.CrossVV(S.rB,i)}r.pointCount;for(var C=0;C<c;++C){var x=r.points[C];j.SubVV(j.AddVCrossSV(d,p,x.rB,j.s_t0),j.AddVCrossSV(_,f,x.rA,j.s_t1),e);var w=j.DotVV(e,m),D=-x.normalMass*(w-x.velocityBias),R=B(x.normalImpulse+D,0);D=R-x.normalImpulse,x.normalImpulse=R,j.MulSV(D,m,i),_.SelfMulSub(a,i),f-=h*j.CrossVV(x.rA,i),d.SelfMulAdd(u,i),p+=l*j.CrossVV(x.rB,i)}this.m_velocities[s].w=f,this.m_velocities[o].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,o=t.SolvePositionConstraints_s_P,a=0,h=0;h<this.m_count;++h){for(var u=this.m_positionConstraints[h],c=u.indexA,_=u.indexB,f=u.localCenterA,d=u.invMassA,p=u.invIA,m=u.localCenterB,g=u.invMassB,y=u.invIB,v=u.pointCount,S=this.m_positions[c].c,A=this.m_positions[c].a,T=this.m_positions[_].c,b=this.m_positions[_].a,E=0;E<v;++E){e.q.SetAngle(A),i.q.SetAngle(b),j.SubVV(S,Q.MulRV(e.q,f,j.s_t0),e.p),j.SubVV(T,Q.MulRV(i.q,m,j.s_t0),i.p),n.Initialize(u,e,i,E);var C=n.normal,x=n.point,w=n.separation;j.SubVV(x,S,r),j.SubVV(x,T,s),a=P(a,w);var D=O(.2*(w+l),-.2,0),R=j.CrossVV(r,C),I=j.CrossVV(s,C),M=d+g+p*R*R+y*I*I,B=M>0?-D/M:0;j.MulSV(B,C,o),S.SelfMulSub(d,o),A-=p*j.CrossVV(r,o),T.SelfMulAdd(g,o),b+=y*j.CrossVV(s,o)}this.m_positions[c].a=A,this.m_positions[_].a=b}return a>-.024},e.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,o=t.SolveTOIPositionConstraints_s_rA,a=t.SolveTOIPositionConstraints_s_rB,h=t.SolveTOIPositionConstraints_s_P,u=0,c=0;c<this.m_count;++c){var _=this.m_positionConstraints[c],f=_.indexA,d=_.indexB,p=_.localCenterA,m=_.localCenterB,g=_.pointCount,y=0,v=0;f!==e&&f!==i||(y=_.invMassA,v=_.invIA);var S=0,A=0;d!==e&&d!==i||(S=_.invMassB,A=_.invIB);for(var T=this.m_positions[f].c,b=this.m_positions[f].a,E=this.m_positions[d].c,C=this.m_positions[d].a,x=0;x<g;++x){n.q.SetAngle(b),r.q.SetAngle(C),j.SubVV(T,Q.MulRV(n.q,p,j.s_t0),n.p),j.SubVV(E,Q.MulRV(r.q,m,j.s_t0),r.p),s.Initialize(_,n,r,x);var w=s.normal,D=s.point,R=s.separation;j.SubVV(D,T,o),j.SubVV(D,E,a),u=P(u,R);var I=O(.75*(R+l),-.2,0),M=j.CrossVV(o,w),B=j.CrossVV(a,w),L=y+S+v*M*M+A*B*B,N=L>0?-I/L:0;j.MulSV(N,w,h),T.SelfMulSub(y,h),b-=v*j.CrossVV(o,h),E.SelfMulAdd(S,h),C+=A*j.CrossVV(a,h)}this.m_positions[f].a=b,this.m_positions[d].a=C}return u>=-.012},t}();Ln.InitializeVelocityConstraints_s_xfA=new Z,Ln.InitializeVelocityConstraints_s_xfB=new Z,Ln.InitializeVelocityConstraints_s_worldManifold=new Lt,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 Z,Ln.SolvePositionConstraints_s_xfB=new Z,Ln.SolvePositionConstraints_s_psm=new On,Ln.SolvePositionConstraints_s_rA=new j,Ln.SolvePositionConstraints_s_rB=new j,Ln.SolvePositionConstraints_s_P=new j,Ln.SolveTOIPositionConstraints_s_xfA=new Z,Ln.SolveTOIPositionConstraints_s_xfB=new Z,Ln.SolveTOIPositionConstraints_s_psm=new On,Ln.SolveTOIPositionConstraints_s_rA=new j,Ln.SolveTOIPositionConstraints_s_rB=new j,Ln.SolveTOIPositionConstraints_s_P=new j;var Nn,Fn=function(){function e(){this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=xn.MakeArray(1024),this.m_velocities=wn.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=B(2*this.m_positions.length,t);this.m_positions.length<r;)this.m_positions[this.m_positions.length]=new xn;if(this.m_velocities.length<t)for(var s=B(2*this.m_velocities.length,t);this.m_velocities.length<s;)this.m_velocities[this.m_velocities.length]=new wn},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,o){for(var a=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,_=this.m_velocities[u].v.Copy(l.m_linearVelocity),f=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&&(_.x+=h*(l.m_gravityScale*s.x+l.m_invMass*l.m_force.x),_.y+=h*(l.m_gravityScale*s.y+l.m_invMass*l.m_force.y),f+=h*l.m_invI*l.m_torque,_.SelfMul(1/(1+h*l.m_linearDamping)),f*=1/(1+h*l.m_angularDamping)),this.m_positions[u].a=c,this.m_velocities[u].w=f}a.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=a.GetMilliseconds(),a.Reset();for(var S=0;S<r.velocityIterations;++S){for(var A=0;A<this.m_jointCount;++A)this.m_joints[A].SolveVelocityConstraints(d);y.SolveVelocityConstraints()}y.StoreImpulses(),n.solveVelocity=a.GetMilliseconds();for(var T=0;T<this.m_bodyCount;++T){var b=this.m_positions[T].c,E=this.m_positions[T].a,C=this.m_velocities[T].v,x=this.m_velocities[T].w,w=j.MulSV(h,C,e.s_translation);if(j.DotVV(w,w)>4){var D=2/w.Length();C.SelfMul(D)}var R=h*x;R*R>g&&(x*=m/M(R)),b.x+=h*C.x,b.y+=h*C.y,E+=h*x,this.m_positions[T].a=E,this.m_velocities[T].w=x}a.Reset();for(var I=!1,B=0;B<r.positionIterations;++B){for(var O=y.SolvePositionConstraints(),L=!0,N=0;N<this.m_jointCount;++N){var F=this.m_joints[N].SolvePositionConstraints(d);L=L&&F}if(O&&L){I=!0;break}}for(var k=0;k<this.m_bodyCount;++k){var V=this.m_bodies[k];V.m_sweep.c.Copy(this.m_positions[k].c),V.m_sweep.a=this.m_positions[k].a,V.m_linearVelocity.Copy(this.m_velocities[k].v),V.m_angularVelocity=this.m_velocities[k].w,V.SynchronizeTransform()}if(n.solvePosition=a.GetMilliseconds(),this.Report(y.m_velocityConstraints),o){for(var G=i,U=0;U<this.m_bodyCount;++U){var z=this.m_bodies[U];z.GetType()!==t.b2BodyType.b2_staticBody&&(!z.m_autoSleepFlag||z.m_angularVelocity*z.m_angularVelocity>.0012184696791469947||j.DotVV(z.m_linearVelocity,z.m_linearVelocity)>1e-4?(z.m_sleepTime=0,G=0):(z.m_sleepTime+=h,G=P(G,z.m_sleepTime)))}if(G>=.5&&I)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 o=e.s_contactSolverDef;o.contacts=this.m_contacts,o.count=this.m_contactCount,o.step.Copy(t),o.positions=this.m_positions,o.velocities=this.m_velocities;for(var a=e.s_contactSolver.Initialize(o),h=0;h<t.positionIterations&&!a.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,a.InitializeVelocityConstraints();for(var u=0;u<t.velocityIterations;++u)a.SolveVelocityConstraints();for(var l=t.dt,c=0;c<this.m_bodyCount;++c){var _=this.m_positions[c].c,f=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 S=l*p;S*S>g&&(p*=m/M(S)),_.SelfMulAdd(l,d),f+=l*p,this.m_positions[c].a=f,this.m_velocities[c].w=p;var A=this.m_bodies[c];A.m_sweep.c.Copy(_),A.m_sweep.a=f,A.m_linearVelocity.Copy(d),A.m_angularVelocity=p,A.SynchronizeTransform()}this.Report(a.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 o=0;o<r.pointCount;++o)s.normalImpulses[o]=r.points[o].normalImpulse,s.tangentImpulses[o]=r.points[o].tangentImpulse;this.m_listener.PostSolve(n,s)}}},e}();Fn.s_timer=new it,Fn.s_solverData=new Dn,Fn.s_contactSolverDef=new Bn,Fn.s_contactSolver=new Ln,Fn.s_translation=new j,Fn.s_impulse=new vn,(Nn=t.b2ParticleFlag||(t.b2ParticleFlag={}))[Nn.b2_waterParticle=0]="b2_waterParticle",Nn[Nn.b2_zombieParticle=2]="b2_zombieParticle",Nn[Nn.b2_wallParticle=4]="b2_wallParticle",Nn[Nn.b2_springParticle=8]="b2_springParticle",Nn[Nn.b2_elasticParticle=16]="b2_elasticParticle",Nn[Nn.b2_viscousParticle=32]="b2_viscousParticle",Nn[Nn.b2_powderParticle=64]="b2_powderParticle",Nn[Nn.b2_tensileParticle=128]="b2_tensileParticle",Nn[Nn.b2_colorMixingParticle=256]="b2_colorMixingParticle",Nn[Nn.b2_destructionListenerParticle=512]="b2_destructionListenerParticle",Nn[Nn.b2_barrierParticle=1024]="b2_barrierParticle",Nn[Nn.b2_staticPressureParticle=2048]="b2_staticPressureParticle",Nn[Nn.b2_reactiveParticle=4096]="b2_reactiveParticle",Nn[Nn.b2_repulsiveParticle=8192]="b2_repulsiveParticle",Nn[Nn.b2_fixtureContactListenerParticle=16384]="b2_fixtureContactListenerParticle",Nn[Nn.b2_particleContactListenerParticle=32768]="b2_particleContactListenerParticle",Nn[Nn.b2_fixtureContactFilterParticle=65536]="b2_fixtureContactFilterParticle",Nn[Nn.b2_particleContactFilterParticle=131072]="b2_particleContactFilterParticle";var kn=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 Vn(t,e,i){return O(Math.ceil(Math.sqrt(t/(.01*e))*i),1,8)}var Gn,Un=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 zn=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},Hn=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 Z,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}();Hn.GetLinearVelocityFromWorldPoint_s_t0=new j;var Wn=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}(),jn=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=x(t,(function(){return new Xn})),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 n=1/t,r=new j(+i,+i),s=new j(-i,-i),o=0,a=0;a<this.m_generatorCount;a++){var h=this.m_generatorBuffer[a];h.necessary&&(j.MinV(r,h.center,r),j.MaxV(s,h.center,s),++o)}if(0===o)return this.m_countX=0,void(this.m_countY=0);r.x-=e,r.y-=e,s.x+=e,s.y+=e,this.m_countX=1+Math.floor(n*(s.x-r.x)),this.m_countY=1+Math.floor(n*(s.y-r.y)),this.m_diagram=[];for(var u=new Wn(4*this.m_countX*this.m_countY),l=0;l<this.m_generatorCount;l++){var c=this.m_generatorBuffer[l];c.center.SelfSub(r).SelfMul(n);var _=Math.floor(c.center.x),f=Math.floor(c.center.y);_>=0&&f>=0&&_<this.m_countX&&f<this.m_countY&&u.Push(new Yn(_,f,_+f*this.m_countX,c))}for(;!u.Empty();){var d=u.Front(),p=d.m_x,m=d.m_y,g=d.m_i,y=d.m_generator;u.Pop(),this.m_diagram[g]||(this.m_diagram[g]=y,p>0&&u.Push(new Yn(p-1,m,g-1,y)),m>0&&u.Push(new Yn(p,m-1,g-this.m_countX,y)),p<this.m_countX-1&&u.Push(new Yn(p+1,m,g+1,y)),m<this.m_countY-1&&u.Push(new Yn(p,m+1,g+this.m_countX,y)))}for(var v=0;v<this.m_countY;v++)for(var S=0;S<this.m_countX-1;S++){var A=S+v*this.m_countX,T=this.m_diagram[A],b=this.m_diagram[A+1];T!==b&&(u.Push(new Yn(S,v,A,b)),u.Push(new Yn(S+1,v,A+1,T)))}for(var E=0;E<this.m_countY-1;E++)for(var C=0;C<this.m_countX;C++){var x=C+E*this.m_countX,w=this.m_diagram[x],D=this.m_diagram[x+this.m_countX];w!==D&&(u.Push(new Yn(C,E,x,D)),u.Push(new Yn(C,E+1,x+this.m_countX,w)))}for(;!u.Empty();){var R=u.Front(),I=R.m_x,M=R.m_y,P=R.m_i,B=R.m_generator;u.Pop();var O=this.m_diagram[P],L=B;if(O!==L){var N=O.center.x-I,F=O.center.y-M,k=L.center.x-I,V=L.center.y-M;N*N+F*F>k*k+V*V&&(this.m_diagram[P]=L,I>0&&u.Push(new Yn(I-1,M,P-1,L)),M>0&&u.Push(new Yn(I,M-1,P-this.m_countX,L)),I<this.m_countX-1&&u.Push(new Yn(I+1,M,P+1,L)),M<this.m_countY-1&&u.Push(new Yn(I,M+1,P+this.m_countX,L)))}}},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],o=this.m_diagram[n+this.m_countX],a=this.m_diagram[n+1+this.m_countX];s!==o&&(r!==s&&r!==o&&(r.necessary||s.necessary||o.necessary)&&t(r.tag,s.tag,o.tag),a!==s&&a!==o&&(r.necessary||s.necessary||o.necessary)&&t(s.tag,a.tag,o.tag))}},t}(),Xn=function(){this.center=new j,this.tag=0,this.necessary=!1},Yn=function(t,e,i,n){this.m_x=t,this.m_y=e,this.m_i=i,this.m_generator=n};function qn(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Kn(t,e){return t<e}function Qn(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Kn);for(var r=e,s=[],o=0;;){for(;r+1<i;i++){var a=t[r+Math.floor(Math.random()*(i-r))];s[o++]=i;for(var h=r-1;;){for(;n(t[++h],a););for(;n(a,t[--i]););if(h>=i)break;qn(t,h,i)}}if(0===o)break;r=i,i=s[--o]}return t}function Zn(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Kn),Qn(t,e,i,n)}function Jn(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r<i;++r)e(t[r])||(r!==n?qn(t,n++,r):++n);return n}function $n(t,e,i,n,r){for(var s=i-e;s>0;){var o=Math.floor(s/2),a=e+o;r(t[a],n)?(e=++a,s-=o+1):s=o}return e}function tr(t,e,i,n,r){for(var s=i-e;s>0;){var o=Math.floor(s/2),a=e+o;r(n,t[a])?s=o:(e=++a,s-=o+1)}return e}function er(t,e,i,n){for(var r=i;e!==r;)qn(t,e++,r++),r===n?r=i:e===i&&(i=r)}var ir=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:A;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=Jn(this.data,t,this.count)},e.Unique=function(t){this.count=function(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||qn(t,++r,e);return++r}(this.data,0,this.count,t)},t}(),nr=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}(An),rr=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&&M(this.weight-t.weight)<.01&&j.DistanceSquaredVV(this.normal,t.normal)<1e-4},t}(),sr=function(){this.index=0,this.weight=0,this.normal=new j,this.mass=0},or=function(){this.indexA=0,this.indexB=0,this.flags=0,this.strength=0,this.distance=0},ar=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},hr=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}(),ur=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 lr,this.m_flagsBuffer=new lr,this.m_positionBuffer=new lr,this.m_velocityBuffer=new lr,this.m_forceBuffer=[],this.m_weightBuffer=[],this.m_staticPressureBuffer=[],this.m_accumulationBuffer=[],this.m_accumulation2Buffer=[],this.m_depthBuffer=[],this.m_colorBuffer=new lr,this.m_groupBuffer=[],this.m_userDataBuffer=new lr,this.m_stuckThreshold=0,this.m_lastBodyContactStepBuffer=new lr,this.m_bodyContactCountBuffer=new lr,this.m_consecutiveContactStepsBuffer=new lr,this.m_stuckParticleBuffer=new ir((function(){return 0})),this.m_proxyBuffer=new ir((function(){return new cr})),this.m_contactBuffer=new ir((function(){return new rr})),this.m_bodyContactBuffer=new ir((function(){return new sr})),this.m_pairBuffer=new ir((function(){return new or})),this.m_triadBuffer=new ir((function(){return new ar})),this.m_expirationTimeBuffer=new lr,this.m_indexByExpirationTimeBuffer=new lr,this.m_timeElapsed=0,this.m_expirationTimeBufferRequiresSorting=!1,this.m_groupCount=0,this.m_groupList=null,this.m_def=new hr,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:A;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()],o=e(t.lifetime,0),a=o>0;(this.m_expirationTimeBuffer.data||a)&&(this.SetParticleLifetime(n,a?o: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 Un).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 yr(this,t,e,i),o=r;return t.ComputeAABB(o,e,0),this.m_world.QueryAABB(s,o),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 o=e(t.particleCount,t.positionData.length),a=0;a<o;a++){var h=t.positionData[a];this.CreateParticleForGroup(t,r,h)}var u=this.m_count,l=new Hn(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 _=new gr;return this.UpdateContacts(!0),this.UpdatePairsAndTriads(s,u,_),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 vr(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=x(t.GetParticleCount(),(function(){return new fr}));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],o=s.indexA,a=s.indexB,h=s.normal,u=j.SubVV(e[a],e[o],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,o=s>0?this.GetQuantizedTimeElapsed()+s:s;o!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=o,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),o=t;o<e;o++)n[o].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=$n(this.m_proxyBuffer.data,0,i,n.computeTag(this.m_inverseDiameter*e.lowerBound.x,this.m_inverseDiameter*e.lowerBound.y),cr.CompareProxyTag),s=tr(this.m_proxyBuffer.data,r,i,n.computeTag(this.m_inverseDiameter*e.upperBound.x,this.m_inverseDiameter*e.upperBound.y),cr.CompareTagProxy),o=this.m_positionBuffer.data,a=r;a<s;++a){var h=this.m_proxyBuffer.data[a].index,u=o[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,o=n.RayCast_s_v,a=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,_=1,f=j.SubVV(i,e,o),d=j.DotVV(f,f),p=this.GetInsideBoundsEnumerator(l);(c=p.GetNext())>=0;){var m=j.SubVV(e,u[c],s),g=j.DotVV(m,f),y=g*g-d*(j.DotVV(m,m)-this.m_squaredDiameter);if(y>=0){var v=k(y),S=(-g-v)/d;if(S>_)continue;if(S<0&&((S=(-g+v)/d)<0||S>_))continue;var A=j.AddVMulSV(m,S,f,a);if(A.Normalize(),(_=P(_,t.ReportParticle(this,c,j.AddVMulSV(e,S,f,h),A,S)))<=0)break}}}},r.ComputeAABB=function(t){var e=this.GetParticleCount();t.lowerBound.x=+i,t.lowerBound.y=+i,t.upperBound.x=-i,t.upperBound.y=-i;for(var n=this.m_positionBuffer.data,r=0;r<e;r++){var s=n[r];j.MinV(t.lowerBound,s,t.lowerBound),j.MaxV(t.upperBound,s,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(A),(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 kn;r.flags=e(t.flags,0),Z.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 o=n.CreateParticlesStrokeShapeForGroup_s_edge,a=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(),_=0;_<c;_++){var f=null;i.GetType()===t.b2ShapeType.e_edgeShape?f=i:(f=o,i.GetChildEdge(f,_));for(var d=j.SubVV(f.m_vertex2,f.m_vertex1,a),p=d.Length();l<p;){var m=j.AddVMulSV(f.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,o=n.CreateParticlesFillShapeForGroup_s_p,a=e(i.stride,0);0===a&&(a=this.GetParticleStride());var h=Z.IDENTITY,u=s;t.ComputeAABB(u,h,0);for(var l=Math.floor(u.lowerBound.y/a)*a;l<u.upperBound.y;l+=a)for(var c=Math.floor(u.lowerBound.x/a)*a;c<u.upperBound.x;c+=a){var _=o.Set(c,l);t.TestPoint(h,_)&&this.CreateParticleForGroup(i,r,_)}},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 Sr(t,e);this.CreateParticlesFillShapeForGroup(r,i,n)},r.CloneParticle=function(t,e){var i=new kn;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 0!=(e&(t.b2ParticleFlag.b2_wallParticle|t.b2ParticleFlag.b2_springParticle|t.b2ParticleFlag.b2_elasticParticle))||null!==i&&0!=(i.GetGroupFlags()&t.b2ParticleGroupFlag.b2_rigidParticleGroup)},r.UpdatePairsAndTriads=function(e,i,r){for(var s=n.UpdatePairsAndTriads_s_dab,o=n.UpdatePairsAndTriads_s_dbc,a=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 _=this.m_contactBuffer.data[c],f=_.indexA,d=_.indexB,p=this.m_flagsBuffer.data[f],m=this.m_flagsBuffer.data[d],g=this.m_groupBuffer[f],y=this.m_groupBuffer[d];if(f>=e&&f<i&&d>=e&&d<i&&!((p|m)&t.b2ParticleFlag.b2_zombieParticle)&&(p|m)&n.k_pairFlags&&(r.IsNecessary(f)||r.IsNecessary(d))&&n.ParticleCanBeConnected(p,g)&&n.ParticleCanBeConnected(m,y)&&r.ShouldCreatePair(f,d)){var v=this.m_pairBuffer.data[this.m_pairBuffer.Append()];v.indexA=f,v.indexB=d,v.flags=_.flags,v.strength=P(g?g.m_strength:1,y?y.m_strength:1),v.distance=j.DistanceVV(h[f],h[d])}Zn(this.m_pairBuffer.data,0,this.m_pairBuffer.count,n.ComparePairIndices),this.m_pairBuffer.Unique(n.MatchPairIndices)}if(u&n.k_triadFlags){for(var S=new jn(i-e),A=e;A<i;A++){var T=this.m_flagsBuffer.data[A],b=this.m_groupBuffer[A];T&t.b2ParticleFlag.b2_zombieParticle||!n.ParticleCanBeConnected(T,b)||S.AddGenerator(h[A],A,r.IsNecessary(A))}var E=this.GetParticleStride();S.Generate(E/2,2*E);var C=this;S.GetNodes((function(t,e,i){var u=C.m_flagsBuffer.data[t],l=C.m_flagsBuffer.data[e],c=C.m_flagsBuffer.data[i];if((u|l|c)&n.k_triadFlags&&r.ShouldCreateTriad(t,e,i)){var _=h[t],f=h[e],d=h[i],p=j.SubVV(_,f,s),m=j.SubVV(f,d,o),g=j.SubVV(d,_,a),y=4*C.m_squaredDiameter;if(j.DotVV(p,p)>y||j.DotVV(m,m)>y||j.DotVV(g,g)>y)return;var v=C.m_groupBuffer[t],S=C.m_groupBuffer[e],A=C.m_groupBuffer[i],T=C.m_triadBuffer.data[C.m_triadBuffer.Append()];T.indexA=t,T.indexB=e,T.indexC=i,T.flags=u|l|c,T.strength=P(P(v?v.m_strength:1,S?S.m_strength:1),A?A.m_strength:1);var b=(_.x+f.x+d.x)/3,E=(_.y+f.y+d.y)/3;T.pa.x=_.x-b,T.pa.y=_.y-E,T.pb.x=f.x-b,T.pb.y=f.y-E,T.pc.x=d.x-b,T.pc.y=d.y-E,T.ka=-j.DotVV(g,p),T.kb=-j.DotVV(p,m),T.kc=-j.DotVV(m,g),T.s=j.CrossVV(_,f)+j.CrossVV(f,d)+j.CrossVV(d,_)}})),Zn(this.m_triadBuffer.data,0,this.m_triadBuffer.count,n.CompareTriadIndices),this.m_triadBuffer.Unique(n.MatchTriadIndices)}},r.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new Ar(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],o=s.indexA,a=s.indexB;if(t.ContainsParticle(o)&&t.ContainsParticle(a)){var h=e[o-i].list,u=e[a-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(),o=0;o<s;o++){var a=i[o];a!==r&&this.m_flagsBuffer.data[a.index]&t.b2ParticleFlag.b2_zombieParticle&&n.MergeParticleListAndNode(r,a)}},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 zn;s.groupFlags=e.GetGroupFlags(),s.userData=e.GetUserData();for(var o=0;o<r;o++){var a=i[o];if(a.count&&a!==n)for(var h=this.CreateParticleGroup(s),u=a;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,o=r.indexB;t.ContainsParticle(s)&&(r.indexA=e[s-i].index),t.ContainsParticle(o)&&(r.indexB=e[o-i].index)}for(var a=0;a<this.m_triadBuffer.count;a++){var h=this.m_triadBuffer.data[a],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],o=s.indexA,a=s.indexB,h=this.m_groupBuffer[o],u=this.m_groupBuffer[a];h&&h===u&&h.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth&&(e[n++]=s)}for(var l=[],c=0,_=this.m_groupList;_;_=_.GetNext())if(_.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth){l[c++]=_,this.SetGroupFlags(_,_.m_groupFlags&~t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth);for(var f=_.m_firstIndex;f<_.m_lastIndex;f++)this.m_accumulationBuffer[f]=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 S=l[v],A=S.m_firstIndex;A<S.m_lastIndex;A++){var T=this.m_accumulationBuffer[A];this.m_depthBuffer[A]=T<.8?0:i}for(var b=k(this.m_count)>>0,E=0;E<b;E++){for(var C=!1,x=0;x<n;x++){var w=e[x],D=w.indexA,R=w.indexB,I=1-w.weight,M=this.m_depthBuffer[D],P=this.m_depthBuffer[R],B=P+I,O=M+I;M>B&&(this.m_depthBuffer[D]=B,C=!0),P>O&&(this.m_depthBuffer[R]=O,C=!0)}if(!C)break}for(var L=0;L<c;L++)for(var N=l[L],F=N.m_firstIndex;F<N.m_lastIndex;F++)this.m_depthBuffer[F]<i?this.m_depthBuffer[F]*=this.m_particleDiameter:this.m_depthBuffer[F]=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=$n(this.m_proxyBuffer.data,0,r,e,cr.CompareProxyTag),o=tr(this.m_proxyBuffer.data,0,r,i,cr.CompareTagProxy);return new _r(this,e,i,s,o)},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),o=j.DotVV(s,s);if(0<o&&o<this.m_squaredDiameter){var a=F(o),h=this.m_contactBuffer.data[this.m_contactBuffer.Append()];h.indexA=t,h.indexB=e,h.flags=i[t]|i[e],h.weight=1-o*a*this.m_inverseDiameter,h.normal.x=a*s.x,h.normal.y=a*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 o=n.computeRelativeTag(this.m_proxyBuffer.data[e].tag,-1,1);i<t&&!(o<=this.m_proxyBuffer.data[i].tag);i++);for(var a=n.computeRelativeTag(this.m_proxyBuffer.data[e].tag,1,1),h=i;h<t&&!(a<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(){Qn(this.m_proxyBuffer.data,0,this.m_proxyBuffer.count,cr.CompareProxyProxy)},r.FilterContacts=function(){var e=this.GetParticleContactFilter();if(null!==e){var i=this;this.m_contactBuffer.RemoveIf((function(n){return 0!=(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 mr;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 pr;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 Tr(this));var o=this.UpdateBodyContacts_callback;o.m_contactFilter=this.GetFixtureContactFilter(),this.m_world.QueryAABB(o,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,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,o=e;o.lowerBound.x=+i,o.lowerBound.y=+i,o.upperBound.x=-i,o.upperBound.y=-i;for(var a=0;a<this.m_count;a++){var h=s[a],u=r[a],l=u.x+t.dt*h.x,c=u.y+t.dt*h.y;o.lowerBound.x=P(o.lowerBound.x,P(u.x,l)),o.lowerBound.y=P(o.lowerBound.y,P(u.y,c)),o.upperBound.x=B(o.upperBound.x,B(u.x,l)),o.upperBound.y=B(o.upperBound.y,B(u.y,c))}null===this.SolveCollision_callback&&(this.SolveCollision_callback=new br(this,t));var _=this.SolveCollision_callback;_.m_step=t,this.m_world.QueryAABB(_,o)},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(k(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,o=n.SolveBarrier_s_pba,a=n.SolveBarrier_s_vba,h=n.SolveBarrier_s_vc,u=n.SolveBarrier_s_pca,l=n.SolveBarrier_s_vca,c=n.SolveBarrier_s_qba,_=n.SolveBarrier_s_qca,f=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++)0!=(this.m_flagsBuffer.data[g]&n.k_barrierWallFlags)&&m[g].SetZero();for(var y=2.5*e.dt,v=this.GetParticleMass(),S=0;S<this.m_pairBuffer.count;S++){var A=this.m_pairBuffer.data[S];if(A.flags&t.b2ParticleFlag.b2_barrierParticle){var T=A.indexA,b=A.indexB,E=p[T],C=p[b],x=i;j.MinV(E,C,x.lowerBound),j.MaxV(E,C,x.upperBound);for(var w=this.m_groupBuffer[T],D=this.m_groupBuffer[b],R=this.GetLinearVelocity(w,T,E,r),I=this.GetLinearVelocity(D,b,C,s),M=j.SubVV(C,E,o),P=j.SubVV(I,R,a),B=this.GetInsideBoundsEnumerator(x),O=void 0;(O=B.GetNext())>=0;){var L=p[O],N=this.m_groupBuffer[O];if(w!==N&&D!==N){var F=this.GetLinearVelocity(N,O,L,h),V=j.SubVV(L,E,u),G=j.SubVV(F,R,l),U=j.CrossVV(P,G),z=j.CrossVV(M,G)-j.CrossVV(V,P),H=j.CrossVV(M,V),W=void 0,X=void 0,Y=c,q=_;if(0===U){if(0===z)continue;if(!((X=-H/z)>=0&&X<y))continue;if(j.AddVMulSV(M,X,P,Y),j.AddVMulSV(V,X,G,q),!((W=j.DotVV(Y,q)/j.DotVV(Y,Y))>=0&&W<=1))continue}else{var K=z*z-4*H*U;if(K<0)continue;var Q=k(K),Z=(-z-Q)/(2*U),J=(-z+Q)/(2*U);if(Z>J){var $=Z;Z=J,J=$}if(X=Z,j.AddVMulSV(M,X,P,Y),j.AddVMulSV(V,X,G,q),W=j.DotVV(Y,q)/j.DotVV(Y,Y),!(X>=0&&X<y&&W>=0&&W<=1)){if(!((X=J)>=0&&X<y))continue;if(j.AddVMulSV(M,X,P,Y),j.AddVMulSV(V,X,G,q),!((W=j.DotVV(Y,q)/j.DotVV(Y,Y))>=0&&W<=1))continue}}var tt=f;tt.x=R.x+W*P.x-F.x,tt.y=R.y+W*P.y-F.y;var et=j.MulSV(v,tt,d);if(N&&this.IsRigidGroup(N)){var it=N.GetMass(),nt=N.GetInertia();it>0&&N.m_linearVelocity.SelfMulAdd(1/it,et),nt>0&&(N.m_angularVelocity+=j.CrossVV(j.SubVV(L,N.GetCenter(),j.s_t0),et)/nt)}else m[O].SelfAdd(tt);this.ParticleApplyForce(O,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=S*i,s=this.m_def.staticPressureRelaxation,o=0;o<this.m_def.staticPressureIterations;o++){for(var a=0;a<this.m_count;a++)this.m_accumulationBuffer[a]=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,_=u.weight;this.m_accumulationBuffer[l]+=_*this.m_staticPressureBuffer[c],this.m_accumulationBuffer[c]+=_*this.m_staticPressureBuffer[l]}}for(var f=0;f<this.m_count;f++){var d=this.m_weightBuffer[f];if(this.m_flagsBuffer.data[f]&t.b2ParticleFlag.b2_staticPressureParticle){var p=(this.m_accumulationBuffer[f]+n*(d-1))/(d+s);this.m_staticPressureBuffer[f]=O(p,0,r)}else this.m_staticPressureBuffer[f]=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 o=this.m_contactBuffer.data[s],a=o.indexA,h=o.indexB,u=o.weight;this.m_weightBuffer[a]+=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,o=this.GetCriticalPressure(e),a=this.m_def.pressureStrength*o,h=S*o,u=0;u<this.m_count;u++){var l=a*B(0,this.m_weightBuffer[u]-1);this.m_accumulationBuffer[u]=P(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 _=0;_<this.m_count;_++)this.m_flagsBuffer.data[_]&t.b2ParticleFlag.b2_staticPressureParticle&&(this.m_accumulationBuffer[_]+=this.m_staticPressureBuffer[_]);for(var f=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,A=m.mass,T=m.normal,b=r[g],E=this.m_accumulationBuffer[g]+a*v,C=j.MulSV(f*v*A*E,T,i);s[g].SelfMulSub(d,C),y.ApplyLinearImpulse(C,b,!0)}for(var x=0;x<this.m_contactBuffer.count;x++){var w=this.m_contactBuffer.data[x],D=w.indexA,R=w.indexB,I=w.weight,M=w.normal,O=this.m_accumulationBuffer[D]+this.m_accumulationBuffer[R],L=j.MulSV(f*I*O,M,i);s[D].SelfSub(L),s[R].SelfAdd(L)}},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,o=this.m_def.dampingStrength,a=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,_=l.body,f=l.weight,d=l.mass,p=l.normal,m=r[c],g=j.SubVV(_.GetLinearVelocityFromWorldPoint(m,j.s_t0),s[c],e),y=j.DotVV(g,p);if(y<0){var v=B(o*f,P(-a*y,.5)),S=j.MulSV(v*d*y,p,i);s[c].SelfMulAdd(h,S),_.ApplyLinearImpulse(S.SelfNeg(),m,!0)}}for(var A=0;A<this.m_contactBuffer.count;A++){var T=this.m_contactBuffer.data[A],b=T.indexA,E=T.indexB,C=T.weight,x=T.normal,w=j.SubVV(s[E],s[b],e),D=j.DotVV(w,x);if(D<0){var R=B(o*C,P(-a*D,.5)),I=j.MulSV(R*D,x,i);s[b].SelfAdd(I),s[E].SelfSub(I)}}},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],o=[0],a=[0],h=[0],u=[0],l=[0],c=this.m_positionBuffer.data,_=this.m_def.dampingStrength,f=0;f<this.m_bodyContactBuffer.count;f++){var d=this.m_bodyContactBuffer.data[f],p=d.index,m=this.m_groupBuffer[p];if(m&&this.IsRigidGroup(m)){var g=d.body,y=d.normal,v=d.weight,S=c[p],A=j.SubVV(g.GetLinearVelocityFromWorldPoint(S,t),m.GetLinearVelocityFromWorldPoint(S,e),r),T=j.DotVV(A,y);if(T<0){this.InitDampingParameterWithRigidGroupOrParticle(s,o,a,!0,m,p,S,y),this.InitDampingParameter(h,u,l,g.GetMass(),g.GetInertia()-g.GetMass()*g.GetLocalCenter().LengthSquared(),g.GetWorldCenter(),S,y);var b=_*P(v,1)*this.ComputeDampingImpulse(s[0],o[0],a[0],h[0],u[0],l[0],T);this.ApplyDamping(s[0],o[0],a[0],!0,m,p,b,y),g.ApplyLinearImpulse(j.MulSV(-b,y,j.s_t0),S,!0)}}}for(var E=0;E<this.m_contactBuffer.count;E++){var C=this.m_contactBuffer.data[E],x=C.indexA,w=C.indexB,D=C.normal,R=C.weight,I=this.m_groupBuffer[x],M=this.m_groupBuffer[w],B=this.IsRigidGroup(I),O=this.IsRigidGroup(M);if(I!==M&&(B||O)){var L=j.MidVV(c[x],c[w],i),N=j.SubVV(this.GetLinearVelocity(M,w,L,t),this.GetLinearVelocity(I,x,L,e),r),F=j.DotVV(N,D);if(F<0){this.InitDampingParameterWithRigidGroupOrParticle(s,o,a,B,I,x,L,D),this.InitDampingParameterWithRigidGroupOrParticle(h,u,l,O,M,w,L,D);var k=_*R*this.ComputeDampingImpulse(s[0],o[0],a[0],h[0],u[0],l[0],F);this.ApplyDamping(s[0],o[0],a[0],B,I,x,k,D),this.ApplyDamping(h[0],u[0],l[0],O,M,w,-k,D)}}}},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(),o=0;o<this.m_bodyContactBuffer.count;o++){var a=this.m_bodyContactBuffer.data[o],h=a.index;if(this.m_flagsBuffer.data[h]&n.k_extraDampingFlags){var u=a.body,l=a.mass,c=a.normal,_=r[h],f=j.SubVV(u.GetLinearVelocityFromWorldPoint(_,j.s_t0),i[h],t),d=j.DotVV(f,c);if(d<0){var p=j.MulSV(.5*l*d,c,e);i[h].SelfMulAdd(s,p),u.ApplyLinearImpulse(p.SelfNeg(),_,!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,o=n.SolveRigid_s_velocityTransform,a=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),Q.MulRV(l,u.m_center,j.s_t1),j.s_t0),i),_=s;_.SetPositionRotation(c,l),Z.MulXX(_,u.m_transform,u.m_transform);var f=o;f.p.x=e.inv_dt*_.p.x,f.p.y=e.inv_dt*_.p.y,f.q.s=e.inv_dt*_.q.s,f.q.c=e.inv_dt*(_.q.c-1);for(var d=u.m_firstIndex;d<u.m_lastIndex;d++)Z.MulXV(f,a[d],h[d])}},r.SolveElastic=function(e){for(var i=n.SolveElastic_s_pa,r=n.SolveElastic_s_pb,s=n.SolveElastic_s_pc,o=n.SolveElastic_s_r,a=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 _=this.m_triadBuffer.data[c];if(_.flags&t.b2ParticleFlag.b2_elasticParticle){var f=_.indexA,d=_.indexB,p=_.indexC,m=_.pa,g=_.pb,y=_.pc,v=i.Copy(h[f]),S=r.Copy(h[d]),A=s.Copy(h[p]),T=u[f],b=u[d],E=u[p];v.SelfMulAdd(e.dt,T),S.SelfMulAdd(e.dt,b),A.SelfMulAdd(e.dt,E);var C=(v.x+S.x+A.x)/3,x=(v.y+S.y+A.y)/3;v.x-=C,v.y-=x,S.x-=C,S.y-=x,A.x-=C,A.y-=x;var w=o;w.s=j.CrossVV(m,v)+j.CrossVV(g,S)+j.CrossVV(y,A),w.c=j.DotVV(m,v)+j.DotVV(g,S)+j.DotVV(y,A);var D=F(w.s*w.s+w.c*w.c);isFinite(D)||(D=198177537e11),w.s*=D,w.c*=D;var R=l*_.strength;Q.MulRV(w,m,a),j.SubVV(a,v,a),j.MulSV(R,a,a),T.SelfAdd(a),Q.MulRV(w,g,a),j.SubVV(a,S,a),j.MulSV(R,a,a),b.SelfAdd(a),Q.MulRV(w,y,a),j.SubVV(a,A,a),j.MulSV(R,a,a),E.SelfAdd(a)}}},r.SolveSpring=function(e){for(var i=n.SolveSpring_s_pa,r=n.SolveSpring_s_pb,s=n.SolveSpring_s_d,o=n.SolveSpring_s_f,a=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 _=c.indexA,f=c.indexB,d=i.Copy(a[_]),p=r.Copy(a[f]),m=h[_],g=h[f];d.SelfMulAdd(e.dt,m),p.SelfMulAdd(e.dt,g);var y=j.SubVV(p,d,s),v=c.distance,S=y.Length(),A=u*c.strength,T=j.MulSV(A*(v-S)/S,y,o);m.SelfSub(T),g.SelfAdd(T)}}},r.SolveTensile=function(e){for(var i=n.SolveTensile_s_weightedNormal,r=n.SolveTensile_s_s,s=n.SolveTensile_s_f,o=this.m_velocityBuffer.data,a=0;a<this.m_count;a++)this.m_accumulation2Buffer[a]=new j,this.m_accumulation2Buffer[a].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,_=u.weight,f=u.normal,d=j.MulSV((1-_)*_,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 S=this.m_contactBuffer.data[v];if(S.flags&t.b2ParticleFlag.b2_tensileParticle){var A=S.indexA,T=S.indexB,b=S.weight,E=S.normal,C=this.m_weightBuffer[A]+this.m_weightBuffer[T],x=j.SubVV(this.m_accumulation2Buffer[T],this.m_accumulation2Buffer[A],r),w=P(m*(C-2)+g*j.DotVV(x,E),y)*b,D=j.MulSV(w,E,s);o[A].SelfSub(D),o[T].SelfAdd(D)}}},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,o=this.m_def.viscousStrength,a=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,_=u.weight,f=u.mass,d=r[l],p=j.SubVV(c.GetLinearVelocityFromWorldPoint(d,j.s_t0),s[l],e),m=j.MulSV(o*f*_,p,i);s[l].SelfMulAdd(a,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,S=y.indexB,A=y.weight,T=j.SubVV(s[S],s[v],e),b=j.MulSV(o*A,T,i);s[v].SelfAdd(b),s[S].SelfSub(b)}}},r.SolveRepulsive=function(e){for(var i=n.SolveRepulsive_s_f,r=this.m_velocityBuffer.data,s=this.m_def.repulsiveStrength*this.GetCriticalVelocity(e),o=0;o<this.m_contactBuffer.count;o++){var a=this.m_contactBuffer.data[o];if(a.flags&t.b2ParticleFlag.b2_repulsiveParticle){var h=a.indexA,u=a.indexB;if(this.m_groupBuffer[h]!==this.m_groupBuffer[u]){var l=a.weight,c=a.normal,_=j.MulSV(s*l,c,i);r[h].SelfSub(_),r[u].SelfAdd(_)}}}},r.SolvePowder=function(e){for(var i=n.SolvePowder_s_f,r=this.m_positionBuffer.data,s=this.m_velocityBuffer.data,o=this.m_def.powderStrength*this.GetCriticalVelocity(e),a=.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 _=l.weight;if(_>a){var f=l.body,d=l.mass,p=r[c],m=l.normal,g=j.MulSV(o*d*(_-a),m,i);s[c].SelfMulSub(h,g),f.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 S=v.weight;if(S>a){var A=v.indexA,T=v.indexB,b=v.normal,E=j.MulSV(o*(S-a),b,i);s[A].SelfSub(E),s[T].SelfAdd(E)}}}},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 o=this.m_contactBuffer.data[s],a=o.indexA,h=o.indexB;if(this.m_groupBuffer[a]!==this.m_groupBuffer[h]){var u=o.weight,l=o.normal,c=this.m_depthBuffer[a]+this.m_depthBuffer[h],_=j.MulSV(r*c*u,l,e);i[a].SelfSub(_),i[h].SelfAdd(_)}}},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 o=this.m_colorBuffer.data[r],a=this.m_colorBuffer.data[s];tt.MixColors(o,a,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 o=this.m_flagsBuffer.data[s];if(o&t.b2ParticleFlag.b2_zombieParticle){var a=this.m_world.m_destructionListener;if(o&t.b2ParticleFlag.b2_destructionListenerParticle&&a&&a.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|=o}}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 _=this.m_proxyBuffer.data[c];_.index=i[_.index]}this.m_proxyBuffer.RemoveIf(l.IsProxyInvalid);for(var f=0;f<this.m_contactBuffer.count;f++){var d=this.m_contactBuffer.data[f];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 S=0;S<this.m_triadBuffer.count;S++){var A=this.m_triadBuffer.data[S];A.indexA=i[A.indexA],A.indexB=i[A.indexB],A.indexC=i[A.indexC]}if(this.m_triadBuffer.RemoveIf(l.IsTriadInvalid),this.m_indexByExpirationTimeBuffer.data)for(var T=0,b=0;b<this.m_count;b++){var E=i[this.m_indexByExpirationTimeBuffer.data[b]];E!==y&&(this.m_indexByExpirationTimeBuffer.data[T++]=E)}for(var C=this.m_groupList;C;C=C.GetNext()){for(var x=e,w=0,D=!1,R=C.m_firstIndex;R<C.m_lastIndex;R++){var I=i[R];I>=0?(x=P(x,I),w=B(w,I+1)):D=!0}x<w?(C.m_firstIndex=x,C.m_lastIndex=w,D&&C.m_groupFlags&t.b2ParticleGroupFlag.b2_solidParticleGroup&&this.SetGroupFlags(C,C.m_groupFlags|t.b2ParticleGroupFlag.b2_particleGroupNeedsUpdateDepth)):(C.m_firstIndex=0,C.m_lastIndex=0,C.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupCanBeEmpty||this.SetGroupFlags(C,C.m_groupFlags|t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed))}this.m_count=e,this.m_allParticleFlags=r,this.m_needsUpdateAllParticleFlags=!1;for(var M=this.m_groupList;M;){var O=M.GetNext();M.m_groupFlags&t.b2ParticleGroupFlag.b2_particleGroupWillBeDestroyed&&this.DestroyParticleGroup(M),M=O}},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&&(Qn(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 o=n[s],a=i[o];if(e<a||a<=0)break;this.DestroyParticle(o)}},r.RotateBuffer=function(t,e,i){if(t!==e&&e!==i){if(er(this.m_flagsBuffer.data,t,e,i),this.m_lastBodyContactStepBuffer.data&&er(this.m_lastBodyContactStepBuffer.data,t,e,i),this.m_bodyContactCountBuffer.data&&er(this.m_bodyContactCountBuffer.data,t,e,i),this.m_consecutiveContactStepsBuffer.data&&er(this.m_consecutiveContactStepsBuffer.data,t,e,i),er(this.m_positionBuffer.data,t,e,i),er(this.m_velocityBuffer.data,t,e,i),er(this.m_groupBuffer,t,e,i),this.m_hasForce&&er(this.m_forceBuffer,t,e,i),this.m_staticPressureBuffer&&er(this.m_staticPressureBuffer,t,e,i),this.m_depthBuffer&&er(this.m_depthBuffer,t,e,i),this.m_colorBuffer.data&&er(this.m_colorBuffer.data,t,e,i),this.m_userDataBuffer.data&&er(this.m_userDataBuffer.data,t,e,i),this.m_handleIndexBuffer.data){er(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){er(this.m_expirationTimeBuffer.data,t,e,i);for(var s=this.GetParticleCount(),o=this.m_indexByExpirationTimeBuffer.data,a=0;a<s;++a)o[a]=v(o[a])}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 _=0;_<this.m_bodyContactBuffer.count;_++){var f=this.m_bodyContactBuffer.data[_];f.index=v(f.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(){Qn(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,o=0;this.m_bodyContactBuffer.count=Jn(this.m_bodyContactBuffer.data,(function(n){if(n.index!==s&&(o=0,s=n.index),o++>3)return!0;var a=t.Copy(n.normal);a.SelfMul(r.m_particleDiameter*(1-n.weight));var h=j.AddVV(r.m_positionBuffer.data[n.index],a,e);if(!n.fixture.TestPoint(h)){for(var u=n.fixture.GetShape().GetChildCount(),c=0;c<u;c++){var _=i;if(n.fixture.ComputeDistance(h,_,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&&0!=(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,o,a){t[0]=n>0?1/n:0,e[0]=r>0?1/r:0,i[0]=j.CrossVV(j.SubVV(o,s,j.s_t0),a)},r.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,o,a,h){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),a,h);else{var u=this.m_flagsBuffer.data[o];this.InitDampingParameter(e,i,n,u&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,a,a,h)}},r.ComputeDampingImpulse=function(t,e,i,n,r,s,o){var a=t+e*i*i+n+r*s*s;return a>0?o/a:0},r.ApplyDamping=function(t,e,i,n,r,s,o,a){r&&n?(r.m_linearVelocity.SelfMulAdd(o*t,a),r.m_angularVelocity+=o*i*e):this.m_velocityBuffer.data[s].SelfMulAdd(o*t,a)},n}();ur.xTruncBits=12,ur.yTruncBits=12,ur.tagBits=32,ur.yOffset=1<<ur.yTruncBits-1,ur.yShift=ur.tagBits-ur.yTruncBits,ur.xShift=ur.tagBits-ur.yTruncBits-ur.xTruncBits,ur.xScale=1<<ur.xShift,ur.xOffset=ur.xScale*(1<<ur.xTruncBits-1),ur.yMask=(1<<ur.yTruncBits)-1<<ur.yShift,ur.xMask=~ur.yMask,ur.DestroyParticlesInShape_s_aabb=new Vt,ur.CreateParticleGroup_s_transform=new Z,ur.ComputeCollisionEnergy_s_v=new j,ur.QueryShapeAABB_s_aabb=new Vt,ur.QueryPointAABB_s_aabb=new Vt,ur.RayCast_s_aabb=new Vt,ur.RayCast_s_p=new j,ur.RayCast_s_v=new j,ur.RayCast_s_n=new j,ur.RayCast_s_point=new j,ur.k_pairFlags=t.b2ParticleFlag.b2_springParticle,ur.k_triadFlags=t.b2ParticleFlag.b2_elasticParticle,ur.k_noPressureFlags=t.b2ParticleFlag.b2_powderParticle|t.b2ParticleFlag.b2_tensileParticle,ur.k_extraDampingFlags=t.b2ParticleFlag.b2_staticPressureParticle,ur.k_barrierWallFlags=t.b2ParticleFlag.b2_barrierParticle|t.b2ParticleFlag.b2_wallParticle,ur.CreateParticlesStrokeShapeForGroup_s_edge=new vi,ur.CreateParticlesStrokeShapeForGroup_s_d=new j,ur.CreateParticlesStrokeShapeForGroup_s_p=new j,ur.CreateParticlesFillShapeForGroup_s_aabb=new Vt,ur.CreateParticlesFillShapeForGroup_s_p=new j,ur.UpdatePairsAndTriads_s_dab=new j,ur.UpdatePairsAndTriads_s_dbc=new j,ur.UpdatePairsAndTriads_s_dca=new j,ur.AddContact_s_d=new j,ur.UpdateBodyContacts_s_aabb=new Vt,ur.Solve_s_subStep=new Cn,ur.SolveCollision_s_aabb=new Vt,ur.SolveGravity_s_gravity=new j,ur.SolveBarrier_s_aabb=new Vt,ur.SolveBarrier_s_va=new j,ur.SolveBarrier_s_vb=new j,ur.SolveBarrier_s_pba=new j,ur.SolveBarrier_s_vba=new j,ur.SolveBarrier_s_vc=new j,ur.SolveBarrier_s_pca=new j,ur.SolveBarrier_s_vca=new j,ur.SolveBarrier_s_qba=new j,ur.SolveBarrier_s_qca=new j,ur.SolveBarrier_s_dv=new j,ur.SolveBarrier_s_f=new j,ur.SolvePressure_s_f=new j,ur.SolveDamping_s_v=new j,ur.SolveDamping_s_f=new j,ur.SolveRigidDamping_s_t0=new j,ur.SolveRigidDamping_s_t1=new j,ur.SolveRigidDamping_s_p=new j,ur.SolveRigidDamping_s_v=new j,ur.SolveExtraDamping_s_v=new j,ur.SolveExtraDamping_s_f=new j,ur.SolveRigid_s_position=new j,ur.SolveRigid_s_rotation=new Q,ur.SolveRigid_s_transform=new Z,ur.SolveRigid_s_velocityTransform=new Z,ur.SolveElastic_s_pa=new j,ur.SolveElastic_s_pb=new j,ur.SolveElastic_s_pc=new j,ur.SolveElastic_s_r=new Q,ur.SolveElastic_s_t0=new j,ur.SolveSpring_s_pa=new j,ur.SolveSpring_s_pb=new j,ur.SolveSpring_s_d=new j,ur.SolveSpring_s_f=new j,ur.SolveTensile_s_weightedNormal=new j,ur.SolveTensile_s_s=new j,ur.SolveTensile_s_f=new j,ur.SolveViscous_s_v=new j,ur.SolveViscous_s_f=new j,ur.SolveRepulsive_s_f=new j,ur.SolvePowder_s_f=new j,ur.SolveSolid_s_f=new j,ur.RemoveSpuriousBodyContacts_s_n=new j,ur.RemoveSpuriousBodyContacts_s_pos=new j,ur.RemoveSpuriousBodyContacts_s_normal=new j;var lr=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}(),cr=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}(),_r=function(){function t(t,e,i,n,r){this.m_system=t,this.m_xLower=(e&ur.xMask)>>>0,this.m_xUpper=(i&ur.xMask)>>>0,this.m_yLower=(e&ur.yMask)>>>0,this.m_yUpper=(i&ur.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&ur.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}(),fr=function(){this.next=null,this.count=0,this.index=0},dr=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}(),pr=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}(dr),mr=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}(dr),gr=function(){function t(){}var e=t.prototype;return e.IsNecessary=function(){return!0},e.ShouldCreatePair=function(){return!0},e.ShouldCreateTriad=function(){return!0},t}(),yr=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}(An),vr=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}(gr),Sr=function(e){function n(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(n,e);var r=n.prototype;return r.Clone=function(){throw new Error},r.GetChildCount=function(){return 1},r.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},r.ComputeDistance=function(){return 0},r.RayCast=function(){return!1},r.ComputeAABB=function(t,e){var n=new Vt;t.lowerBound.x=+i,t.lowerBound.y=+i,t.upperBound.x=-i,t.upperBound.y=-i;for(var r=0;r<this.m_shapeCount;r++)for(var s=this.m_shapes[r].GetChildCount(),o=0;o<s;o++){var a=n;this.m_shapes[r].ComputeAABB(a,e,o),t.Combine1(a)}},r.ComputeMass=function(){},r.SetupDistanceProxy=function(){},r.ComputeSubmergedArea=function(){return 0},r.Dump=function(){},n}(mi),Ar=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 0!=(this.m_flagsBuffer.data[e]&t.b2ParticleFlag.b2_reactiveParticle)},i}(gr),Tr=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,o=i.ReportFixtureAndParticle_s_rp,a=this.m_system.m_positionBuffer.data[r],h=s,u=e.ComputeDistance(a,h,n);if(u<this.m_system.m_particleDiameter&&this.ShouldCollideFixtureParticle(e,this.m_system,r)){var l=e.GetBody(),c=l.GetWorldCenter(),_=l.GetMass(),f=l.GetInertia()-_*l.GetLocalCenter().LengthSquared(),d=_>0?1/_:0,p=f>0?1/f:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),g=j.SubVV(a,c,o),y=j.CrossVV(g,h),v=m+d+p*y*y,S=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];S.index=r,S.body=l,S.fixture=e,S.weight=1-u*this.m_system.m_inverseDiameter,S.normal.Copy(h.SelfNeg()),S.mass=v>0?1/v:0,this.m_system.DetectStuckParticle(r)}},i}(nr);Tr.ReportFixtureAndParticle_s_n=new j,Tr.ReportFixtureAndParticle_s_rp=new j;var br=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,o=i.ReportFixtureAndParticle_s_output,a=i.ReportFixtureAndParticle_s_input,h=i.ReportFixtureAndParticle_s_p,u=i.ReportFixtureAndParticle_s_v,c=i.ReportFixtureAndParticle_s_f,_=e.GetBody(),f=this.m_system.m_positionBuffer.data[r],d=this.m_system.m_velocityBuffer.data[r],p=o,m=a;if(0===this.m_system.m_iterationIndex){var g=Z.MulTXV(_.m_xf0,f,s);e.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(g.SelfSub(_.GetLocalCenter()),Q.MulRV(_.m_xf0.q,g,g),Q.MulTRV(_.m_xf.q,g,g),g.SelfAdd(_.GetLocalCenter())),Z.MulXV(_.m_xf,g,m.p1)}else m.p1.Copy(f);if(j.AddVMulSV(f,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 S=u;S.x=this.m_step.inv_dt*(v.x-f.x),S.y=this.m_step.inv_dt*(v.y-f.y),this.m_system.m_velocityBuffer.data[r].Copy(S);var A=c;A.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.x-S.x),A.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.y-S.y),this.m_system.ParticleApplyForce(r,A)}},n.ReportParticle=function(){return!1},i}(nr);br.ReportFixtureAndParticle_s_p1=new j,br.ReportFixtureAndParticle_s_output=new kt,br.ReportFixtureAndParticle_s_input=new Ft,br.ReportFixtureAndParticle_s_p=new j,br.ReportFixtureAndParticle_s_v=new j,br.ReportFixtureAndParticle_s_f=new j;var Er=function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new bn,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 En,this.m_island=new Fn,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 Di(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 o=s;s=s.next,this.m_contactManager.Destroy(o.contact)}t.m_contactList=null;for(var a=t.m_fixtureList;a;){var h=a;a=a.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(h),h.DestroyProxies(),h.Reset(),t.m_fixtureList=a,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 Oi(e);case t.b2JointType.e_mouseJoint:return new Wi(e);case t.b2JointType.e_prismaticJoint:return new Xi(e);case t.b2JointType.e_revoluteJoint:return new Qi(e);case t.b2JointType.e_pulleyJoint:return new qi(e);case t.b2JointType.e_gearJoint:return new Gi(e);case t.b2JointType.e_wheelJoint:return new nn(e);case t.b2JointType.e_weldJoint:return new tn(e);case t.b2JointType.e_frictionJoint:return new ki(e);case t.b2JointType.e_ropeJoint:return new Ji(e);case t.b2JointType.e_motorJoint:return new zi(e);case t.b2JointType.e_areaJoint:return new Ni(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 ur(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 Vn(this.m_gravity.Length(),function(t){for(var e=i,n=t.GetParticleSystemList();null!==n;n=n.m_next)e=P(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 o=e.Step_s_step;o.dt=t,o.velocityIterations=i,o.positionIterations=n,o.particleIterations=r,o.inv_dt=t>0?1/t:0,o.dtRatio=this.m_inv_dt0*t,o.warmStarting=this.m_warmStarting;var a=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=a.GetMilliseconds(),this.m_stepComplete&&o.dt>0){for(var h=e.Step_s_timer.Reset(),u=this.m_particleSystemList;u;u=u.m_next)u.Solve(o);this.Solve(o),this.m_profile.solve=h.GetMilliseconds()}if(this.m_continuousPhysics&&o.dt>0){var l=e.Step_s_timer.Reset();this.SolveTOI(o),this.m_profile.solveTOI=l.GetMilliseconds()}o.dt>0&&(this.m_inv_dt0=o.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 o=r.GetFixtureList();o;o=o.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(o,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(o,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(o,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(o,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(o,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var a=this.m_particleSystemList;a;a=a.m_next)this.DrawParticleSystem(a);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 _=0;_<c.m_proxyCount;++_){var f=c.m_proxies[_].treeNode.aabb;u[0].Set(f.lowerBound.x,f.lowerBound.y),u[1].Set(f.upperBound.x,f.lowerBound.y),u[2].Set(f.upperBound.x,f.upperBound.y),u[3].Set(f.lowerBound.x,f.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 An?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 An)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 An?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 An)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 An?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 o=e.QueryFixtureShape_s_aabb;if(i.ComputeAABB(o,r,n),this.m_contactManager.m_broadPhase.Query(o,(function(e){var o=e.userData,a=o.fixture;if(jt(i,n,a.GetShape(),o.childIndex,r,a.GetBody().GetTransform())){if(t)return t.ReportFixture(a);if(s)return s(a)}return!0})),t instanceof An)for(var a=this.m_particleSystemList;a;a=a.m_next)t.ShouldQueryParticleSystem(a)&&a.QueryAABB(t,o)},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 An?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,o){var a=o.userData,h=a.fixture,u=a.childIndex,l=e.RayCast_s_output;if(h.RayCast(l,s,u)){var c=l.fraction,_=e.RayCast_s_point;if(_.Set((1-c)*i.x+c*n.x,(1-c)*i.y+c*n.y),t)return t.ReportFixture(h,_,l.normal,c);if(r)return r(h,_,l.normal,c)}return s.maxFraction})),t)for(var o=this.m_particleSystemList;o;o=o.m_next)t.ShouldQueryParticleSystem(o)&&o.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 o=this.m_jointList;o;o=o.m_next)o.m_type===t.b2JointType.e_gearJoint&&(e("{\n"),o.Dump(e),e("}\n"))}},n.DrawJoint=function(i){if(null!==this.m_debugDraw){var n=i.GetBodyA(),r=i.GetBodyB(),s=n.m_xf,o=r.m_xf,a=s.p,h=o.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 _=i,f=_.GetGroundAnchorA(),d=_.GetGroundAnchorB();this.m_debugDraw.DrawSegment(f,u,c),this.m_debugDraw.DrawSegment(d,l,c),this.m_debugDraw.DrawSegment(f,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(a,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,o=s.m_p,a=s.m_radius,h=j.UNITX;this.m_debugDraw.DrawSolidCircle(o,a,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 _=r,f=_.m_count,d=_.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),_.m_hasPrevVertex){var g=_.m_prevVertex;this.m_debugDraw.DrawSegment(g,m,p),this.m_debugDraw.DrawCircle(g,.1,p)}for(var y=1;y<f;++y){var v=d[y];this.m_debugDraw.DrawSegment(m,v,n),this.m_debugDraw.DrawPoint(v,4,n),m=v}if(_.m_hasNextVertex){var S=_.m_nextVertex;this.m_debugDraw.DrawSegment(S,m,p),this.m_debugDraw.DrawCircle(S,.1,p)}break;case t.b2ShapeType.e_polygonShape:var A=r,T=A.m_count,b=A.m_vertices;this.m_debugDraw.DrawSolidPolygon(b,T,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 o=this.m_contactManager.m_contactList;o;o=o.m_next)o.m_islandFlag=!1;for(var a=this.m_jointList;a;a=a.m_next)a.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 _=c.m_contactList;_;_=_.next){var f=_.contact;if(!f.m_islandFlag&&f.IsEnabled()&&f.IsTouching()){var d=f.m_fixtureA.m_isSensor,p=f.m_fixtureB.m_isSensor;if(!d&&!p){r.AddContact(f),f.m_islandFlag=!0;var m=_.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 En;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 S=0;S<r.m_bodyCount;++S){var A=r.m_bodies[S];A.GetType()===t.b2BodyType.b2_staticBody&&(A.m_islandFlag=!1)}}for(var T=0;T<h.length&&h[T];++T)h[T]=null;for(var b=new it,E=this.m_bodyList;E;E=E.m_next)E.m_islandFlag&&E.GetType()!==t.b2BodyType.b2_staticBody&&E.SynchronizeFixtures();this.m_contactManager.FindNewContacts(),this.m_profile.broadphase=b.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 o=null,a=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 _=l.GetBody(),f=c.GetBody(),d=_.m_type,p=f.m_type,m=_.IsAwake()&&d!==t.b2BodyType.b2_staticBody,g=f.IsAwake()&&p!==t.b2BodyType.b2_staticBody;if(!m&&!g)continue;var y=_.IsBullet()||d!==t.b2BodyType.b2_dynamicBody,v=f.IsBullet()||p!==t.b2BodyType.b2_dynamicBody;if(!y&&!v)continue;var S=_.m_sweep.alpha0;_.m_sweep.alpha0<f.m_sweep.alpha0?(S=f.m_sweep.alpha0,_.m_sweep.Advance(S)):f.m_sweep.alpha0<_.m_sweep.alpha0&&(S=_.m_sweep.alpha0,f.m_sweep.Advance(S));var A=h.GetChildIndexA(),T=h.GetChildIndexB(),b=e.SolveTOI_s_toi_input;b.proxyA.SetShape(l.GetShape(),A),b.proxyB.SetShape(c.GetShape(),T),b.sweepA.Copy(_.m_sweep),b.sweepB.Copy(f.m_sweep),b.tMax=1;var E=e.SolveTOI_s_toi_output;Ae(E,b);var C=E.t;u=E.state===t.b2TOIOutputState.e_touching?P(S+(1-S)*C,1):1,h.m_toi=u,h.m_toiFlag=!0}u<a&&(o=h,a=u)}if(null===o||.9999<a){this.m_stepComplete=!0;break}var x=o.GetFixtureA(),w=o.GetFixtureB(),D=x.GetBody(),R=w.GetBody(),I=e.SolveTOI_s_backup1.Copy(D.m_sweep),M=e.SolveTOI_s_backup2.Copy(R.m_sweep);if(D.Advance(a),R.Advance(a),o.Update(this.m_contactManager.m_contactListener),o.m_toiFlag=!1,++o.m_toiCount,o.IsEnabled()&&o.IsTouching()){D.SetAwake(!0),R.SetAwake(!0),n.Clear(),n.AddBody(D),n.AddBody(R),n.AddContact(o),D.m_islandFlag=!0,R.m_islandFlag=!0,o.m_islandFlag=!0;for(var B=0;B<2;++B){var O=0===B?D:R;if(O.m_type===t.b2BodyType.b2_dynamicBody)for(var L=O.m_contactList;L&&n.m_bodyCount!==n.m_bodyCapacity&&n.m_contactCount!==n.m_contactCapacity;L=L.next){var N=L.contact;if(!N.m_islandFlag){var F=L.other;if(F.m_type!==t.b2BodyType.b2_dynamicBody||O.IsBullet()||F.IsBullet()){var k=N.m_fixtureA.m_isSensor,V=N.m_fixtureB.m_isSensor;if(!k&&!V){var G=e.SolveTOI_s_backup.Copy(F.m_sweep);F.m_islandFlag||F.Advance(a),N.Update(this.m_contactManager.m_contactListener),N.IsEnabled()&&N.IsTouching()?(N.m_islandFlag=!0,n.AddContact(N),F.m_islandFlag||(F.m_islandFlag=!0,F.m_type!==t.b2BodyType.b2_staticBody&&F.SetAwake(!0),n.AddBody(F))):(F.m_sweep.Copy(G),F.SynchronizeTransform())}}}}}var U=e.SolveTOI_s_subStep;U.dt=(1-a)*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,D.m_islandIndex,R.m_islandIndex);for(var z=0;z<n.m_bodyCount;++z){var H=n.m_bodies[z];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 o.SetEnabled(!1),D.m_sweep.Copy(I),R.m_sweep.Copy(M),D.SynchronizeTransform(),R.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}();Er.Step_s_step=new Cn,Er.Step_s_stepTimer=new it,Er.Step_s_timer=new it,Er.DrawDebugData_s_color=new tt(0,0,0),Er.DrawDebugData_s_vs=j.MakeArray(4),Er.DrawDebugData_s_xf=new Z,Er.QueryFixtureShape_s_aabb=new Vt,Er.RayCast_s_input=new Ft,Er.RayCast_s_output=new kt,Er.RayCast_s_point=new j,Er.DrawJoint_s_p1=new j,Er.DrawJoint_s_p2=new j,Er.DrawJoint_s_color=new tt(.5,.8,.8),Er.DrawJoint_s_c=new tt,Er.DrawShape_s_ghostColor=new tt,Er.SolveTOI_s_subStep=new Cn,Er.SolveTOI_s_backup=new $,Er.SolveTOI_s_backup1=new $,Er.SolveTOI_s_backup2=new $,Er.SolveTOI_s_toi_input=new he,Er.SolveTOI_s_toi_output=new le;var Cr=function(t,e){this.prevBody=null,this.nextBody=null,this.prevController=null,this.nextController=null,this.controller=t,this.body=e},xr=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 Cr(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}(),wr=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,o=0,a=e.GetFixtureList();a;a=a.m_next){var h=new j,u=a.GetShape().ComputeSubmergedArea(this.normal,this.offset,e.GetTransform(),h);s+=u,i.x+=u*h.x,i.y+=u*h.y;var l;o+=u*(l=this.useDensity?a.GetDensity():1),n.x+=u*h.x*l,n.y+=u*h.y*l}if(i.x/=s,i.y/=s,n.x/=o,n.y/=o,!(s<r)){var c=this.gravity.Clone().SelfNeg();c.SelfMul(this.density*s),e.ApplyForce(c,n);var _=e.GetLinearVelocityFromWorldPoint(i,new j);_.SelfSub(this.velocity),_.SelfMul(-this.linearDrag*s),e.ApplyForce(_,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}(xr),Dr=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}(xr);Dr.Step_s_dtA=new j;var Rr=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}(xr),Ir=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(),o=this.m_bodyList;o&&o!==t;o=o.nextBody){var a=o.body,h=a.GetWorldCenter(),u=a.GetMass(),l=h.x-n.x,c=h.y-n.y,_=l*l+c*c;if(!(_<r)){var f=e.Step_s_f.Set(l,c);f.SelfMul(this.G/_/k(_)*s*u),i.IsAwake()&&i.ApplyForce(f,n),a.IsAwake()&&a.ApplyForce(f.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,S=v.GetWorldCenter(),A=v.GetMass(),T=S.x-m.x,b=S.y-m.y,E=T*T+b*b;if(!(E<r)){var C=e.Step_s_f.Set(T,b);C.SelfMul(this.G/E*g*A),p.IsAwake()&&p.ApplyForce(C,m),v.IsAwake()&&v.ApplyForce(C.SelfMul(-1),S)}}},i.Draw=function(){},e}(xr);Ir.Step_s_f=new j;var Mr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).T=new q,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 o=s.GetWorldVector(q.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,o,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/B(t,e):0},e}(xr);Mr.Step_s_damping=new j;var Pr=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=w(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=w(n),this.m_as=w(r);for(var s=0;s<n;++s){var o=this.m_ps[s],a=this.m_ps[s+1];this.m_Ls[s]=j.DistanceVV(o,a)}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],_=j.SubVV(l,u,j.s_t0),f=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,o=0;o<this.m_count;++o)j.MulSV(s,j.SubVV(this.m_ps[o],this.m_p0s[o],j.s_t0),this.m_vs[o])}},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),o=s.Normalize(),a=this.m_ims[i],h=this.m_ims[i+1];if(a+h!==0){var u=a/(a+h),l=h/(a+h);n.SelfMulSub(this.m_k2*u*(this.m_Ls[i]-o),s),r.SelfMulAdd(this.m_k2*l*(this.m_Ls[i]-o),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],o=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),_=l.LengthSquared(),f=c.LengthSquared();if(_*f!=0){var d=j.CrossVV(l,c),p=j.DotVV(l,c),m=W(d,p),g=j.MulSV(-1/_,l.SelfSkew(),t.s_Jd1),y=j.MulSV(1/f,c.SelfSkew(),t.s_Jd2),v=j.NegV(g,t.s_J1),S=j.SubVV(g,y,t.s_J2),A=y,T=o*j.DotVV(v,v)+h*j.DotVV(S,S)+u*j.DotVV(A,A);if(0!==T){T=1/T;for(var b=m-this.m_as[i];b>a;)b=(m-=2*a)-this.m_as[i];for(;b<-a;)b=(m+=2*a)-this.m_as[i];var E=-this.m_k3*T*b;n.SelfMulAdd(o*E,v),r.SelfMulAdd(h*E,S),s.SelfMulAdd(u*E,A)}}}},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}();Pr.s_d=new j,Pr.s_d1=new j,Pr.s_d2=new j,Pr.s_Jd1=new j,Pr.s_Jd2=new j,Pr.s_J1=new j,Pr.s_J2=new j,t.b2AABB=Vt,t.b2Abs=M,t.b2Acos=z,t.b2Alloc=function(){return null},t.b2AreaJoint=Ni,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=Di,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=Jt,t.b2BuoyancyController=wr,t.b2CalculateParticleIterations=Vn,t.b2ChainAndCircleContact=fn,t.b2ChainAndPolygonContact=dn,t.b2ChainShape=Si,t.b2CircleContact=hn,t.b2CircleShape=gi,t.b2Clamp=O,t.b2ClipSegmentToLine=Ut,t.b2ClipVertex=Nt,t.b2CollideCircles=Ee,t.b2CollideEdgeAndCircle=ai,t.b2CollideEdgeAndPolygon=fi,t.b2CollidePolygonAndCircle=De,t.b2CollidePolygons=Ze,t.b2Color=tt,t.b2ConstantAccelController=Dr,t.b2ConstantForceController=Rr,t.b2Contact=an,t.b2ContactEdge=on,t.b2ContactFactory=mn,t.b2ContactFeature=It,t.b2ContactFilter=yn,t.b2ContactID=Mt,t.b2ContactImpulse=vn,t.b2ContactListener=Sn,t.b2ContactManager=bn,t.b2ContactPositionConstraint=Pn,t.b2ContactRegister=pn,t.b2ContactSolver=Ln,t.b2ContactSolverDef=Bn,t.b2ContactVelocityConstraint=Mn,t.b2Controller=xr,t.b2ControllerEdge=Cr,t.b2Cos=G,t.b2Counter=nt,t.b2DegToRad=function(t){return t*D},t.b2DestructionListener=gn,t.b2Distance=vt,t.b2DistanceInput=at,t.b2DistanceJoint=Oi,t.b2DistanceJointDef=Bi,t.b2DistanceOutput=ht,t.b2DistanceProxy=st,t.b2Draw=et,t.b2DynamicTree=qt,t.b2EdgeAndCircleContact=cn,t.b2EdgeAndPolygonContact=_n,t.b2EdgeShape=vi,t.b2Filter=Ai,t.b2Fixture=Ci,t.b2FixtureDef=Ti,t.b2FixtureParticleQueryCallback=nr,t.b2FixtureProxy=bi,t.b2Free=function(){},t.b2FrictionJoint=ki,t.b2FrictionJointDef=Fi,t.b2GearJoint=Gi,t.b2GearJointDef=Vi,t.b2GetPointStates=function(e,i,n,r){var s;for(s=0;s<n.pointCount;++s){var o=n.points[s].id.key;e[s]=t.b2PointState.b2_removeState;for(var a=0,h=r.pointCount;a<h;++a)if(r.points[a].id.key===o){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=Ir,t.b2GrowableBuffer=ir,t.b2GrowableStack=rt,t.b2InvSqrt=F,t.b2IsPowerOfTwo=function(t){return t>0&&0==(t&t-1)},t.b2IsValid=L,t.b2Island=Fn,t.b2Jacobian=Ri,t.b2Joint=Pi,t.b2JointDef=Mi,t.b2JointEdge=Ii,t.b2Log=function(){},t.b2MakeArray=x,t.b2MakeNullArray=function(t){for(var e=new Array(t),i=0;i<t;++i)e[i]=null;return e},t.b2MakeNumberArray=w,t.b2Manifold=Ot,t.b2ManifoldPoint=Pt,t.b2MassData=pi,t.b2Mat22=q,t.b2Mat33=K,t.b2Max=B,t.b2Maybe=e,t.b2Min=P,t.b2MixFriction=rn,t.b2MixRestitution=sn,t.b2MotorJoint=zi,t.b2MotorJointDef=Ui,t.b2MouseJoint=Wi,t.b2MouseJointDef=Hi,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=$t,t.b2ParseInt=function(t){return parseInt(t,10)},t.b2ParseUInt=function(t){return Math.abs(parseInt(t,10))},t.b2ParticleBodyContact=sr,t.b2ParticleContact=rr,t.b2ParticleDef=kn,t.b2ParticleGroup=Hn,t.b2ParticleGroupDef=zn,t.b2ParticleHandle=Un,t.b2ParticlePair=or,t.b2ParticlePairSet=mr,t.b2ParticleSystem=ur,t.b2ParticleSystemDef=hr,t.b2ParticleSystem_CompositeShape=Sr,t.b2ParticleSystem_ConnectionFilter=gr,t.b2ParticleSystem_DestroyParticlesInShapeCallback=yr,t.b2ParticleSystem_FixedSetAllocator=dr,t.b2ParticleSystem_FixtureParticle=function(t,e){this.second=y,this.first=t,this.second=e},t.b2ParticleSystem_FixtureParticleSet=pr,t.b2ParticleSystem_InsideBoundsEnumerator=_r,t.b2ParticleSystem_JoinParticleGroupsFilter=vr,t.b2ParticleSystem_ParticleListNode=fr,t.b2ParticleSystem_ParticlePair=function(t,e){this.first=y,this.second=y,this.first=t,this.second=e},t.b2ParticleSystem_Proxy=cr,t.b2ParticleSystem_ReactiveFilter=Ar,t.b2ParticleSystem_SolveCollisionCallback=br,t.b2ParticleSystem_UpdateBodyContactsCallback=Tr,t.b2ParticleSystem_UserOverridableBuffer=lr,t.b2ParticleTriad=ar,t.b2PolygonAndCircleContact=ln,t.b2PolygonContact=un,t.b2PolygonShape=yi,t.b2Position=xn,t.b2PositionSolverManifold=On,t.b2Pow=V,t.b2PrismaticJoint=Xi,t.b2PrismaticJointDef=ji,t.b2Profile=En,t.b2PulleyJoint=qi,t.b2PulleyJointDef=Yi,t.b2QueryCallback=An,t.b2RadToDeg=function(t){return t*R},t.b2Random=function(){return 2*Math.random()-1},t.b2RandomRange=function(t,e){return(e-t)*Math.random()+t},t.b2RayCastCallback=Tn,t.b2RayCastInput=Ft,t.b2RayCastOutput=kt,t.b2RevoluteJoint=Qi,t.b2RevoluteJointDef=Ki,t.b2Rope=Pr,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=Ji,t.b2RopeJointDef=Zi,t.b2Rot=Q,t.b2SeparationFunction=ce,t.b2Shape=mi,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=B(i.m_radius,_)+B(n.m_radius,_),s=e.transformA,o=e.transformB,a=e.translationB,h=At.Set(0,0),u=0,l=Tt;l.m_count=0;for(var c=l.m_vertices,f=i.GetSupport(Q.MulTRV(s.q,j.NegV(a,j.s_t1),j.s_t0)),d=Z.MulXV(s,i.GetVertex(f),bt),p=n.GetSupport(Q.MulTRV(o.q,a,j.s_t0)),m=Z.MulXV(o,n.GetVertex(p),Et),g=j.SubVV(d,m,Ct),y=B(_,r-_),v=0;v<20&&M(g.Length()-y)>.004;){t.iterations+=1,f=i.GetSupport(Q.MulTRV(s.q,j.NegV(g,j.s_t1),j.s_t0)),d=Z.MulXV(s,i.GetVertex(f),bt),p=n.GetSupport(Q.MulTRV(o.q,g,j.s_t0)),m=Z.MulXV(o,n.GetVertex(p),Et);var S=j.SubVV(d,m,xt);g.Normalize();var A=j.DotVV(g,S),T=j.DotVV(g,a);if(A-y>u*T){if(T<=0)return!1;if((u=(A-y)/T)>1)return!1;h.Copy(g).SelfNeg(),l.m_count=0}var b=c[l.m_count];switch(b.indexA=p,b.wA.Copy(m).SelfMulAdd(u,a),b.indexB=f,b.wB.Copy(d),b.w.Copy(b.wB).SelfSub(b.wA),b.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 E=wt,C=Dt;return l.GetWitnessPoints(E,C),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 Z,this.transformB=new Z,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=ot,t.b2SimplexVertex=ut,t.b2Sin=U,t.b2SolverData=Dn,t.b2Sq=N,t.b2Sqrt=k,t.b2StackAllocator=function(){},t.b2Swap=function(t,e){var i=t[0];t[0]=e[0],e[0]=i},t.b2Sweep=$,t.b2TOIInput=he,t.b2TOIOutput=le,t.b2TensorDampingController=Mr,t.b2TestOverlapAABB=Gt,t.b2TestOverlapShape=jt,t.b2TimeOfImpact=Ae,t.b2TimeStep=Cn,t.b2Timer=it,t.b2Transform=Z,t.b2TreeNode=Yt,t.b2Vec2=j,t.b2Vec2_zero=X,t.b2Vec3=Y,t.b2Velocity=wn,t.b2VelocityConstraintPoint=In,t.b2Version=E,t.b2WeldJoint=tn,t.b2WeldJointDef=$i,t.b2WheelJoint=nn,t.b2WheelJointDef=en,t.b2World=Er,t.b2WorldManifold=Lt,t.b2_180_over_pi=R,t.b2_aabbExtension=h,t.b2_aabbMultiplier=2,t.b2_angularSleepTolerance=b,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=o,t.b2_gjk_reset=function(){t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0},t.b2_invalidParticleIndex=y,t.b2_linearSleepTolerance=T,t.b2_linearSlop=l,t.b2_maxAngularCorrection=p,t.b2_maxFloat=i,t.b2_maxLinearCorrection=d,t.b2_maxManifoldPoints=2,t.b2_maxParticleForce=.5,t.b2_maxParticleIndex=2147483647,t.b2_maxParticlePressure=S,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=A,t.b2_minParticleWeight=1,t.b2_minPulleyLength=2,t.b2_particleStride=v,t.b2_pi=a,t.b2_pi_over_180=D,t.b2_polygonRadius=_,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=I,t.b2_velocityThreshold=1,t.b2_version=C,t.g_blockSolve=Rn,Object.defineProperty(t,"__esModule",{value:!0})}(e)}));(Wbt=jbt)&&Wbt.__esModule&&Object.prototype.hasOwnProperty.call(Wbt,"default")&&Wbt.default;var Xbt={};for(var Ybt in jbt)-1===Ybt.indexOf("b2_")&&(Xbt[Ybt.replace("b2","")]=jbt[Ybt]);var qbt=Xbt,Kbt=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){fe(this._contactFixtures,t)},e}(qbt.ContactListener),Qbt=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 qbt.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}(qbt.QueryCallback);function Zbt(t,e){var i=e.length;return e[t<0?i- -t%i:t%i]}function Jbt(t,e,i){for(var n=[];e<t;)e+=i.length;for(;t<=e;++t)n.push(Zbt(t,i));return n}function $bt(t,e,i){if(tEt(t,i)){if(nEt(Zbt(t,i),Zbt(t-1,i),Zbt(e,i))&&rEt(Zbt(t,i),Zbt(t+1,i),Zbt(e,i)))return!1}else if(rEt(Zbt(t,i),Zbt(t+1,i),Zbt(e,i))||nEt(Zbt(t,i),Zbt(t-1,i),Zbt(e,i)))return!1;if(tEt(e,i)){if(nEt(Zbt(e,i),Zbt(e-1,i),Zbt(t,i))&&rEt(Zbt(e,i),Zbt(e+1,i),Zbt(t,i)))return!1}else if(rEt(Zbt(e,i),Zbt(e+1,i),Zbt(t,i))||nEt(Zbt(e,i),Zbt(e-1,i),Zbt(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 jn;if(uEt(Zbt(t,i),Zbt(e,i),Zbt(n,i),Zbt(n+1,i),r))return!1}return!0}function tEt(t,e){return eEt(t,e)}function eEt(t,e,i){if(void 0===i){var n=t,r=e;t=Zbt(n-1,r),e=Zbt(n,r),void 0===t&&(t=e),void 0===(i=Zbt(n+1,r))&&(i=e)}return lEt(t,e,i)<0}function iEt(t,e,i){return lEt(t,e,i)>0}function nEt(t,e,i){return lEt(t,e,i)>=0}function rEt(t,e,i){return lEt(t,e,i)<=0}function sEt(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function oEt(t){aEt(t)||t.reverse()}function aEt(t){return t.length<3||function(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}(t)>0}function hEt(t,e,i,n){var r,s=new jn,o=e.y-t.y,a=t.x-e.x,h=o*t.x+a*t.y,u=n.y-i.y,l=i.x-n.x,c=u*i.x+l*i.y,_=o*l-u*a;return r=_,0,Math.abs(r-0)<=1e-6||(s.x=(l*h-a*c)/_,s.y=(o*c-u*h)/_),s}function uEt(t,e,i,n,r){if(t==i||t==n||e==i||e==n)return!1;var s=t.x,o=t.y,a=e.x,h=e.y,u=i.x,l=i.y,c=n.x,_=n.y;if(Math.max(s,a)<Math.min(u,c)||Math.max(u,c)<Math.min(s,a))return!1;if(Math.max(o,h)<Math.min(l,_)||Math.max(l,_)<Math.min(o,h))return!1;var f=(c-u)*(o-l)-(_-l)*(s-u),d=(a-s)*(o-l)-(h-o)*(s-u),p=(_-l)*(a-s)-(c-u)*(h-o);return!(Math.abs(p)<1e-6)&&(d/=p,(f/=p)>0&&f<1&&d>0&&d<1&&(r.x=s+f*(a-s),r.y=o+f*(h-o),!0))}function lEt(t,e,i){return t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y)}var cEt=Object.freeze({__proto__:null,ConvexPartition:function t(e){oEt(e);for(var i,n,r,s,o,a,h=[],u=new jn,l=new jn,c=0,_=0,f=0;f<e.length;++f)if(tEt(f,e)){n=r=1e8;for(var d=0;d<e.length;++d)iEt(Zbt(f-1,e),Zbt(f,e),Zbt(d,e))&&rEt(Zbt(f-1,e),Zbt(f,e),Zbt(d-1,e))&&(s=hEt(Zbt(f-1,e),Zbt(f,e),Zbt(d,e),Zbt(d-1,e)),eEt(Zbt(f+1,e),Zbt(f,e),s)&&(i=sEt(Zbt(f,e),s))<n&&(n=i,u=s,c=d)),iEt(Zbt(f+1,e),Zbt(f,e),Zbt(d+1,e))&&rEt(Zbt(f+1,e),Zbt(f,e),Zbt(d,e))&&(s=hEt(Zbt(f+1,e),Zbt(f,e),Zbt(d,e),Zbt(d+1,e)),iEt(Zbt(f-1,e),Zbt(f,e),s)&&(i=sEt(Zbt(f,e),s))<r&&(r=i,_=d,l=s));if(c==(_+1)%e.length){var p=u.add(l).multiplyScalar(.5);(o=Jbt(f,_,e)).push(p),(a=Jbt(c,f,e)).push(p)}else{for(var m=0,g=c;_<c;)_+=e.length;for(var y=c;y<=_;++y)if($bt(f,y,e)){var v=1/(sEt(Zbt(f,e),Zbt(y,e))+1);tEt(y,e)?rEt(Zbt(y-1,e),Zbt(y,e),Zbt(f,e))&&nEt(Zbt(y+1,e),Zbt(y,e),Zbt(f,e))?v+=3:v+=2:v+=1,v>m&&(g=y,m=v)}o=Jbt(f,g,e),a=Jbt(g,f,e)}return(h=h.concat(t(o))).concat(t(a))}h.push(e);for(var S=h.length-1;S>=0;S--)0==h[S].length&&h.splice(S,0);return h},ForceCounterClockWise:oEt,IsCounterClockWise:aEt});function _Et(t){gEt(t);for(var e=!0,i=0,n=t.length;i<n;++i)if(!pEt(t[(i+n-1)%n],t[i],t[(i+1)%n])){e=!1;break}if(e)return[t];var r=[],s=function(t){if(gEt(t),t.length<4)return[t];for(var e=t.length,i=[],n=[],r=0;r<e;++r){var s=new fEt;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 o=0;o<e;++o){var a=i[o];a.prev=i[(o+e-1)%e],a.next=i[(o+1)%e]}i.forEach((function(t){return yEt(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 _=0;_<e;++_){var f=i[_];if(f.isActive){var d=f.prev.point,p=f.point,m=f.next.point;if(Math.abs(dEt(d,p,m))>1e-5)return console.log("Failed to find ear. There might be self-intersection in the polygon."),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,vEt(u.next),h===e-4)break;for(var g=0;g<e;++g)yEt(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 S=v.prev.point,A=v.point,T=v.next.point;Math.abs(dEt(S,A,T))>1e-5&&n.push([S,A,T])}}return n}(t);if(!s)return null;for(;s.length;){for(var o=s.splice(0,1)[0],a=0,h=o.length;a<h;++a){for(var u=o[a],l=o[(a+1)%h],c=null,_=0;_<s.length;++_){for(var f=s[_],d=0;d<3;++d){var p=f[d];if(mEt(u,f[(d+1)%3])&&mEt(l,p)){c=f[(d+2)%3];break}}if(c)break}if(c&&!(dEt(o[(a+h-1)%h],u,c)>0||dEt(c,l,o[(a+2)%h])>0)){for(var m=[],g=(a+1)%h;g!==a;g=(g+1)%h)m.push(o[g]);m.push(u,c),o=m,h=m.length,a=-1,s.splice(_,1)}}r.push(o)}return r}var fEt=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 dEt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function pEt(t,e,i){return dEt(t,e,i)<0}function mEt(t,e){return t.x===e.x&&t.y===e.y}function gEt(t){(function(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})(t)&&t.reverse()}function yEt(t,e){if(t.shouldUpdate){t.shouldUpdate=!1;var i=t.prev.point,n=t.point,r=t.next.point;t.isConvex=pEt(i,n,r);var s=i.x-n.x,o=i.y-n.y,a=Math.sqrt(s*s+o*o);s/=a,o/=a;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+o*u,t.isConvex){t.isEar=!0;for(var c=0,_=e.length;c<_;++c){var f=e[c];if(f.isActive&&f!==t){var d=f.point;if(!(mEt(i,d)||mEt(n,d)||mEt(r,d))){var p=dEt(i,d,n),m=dEt(n,d,r),g=dEt(r,d,i);if(p>0&&m>0&&g>0){t.isEar=!1;break}if(0===p&&m>=0&&g>=0&&(dEt(i,f.prev.point,n)>0||dEt(i,f.next.point,n)>0)){t.isEar=!1;break}if(0===m&&p>=0&&g>=0&&(dEt(n,f.prev.point,r)>0||dEt(n,f.next.point,r)>0)){t.isEar=!1;break}if(0===g&&p>=0&&m>=0&&(dEt(r,f.prev.point,i)>0||dEt(r,f.next.point,i)>0)){t.isEar=!1;break}}}}}else t.isEar=!1}}function vEt(t){for(var e=t,i=t;;)if(mEt(e.point,e.next.point)||0===dEt(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}var SEt,AEt,TEt,bEt,EEt,CEt,xEt,wEt,DEt,REt,IEt,MEt=Object.freeze({__proto__:null,ConvexPartition:_Et});t("fS",SEt),function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(SEt||t("fS",SEt={})),be(SEt),t("fR",AEt),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(AEt||t("fR",AEt={})),be(AEt),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.SWING1=3]="SWING1",t[t.SWING2=4]="SWING2",t[t.TWIST=5]="TWIST"}(TEt||(TEt={})),be(TEt),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(bEt||(bEt={})),be(bEt),t("fT",EEt),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CAPSULE=2]="CAPSULE",t[t.CYLINDER=3]="CYLINDER",t[t.CONE=4]="CONE",t[t.MESH=5]="MESH",t[t.PLANE=6]="PLANE",t[t.SIMPLEX=7]="SIMPLEX",t[t.TERRAIN=8]="TERRAIN"}(EEt||t("fT",EEt={})),be(EEt),function(t){t[t.POINT_TO_POINT=0]="POINT_TO_POINT",t[t.HINGE=1]="HINGE",t[t.FIXED=2]="FIXED",t[t.CONFIGURABLE=3]="CONFIGURABLE"}(CEt||(CEt={})),be(CEt),function(t){t[t.FREE=0]="FREE",t[t.LIMITED=1]="LIMITED",t[t.LOCKED=2]="LOCKED"}(xEt||(xEt={})),be(xEt),function(t){t[t.DISABLED=0]="DISABLED",t[t.SERVO=1]="SERVO",t[t.INDUCTION=2]="INDUCTION"}(wEt||(wEt={})),be(wEt),function(t){t[t.BOX=0]="BOX",t[t.CAPSULE=1]="CAPSULE"}(DEt||(DEt={})),be(DEt),function(t){t[t.DEFAULT=1]="DEFAULT"}(REt||(REt={})),be(REt),t("fU",IEt),function(t){t[t.NONE=0]="NONE",t[t.WIRE_FRAME=1]="WIRE_FRAME",t[t.CONSTRAINT=2]="CONSTRAINT",t[t.AABB=4]="AABB"}(IEt||t("fU",IEt={})),be(IEt);var PEt=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=REt.DEFAULT}else{for(var r=0;r<32;r++)this[""+(1<<r)]=0;this[1]=REt.DEFAULT}},BEt=null;v.internal.PhysicsGroup2D=Rbt;var OEt,LEt,NEt,FEt,kEt,VEt,GEt,UEt,zEt,HEt,WEt,jEt,XEt,YEt,qEt,KEt,QEt,ZEt,JEt,$Et,tCt,eCt,iCt,nCt,rCt,sCt=t("fc",function(t){function e(){var e,i,n,r,s;(s=t.call(this)||this).velocityIterations=10,s.positionIterations=10,s.collisionMatrix=new PEt,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 jn(0,-10*Lbt),s._delayEvents=[];var o=Me.querySettings(Re.Category.PHYSICS,"gravity");o&&(jn.copy(s._gravity,o),s._gravity.multiplyScalar(Lbt)),s._allowSleep=null!==(e=Me.querySettings(Re.Category.PHYSICS,"allowSleep"))&&void 0!==e?e:s._allowSleep,s._fixedTimeStep=null!==(i=Me.querySettings(Re.Category.PHYSICS,"fixedTimeStep"))&&void 0!==i?i:s._fixedTimeStep,s._maxSubSteps=null!==(n=Me.querySettings(Re.Category.PHYSICS,"maxSubSteps"))&&void 0!==n?n:s._maxSubSteps,s._autoSimulation=null!==(r=Me.querySettings(Re.Category.PHYSICS,"autoSimulation"))&&void 0!==r?r:s._autoSimulation;var a=Me.querySettings(Re.Category.PHYSICS,"collisionMatrix");if(a)for(var h in a){var u=parseInt(h),l=1<<parseInt(h);s.collisionMatrix[""+l]=a[u]}var c=Me.querySettings(Re.Category.PHYSICS,"collisionGroups");return c&&c instanceof Array&&(c.forEach((function(t){Rbt[t.name]=1<<t.index})),be.update(Rbt)),Nbt.physicsWorld=kbt(),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){FI.emit(LI.EVENT_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,o=0,a=s.length;o<a;o++){var h=s[o];h.func.call(h.target)}s.length=0,this.physicsWorld.syncPhysicsToScene(),this.debugDrawFlags&&this.physicsWorld.drawDebug(),this._steping=!1,FI.emit(LI.EVENT_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=Ibt.Closest),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(){FI.registerSystem(e.ID,e.instance,Jl.Priority.LOW)},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 jn(t.x/Lbt,t.y/Lbt))}},{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 Nbt.physicsWorld}},{key:"stepping",get:function(){return this._steping}}],[{key:"PHYSICS_NONE",get:function(){return!Nbt.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===Nbt.id}},{key:"PHYSICS_BOX2D",get:function(){return"box2d"===Nbt.id}},{key:"PHYSICS_BOX2D_WASM",get:function(){return"box2d-wasm"===Nbt.id}},{key:"PhysicsGroup",get:function(){return Rbt}},{key:"instance",get:function(){return BEt||(BEt=new e),BEt}}]),e}(uo(Jl)));sCt.ID="PHYSICS_2D",FI.once(LI.EVENT_INIT,(function(){sCt.constructAndRegister()})),t("fd",OEt),function(t){t[t.Circles=0]="Circles",t[t.FaceA=1]="FaceA",t[t.FaceB=2]="FaceB"}(OEt||t("fd",OEt={}));var oCt,aCt,hCt,uCt,lCt,cCt,_Ct,fCt,dCt,pCt,mCt,gCt,yCt,vCt,SCt,ACt,TCt,bCt,ECt,CCt,xCt,wCt,DCt,RCt,ICt,MCt,PCt,BCt,OCt,LCt,NCt,FCt,kCt,VCt,GCt,UCt,zCt,HCt,WCt,jCt,XCt,YCt,qCt,KCt,QCt,ZCt,JCt,$Ct,txt,ext,ixt,nxt,rxt,sxt,oxt,axt,hxt,uxt,lxt,cxt,_xt,fxt,dxt,pxt,mxt,gxt,yxt,vxt,Sxt,Axt,Txt,bxt,Ext,Cxt,xxt,wxt,Dxt,Rxt,Ixt,Mxt,Pxt,Bxt,Oxt,Lxt,Nxt,Fxt,kxt,Vxt,Gxt,Uxt,zxt,Hxt,Wxt,jxt,Xxt,Yxt,qxt,Kxt,Qxt,Zxt,Jxt,$xt,twt,ewt,iwt,nwt,rwt,swt,owt,awt,hwt,uwt,lwt,cwt,_wt,fwt,dwt,pwt,mwt,gwt,ywt,vwt,Swt,Awt,Twt,bwt,Ewt,Cwt,xwt,wwt,Dwt,Rwt,Iwt,Mwt,Pwt,Bwt,Owt,Lwt,Nwt,Fwt,kwt=eh,Vwt=t("fe",(LEt=Ta("cc.RigidBody2D"),NEt=kwt(REt),FEt=kwt(xbt),kEt=kwt(ni),VEt=kwt(ii),GEt=kwt(ii),UEt=kwt(ii),zEt=kwt(jn),HEt=kwt(ii),WEt=kwt(ni),LEt((m((XEt=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=YEt&&YEt(),e.bullet=qEt&&qEt(),e.awakeOnLoad=KEt&&KEt(),e._body=null,e._group=QEt&&QEt(),e._type=ZEt&&ZEt(),e._allowSleep=JEt&&JEt(),e._gravityScale=$Et&&$Et(),e._linearDamping=tCt&&tCt(),e._angularDamping=eCt&&eCt(),e._linearVelocity=iCt&&iCt(),e._angularVelocity=nCt&&nCt(),e._fixedRotation=rCt&&rCt(),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"===Nbt.id?Vbt:new Nbt.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&&(t===xbt.Animated?this._body.setType(xbt.Kinematic):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}(Lp)).prototype,"group",[NEt],Object.getOwnPropertyDescriptor(XEt.prototype,"group"),XEt.prototype),YEt=fa(XEt.prototype,"enabledContactListener",[Ma],(function(){return!1})),qEt=fa(XEt.prototype,"bullet",[Ma],(function(){return!1})),m(XEt.prototype,"type",[FEt],Object.getOwnPropertyDescriptor(XEt.prototype,"type"),XEt.prototype),m(XEt.prototype,"allowSleep",[kEt],Object.getOwnPropertyDescriptor(XEt.prototype,"allowSleep"),XEt.prototype),m(XEt.prototype,"gravityScale",[VEt],Object.getOwnPropertyDescriptor(XEt.prototype,"gravityScale"),XEt.prototype),m(XEt.prototype,"linearDamping",[GEt],Object.getOwnPropertyDescriptor(XEt.prototype,"linearDamping"),XEt.prototype),m(XEt.prototype,"angularDamping",[UEt],Object.getOwnPropertyDescriptor(XEt.prototype,"angularDamping"),XEt.prototype),m(XEt.prototype,"linearVelocity",[zEt],Object.getOwnPropertyDescriptor(XEt.prototype,"linearVelocity"),XEt.prototype),m(XEt.prototype,"angularVelocity",[HEt],Object.getOwnPropertyDescriptor(XEt.prototype,"angularVelocity"),XEt.prototype),m(XEt.prototype,"fixedRotation",[WEt],Object.getOwnPropertyDescriptor(XEt.prototype,"fixedRotation"),XEt.prototype),KEt=fa(XEt.prototype,"awakeOnLoad",[Ma],(function(){return!0})),QEt=fa(XEt.prototype,"_group",[Ma],(function(){return REt.DEFAULT})),ZEt=fa(XEt.prototype,"_type",[Ma],(function(){return xbt.Dynamic})),JEt=fa(XEt.prototype,"_allowSleep",[Ma],(function(){return!0})),$Et=fa(XEt.prototype,"_gravityScale",[Ma],(function(){return 1})),tCt=fa(XEt.prototype,"_linearDamping",[Ma],(function(){return 0})),eCt=fa(XEt.prototype,"_angularDamping",[Ma],(function(){return 0})),iCt=fa(XEt.prototype,"_linearVelocity",[Ma],(function(){return new jn})),nCt=fa(XEt.prototype,"_angularVelocity",[Ma],(function(){return 0})),rCt=fa(XEt.prototype,"_fixedRotation",[Ma],(function(){return!1})),jEt=XEt))||jEt)),Gwt=eh,Uwt=t("ff",(oCt=Ta("cc.Collider2D"),aCt=Gwt(ii),hCt=Gwt(REt),uCt=Gwt(ii),lCt=Gwt(ni),cCt=Gwt(ii),_Ct=Gwt(ii),fCt=Gwt(jn),oCt((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).editing=!1,e.tag=mCt&&mCt(),e.TYPE=wbt.None,e._shape=null,e._body=null,e._group=gCt&&gCt(),e._density=yCt&&yCt(),e._sensor=vCt&&vCt(),e._friction=SCt&&SCt(),e._restitution=ACt&&ACt(),e._offset=TCt&&TCt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._shape=function(t){return Gbt.INITED||(Gbt.INITED=!0,Gbt[wbt.BOX]=function(){return new Nbt.wrapper.BoxShape},Gbt[wbt.CIRCLE]=function(){return new Nbt.wrapper.CircleShape},Gbt[wbt.POLYGON]=function(){return new Nbt.wrapper.PolygonShape}),Gbt[t]()}(this.TYPE),this._shape.initialize(this),this._shape.onLoad&&this._shape.onLoad(),this._body=this.getComponent(Vwt)},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 Zn}}]),e}(uo(Lp)),mCt=fa(pCt.prototype,"tag",[aCt,Ma],(function(){return 0})),m(pCt.prototype,"group",[hCt],Object.getOwnPropertyDescriptor(pCt.prototype,"group"),pCt.prototype),m(pCt.prototype,"density",[uCt],Object.getOwnPropertyDescriptor(pCt.prototype,"density"),pCt.prototype),m(pCt.prototype,"sensor",[lCt],Object.getOwnPropertyDescriptor(pCt.prototype,"sensor"),pCt.prototype),m(pCt.prototype,"friction",[cCt],Object.getOwnPropertyDescriptor(pCt.prototype,"friction"),pCt.prototype),m(pCt.prototype,"restitution",[_Ct],Object.getOwnPropertyDescriptor(pCt.prototype,"restitution"),pCt.prototype),m(pCt.prototype,"offset",[fCt],Object.getOwnPropertyDescriptor(pCt.prototype,"offset"),pCt.prototype),gCt=fa(pCt.prototype,"_group",[Ma],(function(){return REt.DEFAULT})),yCt=fa(pCt.prototype,"_density",[Ma],(function(){return 1})),vCt=fa(pCt.prototype,"_sensor",[Ma],(function(){return!1})),SCt=fa(pCt.prototype,"_friction",[Ma],(function(){return.2})),ACt=fa(pCt.prototype,"_restitution",[Ma],(function(){return 0})),TCt=fa(pCt.prototype,"_offset",[Ma],(function(){return new jn})),dCt=pCt))||dCt)),zwt=(t("fg",(bCt=Ta("cc.BoxCollider2D"),ECt=eh(Kn),bCt((xCt=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=wCt&&wCt(),e.TYPE=wbt.BOX,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}(Uwt),wCt=fa(xCt.prototype,"_size",[Ma],(function(){return new Kn(1,1)})),m(xCt.prototype,"size",[ECt],Object.getOwnPropertyDescriptor(xCt.prototype,"size"),xCt.prototype),CCt=xCt))||CCt)),t("fh",(DCt=Ta("cc.CircleCollider2D"),RCt=eh(ii),DCt((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)._radius=PCt&&PCt(),e.TYPE=wbt.CIRCLE,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 jn}},{key:"worldRadius",get:function(){return this._shape?this._shape.worldRadius:0}}]),e}(Uwt),PCt=fa(MCt.prototype,"_radius",[Ma],(function(){return 1})),m(MCt.prototype,"radius",[RCt],Object.getOwnPropertyDescriptor(MCt.prototype,"radius"),MCt.prototype),ICt=MCt))||ICt)),t("fi",(BCt=Ta("cc.PolygonCollider2D"),OCt=eh(ii),LCt=eh([jn]),BCt((FCt=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=kCt&&kCt(),e._points=VCt&&VCt(),e.TYPE=wbt.POLYGON,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}(Uwt),kCt=fa(FCt.prototype,"threshold",[OCt],(function(){return 1})),VCt=fa(FCt.prototype,"_points",[Ma],(function(){return[new jn(-1,-1),new jn(1,-1),new jn(1,1),new jn(-1,1)]})),m(FCt.prototype,"points",[LCt],Object.getOwnPropertyDescriptor(FCt.prototype,"points"),FCt.prototype),NCt=FCt))||NCt)),eh),Hwt=t("fj",(GCt=Ta("cc.Joint2D"),UCt=zwt(Vwt),GCt((HCt=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=WCt&&WCt(),e.connectedAnchor=jCt&&jCt(),e.collideConnected=XCt&&XCt(),e.connectedBody=YCt&&YCt(),e._body=null,e._joint=null,e.TYPE=Dbt.None,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._joint=function(t){return function(){if(!Ubt.INITED){Ubt.INITED=!0;var t="builtin"===Nbt.id;Ubt[Dbt.SPRING]=function(){return t?zbt:new Nbt.wrapper.SpringJoint},Ubt[Dbt.DISTANCE]=function(){return t?zbt:new Nbt.wrapper.DistanceJoint},Ubt[Dbt.FIXED]=function(){return t?zbt:new Nbt.wrapper.FixedJoint},Ubt[Dbt.MOUSE]=function(){return t?zbt:new Nbt.wrapper.MouseJoint},Ubt[Dbt.RELATIVE]=function(){return t?zbt:new Nbt.wrapper.RelativeJoint},Ubt[Dbt.SLIDER]=function(){return t?zbt:new Nbt.wrapper.SliderJoint},Ubt[Dbt.WHEEL]=function(){return t?zbt:new Nbt.wrapper.WheelJoint},Ubt[Dbt.HINGE]=function(){return t?zbt:new Nbt.wrapper.HingeJoint}}}(),Ubt[t]()}(this.TYPE),this._joint.initialize(this),this._body=this.getComponent(Vwt)},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}(Lp),WCt=fa(HCt.prototype,"anchor",[Ma],(function(){return new jn})),jCt=fa(HCt.prototype,"connectedAnchor",[Ma],(function(){return new jn})),XCt=fa(HCt.prototype,"collideConnected",[Ma],(function(){return!1})),YCt=fa(HCt.prototype,"connectedBody",[UCt,Ma],(function(){return null})),zCt=HCt))||zCt)),Wwt=(t("fk",(qCt=Ta("cc.DistanceJoint2D"),KCt=eh(ii),QCt=eh(ni),qCt((m((JCt=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=Dbt.DISTANCE,e._maxLength=$Ct&&$Ct(),e._autoCalcDistance=txt&&txt(),e}return s(e,t),n(e,[{key:"maxLength",get:function(){return this._autoCalcDistance?this.connectedBody?mn.distance(this.node.worldPosition,this.connectedBody.node.worldPosition):mn.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}(Hwt)).prototype,"maxLength",[KCt],Object.getOwnPropertyDescriptor(JCt.prototype,"maxLength"),JCt.prototype),m(JCt.prototype,"autoCalcDistance",[QCt],Object.getOwnPropertyDescriptor(JCt.prototype,"autoCalcDistance"),JCt.prototype),$Ct=fa(JCt.prototype,"_maxLength",[Ma],(function(){return 5})),txt=fa(JCt.prototype,"_autoCalcDistance",[Ma],(function(){return!0})),ZCt=JCt))||ZCt)),t("fl",(ext=Ta("cc.SpringJoint2D"),ixt=eh(ii),nxt=eh(ii),rxt=eh(ii),sxt=eh(ni),ext((m((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).TYPE=Dbt.SPRING,e._frequency=hxt&&hxt(),e._dampingRatio=uxt&&uxt(),e._distance=lxt&&lxt(),e._autoCalcDistance=cxt&&cxt(),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?mn.distance(this.node.worldPosition,this.connectedBody.node.worldPosition):mn.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}(Hwt)).prototype,"frequency",[ixt],Object.getOwnPropertyDescriptor(axt.prototype,"frequency"),axt.prototype),m(axt.prototype,"dampingRatio",[nxt],Object.getOwnPropertyDescriptor(axt.prototype,"dampingRatio"),axt.prototype),m(axt.prototype,"distance",[rxt],Object.getOwnPropertyDescriptor(axt.prototype,"distance"),axt.prototype),m(axt.prototype,"autoCalcDistance",[sxt],Object.getOwnPropertyDescriptor(axt.prototype,"autoCalcDistance"),axt.prototype),hxt=fa(axt.prototype,"_frequency",[Ma],(function(){return 5})),uxt=fa(axt.prototype,"_dampingRatio",[Ma],(function(){return.7})),lxt=fa(axt.prototype,"_distance",[Ma],(function(){return 10})),cxt=fa(axt.prototype,"_autoCalcDistance",[Ma],(function(){return!0})),oxt=axt))||oxt)),t("fm",(_xt=Ta("cc.MouseJoint2D"),fxt=eh(ii),dxt=eh(ii),pxt=eh(ii),_xt((m((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).TYPE=Dbt.MOUSE,e._maxForce=yxt&&yxt(),e._dampingRatio=vxt&&vxt(),e._frequency=Sxt&&Sxt(),e._target=new jn,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}(Hwt)).prototype,"frequency",[fxt],Object.getOwnPropertyDescriptor(gxt.prototype,"frequency"),gxt.prototype),m(gxt.prototype,"dampingRatio",[dxt],Object.getOwnPropertyDescriptor(gxt.prototype,"dampingRatio"),gxt.prototype),m(gxt.prototype,"maxForce",[pxt],Object.getOwnPropertyDescriptor(gxt.prototype,"maxForce"),gxt.prototype),yxt=fa(gxt.prototype,"_maxForce",[Ma],(function(){return 1e3})),vxt=fa(gxt.prototype,"_dampingRatio",[Ma],(function(){return.7})),Sxt=fa(gxt.prototype,"_frequency",[Ma],(function(){return 5})),mxt=gxt))||mxt)),new mn),jwt=new mn,Xwt=(t("fn",(Axt=Ta("cc.RelativeJoint2D"),Txt=eh(ii),bxt=eh(ii),Ext=eh(ii),Cxt=eh(jn),xxt=eh(ii),wxt=eh(ni),Axt((m((Rxt=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=Dbt.RELATIVE,e._maxForce=Ixt&&Ixt(),e._maxTorque=Mxt&&Mxt(),e._correctionFactor=Pxt&&Pxt(),e._angularOffset=Bxt&&Bxt(),e._linearOffset=Oxt&&Oxt(),e._autoCalcOffset=Lxt&&Lxt(),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?jn.subtract(this._linearOffset,this.connectedBody.node.worldPosition,this.node.worldPosition):jn.subtract(this._linearOffset,new jn(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&&(In.toEuler(Wwt,this.node.worldRotation),this.connectedBody?In.toEuler(jwt,this.connectedBody.node.worldRotation):In.toEuler(jwt,new In),this._angularOffset=jwt.z-Wwt.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}(Hwt)).prototype,"maxForce",[Txt],Object.getOwnPropertyDescriptor(Rxt.prototype,"maxForce"),Rxt.prototype),m(Rxt.prototype,"maxTorque",[bxt],Object.getOwnPropertyDescriptor(Rxt.prototype,"maxTorque"),Rxt.prototype),m(Rxt.prototype,"correctionFactor",[Ext],Object.getOwnPropertyDescriptor(Rxt.prototype,"correctionFactor"),Rxt.prototype),m(Rxt.prototype,"linearOffset",[Cxt],Object.getOwnPropertyDescriptor(Rxt.prototype,"linearOffset"),Rxt.prototype),m(Rxt.prototype,"angularOffset",[xxt],Object.getOwnPropertyDescriptor(Rxt.prototype,"angularOffset"),Rxt.prototype),m(Rxt.prototype,"autoCalcOffset",[wxt],Object.getOwnPropertyDescriptor(Rxt.prototype,"autoCalcOffset"),Rxt.prototype),Ixt=fa(Rxt.prototype,"_maxForce",[Ma],(function(){return 5})),Mxt=fa(Rxt.prototype,"_maxTorque",[Ma],(function(){return.7})),Pxt=fa(Rxt.prototype,"_correctionFactor",[Ma],(function(){return.3})),Bxt=fa(Rxt.prototype,"_angularOffset",[Ma],(function(){return 0})),Oxt=fa(Rxt.prototype,"_linearOffset",[Ma],(function(){return new jn})),Lxt=fa(Rxt.prototype,"_autoCalcOffset",[Ma],(function(){return!0})),Dxt=Rxt))||Dxt)),new jn);t("fo",(Nxt=Ta("cc.SliderJoint2D"),Fxt=eh(ii),kxt=eh(ni),Vxt=eh(ni),Gxt=eh(ii),Uxt=eh(ii),zxt=eh(ni),Hxt=eh(ii),Wxt=eh(ii),Nxt((m((Xxt=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=Dbt.SLIDER,e._angle=Yxt&&Yxt(),e._autoCalcAngle=qxt&&qxt(),e._enableMotor=Kxt&&Kxt(),e._maxMotorForce=Qxt&&Qxt(),e._motorSpeed=Zxt&&Zxt(),e._enableLimit=Jxt&&Jxt(),e._lowerLimit=$xt&&$xt(),e._upperLimit=twt&&twt(),e}return s(e,t),n(e,[{key:"angle",get:function(){return this._autoCalcAngle&&(this.connectedBody?jn.subtract(Xwt,this.connectedBody.node.worldPosition,this.node.worldPosition):jn.subtract(Xwt,new jn(0,0),this.node.worldPosition),this._angle=Gi(Math.atan2(Xwt.y,Xwt.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}(Hwt)).prototype,"angle",[Fxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"angle"),Xxt.prototype),m(Xxt.prototype,"autoCalcAngle",[kxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"autoCalcAngle"),Xxt.prototype),m(Xxt.prototype,"enableMotor",[Vxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"enableMotor"),Xxt.prototype),m(Xxt.prototype,"maxMotorForce",[Gxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"maxMotorForce"),Xxt.prototype),m(Xxt.prototype,"motorSpeed",[Uxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"motorSpeed"),Xxt.prototype),m(Xxt.prototype,"enableLimit",[zxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"enableLimit"),Xxt.prototype),m(Xxt.prototype,"lowerLimit",[Hxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"lowerLimit"),Xxt.prototype),m(Xxt.prototype,"upperLimit",[Wxt],Object.getOwnPropertyDescriptor(Xxt.prototype,"upperLimit"),Xxt.prototype),Yxt=fa(Xxt.prototype,"_angle",[Ma],(function(){return 0})),qxt=fa(Xxt.prototype,"_autoCalcAngle",[Ma],(function(){return!0})),Kxt=fa(Xxt.prototype,"_enableMotor",[Ma],(function(){return!1})),Qxt=fa(Xxt.prototype,"_maxMotorForce",[Ma],(function(){return 1e3})),Zxt=fa(Xxt.prototype,"_motorSpeed",[Ma],(function(){return 1e3})),Jxt=fa(Xxt.prototype,"_enableLimit",[Ma],(function(){return!1})),$xt=fa(Xxt.prototype,"_lowerLimit",[Ma],(function(){return 0})),twt=fa(Xxt.prototype,"_upperLimit",[Ma],(function(){return 0})),jxt=Xxt))||jxt)),t("fp",(ewt=Ta("cc.FixedJoint2D"),iwt=eh(ii),nwt=eh(ii),ewt((m((swt=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=Dbt.FIXED,e._frequency=owt&&owt(),e._dampingRatio=awt&&awt(),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}(Hwt)).prototype,"frequency",[iwt],Object.getOwnPropertyDescriptor(swt.prototype,"frequency"),swt.prototype),m(swt.prototype,"dampingRatio",[nwt],Object.getOwnPropertyDescriptor(swt.prototype,"dampingRatio"),swt.prototype),owt=fa(swt.prototype,"_frequency",[Ma],(function(){return.7})),awt=fa(swt.prototype,"_dampingRatio",[Ma],(function(){return.5})),rwt=swt))||rwt)),t("fq",(hwt=Ta("cc.WheelJoint2D"),uwt=eh(ii),lwt=eh(ni),cwt=eh(ii),_wt=eh(ii),fwt=eh(ii),dwt=eh(ii),hwt((m((mwt=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=Dbt.WHEEL,e._angle=gwt&&gwt(),e._enableMotor=ywt&&ywt(),e._maxMotorTorque=vwt&&vwt(),e._motorSpeed=Swt&&Swt(),e._frequency=Awt&&Awt(),e._dampingRatio=Twt&&Twt(),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}(Hwt)).prototype,"angle",[uwt],Object.getOwnPropertyDescriptor(mwt.prototype,"angle"),mwt.prototype),m(mwt.prototype,"enableMotor",[lwt],Object.getOwnPropertyDescriptor(mwt.prototype,"enableMotor"),mwt.prototype),m(mwt.prototype,"maxMotorTorque",[cwt],Object.getOwnPropertyDescriptor(mwt.prototype,"maxMotorTorque"),mwt.prototype),m(mwt.prototype,"motorSpeed",[_wt],Object.getOwnPropertyDescriptor(mwt.prototype,"motorSpeed"),mwt.prototype),m(mwt.prototype,"frequency",[fwt],Object.getOwnPropertyDescriptor(mwt.prototype,"frequency"),mwt.prototype),m(mwt.prototype,"dampingRatio",[dwt],Object.getOwnPropertyDescriptor(mwt.prototype,"dampingRatio"),mwt.prototype),gwt=fa(mwt.prototype,"_angle",[Ma],(function(){return 90})),ywt=fa(mwt.prototype,"_enableMotor",[Ma],(function(){return!1})),vwt=fa(mwt.prototype,"_maxMotorTorque",[Ma],(function(){return 1e3})),Swt=fa(mwt.prototype,"_motorSpeed",[Ma],(function(){return 0})),Awt=fa(mwt.prototype,"_frequency",[Ma],(function(){return 5})),Twt=fa(mwt.prototype,"_dampingRatio",[Ma],(function(){return.7})),pwt=mwt))||pwt)),t("fr",(bwt=Ta("cc.HingeJoint2D"),Ewt=eh(ni),Cwt=eh(ii),xwt=eh(ii),wwt=eh(ni),Dwt=eh(ii),Rwt=eh(ii),bwt((m((Mwt=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=Dbt.HINGE,e._enableLimit=Pwt&&Pwt(),e._lowerAngle=Bwt&&Bwt(),e._upperAngle=Owt&&Owt(),e._enableMotor=Lwt&&Lwt(),e._maxMotorTorque=Nwt&&Nwt(),e._motorSpeed=Fwt&&Fwt(),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}(Hwt)).prototype,"enableLimit",[Ewt],Object.getOwnPropertyDescriptor(Mwt.prototype,"enableLimit"),Mwt.prototype),m(Mwt.prototype,"lowerAngle",[Cwt],Object.getOwnPropertyDescriptor(Mwt.prototype,"lowerAngle"),Mwt.prototype),m(Mwt.prototype,"upperAngle",[xwt],Object.getOwnPropertyDescriptor(Mwt.prototype,"upperAngle"),Mwt.prototype),m(Mwt.prototype,"enableMotor",[wwt],Object.getOwnPropertyDescriptor(Mwt.prototype,"enableMotor"),Mwt.prototype),m(Mwt.prototype,"maxMotorTorque",[Dwt],Object.getOwnPropertyDescriptor(Mwt.prototype,"maxMotorTorque"),Mwt.prototype),m(Mwt.prototype,"motorSpeed",[Rwt],Object.getOwnPropertyDescriptor(Mwt.prototype,"motorSpeed"),Mwt.prototype),Pwt=fa(Mwt.prototype,"_enableLimit",[Ma],(function(){return!1})),Bwt=fa(Mwt.prototype,"_lowerAngle",[Ma],(function(){return 0})),Owt=fa(Mwt.prototype,"_upperAngle",[Ma],(function(){return 0})),Lwt=fa(Mwt.prototype,"_enableMotor",[Ma],(function(){return!1})),Nwt=fa(Mwt.prototype,"_maxMotorTorque",[Ma],(function(){return 1e3})),Fwt=fa(Mwt.prototype,"_motorSpeed",[Ma],(function(){return 0})),Iwt=Mwt))||Iwt)),t("f2",{PolygonSeparator:cEt,PolygonPartition:MEt}),v.internal.physics2d={selector:Nbt};var Ywt=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=Ibt.Closest,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 0==(t.GetFilterData().categoryBits&this._mask)?0:this._type===Ibt.Closest?(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 jn(e.x,e.y)),this._normals.push(new jn(i.x,i.y)),this._fractions.push(n),this._type===Ibt.Any?0:this._type>=Ibt.All?1:n)},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}(qbt.RayCastCallback),qwt=[],Kwt=[new jn,new jn],Qwt=new qbt.WorldManifold,Zwt={points:[],separations:[],normal:new jn},Jwt=function(){this.localPoint=new jn,this.normalImpulse=0,this.tangentImpulse=0},$wt=[new Jwt,new Jwt],tDt={type:0,localPoint:new jn,localNormal:new jn,points:[]},eDt={normalImpulses:[],tangentImpulses:[]},iDt=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=qwt.pop();return i||(i=new t),i.init(e),i},t.put=function(t){var e=t.m_userData;e&&(qwt.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=Zwt.points,e=Zwt.separations,i=Zwt.normal;this._b2contact.GetWorldManifold(Qwt);var n=Qwt.points,r=Qwt.separations,s=this._b2contact.GetManifold().pointCount;t.length=e.length=s;for(var o=0;o<s;o++){var a=Kwt[o];a.x=n[o].x*Lbt,a.y=n[o].y*Lbt,t[o]=a,e[o]=r[o]*Lbt}return i.x=Qwt.normal.x,i.y=Qwt.normal.y,this._inverted&&(i.x*=-1,i.y*=-1),Zwt},e.getManifold=function(){for(var t=tDt.points,e=tDt.localNormal,i=tDt.localPoint,n=this._b2contact.GetManifold(),r=n.points,s=t.length=n.pointCount,o=0;o<s;o++){var a=$wt[o],h=r[o];a.localPoint.x=h.localPoint.x*Lbt,a.localPoint.y=h.localPoint.y*Lbt,a.normalImpulse=h.normalImpulse*Lbt,a.tangentImpulse=h.tangentImpulse,t[o]=a}return i.x=n.localPoint.x*Lbt,i.y=n.localPoint.y*Lbt,e.x=n.localNormal.x,e.y=n.localNormal.y,tDt.type=n.type,this._inverted&&(e.x*=-1,e.y*=-1),tDt},e.getImpulse=function(){var t=this._impulse;if(!t)return null;for(var e=eDt.normalImpulses,i=eDt.tangentImpulses,n=t.count,r=0;r<n;r++)e[r]=t.normalImpulses[r]*Lbt,i[r]=t.tangentImpulses[r];return i.length=e.length=n,eDt},e.emit=function(t){var e,i;switch(t){case Obt.BEGIN_CONTACT:case Obt.END_CONTACT:case Obt.PRE_SOLVE:case Obt.POST_SOLVE:}var n=this.colliderA,r=this.colliderB,s=null==n||null===(e=n.body)||void 0===e?void 0:e.enabledContactListener,o=null==r||null===(i=r.body)||void 0===i?void 0:i.enabledContactListener;s&&n.emit(t,n,r,this),o&&r.emit(t,r,n,this),(s||o)&&sCt.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}(),nDt=new qbt.Vec2,rDt=new bn,sDt=bn.GREEN,oDt=bn.RED,aDt=function(t){function e(e){var i;return(i=t.call(this)||this)._drawer=null,i._xf=new qbt.Transform,i._dxf=new qbt.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++){qbt.Transform.MulXV(this._xf,t[n],nDt);var r=nDt.x*Lbt,s=nDt.y*Lbt;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){qbt.Transform.MulXV(this._xf,t,nDt),this._drawer.circle(nDt.x*Lbt,nDt.y*Lbt,e*Lbt)},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/Lbt),void n.fill();this._applyStrokeColor(i),qbt.Transform.MulXV(this._xf,t,nDt),n.moveTo(nDt.x*Lbt,nDt.y*Lbt),qbt.Transform.MulXV(this._xf,e,nDt),n.lineTo(nDt.x*Lbt,nDt.y*Lbt),n.stroke()},i.DrawTransform=function(t){var e=this._drawer;e.strokeColor=oDt,nDt.x=nDt.y=0,qbt.Transform.MulXV(t,nDt,nDt),e.moveTo(nDt.x*Lbt,nDt.y*Lbt),nDt.x=1,nDt.y=0,qbt.Transform.MulXV(t,nDt,nDt),e.lineTo(nDt.x*Lbt,nDt.y*Lbt),e.stroke(),e.strokeColor=sDt,nDt.x=nDt.y=0,qbt.Transform.MulXV(t,nDt,nDt),e.moveTo(nDt.x*Lbt,nDt.y*Lbt),nDt.x=0,nDt.y=1,qbt.Transform.MulXV(t,nDt,nDt),e.lineTo(nDt.x*Lbt,nDt.y*Lbt),e.stroke()},i.DrawPoint=function(){},i.DrawParticles=function(){},i._applyStrokeColor=function(t){this._drawer.strokeColor=rDt.set(255*t.r,255*t.g,255*t.b,150)},i._applyFillColor=function(t){this._drawer.fillColor=rDt.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}(qbt.Draw),hDt=new mn,uDt=new jn,lDt=new jn,cDt=new qbt.BodyDef,_Dt=new qbt.AABB,fDt=[],dDt=function(){function t(){this._world=void 0,this._bodies=[],this._animatedBodies=[],this._rotationAxis=new mn,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 qbt.World(new qbt.Vec2(0,-10));var t=new qbt.BodyDef;this._physicsGroundBody=this._world.CreateBody(t);var e=new Kbt;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 Qbt,this._raycastQueryCallback=new Ywt}var e=t.prototype;return e._checkDebugDrawValid=function(){if(!this._debugGraphics||!this._debugGraphics.isValid){var t=RR("Canvas");if(!t){var e=FI.getScene();if(!e)return;(t=new xg("Canvas")).addComponent("cc.Canvas"),t.parent=e}var i=new xg("PHYSICS_2D_DEBUG_DRAW");i.hideFlags|=$s.Flags.DontSave,i.parent=t,i.worldPosition=mn.ZERO,i.layer=Pm.Enum.UI_2D,this._debugGraphics=i.addComponent("cc.Graphics"),this._debugGraphics.lineWidth=3;var n=new aDt(this._debugGraphics);this._b2DebugDrawer=n,this._world.SetDebugDraw(n)}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||Ibt.Closest,uDt.x=t.x/Lbt,uDt.y=t.y/Lbt,lDt.x=e.x/Lbt,lDt.y=e.y/Lbt;var r=this._raycastQueryCallback;r.init(i,n),this._world.RayCast(r,uDt,lDt);var s=r.getFixtures();if(s.length>0){for(var o=r.getPoints(),a=r.getNormals(),h=r.getFractions(),u=[],l=0,c=s.length;l<c;l++){var _=s[l],f=_.m_userData,d=f.collider;if(i===Ibt.AllClosest){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=f.getFixtureIndex(_),p.point.x=o[l].x*Lbt,p.point.y=o[l].y*Lbt,p.normal.x=a[l].x,p.normal.y=a[l].y,p.fraction=h[l]);continue}}u.push({collider:d,fixtureIndex:f.getFixtureIndex(_),point:new jn(o[l].x*Lbt,o[l].y*Lbt),normal:new jn(a[l].x,a[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(r.type!==xbt.Animated){var s=r.node,o=n.impl,a=o.GetPosition();hDt.x=a.x*Lbt,hDt.y=a.y*Lbt,hDt.z=0,s.worldPosition=hDt;var h=Gi(o.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=cDt,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/Lbt,r.y/Lbt),hDt.z=In.getAxisAngle(this._rotationAxis,n.worldRotation),this._rotationAxis.z<0&&(hDt.z=2*Math.PI-hDt.z),e.angle=hDt.z,e.awake=i.awakeOnLoad,i.type===xbt.Animated?(e.type=xbt.Kinematic,this._animatedBodies.push(t),t._animatedPos.set(e.position.x,e.position.y),t._animatedAngle=e.angle):e.type=i.type;var s=i,o=s._linearVelocity;e.linearVelocity.Set(o.x,o.y),e.angularVelocity=s._angularVelocity;var a=this._world.CreateBody(e);a.m_userData=t,t._imp=a,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),fe(this._bodies,t),t.rigidBody.type===xbt.Animated&&fe(this._animatedBodies,t))},e.registerContactFixture=function(t){this._contactListener.registerContactFixture(t)},e.unregisterContactFixture=function(t){this._contactListener.unregisterContactFixture(t)},e.testPoint=function(t){var e=uDt.x=t.x/Lbt,i=uDt.y=t.y/Lbt,n=.2/Lbt;_Dt.lowerBound.x=e-n,_Dt.lowerBound.y=i-n,_Dt.upperBound.x=e+n,_Dt.upperBound.y=i+n;var r=this._aabbQueryCallback;r.init(uDt),this._world.QueryAABB(r,_Dt);var s=r.getFixtures();fDt.length=0;for(var o=0;o<s.length;o++){var a=s[o].m_userData.collider;fDt.includes(a)||fDt.push(a)}return fDt},e.testAABB=function(t){_Dt.lowerBound.x=t.xMin/Lbt,_Dt.lowerBound.y=t.yMin/Lbt,_Dt.upperBound.x=t.xMax/Lbt,_Dt.upperBound.y=t.yMax/Lbt;var e=this._aabbQueryCallback;e.init(),this._world.QueryAABB(e,_Dt);var i=e.getFixtures();fDt.length=0;for(var n=0;n<i.length;n++){var r=i[n].m_userData.collider;fDt.includes(r)||fDt.push(r)}return fDt},e.drawDebug=function(){this._checkDebugDrawValid(),this._debugGraphics&&(this._debugGraphics.clear(),this._world.DrawDebugData())},e._onBeginContact=function(t){iDt.get(t).emit(Obt.BEGIN_CONTACT)},e._onEndContact=function(t){var e=t.m_userData;e&&(e.emit(Obt.END_CONTACT),iDt.put(t))},e._onPreSolve=function(t){var e=t.m_userData;e&&e.emit(Obt.PRE_SOLVE)},e._onPostSolve=function(t,e){var i=t.m_userData;i&&(i._setImpulse(e),i.emit(Obt.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}(),pDt=new mn,mDt=new qbt.Vec2,gDt=function(){function t(){this._animatedPos=new jn,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,sCt.instance._callAfterStep(this,this._init)},e.onDestroy=function(){sCt.instance._callAfterStep(this,this._destroy)},e.onEnable=function(){this.setActive(!0)},e.onDisable=function(){this.setActive(!1)},e.nodeTransformChanged=function(t){if(!sCt.instance.stepping){if(t&xg.TransformBit.SCALE)for(var e=this.rigidBody.getComponents(Uwt),i=0;i<e.length;i++)e[i].apply();t&xg.TransformBit.POSITION&&this.syncPositionToPhysics(!0),t&xg.TransformBit.ROTATION&&this.syncRotationToPhysics(!0)}},e._init=function(){this._inited||(sCt.instance.physicsWorld.addBody(this),this.setActive(!1),this._inited=!0)},e._destroy=function(){this._inited&&(sCt.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;mDt.x=(this._animatedPos.x-i.x)*n,mDt.y=(this._animatedPos.y-i.y)*n,e.SetLinearVelocity(mDt);var r=e.GetAngle()%Pi;r>Math.PI&&(r-=Pi);var s=(this._animatedAngle-r)*n;this._animatedAngle<-Mi&&r>Mi&&(s=(this._animatedAngle+Pi-r)*n),this._animatedAngle>Mi&&r<-Mi&&(s=(this._animatedAngle-Pi-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=r===xbt.Animated?e.GetLinearVelocity():e.GetPosition()).x=n.x/Lbt,i.y=n.y/Lbt,r===xbt.Animated&&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=pDt;In.toEulerInYXZOrder(n,i);var r=Vi(n.z);this._rigidBody.type===xbt.Animated&&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){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.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 mDt.Set(t.x/Lbt,t.y/Lbt),this._body.GetLinearVelocityFromWorldPoint(mDt,e),e.x*=Lbt,e.y*=Lbt,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 jn,mDt.Set(t.x/Lbt,t.y/Lbt),this._body.GetLocalVector(mDt,e),e.x*=Lbt,e.y*=Lbt,e},e.getWorldVector=function(t,e){return mDt.Set(t.x/Lbt,t.y/Lbt),this._body.GetWorldVector(mDt,e),e.x*=Lbt,e.y*=Lbt,e},e.getLocalPoint=function(t,e){return e=e||new jn,mDt.Set(t.x/Lbt,t.y/Lbt),this._body.GetLocalPoint(mDt,e),e.x*=Lbt,e.y*=Lbt,e},e.getWorldPoint=function(t,e){return e=e||new jn,mDt.Set(t.x/Lbt,t.y/Lbt),this._body.GetWorldPoint(mDt,e),e.x*=Lbt,e.y*=Lbt,e},e.getLocalCenter=function(t){t=t||new jn;var e=this._body.GetLocalCenter();return t.x=e.x*Lbt,t.y=e.y*Lbt,t},e.getWorldCenter=function(t){t=t||new jn;var e=this._body.GetWorldCenter();return t.x=e.x*Lbt,t.y=e.y*Lbt,t},e.getInertia=function(){return this._body.GetInertia()},e.applyForce=function(t,e,i){this._body&&(mDt.Set(e.x/Lbt,e.y/Lbt),this._body.ApplyForce(t,mDt,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&&(mDt.Set(e.x/Lbt,e.y/Lbt),this._body.ApplyLinearImpulse(t,mDt,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}(),yDt=new qbt.Filter,vDt=new qbt.Vec2,SDt=new qbt.Vec2;function ADt(t){var e=t.collider;return e.body?yDt.categoryBits=e.group===REt.DEFAULT?e.body.group:e.group:yDt.categoryBits=e.group,yDt.maskBits=sCt.instance.collisionMatrix[yDt.categoryBits],yDt}var TDt,bDt=function(){function t(){this._shapes=[],this._fixtures=[],this._collider=null,this._body=null,this._inited=!1,this._rect=new Zn}var e=t.prototype;return e.initialize=function(t){this._collider=t},e.onLoad=function(){},e.onEnable=function(){sCt.instance._callAfterStep(this,this._init)},e.onDisable=function(){sCt.instance._callAfterStep(this,this._destroy)},e.start=function(){},e.onGroupChanged=function(){var t=ADt(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=mn.ZERO,n=t.getComponent(Vwt);n&&n.impl&&n.impl.impl?this._body=n.impl.impl:(this._body=sCt.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=ADt(this),o=0;o<r.length;o++){var a=r[o],h={density:t.density,isSensor:t.sensor,friction:t.friction,restitution:t.restitution,shape:a,filter:s},u=this._body.CreateFixture(h);u.m_userData=this,null!=n&&n.enabledContactListener&&sCt.instance.physicsWorld.registerContactFixture(u),this._shapes.push(a),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,sCt.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=-t,r=-t,s=this._fixtures,o=0;o<s.length;o++)for(var a=s[o],h=a.GetShape().GetChildCount(),u=0;u<h;u++){if(vDt.Copy(a.GetAABB(u).lowerBound),SDt.Copy(a.GetAABB(u).upperBound),2===a.GetShape().m_type){var l=a.GetShape().m_radius;vDt.SelfAddXY(l,l),SDt.SelfSubXY(l,l)}vDt.x<e&&(e=vDt.x),vDt.y<i&&(i=vDt.y),SDt.x>n&&(n=SDt.x),SDt.y>r&&(r=SDt.y)}e*=Lbt,i*=Lbt,n*=Lbt,r*=Lbt;var c=this._rect;return c.x=e,c.y=i,c.width=n-e,c.height=r-i,c}}]),t}(),EDt=new Zn,CDt=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 jn,new jn,new jn,new jn],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/Lbt*t,o=r.size.height/2/Lbt*e,a=(i+r.offset.x*t)/Lbt,h=(n+r.offset.y*e)/Lbt,u=new qbt.PolygonShape;return u.SetAsBox(s,o,new qbt.Vec2(a,h),0),[u]},n(e,[{key:"worldPoints",get:function(){var t=EDt,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],o=r[1],a=r[2],h=r[3];return t.transformMat4ToPoints(e.node.worldMatrix,s,o,a,h),r}}]),e}(bDt),xDt=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 jn,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)/Lbt,o=(n+r.offset.y*e)/Lbt,a=new qbt.CircleShape;return a.m_radius=r.radius/Lbt*t,a.m_p.Set(s,o),[a]},n(e,[{key:"worldRadius",get:function(){return this._shapes[0].m_radius*Lbt}},{key:"worldPosition",get:function(){var t=this._shapes[0].m_p;return this._worldPosition.set(t.x*Lbt,t.y*Lbt)}}]),e}(bDt),wDt=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,o=s.points;o.length>0&&o[0].equals(o[o.length-1])&&(o.length-=1);var a=_Et(o);if(!a)return console.log("[Physics2D] b2PolygonShape failed to decompose polygon into convex polygons, node name: ",s.node.name),r;for(var h=s.offset,u=0;u<a.length;u++){for(var l=a[u],c=null,_=[],f=null,d=0,p=l.length;d<p;d++){c||(c=new qbt.PolygonShape);var m=l[d],g=(i+(m.x+h.x)*t)/Lbt,y=(n+(m.y+h.y)*e)/Lbt,v=new qbt.Vec2(g,y);_.push(v),f||(f=v),_.length===qbt.maxPolygonVertices&&(c.Set(_,_.length),r.push(c),c=null,d<p-1&&(_=[f,_[_.length-1]]))}c&&(c.Set(_,_.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 jn),jn.transformMat4(i[r],e[r],n);return i.length=e.length,this._worldPoints}}]),e}(bDt),DDt=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(){sCt.instance._callAfterStep(this,this._init)},e.onDisable=function(){sCt.instance._callAfterStep(this,this._destroy)},e.start=function(){sCt.instance._callAfterStep(this,this._init)},e.apply=function(){sCt.instance._callAfterStep(this,this._destroy),this.comp.enabledInHierarchy&&sCt.instance._callAfterStep(this,this._init)},e._init=function(){if(!this._inited){var t=this._jointComp;if(t.isValid){this._body=t.getComponent(Vwt);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:sCt.instance.physicsWorld.groundBodyImpl,e.collideConnected=t.collideConnected,this._b2joint=sCt.instance.physicsWorld.impl.CreateJoint(e),this._inited=!0)}}}},e._destroy=function(){this._inited&&(sCt.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}(),RDt=new qbt.Vec2,IDt=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 jn,e._isTouched=!1,e}s(e,t);var i=e.prototype;return i.setTarget=function(t){this._b2joint&&(RDt.x=t.x/Lbt,RDt.y=t.y/Lbt,this._b2joint.SetTarget(RDt))},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 qbt.MouseJointDef,e=this._jointComp;return t.target.Set(this._touchPoint.x/Lbt,this._touchPoint.y/Lbt),t.maxForce=e.maxForce,t.dampingRatio=e.dampingRatio,t.frequencyHz=e.frequency,t},i.initialize=function(e){t.prototype.initialize.call(this,e);var i=RR("Canvas");i&&(i.on(Nm.TOUCH_START,this.onTouchBegan,this),i.on(Nm.TOUCH_MOVE,this.onTouchMove,this),i.on(Nm.TOUCH_END,this.onTouchEnd,this),i.on(Nm.TOUCH_CANCEL,this.onTouchEnd,this))},i.onEnable=function(){},i.start=function(){},i.onTouchBegan=function(t){this._isTouched=!0;var e=this._touchPoint.set(t.getUILocation()),i=sCt.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}(DDt),MDt=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 qbt.RopeJointDef;return e.localAnchorA.Set(t.anchor.x/Lbt,t.anchor.y/Lbt),e.localAnchorB.Set(t.connectedAnchor.x/Lbt,t.connectedAnchor.y/Lbt),e.maxLength=t.maxLength/Lbt,e},e}(DDt),PDt=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 qbt.DistanceJointDef;return e.localAnchorA.Set(t.anchor.x/Lbt,t.anchor.y/Lbt),e.localAnchorB.Set(t.connectedAnchor.x/Lbt,t.connectedAnchor.y/Lbt),e.length=t.distance/Lbt,e.dampingRatio=t.dampingRatio,e.frequencyHz=t.frequency,e},e}(DDt),BDt=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(Vi(t))},i.setLinearOffset=function(t){this._b2joint&&this._b2joint.SetLinearOffset(new qbt.Vec2(t.x/Lbt,t.y/Lbt))},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 qbt.MotorJointDef;return e.linearOffset.Set(t.linearOffset.x/Lbt,t.linearOffset.y/Lbt),e.angularOffset=Vi(t.angularOffset),e.maxForce=t.maxForce,e.maxTorque=t.maxTorque,e.correctionFactor=t.correctionFactor,e},e}(DDt),ODt=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/Lbt,t.upperLimit/Lbt)}},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 qbt.PrismaticJointDef;e.localAnchorA.Set(t.anchor.x/Lbt,t.anchor.y/Lbt),e.localAnchorB.Set(t.connectedAnchor.x/Lbt,t.connectedAnchor.y/Lbt);var i=Vi(t.angle);return e.localAxisA.Set(Math.cos(i),Math.sin(i)),e.referenceAngle=0,e.enableLimit=t.enableLimit,e.lowerTranslation=t.lowerLimit/Lbt,e.upperTranslation=t.upperLimit/Lbt,e.enableMotor=t.enableMotor,e.maxMotorForce=t.maxMotorForce,e.motorSpeed=t.motorSpeed,e},e}(DDt),LDt=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 qbt.WeldJointDef;return e.localAnchorA.Set(t.anchor.x/Lbt,t.anchor.y/Lbt),e.localAnchorB.Set(t.connectedAnchor.x/Lbt,t.connectedAnchor.y/Lbt),e.referenceAngle=0,e.frequencyHz=t.frequency,e.dampingRatio=t.dampingRatio,e},e}(DDt),NDt=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 qbt.WheelJointDef;e.localAnchorA.Set(t.anchor.x/Lbt,t.anchor.y/Lbt),e.localAnchorB.Set(t.connectedAnchor.x/Lbt,t.connectedAnchor.y/Lbt);var i=Vi(t.angle);return e.localAxisA.Set(Math.cos(i),Math.sin(i)),e.maxMotorTorque=t.maxMotorTorque,e.motorSpeed=Vi(t.motorSpeed),e.enableMotor=t.enableMotor,e.dampingRatio=t.dampingRatio,e.frequencyHz=t.frequency,e},e}(DDt),FDt=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(Vi(t.lowerAngle),Vi(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 qbt.RevoluteJointDef;return e.localAnchorA.Set(t.anchor.x/Lbt,t.anchor.y/Lbt),e.localAnchorB.Set(t.connectedAnchor.x/Lbt,t.connectedAnchor.y/Lbt),e.enableMotor=t.enableMotor,e.maxMotorTorque=t.maxMotorTorque,e.motorSpeed=Vi(t.motorSpeed),e.enableLimit=t.enableLimit,e.lowerAngle=Vi(t.lowerAngle),e.upperAngle=Vi(t.upperAngle),e},e}(DDt);function kDt(t){v._global.CC_PHYSICS_BUILTIN="builtin"===t,v._global.CC_PHYSICS_CANNON="cannon.js"===t,v._global.CC_PHYSICS_AMMO="bullet"===t}MM.once(IM.EVENT_PRE_SUBSYSTEM_INIT,(function(){Nbt.register("box2d",{PhysicsWorld:dDt,RigidBody:gDt,BoxShape:CDt,CircleShape:xDt,PolygonShape:wDt,MouseJoint:IDt,DistanceJoint:MDt,SpringJoint:PDt,RelativeJoint:BDt,SliderJoint:ODt,FixedJoint:LDt,WheelJoint:NDt,HingeJoint:FDt})}));var VDt,GDt={id:"",switchTo:function(t){if(GDt.runInEditor){var e=GDt;if(GDt.physicsWorld&&t!==GDt.id&&null!=GDt.backend[t]?(GDt.physicsWorld.destroy(),G("[PHYSICS]: switch from "+GDt.id+" to "+t+"."),kDt(t),e.id=t,e.wrapper=GDt.backend[t],e.physicsWorld=WDt()):(G("[PHYSICS]: using "+t+"."),e.physicsWorld=WDt()),TDt){var i=e.physicsWorld;i.setGravity(TDt.gravity),i.setAllowSleep(TDt.allowSleep)}}},register:function(t,e){if(G("[PHYSICS]: register "+t+"."),GDt.backend[t]=e,!GDt.physicsWorld||GDt.id===t){kDt(t);var i=GDt;i.id=t,i.wrapper=e}},wrapper:{},backend:{},physicsWorld:null,runInEditor:!0},UDt=function(){return 0},zDt={impl:null,debugDrawFlags:0,debugDrawConstraintSize:0,setGravity:UDt,setAllowSleep:UDt,setDefaultMaterial:UDt,step:UDt,syncAfterEvents:UDt,syncSceneToPhysics:UDt,raycast:UDt,raycastClosest:UDt,sweepBox:UDt,sweepBoxClosest:UDt,sweepSphere:UDt,sweepSphereClosest:UDt,sweepCapsule:UDt,sweepCapsuleClosest:UDt,emitEvents:UDt,destroy:UDt};function HDt(t,e){return null==t&&(GDt.id?U(GDt.id+" physics does not support "+VDt[e]):et(9600),!0)}function WDt(){return HDt(GDt.wrapper.PhysicsWorld,VDt.World)?zDt:new GDt.wrapper.PhysicsWorld}!function(t){t[t.World=0]="World",t[t.RigidBody=1]="RigidBody",t[t.BoxCollider=2]="BoxCollider",t[t.SphereCollider=3]="SphereCollider",t[t.CapsuleCollider=4]="CapsuleCollider",t[t.MeshCollider=5]="MeshCollider",t[t.CylinderCollider=6]="CylinderCollider",t[t.ConeCollider=7]="ConeCollider",t[t.TerrainCollider=8]="TerrainCollider",t[t.SimplexCollider=9]="SimplexCollider",t[t.PlaneCollider=10]="PlaneCollider",t[t.PointToPointConstraint=11]="PointToPointConstraint",t[t.HingeConstraint=12]="HingeConstraint",t[t.FixedConstraint=13]="FixedConstraint",t[t.ConfigurableConstraint=14]="ConfigurableConstraint",t[t.BoxCharacterController=15]="BoxCharacterController",t[t.CapsuleCharacterController=16]="CapsuleCharacterController"}(VDt||(VDt={}));var jDt={impl:null,rigidBody:null,isAwake:!1,isSleepy:!1,isSleeping:!1,initialize:UDt,onEnable:UDt,onDisable:UDt,onDestroy:UDt,setType:UDt,setMass:UDt,setLinearDamping:UDt,setAngularDamping:UDt,useGravity:UDt,setLinearFactor:UDt,setAngularFactor:UDt,setAllowSleep:UDt,wakeUp:UDt,sleep:UDt,clearState:UDt,clearForces:UDt,clearVelocity:UDt,setSleepThreshold:UDt,getSleepThreshold:UDt,getLinearVelocity:UDt,setLinearVelocity:UDt,getAngularVelocity:UDt,setAngularVelocity:UDt,applyForce:UDt,applyLocalForce:UDt,applyImpulse:UDt,applyLocalImpulse:UDt,applyTorque:UDt,applyLocalTorque:UDt,setGroup:UDt,getGroup:UDt,addGroup:UDt,removeGroup:UDt,setMask:UDt,getMask:UDt,addMask:UDt,removeMask:UDt,isUsingCCD:UDt,useCCD:UDt},XDt={INITED:!1},YDt={impl:null,collider:null,attachedRigidBody:null,initialize:UDt,onLoad:UDt,onEnable:UDt,onDisable:UDt,onDestroy:UDt,setGroup:UDt,getGroup:UDt,addGroup:UDt,removeGroup:UDt,setMask:UDt,getMask:UDt,addMask:UDt,removeMask:UDt,setMaterial:UDt,setAsTrigger:UDt,setCenter:UDt,getAABB:UDt,getBoundingSphere:UDt,updateSize:UDt,updateRadius:UDt,setRadius:UDt,setCylinderHeight:UDt,setDirection:UDt,setHeight:UDt,setShapeType:UDt,setVertices:UDt,setMesh:UDt,setTerrain:UDt,setNormal:UDt,setConstant:UDt,updateEventListener:UDt};var qDt={INITED:!1},KDt={impl:null,initialize:UDt,onLoad:UDt,onEnable:UDt,onDisable:UDt,onDestroy:UDt,setEnableCollision:UDt,setConnectedBody:UDt,setPivotA:UDt,setPivotB:UDt,setAxis:UDt,setSecondaryAxis:UDt,setBreakForce:UDt,setBreakTorque:UDt,setConstraintMode:UDt,setLinearLimit:UDt,setAngularExtent:UDt,setLinearSoftConstraint:UDt,setLinearStiffness:UDt,setLinearDamping:UDt,setLinearRestitution:UDt,setSwingSoftConstraint:UDt,setTwistSoftConstraint:UDt,setSwingStiffness:UDt,setSwingDamping:UDt,setSwingRestitution:UDt,setTwistStiffness:UDt,setTwistDamping:UDt,setTwistRestitution:UDt,setDriverMode:UDt,setLinearMotorTarget:UDt,setLinearMotorVelocity:UDt,setLinearMotorForceLimit:UDt,setAngularMotorTarget:UDt,setAngularMotorVelocity:UDt,setAngularMotorForceLimit:UDt,setAutoPivotB:UDt,setLimitEnabled:UDt,setLowerLimit:UDt,setUpperLimit:UDt,setMotorEnabled:UDt,setMotorVelocity:UDt,setMotorForceLimit:UDt};var QDt,ZDt,JDt,$Dt={INITED:!1},tRt={initialize:UDt,onLoad:UDt,onEnable:UDt,onDisable:UDt,onDestroy:UDt,onGround:UDt,getPosition:UDt,setPosition:UDt,setStepOffset:UDt,setSlopeLimit:UDt,setContactOffset:UDt,setDetectCollisions:UDt,setOverlapRecovery:UDt,setGroup:UDt,getGroup:UDt,addGroup:UDt,removeGroup:UDt,setMask:UDt,getMask:UDt,addMask:UDt,removeMask:UDt,move:UDt,syncPhysicsToScene:UDt,updateEventListener:UDt,setHalfHeight:UDt,setHalfSideExtent:UDt,setHalfForwardExtent:UDt,setRadius:UDt,setHeight:UDt};!function(t){t[t.EBulletTypeVec3=0]="EBulletTypeVec3",t[t.EBulletTypeQuat=1]="EBulletTypeQuat",t[t.EBulletTypeTransform=2]="EBulletTypeTransform",t[t.EBulletTypeMotionState=3]="EBulletTypeMotionState",t[t.EBulletTypeCollisionObject=4]="EBulletTypeCollisionObject",t[t.EBulletTypeCollisionShape=5]="EBulletTypeCollisionShape",t[t.EBulletTypeCharacterController=6]="EBulletTypeCharacterController",t[t.EBulletTypeStridingMeshInterface=7]="EBulletTypeStridingMeshInterface",t[t.EBulletTypeTriangleMesh=8]="EBulletTypeTriangleMesh",t[t.EBulletTypeCollisionDispatcher=9]="EBulletTypeCollisionDispatcher",t[t.EBulletTypeDbvtBroadPhase=10]="EBulletTypeDbvtBroadPhase",t[t.EBulletTypeSequentialImpulseConstraintSolver=11]="EBulletTypeSequentialImpulseConstraintSolver",t[t.EBulletTypeCollisionWorld=12]="EBulletTypeCollisionWorld",t[t.EBulletTypeTypedConstraint=13]="EBulletTypeTypedConstraint",t[t.EBulletTypeDebugDraw=14]="EBulletTypeDebugDraw"}(QDt||(QDt={})),function(t){t[t.NONE=0]="NONE",t[t.FilterBackfaces=1]="FilterBackfaces",t[t.KeepUnflippedNormal=2]="KeepUnflippedNormal",t[t.UseSubSimplexConvexCastRaytest=4]="UseSubSimplexConvexCastRaytest",t[t.UseGjkConvexCastRaytest=8]="UseGjkConvexCastRaytest"}(ZDt||(ZDt={})),function(t){t[t.DBG_NoDebug=0]="DBG_NoDebug",t[t.DBG_DrawWireframe=1]="DBG_DrawWireframe",t[t.DBG_DrawAabb=2]="DBG_DrawAabb",t[t.DBG_DrawFeaturesText=4]="DBG_DrawFeaturesText",t[t.DBG_DrawContactPoints=8]="DBG_DrawContactPoints",t[t.DBG_NoDeactivation=16]="DBG_NoDeactivation",t[t.DBG_NoHelpText=32]="DBG_NoHelpText",t[t.DBG_DrawText=64]="DBG_DrawText",t[t.DBG_ProfileTimings=128]="DBG_ProfileTimings",t[t.DBG_EnableSatComparison=256]="DBG_EnableSatComparison",t[t.DBG_DisableBulletLCP=512]="DBG_DisableBulletLCP",t[t.DBG_EnableCCD=1024]="DBG_EnableCCD",t[t.DBG_DrawConstraints=2048]="DBG_DrawConstraints",t[t.DBG_DrawConstraintLimits=4096]="DBG_DrawConstraintLimits",t[t.DBG_FastWireframe=8192]="DBG_FastWireframe",t[t.DBG_DrawNormals=16384]="DBG_DrawNormals",t[t.DBG_DrawFrames=32768]="DBG_DrawFrames",t[t.DBG_MAX_DEBUG_DRAW_MODE=32769]="DBG_MAX_DEBUG_DRAW_MODE"}(JDt||(JDt={}));var eRt={},iRt={BODY_CACHE_NAME:"body",CCT_CACHE_NAME:"cct"};MM.onPostInfrastructureInitDelegate.add((function(){return jM().then((function(){return Promise.all([e.import("./bullet.release.wasm-11f4611e.js"),e.import("./bullet.release.wasm-e702f478.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){WM(i,t).then((function(t){e(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){G("[bullet]:bullet wasm lib loaded."),eRt=t,globalThis.Bullet=eRt})).then(t).catch((function(t){return n(r(t))}))}))}))})).catch((function(t){z(t)}))}));var nRt={type:"onTriggerEnter",selfCollider:null,otherCollider:null,impl:null},rRt={type:"onCollisionEnter",selfCollider:null,otherCollider:null,contacts:[],impl:null},sRt={type:"onControllerTriggerEnter",collider:null,characterController:null,impl:null},oRt=function(){function t(){this.BT_TRANSFORM_0=eRt.Transform_new(),this.BT_TRANSFORM_1=eRt.Transform_new(),this.BT_V3_0=eRt.Vec3_new(0,0,0),this.BT_V3_1=eRt.Vec3_new(0,0,0),this.BT_V3_2=eRt.Vec3_new(0,0,0),this.BT_QUAT_0=eRt.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!==eRt.EmptyShape_static()},n(t,null,[{key:"instance",get:function(){return null==t._instance&&(t._instance=new t),t._instance}}]),t}();oRt._instance=void 0,oRt.ROOT={};var aRt=new mn,hRt=new mn,uRt=new mn,lRt=new In,cRt=new In,_Rt=new Vn;new Vn;var fRt,dRt,pRt,mRt,gRt,yRt,vRt,SRt,ARt,TRt,bRt,ERt,CRt=new bn;function xRt(t,e){return eRt.Vec3_set(t,e.x,e.y,e.z),t}function wRt(t,e){var i=eRt.HEAPF32.subarray(e/4,e/4+3);return t.x=i[0],t.y=i[1],t.z=i[2],t}function DRt(t,e){return eRt.Quat_set(t,e.x,e.y,e.z,e.w),t}function RRt(t,e){var i=eRt.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 IRt(t,e){for(var i=e.renderingSubMeshes.length,n=0;n<i;n++){var r=e.renderingSubMeshes[n],s=r.geometricInfo;if(s){var o=r.primitiveMode,a=s.positions,h=s.indices,u=oRt.instance.BT_V3_0,l=oRt.instance.BT_V3_1,c=oRt.instance.BT_V3_2;if(o===Yc.TRIANGLE_LIST)for(var _=h.length,f=0;f<_;f+=3){var d=3*h[f],p=3*h[f+1],m=3*h[f+2];eRt.Vec3_set(u,a[d],a[d+1],a[d+2]),eRt.Vec3_set(l,a[p],a[p+1],a[p+2]),eRt.Vec3_set(c,a[m],a[m+1],a[m+2]),eRt.TriangleMesh_addTriangle(t,u,l,c,!1)}else if(o===Yc.TRIANGLE_STRIP)for(var g=h.length-2,y=0,v=0;v<g;v+=1){var S=3*h[v-y],A=3*h[v+y+1],T=3*h[v+2];y=~y,eRt.Vec3_set(u,a[S],a[S+1],a[S+2]),eRt.Vec3_set(l,a[A],a[A+1],a[A+2]),eRt.Vec3_set(c,a[T],a[T+1],a[T+2]),eRt.TriangleMesh_addTriangle(t,u,l,c,!1)}else if(o===Yc.TRIANGLE_FAN){var b=h.length-1,E=3*h[0];eRt.Vec3_set(u,a[E],a[E+1],a[E+2]);for(var C=1;C<b;C+=1){var x=3*h[C],w=3*h[C+1];eRt.Vec3_set(l,a[x],a[x+1],a[x+2]),eRt.Vec3_set(c,a[w],a[w+1],a[w+2]),eRt.TriangleMesh_addTriangle(t,u,l,c,!1)}}}}return t}function MRt(t,e){return t*e}iRt.CACHE=oRt;var PRt=t("fx",(fRt=Ta("cc.PhysicsMaterial"),dRt=eh(ii),pRt=eh(ii),mRt=eh(ii),gRt=eh(ii),fRt(((ERt=function(t){function e(){var i;return(i=t.call(this)||this).id=void 0,i._friction=SRt&&SRt(),i._rollingFriction=ARt&&ARt(),i._spinningFriction=TRt&&TRt(),i._restitution=bRt&&bRt(),e.allMaterials.push(c(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){Oi(this._friction,t)||(this._friction=t,this.emit(e.EVENT_UPDATE))}},{key:"rollingFriction",get:function(){return this._rollingFriction},set:function(t){Oi(this._rollingFriction,t)||(this._rollingFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"spinningFriction",get:function(){return this._spinningFriction},set:function(t){Oi(this._spinningFriction,t)||(this._spinningFriction=t,this.emit(e.EVENT_UPDATE))}},{key:"restitution",get:function(){return this._restitution},set:function(t){Oi(this._restitution,t)||(this._restitution=t,this.emit(e.EVENT_UPDATE))}}]),e}(Fd)).allMaterials=[],ERt.EVENT_UPDATE="event_update",ERt._idCounter=0,m((vRt=ERt).prototype,"friction",[dRt],Object.getOwnPropertyDescriptor(vRt.prototype,"friction"),vRt.prototype),m(vRt.prototype,"rollingFriction",[pRt],Object.getOwnPropertyDescriptor(vRt.prototype,"rollingFriction"),vRt.prototype),m(vRt.prototype,"spinningFriction",[mRt],Object.getOwnPropertyDescriptor(vRt.prototype,"spinningFriction"),vRt.prototype),m(vRt.prototype,"restitution",[gRt],Object.getOwnPropertyDescriptor(vRt.prototype,"restitution"),vRt.prototype),SRt=fa(vRt.prototype,"_friction",[Ma],(function(){return.6})),ARt=fa(vRt.prototype,"_rollingFriction",[Ma],(function(){return 0})),TRt=fa(vRt.prototype,"_spinningFriction",[Ma],(function(){return 0})),bRt=fa(vRt.prototype,"_restitution",[Ma],(function(){return 0})),yRt=vRt))||yRt)),BRt=t("fy",function(){function t(){this._hitPoint=new mn,this._hitNormal=new mn,this._distance=0,this._collider=null}var e=t.prototype;return e._assign=function(t,e,i,n){mn.copy(this._hitPoint,t),mn.copy(this._hitNormal,n),this._distance=e,this._collider=i},e.clone=function(){var e=new t;return mn.copy(e._hitPoint,this._hitPoint),mn.copy(e._hitNormal,this._hitNormal),e._distance=this._distance,e._collider=this._collider,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}}]),t}()),ORt=t("fz",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 mn.copy(t._hitPoint,this._hitPoint),mn.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}(BRt));v.internal.PhysicsGroup=REt;var LRt,NRt,FRt,kRt,VRt,GRt,URt,zRt,HRt,WRt,jRt,XRt,YRt,qRt,KRt,QRt,ZRt=t("ft",function(t){s(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this).raycastClosestResult=new BRt,e.raycastResults=[],e.lineStripCastClosestResult=new ORt,e.lineStripCastResults=[],e.sweepCastClosestResult=new BRt,e.sweepCastResults=[],e.collisionMatrix=new PEt(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 mn(0,-10,0),e._material=void 0,e.raycastOptions={group:-1,mask:-1,queryTrigger:!0,maxDistance:1e7},e.raycastResultPool=new Ks((function(){return new BRt}),1),e.sweepResultPool=new Ks((function(){return new BRt}),1),e}return e.setDefaultPhysicsMaterial=function(t){this._material=t,this.physicsWorld.setDefaultMaterial(this._material),this._material.on(PRt.EVENT_UPDATE,this._updateMaterial,this)},e.initDefaultMaterial=function(){var t=this;if(null!=this._material)return Promise.resolve();var e=UA.get("default-physics-material");if(!e)return console.error("PhysicsSystem initDefaultMaterial() Failed to load builtinMaterial"),Promise.resolve();var i=Me.querySettings(Re.Category.PHYSICS,"defaultMaterial");return i?new Promise((function(t,e){NA.loadAny(i,(function(i,n){return!i&&n instanceof PRt?t(n):e(i)}))})).then((function(e){t.setDefaultPhysicsMaterial(e)})).catch((function(n){U(n),U("Failed to load user customized default physics material: "+i+", will fallback to built-in default physics material"),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,FI.emit(LI.EVENT_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++}FI.emit(LI.EVENT_AFTER_PHYSICS)}}else this.physicsWorld.syncSceneToPhysics()},e.resetConfiguration=function(t){var e=t?t.allowSleep:Me.querySettings(Re.Category.PHYSICS,"allowSleep");"boolean"==typeof e&&(this._allowSleep=e);var i=t?t.fixedTimeStep:Me.querySettings(Re.Category.PHYSICS,"fixedTimeStep");"number"==typeof i&&(this._fixedTimeStep=i);var n=t?t.maxSubSteps:Me.querySettings(Re.Category.PHYSICS,"maxSubSteps");"number"==typeof n&&(this._maxSubSteps=n);var r=t?t.sleepThreshold:Me.querySettings(Re.Category.PHYSICS,"sleepThreshold");"number"==typeof r&&(this._sleepThreshold=r);var s=t?t.autoSimulation:Me.querySettings(Re.Category.PHYSICS,"autoSimulation");"boolean"==typeof s&&(this.autoSimulation=s);var o=t?t.gravity:Me.querySettings(Re.Category.PHYSICS,"gravity");o&&mn.copy(this._gravity,o);var a=t?t.collisionMatrix:Me.querySettings(Re.Category.PHYSICS,"collisionMatrix");if(a)for(var h in a)this.collisionMatrix[""+(1<<parseInt(h))]=a[h];var u=t?t.collisionGroups:Me.querySettings(Re.Category.PHYSICS,"collisionGroups");u&&u instanceof Array&&(u.forEach((function(t){REt[t.name]=1<<t.index})),be.update(REt)),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 mr,o=1;o<t.length&&!(r>i);++o){var a=t[o-1],h=t[o],u=new mn;mn.subtract(u,h,a);var l=mn.len(u);if(r+=l,mn.multiplyScalar(u,u,1/l),s.d=u,s.o=a,this.raycast(s,e,l,n))for(var c=0;c<this.raycastResults.length;c++){var _=this.raycastResults[c];if(0!==c||!mn.equals(a,_.hitPoint)){var f=new ORt;f._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,o-1),this.lineStripCastResults.push(f)}}}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 mr,o=!1,a=1;a<t.length&&!(r>i);++a){var h=t[a-1],u=t[a],l=new mn;mn.subtract(l,u,h);var c=mn.len(l);if(r+=c,mn.multiplyScalar(l,l,1/c),s.d=l,s.o=h,o=this.raycastClosest(s,e,c,n)){var _=this.raycastClosestResult,f=new ORt;f._assign(_.hitPoint,_.distance,_.collider,_.hitNormal,a-1),this.lineStripCastClosestResult=f;break}}return o},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,o){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===o&&(o=!0),!!this.physicsWorld&&(this.sweepResultPool.reset(),this.sweepCastResults.length=0,this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=o,this.physicsWorld.sweepCapsule(t,e,i,n,this.raycastOptions,this.sweepResultPool,this.sweepCastResults))},e.sweepCapsuleClosest=function(t,e,i,n,r,s,o){return void 0===r&&(r=4294967295),void 0===s&&(s=1e7),void 0===o&&(o=!0),!!this.physicsWorld&&(this.raycastOptions.mask=r>>>0,this.raycastOptions.maxDistance=s,this.raycastOptions.queryTrigger=o,this.physicsWorld.sweepCapsuleClosest(t,e,i,n,this.raycastOptions,this.sweepCastClosestResult))},e._updateMaterial=function(){this.physicsWorld&&this.physicsWorld.setDefaultMaterial(this._material)},i.constructAndRegister=function(){var t;if((null===(t=Me.querySettings(Re.Category.PHYSICS,"enabled"))||void 0===t||t)&&!i._instance){var e=new i;i._instance=e,e.resetConfiguration(),function(t){if(TDt||(TDt=t),GDt.runInEditor&&!GDt.physicsWorld){G("[PHYSICS]: using "+GDt.id+".");var e=GDt.physicsWorld=WDt();e.setGravity(TDt.gravity),e.setAllowSleep(TDt.allowSleep)}}(e),FI.registerSystem(i.ID,e,e.priority),MM.onPostProjectInitDelegate.add(e.initDefaultMaterial.bind(e))}},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 GDt.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!GDt.id}},{key:"PHYSICS_BUILTIN",get:function(){return"builtin"===GDt.id}},{key:"PHYSICS_CANNON",get:function(){return"cannon.js"===GDt.id}},{key:"PHYSICS_BULLET",get:function(){return"bullet"===GDt.id}},{key:"PHYSICS_PHYSX",get:function(){return"physx"===GDt.id}},{key:"PhysicsGroup",get:function(){return REt}},{key:"instance",get:function(){return i._instance}}]),i}(Jl));ZRt.ID="PHYSICS",ZRt._instance=null,FI.once(LI.EVENT_INIT,(function(){ZRt.constructAndRegister()}));var JRt,$Rt,tIt,eIt,iIt,nIt,rIt,sIt,oIt,aIt,hIt,uIt=t("fu",(LRt=Ta("cc.RigidBody"),NRt=Ea(-1),FRt=eh(ZRt.PhysicsGroup),kRt=eh(SEt),LRt(VRt=Ca(VRt=NRt(((QRt=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=URt&&URt(),e._type=zRt&&zRt(),e._mass=HRt&&HRt(),e._allowSleep=WRt&&WRt(),e._linearDamping=jRt&&jRt(),e._angularDamping=XRt&&XRt(),e._useGravity=YRt&&YRt(),e._linearFactor=qRt&&qRt(),e._angularFactor=KRt&&KRt(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){GDt.runInEditor&&(this._body=HDt(GDt.wrapper.RigidBody,VDt.RigidBody)?jDt:new GDt.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){mn.copy(this._linearFactor,t),this._body&&this._body.setLinearFactor(this._linearFactor)}},{key:"angularFactor",get:function(){return this._angularFactor},set:function(t){mn.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 this._type===SEt.STATIC},set:function(t){t&&this.isStatic||!t&&!this.isStatic||(this.type=t?SEt.STATIC:SEt.DYNAMIC)}},{key:"isDynamic",get:function(){return this._type===SEt.DYNAMIC},set:function(t){t&&this.isDynamic||!t&&!this.isDynamic||(this.type=t?SEt.DYNAMIC:SEt.KINEMATIC)}},{key:"isKinematic",get:function(){return this._type===SEt.KINEMATIC},set:function(t){t&&this.isKinematic||!t&&!this.isKinematic||(this.type=t?SEt.KINEMATIC:SEt.DYNAMIC)}},{key:"body",get:function(){return this._body}},{key:"_isInitialized",get:function(){var t=null===this._body;return t&&z("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(Lp)).Type=SEt,m((GRt=QRt).prototype,"group",[FRt],Object.getOwnPropertyDescriptor(GRt.prototype,"group"),GRt.prototype),m(GRt.prototype,"type",[kRt],Object.getOwnPropertyDescriptor(GRt.prototype,"type"),GRt.prototype),URt=fa(GRt.prototype,"_group",[Ma],(function(){return ZRt.PhysicsGroup.DEFAULT})),zRt=fa(GRt.prototype,"_type",[Ma],(function(){return SEt.DYNAMIC})),HRt=fa(GRt.prototype,"_mass",[Ma],(function(){return 1})),WRt=fa(GRt.prototype,"_allowSleep",[Ma],(function(){return!0})),jRt=fa(GRt.prototype,"_linearDamping",[Ma],(function(){return.1})),XRt=fa(GRt.prototype,"_angularDamping",[Ma],(function(){return.1})),YRt=fa(GRt.prototype,"_useGravity",[Ma],(function(){return!0})),qRt=fa(GRt.prototype,"_linearFactor",[Ma],(function(){return new mn(1,1,1)})),KRt=fa(GRt.prototype,"_angularFactor",[Ma],(function(){return new mn(1,1,1)})),VRt=GRt))||VRt)||VRt)||VRt));uIt||t("fu",uIt={});var lIt,cIt,_It,fIt,dIt,pIt=t("fA",(JRt=Ta("cc.Collider"),$Rt=eh(uIt),tIt=eh(PRt),eIt=eh(mn),iIt=eh(PRt),JRt(((hIt=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=sIt&&sIt(),i._isTrigger=oIt&&oIt(),i._center=aIt&&aIt(),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(){GDt.runInEditor&&(this.sharedMaterial=this._material,this._shape=function(t){return XDt.INITED||(XDt.INITED=!0,XDt[EEt.BOX]=function(){return HDt(GDt.wrapper.BoxShape,VDt.BoxCollider)?YDt:new GDt.wrapper.BoxShape},XDt[EEt.SPHERE]=function(){return HDt(GDt.wrapper.SphereShape,VDt.SphereCollider)?YDt:new GDt.wrapper.SphereShape},XDt[EEt.CAPSULE]=function(){return HDt(GDt.wrapper.CapsuleShape,VDt.CapsuleCollider)?YDt:new GDt.wrapper.CapsuleShape},XDt[EEt.CYLINDER]=function(){return HDt(GDt.wrapper.CylinderShape,VDt.CylinderCollider)?YDt:new GDt.wrapper.CylinderShape},XDt[EEt.CONE]=function(){return HDt(GDt.wrapper.ConeShape,VDt.ConeCollider)?YDt:new GDt.wrapper.ConeShape},XDt[EEt.MESH]=function(){return HDt(GDt.wrapper.TrimeshShape,VDt.MeshCollider)?YDt:new GDt.wrapper.TrimeshShape},XDt[EEt.TERRAIN]=function(){return HDt(GDt.wrapper.TerrainShape,VDt.TerrainCollider)?YDt:new GDt.wrapper.TerrainShape},XDt[EEt.SIMPLEX]=function(){return HDt(GDt.wrapper.SimplexShape,VDt.SimplexCollider)?YDt:new GDt.wrapper.SimplexShape},XDt[EEt.PLANE]=function(){return HDt(GDt.wrapper.PlaneShape,VDt.PlaneCollider)?YDt:new GDt.wrapper.PlaneShape}),XDt[t]()}(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(PRt.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(uIt))&&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(PRt.EVENT_UPDATE,this._updateMaterial,this),this._material=this._material.clone(),this._material.on(PRt.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(PRt.EVENT_UPDATE,this._updateMaterial,this),t.on(PRt.EVENT_UPDATE,this._updateMaterial,this),this._isSharedMaterial=!1,this._material=t):t&&!this._material?(t.on(PRt.EVENT_UPDATE,this._updateMaterial,this),this._material=t):!t&&this._material&&(this._material.off(PRt.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){mn.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 Ko),this._shape&&this._shape.getAABB(this._aabb),this._aabb}},{key:"boundingSphere",get:function(){return null==this._boundingSphere&&(this._boundingSphere=new Dr),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&&z("[Physics]: This component has not been call onLoad yet, please make sure the node has been added to the scene."),!t}}]),e}(uo(Lp))).Type=EEt,hIt.Axis=AEt,m((rIt=hIt).prototype,"attachedRigidBody",[$Rt],Object.getOwnPropertyDescriptor(rIt.prototype,"attachedRigidBody"),rIt.prototype),m(rIt.prototype,"sharedMaterial",[tIt],Object.getOwnPropertyDescriptor(rIt.prototype,"sharedMaterial"),rIt.prototype),m(rIt.prototype,"center",[eIt],Object.getOwnPropertyDescriptor(rIt.prototype,"center"),rIt.prototype),sIt=fa(rIt.prototype,"_material",[iIt],(function(){return null})),oIt=fa(rIt.prototype,"_isTrigger",[Ma],(function(){return!1})),aIt=fa(rIt.prototype,"_center",[Ma],(function(){return new mn})),nIt=rIt))||nIt));pIt||t("fA",pIt={});var mIt,gIt,yIt,vIt,SIt,AIt,TIt,bIt,EIt,CIt,xIt,wIt,DIt,RIt,IIt,MIt,PIt,BIt,OIt,LIt,NIt,FIt,kIt,VIt,GIt,UIt,zIt,HIt,WIt,jIt,XIt,YIt,qIt,KIt,QIt,ZIt,JIt,$It,tMt,eMt,iMt,nMt,rMt,sMt,oMt,aMt,hMt,uMt,lMt,cMt,_Mt,fMt,dMt,pMt,mMt,gMt,yMt,vMt,SMt,AMt,TMt,bMt,EMt,CMt,xMt,wMt,DMt=t("fB",(lIt=Ta("cc.BoxCollider"),cIt=eh(mn),lIt((m((fIt=function(t){function e(){var e;return(e=t.call(this,EEt.BOX)||this)._size=dIt&&dIt(),e}return s(e,t),n(e,[{key:"size",get:function(){return this._size},set:function(t){mn.strictEquals(this._size,t)||(mn.copy(this._size,t),Jq(this._size),this._shape&&this.shape.updateSize())}},{key:"shape",get:function(){return this._shape}}]),e}(pIt)).prototype,"size",[cIt],Object.getOwnPropertyDescriptor(fIt.prototype,"size"),fIt.prototype),dIt=fa(fIt.prototype,"_size",[Ma],(function(){return new mn(1,1,1)})),_It=fIt))||_It)),RMt=t("fC",Ta("cc.SphereCollider")((gIt=function(t){function e(){var e;return(e=t.call(this,EEt.SPHERE)||this)._radius=yIt&&yIt(),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}(pIt),yIt=fa(gIt.prototype,"_radius",[Ma],(function(){return.5})),mIt=gIt))||mIt),IMt=t("fD",(vIt=Ta("cc.CapsuleCollider"),SIt=eh(AEt),vIt((m((TIt=function(t){function e(){var e;return(e=t.call(this,EEt.CAPSULE)||this)._radius=bIt&&bIt(),e._cylinderHeight=EIt&&EIt(),e._direction=CIt&&CIt(),e}s(e,t);var i=e.prototype;return i._getRadiusScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return this._direction===AEt.Y_AXIS?Math.abs($i(t.x,t.z)):this._direction===AEt.X_AXIS?Math.abs($i(t.y,t.z)):Math.abs($i(t.x,t.y))},i._getHeightScale=function(){if(null==this.node)return 1;var t=this.node.worldScale;return this._direction===AEt.Y_AXIS?Math.abs(t.y):this._direction===AEt.X_AXIS?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))<AEt.X_AXIS||t>AEt.Z_AXIS||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}(pIt)).prototype,"direction",[SIt],Object.getOwnPropertyDescriptor(TIt.prototype,"direction"),TIt.prototype),bIt=fa(TIt.prototype,"_radius",[Ma],(function(){return.5})),EIt=fa(TIt.prototype,"_cylinderHeight",[Ma],(function(){return 1})),CIt=fa(TIt.prototype,"_direction",[Ma],(function(){return AEt.Y_AXIS})),AIt=TIt))||AIt)),MMt=t("fF",(xIt=Ta("cc.CylinderCollider"),wIt=eh(AEt),xIt((m((RIt=function(t){function e(){var e;return(e=t.call(this,EEt.CYLINDER)||this)._radius=IIt&&IIt(),e._height=MIt&&MIt(),e._direction=PIt&&PIt(),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<AEt.X_AXIS||t>AEt.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(pIt)).prototype,"direction",[wIt],Object.getOwnPropertyDescriptor(RIt.prototype,"direction"),RIt.prototype),IIt=fa(RIt.prototype,"_radius",[Ma],(function(){return.5})),MIt=fa(RIt.prototype,"_height",[Ma],(function(){return 2})),PIt=fa(RIt.prototype,"_direction",[Ma],(function(){return AEt.Y_AXIS})),DIt=RIt))||DIt)),PMt=t("fG",(BIt=Ta("cc.ConeCollider"),OIt=eh(AEt),BIt((m((NIt=function(t){function e(){var e;return(e=t.call(this,EEt.CONE)||this)._radius=FIt&&FIt(),e._height=kIt&&kIt(),e._direction=VIt&&VIt(),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<AEt.X_AXIS||t>AEt.Z_AXIS||(this._direction=t,this._shape&&this.shape.setDirection(t)))}},{key:"shape",get:function(){return this._shape}}]),e}(pIt)).prototype,"direction",[OIt],Object.getOwnPropertyDescriptor(NIt.prototype,"direction"),NIt.prototype),FIt=fa(NIt.prototype,"_radius",[Ma],(function(){return.5})),kIt=fa(NIt.prototype,"_height",[Ma],(function(){return 1})),VIt=fa(NIt.prototype,"_direction",[Ma],(function(){return AEt.Y_AXIS})),LIt=NIt))||LIt)),BMt=t("fE",(GIt=Ta("cc.MeshCollider"),UIt=eh(rP),GIt((m((HIt=function(t){function e(){var e;return(e=t.call(this,EEt.MESH)||this)._mesh=WIt&&WIt(),e._convex=jIt&&jIt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(uIt);e&&e.isValid&&e.type===SEt.DYNAMIC&&!this.convex&&$(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}(pIt)).prototype,"mesh",[UIt],Object.getOwnPropertyDescriptor(HIt.prototype,"mesh"),HIt.prototype),WIt=fa(HIt.prototype,"_mesh",[Ma],(function(){return null})),jIt=fa(HIt.prototype,"_convex",[Ma],(function(){return!1})),zIt=HIt))||zIt)),OMt=t("fw",Ta("cc.ConstantForce")(XIt=ba(uIt)(XIt=Ca((YIt=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=qIt&&qIt(),e._localForce=KIt&&KIt(),e._torque=QIt&&QIt(),e._localTorque=ZIt&&ZIt(),e._mask=0,e}s(e,t);var i=e.prototype;return i.onLoad=function(){this._rigidBody=this.node.getComponent(uIt),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(mn.ZERO)?this._mask&=~e:this._mask|=e},n(e,[{key:"force",get:function(){return this._force},set:function(t){mn.copy(this._force,t),this._maskUpdate(this._force,1)}},{key:"localForce",get:function(){return this._localForce},set:function(t){mn.copy(this._localForce,t),this._maskUpdate(this.localForce,2)}},{key:"torque",get:function(){return this._torque},set:function(t){mn.copy(this._torque,t),this._maskUpdate(this._torque,4)}},{key:"localTorque",get:function(){return this._localTorque},set:function(t){mn.copy(this._localTorque,t),this._maskUpdate(this._localTorque,8)}}]),e}(Lp),qIt=fa(YIt.prototype,"_force",[Ma],(function(){return new mn})),KIt=fa(YIt.prototype,"_localForce",[Ma],(function(){return new mn})),QIt=fa(YIt.prototype,"_torque",[Ma],(function(){return new mn})),ZIt=fa(YIt.prototype,"_localTorque",[Ma],(function(){return new mn})),XIt=YIt))||XIt)||XIt)||XIt),LMt=(t("g8",4),t("g9",4)),NMt=t("ga",256),FMt=t("gb",32),kMt=t("gc",33),VMt=t("gd",8),GMt=t("ge",32768),UMt=t("gf",1/128),zMt=t("gg",1/512),HMt=t("gh",-GMt*UMt),WMt=t("gi",(65535-GMt)*UMt),jMt=(t("gj",0),t("gk",1),t("gl",2),t("gm",3),t("gn",16842753)),XMt=t("go",16842754),YMt=t("gp",16842755),qMt=t("gq",16842756),KMt=t("gr",16842757),QMt=t("gs",16842758),ZMt=t("gt",16842759),JMt=t("gu",16842760),$Mt=t("gv",16843025),tPt=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}(),ePt=t("gw",Ta("cc.TerrainLayerInfo")(($It=function(){this.slot=tMt&&tMt(),this.tileSize=eMt&&eMt(),this.detailMap=iMt&&iMt(),this.normalMap=nMt&&nMt(),this.roughness=rMt&&rMt(),this.metallic=sMt&&sMt()},tMt=fa($It.prototype,"slot",[Ma],(function(){return 0})),eMt=fa($It.prototype,"tileSize",[Ma],(function(){return 1})),iMt=fa($It.prototype,"detailMap",[Ma],(function(){return null})),nMt=fa($It.prototype,"normalMap",[Ma],(function(){return null})),rMt=fa($It.prototype,"roughness",[Ma],(function(){return 1})),sMt=fa($It.prototype,"metallic",[Ma],(function(){return 0})),JIt=$It))||JIt),iPt=t("gx",Ta("cc.TerrainLayerBinaryInfo")(oMt=function(){this.slot=0,this.tileSize=1,this.roughness=1,this.metallic=0,this.detailMapId="",this.normalMapId=""})||oMt),nPt=t("gy",Ta("cc.TerrainAsset")((hMt=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=uMt&&uMt(),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]*FMt+1;return(this._heights[e*i+t]-GMt)*UMt},i.getVertexCountI=function(){return this._blockCount.length<1?0:this._blockCount[0]*FMt+1},i.getVertexCountJ=function(){return this._blockCount.length<2?0:this._blockCount[1]*FMt+1},i._setNativeData=function(t){this._data=t},i._loadNativeData=function(t){if(!t||0===t.length)return!1;var e=new tPt;if(e.assign(t),this._version=e.readInt(),this._version===$Mt)return!0;if(this._version!==jMt&&this._version!==XMt&&this._version!==YMt&&this._version!==qMt&&this._version!==KMt&&this._version!==QMt&&this._version!==ZMt&&this._version!==JMt)return!1;this._version>=ZMt?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<JMt)for(var r=0;r<this.heights.length;++r){var s=(this._heights[r]-GMt)*zMt,o=GMt+s/UMt;this.heights[r]=o}if(this._version>=QMt){var a=e.readInt();this.normals=new Float32Array(a);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>=XMt){var c=e.readInt();this.layerBuffer=new Array(c);for(var _=0;_<this.layerBuffer.length;++_)this.layerBuffer[_]=e.readInt16()}if(this._version>=YMt){var f=e.readInt();this._layerBinaryInfos=new Array(f);for(var d=0;d<this._layerBinaryInfos.length;++d)this._layerBinaryInfos[d]=new iPt,this._layerBinaryInfos[d].slot=e.readInt(),this._version>=ZMt?this._layerBinaryInfos[d].tileSize=e.readDouble():this._layerBinaryInfos[d].tileSize=e.readFloat(),this._layerBinaryInfos[d].detailMapId=e.readString(),this._version>=qMt&&(this._layerBinaryInfos[d].normalMapId=e.readString(),this._version>=ZMt?(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 tPt;t.writeInt32(JMt),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 o=0;o<s.length;++o){var a=this.layerInfos[o],h=new iPt;h.slot=o,h.tileSize=a.tileSize,h.detailMapId=a.detailMap?a.detailMap._uuid:"",h.normalMapId=a.normalMap?a.normalMap._uuid:"",h.metallic=a.metallic,h.roughness=a.roughness,s[o]=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 tPt;return t.writeInt32($Mt),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}(Fd),uMt=fa(hMt.prototype,"_layerInfos",[Ma],(function(){return[]})),aMt=hMt))||aMt),rPt=t("fH",(lMt=Ta("cc.TerrainCollider"),cMt=eh(nPt),lMt((m((fMt=function(t){function e(){var e;return(e=t.call(this,EEt.TERRAIN)||this)._terrain=dMt&&dMt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(uIt);e&&e.isValid&&e.type===SEt.DYNAMIC&&$(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}(pIt)).prototype,"terrain",[cMt],Object.getOwnPropertyDescriptor(fMt.prototype,"terrain"),fMt.prototype),dMt=fa(fMt.prototype,"_terrain",[Ma],(function(){return null})),_Mt=fMt))||_Mt)),sPt=t("fI",(pMt=Ta("cc.SimplexCollider"),mMt=eh(bEt),pMt(((AMt=function(t){function e(){var e;return(e=t.call(this,EEt.SIMPLEX)||this)._shapeType=vMt&&vMt(),e._vertices=SMt&&SMt(),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){mn.copy(this._vertices[0],t),this.updateVertices()}},{key:"vertex1",get:function(){return this._vertices[1]},set:function(t){mn.copy(this._vertices[1],t),this.updateVertices()}},{key:"vertex2",get:function(){return this._vertices[2]},set:function(t){mn.copy(this._vertices[2],t),this.updateVertices()}},{key:"vertex3",get:function(){return this._vertices[3]},set:function(t){mn.copy(this._vertices[3],t),this.updateVertices()}},{key:"shape",get:function(){return this._shape}},{key:"vertices",get:function(){return this._vertices}}]),e}(pIt)).ESimplexType=bEt,m((yMt=AMt).prototype,"shapeType",[mMt],Object.getOwnPropertyDescriptor(yMt.prototype,"shapeType"),yMt.prototype),vMt=fa(yMt.prototype,"_shapeType",[Ma],(function(){return bEt.TETRAHEDRON})),SMt=fa(yMt.prototype,"_vertices",[Ma],(function(){return[new mn(0,0,0),new mn(0,0,1),new mn(1,0,0),new mn(0,1,0)]})),gMt=yMt))||gMt));sPt||t("fI",sPt={});var oPt,aPt,hPt,uPt,lPt,cPt,_Pt,fPt,dPt,pPt,mPt,gPt,yPt,vPt,SPt,APt,TPt,bPt,EPt,CPt,xPt,wPt,DPt,RPt,IPt,MPt,PPt,BPt,OPt,LPt,NPt,FPt,kPt,VPt,GPt,UPt,zPt,HPt,WPt,jPt,XPt,YPt,qPt,KPt,QPt,ZPt,JPt,$Pt,tBt,eBt,iBt,nBt,rBt,sBt,oBt,aBt,hBt=t("fJ",(TMt=Ta("cc.PlaneCollider"),bMt=eh(mn),TMt((m((CMt=function(t){function e(){var e;return(e=t.call(this,EEt.PLANE)||this)._normal=xMt&&xMt(),e._constant=wMt&&wMt(),e}return s(e,t),e.prototype.onEnable=function(){if(t.prototype.onEnable.call(this),this.node){var e=this.node.getComponent(uIt);e&&e.isValid&&e.type===SEt.DYNAMIC&&$(9630,this.node.name)}},n(e,[{key:"normal",get:function(){return this._normal},set:function(t){mn.strictEquals(this._normal,t)||(mn.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}(pIt)).prototype,"normal",[bMt],Object.getOwnPropertyDescriptor(CMt.prototype,"normal"),CMt.prototype),xMt=fa(CMt.prototype,"_normal",[Ma],(function(){return new mn(0,1,0)})),wMt=fa(CMt.prototype,"_constant",[Ma],(function(){return 0})),EMt=CMt))||EMt)),uBt=t("fK",(oPt=Ta("cc.Constraint"),aPt=ba(uIt),hPt=eh(uIt),uPt=eh(uIt),lPt=eh(uIt),oPt(cPt=aPt(((pPt=function(t){function e(e){var i;return(i=t.call(this)||this).TYPE=void 0,i._enableCollision=fPt&&fPt(),i._connectedBody=dPt&&dPt(),i._constraint=null,i.TYPE=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){GDt.runInEditor&&(this._constraint=function(t){return qDt.INITED||(qDt.INITED=!0,qDt[CEt.POINT_TO_POINT]=function(){return HDt(GDt.wrapper.PointToPointConstraint,VDt.PointToPointConstraint)?KDt:new GDt.wrapper.PointToPointConstraint},qDt[CEt.HINGE]=function(){return HDt(GDt.wrapper.HingeConstraint,VDt.HingeConstraint)?KDt:new GDt.wrapper.HingeConstraint},qDt[CEt.FIXED]=function(){return HDt(GDt.wrapper.FixedConstraint,VDt.FixedConstraint)?KDt:new GDt.wrapper.FixedConstraint},qDt[CEt.CONFIGURABLE]=function(){return HDt(GDt.wrapper.ConfigurableConstraint,VDt.ConfigurableConstraint)?KDt:new GDt.wrapper.ConfigurableConstraint}),qDt[t]()}(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(uIt)}},{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}(uo(Lp))).Type=CEt,m((_Pt=pPt).prototype,"attachedBody",[hPt],Object.getOwnPropertyDescriptor(_Pt.prototype,"attachedBody"),_Pt.prototype),m(_Pt.prototype,"connectedBody",[uPt],Object.getOwnPropertyDescriptor(_Pt.prototype,"connectedBody"),_Pt.prototype),fPt=fa(_Pt.prototype,"_enableCollision",[Ma],(function(){return!0})),dPt=fa(_Pt.prototype,"_connectedBody",[lPt],(function(){return null})),cPt=_Pt))||cPt)||cPt));uBt||t("fK",uBt={});var lBt,cBt,_Bt,fBt,dBt,pBt,mBt,gBt,yBt,vBt,SBt,ABt,TBt,bBt,EBt,CBt,xBt,wBt,DBt,RBt,IBt,MBt,PBt,BBt,OBt,LBt,NBt,FBt,kBt,VBt,GBt,UBt,zBt,HBt,WBt,jBt,XBt,YBt,qBt,KBt,QBt,ZBt,JBt,$Bt,tOt,eOt,iOt,nOt,rOt,sOt,oOt,aOt,hOt,uOt,lOt,cOt,_Ot,fOt,dOt,pOt,mOt,gOt,yOt,vOt,SOt,AOt,TOt,bOt,EOt,COt,xOt,wOt,DOt,ROt,IOt,MOt,POt,BOt,OOt,LOt,NOt,FOt,kOt,VOt,GOt,UOt,zOt,HOt,WOt,jOt,XOt,YOt,qOt,KOt,QOt,ZOt,JOt,$Ot,tLt,eLt,iLt,nLt,rLt,sLt,oLt,aLt,hLt,uLt,lLt,cLt,_Lt,fLt,dLt,pLt,mLt,gLt,yLt,vLt,SLt,ALt,TLt,bLt,ELt,CLt,xLt,wLt,DLt,RLt,ILt,MLt,PLt,BLt,OLt,LLt,NLt,FLt,kLt,VLt,GLt,ULt,zLt,HLt,WLt=(mPt=Ta("cc.HingeLimitData"),gPt=Pa("enabled"),yPt=Pa("upperLimit"),vPt=Pa("lowerLimit"),SPt=eh(ni),APt=eh(ii),TPt=eh(ii),mPt((EPt=function(){function t(){this._enabled=CPt&&CPt(),this._upperLimit=xPt&&xPt(),this._lowerLimit=wPt&&wPt()}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}(),CPt=fa(EPt.prototype,"_enabled",[Ma,gPt],(function(){return!1})),xPt=fa(EPt.prototype,"_upperLimit",[Ma,yPt],(function(){return Number.MAX_VALUE})),wPt=fa(EPt.prototype,"_lowerLimit",[Ma,vPt],(function(){return-Number.MAX_VALUE})),m(EPt.prototype,"enabled",[SPt],Object.getOwnPropertyDescriptor(EPt.prototype,"enabled"),EPt.prototype),m(EPt.prototype,"upperLimit",[APt],Object.getOwnPropertyDescriptor(EPt.prototype,"upperLimit"),EPt.prototype),m(EPt.prototype,"lowerLimit",[TPt],Object.getOwnPropertyDescriptor(EPt.prototype,"lowerLimit"),EPt.prototype),bPt=EPt))||bPt),jLt=(DPt=Ta("cc.HingeMotorData"),RPt=Pa("enabled"),IPt=Pa("motorVelocity"),MPt=Pa("motorForceLimit"),PPt=eh(ni),BPt=eh(ii),OPt=eh(ii),DPt((NPt=function(){function t(){this._enabled=FPt&&FPt(),this._motorVelocity=kPt&&kPt(),this._motorForceLimit=VPt&&VPt()}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}(),FPt=fa(NPt.prototype,"_enabled",[Ma,RPt],(function(){return!1})),kPt=fa(NPt.prototype,"_motorVelocity",[Ma,IPt],(function(){return 0})),VPt=fa(NPt.prototype,"_motorForceLimit",[Ma,MPt],(function(){return 0})),m(NPt.prototype,"enabled",[PPt],Object.getOwnPropertyDescriptor(NPt.prototype,"enabled"),NPt.prototype),m(NPt.prototype,"motorVelocity",[BPt],Object.getOwnPropertyDescriptor(NPt.prototype,"motorVelocity"),NPt.prototype),m(NPt.prototype,"motorForceLimit",[OPt],Object.getOwnPropertyDescriptor(NPt.prototype,"motorForceLimit"),NPt.prototype),LPt=NPt))||LPt),XLt=t("fL",(GPt=Ta("cc.HingeConstraint"),UPt=eh(mn),zPt=eh(mn),HPt=eh(mn),WPt=eh(ni),jPt=eh(ii),XPt=eh(ii),YPt=eh(ni),qPt=eh(ii),KPt=eh(ii),QPt=Pa("axisA"),ZPt=Pa("pivotA"),JPt=Pa("pivotB"),$Pt=Pa("limitData"),tBt=Pa("motorData"),GPt((m((iBt=function(t){function e(){var e;return(e=t.call(this,CEt.HINGE)||this)._axis=nBt&&nBt(),e._pivotA=rBt&&rBt(),e._pivotB=sBt&&sBt(),e._limitData=oBt&&oBt(),e._motorData=aBt&&aBt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){mn.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){mn.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"axis",get:function(){return this._axis},set:function(t){mn.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}(uBt)).prototype,"pivotA",[UPt],Object.getOwnPropertyDescriptor(iBt.prototype,"pivotA"),iBt.prototype),m(iBt.prototype,"pivotB",[zPt],Object.getOwnPropertyDescriptor(iBt.prototype,"pivotB"),iBt.prototype),m(iBt.prototype,"axis",[HPt],Object.getOwnPropertyDescriptor(iBt.prototype,"axis"),iBt.prototype),m(iBt.prototype,"limitEnabled",[WPt],Object.getOwnPropertyDescriptor(iBt.prototype,"limitEnabled"),iBt.prototype),m(iBt.prototype,"upperLimit",[jPt],Object.getOwnPropertyDescriptor(iBt.prototype,"upperLimit"),iBt.prototype),m(iBt.prototype,"lowerLimit",[XPt],Object.getOwnPropertyDescriptor(iBt.prototype,"lowerLimit"),iBt.prototype),m(iBt.prototype,"motorEnabled",[YPt],Object.getOwnPropertyDescriptor(iBt.prototype,"motorEnabled"),iBt.prototype),m(iBt.prototype,"motorVelocity",[qPt],Object.getOwnPropertyDescriptor(iBt.prototype,"motorVelocity"),iBt.prototype),m(iBt.prototype,"motorForceLimit",[KPt],Object.getOwnPropertyDescriptor(iBt.prototype,"motorForceLimit"),iBt.prototype),nBt=fa(iBt.prototype,"_axis",[Ma,QPt],(function(){return new mn})),rBt=fa(iBt.prototype,"_pivotA",[Ma,ZPt],(function(){return new mn})),sBt=fa(iBt.prototype,"_pivotB",[Ma,JPt],(function(){return new mn})),oBt=fa(iBt.prototype,"_limitData",[Ma,$Pt],(function(){return new WLt})),aBt=fa(iBt.prototype,"_motorData",[Ma,tBt],(function(){return new jLt})),eBt=iBt))||eBt)),YLt=t("fN",(lBt=Ta("cc.FixedConstraint"),cBt=eh(ii),_Bt=eh(ii),fBt=Pa("breakForce"),dBt=Pa("breakTorque"),lBt((m((mBt=function(t){function e(){var e;return(e=t.call(this,CEt.FIXED)||this)._breakForce=gBt&&gBt(),e._breakTorque=yBt&&yBt(),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}(uBt)).prototype,"breakForce",[cBt],Object.getOwnPropertyDescriptor(mBt.prototype,"breakForce"),mBt.prototype),m(mBt.prototype,"breakTorque",[_Bt],Object.getOwnPropertyDescriptor(mBt.prototype,"breakTorque"),mBt.prototype),gBt=fa(mBt.prototype,"_breakForce",[Ma,fBt],(function(){return 1e8})),yBt=fa(mBt.prototype,"_breakTorque",[Ma,dBt],(function(){return 1e8})),pBt=mBt))||pBt)),qLt=(vBt=Ta("cc.LinearLimitSettings"),SBt=eh(xEt),ABt=eh(xEt),TBt=eh(xEt),bBt=eh(mn),EBt=eh(mn),CBt=eh(ii),xBt=eh(ni),wBt=eh(ii),DBt=eh(ii),vBt((m((IBt=function(){function t(t){this._xMotion=MBt&&MBt(),this._yMotion=PBt&&PBt(),this._zMotion=BBt&&BBt(),this._upper=OBt&&OBt(),this._lower=LBt&&LBt(),this._enableSoftConstraint=NBt&&NBt(),this._bounciness=FBt&&FBt(),this._stiffness=kBt&&kBt(),this._damping=VBt&&VBt(),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){mn.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){mn.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}()).prototype,"xMotion",[SBt],Object.getOwnPropertyDescriptor(IBt.prototype,"xMotion"),IBt.prototype),m(IBt.prototype,"yMotion",[ABt],Object.getOwnPropertyDescriptor(IBt.prototype,"yMotion"),IBt.prototype),m(IBt.prototype,"zMotion",[TBt],Object.getOwnPropertyDescriptor(IBt.prototype,"zMotion"),IBt.prototype),m(IBt.prototype,"upper",[bBt],Object.getOwnPropertyDescriptor(IBt.prototype,"upper"),IBt.prototype),m(IBt.prototype,"lower",[EBt],Object.getOwnPropertyDescriptor(IBt.prototype,"lower"),IBt.prototype),m(IBt.prototype,"restitution",[CBt],Object.getOwnPropertyDescriptor(IBt.prototype,"restitution"),IBt.prototype),m(IBt.prototype,"enableSoftConstraint",[xBt],Object.getOwnPropertyDescriptor(IBt.prototype,"enableSoftConstraint"),IBt.prototype),m(IBt.prototype,"stiffness",[wBt],Object.getOwnPropertyDescriptor(IBt.prototype,"stiffness"),IBt.prototype),m(IBt.prototype,"damping",[DBt],Object.getOwnPropertyDescriptor(IBt.prototype,"damping"),IBt.prototype),MBt=fa(IBt.prototype,"_xMotion",[Ma],(function(){return xEt.FREE})),PBt=fa(IBt.prototype,"_yMotion",[Ma],(function(){return xEt.FREE})),BBt=fa(IBt.prototype,"_zMotion",[Ma],(function(){return xEt.FREE})),OBt=fa(IBt.prototype,"_upper",[Ma],(function(){return new mn})),LBt=fa(IBt.prototype,"_lower",[Ma],(function(){return new mn})),NBt=fa(IBt.prototype,"_enableSoftConstraint",[Ma],(function(){return!1})),FBt=fa(IBt.prototype,"_bounciness",[Ma],(function(){return 0})),kBt=fa(IBt.prototype,"_stiffness",[Ma],(function(){return 0})),VBt=fa(IBt.prototype,"_damping",[Ma],(function(){return 0})),RBt=IBt))||RBt),KLt=(GBt=Ta("cc.AngularLimitSettings"),UBt=eh(xEt),zBt=eh(xEt),HBt=eh(xEt),WBt=eh(ii),jBt=eh(ii),XBt=eh(ii),YBt=eh(ii),qBt=eh(ii),KBt=eh(ni),QBt=eh(ii),ZBt=eh(ii),JBt=eh(ni),$Bt=eh(ii),tOt=eh(ii),GBt((m((iOt=function(){function t(t){this._swing1Motion=nOt&&nOt(),this._swing2Motion=rOt&&rOt(),this._twistMotion=sOt&&sOt(),this._twistExtent=oOt&&oOt(),this._swingExtent1=aOt&&aOt(),this._swingExtent2=hOt&&hOt(),this._enableSoftConstraintSwing=uOt&&uOt(),this._swingBounciness=lOt&&lOt(),this._swingStiffness=cOt&&cOt(),this._swingDamping=_Ot&&_Ot(),this._enableSoftConstraintTwist=fOt&&fOt(),this._twistBounciness=dOt&&dOt(),this._twistStiffness=pOt&&pOt(),this._twistDamping=mOt&&mOt(),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}()).prototype,"twistMotion",[UBt],Object.getOwnPropertyDescriptor(iOt.prototype,"twistMotion"),iOt.prototype),m(iOt.prototype,"swingMotion1",[zBt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingMotion1"),iOt.prototype),m(iOt.prototype,"swingMotion2",[HBt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingMotion2"),iOt.prototype),m(iOt.prototype,"twistExtent",[WBt],Object.getOwnPropertyDescriptor(iOt.prototype,"twistExtent"),iOt.prototype),m(iOt.prototype,"swingExtent1",[jBt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingExtent1"),iOt.prototype),m(iOt.prototype,"swingExtent2",[XBt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingExtent2"),iOt.prototype),m(iOt.prototype,"twistRestitution",[YBt],Object.getOwnPropertyDescriptor(iOt.prototype,"twistRestitution"),iOt.prototype),m(iOt.prototype,"swingRestitution",[qBt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingRestitution"),iOt.prototype),m(iOt.prototype,"enableSoftConstraintTwist",[KBt],Object.getOwnPropertyDescriptor(iOt.prototype,"enableSoftConstraintTwist"),iOt.prototype),m(iOt.prototype,"twistStiffness",[QBt],Object.getOwnPropertyDescriptor(iOt.prototype,"twistStiffness"),iOt.prototype),m(iOt.prototype,"twistDamping",[ZBt],Object.getOwnPropertyDescriptor(iOt.prototype,"twistDamping"),iOt.prototype),m(iOt.prototype,"enableSoftConstraintSwing",[JBt],Object.getOwnPropertyDescriptor(iOt.prototype,"enableSoftConstraintSwing"),iOt.prototype),m(iOt.prototype,"swingStiffness",[$Bt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingStiffness"),iOt.prototype),m(iOt.prototype,"swingDamping",[tOt],Object.getOwnPropertyDescriptor(iOt.prototype,"swingDamping"),iOt.prototype),nOt=fa(iOt.prototype,"_swing1Motion",[Ma],(function(){return xEt.FREE})),rOt=fa(iOt.prototype,"_swing2Motion",[Ma],(function(){return xEt.FREE})),sOt=fa(iOt.prototype,"_twistMotion",[Ma],(function(){return xEt.FREE})),oOt=fa(iOt.prototype,"_twistExtent",[Ma],(function(){return 0})),aOt=fa(iOt.prototype,"_swingExtent1",[Ma],(function(){return 0})),hOt=fa(iOt.prototype,"_swingExtent2",[Ma],(function(){return 0})),uOt=fa(iOt.prototype,"_enableSoftConstraintSwing",[Ma],(function(){return!1})),lOt=fa(iOt.prototype,"_swingBounciness",[Ma],(function(){return 0})),cOt=fa(iOt.prototype,"_swingStiffness",[Ma],(function(){return 0})),_Ot=fa(iOt.prototype,"_swingDamping",[Ma],(function(){return 0})),fOt=fa(iOt.prototype,"_enableSoftConstraintTwist",[Ma],(function(){return!1})),dOt=fa(iOt.prototype,"_twistBounciness",[Ma],(function(){return 0})),pOt=fa(iOt.prototype,"_twistStiffness",[Ma],(function(){return 0})),mOt=fa(iOt.prototype,"_twistDamping",[Ma],(function(){return 0})),eOt=iOt))||eOt),QLt=(gOt=Ta("cc.LinearDriverSettings"),yOt=eh(wEt),vOt=eh(wEt),SOt=eh(wEt),AOt=eh(mn),TOt=eh(mn),bOt=eh(ii),gOt((m((COt=function(){function t(t){this._target=xOt&&xOt(),this._velocity=wOt&&wOt(),this._xDrive=DOt&&DOt(),this._yDrive=ROt&&ROt(),this._zDrive=IOt&&IOt(),this._strength=MOt&&MOt(),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){mn.copy(this._target,t),this._impl.setLinearMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._velocity},set:function(t){mn.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}()).prototype,"xDrive",[yOt],Object.getOwnPropertyDescriptor(COt.prototype,"xDrive"),COt.prototype),m(COt.prototype,"yDrive",[vOt],Object.getOwnPropertyDescriptor(COt.prototype,"yDrive"),COt.prototype),m(COt.prototype,"zDrive",[SOt],Object.getOwnPropertyDescriptor(COt.prototype,"zDrive"),COt.prototype),m(COt.prototype,"targetPosition",[AOt],Object.getOwnPropertyDescriptor(COt.prototype,"targetPosition"),COt.prototype),m(COt.prototype,"targetVelocity",[TOt],Object.getOwnPropertyDescriptor(COt.prototype,"targetVelocity"),COt.prototype),m(COt.prototype,"strength",[bOt],Object.getOwnPropertyDescriptor(COt.prototype,"strength"),COt.prototype),xOt=fa(COt.prototype,"_target",[Ma],(function(){return new mn})),wOt=fa(COt.prototype,"_velocity",[Ma],(function(){return new mn})),DOt=fa(COt.prototype,"_xDrive",[Ma],(function(){return wEt.DISABLED})),ROt=fa(COt.prototype,"_yDrive",[Ma],(function(){return wEt.DISABLED})),IOt=fa(COt.prototype,"_zDrive",[Ma],(function(){return wEt.DISABLED})),MOt=fa(COt.prototype,"_strength",[Ma],(function(){return 0})),EOt=COt))||EOt),ZLt=(POt=Ta("cc.AngularDriverSettings"),BOt=eh(wEt),OOt=eh(wEt),LOt=eh(wEt),NOt=eh(mn),FOt=eh(mn),kOt=eh(ii),POt((m((GOt=function(){function t(t){this._swingDrive1=UOt&&UOt(),this._swingDrive2=zOt&&zOt(),this._twistDrive=HOt&&HOt(),this._targetOrientation=WOt&&WOt(),this._targetVelocity=jOt&&jOt(),this._strength=XOt&&XOt(),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){mn.copy(this._targetOrientation,t),this._impl.setAngularMotorTarget(t)}},{key:"targetVelocity",get:function(){return this._targetVelocity},set:function(t){mn.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}()).prototype,"twistDrive",[BOt],Object.getOwnPropertyDescriptor(GOt.prototype,"twistDrive"),GOt.prototype),m(GOt.prototype,"swingDrive1",[OOt],Object.getOwnPropertyDescriptor(GOt.prototype,"swingDrive1"),GOt.prototype),m(GOt.prototype,"swingDrive2",[LOt],Object.getOwnPropertyDescriptor(GOt.prototype,"swingDrive2"),GOt.prototype),m(GOt.prototype,"targetOrientation",[NOt],Object.getOwnPropertyDescriptor(GOt.prototype,"targetOrientation"),GOt.prototype),m(GOt.prototype,"targetVelocity",[FOt],Object.getOwnPropertyDescriptor(GOt.prototype,"targetVelocity"),GOt.prototype),m(GOt.prototype,"strength",[kOt],Object.getOwnPropertyDescriptor(GOt.prototype,"strength"),GOt.prototype),UOt=fa(GOt.prototype,"_swingDrive1",[Ma],(function(){return wEt.DISABLED})),zOt=fa(GOt.prototype,"_swingDrive2",[Ma],(function(){return wEt.DISABLED})),HOt=fa(GOt.prototype,"_twistDrive",[Ma],(function(){return wEt.DISABLED})),WOt=fa(GOt.prototype,"_targetOrientation",[Ma],(function(){return new mn})),jOt=fa(GOt.prototype,"_targetVelocity",[Ma],(function(){return new mn})),XOt=fa(GOt.prototype,"_strength",[Ma],(function(){return 0})),VOt=GOt))||VOt),JLt=t("fM",(YOt=Ta("cc.ConfigurableConstraint"),qOt=eh(mn),KOt=eh(mn),QOt=eh(mn),ZOt=eh(mn),JOt=eh(ni),$Ot=eh(ii),tLt=eh(ii),eLt=eh(qLt),iLt=eh(KLt),nLt=eh(QLt),rLt=eh(ZLt),sLt=Pa("linearLimitSettings"),oLt=Pa("angularLimitSettings"),aLt=Pa("linearDriverSettings"),hLt=Pa("angularDriverSettings"),YOt((m((lLt=function(t){function e(){var e;return(e=t.call(this,CEt.CONFIGURABLE)||this)._breakForce=cLt&&cLt(),e._breakTorque=_Lt&&_Lt(),e._linearLimitSettings=fLt&&fLt(),e._angularLimitSettings=dLt&&dLt(),e._linearDriverSettings=pLt&&pLt(),e._angularDriverSettings=mLt&&mLt(),e._pivotA=gLt&&gLt(),e._pivotB=yLt&&yLt(),e._autoPivotB=vLt&&vLt(),e._axis=SLt&&SLt(),e._secondaryAxis=ALt&&ALt(),e._linearLimitSettings=new qLt(e.constraint),e._angularLimitSettings=new KLt(e.constraint),e._linearDriverSettings=new QLt(e.constraint),e._angularDriverSettings=new ZLt(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){mn.copy(this._axis,t),this.constraint.setAxis(this._axis)}},{key:"secondaryAxis",get:function(){return this._secondaryAxis},set:function(t){mn.copy(this._secondaryAxis,t),this.constraint.setSecondaryAxis(this._secondaryAxis)}},{key:"pivotA",get:function(){return this._pivotA},set:function(t){mn.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){mn.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}(uBt)).prototype,"axis",[qOt],Object.getOwnPropertyDescriptor(lLt.prototype,"axis"),lLt.prototype),m(lLt.prototype,"secondaryAxis",[KOt],Object.getOwnPropertyDescriptor(lLt.prototype,"secondaryAxis"),lLt.prototype),m(lLt.prototype,"pivotA",[QOt],Object.getOwnPropertyDescriptor(lLt.prototype,"pivotA"),lLt.prototype),m(lLt.prototype,"pivotB",[ZOt],Object.getOwnPropertyDescriptor(lLt.prototype,"pivotB"),lLt.prototype),m(lLt.prototype,"autoPivotB",[JOt],Object.getOwnPropertyDescriptor(lLt.prototype,"autoPivotB"),lLt.prototype),m(lLt.prototype,"breakForce",[$Ot],Object.getOwnPropertyDescriptor(lLt.prototype,"breakForce"),lLt.prototype),m(lLt.prototype,"breakTorque",[tLt],Object.getOwnPropertyDescriptor(lLt.prototype,"breakTorque"),lLt.prototype),m(lLt.prototype,"linearLimitSettings",[eLt],Object.getOwnPropertyDescriptor(lLt.prototype,"linearLimitSettings"),lLt.prototype),m(lLt.prototype,"angularLimitSettings",[iLt],Object.getOwnPropertyDescriptor(lLt.prototype,"angularLimitSettings"),lLt.prototype),m(lLt.prototype,"linearDriverSettings",[nLt],Object.getOwnPropertyDescriptor(lLt.prototype,"linearDriverSettings"),lLt.prototype),m(lLt.prototype,"angularDriverSettings",[rLt],Object.getOwnPropertyDescriptor(lLt.prototype,"angularDriverSettings"),lLt.prototype),cLt=fa(lLt.prototype,"_breakForce",[Ma],(function(){return 1e8})),_Lt=fa(lLt.prototype,"_breakTorque",[Ma],(function(){return 1e8})),fLt=fa(lLt.prototype,"_linearLimitSettings",[Ma,sLt],null),dLt=fa(lLt.prototype,"_angularLimitSettings",[Ma,oLt],null),pLt=fa(lLt.prototype,"_linearDriverSettings",[Ma,aLt],null),mLt=fa(lLt.prototype,"_angularDriverSettings",[Ma,hLt],null),gLt=fa(lLt.prototype,"_pivotA",[Ma],(function(){return new mn})),yLt=fa(lLt.prototype,"_pivotB",[Ma],(function(){return new mn})),vLt=fa(lLt.prototype,"_autoPivotB",[Ma],(function(){return!1})),SLt=fa(lLt.prototype,"_axis",[Ma],(function(){return new mn(0,1,0)})),ALt=fa(lLt.prototype,"_secondaryAxis",[Ma],(function(){return new mn(1,0,0)})),uLt=lLt))||uLt)),$Lt=t("fO",(TLt=Ta("cc.PointToPointConstraint"),bLt=eh(mn),ELt=eh(mn),TLt((m((xLt=function(t){function e(){var e;return(e=t.call(this,CEt.POINT_TO_POINT)||this)._pivotA=wLt&&wLt(),e._pivotB=DLt&&DLt(),e}return s(e,t),n(e,[{key:"pivotA",get:function(){return this._pivotA},set:function(t){mn.copy(this._pivotA,t),this.constraint.setPivotA(this._pivotA)}},{key:"pivotB",get:function(){return this._pivotB},set:function(t){mn.copy(this._pivotB,t),this.constraint.setPivotB(this._pivotB)}},{key:"constraint",get:function(){return this._constraint}}]),e}(uBt)).prototype,"pivotA",[bLt],Object.getOwnPropertyDescriptor(xLt.prototype,"pivotA"),xLt.prototype),m(xLt.prototype,"pivotB",[ELt],Object.getOwnPropertyDescriptor(xLt.prototype,"pivotB"),xLt.prototype),wLt=fa(xLt.prototype,"_pivotA",[Ma],(function(){return new mn})),DLt=fa(xLt.prototype,"_pivotB",[Ma],(function(){return new mn})),CLt=xLt))||CLt));new mn(0,0,0),new mn(0,0,0);var tNt,eNt,iNt,nNt,rNt,sNt,oNt,aNt,hNt,uNt,lNt=t("fv",(RLt=Ta("cc.CharacterController"),ILt=eh(ZRt.PhysicsGroup),MLt=eh(ii),PLt=eh(ii),BLt=eh(ii),OLt=eh(ii),LLt=eh(mn),RLt(NLt=Ca((m((FLt=function(t){function e(e){var i;return(i=t.call(this)||this).type=void 0,i._cct=null,i._group=kLt&&kLt(),i._minMoveDistance=VLt&&VLt(),i._stepOffset=GLt&&GLt(),i._slopeLimit=ULt&&ULt(),i._skinWidth=zLt&&zLt(),i._center=HLt&&HLt(),i._initialized=!1,i._prevPos=new mn,i._currentPos=new mn,i._velocity=new mn,i._centerWorldPosition=new mn,i._needCollisionEvent=!1,i._needTriggerEvent=!1,i.type=e,i}s(e,t);var i=e.prototype;return i.onLoad=function(){GDt.runInEditor&&(this._cct=function(t){return $Dt.INITED||($Dt.INITED=!0,$Dt[DEt.BOX]=function(){return HDt(GDt.wrapper.BoxCharacterController,VDt.BoxCharacterController)?tRt:new GDt.wrapper.BoxCharacterController},$Dt[DEt.CAPSULE]=function(){return HDt(GDt.wrapper.CapsuleCharacterController,VDt.CapsuleCharacterController)?tRt:new GDt.wrapper.CapsuleCharacterController}),$Dt[t]()}(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=ZRt.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){mn.equals(this._center,t)||mn.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}(uo(Lp))).prototype,"group",[ILt],Object.getOwnPropertyDescriptor(FLt.prototype,"group"),FLt.prototype),m(FLt.prototype,"minMoveDistance",[MLt],Object.getOwnPropertyDescriptor(FLt.prototype,"minMoveDistance"),FLt.prototype),m(FLt.prototype,"stepOffset",[PLt],Object.getOwnPropertyDescriptor(FLt.prototype,"stepOffset"),FLt.prototype),m(FLt.prototype,"slopeLimit",[BLt],Object.getOwnPropertyDescriptor(FLt.prototype,"slopeLimit"),FLt.prototype),m(FLt.prototype,"skinWidth",[OLt],Object.getOwnPropertyDescriptor(FLt.prototype,"skinWidth"),FLt.prototype),m(FLt.prototype,"center",[LLt],Object.getOwnPropertyDescriptor(FLt.prototype,"center"),FLt.prototype),kLt=fa(FLt.prototype,"_group",[Ma],(function(){return ZRt.PhysicsGroup.DEFAULT})),VLt=fa(FLt.prototype,"_minMoveDistance",[Ma],(function(){return.001})),GLt=fa(FLt.prototype,"_stepOffset",[Ma],(function(){return.5})),ULt=fa(FLt.prototype,"_slopeLimit",[Ma],(function(){return 45})),zLt=fa(FLt.prototype,"_skinWidth",[Ma],(function(){return.01})),HLt=fa(FLt.prototype,"_center",[Ma],(function(){return new mn})),NLt=FLt))||NLt)||NLt));new mn(0,0,0);var cNt,_Nt,fNt,dNt,pNt,mNt,gNt,yNt,vNt=t("fQ",(tNt=Ta("cc.BoxCharacterController"),eNt=Ea(-1),iNt=eh(ii),nNt=eh(ii),rNt=eh(ii),tNt(sNt=eNt((m((oNt=function(t){function e(){var e;return(e=t.call(this,DEt.BOX)||this)._halfHeight=aNt&&aNt(),e._halfSideExtent=hNt&&hNt(),e._halfForwardExtent=uNt&&uNt(),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}(lNt)).prototype,"halfHeight",[iNt],Object.getOwnPropertyDescriptor(oNt.prototype,"halfHeight"),oNt.prototype),m(oNt.prototype,"halfSideExtent",[nNt],Object.getOwnPropertyDescriptor(oNt.prototype,"halfSideExtent"),oNt.prototype),m(oNt.prototype,"halfForwardExtent",[rNt],Object.getOwnPropertyDescriptor(oNt.prototype,"halfForwardExtent"),oNt.prototype),aNt=fa(oNt.prototype,"_halfHeight",[Ma],(function(){return.5})),hNt=fa(oNt.prototype,"_halfSideExtent",[Ma],(function(){return.5})),uNt=fa(oNt.prototype,"_halfForwardExtent",[Ma],(function(){return.5})),sNt=oNt))||sNt)||sNt));new mn(0,0,0);var SNt=t("fP",(cNt=Ta("cc.CapsuleCharacterController"),_Nt=Ea(-1),fNt=eh(ii),dNt=eh(ii),cNt(pNt=_Nt((m((mNt=function(t){function e(){var e;return(e=t.call(this,DEt.CAPSULE)||this)._radius=gNt&&gNt(),e._height=yNt&&yNt(),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}(lNt)).prototype,"radius",[fNt],Object.getOwnPropertyDescriptor(mNt.prototype,"radius"),mNt.prototype),m(mNt.prototype,"height",[dNt],Object.getOwnPropertyDescriptor(mNt.prototype,"height"),mNt.prototype),gNt=fa(mNt.prototype,"_radius",[Ma],(function(){return.5})),yNt=fa(mNt.prototype,"_height",[Ma],(function(){return 1})),pNt=mNt))||pNt)||pNt)),ANt=function(){this.worldPosition=new mn,this.worldNormal=new mn,this.motionDirection=new mn,this.motionLength=0};v.PhysicsSystem=ZRt,v.PhysicsMaterial=PRt,v.PhysicsRayResult=BRt,v.ConstantForce=OMt;var TNt,bNt,ENt,CNt,xNt,wNt=Object.freeze({__proto__:null,PhysicsSystem:ZRt,PhysicsRayResult:BRt,PhysicsLineStripCastResult:ORt,get Collider(){return pIt},BoxCollider:DMt,SphereCollider:RMt,CapsuleCollider:IMt,MeshCollider:BMt,CylinderCollider:MMt,ConeCollider:PMt,TerrainCollider:rPt,get SimplexCollider(){return sPt},PlaneCollider:hBt,get Constraint(){return uBt},HingeConstraint:XLt,FixedConstraint:YLt,PointToPointConstraint:$Lt,ConfigurableConstraint:JLt,get RigidBody(){return uIt},PhysicsMaterial:PRt,ConstantForce:OMt,CharacterController:lNt,BoxCharacterController:vNt,CapsuleCharacterController:SNt,selector:GDt,utils:bK,CharacterControllerContact:ANt,get ERigidBodyType(){return SEt},get EAxisDirection(){return AEt},get ED6Axis(){return TEt},get ESimplexType(){return bEt},get EColliderType(){return EEt},get EConstraintType(){return CEt},get EConstraintMode(){return xEt},get EDriverMode(){return wEt},get ECharacterControllerType(){return DEt},get PhysicsGroup(){return REt},get EPhysicsDrawFlags(){return IEt}});t("fs",wNt),ht(ZRt,"PhysicsSystem",[{name:"ins",newName:"instance"},{name:"PHYSICS_AMMO",newName:"PHYSICS_BULLET"}]),ht(ZRt.prototype,"PhysicsSystem.prototype",[{name:"deltaTime",newName:"fixedTimeStep"},{name:"maxSubStep",newName:"maxSubSteps"}]),ut(ZRt.prototype,"PhysicsSystem.prototype",[{name:"useFixedTime"},{name:"useCollisionMatrix"},{name:"updateCollisionMatrix"},{name:"resetCollisionMatrix"},{name:"isCollisionGroup"},{name:"setCollisionGroup"}]),ht(pIt.prototype,"Collider.prototype",[{name:"attachedRigidbody",newName:"attachedRigidBody"},{name:"TYPE",newName:"type"}]),ht(pIt,"Collider",[{name:"EColliderType",newName:"Type"},{name:"EAxisDirection",newName:"Axis"}]),ht(uBt,"Constraint",[{name:"EConstraintType",newName:"Type"}]),ht(DMt.prototype,"BoxCollider.prototype",[{name:"boxShape",newName:"shape"}]),ht(RMt.prototype,"SphereCollider.prototype",[{name:"sphereShape",newName:"shape"}]),ht(IMt.prototype,"CapsuleCollider.prototype",[{name:"capsuleShape",newName:"shape"}]),ht(uIt.prototype,"RigidBody.prototype",[{name:"rigidBody",newName:"body"}]),ht(uIt,"RigidBody",[{name:"ERigidBodyType",newName:"Type"}]),ut(uIt.prototype,"RigidBody.prototype",[{name:"fixedRotation"}]),v.RigidBodyComponent=uIt,ie(uIt,"cc.RigidBodyComponent"),v.ColliderComponent=pIt,ie(pIt,"cc.ColliderComponent"),v.BoxColliderComponent=DMt,ie(DMt,"cc.BoxColliderComponent"),v.SphereColliderComponent=RMt,ie(RMt,"cc.SphereColliderComponent"),ie(IMt,"cc.CapsuleColliderComponent"),ie(BMt,"cc.MeshColliderComponent"),ie(MMt,"cc.CylinderColliderComponent"),v.PhysicMaterial=PRt,ie(PRt,"cc.PhysicMaterial"),v.physics=wNt,function(t){t[t.BODY_RE_ADD=1]="BODY_RE_ADD",t[t.GHOST_RE_ADD=2]="GHOST_RE_ADD"}(TNt||(TNt={})),function(t){t[t.CF_STATIC_OBJECT=1]="CF_STATIC_OBJECT",t[t.CF_KINEMATIC_OBJECT=2]="CF_KINEMATIC_OBJECT",t[t.CF_NO_CONTACT_RESPONSE=4]="CF_NO_CONTACT_RESPONSE",t[t.CF_CUSTOM_MATERIAL_CALLBACK=8]="CF_CUSTOM_MATERIAL_CALLBACK",t[t.CF_CHARACTER_OBJECT=16]="CF_CHARACTER_OBJECT",t[t.CF_DISABLE_VISUALIZE_OBJECT=32]="CF_DISABLE_VISUALIZE_OBJECT",t[t.CF_DISABLE_SPU_COLLISION_PROCESSING=64]="CF_DISABLE_SPU_COLLISION_PROCESSING"}(bNt||(bNt={})),function(t){t[t.CO_COLLISION_OBJECT=1]="CO_COLLISION_OBJECT",t[t.CO_RIGID_BODY=2]="CO_RIGID_BODY",t[t.CO_GHOST_OBJECT=4]="CO_GHOST_OBJECT",t[t.CO_SOFT_BODY=8]="CO_SOFT_BODY",t[t.CO_HF_FLUID=16]="CO_HF_FLUID",t[t.CO_USER_TYPE=32]="CO_USER_TYPE",t[t.CO_FEATHERSTONE_LINK=64]="CO_FEATHERSTONE_LINK"}(ENt||(ENt={})),function(t){t[t.ACTIVE_TAG=1]="ACTIVE_TAG",t[t.ISLAND_SLEEPING=2]="ISLAND_SLEEPING",t[t.WANTS_DEACTIVATION=3]="WANTS_DEACTIVATION",t[t.DISABLE_DEACTIVATION=4]="DISABLE_DEACTIVATION",t[t.DISABLE_SIMULATION=5]="DISABLE_SIMULATION"}(CNt||(CNt={})),function(t){t[t.BT_DISABLE_WORLD_GRAVITY=1]="BT_DISABLE_WORLD_GRAVITY",t[t.BT_ENABLE_GYROPSCOPIC_FORCE=2]="BT_ENABLE_GYROPSCOPIC_FORCE"}(xNt||(xNt={}));var DNt=aRt,RNt=hRt,INt=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&&(eRt.RigidBody_setMass(this.impl,t),this._wakeUpIfSleep(),this._sharedBody.dirty|=TNt.BODY_RE_ADD)},t.setType=function(t){this._sharedBody.setType(t)},t.setLinearDamping=function(){eRt.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.setAngularDamping=function(){eRt.RigidBody_setDamping(this.impl,this._rigidBody.linearDamping,this._rigidBody.angularDamping)},t.useGravity=function(t){if(this._rigidBody.isDynamic){var e=eRt.RigidBody_getFlags(this.impl);t?e&=~xNt.BT_DISABLE_WORLD_GRAVITY:(eRt.RigidBody_setGravity(this.impl,xRt(oRt.instance.BT_V3_0,mn.ZERO)),e|=xNt.BT_DISABLE_WORLD_GRAVITY),eRt.RigidBody_setFlags(this.impl,e),this._wakeUpIfSleep(),this._sharedBody.dirty|=TNt.BODY_RE_ADD}},t.useCCD=function(t){eRt.CollisionObject_setCcdMotionThreshold(this.impl,t?.01:0),eRt.CollisionObject_setCcdSweptSphereRadius(this.impl,t?.1:0),this._isUsingCCD=t},t.isUsingCCD=function(){return this._isUsingCCD},t.setLinearFactor=function(t){eRt.RigidBody_setLinearFactor(this.impl,xRt(oRt.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAngularFactor=function(t){eRt.RigidBody_setAngularFactor(this.impl,xRt(oRt.instance.BT_V3_0,t)),this._wakeUpIfSleep()},t.setAllowSleep=function(t){this._rigidBody.isDynamic&&(t?eRt.CollisionObject_forceActivationState(this.impl,CNt.ACTIVE_TAG):eRt.CollisionObject_forceActivationState(this.impl,CNt.DISABLE_DEACTIVATION),this._wakeUpIfSleep())},t.clearState=function(){eRt.RigidBody_clearState(this.impl)},t.clearVelocity=function(){this.setLinearVelocity(mn.ZERO),this.setAngularVelocity(mn.ZERO)},t.clearForces=function(){eRt.RigidBody_clearForces(this.impl)},t.initialize=function(t){this._rigidBody=t,this._sharedBody=ZRt.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),eRt.CollisionObject_activate(this.impl,t)},t.sleep=function(){var t=eRt.CollisionObject_getActivationState(this.impl);t!==CNt.DISABLE_DEACTIVATION&&t!==CNt.DISABLE_SIMULATION&&eRt.CollisionObject_forceActivationState(this.impl,CNt.ISLAND_SLEEPING)},t.setSleepThreshold=function(t){this._wakeUpIfSleep(),eRt.RigidBody_setSleepingThresholds(this.impl,t,t)},t.getSleepThreshold=function(){return eRt.RigidBody_getLinearSleepingThreshold(this.impl)},t.getLinearVelocity=function(t){return wRt(t,eRt.RigidBody_getLinearVelocity(this.impl))},t.setLinearVelocity=function(t){this._wakeUpIfSleep(),xRt(eRt.RigidBody_getLinearVelocity(this.impl),t)},t.getAngularVelocity=function(t){return wRt(t,eRt.RigidBody_getAngularVelocity(this.impl))},t.setAngularVelocity=function(t){this._wakeUpIfSleep(),xRt(eRt.RigidBody_getAngularVelocity(this.impl),t)},t.applyLocalForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=mn.transformQuat(DNt,t,i),r=e?mn.transformQuat(RNt,e,i):mn.ZERO;eRt.RigidBody_applyForce(this.impl,xRt(oRt.instance.BT_V3_0,n),xRt(oRt.instance.BT_V3_1,r))},t.applyLocalTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),mn.transformQuat(DNt,t,this._sharedBody.node.worldRotation),eRt.RigidBody_applyTorque(this.impl,xRt(oRt.instance.BT_V3_0,DNt))},t.applyLocalImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=this._sharedBody.node.worldRotation,n=mn.transformQuat(DNt,t,i),r=e?mn.transformQuat(RNt,e,i):mn.ZERO;eRt.RigidBody_applyImpulse(this.impl,xRt(oRt.instance.BT_V3_0,n),xRt(oRt.instance.BT_V3_1,r))},t.applyForce=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||mn.ZERO;eRt.RigidBody_applyForce(this.impl,xRt(oRt.instance.BT_V3_0,t),xRt(oRt.instance.BT_V3_1,i))},t.applyTorque=function(t){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep(),eRt.RigidBody_applyTorque(this.impl,xRt(oRt.instance.BT_V3_0,t))},t.applyImpulse=function(t,e){this._sharedBody.syncSceneToPhysics(),this._wakeUpIfSleep();var i=e||mn.ZERO;eRt.RigidBody_applyImpulse(this.impl,xRt(oRt.instance.BT_V3_0,t),xRt(oRt.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||eRt.CollisionObject_activate(this.impl,!0)},n(e,[{key:"isAwake",get:function(){var t=eRt.CollisionObject_getActivationState(this.impl);return t===CNt.ACTIVE_TAG||t===CNt.DISABLE_DEACTIVATION}},{key:"isSleepy",get:function(){return eRt.CollisionObject_getActivationState(this.impl)===CNt.WANTS_DEACTIVATION}},{key:"isSleeping",get:function(){return eRt.CollisionObject_getActivationState(this.impl)===CNt.ISLAND_SLEEPING}},{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}();INt.idCounter=0;var MNt={syncPhysicsToGraphics:function(t){iRt.CACHE.getWrapper(t,iRt.BODY_CACHE_NAME).syncPhysicsToGraphics()},onShapeHitExt:function(t,e){iRt.CACHE.getWrapper(e,iRt.CCT_CACHE_NAME).onShapeHitExt(t)},onDebugDrawLine:function(t,e,i){var n=iRt.CACHE.world;n&&n.onDebugDrawLine(t,e,i)},clearLines:function(){var t=iRt.CACHE.world;t&&t.onClearLines()},flushLines:function(){}},PNt=aRt,BNt=lRt,ONt=0,LNt=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=ZRt.PhysicsGroup.DEFAULT,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 o=REt.DEFAULT,a=ZRt.instance.collisionMatrix[o];r._collisionFilterGroup=o,r._collisionFilterMask=a,t.sharedBodesMap.set(e.uuid,r)}if(n){r._wrappedBody=n;var h=n.rigidBody.group,u=ZRt.instance.collisionMatrix[h];r._collisionFilterGroup=h,r._collisionFilterMask=u}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=oRt.instance.BT_TRANSFORM_0,i=oRt.instance.BT_QUAT_0;xRt(eRt.Transform_getOrigin(e),this.node.worldPosition),DRt(i,this.node.worldRotation),eRt.Transform_setRotation(e,i);var n=eRt.MotionState.implement(MNt).$$.ptr;eRt.ccMotionState_setup(n,this.id,e);var r=eRt.RigidBody_new(t,n),s=ZRt.instance.sleepThreshold;eRt.RigidBody_setSleepingThresholds(r,s,s),this._bodyStruct={id:ONt++,body:r,motionState:n,compound:eRt.ccCompoundShape_new(),wrappedShapes:[],useCompound:!1},oRt.setWrapper(this.id,iRt.BODY_CACHE_NAME,this),this._ghostStruct&&eRt.CollisionObject_setIgnoreCollisionCheck(this.ghost,this.body,!0),this._wrappedBody&&this.setBodyType(this._wrappedBody.rigidBody.type)}},e._instantiateGhostStruct=function(){if(!this._ghostStruct){var t=eRt.CollisionObject_new(),e=eRt.ccCompoundShape_new();eRt.CollisionObject_setCollisionShape(t,e),eRt.CollisionObject_setCollisionFlags(t,bNt.CF_STATIC_OBJECT|bNt.CF_NO_CONTACT_RESPONSE),this._ghostStruct={id:ONt++,ghost:t,compound:e,wrappedShapes:[]},this._bodyStruct&&eRt.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=eRt.CollisionObject_getCollisionFlags(e),s=oRt.instance.BT_V3_0;switch(t){case SEt.DYNAMIC:r&=~bNt.CF_KINEMATIC_OBJECT,r&=~bNt.CF_STATIC_OBJECT,eRt.CollisionObject_setCollisionFlags(e,r),i.setMass(n.mass),i.useGravity(n.useGravity),i.setAllowSleep(n.allowSleep);break;case SEt.KINEMATIC:eRt.Vec3_set(s,0,0,0),eRt.RigidBody_setMassProps(e,0,s),r|=bNt.CF_KINEMATIC_OBJECT,r&=~bNt.CF_STATIC_OBJECT,eRt.CollisionObject_setCollisionFlags(e,r),eRt.CollisionObject_forceActivationState(e,CNt.DISABLE_DEACTIVATION);break;case SEt.STATIC:default:eRt.Vec3_set(s,0,0,0),eRt.RigidBody_setMassProps(e,0,s),r|=bNt.CF_STATIC_OBJECT,r&=~bNt.CF_KINEMATIC_OBJECT,eRt.CollisionObject_setCollisionFlags(e,r),eRt.CollisionObject_forceActivationState(e,CNt.ISLAND_SLEEPING)}this.dirty|=TNt.BODY_RE_ADD}},e.setGhostType=function(t){if(this._ghostStruct){var e=this._ghostStruct.ghost,i=eRt.CollisionObject_getCollisionFlags(e);switch(t){case SEt.DYNAMIC:case SEt.KINEMATIC:i&=~bNt.CF_STATIC_OBJECT,i|=bNt.CF_KINEMATIC_OBJECT,eRt.CollisionObject_setCollisionFlags(e,i),eRt.CollisionObject_forceActivationState(e,CNt.DISABLE_DEACTIVATION);break;case SEt.STATIC:default:i&=~bNt.CF_KINEMATIC_OBJECT,i|=bNt.CF_STATIC_OBJECT,eRt.CollisionObject_setCollisionFlags(e,i),eRt.CollisionObject_forceActivationState(e,CNt.ISLAND_SLEEPING)}this.dirty|=TNt.GHOST_RE_ADD}},e.addShape=function(t,e){function i(t,e){eRt.CollisionObject_setCollisionShape(t.body,e),t.dirty|=TNt.BODY_RE_ADD,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&&(_e(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):eRt.CollisionObject_setCollisionShape(this.body,eRt.EmptyShape_static()),eRt.CollisionObject_activate(this.body,!0),this.dirty|=TNt.BODY_RE_ADD,_e(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&&_e(this.wrappedJoints1,i)}else{var n=this.wrappedJoints0.indexOf(t);n>=0&&_e(this.wrappedJoints0,n)}},e.updateDirty=function(){this.dirty&&(this.bodyIndex>=0&&this.dirty&TNt.BODY_RE_ADD&&this.updateBodyByReAdd(),this.ghostIndex>=0&&this.dirty&TNt.GHOST_RE_ADD&&this.updateGhostByReAdd(),this.dirty=0)},e.syncSceneToPhysics=function(){if(this.node.hasChangedFlags){var t=oRt.instance.BT_QUAT_0,e=eRt.CollisionObject_getWorldTransform(this.body);if(DRt(t,this.node.worldRotation),xRt(eRt.Transform_getOrigin(e),this.node.worldPosition),eRt.Transform_setRotation(e,t),this.node.hasChangedFlags&Om.SCALE&&this.syncBodyScale(),eRt.CollisionObject_isKinematicObject(this.body)){var i=eRt.RigidBody_getMotionState(this.body);i&&eRt.MotionState_setWorldTransform(i,e)}else this.isBodySleeping()&&eRt.CollisionObject_activate(this.body,!1)}},e.syncPhysicsToScene=function(){eRt.CollisionObject_isStaticOrKinematicObject(this.body)||this.syncPhysicsToGraphics()},e.syncPhysicsToGraphics=function(){if(!this.isBodySleeping()){var t=oRt.instance.BT_QUAT_0,e=oRt.instance.BT_TRANSFORM_0;eRt.RigidBody_getWorldTransform(this.body,e);var i=eRt.Transform_getRotationAndOrigin(e,t);if(this.node.worldRotation=RRt(BNt,t),this.node.worldPosition=wRt(PNt,i),this._ghostStruct){var n=eRt.CollisionObject_getWorldTransform(this.ghost);xRt(eRt.Transform_getOrigin(n),this.node.worldPosition),DRt(t,this.node.worldRotation),eRt.Transform_setRotation(n,t)}}},e.syncSceneToGhost=function(){if(this.node.hasChangedFlags){var t=oRt.instance.BT_QUAT_0,e=eRt.CollisionObject_getWorldTransform(this.ghost);xRt(eRt.Transform_getOrigin(e),this.node.worldPosition),DRt(t,this.node.worldRotation),eRt.Transform_setRotation(e,t),this.node.hasChangedFlags&Om.SCALE&&this.syncGhostScale(),eRt.CollisionObject_activate(this.ghost,!1)}},e.syncInitialBody=function(){var t=oRt.instance.BT_QUAT_0,e=eRt.CollisionObject_getWorldTransform(this.body);xRt(eRt.Transform_getOrigin(e),this.node.worldPosition),DRt(t,this.node.worldRotation),eRt.Transform_setRotation(e,t),this.syncBodyScale(),eRt.CollisionObject_activate(this.body,!1)},e.syncInitialGhost=function(){var t=oRt.instance.BT_QUAT_0,e=eRt.CollisionObject_getWorldTransform(this.ghost);xRt(eRt.Transform_getOrigin(e),this.node.worldPosition),DRt(t,this.node.worldRotation),eRt.Transform_setRotation(e,t),this.syncGhostScale(),eRt.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;oRt.delWrapper(this.id,iRt.BODY_CACHE_NAME),eRt._safe_delete(e.motionState,QDt.EBulletTypeMotionState),eRt._safe_delete(e.compound,QDt.EBulletTypeCollisionShape),eRt._safe_delete(e.body,QDt.EBulletTypeCollisionObject),this._bodyStruct=null}if(this._ghostStruct){var i=this._ghostStruct;eRt._safe_delete(i.compound,QDt.EBulletTypeCollisionShape),eRt._safe_delete(i.ghost,QDt.EBulletTypeCollisionObject),this._ghostStruct=null}},e.isBodySleeping=function(){return eRt.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|=TNt.BODY_RE_ADD,this.dirty|=TNt.GHOST_RE_ADD)}},{key:"collisionFilterMask",get:function(){return this._collisionFilterMask},set:function(t){t!==this._collisionFilterMask&&(this._collisionFilterMask=t,this.dirty|=TNt.BODY_RE_ADD,this.dirty|=TNt.GHOST_RE_ADD)}},{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)&&(eRt.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}();LNt.idCounter=0,LNt.sharedBodesMap=new Map;var NNt=aRt,FNt={},kNt=function(){function t(){this.id=t.idCounter++,this._isEnabled=!1,this._isTrigger=!1,this._isInitialized=!1,this._impl=0,this._compound=0,this.quat=eRt.Quat_new(0,0,0,1),this.transform=eRt.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?ZRt.instance.defaultMaterial:t;if(!this._isTrigger&&this._isEnabled)if(this._compound){FNt[e._uuid]||(FNt[e._uuid]=eRt.ccMaterial_new());var i=FNt[e._uuid];eRt.ccMaterial_set(i,e.restitution,e.friction,e.rollingFriction,e.spinningFriction),eRt.CollisionShape_setMaterial(this._impl,i)}else eRt.CollisionObject_setMaterial(this._sharedBody.body,e.restitution,e.friction,e.rollingFriction,e.spinningFriction)},e.setCenter=function(t){mn.copy(NNt,t),NNt.multiply(this._collider.node.worldScale),xRt(eRt.Transform_getOrigin(this.transform),NNt),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=oRt.instance.BT_TRANSFORM_0;eRt.Transform_setIdentity(e),eRt.Transform_setRotation(e,DRt(oRt.instance.BT_QUAT_0,this._collider.node.worldRotation));var i=oRt.instance.BT_V3_0,n=oRt.instance.BT_V3_1;eRt.CollisionShape_getAabb(this._impl,e,i,n),t.halfExtents.x=(eRt.Vec3_x(n)-eRt.Vec3_x(i))/2,t.halfExtents.y=(eRt.Vec3_y(n)-eRt.Vec3_y(i))/2,t.halfExtents.z=(eRt.Vec3_z(n)-eRt.Vec3_z(i))/2,mn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.getBoundingSphere=function(t){t.radius=eRt.CollisionShape_getLocalBoundingSphere(this._impl),mn.add(t.center,this._collider.node.worldPosition,this._collider.center)},e.initialize=function(t){this._collider=t,this._isInitialized=!0,this._sharedBody=ZRt.instance.physicsWorld.getSharedBody(this._collider.node),this._sharedBody.reference=!0,this.onComponentSet(),this.setWrapper()},e.setWrapper=function(){oRt.isNotEmptyShape(this._impl)&&(eRt.CollisionShape_setUserPointer(this._impl,this._impl),oRt.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,eRt._safe_delete(this.quat,QDt.EBulletTypeQuat),eRt._safe_delete(this.transform,QDt.EBulletTypeTransform),this._compound&&eRt._safe_delete(this._compound,QDt.EBulletTypeCollisionShape),oRt.isNotEmptyShape(this._impl)&&(eRt._safe_delete(this._impl,QDt.EBulletTypeCollisionShape),oRt.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&&eRt.CompoundShape_removeChildShape(this._compound,this._impl),t&&eRt.CompoundShape_addChildShape(t,this.transform,this._impl),this._compound=t},e.updateScale=function(){this.setCenter(this._collider.center)},e.updateCompoundTransform=function(){this._compound?eRt.CompoundShape_updateChildTransform(this._compound,this._impl,this.transform,!0):this._isEnabled&&!this._isTrigger&&this._sharedBody&&!this._sharedBody.bodyStruct.useCompound&&(this._sharedBody.dirty|=TNt.BODY_RE_ADD)},e.needCompound=function(){return this._collider.type===EEt.TERRAIN||!this._collider.center.equals(mn.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}();kNt.TYPE="shape",kNt.idCounter=0;var VNt=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}(),GNt=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}(),UNt=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&&wRt(t,eRt.ManifoldPoint_get_m_localPointA(this.impl))},e.getLocalPointOnB=function(t){this.impl&&wRt(t,eRt.ManifoldPoint_get_m_localPointB(this.impl))},e.getWorldPointOnA=function(t){this.impl&&wRt(t,eRt.ManifoldPoint_get_m_positionWorldOnA(this.impl))},e.getWorldPointOnB=function(t){this.impl&&wRt(t,eRt.ManifoldPoint_get_m_positionWorldOnB(this.impl))},e.getLocalNormalOnA=function(t){if(this.impl){var e=oRt.instance.BT_QUAT_0,i=eRt.PersistentManifold_getBody0(this.event.impl),n=eRt.CollisionObject_getWorldTransform(i);eRt.Transform_getRotation(n,e);var r=lRt;RRt(r,e),In.conjugate(r,r),wRt(t,eRt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||mn.negate(t,t),mn.transformQuat(t,t,r)}},e.getLocalNormalOnB=function(t){if(this.impl){var e=oRt.instance.BT_QUAT_0,i=eRt.PersistentManifold_getBody1(this.event.impl),n=eRt.CollisionObject_getWorldTransform(i);eRt.Transform_getRotation(n,e);var r=lRt;RRt(r,e),In.conjugate(r,r),wRt(t,eRt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),mn.transformQuat(t,t,r)}},e.getWorldNormalOnA=function(t){this.impl&&(wRt(t,eRt.ManifoldPoint_get_m_normalWorldOnB(this.impl)),this.isBodyA||mn.negate(t,t))},e.getWorldNormalOnB=function(t){this.impl&&wRt(t,eRt.ManifoldPoint_get_m_normalWorldOnB(this.impl))},n(t,[{key:"isBodyA",get:function(){return this.event.selfCollider.shape.sharedBody.body===eRt.PersistentManifold_getBody0(this.event.impl)}}]),t}(),zNt=[],HNt=aRt,WNt=hRt,jNt=uRt,XNt=CRt,YNt=new ANt,qNt=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=IEt.NONE,this._debugConstraintSize=.3,this._needEmitEvents=!1,this._needSyncAfterEvents=!1,this._needEmitCCTEvents=!1,this.bodies=[],this.ghosts=[],this.ccts=[],this.constraints=[],this.triggerArrayMat=new VNt,this.collisionArrayMat=new VNt,this.contactsDic=new GNt,this.oldContactsDic=new GNt,this.cctShapeEventDic=new GNt,this.cctContactsDic=new GNt,this.cctOldContactsDic=new GNt,iRt.CACHE.world=this,this._broadphase=eRt.DbvtBroadphase_new(),this._dispatcher=eRt.CollisionDispatcher_new(),this._solver=eRt.SequentialImpulseConstraintSolver_new(),this._world=eRt.ccDiscreteDynamicsWorld_new(this._dispatcher,this._broadphase,this._solver);var t=eRt.DebugDraw.implement(MNt);this._debugDraw=t.$$.ptr,eRt.CollisionWorld_setDebugDrawer(this._world,this._debugDraw),eRt.DebugDraw_setDebugMode(this._debugDraw,JDt.DBG_NoDebug),eRt.DebugDraw_setAABBColor(this._debugDraw,0,1,1),eRt.DebugDraw_setActiveObjectColor(this._debugDraw,1,0,1),eRt.DebugDraw_setDeactiveObjectColor(this._debugDraw,1,0,1),eRt.DebugDraw_setWantsDeactivationObjectColor(this._debugDraw,1,0,1),eRt.DebugDraw_setDisabledDeactivationObjectColor(this._debugDraw,1,0,1),eRt.DebugDraw_setDisabledSimulationObjectColor(this._debugDraw,1,0,1),eRt.DebugDraw_setConstraintLimitColor(this._debugDraw,.5,.5,.5)}return t.setDefaultMaterial=function(){},t.setAllowSleep=function(t){eRt.ccDiscreteDynamicsWorld_setAllowSleep(this._world,t)},t.setGravity=function(t){eRt.DynamicsWorld_setGravity(this._world,xRt(oRt.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 o=this.bodies[s].bodyStruct.wrappedShapes,a=0;a<o.length;a++){var h=o[a].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)&&z("You should destroy all physics component first."),eRt._safe_delete(this._world,QDt.EBulletTypeCollisionWorld),eRt._safe_delete(this._broadphase,QDt.EBulletTypeDbvtBroadPhase),eRt._safe_delete(this._dispatcher,QDt.EBulletTypeCollisionDispatcher),eRt._safe_delete(this._solver,QDt.EBulletTypeSequentialImpulseConstraintSolver),eRt._safe_delete(this._debugDraw,QDt.EBulletTypeDebugDraw),this.bodies=null,this.ghosts=null,this.ccts=null,this.constraints=null,this.triggerArrayMat=null,this.collisionArrayMat=null,this.contactsDic=null,this.oldContactsDic=null,this.cctShapeEventDic=null,this.cctShapeEventPool=null,zNt.length=0},t.step=function(t,e,i){void 0===i&&(i=0),(this.bodies.length||this.ghosts.length)&&(void 0===e&&(e=t),eRt.DynamicsWorld_stepSimulation(this._world,e,i,t),eRt.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 o=r[s];o.updateDirty(),o.syncSceneToPhysics()}},t.syncAfterEvents=function(){this._needSyncAfterEvents&&this.syncSceneToPhysics()},t.raycast=function(t,e,i,n){t.computeHit(HNt,e.maxDistance);var r=xRt(oRt.instance.BT_V3_0,HNt),s=xRt(oRt.instance.BT_V3_1,t.o),o=eRt.ccAllRayCallback_static();if(eRt.ccAllRayCallback_reset(o,s,r,e.mask>>>0,e.queryTrigger),eRt.ccAllRayCallback_setFlags(o,ZDt.UseSubSimplexConvexCastRaytest),eRt.CollisionWorld_rayTest(this._world,s,r,o),eRt.RayCallback_hasHit(o)){for(var a=eRt.ccAllRayCallback_getHitPointWorld(o),h=eRt.ccAllRayCallback_getHitNormalWorld(o),u=eRt.ccAllRayCallback_getCollisionShapePtrs(o),l=0,c=eRt.int_array_size(u);l<c;l++){wRt(HNt,eRt.Vec3_array_at(a,l)),wRt(WNt,eRt.Vec3_array_at(h,l));var _=oRt.getWrapper(eRt.int_array_at(u,l),kNt.TYPE),f=i.add();n.push(f),f._assign(HNt,mn.distance(t.o,HNt),_.collider,WNt)}return!0}return!1},t.raycastClosest=function(t,e,i){t.computeHit(HNt,e.maxDistance);var n=xRt(oRt.instance.BT_V3_0,HNt),r=xRt(oRt.instance.BT_V3_1,t.o),s=eRt.ccClosestRayCallback_static();if(eRt.ccClosestRayCallback_reset(s,r,n,e.mask>>>0,e.queryTrigger),eRt.ccClosestRayCallback_setFlags(s,ZDt.UseSubSimplexConvexCastRaytest),eRt.CollisionWorld_rayTest(this._world,r,n,s),eRt.RayCallback_hasHit(s)){wRt(HNt,eRt.ccClosestRayCallback_getHitPointWorld(s)),wRt(WNt,eRt.ccClosestRayCallback_getHitNormalWorld(s));var o=oRt.getWrapper(eRt.ccClosestRayCallback_getCollisionShapePtr(s),kNt.TYPE);return i._assign(HNt,mn.distance(t.o,HNt),o.collider,WNt),!0}return!1},t.sweepBox=function(t,i,n,r,s,o){var a=oRt.instance.BT_V3_0;return xRt(a,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=eRt.BoxShape_new(a)),eRt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,a),this.sweep(t,e._sweepBoxGeometry,n,r,s,o)},t.sweepBoxClosest=function(t,i,n,r,s){var o=oRt.instance.BT_V3_0;return xRt(o,i),e._sweepBoxGeometry||(e._sweepBoxGeometry=eRt.BoxShape_new(o)),eRt.BoxShape_setUnscaledHalfExtents(e._sweepBoxGeometry,o),this.sweepClosest(t,e._sweepBoxGeometry,n,r,s)},t.sweepSphere=function(t,i,n,r,s){return e._sweepSphereGeometry||(e._sweepSphereGeometry=eRt.SphereShape_new(i)),eRt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweep(t,e._sweepSphereGeometry,In.IDENTITY,n,r,s)},t.sweepSphereClosest=function(t,i,n,r){return e._sweepSphereGeometry||(e._sweepSphereGeometry=eRt.SphereShape_new(i)),eRt.SphereShape_setUnscaledRadius(e._sweepSphereGeometry,i),this.sweepClosest(t,e._sweepSphereGeometry,In.IDENTITY,n,r)},t.sweepCapsule=function(t,i,n,r,s,o,a){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=eRt.CapsuleShape_new(i,n)),eRt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweep(t,e._sweepCapsuleGeometry,r,s,o,a)},t.sweepCapsuleClosest=function(t,i,n,r,s,o){return e._sweepCapsuleGeometry||(e._sweepCapsuleGeometry=eRt.CapsuleShape_new(i,n)),eRt.CapsuleShape_updateProp(e._sweepCapsuleGeometry,i,.5*n,1),this.sweepClosest(t,e._sweepCapsuleGeometry,r,s,o)},t.sweep=function(t,e,i,n,r,s){var o=oRt.instance.BT_TRANSFORM_0,a=oRt.instance.BT_TRANSFORM_1,h=oRt.instance.BT_QUAT_0;xRt(eRt.Transform_getOrigin(o),t.o),DRt(h,i),eRt.Transform_setRotation(o,h),t.computeHit(HNt,n.maxDistance),xRt(eRt.Transform_getOrigin(a),HNt),DRt(h,i),eRt.Transform_setRotation(a,h);var u=eRt.ccAllConvexCallback_static();if(eRt.ccAllConvexCallback_reset(u,o,a,n.mask>>>0,n.queryTrigger),eRt.CollisionWorld_convexSweepTest(this._world,e,o,a,u,0),eRt.ConvexCallback_hasHit(u)){for(var l=eRt.ccAllConvexCallback_getHitPointWorld(u),c=eRt.ccAllConvexCallback_getHitNormalWorld(u),_=eRt.ccAllConvexCallback_getCollisionShapePtrs(u),f=0,d=eRt.int_array_size(_);f<d;f++){wRt(HNt,eRt.Vec3_array_at(l,f)),wRt(WNt,eRt.Vec3_array_at(c,f));var p=oRt.getWrapper(eRt.int_array_at(_,f),kNt.TYPE),m=r.add();s.push(m),m._assign(HNt,mn.distance(t.o,HNt),p.collider,WNt)}return!0}return!1},t.sweepClosest=function(t,e,i,n,r){var s=oRt.instance.BT_TRANSFORM_0,o=oRt.instance.BT_TRANSFORM_1,a=oRt.instance.BT_QUAT_0;xRt(eRt.Transform_getOrigin(s),t.o),DRt(a,i),eRt.Transform_setRotation(s,a),t.computeHit(HNt,n.maxDistance),xRt(eRt.Transform_getOrigin(o),HNt),DRt(a,i),eRt.Transform_setRotation(o,a);var h=eRt.ccClosestConvexCallback_static();if(eRt.ccClosestConvexCallback_reset(h,s,o,n.mask>>>0,n.queryTrigger),eRt.CollisionWorld_convexSweepTest(this._world,e,s,o,h,0),eRt.ConvexCallback_hasHit(h)){wRt(HNt,eRt.ccClosestConvexCallback_getHitPointWorld(h)),wRt(WNt,eRt.ccClosestConvexCallback_getHitNormalWorld(h));var u=oRt.getWrapper(eRt.ccClosestConvexCallback_getCollisionShapePtr(h),kNt.TYPE);return r._assign(HNt,mn.distance(t.o,HNt),u.collider,WNt),!0}return!1},t.getSharedBody=function(t,e){return LNt.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;eRt.DynamicsWorld_addRigidBody(this._world,t.body,e>>>0,i>>>0)}},t.removeSharedBody=function(t){var e=this.bodies.indexOf(t);e>=0&&(_e(this.bodies,e),eRt.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;eRt.CollisionWorld_addCollisionObject(this._world,t.ghost,e>>>0,i>>>0)}},t.removeGhostObject=function(t){var e=this.ghosts.indexOf(t);e>=0&&(_e(this.ghosts,e),eRt.CollisionWorld_removeCollisionObject(this._world,t.ghost))},t.addCCT=function(t){if(this.ccts.indexOf(t)<0){this.ccts.push(t);var e=eRt.CharacterController_getGhostObject(t.impl),i=t.getGroup(),n=t.getMask();eRt.CollisionWorld_addCollisionObject(this._world,e,i>>>0,n>>>0),eRt.DynamicsWorld_addAction(this._world,t.impl)}},t.removeCCT=function(t){var e=this.ccts.indexOf(t);if(e>=0){_e(this.ccts,e);var i=eRt.CharacterController_getGhostObject(t.impl);eRt.CollisionWorld_removeCollisionObject(this._world,i),eRt.DynamicsWorld_removeAction(this._world,t.impl)}},t.addConstraint=function(t){var e=this.constraints.indexOf(t);e<0&&(this.constraints.push(t),eRt.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),eRt.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--;){zNt.push.apply(zNt,rRt.contacts),rRt.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,o=r.collider;if(s&&o){if(s.isTrigger||o.isTrigger)this.triggerArrayMat.get(n.id,r.id)?nRt.type="onTriggerStay":(nRt.type="onTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),nRt.impl=i.impl,nRt.selfCollider=s,nRt.otherCollider=o,s.emit(nRt.type,nRt),nRt.selfCollider=o,nRt.otherCollider=s,o.emit(nRt.type,nRt),this._needSyncAfterEvents=!0;else{var a=s.attachedRigidBody,h=o.attachedRigidBody;if(a&&h){if(a.isSleeping&&h.isSleeping)continue}else if(!a&&h){if(h.isSleeping)continue}else if(!h&&a&&a.isSleeping)continue;this.collisionArrayMat.get(n.id,r.id)?rRt.type="onCollisionStay":(rRt.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(zNt.length>0){var c=zNt.pop();c.impl=l,rRt.contacts.push(c)}else{var _=new UNt(rRt);_.impl=l,rRt.contacts.push(_)}}rRt.impl=i.impl,rRt.selfCollider=s,rRt.otherCollider=o,s.emit(rRt.type,rRt),rRt.selfCollider=o,rRt.otherCollider=s,o.emit(rRt.type,rRt),this._needSyncAfterEvents=!0}null==this.oldContactsDic.get(n.id,r.id)&&this.oldContactsDic.set(n.id,r.id,i)}}for(var f=this.oldContactsDic.getLength();f--;){var d=this.oldContactsDic.getKeyByIndex(f),p=this.oldContactsDic.getDataByKey(d),m=p.shape0,g=p.shape1,y=m.collider,v=g.collider;if(y&&v){var S=y.isTrigger||v.isTrigger;null==this.contactsDic.getDataByKey(d)&&(S?this.triggerArrayMat.get(m.id,g.id)&&(nRt.type="onTriggerExit",nRt.selfCollider=y,nRt.otherCollider=v,y.emit(nRt.type,nRt),nRt.selfCollider=v,nRt.otherCollider=y,v.emit(nRt.type,nRt),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)&&(zNt.push.apply(zNt,rRt.contacts),rRt.contacts.length=0,rRt.type="onCollisionExit",rRt.selfCollider=y,rRt.otherCollider=v,y.emit(rRt.type,rRt),rRt.selfCollider=v,rRt.otherCollider=y,v.emit(rRt.type,rRt),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,o=r.characterController;s&&o&&(s.isTrigger&&(this.triggerArrayMat.get(n.id,r.id)?sRt.type="onControllerTriggerStay":(sRt.type="onControllerTriggerEnter",this.triggerArrayMat.set(n.id,r.id,!0)),sRt.impl=i.impl,sRt.collider=s,sRt.characterController=o,s.emit(sRt.type,sRt),sRt.collider=s,sRt.characterController=o,o.emit(sRt.type,sRt),this._needSyncAfterEvents=!0),null==this.cctOldContactsDic.get(n.id,r.id)&&this.cctOldContactsDic.set(n.id,r.id,i))}for(var a=this.cctOldContactsDic.getLength();a--;){var h=this.cctOldContactsDic.getKeyByIndex(a),u=this.cctOldContactsDic.getDataByKey(h),l=u.shape,c=u.cct,_=l.collider,f=c.characterController;if(_&&f){var d=_.isTrigger;null==this.cctContactsDic.getDataByKey(h)&&d&&this.triggerArrayMat.get(l.id,c.id)&&(sRt.type="onControllerTriggerExit",sRt.collider=_,sRt.characterController=f,_.emit(sRt.type,sRt),sRt.collider=_,sRt.characterController=f,f.emit(sRt.type,sRt),this.triggerArrayMat.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,o=n.worldPos,a=n.worldNormal,h=n.motionDir,u=n.motionLength;YNt.controller=r.characterController,YNt.collider=s.collider,YNt.worldPosition.set(o.x,o.y,o.z),YNt.worldNormal.set(a.x,a.y,a.z),YNt.motionDirection.set(h.x,h.y,h.z),YNt.motionLength=u,null===(e=YNt.controller)||void 0===e||e.emit("onControllerColliderHit",YNt),this._needSyncAfterEvents=!0}this.cctShapeEventDic.reset()},t.gatherConatactData=function(){for(var t=eRt.Dispatcher_getNumManifolds(this._dispatcher),e=0;e<t;e++)for(var i=eRt.Dispatcher_getManifoldByIndexInternal(this._dispatcher,e),n=eRt.PersistentManifold_getNumContacts(i),r=0;r<n;r++){var s=eRt.PersistentManifold_getContactPoint(i,r),o=eRt.ManifoldPoint_getShape0(s),a=eRt.ManifoldPoint_getShape1(s),h=!1;if(!h){var u=oRt.getWrapper(o,kNt.TYPE),l=oRt.getWrapper(a,kNt.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 _=oRt.getWrapper(o,kNt.TYPE),f=oRt.getWrapper(a,iRt.CCT_CACHE_NAME);if(_&&f&&(h=!0,_.collider.needTriggerEvent)){var d=this.cctContactsDic.get(_.id,f.id);d||(d=this.cctContactsDic.set(_.id,f.id,{shape:_,cct:f,contacts:[],impl:i})),d.contacts.push(s),h=!0}}if(!h){var p=oRt.getWrapper(o,iRt.CCT_CACHE_NAME),m=oRt.getWrapper(a,kNt.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;this._debugDrawFlags&IEt.WIRE_FRAME&&(t|=JDt.DBG_DrawWireframe),this._debugDrawFlags&IEt.CONSTRAINT&&(t|=JDt.DBG_DrawConstraints,t|=JDt.DBG_DrawConstraintLimits),this._debugDrawFlags&IEt.AABB&&(t|=JDt.DBG_DrawAabb),eRt.DebugDraw_setDebugMode(this._debugDraw,t)},t._getDebugRenderer=function(){var t,e=null===(t=FI.root.mainWindow)||void 0===t?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++,wRt(HNt,t),wRt(WNt,e),wRt(jNt,i),XNt.set(255*jNt.x,255*jNt.y,255*jNt.z,255),n.addLine(HNt,WNt,XNt))},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}();qNt._sweepBoxGeometry=void 0,qNt._sweepSphereGeometry=void 0,qNt._sweepCapsuleGeometry=void 0;var KNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateSize=function(){var t=oRt.instance.BT_V3_0;xRt(t,this.getMinUnscaledHalfExtents(Zq)),eRt.BoxShape_setUnscaledHalfExtents(this.impl,t),this.updateCompoundTransform()},i.onComponentSet=function(){var t=oRt.instance.BT_V3_0;xRt(t,this.getMinUnscaledHalfExtents(Zq)),this._impl=eRt.BoxShape_new(t),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=oRt.instance.BT_V3_0;eRt.CollisionShape_setLocalScaling(this._impl,xRt(e,this.getMinScale(Zq))),this.updateCompoundTransform()},i.getMinUnscaledHalfExtents=function(t){var e=this.collider.size,i=Jq(Zq.set(this._collider.node.worldScale)),n=ZRt.instance.minVolumeSize,r=e.x/2,s=e.y/2,o=e.z/2,a=r*i.x<n?n/i.x:r,h=s*i.y<n?n/i.y:s,u=o*i.z<n?n/i.z:o;return t.set(a,h,u),t},i.getMinScale=function(t){var e=this.collider.size,i=Jq(Zq.set(this._collider.node.worldScale)),n=ZRt.instance.minVolumeSize,r=e.x/2,s=e.y/2,o=e.z/2,a=r*i.x<n?n/r:i.x,h=s*i.y<n?n/s:i.y,u=o*i.z<n?n/o:i.z;return t.set(a,h,u),t},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),QNt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.updateRadius=function(){eRt.SphereShape_setUnscaledRadius(this.impl,this.getMinUnscaledRadius()),this.updateCompoundTransform()},i.onComponentSet=function(){this._impl=eRt.SphereShape_new(this.getMinUnscaledRadius()),this.updateScale()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=this.getMinScale();aRt.set(e,e,e);var i=oRt.instance.BT_V3_0;eRt.CollisionShape_setLocalScaling(this._impl,xRt(i,aRt)),this.updateCompoundTransform()},i.getMinUnscaledRadius=function(){var t=this.collider.radius,e=Math.abs(Ji(this._collider.node.worldScale)),i=ZRt.instance.minVolumeSize;return e*t<i?i/e:t},i.getMinScale=function(){var t=this.collider.radius,e=Math.abs(Ji(this._collider.node.worldScale)),i=ZRt.instance.minVolumeSize;return e*t<i?i/t:e},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),ZNt=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=eRt.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,o=n,a=i;1===a?(r=t*Math.abs($i(o.x,o.z)),s=e/2*Math.abs(o.y)):0===a?(r=t*Math.abs($i(o.y,o.z)),s=e/2*Math.abs(o.x)):(r=t*Math.abs($i(o.x,o.y)),s=e/2*Math.abs(o.z)),eRt.CapsuleShape_updateProp(this._impl,r,s,a),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),JNt=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=eRt.TriangleMesh_new(),IRt(this.btTriangleMeshPtr,e),this.bulletBvhTriangleMeshShapePtr=eRt.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&&eRt._safe_delete(QDt.EBulletTypeCollisionShape,this.bulletBvhTriangleMeshShapePtr),this.btTriangleMeshPtr&&eRt._safe_delete(QDt.EBulletTypeTriangleMesh,this.btTriangleMeshPtr),t.BulletBvhTriangleMeshShapeMap.delete(this.key)},n(t,[{key:"reference",set:function(t){t?this.ref++:this.ref--,0===this.ref&&this.destroy()}}]),t}();JNt.BulletBvhTriangleMeshShapeMap=new Map;var $Nt,tFt,eFt=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=void 0,e.refBtTriangleMesh=0,e}s(e,t);var i=e.prototype;return i.setMesh=function(t){if(this._isInitialized){this._impl&&oRt.isNotEmptyShape(this._impl)&&(this._compound&&eRt.CompoundShape_removeChildShape(this._compound,this._impl),eRt._safe_delete(this._impl,QDt.EBulletTypeCollisionShape),oRt.delWrapper(this._impl,kNt.TYPE),this._impl=0);var e=t;if(e&&e.renderingSubMeshes.length>0){if(this.collider.convex){var i=this._getBtTriangleMesh(e);this._impl=eRt.ConvexTriangleMeshShape_new(i)}else this.btBVHMeshShape=JNt.getBulletBvhTriangleMeshShape(e.hash,e),this._impl=eRt.ScaledBvhTriangleMeshShape_new(this.btBVHMeshShape.bulletBvhTriangleMeshShapePtr,1,1,1);var n=oRt.instance.BT_V3_0;xRt(n,this._collider.node.worldScale),eRt.CollisionShape_setLocalScaling(this._impl,n),eRt.CollisionShape_setMargin(this._impl,.01),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=eRt.EmptyShape_static()}},i.onComponentSet=function(){this.setMesh(this.collider.mesh)},i.onDestroy=function(){this.collider.convex?this.refBtTriangleMesh&&eRt._safe_delete(this.refBtTriangleMesh,QDt.EBulletTypeTriangleMesh):this.btBVHMeshShape&&(this.btBVHMeshShape.reference=!1),t.prototype.onDestroy.call(this)},i.updateScale=function(){t.prototype.updateScale.call(this);var e=oRt.instance.BT_V3_0;xRt(e,this._collider.node.worldScale),eRt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i._getBtTriangleMesh=function(t){return this.refBtTriangleMesh=eRt.TriangleMesh_new(),IRt(this.refBtTriangleMesh,t),this.refBtTriangleMesh},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),iFt=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=oRt.instance.BT_V3_0;eRt.Vec3_set(t,.5,1,.5),this._impl=eRt.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,o=n,a=i;1===a?(s=e*Math.abs(o.y),r=t*Math.abs($i(o.x,o.z))):0===a?(s=e*Math.abs(o.x),r=t*Math.abs($i(o.y,o.z))):(s=e*Math.abs(o.z),r=t*Math.abs($i(o.x,o.y))),eRt.CylinderShape_updateProp(this._impl,r,s/2,a),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),nFt=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=eRt.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,o=n,a=i;1===a?(s=e*Math.abs(o.y),r=t*Math.abs($i(o.x,o.z))):0===a?(s=e*Math.abs(o.x),r=t*Math.abs($i(o.y,o.z))):(s=e*Math.abs(o.z),r=t*Math.abs($i(o.x,o.y))),eRt.ConeShape_setRadius(this._impl,r),eRt.ConeShape_setHeight(this._impl,s),eRt.ConeShape_setConeUpIndex(this._impl,a);var h=oRt.instance.BT_V3_0;eRt.Vec3_set(h,1,1,1),eRt.CollisionShape_setLocalScaling(this._impl,h),this.updateCompoundTransform()},n(e,[{key:"impl",get:function(){return this._impl}},{key:"collider",get:function(){return this._collider}}]),e}(kNt),rFt=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 mn,e}s(e,t);var i=e.prototype;return i.setTerrain=function(t){if(this._isInitialized)if(this._impl&&oRt.isNotEmptyShape(this._impl))U("[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=eRt._malloc(4*i*n);for(var r=0,s=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,a=0;a<n;a++)for(var h=0;h<i;h++){var u=e.getHeight(h,a);eRt._write_f32(this._bufPtr+r,u),s>u&&(s=u),u>o&&(o=u),r+=4}o+=.01,s-=.01,this._localOffset.set((i-1)/2*this._tileSize,(o+s)/2,(n-1)/2*this._tileSize),this._impl=eRt.TerrainShape_new(i,n,this._bufPtr,1,s,o);var l=oRt.instance.BT_V3_0;eRt.Vec3_set(l,this._tileSize,1,this._tileSize),eRt.CollisionShape_setLocalScaling(this._impl,l),this.setCompound(this._compound),this.updateByReAdd(),this.setWrapper()}else this._impl=eRt.EmptyShape_static()}},i.onComponentSet=function(){this.setTerrain(this.collider.terrain)},i.onDestroy=function(){this._bufPtr&&eRt._free(this._bufPtr),t.prototype.onDestroy.call(this)},i.setCenter=function(t){mn.copy(aRt,t),aRt.add(this._localOffset),xRt(eRt.Transform_getOrigin(this.transform),aRt),this.updateCompoundTransform()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),sFt=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=eRt.SimplexShape_new();for(var t=this.collider.shapeType,e=this.collider.vertices,i=oRt.instance.BT_V3_0,n=0;n<t;n++)eRt.SimplexShape_addVertex(this._impl,xRt(i,e[n]));eRt.CollisionShape_setLocalScaling(this._impl,xRt(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=oRt.instance.BT_V3_0;eRt.CollisionShape_setLocalScaling(this._impl,xRt(e,this._collider.node.worldScale))},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),oFt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setNormal=function(t){xRt(eRt.StaticPlaneShape_getPlaneNormal(this.impl),t),this.updateCompoundTransform()},i.setConstant=function(t){eRt.StaticPlaneShape_setPlaneConstant(this.impl,t),this.updateCompoundTransform()},i.updateScale=function(){t.prototype.updateScale.call(this);var e=oRt.instance.BT_V3_0;xRt(e,this._collider.node.worldScale),eRt.CollisionShape_setLocalScaling(this._impl,e),this.updateCompoundTransform()},i.onComponentSet=function(){var t=oRt.instance.BT_V3_0;xRt(t,this.collider.normal),this._impl=eRt.StaticPlaneShape_new(t,this.collider.constant),this.updateScale()},n(e,[{key:"collider",get:function(){return this._collider}}]),e}(kNt),aFt=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),eRt._safe_delete(this._impl,QDt.EBulletTypeTypedConstraint)),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=ZRt.instance.physicsWorld.debugDrawConstraintSize;eRt.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(){eRt._safe_delete(this._impl,QDt.EBulletTypeTypedConstraint),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}(),hFt=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=oRt.instance.BT_V3_0;mn.multiply(aRt,t.node.worldScale,t.pivotA),xRt(e,aRt),eRt.P2PConstraint_setPivotA(this._impl,e),t.connectedBody||this.setPivotB(t.pivotB)},i.setPivotB=function(){var t=this.constraint,e=this._rigidBody.node,i=oRt.instance.BT_V3_0,n=t.connectedBody;n?(mn.multiply(aRt,n.node.worldScale,t.pivotB),xRt(i,aRt)):(mn.multiply(aRt,e.worldScale,t.pivotA),mn.transformQuat(aRt,aRt,e.worldRotation),mn.add(aRt,aRt,e.worldPosition),xRt(i,aRt)),eRt.P2PConstraint_setPivotB(this._impl,i)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:eRt.TypedConstraint_getFixedBody(),n=oRt.instance.BT_V3_0,r=oRt.instance.BT_V3_1;this._impl=eRt.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}(aFt),uFt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.setBreakForce=function(t){eRt.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:eRt.TypedConstraint_getFixedBody(),n=oRt.instance.BT_TRANSFORM_0,r=oRt.instance.BT_TRANSFORM_1;this._impl=eRt.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=aRt,n=lRt,r=oRt.instance.BT_TRANSFORM_0,s=oRt.instance.BT_TRANSFORM_1,o=oRt.instance.BT_QUAT_0,a=_Rt;if(Vn.fromRT(a,e.node.worldRotation,e.node.worldPosition),Vn.invert(a,a),Vn.getRotation(n,a),Vn.getTranslation(i,a),xRt(eRt.Transform_getOrigin(r),i),DRt(o,n),eRt.Transform_setRotation(r,o),t){var h=t.body.sharedBody;Vn.fromRT(a,h.node.worldRotation,h.node.worldPosition),Vn.invert(a,a),Vn.getRotation(n,a),Vn.getTranslation(i,a),xRt(eRt.Transform_getOrigin(s),i),DRt(o,n),eRt.Transform_setRotation(s,o)}else eRt.Transform_setIdentity(s);eRt.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}(aFt),lFt=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?eRt.HingeConstraint_setLimit(this._impl,Vi(this.constraint.lowerLimit),Vi(this.constraint.upperLimit),.9,.3,1):eRt.HingeConstraint_setLimit(this._impl,1,0,.9,.3,1)},i.setLowerLimit=function(){this.constraint.limitEnabled&&eRt.HingeConstraint_setLimit(this._impl,Vi(this.constraint.lowerLimit),Vi(this.constraint.upperLimit),.9,.3,1)},i.setUpperLimit=function(){this.constraint.limitEnabled&&eRt.HingeConstraint_setLimit(this._impl,Vi(this.constraint.lowerLimit),Vi(this.constraint.upperLimit),.9,.3,1)},i.setMotorEnabled=function(t){eRt.HingeConstraint_enableMotor(this._impl,t);var e=-this.constraint.motorVelocity/60,i=MRt(this.constraint.motorForceLimit,ZRt.instance.fixedTimeStep);eRt.HingeConstraint_setMotorVelocity(this._impl,e),eRt.HingeConstraint_setMaxMotorImpulse(this._impl,i)},i.setMotorVelocity=function(t){if(this.constraint.motorEnabled){var e=-t/60;eRt.HingeConstraint_setMotorVelocity(this._impl,e)}},i.setMotorForceLimit=function(t){if(this.constraint.motorEnabled){var e=MRt(t,ZRt.instance.fixedTimeStep);eRt.HingeConstraint_setMaxMotorImpulse(this._impl,e)}},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t?t.body.impl:eRt.TypedConstraint_getFixedBody(),n=oRt.instance.BT_TRANSFORM_0,r=oRt.instance.BT_TRANSFORM_1;this._impl=eRt.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=aRt,n=lRt,r=cRt,s=oRt.instance.BT_TRANSFORM_0;mn.multiply(i,e.worldScale,t.pivotA),xRt(eRt.Transform_getOrigin(s),i);var o=oRt.instance.BT_QUAT_0;mn.normalize(i,t.axis),In.rotationTo(r,mn.UNIT_Z,i),DRt(o,r),eRt.Transform_setRotation(s,o);var a=oRt.instance.BT_TRANSFORM_1,h=this.constraint.connectedBody;h?(mn.multiply(i,h.node.worldScale,t.pivotB),In.multiply(r,e.worldRotation,r),In.invert(n,h.node.worldRotation),In.multiply(r,n,r)):(mn.multiply(i,e.worldScale,t.pivotA),mn.transformQuat(i,i,e.worldRotation),mn.add(i,i,e.worldPosition),In.multiply(r,e.worldRotation,r)),xRt(eRt.Transform_getOrigin(a),i),DRt(o,r),eRt.Transform_setRotation(a,o),eRt.HingeConstraint_setFrames(this._impl,s,a)},i.updateScale0=function(){this.updateFrames()},i.updateScale1=function(){this.updateFrames()},n(e,[{key:"constraint",get:function(){return this._com}}]),e}(aFt);!function(t){t[t.RO_XYZ=0]="RO_XYZ",t[t.RO_XZY=1]="RO_XZY",t[t.RO_YXZ=2]="RO_YXZ",t[t.RO_YZX=3]="RO_YZX",t[t.RO_ZXY=4]="RO_ZXY",t[t.RO_ZYX=5]="RO_ZYX"}($Nt||($Nt={})),function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.Z=2]="Z",t[t.TWIST=3]="TWIST",t[t.SWING1=4]="SWING1",t[t.SWING2=5]="SWING2"}(tFt||(tFt={}));var cFt=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 xEt.LOCKED:eRt.Generic6DofSpring2Constraint_setLimit(this._impl,e,0,0);break;case xEt.LIMITED:eRt.Generic6DofSpring2Constraint_setLimit(this._impl,e,i,n);break;case xEt.FREE:eRt.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],o=0,a=0;switch(t){case 0:case 1:case 2:mn.toArray(r,i.lower),mn.toArray(s,i.upper),a=r[t],o=s[t];break;case 3:a=-(o=.5*Vi(n.twistExtent));break;case 4:a=-(o=.5*Vi(n.swingExtent1));break;case 5:a=-(o=.5*Vi(n.swingExtent2));break;default:z("idx should be in [0, 5], but give "+t)}this._setLimit(e,t,a,o)},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,tFt.TWIST,.5*-Vi(t),.5*Vi(t)),this._setLimit(n.swingMotion1,tFt.SWING1,.5*-Vi(e),.5*Vi(e)),this._setLimit(n.swingMotion2,tFt.SWING2,.5*-Vi(i),.5*Vi(i))},i.setSwingSoftConstraint=function(t){eRt.Generic6DofSpring2Constraint_enableSpring(this._impl,tFt.SWING1,t),eRt.Generic6DofSpring2Constraint_enableSpring(this._impl,tFt.SWING2,t)},i.setTwistSoftConstraint=function(t){eRt.Generic6DofSpring2Constraint_enableSpring(this._impl,tFt.TWIST,t)},i.setLinearSoftConstraint=function(t){eRt.Generic6DofSpring2Constraint_enableSpring(this._impl,tFt.X,t),eRt.Generic6DofSpring2Constraint_enableSpring(this._impl,tFt.Y,t),eRt.Generic6DofSpring2Constraint_enableSpring(this._impl,tFt.Z,t)},i.setLinearStiffness=function(t){eRt.Generic6DofSpring2Constraint_setStiffness(this._impl,tFt.X,t),eRt.Generic6DofSpring2Constraint_setStiffness(this._impl,tFt.Y,t),eRt.Generic6DofSpring2Constraint_setStiffness(this._impl,tFt.Z,t)},i.setLinearDamping=function(t){eRt.Generic6DofSpring2Constraint_setDamping(this._impl,tFt.X,t),eRt.Generic6DofSpring2Constraint_setDamping(this._impl,tFt.Y,t),eRt.Generic6DofSpring2Constraint_setDamping(this._impl,tFt.Z,t)},i.setLinearRestitution=function(t){eRt.Generic6DofSpring2Constraint_setBounce(this._impl,tFt.X,t),eRt.Generic6DofSpring2Constraint_setBounce(this._impl,tFt.Y,t),eRt.Generic6DofSpring2Constraint_setBounce(this._impl,tFt.Z,t)},i.setSwingStiffness=function(t){eRt.Generic6DofSpring2Constraint_setStiffness(this._impl,tFt.SWING1,t),eRt.Generic6DofSpring2Constraint_setStiffness(this._impl,tFt.SWING2,t)},i.setSwingDamping=function(t){eRt.Generic6DofSpring2Constraint_setDamping(this._impl,tFt.SWING1,t),eRt.Generic6DofSpring2Constraint_setDamping(this._impl,tFt.SWING2,t)},i.setSwingRestitution=function(t){eRt.Generic6DofSpring2Constraint_setBounce(this._impl,tFt.SWING1,t),eRt.Generic6DofSpring2Constraint_setBounce(this._impl,tFt.SWING2,t)},i.setTwistStiffness=function(t){eRt.Generic6DofSpring2Constraint_setStiffness(this._impl,tFt.TWIST,t)},i.setTwistDamping=function(t){eRt.Generic6DofSpring2Constraint_setDamping(this._impl,tFt.TWIST,t)},i.setTwistRestitution=function(t){eRt.Generic6DofSpring2Constraint_setBounce(this._impl,tFt.TWIST,t)},i.setDriverMode=function(t,e){e===wEt.DISABLED?eRt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!1):e===wEt.SERVO?(eRt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),eRt.Generic6DofSpring2Constraint_setServo(this._impl,t,!0)):e===wEt.INDUCTION&&(eRt.Generic6DofSpring2Constraint_enableMotor(this._impl,t,!0),eRt.Generic6DofSpring2Constraint_setServo(this._impl,t,!1))},i._updateMotorTargetAndVelocity=function(t){var e=wEt.DISABLED,i=0,n=0,r=0,s=this.constraint.linearDriverSettings,o=this.constraint.angularDriverSettings;switch(t){case 0:i=tFt.X,e=s.xDrive,n=s.targetPosition.x,r=-s.targetVelocity.x;break;case 1:i=tFt.Y,e=s.yDrive,n=s.targetPosition.y,r=-s.targetVelocity.y;break;case 2:i=tFt.Z,e=s.zDrive,n=s.targetPosition.z,r=-s.targetVelocity.z;break;case 3:i=tFt.TWIST,e=o.twistDrive,n=-Vi(o.targetOrientation.x),r=-Vi(o.targetVelocity.x);break;case 4:i=tFt.SWING1,e=o.swingDrive1,n=-Vi(o.targetOrientation.y),r=-Vi(o.targetVelocity.y);break;case 5:i=tFt.SWING2,e=o.swingDrive2,n=-Vi(o.targetOrientation.z),r=-Vi(o.targetVelocity.z)}var a=t>2?o.strength:s.strength;eRt.Generic6DofSpring2Constraint_setServoTarget(this._impl,i,n),e===wEt.SERVO?t>2?eRt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,-n*a*.1):eRt.Generic6DofSpring2Constraint_setTargetVelocity(this._impl,i,n*a*.1):e===wEt.INDUCTION&&eRt.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){eRt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,tFt.X,t),eRt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,tFt.Y,t),eRt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,tFt.Z,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){eRt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,tFt.TWIST,t),eRt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,tFt.SWING1,t),eRt.Generic6DofSpring2Constraint_setMaxMotorForce(this._impl,tFt.SWING2,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=MRt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),ZRt.instance.fixedTimeStep);eRt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.setBreakTorque=function(){var t=MRt(Math.max(this.constraint.breakForce,this.constraint.breakTorque),ZRt.instance.fixedTimeStep);eRt.TypedConstraint_setMaxImpulseThreshold(this._impl,t)},i.onComponentSet=function(){var t=this.constraint.connectedBody,e=this._rigidBody.body.impl,i=t&&t.body.impl||eRt.TypedConstraint_getFixedBody(),n=oRt.instance.BT_TRANSFORM_0,r=oRt.instance.BT_TRANSFORM_1;this._impl=eRt.Generic6DofSpring2Constraint_new(e,i,n,r,$Nt.RO_YZX);var s=this.constraint.linearLimitSettings,o=this.constraint.angularLimitSettings;this.setConstraintMode(0,s.xMotion),this.setConstraintMode(1,s.yMotion),this.setConstraintMode(2,s.zMotion),this.setConstraintMode(3,o.twistMotion),this.setConstraintMode(4,o.swingMotion1),this.setConstraintMode(5,o.swingMotion2),this.setLinearSoftConstraint(s.enableSoftConstraint),this.setLinearStiffness(s.stiffness),this.setLinearDamping(s.damping),this.setLinearRestitution(s.restitution),this.setSwingSoftConstraint(o.enableSoftConstraintSwing),this.setSwingRestitution(o.swingRestitution),this.setSwingStiffness(o.swingStiffness),this.setSwingDamping(o.swingDamping),this.setTwistSoftConstraint(o.enableSoftConstraintTwist),this.setTwistRestitution(o.twistRestitution),this.setTwistStiffness(o.twistStiffness),this.setTwistDamping(o.twistDamping);var a=this.constraint.linearDriverSettings,h=this.constraint.angularDriverSettings;this.setDriverMode(0,a.xDrive),this.setDriverMode(1,a.yDrive),this.setDriverMode(2,a.zDrive),this.setDriverMode(3,h.twistDrive),this.setDriverMode(4,h.swingDrive1),this.setDriverMode(5,h.swingDrive2),this.setLinearMotorTarget(a.targetPosition),this.setLinearMotorVelocity(a.targetVelocity),this.setLinearMotorForceLimit(a.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=aRt,n=lRt,r=cRt,s=oRt.instance.BT_TRANSFORM_0;mn.multiply(i,e.worldScale,t.pivotA),xRt(eRt.Transform_getOrigin(s),i);var o=oRt.instance.BT_QUAT_0,a=t.axis,h=t.secondaryAxis,u=mn.cross(hRt,a,h);Vn.set(_Rt,a.x,a.y,a.z,0,h.x,h.y,h.z,0,u.x,u.y,u.z,0,0,0,0,1).getRotation(n),DRt(o,n),eRt.Transform_setRotation(s,o);var l=oRt.instance.BT_TRANSFORM_1,c=this.constraint.connectedBody;c?(In.multiply(n,e.worldRotation,n),In.invert(r,c.node.worldRotation),In.multiply(n,r,n),t.autoPivotB?(mn.multiply(i,t.node.worldScale,t.pivotA),mn.transformQuat(i,i,e.worldRotation),mn.add(i,i,t.node.worldPosition),mn.subtract(i,i,c.node.worldPosition),mn.transformQuat(i,i,r)):mn.multiply(i,c.node.worldScale,t.pivotB)):(mn.multiply(i,e.worldScale,t.pivotA),mn.transformQuat(i,i,e.worldRotation),mn.add(i,i,e.worldPosition),In.multiply(n,e.worldRotation,n)),xRt(eRt.Transform_getOrigin(l),i),DRt(o,n),eRt.Transform_setRotation(l,o),eRt.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}(aFt),_Ft=new mn(0,0,0),fFt=new mn(0,0,0);new mn(0,0,0);var dFt=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=REt.DEFAULT,this._collisionFilterMask=-1,this.id=t.idCounter++,this.wrappedWorld=ZRt.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=ZRt.instance.collisionMatrix[e];return this._collisionFilterGroup=e,this._collisionFilterMask=i,this.onComponentSet(),0!==this._impl||(z("[Physics]: Initialize BulletCharacterController failed"),!1)},e.setWrapper=function(){oRt.setWrapper(this._impl,iRt.CCT_CACHE_NAME,this);var t=eRt.CharacterController_getCollisionShape(this.impl);oRt.setWrapper(t,iRt.CCT_CACHE_NAME,this)},e.onEnable=function(){this._isEnabled=!0,this._impl||this.onComponentSet(),this.setDetectCollisions(!1),this.setOverlapRecovery(!0),ZRt.instance.physicsWorld.addCCT(this),this.setWrapper()},e.onDisable=function(){this._isEnabled=!1,this.wrappedWorld.removeCCT(this),this.onDestroy()},e.onDestroy=function(){eRt._safe_delete(this._impl,QDt.EBulletTypeCharacterController),oRt.delWrapper(this._impl,iRt.CCT_CACHE_NAME),this._impl=0},e.onLoad=function(){},e.getPosition=function(t){this._impl&&wRt(t,eRt.CharacterController_getPosition(this.impl))},e.setPosition=function(t){this._impl&&(xRt(eRt.CharacterController_getPosition(this.impl),t),this.syncPhysicsToScene())},e.setContactOffset=function(t){this._impl&&eRt.CharacterController_setContactOffset(this._impl,t)},e.setStepOffset=function(t){this._impl&&eRt.CharacterController_setStepOffset(this._impl,t)},e.setSlopeLimit=function(t){this._impl&&eRt.CharacterController_setSlopeLimit(this._impl,Xe(t))},e.setDetectCollisions=function(t){this._impl&&eRt.CharacterController_setCollision(this.impl,t)},e.setOverlapRecovery=function(t){this._impl&&eRt.CharacterController_setOverlapRecovery(this.impl,t)},e.onGround=function(){return(4&this._btCollisionFlags)>0},e.syncSceneToPhysics=function(){var t=this.characterController.node;t.hasChangedFlags&&(t.hasChangedFlags&Om.SCALE&&this.syncScale(),t.hasChangedFlags&Om.POSITION&&(mn.add(_Ft,t.worldPosition,this.scaledCenter),this.setPosition(_Ft)))},e.syncPhysicsToScene=function(){this.getPosition(_Ft),_Ft.subtract(this.scaledCenter),this._comp.node.setWorldPosition(_Ft)},e.syncScale=function(){this.updateScale()},e.move=function(t,e,i){if(this._isEnabled){var n=oRt.instance.BT_V3_0;eRt.Vec3_set(n,t.x,t.y,t.z),this._btCollisionFlags=eRt.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&&(ZRt.instance.physicsWorld.removeCCT(this),ZRt.instance.physicsWorld.addCCT(this),this._dirty=!1)},e.onShapeHitExt=function(t){var e=eRt.ControllerShapeHit_getHitShape(t),i=ZRt.instance.physicsWorld;i.cctShapeEventDic.get(this.impl,e);var n=new mn;wRt(n,eRt.ControllerHit_getHitWorldPos(t));var r=new mn;wRt(r,eRt.ControllerHit_getHitWorldNormal(t));var s=new mn;wRt(s,eRt.ControllerHit_getHitMotionDir(t));var o=eRt.ControllerHit_getHitMotionLength(t),a=oRt.getWrapper(e,kNt.TYPE);a&&i.cctShapeEventDic.set(this.impl,e,{BulletCharacterController:this,BulletShape:a,worldPos:n,worldNormal:r,motionDir:s,motionLength:o})},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 mn.multiply(fFt,this._comp.center,this._comp.node.worldScale),fFt}}]),t}();dFt.idCounter=0;var pFt,mFt,gFt,yFt,vFt,SFt,AFt,TFt,bFt=new mn(0,0,0),EFt=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(bFt),bFt.add(this.scaledCenter);var t=oRt.instance.BT_V3_0;eRt.Vec3_set(t,bFt.x,bFt.y,bFt.z);var e=mn.UNIT_Y,i=oRt.instance.BT_V3_1;eRt.Vec3_set(i,e.x,e.y,e.z);var n=eRt.ControllerHitReport.implement(MNt).$$.ptr,r=ZRt.instance.physicsWorld,s=eRt.CapsuleCharacterControllerDesc_new(Xe(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.radius,this.component.height);this._impl=eRt.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*$i(t.x,t.z),i=this.component.height*Math.abs(t.y);eRt.CapsuleCharacterController_setRadius(this.impl,e),eRt.CapsuleCharacterController_setHeight(this.impl,i),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(dFt),CFt=new mn(0,0,0),xFt=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(CFt),CFt.add(this.scaledCenter);var t=oRt.instance.BT_V3_0;eRt.Vec3_set(t,CFt.x,CFt.y,CFt.z);var e=mn.UNIT_Y,i=oRt.instance.BT_V3_1;eRt.Vec3_set(i,e.x,e.y,e.z);var n=eRt.ControllerHitReport.implement(MNt).$$.ptr,r=ZRt.instance.physicsWorld,s=eRt.BoxCharacterControllerDesc_new(Xe(this.component.slopeLimit),this.component.stepOffset,this.component.skinWidth,i,t,n,this.component.halfHeight,this.component.halfSideExtent,this.component.halfForwardExtent);this._impl=eRt.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;eRt.BoxCharacterController_setHalfSideExtent(this.impl,this.component.halfSideExtent*t.x),eRt.BoxCharacterController_setHalfHeight(this.impl,this.component.halfHeight*t.y),eRt.BoxCharacterController_setHalfForwardExtent(this.impl,this.component.halfForwardExtent*t.z),this._dirty=!0},n(e,[{key:"component",get:function(){return this._comp}}]),e}(dFt);MM.once(IM.EVENT_PRE_SUBSYSTEM_INIT,(function(){GDt.register("bullet",{PhysicsWorld:qNt,RigidBody:INt,BoxShape:KNt,SphereShape:QNt,CapsuleShape:ZNt,TrimeshShape:eFt,CylinderShape:iFt,ConeShape:nFt,TerrainShape:rFt,SimplexShape:sFt,PlaneShape:oFt,PointToPointConstraint:hFt,HingeConstraint:lFt,FixedConstraint:uFt,ConfigurableConstraint:cFt,BoxCharacterController:xFt,CapsuleCharacterController:EFt})})),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CYLINDER=2]="CYLINDER",t[t.CONE=3]="CONE",t[t.CAPSULE=4]="CAPSULE",t[t.TORUS=5]="TORUS",t[t.PLANE=6]="PLANE",t[t.QUAD=7]="QUAD"}(TFt||(TFt={})),xe(TFt);var wFt=t("fW",(pFt=Ta("cc.Primitive"),mFt=eh(TFt),pFt(((AFt=function(t){function e(e){var i;return void 0===e&&(e=TFt.BOX),(i=t.call(this)||this).type=vFt&&vFt(),i.info=SFt&&SFt(),i.type=e,i}return s(e,t),e.prototype.onLoaded=function(){dP(Qq[TFt[this.type].toLowerCase()](this.info),this)},e}(rP)).PrimitiveType=TFt,vFt=fa((yFt=AFt).prototype,"type",[mFt],(function(){return TFt.BOX})),SFt=fa(yFt.prototype,"info",[Ma],(function(){return{}})),gFt=yFt))||gFt));v.Primitive=wFt,v.primitives=Qq;var DFt,RFt=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}(),IFt=Ta("cc.PerfCounter")(DFt=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}(RFt))||DFt,MFt="0123456789. ",PFt=500,BFt={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},OFt={fps:{desc:"Framerate (FPS)",below:30,average:PFt,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:PFt},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:PFt,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:PFt},render:{desc:"Renderer (ms)",min:0,max:50,average:PFt,color:"#f90"},present:{desc:"Present (ms)",min:0,max:50,average:PFt,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},LFt=t("fX",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 y_,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(OFt).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=A.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(){Me.querySettings(Re.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),v.director.off(v.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),v.director.off(v.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),v.director.off(v.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),v.director.off(v.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),v.director.off(v.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),v.director.off(v.Director.EVENT_AFTER_RENDER,this.afterRender,this),v.director.off(v.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!1,FI.root.pipeline.profiler=null,v.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=v.director.root;this._device=nd.gfxDevice,this._swapchain=t.mainWindow.swapchain}this.generateCanvas(),this.generateStats(),v.game.once(v.Game.EVENT_ENGINE_INITED,this.generateNode,this),v.game.on(v.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),v.director.on(v.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),v.director.on(v.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),v.director.on(v.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),v.director.on(v.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),v.director.on(v.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),v.director.on(v.Director.EVENT_AFTER_RENDER,this.afterRender,this),v.director.on(v.Director.EVENT_AFTER_DRAW,this.afterPresent,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,v.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=280,this._canvas.height=280,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new R_(Dc.TEX2D,Rc.SAMPLED|Rc.TRANSFER_DST,Ac.RGBA8,280,280)),this._region.texExtent.width=280,this._region.texExtent.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 OFt){var n=OFt[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new IFt(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r<MFt.length;++r){var s=this._ctx.measureText(MFt[r]).width;this._eachNumWidth=Math.max(this._eachNumWidth,s)}for(var o=0;o<MFt.length;++o)this._ctx.fillText(MFt[o],o*this._eachNumWidth,this._totalLines*this._lineHeight);this._eachNumWidth/=this._canvas.width,this._profilerStats=OFt,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 xg("PROFILER_NODE"),this._rootNode._objFlags=v.Object.Flags.DontSave|v.Object.Flags.HideInHierarchy,v.game.addPersistRootNode(this._rootNode);var t=new xg("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,o=[0,e,0,n,e,0,n,0,0,0,0,0],a=[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++){o.push(n+c*s,e-l*i,0),o.push(n+(c+1)*s,e-l*i,0),o.push(n+(c+1)*s,e-(l+1)*i,0),o.push(n+c*s,e-(l+1)*i,0),u=4*(8*l+c+1),a.push(0+u,2+u,1+u,0+u,3+u,2+u);var _=8*l+c,f=Math.floor(_/4),d=_-4*f;h.push(0,this._wordHeight,f,d),h.push(this._eachNumWidth,this._wordHeight,f,d),h.push(this._eachNumWidth,1,f,d),h.push(0,1,f,d)}this._meshRenderer=t.addComponent(YH),this._meshRenderer.mesh=dP({positions:o,indices:a,colors:h});var p=new oT;p.initialize({effectName:"util/profiler"});var m=this.pass=p.passes[0],g=m.getBinding("mainTexture"),y=m.getBinding("digits"),S=m.getBinding("offset");m.bindTexture(g,this._texture),this.digitsData=m.blocks[y],this.offsetData=m.blocks[S],this.offsetData[3]=-1,this._meshRenderer.material=p,this._meshRenderer.node.layer=Pm.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();v.director.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=kn[t],n=-.9,r=-.9*e;Uo.isXR&&(n=-.5,r=-.5*e),this.offsetData[0]=n*i[0]+r*i[2],this.offsetData[1]=n*i[1]+r*i[3],this.offsetData[2]=this._eachNumWidth,this.offsetData[3]=t}this.pass.setRootBufferDirty(!0),this._meshRenderer.model?FI.root.pipeline.profiler=this._meshRenderer.model:FI.root.pipeline.profiler=null;var s=performance.now();this._profilerStats.render.counter.start(s)}},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<PFt)){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 o=s.counter.human().toString(),a=7;a>=0;a--){var h=8*i+a,u=o[o.length-(8-a)],l=BFt[u];void 0===l&&(l=11),n[h]=l}i++}}}},n(e,[{key:"_stats",get:function(){return $(16381),this._profilerStats}},{key:"stats",get:function(){return this._profilerStats}}]),e}(Jl)),NFt=t("fY",new LFt);FI.registerSystem("profiler",NFt,0),v.profiler=NFt;var FFt=function(){function t(t){this.jointTexturePool=void 0,this.jointAnimationInfo=void 0,this.jointTexturePool=new JX(t),this.jointAnimationInfo=new $X(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}();v.internal.DataPoolManager=FFt;var kFt,VFt,GFt,UFt,zFt,HFt,WFt,jFt,XFt,YFt,qFt,KFt,QFt,ZFt,JFt,$Ft=new Vn,tkt=new Vn,ekt=t("f_",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=v.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=kX.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=kX.getOrExtract(this.clip),o=n.path,a=s.joints[o],h=r,u=void 0;!a;){var l=o.lastIndexOf("/");if(o=o.substring(0,l),a=s.joints[o],h&&(u||(u=Vn.identity(tkt)),Vn.fromRTS($Ft,h.rotation,h.position,h.scale),Vn.multiply(u,$Ft,u),h=h.parent),l<0)break}for(var c=a&&a.transforms,_=s.frames,f=[],d=0;d<_;d++){var p;p=c&&u?Vn.multiply($Ft,c[d],u):c?c[d]:u||new Vn;var m={pos:new mn,rot:new In,scale:new mn};Vn.toRTS(p,m.rot,m.pos,m.scale),f.push(m)}this._sockets.push({target:n.target,frames:f})}}},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 o=this._sockets[s],a=o.target,h=o.frames[r],u=h.pos,l=h.rot,c=h.scale;a.setRTS(l,u,c)}}},e}(UK)),ikt=t("f$",(kFt=Ta("cc.SkeletalAnimation.Socket"),VFt=eh(xg),kFt((UFt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=zFt&&zFt(),this.target=HFt&&HFt(),this.path=t,this.target=e},zFt=fa(UFt.prototype,"path",[Ma],(function(){return""})),HFt=fa(UFt.prototype,"target",[VFt],(function(){return null})),GFt=UFt))||GFt));ie(ikt,"cc.SkeletalAnimationComponent.Socket");var nkt=new Vn,rkt=new Vn;function skt(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),skt(r,s,i)}}return i}var okt,akt=t("g0",(WFt=Ta("cc.SkeletalAnimation"),jFt=Ea(99),XFt=eh([ikt]),YFt=eh([ikt]),WFt(qFt=jFt(((JFt=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=QFt&&QFt(),e._sockets=ZFt&&ZFt(),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(QY),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),v.director.root.dataPoolManager.jointAnimationInfo.destroy(this.node.uuid),FK().removeSockets(this.node,this._sockets),this._removeAllUsers()},i.onEnable=function(){var e;t.prototype.onEnable.call(this),null===(e=this._currentBakedState)||void 0===e||e.resume()},i.onDisable=function(){var e;t.prototype.onDisable.call(this),null===(e=this._currentBakedState)||void 0===e||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)||void 0===e||e.pause():t.prototype.pause.call(this)},i.resume=function(){var e;this._useBakedEffectively?null===(e=this._currentBakedState)||void 0===e||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(kX.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),skt(r,n,e))}return e},i.rebuildSocketAnimations=function(){for(var t,e=f(this._sockets);!(t=e()).done;){var i=t.value,n=this.node.getChildByPath(i.path),r=i.target;n&&r&&(r.name=i.path.substring(i.path.lastIndexOf("/")+1)+" Socket",r.parent=this.node,GX(n,this.node,nkt),Vn.fromRTS(rkt,r.rotation,r.position,r.scale),Vn.equals(rkt,nkt)||(r.matrix=nkt))}for(var s=0,o=Object.keys(this._nameToState);s<o.length;s++){var a=o[s];this._nameToState[a].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 U("illegal socket path"),null;var i=new xg;return i.parent=this.node,this._sockets.push(new ikt(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 ekt(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?FK().removeSockets(this.node,this._sockets):(FK().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=FK();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}(v9)).Socket=ikt,m((KFt=JFt).prototype,"sockets",[XFt],Object.getOwnPropertyDescriptor(KFt.prototype,"sockets"),KFt.prototype),QFt=fa(KFt.prototype,"_useBakedAnimation",[Ma],(function(){return!0})),ZFt=fa(KFt.prototype,"_sockets",[YFt],(function(){return[]})),qFt=KFt))||qFt)||qFt));v.SkeletalAnimationComponent=akt,ie(akt,"cc.SkeletalAnimationComponent"),function(t){var e,i,n,r,s,o,a,h;(e=t.MixBlend||(t.MixBlend={}))[e.setup=0]="setup",e[e.first=1]="first",e[e.replace=2]="replace",e[e.add=3]="add",(i=t.MixDirection||(t.MixDirection={}))[i.mixIn=0]="mixIn",i[i.mixOut=1]="mixOut",function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(t.TimelineType||(t.TimelineType={})),function(t){t[t.start=0]="start",t[t.interrupt=1]="interrupt",t[t.end=2]="end",t[t.dispose=3]="dispose",t[t.complete=4]="complete",t[t.event=5]="event"}(t.EventType||(t.EventType={})),function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(t.BlendMode||(t.BlendMode={})),(n=t.TransformMode||(t.TransformMode={}))[n.Normal=0]="Normal",n[n.OnlyTranslation=1]="OnlyTranslation",n[n.NoRotationOrReflection=2]="NoRotationOrReflection",n[n.NoScale=3]="NoScale",n[n.NoScaleOrReflection=4]="NoScaleOrReflection",(r=t.PositionMode||(t.PositionMode={}))[r.Fixed=0]="Fixed",r[r.Percent=1]="Percent",(s=t.SpacingMode||(t.SpacingMode={}))[s.Length=0]="Length",s[s.Fixed=1]="Fixed",s[s.Percent=2]="Percent",(o=t.RotateMode||(t.RotateMode={}))[o.Tangent=0]="Tangent",o[o.Chain=1]="Chain",o[o.ChainScale=2]="ChainScale",(a=t.TextureFilter||(t.TextureFilter={}))[a.Nearest=9728]="Nearest",a[a.Linear=9729]="Linear",a[a.MipMap=9987]="MipMap",a[a.MipMapNearestNearest=9984]="MipMapNearestNearest",a[a.MipMapLinearNearest=9985]="MipMapLinearNearest",a[a.MipMapNearestLinear=9986]="MipMapNearestLinear",a[a.MipMapLinearLinear=9987]="MipMapLinearLinear",(h=t.TextureWrap||(t.TextureWrap={}))[h.MirroredRepeat=33648]="MirroredRepeat",h[h.ClampToEdge=33071]="ClampToEdge",h[h.Repeat=10497]="Repeat",function(t){t[t.Region=0]="Region",t[t.BoundingBox=1]="BoundingBox",t[t.Mesh=2]="Mesh",t[t.LinkedMesh=3]="LinkedMesh",t[t.Path=4]="Path",t[t.Point=5]="Point",t[t.Clipping=6]="Clipping"}(t.AttachmentType||(t.AttachmentType={}))}(okt||(okt={}));var hkt=okt;function ukt(t,e){return t?e===t.length?t:e<t.length?t.slice(0,e):new Array(e):new Array(e)}function lkt(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=ukt(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}var ckt=null,_kt=[];MM.onPostInfrastructureInitDelegate.add((function(){return jM().then((function(){return Promise.all([e.import("./spine.wasm-8096fadd.js"),e.import("./spine-d11505f0.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){WM(i,t).then((function(t){e(t.instance,t.module)})).catch((function(t){return n(r(t))}))}}).then((function(t){ckt=t,_kt.forEach((function(t){t(ckt)}))})).then(t).catch((function(t){return n(r(t))}))}));var e,i}))})).catch((function(t){z(t)}))})),_kt.push((function(t){var e;!function(t){hkt.wasmUtil=t.SpineWasmUtil,hkt.wasmUtil.wasm=t,hkt.wasmUtil.spineWasmInit(),hkt.SPVectorFloat=t.SPVectorFloat,hkt.MathUtils=t.MathUtils,hkt.Color=t.Color,hkt.String=t.String,hkt.Vector2=t.Vector2,hkt.Interpolation=t.Interpolation,hkt.Triangulator=t.Triangulator,hkt.ConstraintData=t.ConstraintData,hkt.IkConstraintData=t.IkConstraintData,hkt.PathConstraintData=t.PathConstraintData,hkt.SkeletonBounds=t.SkeletonBounds,hkt.Event=t.Event,hkt.EventData=t.EventData,hkt.Attachment=t.Attachment,hkt.VertexAttachment=t.VertexAttachment,hkt.BoundingBoxAttachment=t.BoundingBoxAttachment,hkt.ClippingAttachment=t.ClippingAttachment,hkt.MeshAttachment=t.MeshAttachment,hkt.PathAttachment=t.PathAttachment,hkt.PointAttachment=t.PointAttachment,hkt.RegionAttachment=t.RegionAttachment,hkt.AtlasAttachmentLoader=t.AtlasAttachmentLoader,hkt.TextureAtlasPage=t.TextureAtlasPage,hkt.TextureAtlasRegion=t.TextureAtlasRegion,hkt.TextureAtlas=t.TextureAtlas,hkt.PowOut=t.PowOut,hkt.BoneData=t.BoneData,hkt.SlotData=t.SlotData,hkt.Updatable=t.Updatable,hkt.IkConstraint=t.IkConstraint,hkt.PathConstraint=t.PathConstraint,hkt.TransformConstraintData=t.TransformConstraintData,hkt.TransformConstraint=t.TransformConstraint,hkt.Bone=t.Bone,hkt.Slot=t.Slot,hkt.Skin=t.Skin,hkt.SkinEntry=t.SkinEntry,hkt.SkeletonClipping=t.SkeletonClipping,hkt.SkeletonData=t.SkeletonData,hkt.TranslateTimeline=t.TranslateTimeline,hkt.ScaleTimeline=t.ScaleTimeline,hkt.ShearTimeline=t.ShearTimeline,hkt.RotateTimeline=t.RotateTimeline,hkt.ColorTimeline=t.ColorTimeline,hkt.TwoColorTimeline=t.TwoColorTimeline,hkt.AttachmentTimeline=t.AttachmentTimeline,hkt.DeformTimeline=t.DeformTimeline,hkt.EventTimeline=t.EventTimeline,hkt.DrawOrderTimeline=t.DrawOrderTimeline,hkt.IkConstraintTimeline=t.IkConstraintTimeline,hkt.TransformConstraintTimeline=t.TransformConstraintTimeline,hkt.PathConstraintPositionTimeline=t.PathConstraintPositionTimeline,hkt.PathConstraintMixTimeline=t.PathConstraintMixTimeline,hkt.TrackEntry=t.TrackEntry,hkt.AnimationStateData=t.AnimationStateData,hkt.AnimationState=t.AnimationState,hkt.Animation=t.Animation,hkt.EventQueue=t.EventQueue,hkt.AnimationStateAdapter=t.AnimationStateAdapter,hkt.Skeleton=t.Skeleton,hkt.SkeletonBinary=t.SkeletonBinary,hkt.SkeletonJson=t.SkeletonJson,hkt.VertexEffect=t.VertexEffect,hkt.JitterEffect=t.JitterEffect,hkt.SwirlEffect=t.SwirlEffect,hkt.SkeletonInstance=t.SkeletonInstance,hkt.SkeletonSystem=t.SkeletonSystem}(t),[{proto:e=hkt.String.prototype,property:"length",getter:e.length},{proto:e,property:"isEmpty",getter:e.isEmpty},{proto:e,property:"str",getter:e.str}].forEach((function(t){Pt(t.proto,t.property,t.getter)})),function(t,e){Object.defineProperty(t,"strPtr",{value:function(){var t=e.call(this),i=hkt.wasmUtil.wasm.HEAPU8,n=this.length,r=i.subarray(t,t+n);return String.fromCharCode.apply(String,r)}})}(e,e.strPtr),function(){var t=hkt.Vector2.prototype;[{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY}].forEach((function(t){Pt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.BoneData.prototype;[{proto:t,property:"index",getter:t.getIndex},{proto:t,property:"name",getter:t.getName},{proto:t,property:"parent",getter:t.getParent},{proto:t,property:"length",getter:t.getLength,setter:t.setLength},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"shearX",getter:t.getShearX,setter:t.setShearX},{proto:t,property:"shearY",getter:t.getShearY,setter:t.setShearY},{proto:t,property:"transformMode",getter:t.getTransformMode,setter:t.setTransformMode},{proto:t,property:"skinRequired",getter:t.getSkinRequired,setter:t.setSkinRequired}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.ConstraintData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"order",getter:t.getOrder,setter:t.setOder},{proto:t,property:"skinRequired",getter:t.getSkinRequired,setter:t.setSkinRequired}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.IkConstraintData.prototype;[{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"bendDirection",getter:t.getBendDirection,setter:t.setBendDirection},{proto:t,property:"compress",getter:t.getCompress,setter:t.setCompress},{proto:t,property:"stretch",getter:t.getStretch,setter:t.setStretch},{proto:t,property:"uniform",getter:t.getUniform,setter:t.setUniform},{proto:t,property:"mix",getter:t.getMix,setter:t.setMix},{proto:t,property:"softness",getter:t.getSoftness,setter:t.setSoftness}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones")}(),function(){var t=hkt.PathConstraintData.prototype;[{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"positionMode",getter:t.getPositionMode,setter:t.setPositionMode},{proto:t,property:"spacingMode",getter:t.getSpacingMode,setter:t.setSpacingMode},{proto:t,property:"rotateMode",getter:t.getRotateMode,setter:t.setRotateMode},{proto:t,property:"offsetRotation",getter:t.getOffsetRotation,setter:t.setOffsetRotation},{proto:t,property:"position",getter:t.getPosition,setter:t.setPosition},{proto:t,property:"spacing",getter:t.getSpacing,setter:t.setSpacing},{proto:t,property:"rotateMix",getter:t.getRotateMix,setter:t.setRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix,setter:t.setTranslateMix}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones")}(),function(){var t=hkt.Event.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"intValue",getter:t.getIntValue,setter:t.setIntValue},{proto:t,property:"floatValue",getter:t.getFloatValue,setter:t.setFloatValue},{proto:t,property:"stringValue",getter:t.getStringValue,setter:t.setStringValue},{proto:t,property:"time",getter:t.getTime},{proto:t,property:"volume",getter:t.getVolume,setter:t.setVolume},{proto:t,property:"balance",getter:t.getBalance,setter:t.setBalance}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.EventData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"intValue",getter:t.getIntValue,setter:t.setIntValue},{proto:t,property:"floatValue",getter:t.getFloatValue,setter:t.setFloatValue},{proto:t,property:"stringValue",getter:t.getStringValue,setter:t.setStringValue},{proto:t,property:"audioPath",getter:t.getAudioPath,setter:t.setAudioPath},{proto:t,property:"volume",getter:t.getVolume,setter:t.setVolume},{proto:t,property:"balance",getter:t.getBalance,setter:t.setBalance}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.BoundingBoxAttachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){Mt(t.proto,t.property,t.getter)}))}(),function(){var t=hkt.ClippingAttachment.prototype;[{proto:t,property:"endSlot",getter:t.getEndSlot,setter:t.setEndSlot}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.MeshAttachment.prototype;[{proto:t,property:"path",getter:t.getPath,setter:t.setPath},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"width",getter:t.getWidth,setter:t.setWidth},{proto:t,property:"height",getter:t.getHeight,setter:t.setHeight},{proto:t,property:"hullLength",getter:t.getHullLength,setter:t.setHullLength}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getRegionUVs,"regionUVs"),lkt(t,t.getUVs,"uvs"),lkt(t,t.getTriangles,"triangles"),lkt(t,t.getEdges,"edges")}(),function(){var t=hkt.PathAttachment.prototype;[{proto:t,property:"closed",getter:t.getClosed,setter:t.setClosed},{proto:t,property:"constantSpeed",getter:t.getConstantSpeed,setter:t.setConstantSpeed}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getLengths,"lengths")}(),function(){var t=hkt.PointAttachment.prototype;[{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.RegionAttachment.prototype;[{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation},{proto:t,property:"width",getter:t.getWidth,setter:t.setWidth},{proto:t,property:"height",getter:t.getHeight,setter:t.setHeight},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"path",getter:t.getPath,setter:t.setPath},{proto:t,property:"rendererObject",getter:t.getRendererObject}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getOffset,"offset");var e=t.getUVs,i=t.setUVs;Object.defineProperty(t,"uvs",{get:function(){var i=e.call(this),n=i.size(),r=t._uvs;r=ukt(r,n);for(var s=0;s<n;s++)r[s]=i.get(s);return t._uvs=r,r},set:function(t){i.call(this,t[0],t[1],t[2],t[3],1===t[4])}});var n=t.computeWorldVertices,r=new hkt.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,e,i,s){var o=e.length;r.resize(o,0);for(var a=0;a<o;a++)r.set(a,e[a]);n.call(this,t,r,i,s);for(var h=0;h<o;h++)e[h]=r.get(h)}})}(),function(){var t=hkt.VertexAttachment.prototype;[{proto:t,property:"id",getter:t.getId},{proto:t,property:"worldVerticesLength",getter:t.getWorldVerticesLength,setter:t.setWorldVerticesLength},{proto:t,property:"deformAttachment",getter:t.getDeformAttachment,setter:t.setDeformAttachment}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones"),lkt(t,t.getVertices,"vertices");var e=t.computeWorldVertices,i=new hkt.SPVectorFloat;Object.defineProperty(t,"computeWorldVertices",{value:function(t,n,r,s,o,a){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,o,a);for(var l=0;l<h;l++)s[l]=i.get(l)}})}(),function(){var t=hkt.SlotData.prototype;[{proto:t,property:"index",getter:t.getIndex},{proto:t,property:"boneData",getter:t.getBoneData},{proto:t,property:"name",getter:t.getName},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"darkColor",getter:t.getDarkColor},{proto:t,property:"blendMode",getter:t.getBlendMode,setter:t.setBlendMode}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.IkConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"bendDirection",getter:t.getBendDirection,setter:t.setBendDirection},{proto:t,property:"compress",getter:t.getCompress,setter:t.setCompress},{proto:t,property:"stretch",getter:t.getStretch,setter:t.setStretch},{proto:t,property:"mix",getter:t.getMix,setter:t.setMix},{proto:t,property:"softness",getter:t.getSoftness,setter:t.setSoftness},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones")}(),function(){var t=hkt.PathConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"target",getter:t.getTarget,setter:t.setTarget},{proto:t,property:"position",getter:t.getPosition,setter:t.setPosition},{proto:t,property:"spacing",getter:t.getSpacing,setter:t.setSpacing},{proto:t,property:"rotateMix",getter:t.getRotateMix,setter:t.setRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix,setter:t.setTranslateMix},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones")}(),function(){var t=hkt.TransformConstraintData.prototype;[{proto:t,property:"target",getter:t.getTarget},{proto:t,property:"rotateMix",getter:t.getRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix},{proto:t,property:"scaleMix",getter:t.getScaleMix},{proto:t,property:"shearMix",getter:t.getShearMix},{proto:t,property:"offsetRotation",getter:t.getOffsetRotation},{proto:t,property:"offsetX",getter:t.getOffsetX},{proto:t,property:"offsetY",getter:t.getOffsetY},{proto:t,property:"offsetScaleX",getter:t.getOffsetScaleX},{proto:t,property:"offsetScaleY",getter:t.getOffsetScaleY},{proto:t,property:"offsetShearY",getter:t.getOffsetShearY},{proto:t,property:"relative",getter:t.getRelative},{proto:t,property:"local",getter:t.getLocal}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getBones,"bones")}(),function(){var t=hkt.TransformConstraint.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"target",getter:t.getTarget},{proto:t,property:"rotateMix",getter:t.getRotateMix,setter:t.setRotateMix},{proto:t,property:"translateMix",getter:t.getTranslateMix,setter:t.setTranslateMix},{proto:t,property:"scaleMix",getter:t.getScaleMix,setter:t.setScaleMix},{proto:t,property:"shearMix",getter:t.getShearMix,setter:t.setShearMix},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones")}(),function(){var t=hkt.Bone.prototype;[{proto:t,property:"skeleton",getter:t.getSkeleton},{proto:t,property:"data",getter:t.getData},{proto:t,property:"parent",getter:t.getParent},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"rotation",getter:t.getRotation,setter:t.setRotation},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"shearX",getter:t.getShearX,setter:t.setShearX},{proto:t,property:"shearY",getter:t.getShearY,setter:t.setShearY},{proto:t,property:"ax",getter:t.getAX,setter:t.setAX},{proto:t,property:"ay",getter:t.getAY,setter:t.setAY},{proto:t,property:"arotation",getter:t.getARotation,setter:t.setARotation},{proto:t,property:"ascaleX",getter:t.getAScaleX,setter:t.setAScaleX},{proto:t,property:"ascaleY",getter:t.getAScaleY,setter:t.setAScaleY},{proto:t,property:"ashearX",getter:t.getAShearX,setter:t.setAShearX},{proto:t,property:"ashearY",getter:t.getAShearY,setter:t.setAShearY},{proto:t,property:"appliedValid",getter:t.getAppliedValid,setter:t.setAppliedValid},{proto:t,property:"a",getter:t.getA,setter:t.setA},{proto:t,property:"b",getter:t.getB,setter:t.setB},{proto:t,property:"c",getter:t.getC,setter:t.setC},{proto:t,property:"d",getter:t.getD,setter:t.setD},{proto:t,property:"worldX",getter:t.getWorldX,setter:t.setWorldX},{proto:t,property:"worldY",getter:t.getWorldY,setter:t.setWorldY},{proto:t,property:"active",getter:t.getActive,setter:t.setActive}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getChildren,"children")}(),function(){var t=hkt.Slot.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"bone",getter:t.getBone},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"darkColor",getter:t.getDarkColor},{proto:t,property:"skeleton",getter:t.getSkeleton}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getDeform,"deform")}(),function(){var t=hkt.Skin.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getBones,"bones"),lkt(t,t.getAttachments,"attachments"),lkt(t,t.getConstraints,"constraints"),function(t,e,i){var n="_"+i;Object.defineProperty(t,i,{value:function(){var t=e.call(this),i=t.size(),r=this[n];r=ukt(r,i);for(var s=0;s<i;s++)r[s]=t.get(s);return this[n]=r,r}})}(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(){var t=hkt.Attachment.prototype;[{proto:t,property:"name",getter:t.getName}].forEach((function(t){Mt(t.proto,t.property,t.getter)}))}(),function(){var t=hkt.SkinEntry.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"attachment",getter:t.getAttachment}].forEach((function(t){Mt(t.proto,t.property,t.getter)}))}(),function(){var t=hkt.SkeletonClipping.prototype;[{proto:t,property:"clippedVertices",getter:t.getClippedVertices},{proto:t,property:"clippedTriangles",getter:t.getClippedTriangles},{proto:t,property:"clippedUVs",getter:t.getClippedUVs}].forEach((function(t){Mt(t.proto,t.property,t.getter)}))}(),function(){var t=hkt.SkeletonData.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"defaultSkin",getter:t.getDefaultSkin,setter:t.setDefaultSkin},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY},{proto:t,property:"width",getter:t.getWidth,setter:t.setWidth},{proto:t,property:"height",getter:t.getHeight,setter:t.setHeight},{proto:t,property:"version",getter:t.getVersion,setter:t.setVersion},{proto:t,property:"hash",getter:t.getHash,setter:t.setHash},{proto:t,property:"fps",getter:t.getFps,setter:t.setFps},{proto:t,property:"imagesPath",getter:t.getImagesPath,setter:t.setImagesPath},{proto:t,property:"audioPath",getter:t.getAudioPath,setter:t.setAudioPath}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones"),lkt(t,t.getSlots,"slots"),lkt(t,t.getSkins,"skins"),lkt(t,t.getAnimations,"animations"),lkt(t,t.getEvents,"events"),lkt(t,t.getIkConstraints,"ikConstraints"),lkt(t,t.getTransformConstraints,"transformConstraints"),lkt(t,t.getPathConstraints,"pathConstraints")}(),function(){var t=hkt.RotateTimeline.prototype;[{proto:t,property:"boneIndex",getter:t.getBoneIndex}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getFrames,"frames")}(),function(){var t=hkt.ColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getFrames,"frames")}(),function(){var t=hkt.TwoColorTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){Mt(t.proto,t.property,t.getter)}))}(),function(){var t=hkt.AttachmentTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getFrames,"frames"),lkt(t,t.getAttachmentNames,"attachmentNames")}(),function(){var t=hkt.DeformTimeline.prototype;[{proto:t,property:"slotIndex",getter:t.getSlotIndex},{proto:t,property:"attachment",getter:t.getAttachment}].forEach((function(t){Mt(t.proto,t.property,t.getter)})),lkt(t,t.getFrames,"frames"),function(t,e,i){var n="_"+i;Object.defineProperty(t,i,{get:function(){var t=e.call(this),i=t.size(),r=this[n];r=ukt(r,i);for(var s=0;s<i;s++){var o=t.get(s),a=o.size(),h=r[s];h=ukt(h,a);for(var u=0;u<a;u++)h[u]=o.get(u);r[s]=h}return this[n]=r,r}})}(t,t.getFrameVertices,"frameVertices")}(),function(){var t=hkt.EventTimeline.prototype;lkt(t,t.getFrames,"frames"),lkt(t,t.getEvents,"events")}(),function(){var t=hkt.DrawOrderTimeline.prototype;lkt(t,t.getFrames,"frames")}(),function(){var t=hkt.TrackEntry.prototype;[{proto:t,property:"animation",getter:t.getAnimation},{proto:t,property:"next",getter:t.getNext},{proto:t,property:"mixingFrom",getter:t.getMixingFrom},{proto:t,property:"mixingTo",getter:t.getMixingTo},{proto:t,property:"trackIndex",getter:t.getTrackIndex},{proto:t,property:"loop",getter:t.getLoop,setter:t.setLoop},{proto:t,property:"holdPrevious",getter:t.getHoldPrevious,setter:t.setHoldPrevious},{proto:t,property:"eventThreshold",getter:t.getEventThreshold,setter:t.setEventThreshold},{proto:t,property:"attachmentThreshold",getter:t.getAttachmentThreshold,setter:t.setAttachmentThreshold},{proto:t,property:"drawOrderThreshold",getter:t.getDrawOrderThreshold,setter:t.setDrawOrderThreshold},{proto:t,property:"animationStart",getter:t.getAnimationStart,setter:t.setAnimationStart},{proto:t,property:"animationEnd",getter:t.getAnimationEnd,setter:t.setAnimationEnd},{proto:t,property:"animationLast",getter:t.getAnimationLast,setter:t.setAnimationLast},{proto:t,property:"delay",getter:t.getDelay,setter:t.setDelay},{proto:t,property:"trackTime",getter:t.getTrackTime,setter:t.setTrackTime},{proto:t,property:"trackEnd",getter:t.getTrackEnd,setter:t.setTrackEnd},{proto:t,property:"timeScale",getter:t.getTimeScale,setter:t.setTimeScale},{proto:t,property:"alpha",getter:t.getAlpha,setter:t.setAlpha},{proto:t,property:"mixTime",getter:t.getMixTime,setter:t.setMixTime},{proto:t,property:"mixDuration",getter:t.getMixDuration,setter:t.setMixDuration},{proto:t,property:"mixBlend",getter:t.getMixBlend,setter:t.setMixBlend}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.AnimationStateData.prototype;[{proto:t,property:"defaultMix",getter:t.getDefaultMix},{proto:t,property:"skeletonData",getter:t.getSkeletonData}].forEach((function(t){Mt(t.proto,t.property,t.getter)}))}(),function(){var t=hkt.AnimationState.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"timeScale",getter:t.getTimeScale,setter:t.setTimeScale}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getTracks,"tracks")}(),function(){var t=hkt.Animation.prototype;[{proto:t,property:"name",getter:t.getName},{proto:t,property:"duration",getter:t.getDuration,setter:t.setDuration}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getTimelines,"timelines")}(),function(){var t=hkt.Skeleton.prototype;[{proto:t,property:"data",getter:t.getData},{proto:t,property:"skin",getter:t.getSkin},{proto:t,property:"color",getter:t.getColor},{proto:t,property:"time",getter:t.getTime},{proto:t,property:"scaleX",getter:t.getScaleX,setter:t.setScaleX},{proto:t,property:"scaleY",getter:t.getScaleY,setter:t.setScaleY},{proto:t,property:"x",getter:t.getX,setter:t.setX},{proto:t,property:"y",getter:t.getY,setter:t.setY}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)})),lkt(t,t.getBones,"bones"),lkt(t,t.getSlots,"slots"),lkt(t,t.getDrawOrder,"drawOrder"),lkt(t,t.getIkConstraints,"ikConstraints"),lkt(t,t.getTransformConstraints,"transformConstraints"),lkt(t,t.getPathConstraints,"pathConstraints"),lkt(t,t.getUpdateCacheList,"_updateCache")}(),function(){var t=hkt.JitterEffect.prototype;[{proto:t,property:"jitterX",getter:t.getJitterX,setter:t.setJitterX},{proto:t,property:"jitterY",getter:t.getJitterY,setter:t.setJitterY}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}(),function(){var t=hkt.SwirlEffect.prototype;[{proto:t,property:"centerX",getter:t.getCenterX,setter:t.setCenterX},{proto:t,property:"centerY",getter:t.getCenterY,setter:t.setCenterY},{proto:t,property:"radius",getter:t.getRadius,setter:t.setRadius},{proto:t,property:"angle",getter:t.getAngle,setter:t.setAngle}].forEach((function(t){Mt(t.proto,t.property,t.getter,t.setter)}))}()}));var fkt,dkt=0,pkt=0,mkt=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=++pkt;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 hkt.EventType.event:s.event&&s.event(i,n);break;case hkt.EventType.start:s.start&&s.start(i);break;case hkt.EventType.interrupt:s.interrupt&&s.interrupt(i);break;case hkt.EventType.end:s.end&&s.end(i);break;case hkt.EventType.dispose:s.dispose&&s.dispose(i);break;case hkt.EventType.complete:s.complete&&s.complete(i);break;default:U("emitListener doesn't handled",r)}},t.emitTrackEntryListener=function(t,e,i,n){var r=this._trackSet.get(t);if(r)switch(n){case hkt.EventType.start:r.listener.start&&r.listener.start(e);break;case hkt.EventType.interrupt:r.listener.interrupt&&r.listener.interrupt(e);break;case hkt.EventType.end:r.listener.end&&r.listener.end(e);break;case hkt.EventType.dispose:r.listener.dispose&&r.listener.dispose(e),this._trackSet.delete(t),r.listener=null;break;case hkt.EventType.complete:r.listener.complete&&r.listener.complete(e);break;case hkt.EventType.event:r.listener.event&&r.listener.event(e,i);break;default:U("TrackEntry doesn't handled",n)}},t.addListener=function(e){var i=++dkt;return t._listenerSet.set(i,e),i},t.removeListener=function(e){t._listenerSet.delete(e)},t}();mkt._listenerSet=new Map,mkt._trackSet=new Map,globalThis.TrackEntryListeners=mkt;var gkt=1/60;jB(UB);var ykt,vkt,Skt,Akt,Tkt,bkt,Ekt,Ckt,xkt,wkt,Dkt=jB(HB),Rkt=function(){this.a=0,this.b=0,this.c=0,this.d=0,this.worldX=0,this.worldY=0},Ikt=function(){this.vCount=0,this.iCount=0,this.vData=null,this.iData=null,this.meshes=[]},Mkt=function(){this.iCount=0,this.blendMode=0,this.textureID=0},Pkt=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 hkt.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/gkt),this._maxFrameIdex<=0&&(this._maxFrameIdex=1),this._instance.setAnimation(0,t,!1)):U("find no animation named "+t+" !!!")},e.updateToFrame=function(t){if(this._inited&&(this.begin(),this.needToUpdate(t)))do{this._frameIdx++,this.totalTime+=gkt,this._instance.updateAnimation(gkt);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=Dkt/Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(Float32Array.BYTES_PER_ELEMENT*r*i),o=new Uint16Array(n),a=hkt.wasmUtil.wasm.HEAPU8,h=e.vPtr,u=i*Float32Array.BYTES_PER_ELEMENT*r;s.set(a.subarray(h,h+u));var l=e.iPtr,c=Uint16Array.BYTES_PER_ELEMENT*n;new Uint8Array(o.buffer).set(a.subarray(l,l+c));var _=new Ikt;_.vCount=i,_.iCount=n,_.vData=s,_.iData=o;for(var f=e.getData(),d=f.size(),p=0;p<d;p+=6){var m=new Mkt;m.iCount=f.get(p+3),m.blendMode=f.get(p+4),m.textureID=f.get(p+5),_.meshes.push(m)}var g=this._skeleton.bones,y=[];g.forEach((function(t){var e=new Rkt;e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e.worldX=t.worldX,e.worldY=t.worldY,y.push(e)})),this.frames[t]={model:_,boneInfos:y}},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}(),Bkt=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 o in s){var a=s[o];a&&r(o,a)}n.skeleton&&hkt.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 hkt.Skeleton(i),s=new mkt;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,o=s[i];if(!o){var a=t+"#"+i;(o=this._animationPool[a])?delete this._animationPool[a]:(o=new Pkt(n))._privateMode=this._privateMode,o.init(r,i),s[i]=o}return o.init(r,i),o.setAnimation(i),o},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&&hkt.wasmUtil.destroySpineSkeleton(r),n&&delete this._skeletonCache[t]}else{var s=this._animationPool;for(var o in s)s[o].destroy(),delete s[o]}},t}();fkt=Bkt,Bkt.FrameTime=gkt,Bkt.sharedCache=new fkt;var Okt=(ykt=Ta("sp.SkeletonData"),vkt=eh([Dm]),Skt=eh([ri]),ykt((Tkt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonJson=bkt&&bkt(),e.textures=Ekt&&Ekt(),e.textureNames=Ckt&&Ckt(),e.scale=xkt&&xkt(),e._atlasText=wkt&&wkt(),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 xg(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||z(this.name+" no textures found!"),null;var e=hkt.wasmUtil.querySpineSkeletonDataByUUID(this._uuid);if(e)this._skeletonCache=e;else if(this._skeletonJson)this._skeletonCache=hkt.wasmUtil.createSpineSkeletonDataWithJson(this.skeletonJsonStr,this._atlasText),hkt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid);else{var i=new Uint8Array(this._nativeAsset),n=i.length,r=hkt.wasmUtil.queryStoreMemory(n);hkt.wasmUtil.wasm.HEAPU8.subarray(r,r+n).set(i),this._skeletonCache=hkt.wasmUtil.createSpineSkeletonDataWithBinary(n,this._atlasText),hkt.wasmUtil.registerSpineSkeletonDataWithUUID(this._skeletonCache,this._uuid)}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=be(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=be(e)}return null},i.destroy=function(){return Bkt.sharedCache.destroyCachedAnimations(this._uuid),hkt.wasmUtil.destroySpineSkeletonDataWithUUID(this._uuid),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}(Fd),bkt=fa(Tkt.prototype,"_skeletonJson",[Ma],(function(){return null})),Ekt=fa(Tkt.prototype,"textures",[Ma,vkt],(function(){return[]})),Ckt=fa(Tkt.prototype,"textureNames",[Ma,Skt],(function(){return[]})),xkt=fa(Tkt.prototype,"scale",[Ma],(function(){return 1})),wkt=fa(Tkt.prototype,"_atlasText",[Ma],(function(){return""})),Akt=Tkt))||Akt);v.internal.SpineSkeletonData=Okt;var Lkt=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,FI.registerSystem(e.ID,e._instance,Jl.Priority.HIGH)),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}(Jl);Lkt.ID="SKELETON",Lkt._instance=void 0,v.internal.SpineSkeletonSystem=Lkt;var Nkt,Fkt,kkt,Vkt,Gkt,Ukt,zkt,Hkt,Wkt,jkt,Xkt,Ykt,qkt,Kkt,Qkt,Zkt,Jkt,$kt,tVt,eVt,iVt,nVt,rVt,sVt,oVt,aVt,hVt,uVt,lVt,cVt,_Vt,fVt,dVt,pVt,mVt=new Vn,gVt=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?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=f(e);!(t=i()).done;){var n=t.value,r=n[0],s=n[1];if(s&&s.isValid){var o=this._skeletonBones[r];o&&this.matrixHandle(s,o)}else this._keysToDelete.push(r)}if(!(this._keysToDelete.length<=0)){for(var a,h=f(this._keysToDelete);!(a=h()).done;){var u=a.value;e.delete(u)}this._keysToDelete.length=0}}},e.matrixHandle=function(t,e){var i=mVt;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=mVt},t}(),yVt=1e4;!function(t){t[t.UNSET=-1]="UNSET",t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(_Vt||(_Vt={})),xe(_Vt),function(t){t[t.default=0]="default"}(fVt||(fVt={})),xe(fVt),function(t){t[t["<None>"]=0]="<None>"}(dVt||(dVt={})),xe(dVt),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(pVt||(pVt={}));var vVt=(Nkt=Ta("sp.Skeleton.SpineSocket"),Fkt=eh(xg),Nkt((Vkt=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),this.path=Gkt&&Gkt(),this.target=Ukt&&Ukt(),this.path=t,this.target=e},Gkt=fa(Vkt.prototype,"path",[Ma],(function(){return""})),Ukt=fa(Vkt.prototype,"target",[Fkt,Ma],(function(){return null})),kkt=Vkt))||kkt);ie(vVt,"sp.Skeleton.SpineSocket");var SVt=(zkt=Ta("sp.Skeleton"),Hkt=eh(Okt),Wkt=eh(fVt),jkt=eh(dVt),Xkt=eh(_Vt),Ykt=eh([vVt]),qkt=eh(oT),zkt(((cVt=function(t){function e(){var e;return(e=t.call(this)||this)._skeletonData=Zkt&&Zkt(),e.defaultSkin=Jkt&&Jkt(),e.defaultAnimation=$kt&&$kt(),e._premultipliedAlpha=tVt&&tVt(),e._timeScale=eVt&&eVt(),e._preCacheMode=iVt&&iVt(),e._cacheMode=nVt&&nVt(),e._sockets=rVt&&rVt(),e._useTint=sVt&&sVt(),e._debugMesh=oVt&&oVt(),e._debugBones=aVt&&aVt(),e._debugSlots=hVt&&hVt(),e._enableBatch=uVt&&uVt(),e._runtimeData=null,e._skeleton=null,e._instance=null,e._state=null,e._textures=[],e._skeletonInfo=null,e._animationName="",e._skinName="",e._drawList=new Ks((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e._materialCache={},e.paused=!1,e._enumSkins=be({}),e._enumAnimations=be({}),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._slotTextures=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.loop=lVt&&lVt(),e._useVertexOpacity=!0,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e._startSlotIndex=-1,e._endSlotIndex=-1,e._instance=new hkt.SkeletonInstance,e._instance.dtRate=1*e._timeScale,e._instance.isCache=e.isAnimationCached(),e.attachUtil=new gVt,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(),Lkt.getInstance().add(this)},i.onDisable=function(){t.prototype.onDisable.call(this),this._instance&&(this._instance.enable=!1),Lkt.getInstance().remove(this)},i.onDestroy=function(){var e;this._eventListenerID>0&&(mkt.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)||void 0===e||e.clear(),this._slotTextures=null,this._cachedSockets.clear(),this._socketNodes.clear(),this._animCache=null,Lkt.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.defaultAnimation&&(this.animation=this.defaultAnimation.toString()),this.defaultSkin&&""!==this.defaultSkin&&this.setSkin(this.defaultSkin),this._updateUseTint(),this._indexBoneSockets(),this._updateSocketBindings(),this.attachUtil.init(this),this._preCacheMode=this._cacheMode)},i.setSkeletonData=function(t){var e=this._skeletonCache;if(this._cacheMode===_Vt.SHARED_CACHE?this._skeletonCache=Bkt.sharedCache:this._cacheMode===_Vt.PRIVATE_CACHE?(this._skeletonCache=new Bkt,this._skeletonCache.enablePrivateMode()):this._skeletonCache=null,e!==this._skeletonCache&&this._destroySkeletonInfo(e),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&U("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonInfo(this._skeletonData);this._skeletonInfo!==i&&(this._destroySkeletonInfo(this._skeletonCache),this._skeletonInfo=this._skeletonCache.createSkeletonInfo(this._skeletonData),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()?U("Slots visible range can not be modified in cached mode."):(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 K(7511),null;if(!this._skeleton.data.findAnimation(e))return K(7509,e),null;var n=null;if(void 0===i&&(i=!0),this._playTimes=i?0:1,this.isAnimationCached()){if(0!==t&&U("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var r,s=this._skeletonCache.getAnimationCache(this._skeletonData.uuid,e);s||null===(r=s=this._skeletonCache.initAnimationCache(this.skeletonData.uuid,this._skeletonData,e))||void 0===r||r.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,n=this._instance.setAnimation(t,e,i);return this.markForUpdateRenderData(),n},i.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())return 0!==t&&U("Track index can not greater than 0 in cached mode."),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?void 0:r.addAnimationWith(t,s,i,n):(K(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())U("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},i.setSkin=function(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?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=Bkt.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._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(),o=s.indexOffset,a=0;a<this._drawList.length;a++){var h=this._drawList.data[a];h.texture&&t.commitMiddleware(this,s,o+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();if(r.material=t,e<1e4)r.texture=this._textures[e];else{var s,o=null===(s=this._slotTextures)||void 0===s?void 0:s.get(e);o&&(r.texture=o)}return r.indexOffset=i,r.indexCount=n,r},i._updateBuiltinMaterial=function(){return UA.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;var s=this.getMaterialTemplate();r=new pT({parent:s,subModelIdx:0,owner:this}),this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:bn.WHITE,targets:[{blendEq:Vc.ADD,blendAlphaEq:Vc.ADD,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var o=!1;i===pVt.TWO_COLORED&&(o=!0);var a=!this._enableBatch;return r.recompileShaders({TWO_COLORED:o,USE_LOCAL:a}),r},i._updateAnimEnum=function(){var t;t=this.skeletonData?this.skeletonData.getAnimsEnum():dVt,this._enumAnimations=be({}),Object.assign(this._enumAnimations,t),be.update(this._enumAnimations),pi(this,"_animationIndex",this._enumAnimations)},i._updateSkinEnum=function(){var t;t=this.skeletonData?this.skeletonData.getSkinsEnum():fVt,this._enumSkins=be({}),Object.assign(this._enumSkins,t),be.update(this._enumSkins),pi(this,"_defaultSkinIndex",this._enumSkins)},i._refreshInspector=function(){},i.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},i.createRenderEntity=function(){var t=new AO(rO.DYNAMIC);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 this._cacheMode!==_Vt.REALTIME},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()?U("cached mode not support setMix!!!"):this._state&&this._instance.setMix(t,e,i)},i.clearTracks=function(){this.isAnimationCached()?U("'clearTracks' interface can not be invoked in cached mode."):this._state&&(this._state.clearTracks(),this.setToSetupPose())},i.clearTrack=function(t){this.isAnimationCached()?U("'clearTrack' interface can not be invoked in cached mode."):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||z("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)?z("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){z("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),this._assembler&&this._skeleton&&(this._renderData=this._assembler.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 xg("DEBUG_DRAW_NODE");t.layer=this.node.layer,t.hideFlags|=$s.Flags.DontSave|$s.Flags.HideInHierarchy;var e=t.addComponent(RF);e.lineWidth=5,e.strokeColor=new bn(255,0,0,255),this._debugRenderer=e,t.parent=this.node,this.node.on(Nm.LAYER_CHANGED,this._applyLayer,this)}this.isAnimationCached()?U("Debug bones or slots is invalid in cached mode"):this._instance.setDebugMode(!0)}else this._debugRenderer&&(this.node.off(Nm.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._uiProps.uiTransformComp,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.node._uiProps.opacity;if(this._tempColor.r!==this._color.r||this._tempColor.g!==this._color.g||this._tempColor.b!==this._color.b||this._tempColor.a!==t){this.node._uiProps.colorDirty=!0,this._tempColor.r=this._color.r,this._tempColor.g=this._color.g,this._tempColor.b=this._color.b,this._tempColor.a=t;var e=this._color.r/255,i=this._color.g/255,n=this._color.b/255;this._instance.setColor(e,i,n,t)}},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 mkt,this._eventListenerID=mkt.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){mkt.getListeners(t,this._instance).start=e},i.setTrackInterruptListener=function(t,e){mkt.getListeners(t,this._instance).interrupt=e},i.setTrackEndListener=function(t,e){mkt.getListeners(t,this._instance).end=e},i.setTrackDisposeListener=function(t,e){mkt.getListeners(t,this._instance).dispose=e},i.setTrackCompleteListener=function(t,e){mkt.getListeners(t,this._instance).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},i.setTrackEventListener=function(t,e){mkt.getListeners(t,this._instance).event=e},i.getDebugShapes=function(){return this._instance.getDebugShapes()},i.setSlotTexture=function(t,e,i){if(this.isAnimationCached())z("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),this._slotTextures||(this._slotTextures=new Map);var o=0;this._slotTextures.forEach((function(t,i){t===e&&(o=i)})),0===o&&(o=++yVt,this._slotTextures.set(o,e)),this._instance.setSlotTexture(t,o)}else z("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()):z(this.name+" skin enums are invalid")}else z(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):z(this.name+" animation enums are invalid")}else z(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()}}]),e}(JO)).SpineSocket=vVt,cVt.AnimationCacheMode=_Vt,Zkt=fa((Qkt=cVt).prototype,"_skeletonData",[Ma],(function(){return null})),Jkt=fa(Qkt.prototype,"defaultSkin",[Ma],(function(){return""})),$kt=fa(Qkt.prototype,"defaultAnimation",[Ma],(function(){return""})),tVt=fa(Qkt.prototype,"_premultipliedAlpha",[Ma],(function(){return!0})),eVt=fa(Qkt.prototype,"_timeScale",[Ma],(function(){return 1})),iVt=fa(Qkt.prototype,"_preCacheMode",[Ma],(function(){return _Vt.UNSET})),nVt=fa(Qkt.prototype,"_cacheMode",[Ma],(function(){return _Vt.REALTIME})),rVt=fa(Qkt.prototype,"_sockets",[Ma],(function(){return[]})),sVt=fa(Qkt.prototype,"_useTint",[Ma],(function(){return!1})),oVt=fa(Qkt.prototype,"_debugMesh",[Ma],(function(){return!1})),aVt=fa(Qkt.prototype,"_debugBones",[Ma],(function(){return!1})),hVt=fa(Qkt.prototype,"_debugSlots",[Ma],(function(){return!1})),uVt=fa(Qkt.prototype,"_enableBatch",[Ma],(function(){return!1})),m(Qkt.prototype,"skeletonData",[Hkt],Object.getOwnPropertyDescriptor(Qkt.prototype,"skeletonData"),Qkt.prototype),m(Qkt.prototype,"_defaultSkinIndex",[Wkt],Object.getOwnPropertyDescriptor(Qkt.prototype,"_defaultSkinIndex"),Qkt.prototype),m(Qkt.prototype,"_animationIndex",[jkt],Object.getOwnPropertyDescriptor(Qkt.prototype,"_animationIndex"),Qkt.prototype),m(Qkt.prototype,"defaultCacheMode",[Xkt],Object.getOwnPropertyDescriptor(Qkt.prototype,"defaultCacheMode"),Qkt.prototype),lVt=fa(Qkt.prototype,"loop",[Ma],(function(){return!0})),m(Qkt.prototype,"sockets",[Ykt],Object.getOwnPropertyDescriptor(Qkt.prototype,"sockets"),Qkt.prototype),m(Qkt.prototype,"customMaterial",[_h,qkt],Object.getOwnPropertyDescriptor(Qkt.prototype,"customMaterial"),Qkt.prototype),Kkt=Qkt))||Kkt);v.internal.SpineSkeleton=SVt;var AVt,TVt,bVt,EVt,CVt=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 hkt.JitterEffect(t,e),this._vertexEffect},e.initSwirlWithPow=function(t,e){return this._effectType="swirl",this._interpolation=new hkt.Pow(e),this._vertexEffect=new hkt.SwirlEffect(t,this._interpolation),this._vertexEffect},e.initSwirlWithPowOut=function(t,e){return this._effectType="swirl",this._interpolation=new hkt.PowOut(e),this._vertexEffect=new hkt.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}(),xVt=new bn(0,0,255,255),wVt=new bn(255,0,0,255),DVt=new bn(0,255,0,255),RVt=new bn(255,255,0,255),IVt=null,MVt=null,PVt=!1,BVt=!1,OVt=jB(UB),LVt=jB(HB),NVt=new mn(0,0,0);function FVt(t,e){var i,n;switch(t){case 1:i=PVt?kc.ONE:kc.SRC_ALPHA,n=kc.ONE;break;case 2:i=kc.DST_COLOR,n=kc.ONE_MINUS_SRC_ALPHA;break;case 3:i=kc.ONE,n=kc.ONE_MINUS_SRC_COLOR;break;case 0:default:i=PVt?kc.ONE:kc.SRC_ALPHA,n=kc.ONE_MINUS_SRC_ALPHA}return e.getMaterialForBlendAndTint(i,n,BVt?pVt.TWO_COLORED:pVt.COLORED_TEXTURED)}var kVt={vCount:32767,ensureAccessor:function(t){var e=t?MVt:IVt;if(!e){var i=FI.root.device,n=FI.root.batcher2D,r=t?HB:UB;t?(e=MVt=new tO(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),MVt)):(e=IVt=new tO(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),IVt))}return e},createData:function(t){var e=t.renderData;if(!e){var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i);e=EO.add(i?HB:UB,n)}return e},updateRenderData:function(t){var e;t._skeleton&&t.node.active&&null!==(e=t.skeletonData)&&void 0!==e&&e.isValid&&function(t){if(t.drawList.reset(),0!==t.color.a){t._updateColor(),PVt=t.premultipliedAlpha,BVt=t.useTint||t.isAnimationCached(),t.isAnimationCached()?function(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,o=new Uint8Array(s.buffer,s.byteOffset,Float32Array.BYTES_PER_ELEMENT*s.length);o.set(e.vData);var a=t.color,h=t.node._uiProps.opacity;if(1-h>Bi||4294967295!==bn.toUint32(a)||PVt){AVt=a.r/255,TVt=a.g/255,bVt=a.b/255,EVt=h;for(var u=0;u<i;u++){var l=u*LVt+5*Float32Array.BYTES_PER_ELEMENT,c=o[l],_=o[l+1],f=o[l+2],d=o[l+3]*EVt,p=PVt?d/255:1;o[l]=Math.floor(p*c*AVt),o[l+1]=Math.floor(p*_*TVt),o[l+2]=Math.floor(p*f*bVt),o[l+3]=Math.floor(d),o[l+4]=Math.floor(o[l+4]*AVt),o[l+5]=Math.floor(o[l+5]*TVt),o[l+6]=Math.floor(o[l+6]*bVt),o[l+7]=PVt?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,S=v.length,A=0,T=0,b=0;b<S;b++){var E=v[b],C=FVt(E.blendMode,t),x=E.textureID;T=E.iCount,t.requestDrawData(C,x,A,T),A+=T}var w=LVt/Float32Array.BYTES_PER_ELEMENT;if(t.enableBatch)for(var D=t.node.worldMatrix,R=0,I=0;I<i;I++)R=I*w,NVt.x=s[R],NVt.y=s[R+1],NVt.z=0,NVt.transformMat4(D),s[R]=NVt.x,s[R+1]=NVt.y,s[R+2]=NVt.z}}}(t):function(t){var e,i,n=(t.useTint?LVt:OVt)/Float32Array.BYTES_PER_ELEMENT,r=t.updateRenderData(),s=r.vCount,o=r.iCount;if(!(s<1||o<1)){var a=t.renderData;a.vertexCount===s&&a.indexCount===o||(a.resize(s,o),a.indices=new Uint16Array(o),t._vLength=s*Float32Array.BYTES_PER_ELEMENT*n,t._vBuffer=new Uint8Array(a.chunk.vb.buffer,a.chunk.vb.byteOffset,Float32Array.BYTES_PER_ELEMENT*a.chunk.vb.length),t._iLength=Uint16Array.BYTES_PER_ELEMENT*o,t._iBuffer=new Uint8Array(a.indices.buffer));var h=a.chunk.vb,u=r.vPtr,l=r.iPtr,c=a.indices,_=hkt.wasmUtil.wasm.HEAPU8;null===(e=t._vBuffer)||void 0===e||e.set(_.subarray(u,u+t._vLength),0),null===(i=t._iBuffer)||void 0===i||i.set(_.subarray(l,l+t._iLength),0);for(var f=a.chunk.vertexOffset,d=0;d<o;d++)c[d]+=f;for(var p=r.getData(),m=p.size(),g=0,y=0,v=0;v<m;v+=6){y=p.get(v+3);var S=FVt(p.get(v+4),t),A=p.get(v+5);t.requestDrawData(S,A,g,y),g+=y}if(t.enableBatch)for(var T=t.node.worldMatrix,b=0,E=0;E<s;E++)b=E*n,NVt.x=h[b],NVt.y=h[b+1],NVt.z=0,NVt.transformMat4(T),h[b]=NVt.x,h[b+1]=NVt.y,h[b+2]=NVt.z;var C=t._debugRenderer,x=t._skeleton;if(C&&(t.debugBones||t.debugSlots||t.debugMesh)){C.clear();for(var w=t.getDebugShapes(),D=w.size(),R=0;R<D;R++){var I=w.get(R);if(0===I.type&&t.debugSlots){C.strokeColor=xVt;var M=I.vOffset*n,P=I.vCount*n;C.moveTo(h[M],h[M+1]);for(var B=M+n,O=M+P;B<O;B+=n)C.lineTo(h[B],h[B+1]);C.close(),C.stroke()}else if(1===I.type&&t.debugMesh){C.strokeColor=RVt;for(var L=I.iCount,N=I.iOffset,F=N,k=N+L;F<k;F+=3){var V=c[F]*n,G=c[F+1]*n,U=c[F+2]*n;C.moveTo(h[V],h[V+1]),C.lineTo(h[G],h[G+1]),C.lineTo(h[U],h[U+1]),C.close(),C.stroke()}}}if(t.debugBones){C.strokeColor=wVt,C.fillColor=xVt;for(var z=0,H=x.bones.length;z<H;z++){var W=x.bones[z],j=W.data.length*W.a+W.worldX,X=W.data.length*W.c+W.worldY;C.moveTo(W.worldX,W.worldY),C.lineTo(j,X),C.stroke(),C.circle(W.worldX,W.worldY,1.5*Math.PI),C.fill(),0===z&&(C.fillColor=DVt)}}}}}(t);var e=t.renderData,i=BVt?MVt:IVt;t.syncAttachedNode(),(e.vertexCount>0||e.indexCount>0)&&i.getMeshBuffer(e.chunk.bufferId).setDirty()}}(t)}};v.internal.SpineAssembler=kVt;var VVt,GVt,UVt={getAssembler:function(){return kVt}};SVt.Assembler=UVt,function(t){t[t.REGION=0]="REGION",t[t.BOUNDING_BOX=1]="BOUNDING_BOX",t[t.MESH=2]="MESH",t[t.SKINNED_MESH=3]="SKINNED_MESH"}(VVt||(VVt={})),xe(VVt),function(t){t[t.START=0]="START",t[t.INTERRUPT=1]="INTERRUPT",t[t.END=2]="END",t[t.DISPOSE=3]="DISPOSE",t[t.COMPLETE=4]="COMPLETE",t[t.EVENT=5]="EVENT"}(GVt||(GVt={})),xe(GVt),t("g1",Object.freeze({__proto__:null,spine:hkt,get ATTACHMENT_TYPE(){return VVt},get AnimationEventType(){return GVt},timeScale:1,get AnimationCacheMode(){return _Vt},get DefaultSkinsEnum(){return fVt},get DefaultAnimsEnum(){return dVt},get SpineMaterialType(){return pVt},SpineSocket:vVt,Skeleton:SVt,SkeletonData:Okt,VertexEffectDelegate:CVt,simpleSpineAssembler:UVt})),t("g2",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=Ni(t,0,this.w-1),e=Ni(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),o=r+1,a=s+1,h=i-r,u=n-s;r=Ni(r,0,this.w-1),s=Ni(s,0,this.h-1),o=Ni(o,0,this.w-1),a=Ni(a,0,this.h-1);var l=this.get(r,s),c=this.get(o,s),_=this.get(r,a),f=this.get(o,a),d=.5*(c+_);return h+u<=1?f=d+(d-l):l=d+(d-f),(l*(1-h)+c*h)*(1-u)+(_*(1-h)+f*h)*u},t}());var zVt,HVt,WVt,jVt,XVt,YVt,qVt,KVt,QVt,ZVt,JVt,$Vt,tGt,eGt,iGt,nGt,rGt,sGt,oGt,aGt,hGt,uGt,lGt,cGt,_Gt,fGt,dGt,pGt,mGt,gGt,yGt,vGt,SGt,AGt,TGt,bGt,EGt,CGt,xGt,wGt,DGt,RGt,IGt,MGt,PGt,BGt=33,OGt=1e14,LGt=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}(),NGt=function(){this.size=0,this.indices=null},FGt=function(){this.key=new LGt,this.start=0,this.size=0,this.buffer=null,this.primCount=0},kGt=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 NGt;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 NGt;for(var s=0;s<4;++s)this._genBodyIndex(s);for(var o=0;o<4;++o)for(var a=0;a<4;++a)this._genConnecterIndexNorth(o,a),this._genConnecterIndexSouth(o,a),this._genConnecterIndexWest(o,a),this._genConnecterIndexEast(o,a);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 _=0;_<4;++_)if(!(_<h)){var f=new LGt;f.level=h,f.north=u,f.south=l,f.west=c,f.east=_,this._genIndexData(f)}}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*BGt+e),0!==i&&0!==i){var r=i*i*6;this._bodyIndexPool[t].indices=new Uint16Array(r);for(var s=0,o=new Uint16Array(r),a=n,h=a+BGt*e,u=0;u<i;++u){for(var l=0;l<i;++l)o[s++]=h+l*e,o[s++]=h+(l+1)*e,o[s++]=a+l*e,o[s++]=h+(l+1)*e,o[s++]=a+(l+1)*e,o[s++]=a+l*e;a+=BGt*e,h+=BGt*e}this._bodyIndexPool[t].size=s,this._bodyIndexPool[t].indices=o}},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,o=32>>e,a=0,h=new Uint16Array(2*o+2);h[a++]=0,h[a++]=0;for(var u=1;u<o;++u){var l=u*r,c=r*BGt+l,_=(r-r)*BGt+l/s*s;h[a++]=c,h[a++]=_}h[a++]=32,h[a++]=32,this._connecterIndexPool[n].size=a,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,o=32>>e,a=0,h=new Uint16Array(2*o+2);h[a++]=1056,h[a++]=1056;for(var u=1;u<o;++u){var l=u*r,c=32-r,_=(c+r)*BGt+l/s*s,f=c*BGt+l;h[a++]=_,h[a++]=f}h[a++]=1088,h[a++]=1088,this._connecterIndexPool[n].size=a,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,o=32>>e,a=0,h=new Uint16Array(2*o+2);h[a++]=0,h[a++]=0;for(var u=1;u<o;++u){var l=u*r/s*s*BGt+0,c=u*r*BGt+r;h[a++]=l,h[a++]=c}h[a++]=1056,h[a++]=1056,this._connecterIndexPool[n].size=a,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,o=32>>e,a=0,h=new Uint16Array(2*o+2);h[a++]=32,h[a++]=32;for(var u=1;u<o;++u){var l=u*r*BGt+(32-r),c=u*r/s*s*BGt+32;h[a++]=l,h[a++]=c}h[a++]=1088,h[a++]=1088,this._connecterIndexPool[n].size=a,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),o=this._getConnenterIndex(t.level,t.east,3);if((e=new FGt).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)),o.indices&&(e.size+=3*(o.size-2)),0===e.size)return null;var a=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[a++]=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],_=n.indices[u+2],f=n.indices[u+3];e.buffer[a++]=l,e.buffer[a++]=_,e.buffer[a++]=c,e.buffer[a++]=_,e.buffer[a++]=f,e.buffer[a++]=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[a++]=p,e.buffer[a++]=g,e.buffer[a++]=m,e.buffer[a++]=g,e.buffer[a++]=y,e.buffer[a++]=m}if(s.indices)for(var v=0;v<s.size-2;v+=2){var S=s.indices[v+0],A=s.indices[v+1],T=s.indices[v+2],b=s.indices[v+3];e.buffer[a++]=S,e.buffer[a++]=T,e.buffer[a++]=A,e.buffer[a++]=T,e.buffer[a++]=b,e.buffer[a++]=A}if(o.indices)for(var E=0;E<o.size-2;E+=2){var C=o.indices[E+0],x=o.indices[E+1],w=o.indices[E+2],D=o.indices[E+3];e.buffer[a++]=C,e.buffer[a++]=w,e.buffer[a++]=x,e.buffer[a++]=w,e.buffer[a++]=D,e.buffer[a++]=x}e.primCount=a/3,e.start=this._indexBuffer.length,this._indexMap.push(e);var R=new Uint16Array(e.start+e.size);return R.set(this._indexBuffer,0),R.set(e.buffer,e.start),this._indexBuffer=R,e},t}(),VGt=t("g3",Ta("cc.TerrainInfo")((HVt=function(){function t(){this.tileSize=WVt&&WVt(),this.blockCount=jVt&&jVt(),this.weightMapSize=XVt&&XVt(),this.lightMapSize=YVt&&YVt()}return n(t,[{key:"size",get:function(){var t=new Kn(0,0);return t.width=this.blockCount[0]*FMt*this.tileSize,t.height=this.blockCount[1]*FMt*this.tileSize,t}},{key:"tileCount",get:function(){var t=[0,0];return t[0]=this.blockCount[0]*FMt,t[1]=this.blockCount[1]*FMt,t}},{key:"vertexCount",get:function(){var t=this.tileCount;return t[0]+=1,t[1]+=1,t}}]),t}(),WVt=fa(HVt.prototype,"tileSize",[Ma],(function(){return 1})),jVt=fa(HVt.prototype,"blockCount",[Ma],(function(){return[1,1]})),XVt=fa(HVt.prototype,"weightMapSize",[Ma],(function(){return 128})),YVt=fa(HVt.prototype,"lightMapSize",[Ma],(function(){return 128})),zVt=HVt))||zVt),GGt=t("g4",Ta("cc.TerrainLayer")((KVt=function(){this.detailMap=QVt&&QVt(),this.normalMap=ZVt&&ZVt(),this.tileSize=JVt&&JVt(),this.metallic=$Vt&&$Vt(),this.roughness=tGt&&tGt()},QVt=fa(KVt.prototype,"detailMap",[Ma],(function(){return null})),ZVt=fa(KVt.prototype,"normalMap",[Ma],(function(){return null})),JVt=fa(KVt.prototype,"tileSize",[Ma],(function(){return 1})),$Vt=fa(KVt.prototype,"metallic",[Ma],(function(){return 0})),tGt=fa(KVt.prototype,"roughness",[Ma],(function(){return 1})),qVt=KVt))||qVt),UGt=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&&(v.director.root.destroyModel(this._model),this._model=null),t.prototype.destroy.call(this)},i._destroyModel=function(){null!=this._model&&(v.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 oT,this._currentMaterial.initialize({effectAsset:t.getTerrain().getEffectAsset(),defines:t._getMaterialDefines(i)}),null!==this._brushMaterial){var n=new oT;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===tg.Static&&this._lightmap?this._onUpdateReceiveDirLight(i,!0):this._onUpdateReceiveDirLight(i))}}},i._getBuiltinMaterial=function(){return UA.get("missing-material")},e}(MV),zGt=t("g5",Ta("cc.TerrainBlockLightmapInfo")((iGt=function(){this.texture=nGt&&nGt(),this.UOff=rGt&&rGt(),this.VOff=sGt&&sGt(),this.UScale=oGt&&oGt(),this.VScale=aGt&&aGt()},nGt=fa(iGt.prototype,"texture",[Ma],(function(){return null})),rGt=fa(iGt.prototype,"UOff",[Ma],(function(){return 0})),sGt=fa(iGt.prototype,"VOff",[Ma],(function(){return 0})),oGt=fa(iGt.prototype,"UScale",[Ma],(function(){return 0})),aGt=fa(iGt.prototype,"VScale",[Ma],(function(){return 0})),eGt=iGt))||eGt),HGt=t("g6",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 LGt,this._errorMetrics=[0,0,0,0],this._LevelDistances=[OGt,OGt,OGt,OGt],this._bbMin=new mn,this._bbMax=new mn,this._terrain=t,this._index[0]=e,this._index[1]=i,this._lightmapInfo=t._getLightmapInfo(e,i),this._node=new xg("TerrainBlock"),this._node.setParent(this._terrain.node),this._node.hideFlags|=$s.Flags.DontSave|$s.Flags.HideInHierarchy,this._node.layer=this._terrain.node.layer,this._renderable=this._node.addComponent(UGt)}var e=t.prototype;return e.build=function(){var t=FI.root.device,e=new Float32Array(VMt*kMt*kMt);this._buildVertexData(e);var i=t.createBuffer(new E_(Ec.VERTEX|Ec.TRANSFER_DST,wc.DEVICE,VMt*Float32Array.BYTES_PER_ELEMENT*kMt*kMt,VMt*Float32Array.BYTES_PER_ELEMENT));i.update(e),this._buildBoundingBox();var n=[new U_(a_.ATTR_POSITION,Ac.RGB32F),new U_(a_.ATTR_NORMAL,Ac.RGB32F),new U_(a_.ATTR_TEX_COORD,Ac.RG32F)];this._renderable._meshData=new jI([i],n,Yc.TRIANGLE_LIST,this._terrain._getSharedIndexBuffer(),null,!1),this._renderable._model=v.director.root.createModel(ND),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=UA.get("normal-texture")),e},r=this._renderable._currentMaterial;if(null!==r){var s=this.getMaxLayer(),o=new ln(1,1,1,1),a=new ln(1,1,1,1),h=new ln(0,0,0,0);if(0===s)if(-1!==this.layers[0]){var u=this._terrain.getLayer(this.layers[0]);null!==u&&(o.x=1/u.tileSize,a.x=u.roughness,h.x=u.metallic),r.setProperty("detailMap0",i(u)),t&&r.setProperty("normalMap0",n(u))}else r.setProperty("detailMap0",UA.get("default-texture")),t&&r.setProperty("normalMap0",UA.get("normal-texture"));else if(1===s){var l=this._terrain.getLayer(this.layers[0]),c=this._terrain.getLayer(this.layers[1]);null!==l&&(o.x=1/l.tileSize,a.x=l.roughness,h.x=l.metallic),null!==c&&(o.y=1/c.tileSize,a.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 _=this._terrain.getLayer(this.layers[0]),f=this._terrain.getLayer(this.layers[1]),d=this._terrain.getLayer(this.layers[2]);null!==_&&(o.x=1/_.tileSize,a.x=_.roughness,h.x=_.metallic),null!==f&&(o.y=1/f.tileSize,a.y=f.roughness,h.y=f.metallic),null!==d&&(o.z=1/d.tileSize,a.z=d.roughness,h.z=d.metallic),r.setProperty("weightMap",this._weightMap),r.setProperty("detailMap0",i(_)),r.setProperty("detailMap1",i(f)),r.setProperty("detailMap2",i(d)),t&&(r.setProperty("normalMap0",n(_)),r.setProperty("normalMap1",n(f)),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&&(o.x=1/p.tileSize,a.x=p.roughness,h.x=p.metallic),null!==m&&(o.y=1/m.tileSize,a.y=m.roughness,h.y=m.metallic),null!==g&&(o.z=1/g.tileSize,a.z=g.roughness,h.z=g.metallic),null!==y&&(o.w=1/y.tileSize,a.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",o),e&&(r.setProperty("roughness",a),r.setProperty("metallic",h))}},e._buildLodInfo=function(){var t=new Float32Array(VMt*kMt*kMt);this._buildVertexData(t),this._updateLodBuffer(t),this._updateIndexBuffer()},e._updateLevel=function(t){var e=new mn,i=new mn;mn.add(e,this._bbMin,this._terrain.node.getWorldPosition()),mn.add(i,this._bbMax,this._terrain.node.getWorldPosition());var n=mn.distance(e,t),r=mn.distance(i,t),s=Math.min(n,r);for(s-=this._terrain.LodBias,this._lodLevel=0;this._lodLevel<3&&!(s<=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 Zn;return t.x=this._index[0]*FMt,t.y=this._index[1]*FMt,t.width=FMt,t.height=FMt,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(Vd.CLAMP_TO_BORDER,Vd.CLAMP_TO_BORDER),this._renderable._updateLightingmap(this.lightmap,this.lightmapUVParam))},e._updateHeight=function(){if(null!=this._renderable._meshData){var t=new Float32Array(VMt*kMt*kMt);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 Dm,this._weightMap.create(this._terrain.weightMapSize,this._terrain.weightMapSize,kd.RGBA8888),this._weightMap.setFilters(Gd.LINEAR,Gd.LINEAR),this._weightMap.setWrapMode(Vd.CLAMP_TO_EDGE,Vd.CLAMP_TO_EDGE));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,o=this._terrain.getWeight(r,s);t[4*e+0]=Math.floor(255*o.x),t[4*e+1]=Math.floor(255*o.y),t[4*e+2]=Math.floor(255*o.z),t[4*e+3]=Math.floor(255*o.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 LGt;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 LGt;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[(kMt*e+t)*VMt+1]},e._updateLodBuffer=function(t){this._lodLevel=0,this._lodKey=new LGt,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=kMt,s=kMt,o=r-1>>t,a=s-1>>t,h=0;h<s;h+=n)for(var u=0;u<o;++u){var l=u*n,c=l+n,_=(c+l)/2,f=this._getHeight(l,h,e),d=this._getHeight(c,h,e),p=this._getHeight(_,h,e),m=(f+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<a;++v){var S=v*n,A=S+n,T=(S+A)/2,b=this._getHeight(y,S,e),E=this._getHeight(y,A,e),C=this._getHeight(y,T,e),x=(b+E)/2,w=Math.abs(C-x);i=Math.max(i,w)}for(var D=0;D<a;++D)for(var R=D*n,I=R+n,M=(R+I)/2,P=0;P<o;++P){var B=P*n,O=B+n,L=(B+O)/2,N=this._getHeight(B,R,e),F=this._getHeight(O,I,e),k=this._getHeight(L,M,e),V=(N+F)/2,G=Math.abs(k-V);i=Math.max(i,G)}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<kMt;++i)for(var n=0;n<kMt;++n){var r=this._index[0]*FMt+n,s=this._index[1]*FMt+i,o=this._terrain.getPosition(r,s),a=this._terrain.getNormal(r,s),h=new jn(n/FMt,i/FMt);t[e++]=o.x,t[e++]=o.y,t[e++]=o.z,t[e++]=a.x,t[e++]=a.y,t[e++]=a.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<kMt;++t)for(var e=0;e<kMt;++e){var i=this._index[0]*FMt+e,n=this._index[1]*FMt+t,r=this._terrain.getPosition(i,n);mn.min(this._bbMin,this._bbMin,r),mn.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 ln(this._lightmapInfo.UOff,this._lightmapInfo.VOff,this._lightmapInfo.UScale,this._lightmapInfo.VScale):new ln(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}());t("g7",(hGt=Ta("cc.Terrain"),uGt=eh(nPt),lGt=eh(gS),cGt=eh(zGt),_Gt=eh(ii),fGt=eh(nPt),dGt=eh(gS),pGt=eh(VGt),hGt(mGt=Ca((gGt=function(t){function e(){var e;(e=t.call(this)||this).__asset=yGt&&yGt(),e._effectAsset=vGt&&vGt(),e._lightmapInfos=SGt&&SGt(),e._receiveShadow=AGt&&AGt(),e._useNormalmap=TGt&&TGt(),e._usePBR=bGt&&bGt(),e._lodEnable=EGt&&EGt(),e._lodBias=CGt&&CGt(),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<NMt;++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 HGt(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],o=n/this.tileCount[1],a=t.getAt(s*t.w,o*t.h)*e;this._heights[i++]=a}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),o=n/(t.h-1),a=s*this.size.width,h=o*this.size.height,u=this.getHeightAt(a,h);null!=u&&(t.data[i++]=u*e)}},i.exportAsset=function(){var t=new nPt;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&&eo(i.detailMap)){var n=new ePt;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?v.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;v.director.root.pipelineEvent.on(UD.RENDER_CAMERA_BEGIN,this.onUpdateFromCamera,this)},i.onDisable=function(){v.director.root.pipelineEvent.off(UD.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?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,r=this.getHeight(t,e);return new mn(i,r,n)},i.getHeightField=function(){return this._heights},i.setHeight=function(t,e,i){i=Ni(i,HMt,WMt),this._heights[e*this.vertexCount[0]+t]=GMt+i/UMt},i.getHeight=function(t,e){return(this._heights[e*this.vertexCount[0]+t]-GMt)*UMt},i.getHeightClamp=function(t,e){return t=Ni(t,0,this.vertexCount[0]-1),e=Ni(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),o=r+1,a=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=Ni(r,0,this.vertexCount[0]-1),s=Ni(s,0,this.vertexCount[1]-1),o=Ni(o,0,this.vertexCount[0]-1),a=Ni(a,0,this.vertexCount[1]-1);var l=this.getHeight(r,s),c=this.getHeight(o,s),_=this.getHeight(r,a),f=this.getHeight(o,a),d=.5*(c+_);return h+u<=1?f=d+(d-l):l=d+(d-f),(l*(1-h)+c*h)*(1-u)+(_*(1-h)+f*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=new mn;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),o=r+1,a=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=Ni(r,0,this.vertexCount[0]-1),s=Ni(s,0,this.vertexCount[1]-1),o=Ni(o,0,this.vertexCount[0]-1),a=Ni(a,0,this.vertexCount[1]-1);var l=this.getNormal(r,s),c=this.getNormal(o,s),_=this.getNormal(r,a),f=this.getNormal(o,a),d=new mn;mn.add(d,c,_).multiplyScalar(.5),h+u<=1?(f.set(d),f.subtract(l),f.add(d)):(l.set(d),l.subtract(f),l.add(d));var p=new mn,m=new mn,g=new mn;return mn.lerp(p,l,c,h),mn.lerp(m,_,f,h),mn.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 ln;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,o=Math.floor(r),a=Math.floor(s),h=o+1,u=a+1,l=r-o,c=s-a;if(o<0||o>i-1||a<0||a>n-1)return null;o=Ni(o,0,i-1),a=Ni(a,0,n-1),h=Ni(h,0,i-1),u=Ni(u,0,n-1);var _=this.getWeight(o,a),f=this.getWeight(h,a),d=this.getWeight(o,u),p=this.getWeight(h,u),m=new ln;ln.add(m,f,d).multiplyScalar(.5),l+c<=1?(p=new ln,ln.subtract(p,m,_).add(m)):(_=new ln,ln.subtract(_,m,p).add(m));var g=new ln,y=new ln,v=new ln;return ln.lerp(g,_,f,l),ln.lerp(y,d,p,l),ln.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,o=Math.floor(r),a=Math.floor(s);if(o<0||o>i-1||a<0||a>n-1)return null;var h=this.getWeight(o,a),u=Math.floor(t/this.weightMapSize),l=Math.floor(e/this.weightMapSize),c=this.getBlock(u,l),_=0;return h.y>h[_]&&-1!==c.getLayer(1)&&(_=1),h.y>h[_]&&-1!==c.getLayer(2)&&(_=2),h.z>h[_]&&-1!==c.getLayer(3)&&(_=3),_=c.getLayer(_),this.getLayer(_)},i.getBlockLayers=function(t,e){var i=(e*this._blockCount[0]+t)*LMt;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)*LMt;return this._layerBuffer[n+i]},i.setBlockLayer=function(t,e,i,n){var r=(e*this._blockCount[0]+t)*LMt;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&&mn.subtract(r,t,this.node.getWorldPosition());var s=new mn;s.set(e),s.multiplyScalar(i);var o=null;if(e.equals(new mn(0,1,0))){var a=this.getHeightAt(r.x,r.z);null!=a&&r.y<=a&&(o=new mn(r.x,a,r.z))}else if(e.equals(new mn(0,-1,0))){var h=this.getHeightAt(r.x,r.z);null!=h&&r.y>=h&&(o=new mn(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){o=new mn(r.x,c,r.z);break}r.add(s)}}return o},i._createSharedIndexBuffer=function(){var t=nd.gfxDevice;if(null!==this._lod){var e=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,Uint16Array.BYTES_PER_ELEMENT*this._lod._indexBuffer.length,Uint16Array.BYTES_PER_ELEMENT));return e.update(this._lod._indexBuffer),e}for(var i=new Uint16Array(FMt*FMt*6),n=0,r=0;r<FMt;++r)for(var s=0;s<FMt;++s){var o=r*kMt+s,a=r*kMt+s+1,h=(r+1)*kMt+s,u=(r+1)*kMt+s+1;i[n++]=o,i[n++]=h,i[n++]=a,i[n++]=a,i[n++]=h,i[n++]=u}var l=t.createBuffer(new E_(Ec.INDEX|Ec.TRANSFER_DST,wc.DEVICE,Uint16Array.BYTES_PER_ELEMENT*i.length,Uint16Array.BYTES_PER_ELEMENT));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 kGt),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 zGt)},i._updateLightmap=function(t,e,i,n,r,s){if(e){if(0===this._lightmapInfos.length)for(var o=0;o<this._blockCount[0]*this._blockCount[1];++o)this._lightmapInfos.push(new zGt)}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 o=new mn;return o.set(n),o.cross(i),o.multiplyScalar(r),o.normalize(),o},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<KMt)for(var r=function(){var t=new GGt,n=i.layerBinaryInfos[s];t.tileSize=n.tileSize,v.assetManager.loadAny(n.detailMapId,(function(e,i){t.detailMap=i})),""!==n.normalMapId&&v.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 o=0;o<i.layerInfos.length;++o){var a=new GGt,h=i.layerInfos[o];a.tileSize=h.tileSize,a.detailMap=h.detailMap,a.normalMap=h.normalMap,a.roughness=h.roughness,a.metallic=h.metallic,this._layerList[h.slot]=a}}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]=GMt,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]*LMt;if(null===this._layerBuffer||this._layerBuffer.length!==c){this._layerBuffer=new Array(c);for(var _=0;_<c;++_)this._layerBuffer[_]=-1;i&&(i.layerBuffer=this._layerBuffer)}var f=this._weightMapSize*this._blockCount[0],d=this._weightMapSize*this._blockCount[1];if(this._weights.length!==f*d*4){this._weights=new Uint8Array(f*d*4);for(var p=0;p<f*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 HGt(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]=GMt;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 o=0;o<n;++o){var a=s*t.vertexCount[0]+o,h=s*this.vertexCount[0]+o;e[a]=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]*LMt;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 o=0;o<n;++o)for(var a=s*t.blockCount[0]+o,h=s*this.blockCount[0]+o,u=0;u<LMt;++u)e[a*LMt+u]=this._layerBuffer[h*LMt+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],o=t.weightMapSize*t.blockCount[1];if(s===n&&o===r)return!1;for(var a=new Uint8Array(s*o*4),h=0;h<s*o;++h)a[4*h+0]=255,a[4*h+1]=0,a[4*h+2]=0,a[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 ln;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},_=function(t,n,r,s){var o=Math.floor(t),a=Math.floor(n),h=Math.min(o+1,i-1),u=Math.min(a+1,i-1),l=t-o,_=n-a,f=c(o+r,a+s,e._weights),d=c(h+r,a+s,e._weights),p=c(o+r,u+s,e._weights),m=c(h+r,u+s,e._weights),g=new ln;ln.add(g,d,p).multiplyScalar(.5),l+_<=1?(m.set(g),m.subtract(f),m.add(g)):(f.set(g),f.subtract(m),f.add(g));var y=new ln,v=new ln,S=new ln;return ln.lerp(y,f,d,l),ln.lerp(v,p,m,l),ln.lerp(S,y,v,_),S},f=0;f<l;++f)for(var d=0;d<u;++d)for(var p=d*i,m=f*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):_(y/(t.weightMapSize-1)*(i-1),g/(t.weightMapSize-1)*(i-1),p,m,this._weights);var S=d*t.weightMapSize+y,A=(f*t.weightMapSize+g)*s+S;a[4*A+0]=255*v.x,a[4*A+1]=255*v.y,a[4*A+2]=255*v.z,a[4*A+3]=255*v.w}return this._weights=a,!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<NMt;++i)this._layerList.push(null)}nd.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 kGt,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 HGt(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 Kn(0,0);return t.width=this.blockCount[0]*FMt*this.tileSize,t.height=this.blockCount[1]*FMt*this.tileSize,t}},{key:"tileSize",get:function(){return this._tileSize}},{key:"tileCount",get:function(){return[this.blockCount[0]*FMt,this.blockCount[1]*FMt]}},{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 VGt;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}(Lp),yGt=fa(gGt.prototype,"__asset",[uGt,Ma],(function(){return null})),vGt=fa(gGt.prototype,"_effectAsset",[lGt,Ma],(function(){return null})),SGt=fa(gGt.prototype,"_lightmapInfos",[cGt,Ma],(function(){return[]})),AGt=fa(gGt.prototype,"_receiveShadow",[Ma],(function(){return!1})),TGt=fa(gGt.prototype,"_useNormalmap",[Ma],(function(){return!1})),bGt=fa(gGt.prototype,"_usePBR",[Ma],(function(){return!1})),EGt=fa(gGt.prototype,"_lodEnable",[Ma],(function(){return!1})),CGt=fa(gGt.prototype,"_lodBias",[_Gt,Ma],(function(){return 0})),m(gGt.prototype,"_asset",[fGt],Object.getOwnPropertyDescriptor(gGt.prototype,"_asset"),gGt.prototype),m(gGt.prototype,"effectAsset",[dGt],Object.getOwnPropertyDescriptor(gGt.prototype,"effectAsset"),gGt.prototype),m(gGt.prototype,"info",[pGt],Object.getOwnPropertyDescriptor(gGt.prototype,"info"),gGt.prototype),mGt=gGt))||mGt)||mGt)),function(t){t[t.ORTHO=0]="ORTHO",t[t.HEX=1]="HEX",t[t.ISO=2]="ISO"}(xGt||(xGt={})),xe(xGt),function(t){t[t.NONE=0]="NONE",t[t.MAP=1]="MAP",t[t.LAYER=2]="LAYER",t[t.OBJECTGROUP=3]="OBJECTGROUP",t[t.OBJECT=4]="OBJECT",t[t.TILE=5]="TILE"}(wGt||(wGt={})),xe(wGt),function(t){t[t.HORIZONTAL=2147483648]="HORIZONTAL",t[t.VERTICAL=1073741824]="VERTICAL",t[t.DIAGONAL=536870912]="DIAGONAL",t[t.FLIPPED_ALL=4026531840]="FLIPPED_ALL",t[t.FLIPPED_MASK=268435455]="FLIPPED_MASK"}(DGt||(DGt={})),xe(DGt),function(t){t[t.STAGGERAXIS_X=0]="STAGGERAXIS_X",t[t.STAGGERAXIS_Y=1]="STAGGERAXIS_Y"}(RGt||(RGt={})),xe(RGt),function(t){t[t.STAGGERINDEX_ODD=0]="STAGGERINDEX_ODD",t[t.STAGGERINDEX_EVEN=1]="STAGGERINDEX_EVEN"}(IGt||(IGt={})),xe(IGt),function(t){t[t.RightDown=0]="RightDown",t[t.RightUp=1]="RightUp",t[t.LeftDown=2]="LeftDown",t[t.LeftUp=3]="LeftUp"}(MGt||(MGt={})),xe(MGt),function(t){t[t.RECT=0]="RECT",t[t.ELLIPSE=1]="ELLIPSE",t[t.POLYGON=2]="POLYGON",t[t.POLYLINE=3]="POLYLINE",t[t.IMAGE=4]="IMAGE",t[t.TEXT=5]="TEXT"}(PGt||(PGt={})),xe(PGt);var WGt=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 Kn(0,0),this.tileOffset=new jn(0,0),this._tileSize=new Kn(0,0),this.collection=!1}return t.prototype.rectForGID=function(t,e){var i=e||new Zn(0,0,0,0);i.width=this._tileSize.width,i.height=this._tileSize.height;var n=t;if(n&=DGt.FLIPPED_MASK,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}(),jGt=function(){function t(){this.properties={},this.name="",this.objects=[],this.visible=!0,this.opacity=0,this.color=new bn(255,255,255,255),this.offset=new jn(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}(),XGt=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 jn(0,0),this.tintColor=null}var e=t.prototype;return e.getProperties=function(){return this.properties},e.setProperties=function(t){this.properties=t},t}();XGt.ATTRIB_NONE=1,XGt.ATTRIB_BASE64=2,XGt.ATTRIB_GZIP=4,XGt.ATTRIB_ZLIB=8;var YGt=function(){this.name="",this.visible=!0,this.width=0,this.height=0,this.offset=new jn(0,0),this.opacity=0,this.trans=new bn(255,255,255,255),this.sourceImage=void 0,this.tintColor=null};function qGt(t){var e=UL.HorizontalAlign;switch(t){case"center":return e.CENTER;case"right":return e.RIGHT;default:return e.LEFT}}function KGt(t){var e=UL.VerticalAlign;switch(t){case"center":return e.CENTER;case"bottom":return e.BOTTOM;default:return e.TOP}}function QGt(t){if(!t)return new bn(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 bn(i,n,r,e)}var s=parseInt(t.substr(0,2),16)||0,o=parseInt(t.substr(2,2),16)||0,a=parseInt(t.substr(4,2),16)||0;return new bn(s,o,a,255)}function ZGt(t,e){for(var i=[],n=t.getElementsByTagName("properties"),r=0;r<n.length;++r)for(var s=n[r].getElementsByTagName("property"),o=0;o<s.length;++o)i.push(s[o]);e=e||{};for(var a=0;a<i.length;a++){var h=i[a],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=QGt(c)),e[u]=c}return e}var JGt,$Gt,tUt,eUt,iUt,nUt,rUt,sUt,oUt,aUt,hUt,uUt,lUt,cUt=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=MGt.RightDown,this._supportVersion=[1,4,0],this._objectGroups=[],this._allChildren=[],this._mapSize=new Kn(0,0),this._tileSize=new Kn(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 Kn(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 Kn(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=XGt.ATTRIB_NONE,this.parentElement=null,this.parseXMLString(t)},e.parseXMLString=function(e,i){var n,r=(new TA).parse(e).documentElement,s=r.getAttribute("orientation"),o=r.getAttribute("staggeraxis"),a=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("."),_=this._supportVersion;for(n=0;n<_.length;n++){var f=parseInt(c[n])||0;if(_[n]<f){K(7216,l);break}}"orthogonal"===s?this.orientation=xGt.ORTHO:"isometric"===s?this.orientation=xGt.ISO:"hexagonal"===s?this.orientation=xGt.HEX:null!==s&&K(7217,s),this.renderOrder="right-up"===u?MGt.RightUp:"left-up"===u?MGt.LeftUp:"left-down"===u?MGt.LeftDown:MGt.RightDown,"x"===o?this.setStaggerAxis(RGt.STAGGERAXIS_X):"y"===o&&this.setStaggerAxis(RGt.STAGGERAXIS_Y),"odd"===a?this.setStaggerIndex(IGt.STAGGERINDEX_ODD):"even"===a&&this.setStaggerIndex(IGt.STAGGERINDEX_EVEN),h&&this.setHexSideLength(parseFloat(h));var d=new Kn(0,0);d.width=parseFloat(r.getAttribute("width")),d.height=parseFloat(r.getAttribute("height")),this.setMapSize(d),(d=new Kn(0,0)).width=parseFloat(r.getAttribute("tilewidth")),d.height=parseFloat(r.getAttribute("tileheight")),this.setTileSize(d),this.properties=ZGt(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 S=m.getElementsByTagName("image"),A=S.length>1,T=S[0],b=T.getAttribute("source");b=b.replace(/\\/g,"/");var E=m.getElementsByTagName("tile"),C=E&&E.length||1,x=null,w=m.getAttribute("name")||"",D=parseInt(m.getAttribute("spacing"))||0,R=parseInt(m.getAttribute("margin"))||0,I=i||parseInt(m.getAttribute("firstgid"))||0,M=new Kn(0,0);M.width=parseFloat(m.getAttribute("tilewidth")),M.height=parseFloat(m.getAttribute("tileheight"));var P=m.getElementsByTagName("tileoffset")[0],B=0,O=0;P&&(B=parseFloat(P.getAttribute("x"))||0,O=parseFloat(P.getAttribute("y"))||0);for(var L=null,N=0;N<C;N++){var F=S[N]?S[N]:T;if(F){var k=F.getAttribute("source");if(k=k.replace(/\\/g,"/"),!L||A){if((L=new WGt).name=w,L.firstGid=I&DGt.FLIPPED_MASK,L.tileOffset.x=B,L.tileOffset.y=O,L.collection=A,!A&&(L.imageName=k,L.imageSize.width=parseFloat(F.getAttribute("width"))||0,L.imageSize.height=parseFloat(F.getAttribute("height"))||0,L.sourceImage=this._spriteFrameMap[k],!L.sourceImage)){var V=t.getNameWithPostfix(k);if(L.imageName=V,L.sourceImage=this._spriteFrameMap[V],!L.sourceImage){var G=t.getShortName(k);L.imageName=G,L.sourceImage=this._spriteFrameMap[G],L.sourceImage||(console.error("[error]: "+G+" not find in ["+Object.keys(this._spriteFrameMap).join(", ")+"]"),et(7221,k),console.warn("Please try asset type of "+k+" to 'sprite-frame'"))}}L.spacing=D,L.margin=R,L._tileSize.width=M.width,L._tileSize.height=M.height,this.setTilesets(L)}if(x=E&&E[N]){this.parentGID=I+(parseInt(x.getAttribute("id"))||0);var U=x.getElementsByTagName("image");x.hasAttribute("x")&&x.hasAttribute("y")&&(L.imageOffset=new jn(parseFloat(x.getAttribute("x"))||0,parseFloat(x.getAttribute("y"))||0));var z=x.hasAttribute("width")&&x.hasAttribute("height");if(z&&(L._tileSize.width=parseFloat(x.getAttribute("width"))||0,L._tileSize.height=parseFloat(x.getAttribute("height"))||0),U&&U.length>0){var H=U[0],W=H.getAttribute("source");if(W=W.replace(/\\/g,"/"),L.imageName=W,L.imageSize.width=parseFloat(H.getAttribute("width"))||0,L.imageSize.height=parseFloat(H.getAttribute("height"))||0,z||(L._tileSize.width=L.imageSize.width,L._tileSize.height=L.imageSize.height),L.sourceImage=this._spriteFrameMap[W],!L.sourceImage){var j=t.getNameWithPostfix(W);if(L.imageName=j,L.sourceImage=this._spriteFrameMap[j],!L.sourceImage){var X=t.getShortName(W);L.imageName=X,L.sourceImage=this._spriteFrameMap[X],L.sourceImage||(et(7221,W),console.warn("Please try asset type of "+W+" to 'sprite-frame'"))}}L.firstGid=this.parentGID&DGt.FLIPPED_MASK}var Y=(DGt.FLIPPED_MASK&this.parentGID)>>>0;this._tileProperties.set(Y,ZGt(x));var q=x.getElementsByTagName("animation");if(q&&q.length>0){var Q=q[0].getElementsByTagName("frame"),Z={frames:[],dt:0,frameIdx:0};this._tileAnimations.set(Y,Z);for(var J=Z.frames,$=0;$<Q.length;$++){var tt=Q[$],it=I+(parseInt(tt.getAttribute("tileid"))||0),nt=parseFloat(tt.getAttribute("duration"))||0;J.push({tileid:it,duration:nt/1e3,grid:null})}}}}}}}var rt=r.childNodes;for(n=0;n<rt.length;n++){var st=rt[n];if(!this._shouldIgnoreNode(st)){if("imagelayer"===st.nodeName){var ot=this._parseImageLayer(st);ot&&this.setImageLayers(ot)}if("layer"===st.nodeName){var at=this._parseLayer(st);this.setLayers(at)}if("objectgroup"===st.nodeName){var ht=this._parseObjectGroup(st);this.setObjectGroups(ht)}}}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 YGt;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?QGt(s):null;var o=e[0],a=o.getAttribute("source");return i.sourceImage=this._imageLayerSPF[a],i.width=parseInt(o.getAttribute("width"))||0,i.height=parseInt(o.getAttribute("height"))||0,i.trans=QGt(o.getAttribute("trans")),i.sourceImage?i:(et(7221,a),console.warn("Please try asset type of "+a+" to 'sprite-frame'"),null)},e._parseLayer=function(t){var e=t.getElementsByTagName("data")[0],i=new XGt;i.name=t.getAttribute("name");var n=new Kn(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 jn(parseFloat(t.getAttribute("offsetx"))||0,parseFloat(t.getAttribute("offsety"))||0);var o=t.getAttribute("tintcolor");i.tintColor=o?QGt(o):null;for(var a="",h=0;h<e.childNodes.length;h++)a+=e.childNodes[h].nodeValue;a=a.trim();var u,l=e.getAttribute("compression"),c=e.getAttribute("encoding");if(l&&"gzip"!==l&&"zlib"!==l)return K(7218),null;switch(l){case"gzip":u=rbt.unzipBase64AsArray(a,4);break;case"zlib":u=function(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}(new $M.Inflate(rbt.Base64.decodeAsArray(a,1)).decompress());break;case null:case"":if("base64"===c)u=rbt.Base64.decodeAsArray(a,4);else if("csv"===c){u=[];for(var _=a.split(","),f=0;f<_.length;f++)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===XGt.ATTRIB_NONE&&K(7219)}return u&&(i.tiles=new Uint32Array(u)),i.properties=ZGt(t),i},e._parseObjectGroup=function(t){var e=new jGt;e.name=t.getAttribute("name")||"",e.offset=new jn(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?QGt(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 o=t.getAttribute("draworder");o&&(e.draworder=o),e.setProperties(ZGt(t));var a=t.getElementsByTagName("object");if(a){for(var h=0;h<a.length;h++){var u=a[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,ZGt(u,l);var c=u.getAttribute("visible");l.visible=!(c&&0===parseInt(c));var _=u.getElementsByTagName("text");if(_&&_.length>0){var f=_[0];l.type=PGt.TEXT,l.wrap="1"===f.getAttribute("wrap"),l.color=QGt(f.getAttribute("color")),l.halign=qGt(f.getAttribute("halign")),l.valign=KGt(f.getAttribute("valign")),l.pixelsize=parseInt(f.getAttribute("pixelsize"))||16,l.text=f.childNodes[0].nodeValue}var d=u.getAttribute("gid");d&&(l.gid=parseInt(d),l.type=PGt.IMAGE);var p=u.getElementsByTagName("ellipse");p&&p.length>0&&(l.type=PGt.ELLIPSE);var m=u.getElementsByTagName("polygon");if(m&&m.length>0){l.type=PGt.POLYGON;var g=m[0].getAttribute("points");g&&(l.points=this._parsePointsString(g))}var y=u.getElementsByTagName("polyline");if(y&&y.length>0){l.type=PGt.POLYLINE;var v=y[0].getAttribute("points");v&&(l.polylinePoints=this._parsePointsString(v))}l.type||(l.type=PGt.RECT),e.objects.push(l)}"index"!==o&&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}(),_Ut=t("gE",(JGt=Ta("cc.TiledTile"),$Gt=ba(OO),tUt=eh(ei),eUt=eh(ei),iUt=eh(ei),nUt=eh(ei),rUt=eh(ei),JGt(sUt=$Gt((oUt=function(t){function e(){var e;return(e=t.call(this)||this)._layer=null,e._x=aUt&&aUt(),e._y=hUt&&hUt(),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(Nm.TRANSFORM_CHANGED,this._updatePosition,this),this.node.on(Nm.SIZE_CHANGED,this._updatePosition,this),this._resetTile(),this.updateInfo()},i.onDisable=function(){this._resetTile(),this.node.off(Nm.TRANSFORM_CHANGED,this._updatePosition,this),this.node.off(Nm.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))U("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)?U("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)?U("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}(Lp),aUt=fa(oUt.prototype,"_x",[tUt],(function(){return 0})),hUt=fa(oUt.prototype,"_y",[eUt],(function(){return 0})),m(oUt.prototype,"x",[iUt],Object.getOwnPropertyDescriptor(oUt.prototype,"x"),oUt.prototype),m(oUt.prototype,"y",[nUt],Object.getOwnPropertyDescriptor(oUt.prototype,"y"),oUt.prototype),m(oUt.prototype,"grid",[rUt],Object.getOwnPropertyDescriptor(oUt.prototype,"grid"),oUt.prototype),sUt=oUt))||sUt)||sUt));function fUt(t,e,i){var n=i||t.sourceImage,r=n.texture,s=t.collection;if(!t.imageSize.width||!t.imageSize.height){var o=t.sourceImage;t.imageSize.width=o.width,t.imageSize.height=o.height}var a=t.imageSize.width,h=t.imageSize.height,u=t._tileSize.width,l=t._tileSize.height,c=n.width,_=n.height,f=t.spacing,d=t.margin,p=1;if(!s){var m=Math.floor((a-2*d+f)/(u+f)),g=Math.floor((h-2*d+f)/(l+f));p=Math.max(1,g*m)}for(var y=t.firstGid,v=null,S=!!e.get(y),A=t.firstGid+p,T=y;T<A&&(S&&!e.get(T)&&(S=!1),S||!e.get(T));++T){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:T,spriteFrame:n,texture:r},t.rectForGID(T,v),!i||p>1||t.imageOffset)if(i){v._name=i.name;var b=i.unbiasUV[0],E=i.rotated?i.unbiasUV[1]:i.unbiasUV[5];v.l=b+(v.x+.5)/c,v.t=E+(v.y+.5)/_,v.r=b+(v.x+v.width-.5)/c,v.b=E+(v.y+v.height-.5)/_,v._rect=new Zn(v.x,v.y,v.width,v.height)}else v.l=v.x/c,v.t=v.y/_,v.r=(v.x+v.width)/c,v.b=(v.y+v.height)/_,v._rect=new Zn(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(T,v)}}for(var dUt,pUt,mUt,gUt,yUt,vUt,SUt,AUt,TUt,bUt,EUt,CUt,xUt,wUt,DUt,RUt,IUt,MUt,PUt,BUt,OUt,LUt,NUt,FUt,kUt,VUt,GUt,UUt,zUt,HUt,WUt,jUt,XUt=new Vn,YUt=new jn,qUt=new mn,KUt=new mn,QUt={row:0,col:0},ZUt=t("gB",Ta("cc.TiledUserNodeData")(uUt=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}(Lp))||uUt),JUt=t("gC",Ta("cc.TiledLayer")(lUt=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 nO,this._drawInfoList[t].setDrawInfoType(KB.MIDDLEWARE)),this._drawInfoList[t]},e.hasTiledNode=function(){return this._hasTiledNodeGrid},e.hasAnimation=function(){return this._hasAniGrid},e.addUserNode=function(t){var e=t.getComponent(ZUt);return e?(U("CCTiledLayer:addUserNode node has been added"),!1):(e=t.addComponent(ZUt),t.parent=this.node,this._userNodeMap[t.uuid]=e,e._row=-1,e._col=-1,e._tiledLayer=this,this._nodeLocalPosToLayerPos(t.getPosition(),YUt),this._positionToRowCol(YUt.x,YUt.y,QUt),this._addUserNodeToGrid(e,QUt),this._updateCullingOffsetByUserNode(t),t.on(Nm.TRANSFORM_CHANGED,this._userNodePosChange,e),t.on(Nm.SIZE_CHANGED,this._userNodeSizeChange,e),!0)},e.removeUserNode=function(t){var e=t.getComponent(ZUt);return e?(t.off(Nm.TRANSFORM_CHANGED,this._userNodePosChange,e),t.off(Nm.SIZE_CHANGED,this._userNodeSizeChange,e),this._removeUserNodeFromGrid(e),delete this._userNodeMap[t.uuid],t._removeComponent(e),e.destroy(),t.removeFromParent(),!0):(U("CCTiledLayer:removeUserNode node is not exist"),!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(),YUt),this._positionToRowCol(YUt.x,YUt.y,QUt),this._addUserNodeToGrid(e,QUt),this._updateCullingOffsetByUserNode(e.node)}},e._updateCullingOffsetByUserNode=function(t){var e=t._uiProps.uiTransformComp.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(),YUt),i._positionToRowCol(YUt.x,YUt.y,QUt),i._limitInLayer(QUt),QUt.row===t._row&&QUt.col===t._col||(i._removeUserNodeFromGrid(t),i._addUserNodeToGrid(t,QUt))},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=FI.root.batcher2D.getFirstRenderCamera(this.node),e=null==t?void 0:t.node;return this._cameraNode!==e&&(this._uninstallCamera(),e&&(e.on(Nm.TRANSFORM_CHANGED,this.updateCulling,this),e.on(Nm.SIZE_CHANGED,this.updateCulling,this),this._cameraNode=e)),t},e._uninstallCamera=function(){this._cameraNode&&(this._cameraNode.off(Nm.TRANSFORM_CHANGED,this.updateCulling,this),this._cameraNode.off(Nm.SIZE_CHANGED,this.updateCulling,this),delete this._cameraNode)},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(Nm.ANCHOR_CHANGED,this._syncAnchorPoint,this),this.node.on(Nm.TRANSFORM_CHANGED,this.updateCulling,this),this.node.on(Nm.SIZE_CHANGED,this.updateCulling,this),this.node.parent.on(Nm.TRANSFORM_CHANGED,this.updateCulling,this),this.node.parent.on(Nm.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)||void 0===e||e.off(Nm.SIZE_CHANGED,this.updateCulling,this),null===(i=this.node.parent)||void 0===i||i.off(Nm.TRANSFORM_CHANGED,this.updateCulling,this),this.node.off(Nm.SIZE_CHANGED,this.updateCulling,this),this.node.off(Nm.TRANSFORM_CHANGED,this.updateCulling,this),this.node.off(Nm.ANCHOR_CHANGED,this._syncAnchorPoint,this),this._uninstallCamera()},e._syncAnchorPoint=function(){var t=this.node,e=t._uiProps.uiTransformComp,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 xGt.ORTHO:return this._positionForOrthoAt(i,e);case xGt.ISO:return this._positionForIsoAt(i,e);case xGt.HEX: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 o=(s&DGt.FLIPPED_MASK)>>>0,a=this.texGrids.get(o).tileset.tileOffset;i=a.x,n=a.y}return new jn(.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 o=(s&DGt.FLIPPED_MASK)>>>0,a=this.texGrids.get(o).tileset.tileOffset;i=a.x,n=a.y}return new jn(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,o=Math.floor(t)+Math.floor(e)*this._layerSize.width,a=(this.tiles[o]&DGt.FLIPPED_MASK)>>>0;i=this.texGrids.get(a)?this.texGrids.get(a).tileset.tileOffset:{x:0,y:0};var h=this._staggerIndex===IGt.STAGGERINDEX_ODD?1:-1,u=0,l=0,c=0,_=0;switch(this._staggerAxis){case RGt.STAGGERAXIS_Y: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 RGt.STAGGERAXIS_X:_=0,t%2==1&&(_=r/2*-h),u=t*(n-(n-this._hexSideLength)/2)+i.x,l=(s-e-1)*r+_-i.y}return new jn(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,o=i;;o++)for(var a=e;a<s;a++){if(r>=t.length)return;this._updateTileForGID(t[r],a,o),r++}}},e.setTileGIDAt=function(t,e,i,n){var r=(t&DGt.FLIPPED_MASK)>>>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?K(7239,t):(n=n||0,this._updateTileForGID((r|n)>>>0,e,i)):K(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=(t&DGt.FLIPPED_MASK)>>>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 K(7237),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(this.tiles[i]&DGt.FLIPPED_MASK)>>>0},e.getTileFlagsAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTileFlagsAt: invalid position");if(!this.tiles)return K(7240),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(this.tiles[i]&DGt.FLIPPED_ALL)>>>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;this._layerOrientation===xGt.ISO&&(r=2);var s=this._viewPort.x-this._offset.x+this._leftDownToCenterX,o=this._viewPort.y-this._offset.y+this._leftDownToCenterY,a=s-this._leftOffset,h=o-this._downOffset,u=s+i+this._rightOffset,l=o+n+this._topOffset,c=this._cullingRect.leftDown,_=this._cullingRect.rightTop;a<0&&(a=0),h<0&&(h=0),this._positionToRowCol(a,h,QUt),QUt.row-=r,QUt.col-=r,QUt.row=QUt.row>0?QUt.row:0,QUt.col=QUt.col>0?QUt.col:0,QUt.row===c.row&&QUt.col===c.col||(c.row=QUt.row,c.col=QUt.col,this._cullingDirty=!0),u<0||l<0?(QUt.row=-1,QUt.col=-1):(this._positionToRowCol(u,l,QUt),QUt.row++,QUt.col++),QUt.row===_.row&&QUt.col===_.col||(_.row=QUt.row,_.col=QUt.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,o=.5*r,a=0,h=0,u=0,l=0,c=this._staggerAxis;switch(this._layerOrientation){case xGt.ORTHO:h=Math.floor(t/n),a=Math.floor(e/r);break;case xGt.ISO:h=Math.floor(t/s),a=Math.floor(e/o);break;case xGt.HEX:c===RGt.STAGGERAXIS_Y?(u=(a=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?o*-this._odd_even:0,a=Math.floor((e-l)/r))}return i.row=a,i.col=h,i},e.updateCulling=function(){if(this._enableCulling){this.node.updateWorldTransform(),Vn.invert(XUt,this.node.getWorldMatrix());var t=this._reinstallCamera();t&&(qUt.x=0,qUt.y=0,qUt.z=0,KUt.x=t.width,KUt.y=t.height,KUt.z=0,t.screenToWorld(qUt,qUt),t.screenToWorld(KUt,KUt),mn.transformMat4(qUt,qUt,XUt),mn.transformMat4(KUt,KUt,XUt),this.updateViewPort(qUt.x,qUt.y,KUt.x-qUt.x,KUt.y-qUt.y))}},e.getLayerOrientation=function(){return this._layerOrientation},e.getProperties=function(){return this._properties},e._updateVertex=function(t,e){var i=DGt.FLIPPED_MASK,n=this.vertices,r=this._layerOrientation,s=this.tiles;if(s){var o,a,h,u,l=this._rightTop,c=this._mapTileSize.width,_=this._mapTileSize.height,f=.5*c,d=.5*_,p=this._layerSize.height,m=this._layerSize.width,g=this.texGrids,y=0,v=0;r===xGt.HEX&&(o=this._staggerAxis,a=this._diffX1,h=this._diffY1,u=this._odd_even);var S,A,T,b=0,E=0,C=0,x=0,w=e*m+t;S=(s[w]&i)>>>0;var D=g.get(S);if(D){switch(this._animations.get(S)&&(this._hasAniGrid=this._hasAniGrid||!0),r){case xGt.ORTHO:y=(b=t)*c,v=(E=p-e-1)*_;break;case xGt.ISO:y=f*(b=p+t-e-1),v=d*(E=p+m-t-e-2);break;case xGt.HEX:y=t*(c-a)+(o===RGt.STAGGERAXIS_Y&&e%2==1?f*u:0),v=(p-e-1)*(_-h)+(o===RGt.STAGGERAXIS_X&&t%2==1?d*-u:0),b=t,E=p-e-1}var R=n[E]=n[E]||{minCol:0,maxCol:0},I=R[b]=R[b]||{left:0,bottom:0,index:0};R.minCol>b&&(R.minCol=b),R.maxCol<b&&(R.maxCol=b),l.row<E&&(l.row=E,r===xGt.ISO&&(l.row+=1)),l.col<b&&(l.col=b,r===xGt.ISO&&(l.col+=1));var M=D.tileset.tileOffset;y+=this._offset.x+M.x+D.offsetX,v+=this._offset.y-M.y-D.offsetY,C=(C=-M.y+D.tileset._tileSize.height-_)<0?0:C,A=M.y<0?0:M.y,T=-M.x<0?0:-M.x,x=(x=M.x+D.tileset._tileSize.width-c)<0?0:x,this._rightOffset<T&&(this._rightOffset=T),this._leftOffset<x&&(this._leftOffset=x),this._topOffset<A&&(this._topOffset=A),this._downOffset<C&&(this._downOffset=C),I.left=y,I.bottom=v,I.index=w,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 K(7236),null;var n=Math.floor(t)+Math.floor(e)*this._layerSize.width,r=this.tiledTiles[n];if(!r&&i){var s=new xg;return(r=s.addComponent(_Ut))._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 K(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,o=t.length;s<o;++s){var a=t[s];a&&fUt(a,i,a.sourceImage)}this._prepareToRender()},e.init=function(t,e,i,n,r){this._cullingDirty=!0,this._layerInfo=t,this._mapInfo=e;var s=t.layerSize;this._layerName=t.name,this.tiles=t.tiles,this._properties=t.properties,this._layerSize=s,this._minGID=t.minGID,this._maxGID=t.maxGID,this._opacity=t.opacity,t.tintColor&&(this._tintColor=t.tintColor),this.renderOrder=e.renderOrder,this._staggerAxis=e.getStaggerAxis(),this._staggerIndex=e.getStaggerIndex(),this._hexSideLength=e.getHexSideLength(),this._animations=e.getTileAnimations(),this._tilesets=i,this._textures=n,this.texGrids=r,this._layerOrientation=e.orientation,this._mapTileSize=e.getTileSize();var o=this._mapTileSize.width,a=this._mapTileSize.height,h=this._layerSize.width,u=this._layerSize.height;if(this._layerOrientation===xGt.HEX){var l=0,c=0,_=-2&o,f=-2&a;this._odd_even=this._staggerIndex===IGt.STAGGERINDEX_ODD?1:-1,this._staggerAxis===RGt.STAGGERAXIS_X?(this._diffX1=(_-this._hexSideLength)/2,this._diffY1=0,l=(this._diffX1+this._hexSideLength)*h+this._diffX1,c=f*u+f/2):(this._diffX1=0,this._diffY1=(f-this._hexSideLength)/2,l=_*h+_/2,c=(this._diffY1+this._hexSideLength)*u+this._diffY1),this.node._uiProps.uiTransformComp.setContentSize(l,c)}else if(this._layerOrientation===xGt.ISO){var d=h+u;this.node._uiProps.uiTransformComp.setContentSize(.5*o*d,.5*a*d)}else this.node._uiProps.uiTransformComp.setContentSize(h*o,u*a);this._offset=new jn(t.offset.x,-t.offset.y),this._useAutomaticVertexZ=!1,this._vertexZvalue=0,this._syncAnchorPoint(),this._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&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length)return t[t.length-1];var e={subNodes:[]};return this._tiledDataArray.push(e),e},e.destroyRenderData=function(){this._tiledDataArray.forEach((function(t){var e=t.renderData;e&&EO.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 AO(rO.CROSSED)},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,o=0;o<s;o+=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(i.subNodes)i.subNodes.forEach((function(i){if(i){t._drawInfoList[n]||(t._drawInfoList[n]=new nO);var r=t._drawInfoList[n];r.setDrawInfoType(KB.SUB_NODE),r.setSubNode(i.node),e.setDynamicRenderDrawInfo(r,n),n++}}));else{var r=i;if(r.texture){t._drawInfoList[n]||(t._drawInfoList[n]=new nO);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}(JO))||lUt),$Ut=t("gD",(dUt=Ta("cc.TiledObjectGroup"),pUt=ba(OO),mUt=eh(ni),dUt(gUt=pUt((m((yUt=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)._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){var n=DGt.FLIPPED_MASK,r=DGt.HORIZONTAL,s=DGt.VERTICAL;this._groupName=t.name,this._positionOffset=t.offset,this._mapInfo=e,this._properties=t.getProperties(),this._offset=new jn(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 o=e.mapSize,a=e.tileSize,h=0,u=0,l=new bn,c=xGt.ISO===e.orientation;if(e.orientation===xGt.HEX)e.getStaggerAxis()===RGt.STAGGERAXIS_X?(u=a.height*(o.height+.5),h=(a.width+e.getHexSideLength())*Math.floor(o.width/2)+a.width*(o.width%2)):(h=a.width*(o.width+.5),u=(a.height+e.getHexSideLength())*Math.floor(o.height/2)+a.height*(o.height%2));else if(c){var _=o.width+o.height;h=.5*a.width*_,u=.5*a.height*_}else h=o.width*a.width,u=o.height*a.height;var f=this.node._uiProps.uiTransformComp;f.setContentSize(h,u);for(var d=h*f.anchorX,p=u*(1-f.anchorY),m=t.objects,g={},y=0,v=m.length;y<v;y++){var S=m[y],A=S.type;S.offset=new jn(S.x,S.y);var T=S.points||S.polylinePoints;if(T)for(var b=0;b<T.length;b++)T[b].y*=-1;if(c){var E=S.x/a.height,C=S.y/a.height;S.x=.5*a.width*(o.height+E-C),S.y=.5*a.height*(o.width+o.height-E-C)}else S.y=u-S.y;if(A===PGt.TEXT){var x="text"+S.id;g[x]=!0;var w=this.node.getChildByName(x);w||(w=new xg),w.setRotationFromEuler(0,0,-S.rotation),w.setPosition(S.x-d,S.y-p),w.name=x,w.parent=this.node,w.setSiblingIndex(y),w.layer=this.node.layer;var D=w.getComponent(UL);D||(D=w.addComponent(UL));var R=w._uiProps.uiTransformComp;w.active=S.visible,R.anchorX=0,R.anchorY=1,this._tintColor?(l.set(this._tintColor),l.a*=this._opacity/255,D.color.set(l)):D.color.a*=this._opacity/255,D.overflow=UL.Overflow.SHRINK,D.lineHeight=S.height,D.string=S.text,D.horizontalAlign=S.halign,D.verticalAlign=S.valign,D.fontSize=S.pixelsize,R.setContentSize(S.width,S.height)}else if(A===PGt.IMAGE){var I=S.gid,M=(I&n)>>>0,P=i.get(M);if(!P)continue;var B=P.tileset,O="img"+S.id;g[O]=!0;var L=this.node.getChildByName(O);S.width=S.width||P.width,S.height=S.height||P.height,L&&L._objFlags&$s.Flags.HideInHierarchy&&(L.removeFromParent(),L.hideFlags|=$s.Flags.DontSave,L.destroy(),L=null),L||(L=new xg),this._animations.get(M)&&(this.aniObjects.push({object:S,imgNode:L,gridGID:M}),this._hasAniObj=!0);var N=B.tileOffset.x,F=B.tileOffset.y;L.active=S.visible,L.setRotationFromEuler(0,0,-S.rotation),L.setPosition(S.x-d,S.y-p),L.name=O,L.parent=this.node,L.setSiblingIndex(y),L.layer=this.node.layer;var k=L.getComponent(GF);k||(k=L.addComponent(GF));var V=L._uiProps.uiTransformComp;c?(V.anchorX=.5+N/S.width,V.anchorY=F/S.height):(V.anchorX=N/S.width,V.anchorY=F/S.height),this._tintColor?(l.set(this._tintColor),l.a*=this._opacity/255,k.color.set(l)):k.color.a*=this._opacity/255,k.sizeMode=GF.SizeMode.CUSTOM;var G=this._premultiplyAlpha?kc.ONE:kc.SRC_ALPHA;k.srcBlendFactor!==G&&(k.srcBlendFactor=G,k.material&&k._updateBlendFunc());var U=P.spriteFrame;U=U?U.clone():new wP,(I&r)>>>0&&(U.flipUVX=!U.flipUVX),(I&s)>>>0&&(U.flipUVY=!U.flipUVY),U.rotated=P._rotated,U.rect=P._rect,k.spriteFrame=U,V.setContentSize(S.width,S.height),k.markForUpdateRenderData()}}this._objects=m;for(var z=this.node.children,H=/^(?:img|text)\d+$/,W=0,j=z.length;W<j;W++){var X=z[W],Y=X.name;H.test(Y)&&!g[Y]&&X.destroy()}},i.update=function(){if(this._hasAniObj)for(var t=this.aniObjects,e=this._texGrids,i=xGt.ISO===this._mapInfo.orientation,n=0,r=t.length;n<r;n++){var s=t[n],o=s.gridGID,a=e.get(o);if(a){var h=a.tileset,u=s.object,l=s.imgNode,c=h.tileOffset.x,_=h.tileOffset.y,f=l._uiProps.uiTransformComp;i?(f.anchorX=.5+c/u.width,f.anchorY=_/u.height):(f.anchorX=c/u.width,f.anchorY=_/u.height);var d=l.getComponent(GF),p=d.spriteFrame;p.rotated=a._rotated,p.rect=a._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}(Lp)).prototype,"premultiplyAlpha",[mUt],Object.getOwnPropertyDescriptor(yUt.prototype,"premultiplyAlpha"),yUt.prototype),gUt=yUt))||gUt)||gUt)),tzt=t("gA",(vUt=Ta("cc.TiledMapAsset"),SUt=eh([lA]),AUt=eh([ri]),TUt=eh([wP]),bUt=eh([wP]),EUt=eh([ri]),CUt=eh([ri]),xUt=eh([Kn]),vUt((DUt=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).tmxXmlStr=RUt&&RUt(),e.tsxFiles=IUt&&IUt(),e.tsxFileNames=MUt&&MUt(),e.spriteFrames=PUt&&PUt(),e.imageLayerSpriteFrame=BUt&&BUt(),e.imageLayerSpriteFrameNames=OUt&&OUt(),e.spriteFrameNames=LUt&&LUt(),e.spriteFrameSizes=NUt&&NUt(),e}return s(e,t),e}(Fd),RUt=fa(DUt.prototype,"tmxXmlStr",[Ma],(function(){return""})),IUt=fa(DUt.prototype,"tsxFiles",[Ma,SUt],(function(){return[]})),MUt=fa(DUt.prototype,"tsxFileNames",[Ma,AUt],(function(){return[]})),PUt=fa(DUt.prototype,"spriteFrames",[Ma,TUt],(function(){return[]})),BUt=fa(DUt.prototype,"imageLayerSpriteFrame",[Ma,bUt],(function(){return[]})),OUt=fa(DUt.prototype,"imageLayerSpriteFrameNames",[Ma,EUt],(function(){return[]})),LUt=fa(DUt.prototype,"spriteFrameNames",[Ma,CUt],(function(){return[]})),NUt=fa(DUt.prototype,"spriteFrameSizes",[Ma,xUt],(function(){return[]})),wUt=DUt))||wUt)),ezt=(t("gz",(FUt=Ta("cc.TiledMap"),kUt=ba(OO),VUt=eh(tzt),FUt(GUt=kUt(((jUt=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)._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 Kn(0,0),e._tileSize=new Kn(0,0),e._mapOrientation=xGt.ORTHO,e._isApplied=!1,e._tmxFile=zUt&&zUt(),e._enableCulling=HUt&&HUt(),e.cleanupImageCache=WUt&&WUt(),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.__preload=function(){this._tmxFile&&!1===this._isApplied&&(this._applyFile(),this._isApplied=!0)},i.onEnable=function(){this.node.on(Nm.ANCHOR_CHANGED,this._syncAnchorPoint,this)},i.onDisable=function(){this.node.off(Nm.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,o={},a={},h=0;h<n.length;++h){var u=n[h];a[u]=r[h],t[h]=s[h];var l=t[h];l&&(e[l.name]=l,o[u]=l)}var c={},_=i.imageLayerSpriteFrame;n=i.imageLayerSpriteFrameNames;for(var f=0;f<_.length;++f)c[n[f]]=_[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 cUt(i.tmxXmlStr,m,o,a,c),v=y.getTilesets();v&&0!==v.length||K(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)||void 0===n||n.off(Nm.SIZE_CHANGED,t[e].updateCulling,t[e]),null===(r=t[e].node.parent)||void 0===r||r.off(Nm.TRANSFORM_CHANGED,t[e].updateCulling,t[e]),t[e].node.removeFromParent(),t[e].node.destroy()}t.length=0;for(var s=this._groups,o=0,a=s.length;o<a;o++)s[o].node.removeFromParent(),s[o].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._uiProps.uiTransformComp.anchorPoint,n=this.node._uiProps.uiTransformComp.width*i.x,r=this.node._uiProps.uiTransformComp.height*(1-i.y);for(t=0,e=this._layers.length;t<e;t++)this._layers[t].node._uiProps.uiTransformComp.setAnchorPoint(i);for(t=0,e=this._groups.length;t<e;t++){var s=this._groups[t],o=s.node._uiProps.uiTransformComp;o.anchorX=.5,o.anchorY=.5;var a=s.offset.x-n+o.width*o.anchorX,h=s.offset.y+r-o.height*o.anchorY;s.node.setPosition(a,h)}for(t=0,e=this._images.length;t<e;t++){var u=this._images[t]._uiProps.uiTransformComp;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=f(e.keys());!(i=n()).done;){var r=i.value,s=e.get(r);if(s)for(var o=s.frames,a=0;a<o.length;a++){var h=o[a];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?fUt(s,e,s.sourceImage):console.warn("Can't find the spriteFrame of tilesets "+n))}this._fillAniGrids(e,i);for(var o=this._layers,a=this._groups,h=this._images,u={},l=0,c=o.length;l<c;l++)u[o[l].node.name]=!0;for(var _=0,f=a.length;_<f;_++)u[a[_].node.name]=!0;for(var d=0,p=h.length;d<p;d++)u[h[d].name]=!0;o=this._layers=[],a=this._groups=[],h=this._images=[];var m=this._mapInfo,g=this.node,y=m.getAllChildren(),v=this._textures,S=0,A=0;if(y&&y.length>0)for(var T=0,b=y.length;T<b;T++){var E=y[T],C=E.name,x=this.node.getChildByName(C);if(u[C]=!1,x||((x=new xg).name=C,x.layer=g.layer,g.addChild(x)),x.setSiblingIndex(T),x.active=E.visible,E instanceof XGt){var w=x.getComponent(JUt);w||(w=x.addComponent(JUt)),w.init(E,m,t,v,e),w.enableCulling=this._enableCulling,E.ownTiles=!1,o.push(w)}else if(E instanceof jGt){var D=x.getComponent($Ut);D||(D=x.addComponent($Ut)),D._init(E,m,e),a.push(D)}else if(E instanceof YGt){var R=E.sourceImage;x.layerInfo=E,x._offset=new jn(E.offset.x,-E.offset.y);var I=x.getComponent(GF);I||(I=x.addComponent(GF)),I.color.a*=E.opacity,I.spriteFrame=R;var M=R.width,P=R.height;R.original&&(M=R.originalSize.width,P=R.originalSize.height),x._uiProps.uiTransformComp.setContentSize(M,P),h.push(x)}S=Math.max(S,x._uiProps.uiTransformComp.width),A=Math.max(A,x._uiProps.uiTransformComp.height)}for(var B=g.children,O=0,L=B.length;O<L;O++){var N=B[O];u[N.name]&&N.destroy()}this.node._uiProps.uiTransformComp.setContentSize(S,A),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 o=i[r];o&&o.sourceImage&&(this._textures[r]=o.sourceImage,n.push(o.sourceImage))}for(var a=0;a<this._imageLayers.length;a++){var h=this._imageLayers[a];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="":Uo.hasFeature(Uo.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=f(i.keys());!(e=r()).done;){var s=e.value,o=i.get(s),a=o.frames,h=a[o.frameIdx];o.dt+=t,h.duration<o.dt&&(o.dt=0,o.frameIdx++,o.frameIdx>=a.length&&(o.frameIdx=0),h=a[o.frameIdx]),n.set(s,h.grid)}for(var u=this.getLayers(),l=0,c=u.length;l<c;l++){var _=u[l];(_.hasAnimation()||_.node.hasChangedFlags)&&_.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}(Lp)).Orientation=xGt,jUt.Property=wGt,jUt.TileFlag=DGt,jUt.StaggerAxis=RGt,jUt.StaggerIndex=IGt,jUt.TMXObjectType=PGt,jUt.RenderOrder=MGt,zUt=fa((UUt=jUt).prototype,"_tmxFile",[Ma],(function(){return null})),m(UUt.prototype,"tmxAsset",[VUt],Object.getOwnPropertyDescriptor(UUt.prototype,"tmxAsset"),UUt.prototype),HUt=fa(UUt.prototype,"_enableCulling",[Ma],(function(){return!0})),WUt=fa(UUt.prototype,"cleanupImageCache",[Ma],(function(){return!0})),GUt=UUt))||GUt)||GUt)),Math.ceil(10922.5)),izt=[],nzt=0;nzt<4;nzt++)izt.push(new mn);var rzt,szt,ozt,azt=new Vn,hzt=new mn,uzt={row:0,col:0},lzt={x:0,y:0},czt={x:0,y:0},_zt={x:0,y:0},fzt={x:0,y:0},dzt=0,pzt=0,mzt=0,gzt=0,yzt=null,vzt=null,Szt={ensureAccessor:function(){if(!vzt){var t=FI.root.device;FI.root.batcher2D,vzt=new tO(t,GB,this.vCount),FI.on(LI.EVENT_BEFORE_DRAW,(function(){vzt.reset()}))}},createData:function(){},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,o=0;o<s;o+=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}},updateRenderData:function(t){if(t.updateCulling(),pzt=t.leftDownToCenterX,mzt=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=uzt,i=t.rightTop;switch(t.renderOrder){case MGt.RightDown:bzt(e,i,-1,1,t);break;case MGt.LeftDown:bzt(e,i,-1,-1,t);break;case MGt.RightUp:bzt(e,i,1,1,t);break;case MGt.LeftUp:default:bzt(e,i,1,-1,t)}t.setCullingDirty(!1),t.setUserNodeDirty(!1)}},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,r=f(t.tiledDataArray);!(n=r()).done;){var s=n.value;if(s.renderData)for(var o=s.renderData,a=o.vData,h=o.vertexStart,u=o.vertexCount;h<u;h++)a.set(i,9*h+5)}}};function Azt(t,e){var i;t._rotated?(lzt.x=t.r,lzt.y=t.t,czt.x=t.l,czt.y=t.t,_zt.x=t.r,_zt.y=t.b,fzt.x=t.l,fzt.y=t.b):(lzt.x=t.l,lzt.y=t.t,czt.x=t.l,czt.y=t.b,_zt.x=t.r,_zt.y=t.t,fzt.x=t.r,fzt.y=t.b),(e&DGt.DIAGONAL)>>>0&&(i=czt,czt=_zt,_zt=i),(e&DGt.HORIZONTAL)>>>0&&(i=lzt,lzt=_zt,_zt=i,i=czt,czt=fzt,fzt=i),(e&DGt.VERTICAL)>>>0&&(i=lzt,lzt=czt,czt=i,i=_zt,_zt=fzt,fzt=i)}function Tzt(){if(!(gzt<1)&&yzt){var t=4*gzt,e=6*gzt,i=szt.requestTiledRenderData();i.renderData=EO.add(GB),i.texture=yzt;var n=i.renderData;n.resize(t,e),n.chunk.vb.set(rzt.subarray(0,9*t),0),gzt=0,yzt=null}}function bzt(t,e,i,n,r){if(!(e.row<0||e.col<0)){szt=r;var s=r.node.worldMatrix;dzt=0;var o,a,h,u,l,c,_,f,d,p=r.tiledTiles,m=r.texGrids,g=r.tiles,y=18,v=27,S=r.vertices,A=0,T=0,b=0,E=0,C=0,x=0,w=!0;ozt=Azt;var D=new Float32Array(4);D[0]=r.color.r/255,D[1]=r.color.g/255,D[2]=r.color.b/255,D[3]=r.color.a/255,-1===i?(u=e.row,l=t.row):(u=t.row,l=e.row);var R=Math.abs(t.row-e.row)+1,I=Math.abs(e.col-t.col)+1;rzt=new Float32Array(R*I*36),gzt=0;for(var M=rzt;(l-u)*i>=0;u+=i)for(o=S[u],x=r.getNodesCountByRow(u),w=o&&0===x,1===n?(a=w&&t.col<o.minCol?o.minCol:t.col,h=w&&e.col>o.maxCol?o.maxCol:e.col):(a=w&&e.col>o.maxCol?o.maxCol:e.col,h=w&&t.col<o.minCol?o.minCol:t.col);(h-a)*n>=0;a+=n){if(c=o&&o[a],x>0){Tzt();var P=r.requestSubNodesData(),B=r.getNodesByRowCol(u,a);B&&B.count>0&&(P.subNodes=B.list)}c&&(A=g[c.index],(f=m.get((A&DGt.FLIPPED_MASK)>>>0))&&(yzt!==f.texture&&(Tzt(),yzt=f.texture),_=f.tileset._tileSize,T=c.left-pzt,b=c.bottom-mzt,E=T+_.width,C=b+_.height,d=p[c.index],dzt=36*gzt,d?d.node.active&&Ezt(d.node,D,M,T,E,C,b,!1):(izt[0].x=T,izt[0].y=C,izt[1].x=T,izt[1].y=b,izt[2].x=E,izt[2].y=C,izt[3].x=E,izt[3].y=b,izt[0].transformMat4(s),M[dzt]=izt[0].x,M[dzt+1]=izt[0].y,M[dzt+2]=izt[0].z,izt[1].transformMat4(s),M[dzt+9]=izt[1].x,M[dzt+9+1]=izt[1].y,M[dzt+9+2]=izt[1].z,izt[2].transformMat4(s),M[dzt+y]=izt[2].x,M[dzt+y+1]=izt[2].y,M[dzt+y+2]=izt[2].z,izt[3].transformMat4(s),M[dzt+v]=izt[3].x,M[dzt+v+1]=izt[3].y,M[dzt+v+2]=izt[3].z,M.set(D,dzt+5),M.set(D,dzt+9+5),M.set(D,dzt+y+5),M.set(D,dzt+v+5)),ozt(f,A),M[dzt+3]=lzt.x,M[dzt+4]=lzt.y,M[dzt+9+3]=czt.x,M[dzt+9+4]=czt.y,M[dzt+y+3]=_zt.x,M[dzt+y+4]=_zt.y,M[dzt+v+3]=fzt.x,M[dzt+v+4]=fzt.y,++gzt>=ezt&&Tzt()))}Tzt()}}function Ezt(t,e,i,n,r,s,o,a){var h=18,u=27;t.updateWorldTransform(),Vn.fromRTS(azt,t.rotation,t.position,t.scale),mn.set(hzt,-(n+pzt),-(o+mzt),0),Vn.transform(azt,azt,hzt),Vn.multiply(azt,t.parent.worldMatrix,azt);var l=azt,c=l.m12,_=l.m13,f=l.m00,d=l.m01,p=l.m04,m=l.m05,g=1===f&&0===d&&0===p&&1===m;if(a){var y=(n+r)/2,v=(s+o)/2;g?(i[dzt]=y+c,i[dzt+1]=s+_,i[dzt+9]=n+c,i[dzt+9+1]=v+_,i[dzt+h]=r+c,i[dzt+h+1]=v+_,i[dzt+u]=y+c,i[dzt+u+1]=o+_):(i[dzt]=y*f+s*p+c,i[dzt+1]=y*d+s*m+_,i[dzt+9]=n*f+v*p+c,i[dzt+9+1]=n*d+v*m+_,i[dzt+h]=r*f+v*p+c,i[dzt+h+1]=r*d+v*m+_,i[dzt+u]=y*f+o*p+c,i[dzt+u+1]=y*d+o*m+_)}else g?(i[dzt]=n+c,i[dzt+1]=s+_,i[dzt+9]=n+c,i[dzt+9+1]=o+_,i[dzt+h]=r+c,i[dzt+h+1]=s+_,i[dzt+u]=r+c,i[dzt+u+1]=o+_):(i[dzt]=n*f+s*p+c,i[dzt+1]=n*d+s*m+_,i[dzt+9]=n*f+o*p+c,i[dzt+9+1]=n*d+o*m+_,i[dzt+h]=r*f+s*p+c,i[dzt+h+1]=r*d+s*m+_,i[dzt+u]=r*f+o*p+c,i[dzt+u+1]=r*d+o*m+_);i.set(e,dzt+5),i.set(e,dzt+9+5),i.set(e,dzt+h+5),i.set(e,dzt+u+5)}var Czt=t("gF",{getAssembler:function(){return Szt}});JUt.Assembler=Czt;var xzt=new mn,wzt=new mn;function Dzt(t,e){var i=null;return{value:e.length>0?e[e.length-1]:mn.ZERO,progress:function(t,e,n,r){return i.getPoint(r)},clone:function(t){return mn.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,o=n.relative,a=n.reversed;(i=Gl.create(t)).addKnot(r);var h=null;o&&a&&(h=wzt,mn.subtract(h,r,e[e.length-1]));for(var u=0,l=e.length;u<l;++u){var c=a?e[l-1-u]:e[u];o?a?u>0&&i.addKnot(mn.copy(xzt,h).add(c)):i.addKnot(mn.copy(xzt,r).add(c)):i.addKnot(c)}o&&a&&i.addKnot(s)},onComplete:function(){i=null},onStop:function(){i=null},legacyProgress:!1}}t("gG",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 Dzt(Rl.BEZIER,e)},catmullRom:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return Dzt(Rl.CATMULL_ROM,e)}}));var Rzt=function(){function t(){this.originalTarget=null,this.target=null,this.workerTarget=null,this.tag=t.TAG_INVALID,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.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}();Rzt.TAG_INVALID=-1;var Izt=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}(Rzt),Mzt=function(){this.actions=[],this.target=null,this.actionIndex=0,this.currentAction=null,this.paused=!1,this.lock=!1},Pzt=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 Mzt),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(Nm.ACTIVE_CHANGED,this._onNodeActiveChanged,this),t.on(Nm.NODE_DESTROYED,this._onNodeDestroy,this))},e._unregisterNodeEvent=function(t){t.isValid&&(t.off(Nm.ACTIVE_CHANGED,this._onNodeActiveChanged,this),t.off(Nm.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 xg&&this._registerNodeEvent(e),n.target=e,n.actions.push(t),t.startWithTarget(e)}else et(1e3)},e.removeAllActions=function(){for(var t=this._arrayTargets,e=0;e<t.length;e++){var i=t[e];i&&(i.target instanceof xg&&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 xg&&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;t===Rzt.TAG_INVALID&&K(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;t===Rzt.TAG_INVALID&&K(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){t===Rzt.TAG_INVALID&&K(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}K(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 xg&&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(!to(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 xg&&this._unregisterNodeEvent(r),this._deleteHashElement(e)&&n--)}else this.removeAllActionsFromTarget(r),n--}},t}(),Bzt=t("gH",function(t){function e(){var e;return(e=t.call(this)||this).actionMgr=new Pzt,e}return s(e,t),e.prototype.update=function(t){this.actionMgr.update(t)},n(e,[{key:"ActionManager",get:function(){return this.actionMgr}}]),e}(Jl));Bzt.ID="TWEEN",Bzt.instance=void 0,FI.on(LI.EVENT_INIT,(function(){var t=new Bzt;Bzt.instance=t,FI.registerSystem(Bzt.ID,t,Jl.Priority.MEDIUM)}));var Ozt=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}(Izt),Lzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;if(e)for(var i=e.getComponentsInChildren(ZO),n=0;n<i.length;++n)i[n].enabled=!0},i.reverse=function(){return new Nzt},i.clone=function(){var t=new e;return t._id=this._id,t},e}(Ozt),Nzt=function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;return i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;if(e)for(var i=e.getComponentsInChildren(ZO),n=0;n<i.length;++n)i[n].enabled=!1},i.reverse=function(){return new Lzt},i.clone=function(){var t=new e;return t._id=this._id,t},e}(Ozt);!function(t){function e(){return t.apply(this,arguments)||this}s(e,t);var i=e.prototype;i.update=function(){var t,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;if(e)for(var i=e.getComponentsInChildren(ZO),n=0;n<i.length;++n){var r=i[n];r.enabled=!r.enabled}},i.reverse=function(){return new e},i.clone=function(){var t=new e;return t._id=this._id,t}}(Ozt);var Fzt=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,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;e&&(e.removeFromParent(),this._isNeedCleanUp&&e.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},e}(Ozt);function kzt(t){return new Fzt(t)}var Vzt=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,e=null!==(t=this.workerTarget)&&void 0!==t?t:this.target;this._callback.call(this._callbackThis,e,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},e}(Ozt),Gzt=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},e}(Izt),Uzt=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?Pe.FLT_EPSILON:t,this._elapsed=0,this._firstTick=!0,!0},i.isDone=function(){return this._elapsed>=this._duration},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&&(this._elapsed-=t),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}(Izt),zzt=function(t){function e(i){var n;if((n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1,!i||0===i.length)return c(n);1===i.length&&i.push(new Gzt);var r=i.length-1;if(r>=0&&null==i[r]&&K(1015),r>=0){for(var s,o=i[0],a=1;a<r;a++)i[a]&&(s=o,o=e._actionOneTwo(s,i[a]));n.initWithTwoActions(o,i[r])}return n}s(e,t),e._actionOneTwo=function(t,i){var n=new e;return n.initWithTwoActions(t,i),n};var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return et(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 o=e[1];if(o.update(0),o.isUnknownDuration())return;o.stop()}}else{var a=e[0];if(n=1,i=1===r?1:(t-r)/(1-r),-1===s){if(a.startWithTarget(this.target),a.update(1),a.isUnknownDuration())return;a.stop()}if(0===s){if(a.update(1),a.isUnknownDuration())return;a.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=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),t._reversed=!0,t},i.updateWorkerTarget=function(t){if(!(this._actions.length<2)){this._actions[1].workerTarget=t;var i=this._actions[0];i instanceof e||i instanceof Yzt?i.updateWorkerTarget(t):i.workerTarget=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 Yzt)&&(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()},e}(Uzt);function Hzt(t){return new zzt(t)}var Wzt=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 Ozt&&(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()},e}(Uzt);function jzt(t,e){return new Wzt(t,e)}var Xzt=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):(et(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(){K(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()},e}(Uzt),Yzt=function(t){function e(i){var n;if((n=t.call(this)||this)._one=null,n._two=null,n._finished=!1,!i||0===i.length)return c(n);1===i.length&&i.push(new Gzt);var r=i.length-1;if(r>=0&&null==i[r]&&K(1015),r>=0){for(var s,o=i[0],a=1;a<r;a++)i[a]&&(s=o,o=e._actionOneTwo(s,i[a]));n.initWithTwoActions(o,i[r])}return n}s(e,t),e._actionOneTwo=function(t,i){var n=new e;return n.initWithTwoActions(t,i),n};var i=e.prototype;return i.initWithTwoActions=function(t,e){if(!t||!e)return et(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=zzt._actionOneTwo(e,Kzt(n-r)):n<r&&(this._one=zzt._actionOneTwo(t,Kzt(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=e._actionOneTwo(this._one.reverse(),this._two.reverse());return this._cloneDecoration(t),t}return this},i.updateWorkerTarget=function(t){if(this._one&&this._two){this._two.workerTarget=t;var i=this._one;i instanceof e||i instanceof zzt?i.updateWorkerTarget(t):i.workerTarget=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 zzt||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},e}(Uzt),qzt=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},e}(Uzt);function Kzt(t){return new qzt(t)}var Qzt,Zzt,Jzt,$zt,tHt,eHt,iHt,nHt,rHt,sHt,oHt,aHt,hHt,uHt,lHt,cHt,_Ht,fHt,dHt,pHt,mHt,gHt,yHt,vHt,SHt,AHt,THt,bHt,EHt,CHt,xHt,wHt=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?(et(1029),!1):!!t.prototype.initWithDuration.call(this,e.getDurationScaled())&&(this._other=e,!0):(et(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},e}(Uzt),DHt=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},e}(Uzt),RHt=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=v.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()},e}(Izt),IHt=t("gI",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(function(t){var e=" [Tween:] ",i=" option is not support in v + "+S,n=t;n.delay&&U(e+"delay"+i),n.repeat&&U(e+"repeat"+i),n.repeatDelay&&U(e+"repeatDelay"+i),n.interpolation&&U(e+"interpolation"+i),n.onStop&&U(e+"onStop"+i)}(n),n.easing&&"string"==typeof n.easing&&(n.easing=function(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}(n.easing)),n.progress||(n.progress=r.progress),n.easing&&"string"==typeof n.easing){var s=n.easing;n.easing=du[s],n.easing||$(1031,s)}for(var o in r._opts=n,r._props=Object.create(null),i){var a;if(i.hasOwnProperty(o)){var h=i[o];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=du[h.easing])||$(1031,h.easing):u=h.easing),void 0!==h.progress&&(l=h.progress)):c=h;var _=Object.create(null);_.start=_.current=_.end=null,_.keys=null,_.value=c,_.easing=u,_.progress=l,_.convert=h.convert,_.clone=h.clone,_.add=h.add,_.sub=h.sub,_.legacyProgress=null===(a=h.legacyProgress)||void 0===a||a,_.toFixed=h.toFixed,_.onStart=h.onStart,_.onStop=h.onStop,_.onComplete=h.onComplete,_.valid=!0,r._props[o]=_}}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.workerTarget=this.workerTarget,t._id=this._id,this._cloneDecoration(t),t},i.reverse=function(){if(!this._opts.relative)return $(16382),new e(0,{});var t=new e(this._duration,this._originProps,this._opts);return this._cloneDecoration(t),t._reversed=!this._reversed,t.workerTarget=this.workerTarget,t},i.startWithTarget=function(e){var i;t.prototype.startWithTarget.call(this,e);var n=null!==(i=this.workerTarget)&&void 0!==i?i:this.target;if(n){var r=!!this._opts.relative,s=this._props,o=this._reversed,a=function(){var t=n[h];if(void 0===t)return 0;var e=s[h],i=e.value;if("number"==typeof t)e.start=t,e.current=t,e.end=r?o?t-i:t+i:i;else if("object"==typeof t)if(e.legacyProgress){if(null==e.start){var a=t.constructor;e.start=new a,e.current=new a,e.end=new a}var u;u=i.getModifiableProperties?i.getModifiableProperties():Object.keys(i),e.keys=u;for(var l=0,c=u.length;l<c;++l){var _=u[l];isNaN(t[_])||(e.start[_]=t[_],e.current[_]=t[_],e.end[_]=r?o?t[_]-i[_]:t[_]+i[_]:i[_])}}else{var f=e.clone;if(!f)return $(16383,h),e.valid=!1,0;var d=e.add,p=e.sub;if(r&&(d||($(16384,h),e.valid=!1),o&&!p&&($(16385,h),e.valid=!1),!e.valid))return 0;e.start=f(t),e.current=f(t),e.end=r?o?p(t,i):d(t,i):f(i)}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))?($(16386,""+t),null):e},y=g(i),v=g(t);if(null==y||null==v)return e.valid=!1,0;e.start=v,e.current=t,e.end=r?o?v-y:v+y:y}e.onStart&&e.onStart({relative:r,reversed:o,start:e.start,end:e.end})};for(var h in s)a();this._opts.onStart&&this._opts.onStart(n)}},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,i=null!==(e=this.workerTarget)&&void 0!==e?e:this.target;if(i&&this._opts){var n=this._props,r=this._opts,s=t;"function"==typeof r.easing&&(s=r.easing(t));var o=r.progress;for(var a in n){var h=n[a];if(h.valid){var u=h.easing?h.easing(t):s,l=h.progress?h.progress:o,c=h.start,_=h.end,f=h.current;if("number"==typeof f)h.current=l(c,_,h.current,u);else if("object"==typeof c)if(h.legacyProgress)for(var d=h.keys,p=0,m=d.length;p<m;++p){var g=d[p];h.current[g]=l(c[g],_[g],h.current[g],u)}else h.current=l(c,_,h.current,u);else if("string"==typeof f){var y,v=l(c,_,h.current,u);if("number"==typeof v)v=v.toFixed(null!==(y=h.toFixed)&&void 0!==y?y:0);else if("string"!=typeof v){$(16387);continue}h.current=v}i[a]=h.current,1===t&&h.onComplete&&h.onComplete()}}r.onUpdate&&r.onUpdate(i,t),1===t&&r.onComplete&&r.onComplete(i)}},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}(Uzt)),MHt=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.target;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}(Ozt),PHt=t("gJ",function(){function t(t){this._actions=[],this._finalAction=null,this._target=null,this._tag=Rzt.TAG_INVALID,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 $(16388),this.clone(this._target);var t=this._union(!1),e=BHt(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()).workerTarget=t._target:$(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 zzt||i instanceof Yzt)&&(i=i.findAction(t)))return i}return null},e.insertAction=function(t){var e=t.clone();return this.updateWorkerTargetForAction(e),this._actions.push(e),this},e.updateWorkerTargetForAction=function(t){t&&(t instanceof zzt||t instanceof Yzt?t.updateWorkerTarget(this._target):t.workerTarget=this._target)},e.target=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){this._target=t;for(var e=0,i=this._actions.length;e<i;++e){var n=this._actions[e];this.updateWorkerTargetForAction(n)}return this})),e.getTarget=function(){return this._target},e.start=function(t){if(void 0===t&&(t=0),!this._target)return $(16392),this;this._finalAction&&Bzt.instance.ActionManager.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),Bzt.instance.ActionManager.addAction(e,this._target,!1)):$(16393),this},e.stop=function(){return this._finalAction&&(this._finalAction.stop(),Bzt.instance.ActionManager.removeAction(this._finalAction),this._finalAction=null),this},e.pause=function(){return this._finalAction?this._finalAction.setPaused(!0):$(16389),this},e.resume=function(){return this._finalAction?this._finalAction.setPaused(!1):$(16390),this},e.clone=function(t){var e=this._union(!1),i=BHt(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(Hzt(s))}return this},e.to=function(t,e,i){var n=i||Object.create(null);n.relative=!1;var r=new IHt(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 IHt(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 DHt(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 RHt(t,i);return this._actions.push(r),this},e.set=function(t){var e=new MHt(t);return this._actions.push(e),this},e.delay=function(t){var e=Kzt(t);return this._actions.push(e),this},e.call=function(t,e,i){var n=function(t,e,i){return new Vzt(t,e,i)}(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(jzt(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(jzt(i,Number.MAX_SAFE_INTEGER)):i instanceof Uzt?n.push(function(t){return new Xzt(t)}(i)):$(16394),this},e.reverseTime=function(e){var i,n=this._actions;return(i=e instanceof t?e._union(!1):n.pop())instanceof Uzt?n.push(function(t){return new wHt(t)}(i)):$(16395),this},e.hide=function(){if(this._target instanceof xg){var t=new Nzt;this._actions.push(t)}return this},e.show=function(){if(this._target instanceof xg){var t=new Lzt;this._actions.push(t)}return this},e.removeSelf=function(){if(this._target instanceof xg){var t=kzt(!1);this._actions.push(t)}return this},e.destroySelf=function(){if(this._target instanceof xg){var t=kzt(!0);this._actions.push(t)}return this},t.getRunningCount=function(t){return Bzt.instance.ActionManager.getNumberOfRunningActionsInTarget(t)},t.stopAll=function(){Bzt.instance.ActionManager.removeAllActions()},t.stopAllByTag=function(t,e){Bzt.instance.ActionManager.removeAllActionsByTag(t,e)},t.stopAllByTarget=function(t){Bzt.instance.ActionManager.removeAllActionsFromTarget(t)},t.pauseAllByTarget=function(t){Bzt.instance.ActionManager.pauseTarget(t)},t.resumeAllByTarget=function(t){Bzt.instance.ActionManager.resumeTarget(t)},e._union=function(t){var e=this._actions;if(0===e.length)return null;var i=Hzt(e);return t&&this.updateWorkerTargetForAction(i),i},e._unionForStart=function(){var t=this._actions;return 0===t.length?null:1===t.length&&t[0]instanceof Xzt?t[0]:Hzt(t)},t._tweenToActions=function(e){var i=t._tmp_args;i.length=0;for(var n=e.length,r=0;r<n;r++){var s=e[r],o=s._union(!0);o&&(o.setSpeed(s._timeScale),i.push(o))}},t._wrappedSequence=function(e){return t._tweenToActions(e),Hzt(t._tmp_args)},t._wrappedParallel=function(e){return t._tweenToActions(e),i=t._tmp_args,new Yzt(i);var i},n(t,[{key:"running",get:function(){return!!this._finalAction&&Bzt.instance.ActionManager.isActionRunning(this._finalAction)}},{key:"duration",get:function(){return this._finalAction?this._finalAction.getDuration():0}}]),t}());function BHt(t){return new PHt(t)}function OHt(t){return $(16396),new PHt(t)}PHt._tmp_args=[],v.Tween=PHt,v.tween=BHt,v.tweenUtil=OHt,function(t){t[t.Other=0]="Other",t[t.Left=1]="Left",t[t.Right=2]="Right"}(Qzt||(Qzt={})),function(t){t.XRUI_HOVER_ENTERED="xrui-hover-entered",t.XRUI_HOVER_EXITED="xrui-hover-exited",t.XRUI_HOVER_STAY="xrui-hover-stay",t.XRUI_CLICK="xrui-click",t.XRUI_UNCLICK="xrui-unclick"}(Zzt||(Zzt={})),function(t){t.XR_CAPS_LOCK="xr-caps-lock",t.XR_KEYBOARD_INIT="xr-keyboard-init",t.XR_KEYBOARD_INPUT="xr-keyboard-input",t.TO_LATIN="to-latin",t.TO_SYMBOL="to-symbol",t.TO_MATH_SYMBOL="to-math-symbol"}(Jzt||(Jzt={})),s((function(){for(var t,e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];return(t=xHt.call.apply(xHt,[this].concat(i))||this).deviceType=Qzt.Other,t.hitPoint=new mn,t}),xHt=rw);var LHt,NHt,FHt,kHt=new bn;!function(t){t[t.NONE=0]="NONE",t[t.COLOR=1]="COLOR",t[t.SPRITE=2]="SPRITE",t[t.SCALE=3]="SCALE"}(LHt||(LHt={})),xe(LHt),function(t){t[t.NORMAL=0]="NORMAL",t[t.HOVER=1]="HOVER",t[t.PRESSED=2]="PRESSED",t[t.DISABLED=3]="DISABLED"}(NHt||(NHt={})),function(t){t.CLICK="click"}(FHt||(FHt={}));var VHt=t("gM",($zt=Ta("cc.Button"),tHt=Ea(110),eHt=ba(OO),iHt=eh(xg),nHt=eh(LHt),rHt=eh(wP),sHt=eh(wP),oHt=eh(wP),aHt=eh(wP),hHt=eh([Pp]),$zt(uHt=tHt(uHt=eHt(((CHt=function(t){function e(){var e;return(e=t.call(this)||this).clickEvents=cHt&&cHt(),e._interactable=_Ht&&_Ht(),e._transition=fHt&&fHt(),e._normalColor=dHt&&dHt(),e._hoverColor=pHt&&pHt(),e._pressedColor=mHt&&mHt(),e._disabledColor=gHt&&gHt(),e._normalSprite=yHt&&yHt(),e._hoverSprite=vHt&&vHt(),e._pressedSprite=SHt&&SHt(),e._disabledSprite=AHt&&AHt(),e._duration=THt&&THt(),e._zoomScale=bHt&&bHt(),e._target=EHt&&EHt(),e._pressed=!1,e._hovered=!1,e._fromColor=new bn,e._toColor=new bn,e._time=0,e._transitionFinished=!0,e._fromScale=new mn,e._toScale=new mn,e._originalScale=null,e._sprite=null,e._targetScale=new mn,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&&(this._transition===LHt.COLOR||this._transition===LHt.SCALE)){this._time+=t;var i=1;if(this._duration>0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===LHt.COLOR){var n=e._uiProps.uiComp;bn.lerp(kHt,this._fromColor,this._toColor,i),n&&(n.color=kHt)}else this.transition===LHt.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=ki(this._fromScale.x,this._toScale.x,i),this._targetScale.y=ki(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(e===LHt.COLOR&&this._interactable){var i=t.getComponent(JO);i&&(i.color=this._normalColor)}else e===LHt.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(Nm.TOUCH_START,this._onTouchBegan,this),this.node.on(Nm.TOUCH_MOVE,this._onTouchMove,this),this.node.on(Nm.TOUCH_END,this._onTouchEnded,this),this.node.on(Nm.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(Nm.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(Nm.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(Zzt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(Zzt.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(Zzt.XRUI_CLICK,this._xrClick,this),this.node.on(Zzt.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(Nm.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(Nm.TOUCH_START,this._onTouchBegan,this),this.node.off(Nm.TOUCH_MOVE,this._onTouchMove,this),this.node.off(Nm.TOUCH_END,this._onTouchEnded,this),this.node.off(Nm.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(Nm.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(Nm.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(Zzt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(Zzt.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(Zzt.XRUI_CLICK,this._xrClick,this),this.node.off(Zzt.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(Nm.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(GF)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new mn),mn.copy(this._originalScale,this.target.scale),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===LHt.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case NHt.NORMAL:this._normalSprite=t;break;case NHt.HOVER:this._hoverSprite=t;break;case NHt.PRESSED:this._pressedSprite=t;break;case NHt.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===LHt.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case NHt.NORMAL:this._normalColor=t;break;case NHt.HOVER:this._hoverColor=t;break;case NHt.PRESSED:this._pressedColor=t;break;case NHt.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&Om.SCALE&&this._originalScale&&this._transition===LHt.SCALE&&this._transitionFinished&&mn.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._uiProps.uiTransformComp.hitTest(e.getLocation(),t.windowId);this._transition===LHt.SCALE&&this.target&&this._originalScale?n?(mn.copy(this._fromScale,this._originalScale),mn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?NHt.PRESSED:NHt.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Pp.emitEvents(this.clickEvents,t),this.node.emit(FHt.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&&(this._transition!==LHt.SPRITE||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=NHt.NORMAL;return this._interactable?this._pressed?t=NHt.PRESSED:this._hovered&&(t=NHt.HOVER):t=NHt.DISABLED,t},i._updateColorTransition=function(t){var e,i=this._getColorByState(t),n=null===(e=this.target)||void 0===e?void 0:e.getComponent(JO);n&&(t===NHt.DISABLED?(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&&(t===NHt.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(mn.copy(this._fromScale,this._originalScale),mn.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(mn.copy(this._fromScale,this.target.scale),mn.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===LHt.COLOR?this._updateColorTransition(t):e===LHt.SPRITE?this._updateSpriteTransition(t):e===LHt.SCALE&&this._updateScaleTransition(t)},i._getSpriteFrameByState=function(t){switch(t){case NHt.NORMAL:return this._normalSprite;case NHt.DISABLED:return this._disabledSprite;case NHt.HOVER:return this.hoverSprite;case NHt.PRESSED:return this._pressedSprite;default:return null}},i._getColorByState=function(t){switch(t){case NHt.NORMAL:return this._normalColor;case NHt.DISABLED:return this._disabledColor;case NHt.HOVER:return this._hoverColor;case NHt.PRESSED:return this._pressedColor;default:return new bn}},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Pp.emitEvents(this.clickEvents,this),this.node.emit(FHt.CLICK,this)),this._pressed=!1,this._updateState())},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&&(this._transition===LHt.COLOR?this._updateColorTransition(NHt.NORMAL):this._transition===LHt.SPRITE&&this._updateSpriteTransition(NHt.NORMAL),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(GF);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}(Lp)).Transition=LHt,CHt.EventType=FHt,m((lHt=CHt).prototype,"target",[iHt],Object.getOwnPropertyDescriptor(lHt.prototype,"target"),lHt.prototype),m(lHt.prototype,"transition",[nHt],Object.getOwnPropertyDescriptor(lHt.prototype,"transition"),lHt.prototype),m(lHt.prototype,"normalSprite",[rHt],Object.getOwnPropertyDescriptor(lHt.prototype,"normalSprite"),lHt.prototype),m(lHt.prototype,"pressedSprite",[sHt],Object.getOwnPropertyDescriptor(lHt.prototype,"pressedSprite"),lHt.prototype),m(lHt.prototype,"hoverSprite",[oHt],Object.getOwnPropertyDescriptor(lHt.prototype,"hoverSprite"),lHt.prototype),m(lHt.prototype,"disabledSprite",[aHt],Object.getOwnPropertyDescriptor(lHt.prototype,"disabledSprite"),lHt.prototype),cHt=fa(lHt.prototype,"clickEvents",[hHt,Ma],(function(){return[]})),_Ht=fa(lHt.prototype,"_interactable",[Ma],(function(){return!0})),fHt=fa(lHt.prototype,"_transition",[Ma],(function(){return LHt.NONE})),dHt=fa(lHt.prototype,"_normalColor",[Ma],(function(){return bn.WHITE.clone()})),pHt=fa(lHt.prototype,"_hoverColor",[Ma],(function(){return new bn(211,211,211,255)})),mHt=fa(lHt.prototype,"_pressedColor",[Ma],(function(){return bn.WHITE.clone()})),gHt=fa(lHt.prototype,"_disabledColor",[Ma],(function(){return new bn(124,124,124,255)})),yHt=fa(lHt.prototype,"_normalSprite",[Ma],(function(){return null})),vHt=fa(lHt.prototype,"_hoverSprite",[Ma],(function(){return null})),SHt=fa(lHt.prototype,"_pressedSprite",[Ma],(function(){return null})),AHt=fa(lHt.prototype,"_disabledSprite",[Ma],(function(){return null})),THt=fa(lHt.prototype,"_duration",[Ma],(function(){return.1})),bHt=fa(lHt.prototype,"_zoomScale",[Ma],(function(){return 1.2})),EHt=fa(lHt.prototype,"_target",[Ma],(function(){return null})),uHt=lHt))||uHt)||uHt)||uHt));v.Button=VHt;var GHt,UHt,zHt,HHt=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}();HHt._tabIndexList=[],function(t){t[t.DEFAULT=0]="DEFAULT",t[t.DONE=1]="DONE",t[t.SEND=2]="SEND",t[t.SEARCH=3]="SEARCH",t[t.GO=4]="GO",t[t.NEXT=5]="NEXT"}(GHt||(GHt={})),be(GHt),function(t){t[t.ANY=0]="ANY",t[t.EMAIL_ADDR=1]="EMAIL_ADDR",t[t.NUMERIC=2]="NUMERIC",t[t.PHONE_NUMBER=3]="PHONE_NUMBER",t[t.URL=4]="URL",t[t.DECIMAL=5]="DECIMAL",t[t.SINGLE_LINE=6]="SINGLE_LINE"}(UHt||(UHt={})),be(UHt),function(t){t[t.PASSWORD=0]="PASSWORD",t[t.SENSITIVE=1]="SENSITIVE",t[t.INITIAL_CAPS_WORD=2]="INITIAL_CAPS_WORD",t[t.INITIAL_CAPS_SENTENCE=3]="INITIAL_CAPS_SENTENCE",t[t.INITIAL_CAPS_ALL_CHARACTERS=4]="INITIAL_CAPS_ALL_CHARACTERS",t[t.DEFAULT=5]="DEFAULT"}(zHt||(zHt={})),be(zHt);var WHt,jHt,XHt,YHt,qHt,KHt,QHt,ZHt,JHt,$Ht,tWt,eWt,iWt,nWt,rWt,sWt,oWt,aWt,hWt,uWt,lWt,cWt,_Wt,fWt,dWt,pWt,mWt,gWt,yWt,vWt,SWt=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}(),AWt=A.document,TWt=new Vn,bWt=new Vn,EWt=new mn,CWt=null,xWt=0;!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_"+ ++xWt,e._forceUpdate=!1,e}s(e,t);var i=e.prototype;i.init=function(t){t&&(this._delegate=t,t.inputMode===UHt.ANY?this._createTextArea():this._createInput(),HHt.add(this),this.setTabIndex(t.tabIndex),this._initStyleSheet(),this._registerEventListeners(),this._addDomToGameContainer(),mM.instance.on("canvas-resize",this._resize,this),ko.on("window-resize",this._resize,this))},i.clear=function(){mM.instance.off("canvas-resize",this._resize,this),ko.off("window-resize",this._resize,this),this._removeEventListeners(),this._removeDomFromGameContainer(),HHt.remove(this),CWt===this&&(CWt=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,HHt.resort()},i.setSize=function(t,e){var i=this._edTxt;i&&(i.style.width=t+"px",i.style.height=e+"px")},i.beginEditing=function(){CWt&&CWt!==this&&CWt.setFocus(!1),this._editing=!0,CWt=this,this._delegate._editBoxEditingDidBegan(),this._showDom(),this._edTxt.focus()},i.endEditing=function(){this._edTxt.blur()},i._createInput=function(){this._isTextArea=!1,this._edTxt=AWt.createElement("input")},i._createTextArea=function(){this._isTextArea=!0,this._edTxt=AWt.createElement("textarea")},i._addDomToGameContainer=function(){MM.container&&this._edTxt&&(MM.container.appendChild(this._edTxt),AWt.head.appendChild(this._placeholderStyleSheet))},i._removeDomFromGameContainer=function(){Ue(MM.container,this._edTxt)&&this._edTxt&&MM.container.removeChild(this._edTxt),Ue(AWt.head,this._placeholderStyleSheet)&&AWt.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()),Uo.isMobile&&this._showDomOnMobile()},i._hideDom=function(){var t=this._edTxt;t&&this._delegate&&(t.style.display="none",this._delegate._showLabels()),Uo.isMobile&&this._hideDomOnMobile()},i._showDomOnMobile=function(){Uo.os!==po.ANDROID&&Uo.os!==po.OHOS||(ko.handleResizeEvent=!1,this._adjustWindowScroll())},i._hideDomOnMobile=function(){Uo.os!==po.ANDROID&&Uo.os!==po.OHOS||(ko.handleResizeEvent=!0),this._scrollBackWindow()},i._isElementInViewport=function(){if(this._edTxt){var t=this._edTxt.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(A.innerHeight||AWt.documentElement.clientHeight)&&t.right<=(A.innerWidth||AWt.documentElement.clientWidth)}return!1},i._adjustWindowScroll=function(){var t=this;setTimeout((function(){A.scrollY<40&&!t._isElementInViewport()&&t._edTxt.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})}),400)},i._scrollBackWindow=function(){setTimeout((function(){Uo.browserType!==co.WECHAT||Uo.os!==po.IOS?A.scrollTo(0,0):A.top&&A.top.scrollTo(0,0)}),400)},i._updateMatrix=function(){if(this._edTxt){var t=this._delegate.node,e=wM.getScaleX(),i=wM.getScaleY(),n=wM.getViewportRect(),r=ko.devicePixelRatio;t.getWorldMatrix(TWt);var s=t._uiProps.uiTransformComp;if(s&&(mn.set(EWt,-s.anchorX*s.width,-s.anchorY*s.height,EWt.z),Vn.transform(TWt,TWt,EWt)),t._uiProps.uiTransformComp){var o=FI.root.batcher2D.getFirstRenderCamera(t);if(o){o.node.getWorldRT(bWt);var a=bWt.m12,h=bWt.m13,u=zo.center;bWt.m12=u.x-(bWt.m00*a+bWt.m04*h),bWt.m13=u.y-(bWt.m01*a+bWt.m05*h),e/=r,i/=r,mn.set(EWt,e,i,1),Vn.scale(bWt,bWt,EWt);var l=MM.container,c=parseInt(l&&l.style.paddingLeft||"0");c+=n.x/r;var _=parseInt(l&&l.style.paddingBottom||"0");_+=n.y/r,bWt.m12+=c,bWt.m13+=_,Vn.multiply(bWt,bWt,TWt);var f="matrix("+bWt.m00+","+-bWt.m01+","+-bWt.m04+","+bWt.m05+","+bWt.m12+","+-bWt.m13+")";this._edTxt.style.transform=f,this._edTxt.style["-webkit-transform"]=f,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 i===zHt.INITIAL_CAPS_ALL_CHARACTERS?s="uppercase":i===zHt.INITIAL_CAPS_WORD&&(s="capitalize"),void(r.style.textTransform=s)}if(r=r,i===zHt.PASSWORD)return r.type="password",void(r.style.textTransform="none");var o=r.type;e===UHt.EMAIL_ADDR?o="email":e===UHt.NUMERIC?o="number":e===UHt.DECIMAL?o="digit":e===UHt.PHONE_NUMBER?(o="tel",r.addEventListener("wheel",(function(){return!1}))):e===UHt.URL?o="url":(o="text",n===GHt.SEARCH&&(o="search")),r.type=o;var a="none";i===zHt.INITIAL_CAPS_ALL_CHARACTERS?a="uppercase":i===zHt.INITIAL_CAPS_WORD&&(a="capitalize"),r.style.textTransform=a}},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=t).type="text",t.style["-moz-appearance"]="textfield"),this._placeholderStyleSheet=AWt.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 wB?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 UL.HorizontalAlign.LEFT:n.style.textAlign="left";break;case UL.HorizontalAlign.CENTER:n.style.textAlign="center";break;case UL.HorizontalAlign.RIGHT:n.style.textAlign="right"}}}},i._updatePlaceholderLabel=function(t){if(t){var e=t.font;e=!e||e instanceof wB?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,o="";switch(t.horizontalAlign){case UL.HorizontalAlign.LEFT:o="left";break;case UL.HorizontalAlign.CENTER:o="center";break;case UL.HorizontalAlign.RIGHT:o="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: "+o+";}#"+this._domId+"::-moz-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}#"+this._domId+"::-ms-input-placeholder{text-transform: initial;-family: "+e+";font-size: "+i+"px;color: "+r+";line-height: "+s+"px;text-align: "+o+";}",Uo.browserType===co.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&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&Uo.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===lw.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===lw.TAB&&(i.propagationStopped=!0,i.preventDefault(),HHt.next(t))},n.onBlur=function(){Uo.isMobile&&i&&n.compositionEnd(),t._editing=!1,CWt=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}}}(SWt),function(t){t.EDITING_DID_BEGAN="editing-did-began",t.EDITING_DID_ENDED="editing-did-ended",t.TEXT_CHANGED="text-changed",t.EDITING_RETURN="editing-return",t.XR_EDITING_DID_BEGAN="xr-editing-did-began",t.XR_EDITING_DID_ENDED="xr-editing-did-ended"}(vWt||(vWt={}));var wWt,DWt,RWt,IWt,MWt,PWt,BWt,OWt,LWt,NWt,FWt,kWt,VWt,GWt,UWt,zWt,HWt,WWt,jWt,XWt,YWt,qWt,KWt,QWt,ZWt,JWt,$Wt,tjt,ejt,ijt,njt,rjt,sjt,ojt,ajt=t("gN",(WHt=Ta("cc.EditBox"),jHt=Ea(110),XHt=ba(OO),YHt=eh(UL),qHt=eh(UL),KHt=eh(wP),QHt=eh(zHt),ZHt=eh(UHt),JHt=eh(GHt),$Ht=eh([Pp]),tWt=eh([Pp]),eWt=eh([Pp]),iWt=eh([Pp]),WHt(nWt=jHt(nWt=XHt(((yWt=function(t){function e(){var e;return(e=t.call(this)||this).editingDidBegan=sWt&&sWt(),e.textChanged=oWt&&oWt(),e.editingDidEnded=aWt&&aWt(),e.editingReturn=hWt&&hWt(),e._impl=null,e._background=null,e._textLabel=uWt&&uWt(),e._placeholderLabel=lWt&&lWt(),e._returnType=cWt&&cWt(),e._string=_Wt&&_Wt(),e._tabIndex=fWt&&fWt(),e._backgroundImage=dWt&&dWt(),e._inputFlag=pWt&&pWt(),e._inputMode=mWt&&mWt(),e._maxLength=gWt&&gWt(),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(){FI.off(LI.EVENT_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(){Pp.emitEvents(this.editingDidBegan,this),this.node.emit(vWt.EDITING_DID_BEGAN,this)},i._editBoxEditingDidEnded=function(t){Pp.emitEvents(this.editingDidEnded,this),this.node.emit(vWt.EDITING_DID_ENDED,this,t)},i._editBoxTextChanged=function(t){t=this._updateLabelStringStyle(t,!0),this.string=t,Pp.emitEvents(this.textChanged,t,this),this.node.emit(vWt.TEXT_CHANGED,this)},i._editBoxEditingReturn=function(t){Pp.emitEvents(this.editingReturn,this),this.node.emit(vWt.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(Nm.SIZE_CHANGED,this._resizeChildNodes,this),FI.on(LI.EVENT_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(GF);t||(t=this.node.addComponent(GF)),t!==this._background&&(t.type=GF.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 xg("TEXT_LABEL")).layer=this.node.layer),(t=e.getComponent(UL))||(t=e.addComponent(UL)),e.parent=this.node,this._textLabel=t}this._inputMode===UHt.ANY?(t.verticalAlign=OL.TOP,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 xg("PLACEHOLDER_LABEL")).layer=this.node.layer),(t=e.getComponent(UL))||(t=e.addComponent(UL)),e.parent=this.node,this._placeholderLabel=t}this._inputMode===UHt.ANY?t.enableWrapText=!0:t.enableWrapText=!1,t.string=this.placeholder},i._syncSize=function(){var t=this.node._uiProps.uiTransformComp,e=t.contentSize;if(this._background){var i=this._background.node._uiProps.uiTransformComp;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||n!==zHt.PASSWORD)n===zHt.INITIAL_CAPS_ALL_CHARACTERS?t=t.toUpperCase():n===zHt.INITIAL_CAPS_WORD?t=t.replace(/(?:^|\s)\S/g,(function(t){return t.toUpperCase()})):n===zHt.INITIAL_CAPS_SENTENCE&&(t=(i=t).charAt(0).toUpperCase()+i.slice(1));else{for(var r="",s=t.length,o=0;o<s;++o)r+="●";t=r}return t},i._registerEvent=function(){this.node.on(Nm.TOUCH_START,this._onTouchBegan,this),this.node.on(Nm.TOUCH_END,this._onTouchEnded,this),this.node.on(Zzt.XRUI_UNCLICK,this._xrUnClick,this),this.node.on(Jzt.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._unregisterEvent=function(){this.node.off(Nm.TOUCH_START,this._onTouchBegan,this),this.node.off(Nm.TOUCH_END,this._onTouchEnded,this),this.node.off(Zzt.XRUI_UNCLICK,this._xrUnClick,this),this.node.off(Jzt.XR_KEYBOARD_INPUT,this._xrKeyBoardInput,this)},i._onBackgroundSpriteFrameChanged=function(){this._background&&(this.backgroundImage=this._background.spriteFrame)},i._registerBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.on(GF.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._unregisterBackgroundEvent=function(){var t=this._background&&this._background.node;null==t||t.off(GF.EventType.SPRITE_FRAME_CHANGED,this._onBackgroundSpriteFrameChanged,this)},i._updateLabelPosition=function(t){var e=this.node._uiProps.uiTransformComp,i=-e.anchorX*e.width,n=-e.anchorY*e.height,r=this._placeholderLabel,s=this._textLabel;s&&(s.node._uiProps.uiTransformComp.setContentSize(t.width-2,t.height),s.node.setPosition(i+2,n+t.height,s.node.position.z),this._inputMode===UHt.ANY&&(s.verticalAlign=OL.TOP),s.enableWrapText=this._inputMode===UHt.ANY),r&&(r.node._uiProps.uiTransformComp.setContentSize(t.width-2,t.height),r.node.setPosition(i+2,n+t.height,r.node.position.z),r.enableWrapText=this._inputMode===UHt.ANY)},i._resizeChildNodes=function(){var t=this.node._uiProps.uiTransformComp,e=this._textLabel&&this._textLabel.node;e&&(e.setPosition(-t.width/2,t.height/2,e.position.z),e._uiProps.uiTransformComp.setContentSize(t.contentSize));var i=this._placeholderLabel&&this._placeholderLabel.node;i&&(i.setPosition(-t.width/2,t.height/2,i.position.z),i._uiProps.uiTransformComp.setContentSize(t.contentSize));var n=this._background&&this._background.node;n&&n._uiProps.uiTransformComp.setContentSize(t.contentSize),this._syncSize()},i._xrUnClick=function(){this.node.emit(vWt.XR_EDITING_DID_BEGAN,this._maxLength,this.string)},i._xrKeyBoardInput=function(t){this.string=t},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}(Lp))._EditBoxImpl=SWt,yWt.KeyboardReturnType=GHt,yWt.InputFlag=zHt,yWt.InputMode=UHt,yWt.EventType=vWt,m((rWt=yWt).prototype,"textLabel",[YHt],Object.getOwnPropertyDescriptor(rWt.prototype,"textLabel"),rWt.prototype),m(rWt.prototype,"placeholderLabel",[qHt],Object.getOwnPropertyDescriptor(rWt.prototype,"placeholderLabel"),rWt.prototype),m(rWt.prototype,"backgroundImage",[KHt],Object.getOwnPropertyDescriptor(rWt.prototype,"backgroundImage"),rWt.prototype),m(rWt.prototype,"inputFlag",[QHt],Object.getOwnPropertyDescriptor(rWt.prototype,"inputFlag"),rWt.prototype),m(rWt.prototype,"inputMode",[ZHt],Object.getOwnPropertyDescriptor(rWt.prototype,"inputMode"),rWt.prototype),m(rWt.prototype,"returnType",[JHt],Object.getOwnPropertyDescriptor(rWt.prototype,"returnType"),rWt.prototype),sWt=fa(rWt.prototype,"editingDidBegan",[$Ht,Ma],(function(){return[]})),oWt=fa(rWt.prototype,"textChanged",[tWt,Ma],(function(){return[]})),aWt=fa(rWt.prototype,"editingDidEnded",[eWt,Ma],(function(){return[]})),hWt=fa(rWt.prototype,"editingReturn",[iWt,Ma],(function(){return[]})),uWt=fa(rWt.prototype,"_textLabel",[Ma],(function(){return null})),lWt=fa(rWt.prototype,"_placeholderLabel",[Ma],(function(){return null})),cWt=fa(rWt.prototype,"_returnType",[Ma],(function(){return GHt.DEFAULT})),_Wt=fa(rWt.prototype,"_string",[Ma],(function(){return""})),fWt=fa(rWt.prototype,"_tabIndex",[Ma],(function(){return 0})),dWt=fa(rWt.prototype,"_backgroundImage",[Ma],(function(){return null})),pWt=fa(rWt.prototype,"_inputFlag",[Ma],(function(){return zHt.DEFAULT})),mWt=fa(rWt.prototype,"_inputMode",[Ma],(function(){return UHt.ANY})),gWt=fa(rWt.prototype,"_maxLength",[Ma],(function(){return 20})),nWt=rWt))||nWt)||nWt)||nWt));v.internal.EditBox=ajt,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(ejt||(ejt={})),xe(ejt),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(ijt||(ijt={})),xe(ijt),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(njt||(njt={})),xe(njt),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(rjt||(rjt={})),xe(rjt),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(sjt||(sjt={})),xe(sjt),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(ojt||(ojt={})),xe(ojt);var hjt,ujt,ljt,cjt,_jt,fjt,djt,pjt,mjt,gjt,yjt,vjt,Sjt,Ajt,Tjt=new mn,bjt=t("gO",(wWt=Ta("cc.Layout"),DWt=Ea(110),RWt=ba(OO),IWt=eh(ejt),MWt=eh(ijt),PWt=eh(njt),BWt=eh(rjt),OWt=eh(sjt),LWt=eh(ojt),wWt(NWt=DWt(NWt=RWt(((tjt=function(t){function e(){var e;return(e=t.call(this)||this)._resizeMode=kWt&&kWt(),e._layoutType=VWt&&VWt(),e._cellSize=GWt&&GWt(),e._startAxis=UWt&&UWt(),e._paddingLeft=zWt&&zWt(),e._paddingRight=HWt&&HWt(),e._paddingTop=WWt&&WWt(),e._paddingBottom=jWt&&jWt(),e._spacingX=XWt&&XWt(),e._spacingY=YWt&&YWt(),e._verticalDirection=qWt&&qWt(),e._horizontalDirection=KWt&&KWt(),e._constraint=QWt&&QWt(),e._constraintNum=ZWt&&ZWt(),e._affectedByScale=JWt&&JWt(),e._isAlign=$Wt&&$Wt(),e._layoutSize=new Kn(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._uiProps.uiTransformComp;t.contentSize.equals(Kn.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._uiProps.uiTransformComp;i.activeInHierarchy&&n&&this._usefulLayoutObj.push(n)}},i._addEventListeners=function(){FI.on(LI.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.on(Nm.SIZE_CHANGED,this._resized,this),this.node.on(Nm.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.on(Nm.CHILD_ADDED,this._childAdded,this),this.node.on(Nm.CHILD_REMOVED,this._childRemoved,this),this.node.on(Nm.CHILDREN_ORDER_CHANGED,this._childrenChanged,this),this.node.on("childrenSiblingOrderChanged",this.updateLayout,this),this._addChildrenEventListeners()},i._removeEventListeners=function(){FI.off(LI.EVENT_AFTER_UPDATE,this.updateLayout,this),this.node.off(Nm.SIZE_CHANGED,this._resized,this),this.node.off(Nm.ANCHOR_CHANGED,this._doLayoutDirty,this),this.node.off(Nm.CHILD_ADDED,this._childAdded,this),this.node.off(Nm.CHILD_REMOVED,this._childRemoved,this),this.node.off(Nm.CHILDREN_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(Nm.SIZE_CHANGED,this._doLayoutDirty,this),i.on(Nm.TRANSFORM_CHANGED,this._transformDirty,this),i.on(Nm.ANCHOR_CHANGED,this._doLayoutDirty,this),i.on(Nm.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(Nm.SIZE_CHANGED,this._doLayoutDirty,this),i.off(Nm.TRANSFORM_CHANGED,this._transformDirty,this),i.off(Nm.ANCHOR_CHANGED,this._doLayoutDirty,this),i.off(Nm.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this)}},i._childAdded=function(t){t.on(Nm.SIZE_CHANGED,this._doLayoutDirty,this),t.on(Nm.TRANSFORM_CHANGED,this._transformDirty,this),t.on(Nm.ANCHOR_CHANGED,this._doLayoutDirty,this),t.on(Nm.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._childRemoved=function(t){t.off(Nm.SIZE_CHANGED,this._doLayoutDirty,this),t.off(Nm.TRANSFORM_CHANGED,this._transformDirty,this),t.off(Nm.ANCHOR_CHANGED,this._doLayoutDirty,this),t.off(Nm.ACTIVE_IN_HIERARCHY_CHANGED,this._childrenChanged,this),this._childrenChanged()},i._resized=function(){this._layoutSize.set(this.node._uiProps.uiTransformComp.contentSize),this._doLayoutDirty()},i._doLayoutHorizontally=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),o=1,a=this._paddingLeft;this._horizontalDirection===sjt.RIGHT_TO_LEFT&&(o=-1,a=this._paddingRight);var h=(this._horizontalDirection-r.x)*t+o*a,u=h-o*this._spacingX,l=0,c=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.width,g=this._getPaddingH();this._layoutType!==ejt.GRID&&this._resizeMode===ijt.CHILDREN&&(m=(t-g-(p-1)*this._spacingX)/p);for(var y=this._usefulLayoutObj,v=0;v<y.length;++v){var S=y[v],A=S.node,T=A.scale,b=this._getUsedScaleValue(T.x),E=this._getUsedScaleValue(T.y);this._resizeMode===ijt.CHILDREN&&(S.width=m/b,this._layoutType===ejt.GRID&&(S.height=this._cellSize.height/E));var C=Math.abs(this._horizontalDirection-S.anchorX),x=S.width*b,w=S.height*E;w>_&&(f=Math.max(_,f),c=_||w,_=w),u+=o*(C*x+this._spacingX);var D=o*(1-C)*x;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(c=_>w?_:c);else if(x>t-g)u>h+o*C*x&&(d=!0);else{var R=(1-this._horizontalDirection-r.x)*t,I=u+D+o*(o>0?this._paddingRight:this._paddingLeft);d=Math.abs(I)>Math.abs(R)}d&&(u=h+o*C*x,w!==_&&(c=_),l+=c+this._spacingY,c=_=w)}var M=i(A,S,l);n&&A.setPosition(u,M),u+=D}return c=Math.max(c,_),Math.max(f,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),o=1,a=this._paddingBottom;this._verticalDirection===rjt.TOP_TO_BOTTOM&&(o=-1,a=this._paddingTop);var h=(this._verticalDirection-r.y)*t+o*a,u=h-o*this._spacingY,l=0,c=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==ejt.GRID&&this._resizeMode===ijt.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var y=this._usefulLayoutObj,v=0;v<y.length;++v){var S=y[v],A=S.node,T=A.scale,b=this._getUsedScaleValue(T.x),E=this._getUsedScaleValue(T.y);this._resizeMode===ijt.CHILDREN&&(S.height=m/E,this._layoutType===ejt.GRID&&(S.width=this._cellSize.width/b));var C=Math.abs(this._verticalDirection-S.anchorY),x=S.width*b,w=S.height*E;x>l&&(c=Math.max(l,c),_=l||x,l=x),u+=o*(C*w+this._spacingY);var D=o*(1-C)*w;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(_=l>w?l:_);else if(w>t-g)u>h+o*C*w&&(d=!0);else{var R=(1-this._verticalDirection-r.y)*t,I=u+D+o*(o>0?this._paddingTop:this._paddingBottom);d=Math.abs(I)>Math.abs(R)}d&&(u=h+o*C*w,x!==l&&(_=l),f+=_+this._spacingX,_=l=x)}var M=i(A,S,f);n&&(A.getPosition(Tjt),A.setPosition(M,u,Tjt.z)),u+=D}return _=Math.max(_,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,o=this._paddingBottom;this._verticalDirection===rjt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,o=this._paddingTop);var a=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+o)},h=0;this._resizeMode===ijt.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,a,!1),s=-t.y*h,this._verticalDirection===rjt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,a,!0),this._resizeMode===ijt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,o=this._paddingLeft;this._horizontalDirection===sjt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,o=this._paddingRight);var a=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+o)},h=0;this._resizeMode===ijt.CONTAINER&&(h=this._doLayoutVertically(n,!0,a,!1),s=-t.x*h,this._horizontalDirection===sjt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,a,!0),this._resizeMode===ijt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===njt.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===njt.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===ijt.CONTAINER){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._uiProps.uiTransformComp.width;return e},i._getVerticalBaseHeight=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===ijt.CONTAINER){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._uiProps.uiTransformComp.height;return e},i._doLayout=function(){var t=this;if(this._init&&!this._childrenDirty||(this._checkUsefulObj(),this._init=!0,this._childrenDirty=!1),this._layoutType===ejt.HORIZONTAL){var e=this._getHorizontalBaseWidth();this._doLayoutHorizontally(e,!1,(function(e){return(t._isAlign?mn.ZERO:e.position).y}),!0),this.node._uiProps.uiTransformComp.width=e}else if(this._layoutType===ejt.VERTICAL){var i=this._getVerticalBaseHeight();this._doLayoutVertically(i,!1,(function(e){return(t._isAlign?mn.ZERO:e.position).x}),!0),this.node._uiProps.uiTransformComp.height=i}else this._layoutType===ejt.GRID&&this._doLayoutGrid()},i._getUsedScaleValue=function(t){return this._affectedByScale?Math.abs(t):1},i._transformDirty=function(t){t&Om.SCALE&&t&Om.POSITION&&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(this._layoutType!==ejt.GRID||this._constraint===ojt.NONE||this._constraintNum<=0)return 0;var t=this._constraint===ojt.FIXED_ROW?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum;return this._startAxis===njt.VERTICAL&&(t=this._constraint===ojt.FIXED_COL?Math.ceil(this._usefulLayoutObj.length/this._constraintNum):this._constraintNum),t},n(e,[{key:"alignHorizontal",get:function(){return this._isAlign},set:function(t){this._layoutType===ejt.HORIZONTAL&&(this._isAlign=t,this._doLayoutDirty())}},{key:"alignVertical",get:function(){return this._isAlign},set:function(t){this._layoutType===ejt.VERTICAL&&(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){this._layoutType!==ejt.NONE&&(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){this._layoutType!==ejt.NONE&&this._constraint!==t&&(this._constraint=t,this._doLayoutDirty())}},{key:"constraintNum",get:function(){return this._constraintNum},set:function(t){this._constraint!==ojt.NONE&&this._constraintNum!==t&&(t<=0&&U("Limit values to be greater than 0"),this._constraintNum=t,this._doLayoutDirty())}},{key:"affectedByScale",get:function(){return this._affectedByScale},set:function(t){this._affectedByScale=t,this._doLayoutDirty()}}]),e}(Lp)).Type=ejt,tjt.VerticalDirection=rjt,tjt.HorizontalDirection=sjt,tjt.ResizeMode=ijt,tjt.AxisDirection=njt,tjt.Constraint=ojt,m((FWt=tjt).prototype,"type",[IWt],Object.getOwnPropertyDescriptor(FWt.prototype,"type"),FWt.prototype),m(FWt.prototype,"resizeMode",[MWt],Object.getOwnPropertyDescriptor(FWt.prototype,"resizeMode"),FWt.prototype),m(FWt.prototype,"startAxis",[PWt],Object.getOwnPropertyDescriptor(FWt.prototype,"startAxis"),FWt.prototype),m(FWt.prototype,"verticalDirection",[BWt],Object.getOwnPropertyDescriptor(FWt.prototype,"verticalDirection"),FWt.prototype),m(FWt.prototype,"horizontalDirection",[OWt],Object.getOwnPropertyDescriptor(FWt.prototype,"horizontalDirection"),FWt.prototype),m(FWt.prototype,"constraint",[LWt],Object.getOwnPropertyDescriptor(FWt.prototype,"constraint"),FWt.prototype),kWt=fa(FWt.prototype,"_resizeMode",[Ma],(function(){return ijt.NONE})),VWt=fa(FWt.prototype,"_layoutType",[Ma],(function(){return ejt.NONE})),GWt=fa(FWt.prototype,"_cellSize",[Ma],(function(){return new Kn(40,40)})),UWt=fa(FWt.prototype,"_startAxis",[Ma],(function(){return njt.HORIZONTAL})),zWt=fa(FWt.prototype,"_paddingLeft",[Ma],(function(){return 0})),HWt=fa(FWt.prototype,"_paddingRight",[Ma],(function(){return 0})),WWt=fa(FWt.prototype,"_paddingTop",[Ma],(function(){return 0})),jWt=fa(FWt.prototype,"_paddingBottom",[Ma],(function(){return 0})),XWt=fa(FWt.prototype,"_spacingX",[Ma],(function(){return 0})),YWt=fa(FWt.prototype,"_spacingY",[Ma],(function(){return 0})),qWt=fa(FWt.prototype,"_verticalDirection",[Ma],(function(){return rjt.TOP_TO_BOTTOM})),KWt=fa(FWt.prototype,"_horizontalDirection",[Ma],(function(){return sjt.LEFT_TO_RIGHT})),QWt=fa(FWt.prototype,"_constraint",[Ma],(function(){return ojt.NONE})),ZWt=fa(FWt.prototype,"_constraintNum",[Ma],(function(){return 2})),JWt=fa(FWt.prototype,"_affectedByScale",[Ma],(function(){return!1})),$Wt=fa(FWt.prototype,"_isAlign",[Ma],(function(){return!1})),NWt=FWt))||NWt)||NWt)||NWt));v.Layout=bjt,function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL",t[t.FILLED=2]="FILLED"}(Ajt||(Ajt={})),be(Ajt);var Ejt,Cjt,xjt,wjt,Djt,Rjt,Ijt,Mjt,Pjt,Bjt,Ojt,Ljt,Njt,Fjt=t("gP",(hjt=Ta("cc.ProgressBar"),ujt=Ea(110),ljt=ba(OO),cjt=eh(GF),_jt=eh(Ajt),hjt(fjt=ujt(fjt=ljt(((Sjt=function(t){function e(){var e;return(e=t.call(this)||this)._barSprite=pjt&&pjt(),e._mode=mjt&&mjt(),e._totalLength=gjt&&gjt(),e._progress=yjt&&yjt(),e._reverse=vjt&&vjt(),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._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint,r=t._uiProps.uiTransformComp.contentSize;if(this._barSprite.fillType===GF.FillType.RADIAL&&(this._mode=Ajt.FILLED),this._mode===Ajt.HORIZONTAL?this.totalLength=r.width:this._mode===Ajt.VERTICAL?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._uiProps.uiTransformComp,i=e.anchorPoint,n=e.contentSize,r=new jn(0,.5),s=Fi(this._progress),o=this._totalLength*s,a=n,h=0,u=0;switch(this._mode){case Ajt.HORIZONTAL:this._reverse&&(r=new jn(1,.5)),a=new Kn(o,n.height),h=this._totalLength,u=n.height;break;case Ajt.VERTICAL:r=this._reverse?new jn(.5,1):new jn(.5,0),a=new Kn(n.width,o),h=n.width,u=this._totalLength}if(this._mode===Ajt.FILLED)this._barSprite.type!==GF.Type.FILLED?$(16397):(this._reverse&&(o*=-1),this._barSprite.fillRange=o);else if(this._barSprite.type!==GF.Type.FILLED){var l=r.x-i.x,c=r.y-i.y,_=new mn(t.position);_.add3f(h*l,u*c,0),t.setPosition(_),e.setAnchorPoint(r),e.setContentSize(a)}else $(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._uiProps.uiTransformComp.contentSize;this._mode===Ajt.HORIZONTAL?this.totalLength=i.width:this._mode===Ajt.VERTICAL?this.totalLength=i.height:this._mode===Ajt.FILLED&&(this.totalLength=this._barSprite.fillRange)}}},{key:"totalLength",get:function(){return this._totalLength},set:function(t){this._mode===Ajt.FILLED&&(t=Fi(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}(Lp)).Mode=Ajt,m((djt=Sjt).prototype,"barSprite",[cjt],Object.getOwnPropertyDescriptor(djt.prototype,"barSprite"),djt.prototype),m(djt.prototype,"mode",[_jt],Object.getOwnPropertyDescriptor(djt.prototype,"mode"),djt.prototype),pjt=fa(djt.prototype,"_barSprite",[Ma],(function(){return null})),mjt=fa(djt.prototype,"_mode",[Ma],(function(){return Ajt.HORIZONTAL})),gjt=fa(djt.prototype,"_totalLength",[Ma],(function(){return 1})),yjt=fa(djt.prototype,"_progress",[Ma],(function(){return.1})),vjt=fa(djt.prototype,"_reverse",[Ma],(function(){return!1})),fjt=djt))||fjt)||fjt)||fjt));v.ProgressBar=Fjt;var kjt,Vjt=new mn,Gjt=new mn,Ujt=new mn,zjt=new jn,Hjt=new bn,Wjt=new jn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kjt||(kjt={})),xe(kjt);var jjt,Xjt=t("gQ",(Ejt=Ta("cc.ScrollBar"),Cjt=Ea(110),xjt=ba(OO),wjt=eh(GF),Djt=eh(kjt),Ejt(Rjt=Cjt(Rjt=xjt(((Njt=function(t){function e(){var e;return(e=t.call(this)||this)._scrollView=Mjt&&Mjt(),e._handle=Pjt&&Pjt(),e._direction=Bjt&&Bjt(),e._enableAutoHide=Ojt&&Ojt(),e._autoHideTime=Ljt&&Ljt(),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._uiProps.uiTransformComp.contentSize,n=this._scrollView.node._uiProps.uiTransformComp.contentSize,r=this.node._uiProps.uiTransformComp.contentSize;if(!this._conditionalDisableScrollBar(i,n)){this._enableAutoHide&&(this._autoHideRemainingTime=this._autoHideTime,this._setOpacity(this._opacity));var s=0,o=0,a=0,h=0,u=0,l=Wjt;l.set(0,0),this._direction===kjt.HORIZONTAL?(s=i.width,o=n.width,u=r.width,a=t.x,this._convertToScrollViewSpace(l,e),h=-l.x):this._direction===kjt.VERTICAL&&(s=i.height,o=n.height,u=r.height,a=t.y,this._convertToScrollViewSpace(l,e),h=-l.y);var c=this._calculateLength(s,o,u,a),_=Wjt;this._calculatePosition(_,s,o,u,h,a,c),this._updateLength(c),this._updateHandlerPosition(_)}}}},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._uiProps.uiTransformComp.contentSize,i=this._scrollView.node._uiProps.uiTransformComp.contentSize;if(this._conditionalDisableScrollBar(e,i))return}}this._autoHideRemainingTime=this._autoHideTime}},i.onEnable=function(){var t=this.node.getComponent(GF);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._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp;if(i&&n){Vjt.set(-n.anchorX*n.width,-n.anchorY*n.height,0),n.convertToWorldSpaceAR(Vjt,Gjt);var r=i.convertToNodeSpaceAR(Gjt);r.x+=i.anchorX*i.width,r.y+=i.anchorY*i.height,t.set(r.x,r.y)}else t.set(jn.ZERO)},i._setOpacity=function(t){if(this._handle){var e=this.node.getComponent(GF);e&&(Hjt.set(e.color),Hjt.a=t,e.color=Hjt),(e=this._handle.getComponent(GF))&&(Hjt.set(e.color),Hjt.a=t,e.color=Hjt)}},i._updateHandlerPosition=function(t){if(this._handle){var e=Ujt;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._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint,r=this.handle.node._uiProps.uiTransformComp.contentSize,s=this.handle.node.parent;mn.set(Vjt,-i.width*n.x,-i.height*n.y,0);var o=this.node._uiProps.uiTransformComp.convertToWorldSpaceAR(Vjt,Gjt),a=t;a.set(0,0,0),s._uiProps.uiTransformComp.convertToNodeSpaceAR(o,a),this.direction===kjt.HORIZONTAL?a.set(a.x,a.y+(i.height-r.height)/2,a.z):this.direction===kjt.VERTICAL&&a.set(a.x+(i.width-r.width)/2,a.y,a.z),this.handle.node.setPosition(a)},i._conditionalDisableScrollBar=function(t,e){return t.width<=e.width&&this._direction===kjt.HORIZONTAL||t.height<=e.height&&this._direction===kjt.VERTICAL},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,o){var a=e-i;s&&(a+=Math.abs(s));var h=0;a&&(h=Fi(h=r/a));var u=(n-o)*h;this._direction===kjt.VERTICAL?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===zjt.x&&n.y===zjt.y||e.setAnchorPoint(zjt),this._direction===kjt.HORIZONTAL?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(jn.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(jn.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}(Lp)).Direction=kjt,m((Ijt=Njt).prototype,"handle",[wjt],Object.getOwnPropertyDescriptor(Ijt.prototype,"handle"),Ijt.prototype),m(Ijt.prototype,"direction",[Djt],Object.getOwnPropertyDescriptor(Ijt.prototype,"direction"),Ijt.prototype),Mjt=fa(Ijt.prototype,"_scrollView",[Ma],(function(){return null})),Pjt=fa(Ijt.prototype,"_handle",[Ma],(function(){return null})),Bjt=fa(Ijt.prototype,"_direction",[Ma],(function(){return kjt.HORIZONTAL})),Ojt=fa(Ijt.prototype,"_enableAutoHide",[Ma],(function(){return!1})),Ljt=fa(Ijt.prototype,"_autoHideTime",[Ma],(function(){return 1})),Rjt=Ijt))||Rjt)||Rjt)||Rjt));v.ScrollBar=Xjt;var Yjt,qjt,Kjt,Qjt,Zjt,Jjt,$jt,tXt,eXt,iXt,nXt,rXt,sXt,oXt,aXt,hXt,uXt,lXt,cXt,_Xt,fXt,dXt=t("gV",Ta("cc.ViewGroup")(jjt=Ea(110)(jjt=function(t){function e(){return t.apply(this,arguments)||this}return s(e,t),e}(Lp))||jjt)||jjt);v.ViewGroup=dXt;var pXt,mXt,gXt=1e-4,yXt=new mn,vXt=new mn,SXt=new jn,AXt=new jn,TXt=function(){return(new Date).getMilliseconds()},bXt={"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};!function(t){t.NONE="",t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(pXt||(pXt={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(mXt||(mXt={}));var EXt,CXt,xXt,wXt,DXt,RXt,IXt,MXt,PXt,BXt,OXt,LXt,NXt,FXt=t("gR",(Yjt=Ta("cc.ScrollView"),qjt=Ea(110),Kjt=ba(OO),Qjt=eh(xg),Zjt=eh(Xjt),Jjt=eh(Xjt),$jt=eh([Pp]),Yjt(tXt=qjt(tXt=Kjt(((fXt=function(t){function e(){var e;return(e=t.call(this)||this).bounceDuration=iXt&&iXt(),e.brake=nXt&&nXt(),e.elastic=rXt&&rXt(),e.inertia=sXt&&sXt(),e.horizontal=oXt&&oXt(),e.vertical=aXt&&aXt(),e.cancelInnerEvents=hXt&&hXt(),e.scrollEvents=uXt&&uXt(),e._autoScrolling=!1,e._scrolling=!1,e._content=lXt&&lXt(),e._horizontalScrollBar=cXt&&cXt(),e._verticalScrollBar=_Xt&&_Xt(),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 mn,e._autoScrollTargetDelta=new mn,e._autoScrollTotalTime=0,e._autoScrollAccumulatedTime=0,e._autoScrollCurrentlyOutOfBoundary=!1,e._autoScrollBraking=!1,e._autoScrollBrakingStartPosition=new mn,e._outOfBoundaryAmount=new mn,e._outOfBoundaryAmountDirty=!0,e._stopMouseWheel=!1,e._mouseWheelEventElapsedTime=0,e._isScrollEndedWithThresholdEventFired=!1,e._scrollEventEmitMask=0,e._isBouncing=!1,e._contentPos=new mn,e._deltaPos=new mn,e._deltaAmount=new mn,e._hoverIn=mXt.NONE,e}s(e,t);var i=e.prototype;return i.scrollToBottom=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(0,0),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i,!0)},i.scrollToTop=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(0,1),applyToHorizontal:!1,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(0,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(1,0),applyToHorizontal:!0,applyToVertical:!1});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToTopLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(0,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToTopRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(1,1),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToBottomLeft=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(0,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToBottomRight=function(t,e){void 0===e&&(e=!0);var i=this._calculateMovePercentDelta({anchor:new jn(1,0),applyToHorizontal:!0,applyToVertical:!0});t?this._startAutoScroll(i,t,!1!==e):this._moveContent(i)},i.scrollToOffset=function(t,e,i){void 0===i&&(i=!0);var n=this.getMaxScrollOffset(),r=new jn(0,0);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 jn(e,t)},i.getMaxScrollOffset=function(){if(!this._content||!this.view)return jn.ZERO;var t=this._content._uiProps.uiTransformComp.contentSize,e=t.width-this.view.width,i=t.height-this.view.height;return new jn(e=e>=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new jn(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},i.scrollTo=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new jn(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.scrollToPercentVertical=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new jn(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},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)<gXt&&Math.abs(t.y-e.y)<gXt||(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):mn.ZERO.clone()},i.isScrolling=function(){return this._scrolling},i.isAutoScrolling=function(){return this._autoScrolling},i.getScrollEndedEventTiming=function(){return gXt},i.start=function(){this._calculateBoundary(),this._content&&FI.once(LI.EVENT_BEFORE_DRAW,this._adjustContentOutOfBoundary,this)},i.onEnable=function(){this._registerEvent(),this._content&&(this._content.on(Nm.SIZE_CHANGED,this._calculateBoundary,this),this._content.on(Nm.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.on(Nm.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.on(Nm.SIZE_CHANGED,this._calculateBoundary,this))),this._calculateBoundary(),this._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(){this._unregisterEvent(),this._content&&(this._content.off(Nm.SIZE_CHANGED,this._calculateBoundary,this),this._content.off(Nm.TRANSFORM_CHANGED,this._scaleChanged,this),this.view&&(this.view.node.off(Nm.TRANSFORM_CHANGED,this._scaleChanged,this),this.view.node.off(Nm.SIZE_CHANGED,this._calculateBoundary,this))),this._deltaAmount.set(0,0),this._hideScrollBar(),this.stopAutoScroll()},i._registerEvent=function(){this.node.on(Nm.TOUCH_START,this._onTouchBegan,this,!0),this.node.on(Nm.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.on(Nm.TOUCH_END,this._onTouchEnded,this,!0),this.node.on(Nm.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.on(Nm.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.on(Zzt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(Zzt.XRUI_HOVER_EXITED,this._xrHoverExit,this),Xw.on(jw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),Xw.on(jw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._unregisterEvent=function(){this.node.off(Nm.TOUCH_START,this._onTouchBegan,this,!0),this.node.off(Nm.TOUCH_MOVE,this._onTouchMoved,this,!0),this.node.off(Nm.TOUCH_END,this._onTouchEnded,this,!0),this.node.off(Nm.TOUCH_CANCEL,this._onTouchCancelled,this,!0),this.node.off(Nm.MOUSE_WHEEL,this._onMouseWheel,this,!0),this.node.off(Zzt.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(Zzt.XRUI_HOVER_EXITED,this._xrHoverExit,this),Xw.off(jw.EventType.HANDLE_INPUT,this._dispatchEventHandleInput,this),Xw.off(jw.EventType.GAMEPAD_INPUT,this._dispatchEventHandleInput,this)},i._onMouseWheel=function(t,e){if(this.enabledInHierarchy&&!this._hasNestedViewGroup(t,e)){var i=new mn,n=t.getScrollY();this.vertical?i.set(0,-.1*n,0):this.horizontal&&i.set(-.1*n,0,0),this._mouseWheelEventElapsedTime=0,this._deltaAmount.add(i),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60),this._stopMouseWheel=!0),this._stopPropagationIfTargetIsMe(t)}},i._onTouchBegan=function(t,e){this.enabledInHierarchy&&this._content&&(this._hasNestedViewGroup(t,e)||(this._handlePressLogic(),this._touchMoved=!1,this._stopPropagationIfTargetIsMe(t)))},i._onTouchMoved=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){var i=t.touch;if(this._handleMoveLogic(i),this.cancelInnerEvents){var n=i.getUILocation(SXt);if(n.subtract(i.getUIStartLocation(AXt)),n.length()>7&&!this._touchMoved&&t.target!==this.node){var r=new uw(t.getTouches(),t.bubbles,iw.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(pXt.TOUCH_UP);var i=t.touch;this._handleReleaseLogic(i),this._touchMoved?t.propagationStopped=!0:this._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){if(t&&!t.simulate){var i=t.touch;this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},i._calculateBoundary=function(){if(this._content&&this.view){var t=this._content.getComponent(bjt);t&&t.enabledInHierarchy&&t.updateLayout();var e=this.view,i=e.width*e.anchorX,n=e.height*e.anchorY;this._leftBoundary=-i,this._bottomBoundary=-n,this._rightBoundary=this._leftBoundary+e.width,this._topBoundary=this._bottomBoundary+e.height,this._moveContentToTopLeft(e.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==rw.CAPTURING_PHASE)return!1;if(e)for(var i,n=f(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(dXt));if(r.getComponent(dXt))return!0}return!1},i._startInertiaScroll=function(t){var e=new mn(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,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._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,o=n.height-r.height,a=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(o);i.x=i.x*s*(1-this.brake)*a,i.y=i.y*o*h*(1-this.brake),i.z=0}var u=t.length(),l=i.length()/u;if(i.add(t),this.brake>0&&l>7){l=Math.sqrt(l);var c=t.clone();c.multiplyScalar(l),i.set(c),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(_*=l=3),0===this.brake&&l>1&&(_*=l),this._startAutoScroll(i,_,!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._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,mn.copy(this._autoScrollStartPosition,this._getContentPosition()),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition.set(0,0,0),this._getHowMuchOutOfBoundary().equals(mn.ZERO,gXt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new mn,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(mn.ZERO);else{var i=new mn;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){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);yXt.set(this._getContentPosition()),yXt.add(i),yXt.set(Math.round(1e4*yXt.x)*gXt,Math.round(1e4*yXt.y)*gXt,yXt.z),this._setContentPosition(yXt);var n=this._getHowMuchOutOfBoundary();SXt.set(n.x,n.y),this._updateScrollBar(SXt),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if((t=t||new mn).equals(mn.ZERO,gXt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new mn,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(mn.ZERO,gXt)&&(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(t===pXt.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===pXt.SCROLL_TO_TOP||t===pXt.SCROLL_TO_BOTTOM||t===pXt.SCROLL_TO_LEFT||t===pXt.SCROLL_TO_RIGHT){var e=1<<bXt[t];if(this._scrollEventEmitMask&e)return;this._scrollEventEmitMask|=e}Pp.emitEvents(this.scrollEvents,this,bXt[t]),this.node.emit(t,this)},i._adjustContentOutOfBoundary=function(){if(this._content){this._outOfBoundaryAmountDirty=!0;var t=this._getHowMuchOutOfBoundary();!t.equals(mn.ZERO,gXt)&&(yXt.set(this._getContentPosition()),yXt.add(t),this._setContentPosition(yXt),this._updateScrollBar(jn.ZERO))}},i._hideScrollBar=function(){this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&this._horizontalScrollBar.hide(),this._verticalScrollBar&&this._verticalScrollBar.isValid&&this._verticalScrollBar.hide()},i._updateScrollBarState=function(){if(this._content&&this.view){var t=this.view,e=this._content._uiProps.uiTransformComp;this._verticalScrollBar&&this._verticalScrollBar.isValid&&(e.height<t.height||Li(e.height,t.height)?this._verticalScrollBar.hide():this._verticalScrollBar.show()),this._horizontalScrollBar&&this._horizontalScrollBar.isValid&&(e.width<t.width||Li(e.width,t.width)?this._horizontalScrollBar.hide():this._horizontalScrollBar.show())}},i._stopPropagationIfTargetIsMe=function(t){t.eventPhase===rw.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){this._getLocalAxisAlignDelta(this._deltaPos,t),this._gatherTouchMove(this._deltaPos),this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(pXt.SCROLL_ENDED))},i._getLocalAxisAlignDelta=function(t,e){var i=this.node._uiProps.uiTransformComp,n=new mn;i&&(e.getUILocation(SXt),e.getUIPreviousLocation(AXt),yXt.set(SXt.x,SXt.y,0),vXt.set(AXt.x,AXt.y,0),i.convertToNodeSpaceAR(yXt,yXt),i.convertToNodeSpaceAR(vXt,vXt),mn.subtract(n,yXt,vXt)),t.set(n)},i._scrollChildren=function(t){this._clampDelta(t);var e,i=t;this.elastic&&(e=this._getHowMuchOutOfBoundary(),i.x*=0===e.x?1:.5,i.y*=0===e.y?1:.5),this.elastic||(e=this._getHowMuchOutOfBoundary(i),i.add(e));var n=pXt.NONE,r=pXt.NONE;if(this._content){var s=this._content._uiProps.uiTransformComp,o=s.anchorX,a=s.anchorY,h=s.width,u=s.height,l=this._content.position||mn.ZERO;this.vertical&&(i.y>0?l.y-a*u+i.y>=this._bottomBoundary&&(n=pXt.SCROLL_TO_BOTTOM):i.y<0&&l.y-a*u+u+i.y<=this._topBoundary&&(n=pXt.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-o*h+h+i.x<=this._rightBoundary&&(r=pXt.SCROLL_TO_RIGHT):i.x>0&&l.x-o*h+i.x>=this._leftBoundary&&(r=pXt.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(pXt.SCROLL_BEGAN)),this._dispatchEvent(pXt.SCROLLING)),n!==pXt.NONE&&this._dispatchEvent(n),r!==pXt.NONE&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(pXt.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=TXt(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width<e.width&&(t.x=0),i.height<e.height&&(t.y=0)}},i._gatherTouchMove=function(t){var e=t.clone();for(this._clampDelta(e);this._touchMoveDisplacements.length>=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(e);var i=TXt();this._touchMoveTimeDeltas.push((i-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=i},i._startBounceBackIfNeeded=function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if(this._clampDelta(t),t.equals(mn.ZERO,gXt))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(pXt.BOUNCE_TOP),t.y<0&&this._dispatchEvent(pXt.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(pXt.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(pXt.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(yXt,gXt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(mn.ZERO,gXt)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,mn.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var o=this._autoScrollStartPosition.clone();o.add(s);var a=Math.abs(r-1)<=gXt;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(pXt.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=o.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),o.set(this._autoScrollBrakingStartPosition),o.add(h)}else{var u=o.clone();u.subtract(this.getContentPosition());var l=this._getHowMuchOutOfBoundary(u);l.equals(mn.ZERO,gXt)||(o.add(l),a=!0)}a&&(this._autoScrolling=!1);var c=o.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,a),this._dispatchEvent(pXt.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(pXt.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(mn.ZERO,gXt))return this._processInertiaScroll(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(pXt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this._scrolling&&(this._scrolling=!1,this._autoScrolling||this._dispatchEvent(pXt.SCROLL_ENDED)),this.unschedule(this._checkMouseWheel),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(jn.ZERO,jn.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var o=new mn;if(this._content&&this.view){var a=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(a=h.width-u.width,o.x=s-a*e.x),n&&(a=h.height-u.height,o.y=r-a*e.y)}return o},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new mn,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.height<t.height&&(n=s.height-t.height,i.y=e-n),s.width<t.width&&(n=s.width-t.width,i.x=r)}this._updateScrollBarState(),this._moveContent(i),this._adjustContentOutOfBoundary()},i._scaleChanged=function(t){t===Om.SCALE&&this._calculateBoundary()},i._xrHoverEnter=function(t){t.deviceType===Qzt.Left?this._hoverIn=mXt.LEFT:t.deviceType===Qzt.Right&&(this._hoverIn=mXt.RIGHT)},i._xrHoverExit=function(){this._hoverIn=mXt.NONE},i._dispatchEventHandleInput=function(t){var e,i;t instanceof cw?e=t.gamepad:t instanceof _w&&(e=t.handleInputDevice),this.enabledInHierarchy&&this._hoverIn!==mXt.NONE&&(this._hoverIn===mXt.LEFT?(i=e.leftStick.getValue()).equals(jn.ZERO)||this._xrThumbStickMove(i):this._hoverIn===mXt.RIGHT&&((i=e.rightStick.getValue()).equals(jn.ZERO)||this._xrThumbStickMove(i)))},i._xrThumbStickMove=function(t){if(this.enabledInHierarchy){var e=new mn,i=t.y;this.vertical?e.set(0,-62.5*i,0):this.horizontal&&e.set(-62.5*i,0,0),this._mouseWheelEventElapsedTime=0,this._deltaAmount.add(e),this._stopMouseWheel||(this._handlePressLogic(),this.schedule(this._checkMouseWheel,1/60,NaN,0),this._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._uiProps.uiTransformComp;!t||t&&e?(this._content=t,this._calculateBoundary()):K(4302)}}},{key:"horizontalScrollBar",get:function(){return this._horizontalScrollBar&&!this._horizontalScrollBar.isValid&&et(4303,"horizontal",this.node.name),this._horizontalScrollBar},set:function(t){this._horizontalScrollBar!==t&&(this._horizontalScrollBar=t,this._horizontalScrollBar&&(this._horizontalScrollBar.setScrollView(this),this._updateScrollBar(jn.ZERO)))}},{key:"verticalScrollBar",get:function(){return this._verticalScrollBar&&!this._verticalScrollBar.isValid&&et(4303,"vertical",this.node.name),this._verticalScrollBar},set:function(t){this._verticalScrollBar!==t&&(this._verticalScrollBar=t,this._verticalScrollBar&&(this._verticalScrollBar.setScrollView(this),this._updateScrollBar(jn.ZERO)))}},{key:"view",get:function(){var t=this._content&&this._content.parent;return t?t._uiProps.uiTransformComp:null}}]),e}(dXt)).EventType=pXt,iXt=fa((eXt=fXt).prototype,"bounceDuration",[Ma],(function(){return 1})),nXt=fa(eXt.prototype,"brake",[Ma],(function(){return.5})),rXt=fa(eXt.prototype,"elastic",[Ma],(function(){return!0})),sXt=fa(eXt.prototype,"inertia",[Ma],(function(){return!0})),m(eXt.prototype,"content",[Qjt],Object.getOwnPropertyDescriptor(eXt.prototype,"content"),eXt.prototype),oXt=fa(eXt.prototype,"horizontal",[Ma],(function(){return!0})),m(eXt.prototype,"horizontalScrollBar",[Zjt],Object.getOwnPropertyDescriptor(eXt.prototype,"horizontalScrollBar"),eXt.prototype),aXt=fa(eXt.prototype,"vertical",[Ma],(function(){return!0})),m(eXt.prototype,"verticalScrollBar",[Jjt],Object.getOwnPropertyDescriptor(eXt.prototype,"verticalScrollBar"),eXt.prototype),hXt=fa(eXt.prototype,"cancelInnerEvents",[Ma],(function(){return!0})),uXt=fa(eXt.prototype,"scrollEvents",[$jt,Ma],(function(){return[]})),lXt=fa(eXt.prototype,"_content",[Ma],(function(){return null})),cXt=fa(eXt.prototype,"_horizontalScrollBar",[Ma],(function(){return null})),_Xt=fa(eXt.prototype,"_verticalScrollBar",[Ma],(function(){return null})),tXt=eXt))||tXt)||tXt)||tXt));v.ScrollView=FXt;var kXt,VXt=new mn;!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(kXt||(kXt={})),xe(kXt);var GXt,UXt,zXt,HXt,WXt,jXt,XXt,YXt,qXt,KXt,QXt,ZXt,JXt=t("gS",(EXt=Ta("cc.Slider"),CXt=Ea(110),xXt=ba(OO),wXt=eh(GF),DXt=eh(kXt),RXt=eh([Pp]),EXt(IXt=CXt(IXt=xXt(((NXt=function(t){function e(){var e;return(e=t.call(this)||this).slideEvents=PXt&&PXt(),e._handle=BXt&&BXt(),e._direction=OXt&&OXt(),e._progress=LXt&&LXt(),e._offset=new mn,e._dragging=!1,e._touchHandle=!1,e._handleLocalPos=new mn,e._touchPos=new mn,e}s(e,t);var i=e.prototype;return i.__preload=function(){this._updateHandlePosition()},i.onEnable=function(){this._updateHandlePosition(),this.node.on(Nm.TOUCH_START,this._onTouchBegan,this),this.node.on(Nm.TOUCH_MOVE,this._onTouchMoved,this),this.node.on(Nm.TOUCH_END,this._onTouchEnded,this),this.node.on(Nm.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.on(Zzt.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.on(Zzt.XRUI_CLICK,this._xrClick,this),this.node.on(Zzt.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.on(Nm.TOUCH_START,this._onHandleDragStart,this),this._handle.node.on(Nm.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.on(Nm.TOUCH_END,this._onTouchEnded,this))},i.onDisable=function(){this.node.off(Nm.TOUCH_START,this._onTouchBegan,this),this.node.off(Nm.TOUCH_MOVE,this._onTouchMoved,this),this.node.off(Nm.TOUCH_END,this._onTouchEnded,this),this.node.off(Nm.TOUCH_CANCEL,this._onTouchCancelled,this),this.node.off(Zzt.XRUI_HOVER_STAY,this._xrHoverStay,this),this.node.off(Zzt.XRUI_CLICK,this._xrClick,this),this.node.off(Zzt.XRUI_UNCLICK,this._xrUnClick,this),this._handle&&this._handle.isValid&&(this._handle.node.off(Nm.TOUCH_START,this._onHandleDragStart,this),this._handle.node.off(Nm.TOUCH_MOVE,this._onTouchMoved,this),this._handle.node.off(Nm.TOUCH_END,this._onTouchEnded,this))},i._onHandleDragStart=function(t){if(t&&this._handle&&this._handle.node._uiProps.uiTransformComp){this._dragging=!0,this._touchHandle=!0;var e=t.touch.getUILocation();mn.set(this._touchPos,e.x,e.y,0),this._handle.node._uiProps.uiTransformComp.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 mn,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(){Pp.emitEvents(this.slideEvents,this),this.node.emit("slide",this)},i._updateProgress=function(t){if(this._handle&&t){var e=t.getUILocation();mn.set(this._touchPos,e.x,e.y,0);var i=this.node._uiProps.uiTransformComp,n=i.convertToNodeSpaceAR(this._touchPos,VXt);this.direction===kXt.Horizontal?this.progress=Fi(.5+(n.x-this._offset.x)/i.width):this.progress=Fi(.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._uiProps.uiTransformComp;this._direction===kXt.Horizontal?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._uiProps.uiTransformComp,e=t.contentSize;if(t.setContentSize(e.height,e.width),this._handle){var i=this._handle.node.position;this._direction===kXt.Horizontal?this._handle.node.setPosition(i.x,0,i.z):this._handle.node.setPosition(0,i.y,i.z),this._updateHandlePosition()}},i._xrHandleProgress=function(t){if(!this._touchHandle){var e=this.node._uiProps.uiTransformComp;e.convertToNodeSpaceAR(t,VXt),this.direction===kXt.Horizontal?this.progress=Fi(.5+(VXt.x-this.node.position.x)/e.width):this.progress=Fi(.5+(VXt.y-this.node.position.y)/e.height)}},i._xrClick=function(t){this._handle&&(this._dragging=!0,this._xrHandleProgress(t.hitPoint),this._emitSlideEvent())},i._xrUnClick=function(){this._dragging=!1,this._touchHandle=!1},i._xrHoverStay=function(t){this._dragging&&(this._xrHandleProgress(t.hitPoint),this._emitSlideEvent())},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}(Lp)).Direction=kXt,m((MXt=NXt).prototype,"handle",[wXt],Object.getOwnPropertyDescriptor(MXt.prototype,"handle"),MXt.prototype),m(MXt.prototype,"direction",[DXt],Object.getOwnPropertyDescriptor(MXt.prototype,"direction"),MXt.prototype),PXt=fa(MXt.prototype,"slideEvents",[RXt,Ma],(function(){return[]})),BXt=fa(MXt.prototype,"_handle",[Ma],(function(){return null})),OXt=fa(MXt.prototype,"_direction",[Ma],(function(){return kXt.Horizontal})),LXt=fa(MXt.prototype,"_progress",[Ma],(function(){return.1})),IXt=MXt))||IXt)||IXt)||IXt));function $Xt(){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))}v.Slider=JXt,function(t){t.TOGGLE="toggle"}(ZXt||(ZXt={}));var tYt,eYt,iYt,nYt,rYt,sYt,oYt,aYt=t("gT",(GXt=Ta("cc.Toggle"),UXt=Ea(110),zXt=ba(OO),HXt=eh(GF),WXt=eh([Pp]),GXt(jXt=UXt(jXt=zXt(((QXt=function(t){function e(){var e;return(e=t.call(this)||this).checkEvents=YXt&&YXt(),e._isChecked=qXt&&qXt(),e._checkMark=KXt&&KXt(),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&&Pp.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 v.Node.isNode(t)?t.getComponent("cc.ToggleContainer"):null}}]),e}(VHt)).EventType=$Xt(ZXt,FHt),m((XXt=QXt).prototype,"checkMark",[HXt],Object.getOwnPropertyDescriptor(XXt.prototype,"checkMark"),XXt.prototype),YXt=fa(XXt.prototype,"checkEvents",[WXt,Ma],(function(){return[]})),qXt=fa(XXt.prototype,"_isChecked",[Ma],(function(){return!0})),KXt=fa(XXt.prototype,"_checkMark",[Ma],(function(){return null})),jXt=XXt))||jXt)||jXt)||jXt));v.Toggle=aYt;var hYt,uYt,lYt,cYt,_Yt,fYt,dYt,pYt,mYt,gYt,yYt,vYt,SYt,AYt,TYt,bYt,EYt,CYt,xYt,wYt,DYt,RYt,IYt,MYt,PYt,BYt,OYt=t("gU",(tYt=Ta("cc.ToggleContainer"),eYt=Ea(110),iYt=eh([Pp]),tYt(nYt=eYt((rYt=function(t){function e(){var e;return(e=t.call(this)||this)._allowSwitchOff=sYt&&sYt(),e.checkEvents=oYt&&oYt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.ensureValidState(),this.node.on(Nm.CHILD_ADDED,this.ensureValidState,this),this.node.on(Nm.CHILD_REMOVED,this.ensureValidState,this)},i.onDisable=function(){this.node.off(Nm.CHILD_ADDED,this.ensureValidState,this),this.node.off(Nm.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&&v.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}(Lp),sYt=fa(rYt.prototype,"_allowSwitchOff",[Ma],(function(){return!1})),oYt=fa(rYt.prototype,"checkEvents",[iYt,Ma],(function(){return[]})),nYt=rYt))||nYt)||nYt));v.ToggleContainer=OYt;var LYt,NYt,FYt=new jn;function kYt(t){return t instanceof tw?zo:t._uiProps.uiTransformComp?t._uiProps.uiTransformComp.contentSize:Kn.ZERO}function VYt(t,e,i,n){t.parent?FYt.set(t.parent.scale.x,t.parent.scale.y):FYt.set(0,0);for(var r=FYt.x,s=FYt.y,o=0,a=0,h=t.parent;;){if(!h)return i.x=i.y=0,void(n.x=n.y=1);var u=h.position;if(o+=u.x,a+=u.y,(h=h.parent)===e)break;h?FYt.set(h.scale.x,h.scale.y):FYt.set(0,0);var l=FYt.x,c=FYt.y;o*=l,a*=c,r*=l,s*=c}n.x=0!==r?1/r:1,n.y=0!==s?1/s:1,i.x=-o,i.y=-a}!function(t){t[t.ONCE=0]="ONCE",t[t.ALWAYS=1]="ALWAYS",t[t.ON_WINDOW_RESIZE=2]="ON_WINDOW_RESIZE"}(LYt||(LYt={})),xe(LYt),function(t){t[t.TOP=1]="TOP",t[t.MID=2]="MID",t[t.BOT=4]="BOT",t[t.LEFT=8]="LEFT",t[t.CENTER=16]="CENTER",t[t.RIGHT=32]="RIGHT",t[t.HORIZONTAL=56]="HORIZONTAL",t[t.VERTICAL=7]="VERTICAL"}(NYt||(NYt={}));var GYt,UYt,zYt,HYt,WYt,jYt,XYt,YYt,qYt,KYt,QYt,ZYt,JYt=NYt.TOP|NYt.BOT,$Yt=NYt.LEFT|NYt.RIGHT,tqt=t("gW",(hYt=Ta("cc.Widget"),uYt=Ea(110),lYt=ba(OO),cYt=eh(xg),_Yt=eh(LYt),hYt(fYt=uYt(fYt=lYt(((BYt=function(t){function e(){var e;return(e=t.call(this)||this)._lastPos=new mn,e._lastSize=new Kn,e._dirty=!0,e._hadAlignOnce=!1,e._alignFlags=pYt&&pYt(),e._target=mYt&&mYt(),e._left=gYt&&gYt(),e._right=yYt&&yYt(),e._top=vYt&&vYt(),e._bottom=SYt&&SYt(),e._horizontalCenter=AYt&&AYt(),e._verticalCenter=TYt&&TYt(),e._isAbsLeft=bYt&&bYt(),e._isAbsRight=EYt&&EYt(),e._isAbsTop=CYt&&CYt(),e._isAbsBottom=xYt&&xYt(),e._isAbsHorizontalCenter=wYt&&wYt(),e._isAbsVerticalCenter=DYt&&DYt(),e._originalWidth=RYt&&RYt(),e._originalHeight=IYt&&IYt(),e._alignMode=MYt&&MYt(),e._lockFlags=PYt&&PYt(),e}s(e,t);var i=e.prototype;return i.updateAlignment=function(){v._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._uiProps.uiTransformComp.contentSize),v._widgetManager.add(this),this._hadAlignOnce=!1,this._registerEvent(),this._registerTargetEvents()},i.onDisable=function(){v._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(Nm.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.on(Nm.SIZE_CHANGED,this._setDirtyByMode,this),this.node.on(Nm.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this),this.node.on(Nm.PARENT_CHANGED,this._adjustTargetToParentChanged,this)},i._unregisterEvent=function(){this.node.off(Nm.TRANSFORM_CHANGED,this._setDirtyByMode,this),this.node.off(Nm.SIZE_CHANGED,this._setDirtyByMode,this),this.node.off(Nm.ANCHOR_CHANGED,this._adjustWidgetToAnchorChanged,this)},i._removeParentEvent=function(){this.node.off(Nm.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:zo;this.isAlignLeft&&t===NYt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===NYt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===NYt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===NYt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===NYt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===NYt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(OO)&&(t.on(Nm.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(Nm.SIZE_CHANGED,this._setDirtyByMode,this),t.on(Nm.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(Nm.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(Nm.SIZE_CHANGED,this._setDirtyByMode,this),t.off(Nm.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(Nm.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(Nm.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===LYt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&$Yt)>0,n=this.node._uiProps.uiTransformComp;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(this._alignFlags&NYt.TOP)>0},set:function(t){this._setAlign(NYt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&NYt.BOT)>0},set:function(t){this._setAlign(NYt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&NYt.LEFT)>0},set:function(t){this._setAlign(NYt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&NYt.RIGHT)>0},set:function(t){this._setAlign(NYt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&NYt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=NYt.MID):this._alignFlags&=~NYt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&NYt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=NYt.CENTER):this._alignFlags&=~NYt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&$Yt)===$Yt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&JYt)===JYt}},{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(NYt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(NYt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(NYt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(NYt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(NYt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(NYt.MID,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}(Lp)).AlignMode=LYt,m((dYt=BYt).prototype,"target",[cYt],Object.getOwnPropertyDescriptor(dYt.prototype,"target"),dYt.prototype),m(dYt.prototype,"alignMode",[_Yt],Object.getOwnPropertyDescriptor(dYt.prototype,"alignMode"),dYt.prototype),pYt=fa(dYt.prototype,"_alignFlags",[Ma],(function(){return 0})),mYt=fa(dYt.prototype,"_target",[Ma],(function(){return null})),gYt=fa(dYt.prototype,"_left",[Ma],(function(){return 0})),yYt=fa(dYt.prototype,"_right",[Ma],(function(){return 0})),vYt=fa(dYt.prototype,"_top",[Ma],(function(){return 0})),SYt=fa(dYt.prototype,"_bottom",[Ma],(function(){return 0})),AYt=fa(dYt.prototype,"_horizontalCenter",[Ma],(function(){return 0})),TYt=fa(dYt.prototype,"_verticalCenter",[Ma],(function(){return 0})),bYt=fa(dYt.prototype,"_isAbsLeft",[Ma],(function(){return!0})),EYt=fa(dYt.prototype,"_isAbsRight",[Ma],(function(){return!0})),CYt=fa(dYt.prototype,"_isAbsTop",[Ma],(function(){return!0})),xYt=fa(dYt.prototype,"_isAbsBottom",[Ma],(function(){return!0})),wYt=fa(dYt.prototype,"_isAbsHorizontalCenter",[Ma],(function(){return!0})),DYt=fa(dYt.prototype,"_isAbsVerticalCenter",[Ma],(function(){return!0})),RYt=fa(dYt.prototype,"_originalWidth",[Ma],(function(){return 0})),IYt=fa(dYt.prototype,"_originalHeight",[Ma],(function(){return 0})),MYt=fa(dYt.prototype,"_alignMode",[Ma],(function(){return LYt.ON_WINDOW_RESIZE})),PYt=fa(dYt.prototype,"_lockFlags",[Ma,Ba],(function(){return 0})),fYt=dYt))||fYt)||fYt)||fYt));v.internal.computeInverseTransForTarget=VYt,v.internal.getReadonlyNodeSize=kYt,v.Widget=tqt;var eqt,iqt=new bn;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eqt||(eqt={})),xe(eqt);var nqt,rqt,sqt,oqt,aqt,hqt,uqt,lqt,cqt,_qt,fqt,dqt,pqt,mqt,gqt,yqt,vqt,Sqt,Aqt,Tqt,bqt,Eqt,Cqt,xqt,wqt=t("gY",(GYt=Ta("cc.PageViewIndicator"),UYt=Ea(110),zYt=eh(wP),HYt=eh(eqt),WYt=eh(Kn),GYt(jYt=UYt(((ZYt=function(t){function e(){var e;return(e=t.call(this)||this).spacing=YYt&&YYt(),e._spriteFrame=qYt&&qYt(),e._direction=KYt&&KYt(),e._cellSize=QYt&&QYt(),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(bjt),this._layout||(this._layout=this.addComponent(bjt));var t=this._layout;this.direction===eqt.HORIZONTAL?(t.type=bjt.Type.HORIZONTAL,t.spacingX=this.spacing):this.direction===eqt.VERTICAL&&(t.type=bjt.Type.VERTICAL,t.spacingY=this.spacing),t.resizeMode=bjt.ResizeMode.CONTAINER},i._createIndicator=function(){var t=new xg;t.layer=this.node.layer;var e=t.addComponent(GF);return e.spriteFrame=this.spriteFrame,e.sizeMode=GF.SizeMode.CUSTOM,t.parent=this.node,t._uiProps.uiTransformComp.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;iqt.set(r.color),iqt.a=127.5,r.color=iqt}}if(t[e]._uiProps.uiComp){var s=t[e]._uiProps.uiComp;iqt.set(s.color),iqt.a=255,s.color=iqt}}}},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}(Lp)).Direction=eqt,m((XYt=ZYt).prototype,"spriteFrame",[zYt],Object.getOwnPropertyDescriptor(XYt.prototype,"spriteFrame"),XYt.prototype),m(XYt.prototype,"direction",[HYt],Object.getOwnPropertyDescriptor(XYt.prototype,"direction"),XYt.prototype),m(XYt.prototype,"cellSize",[WYt],Object.getOwnPropertyDescriptor(XYt.prototype,"cellSize"),XYt.prototype),YYt=fa(XYt.prototype,"spacing",[Ma],(function(){return 0})),qYt=fa(XYt.prototype,"_spriteFrame",[Ma],(function(){return null})),KYt=fa(XYt.prototype,"_direction",[Ma],(function(){return eqt.HORIZONTAL})),QYt=fa(XYt.prototype,"_cellSize",[Ma],(function(){return new Kn(20,20)})),jYt=XYt))||jYt)||jYt));v.PageViewIndicator=wqt;var Dqt,Rqt,Iqt,Mqt=new jn;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(Dqt||(Dqt={})),xe(Dqt),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Rqt||(Rqt={})),xe(Rqt),function(t){t.PAGE_TURNING="page-turning"}(Iqt||(Iqt={}));var Pqt=t("gX",(nqt=Ta("cc.PageView"),rqt=Ea(110),sqt=eh(Dqt),oqt=eh(Rqt),aqt=eh(wqt),hqt=eh(Xjt),uqt=eh(Xjt),lqt=eh([Pp]),cqt=eh([Pp]),nqt(_qt=rqt(((xqt=function(t){function e(){var e;return(e=t.call(this)||this).autoPageTurningThreshold=dqt&&dqt(),e.horizontal=pqt&&pqt(),e.vertical=mqt&&mqt(),e.cancelInnerEvents=gqt&&gqt(),e.scrollEvents=yqt&&yqt(),e.pageTurningSpeed=vqt&&vqt(),e.pageEvents=Sqt&&Sqt(),e._sizeMode=Aqt&&Aqt(),e._direction=Tqt&&Tqt(),e._scrollThreshold=bqt&&bqt(),e._pageTurningEventTiming=Eqt&&Eqt(),e._indicator=Cqt&&Cqt(),e._curPageIdx=0,e._lastPageIdx=0,e._pages=[],e._initContentPos=gn(),e._scrollCenterOffsetX=[],e._scrollCenterOffsetY=[],e._touchBeganPosition=Xn(),e._touchEndPosition=Xn(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(Nm.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(Nm.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._uiProps.uiTransformComp?(this.content.addChild(t),this._pages.push(t),this._updatePageView()):K(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._uiProps.uiTransformComp)return void K(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):$(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(bjt);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;this.direction===Rqt.Horizontal?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&&this._sizeMode===Dqt.Unified)for(var e=this._pages,i=t.contentSize,n=0,r=e.length;n<r;n++)e[n]._uiProps.uiTransformComp.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(Mqt),jn.set(this._touchBeganPosition,Mqt.x,Mqt.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(Mqt),jn.set(this._touchEndPosition,Mqt.x,Mqt.y),t.prototype._onTouchEnded.call(this,e,i)},i._onTouchCancelled=function(e,i){e.touch.getUILocation(Mqt),jn.set(this._touchEndPosition,Mqt.x,Mqt.y),t.prototype._onTouchCancelled.call(this,e,i)},i._onMouseWheel=function(){},i._syncScrollDirection=function(){this.horizontal=this.direction===Rqt.Horizontal,this.vertical=this.direction===Rqt.Vertical},i._syncSizeMode=function(){var t=this.view;if(this.content&&t){var e=this.content.getComponent(bjt);if(e){if(this._sizeMode===Dqt.Free&&this._pages.length>0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===Rqt.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===Rqt.Vertical&&(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,Pp.emitEvents(this.pageEvents,this,Iqt.PAGE_TURNING),this.node.emit(Iqt.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===Rqt.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===Rqt.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new jn;if(this._sizeMode===Dqt.Free)this.direction===Rqt.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===Rqt.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===Rqt.Horizontal?e.x=t*i.width:this.direction===Rqt.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===Rqt.Horizontal?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(this._sizeMode===Dqt.Free){var n=0,r=0;if(this.direction===Rqt.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===Rqt.Vertical)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(this.direction===Rqt.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===Rqt.Vertical)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 jn;jn.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}(FXt)).SizeMode=Dqt,xqt.Direction=Rqt,xqt.EventType=$Xt(Iqt,pXt),m((fqt=xqt).prototype,"sizeMode",[sqt],Object.getOwnPropertyDescriptor(fqt.prototype,"sizeMode"),fqt.prototype),m(fqt.prototype,"direction",[oqt],Object.getOwnPropertyDescriptor(fqt.prototype,"direction"),fqt.prototype),m(fqt.prototype,"indicator",[aqt],Object.getOwnPropertyDescriptor(fqt.prototype,"indicator"),fqt.prototype),dqt=fa(fqt.prototype,"autoPageTurningThreshold",[Ma],(function(){return 100})),m(fqt.prototype,"verticalScrollBar",[hqt,_h],Object.getOwnPropertyDescriptor(fqt.prototype,"verticalScrollBar"),fqt.prototype),m(fqt.prototype,"horizontalScrollBar",[uqt,_h],Object.getOwnPropertyDescriptor(fqt.prototype,"horizontalScrollBar"),fqt.prototype),pqt=fa(fqt.prototype,"horizontal",[_h,Ma],(function(){return!0})),mqt=fa(fqt.prototype,"vertical",[_h,Ma],(function(){return!0})),gqt=fa(fqt.prototype,"cancelInnerEvents",[_h,Ma],(function(){return!0})),yqt=fa(fqt.prototype,"scrollEvents",[lqt,Ma,_h],(function(){return[]})),vqt=fa(fqt.prototype,"pageTurningSpeed",[Ma],(function(){return.3})),Sqt=fa(fqt.prototype,"pageEvents",[cqt,Ma],(function(){return[]})),Aqt=fa(fqt.prototype,"_sizeMode",[Ma],(function(){return Dqt.Unified})),Tqt=fa(fqt.prototype,"_direction",[Ma],(function(){return Rqt.Horizontal})),bqt=fa(fqt.prototype,"_scrollThreshold",[Ma],(function(){return.5})),Eqt=fa(fqt.prototype,"_pageTurningEventTiming",[Ma],(function(){return.1})),Cqt=fa(fqt.prototype,"_indicator",[Ma],(function(){return null})),_qt=fqt))||_qt)||_qt));v.PageView=Pqt;var Bqt=new mn,Oqt=new jn,Lqt=new jn,Nqt=new jn(1,1),Fqt=new jn,kqt=new jn;function Vqt(t,e){if(!e._hadAlignOnce){e.alignMode===LYt.ONCE&&(e._hadAlignOnce=!0);var i,n=e.target,r=Lqt,s=Nqt;n?VYt(t,i=n,r,s):i=t.parent;var o=kYt(i),a=i instanceof tw||!i.getComponent(OO),h=a?Oqt:i.getComponent(OO).anchorPoint,u=a;t.getPosition(Bqt);var l=t._uiProps.uiTransformComp,c=Bqt.x,_=Bqt.y,f=l.anchorPoint,d=t.scale;if(e.alignFlags&NYt.HORIZONTAL){var p=0,m=0,g=o.width;u?(p=zo.left.x,m=zo.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=f.x,S=d.x;if(S<0&&(v=1-v,S=-S),e.isStretchWidth)y=m-p,0!==S&&(l.width=y/S),c=p+v*y;else{if(y=l.width*S,e.isAlignHorizontalCenter){var A=e.isAbsoluteHorizontalCenter?e.horizontalCenter:e.horizontalCenter*g,T=(.5-h.x)*o.width;n&&(A*=s.x,T+=r.x,T*=s.x),c=T+(v-.5)*y+A}else c=e.isAlignLeft?p+v*y:m+(v-1)*y;Li(S,0,Bi)?y=l.width:y/=S}e._lastSize.width=y}if(e.alignFlags&NYt.VERTICAL){var b=0,E=0,C=o.height;u?(E=zo.bottom.y,b=zo.top.y):b=(E=-h.y*C)+C,E+=e.isAbsoluteBottom?e.bottom:e.bottom*C,b-=e.isAbsoluteTop?e.top:e.top*C,n&&(E+=r.y,E*=s.y,b+=r.y,b*=s.y);var x=0,w=f.y,D=d.y;if(D<0&&(w=1-w,D=-D),e.isStretchHeight)x=b-E,0!==D&&(l.height=x/D),_=E+w*x;else{if(x=l.height*D,e.isAlignVerticalCenter){var R=e.isAbsoluteVerticalCenter?e.verticalCenter:e.verticalCenter*C,I=(.5-h.y)*o.height;n&&(R*=s.y,I+=r.y,I*=s.y),_=I+(w-.5)*x+R}else _=e.isAlignBottom?E+w*x:b+(w-1)*x;Li(D,0,Bi)?x=l.height:x/=D}e._lastSize.height=x}t.setPosition(c,_,Bqt.z),mn.set(e._lastPos,c,_,Bqt.z)}}function Gqt(t){var e=t.getComponent(tqt);if(e&&e.enabled){if(!v.isValid(t,!0))return;jqt.push(e)}for(var i,n=f(t.children);!(i=n()).done;){var r=i.value;r.active&&Gqt(r)}}function Uqt(){var t=FI.getScene();if(t){Xqt.isAligning=!0,Xqt._nodesOrderDirty&&(jqt.length=0,Gqt(t),Xqt._nodesOrderDirty=!1);var e=null,i=Xqt._activeWidgetsIterator;for(i.i=0;i.i<jqt.length;++i.i)(e=jqt[i.i])._dirty&&(Vqt(e.node,e),e._dirty=!1);Xqt.isAligning=!1}}var zqt,Hqt,Wqt,jqt=[],Xqt=t("h1",v._widgetManager={isAligning:!1,_nodesOrderDirty:!1,_activeWidgetsIterator:new le(jqt),animationState:null,init:function(){FI.on(LI.EVENT_AFTER_SCENE_LAUNCH,Uqt),FI.on(LI.EVENT_AFTER_UPDATE,Uqt),mM.instance.on("design-resolution-changed",this.onResized,this);var t=this.onResized.bind(this);mM.instance.on("canvas-resize",t),ko.on("window-resize",t)},add:function(){this._nodesOrderDirty=!0},remove:function(t){this._activeWidgetsIterator.remove(t)},onResized:function(){var t=FI.getScene();t&&this.refreshWidgetOnResized(t)},refreshWidgetOnResized:function(t){var e=xg.isNode(t)&&t.getComponent(tqt);e&&e.enabled&&(e.alignMode===LYt.ON_WINDOW_RESIZE||e.alignMode===LYt.ALWAYS)&&e.setDirty();for(var i,n=f(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=Fqt;s.set(0,0);var o=kqt;if(o.set(1,1),t.target&&VYt(n,r=t.target,s,o),!e)return;var a=r._uiProps&&r._uiProps.uiTransformComp,h=a?a.anchorPoint:Oqt,u=n._uiProps.uiTransformComp,l=kYt(r),c=u.anchorPoint,_=n.position,f=NYt,d=n.scale,p=0;if(e&f.LEFT){var m=-h.x*l.width;m+=s.x,m*=o.x,p=_.x-c.x*u.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=o.x,t.left=i(t.left,p)}if(e&f.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=o.x)-(_.x+(1-c.x)*u.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=l.width),p/=o.x,t.right=i(t.right,p)}if(e&f.TOP){var y=(1-h.y)*l.height;y+=s.y,p=(y*=o.y)-(_.y+(1-c.y)*u.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=l.height),p/=o.y,t.top=i(t.top,p)}if(e&f.BOT){var v=-h.y*l.height;v+=s.y,v*=o.y,p=_.y-c.y*u.height*Math.abs(d.y)-v,t.isAbsoluteBottom||(p/=l.height),p/=o.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&xg.isNode(i)&&t(i);var n=e.getComponent(tqt);n&&i&&Vqt(e,n)},AlignMode:LYt,AlignFlags:NYt});FI.on(LI.EVENT_INIT,(function(){Xqt.init()}));var Yqt,qqt,Kqt,Qqt,Zqt,Jqt,$qt,tKt,eKt,iKt,nKt,rKt,sKt=t("gZ",Ta("cc.SafeArea")(zqt=Ea(110)(zqt=ba(tqt)((Hqt=function(t){function e(){var e;return(e=t.call(this)||this)._symmetric=Wqt&&Wqt(),e}s(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),ko.on("window-resize",this.updateArea,this),ko.on("orientation-change",this.updateArea,this)},i.onDisable=function(){ko.off("window-resize",this.updateArea,this),ko.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(tqt),e=this.node.getComponent(OO);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=wM.getVisibleSize(),s=r.width,o=r.height,a=Uo.getSafeAreaRect(this._symmetric);t.top=o-a.y-a.height,t.bottom=a.y,t.left=a.x,t.right=s-a.x-a.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),Xqt.add(t)}},n(e,[{key:"symmetric",get:function(){return this._symmetric},set:function(t){this._symmetric=t}}]),e}(Lp),Wqt=fa(Hqt.prototype,"_symmetric",[Ma],(function(){return!0})),zqt=Hqt))||zqt)||zqt)||zqt);v.SafeArea=sKt;var oKt,aKt=t("g_",(Yqt=Ta("cc.UICoordinateTracker"),qqt=Ea(110),Kqt=eh(xg),Qqt=eh(Hk),Zqt=eh([Pp]),Yqt(Jqt=qqt((m(($qt=function(t){function e(){var e;return(e=t.call(this)||this).syncEvents=tKt&&tKt(),e._target=eKt&&eKt(),e._camera=iKt&&iKt(),e._useScale=nKt&&nKt(),e._distance=rKt&&rKt(),e._transformPos=gn(),e._viewPos=gn(),e._canMove=!0,e._lastWPos=gn(),e._lastCameraPos=gn(),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&&mn.transformMat4(this._viewPos,this.node.worldPosition,e.camera.matView),this.syncEvents.length>0)){var i=this._distance/Math.abs(this._viewPos.z);Pp.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}(Lp)).prototype,"target",[Kqt],Object.getOwnPropertyDescriptor($qt.prototype,"target"),$qt.prototype),m($qt.prototype,"camera",[Qqt],Object.getOwnPropertyDescriptor($qt.prototype,"camera"),$qt.prototype),tKt=fa($qt.prototype,"syncEvents",[Zqt,Ma],(function(){return[]})),eKt=fa($qt.prototype,"_target",[Ma],(function(){return null})),iKt=fa($qt.prototype,"_camera",[Ma],(function(){return null})),nKt=fa($qt.prototype,"_useScale",[Ma],(function(){return!0})),rKt=fa($qt.prototype,"_distance",[Ma],(function(){return 1})),Jqt=$qt))||Jqt)||Jqt)),hKt=[Nm.TOUCH_START,Nm.TOUCH_END,Nm.TOUCH_MOVE,Nm.MOUSE_DOWN,Nm.MOUSE_MOVE,Nm.MOUSE_UP,Nm.MOUSE_ENTER,Nm.MOUSE_LEAVE,Nm.MOUSE_WHEEL];function uKt(t){t.propagationStopped=!0}var lKt,cKt,_Kt,fKt,dKt,pKt=t("g$",Ta("cc.BlockInputEvents")(oKt=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<hKt.length;t++)this.node.on(hKt[t],uKt,this)},i.onDisable=function(){for(var t=0;t<hKt.length;t++)this.node.off(hKt[t],uKt,this)},e}(Lp))||oKt),mKt=t("h0",Ta("cc.SubContextView")(lKt=Ea(110)(lKt=ba(OO)((cKt=function(t){function e(){var e;return(e=t.call(this)||this)._fps=_Kt&&_Kt(),e._sprite=null,e._imageAsset=new sp,e._texture=new Dm,e._updatedTime=0,e._updateInterval=0,e._openDataContext=null,e._content=new xg("content"),e._designResolutionSize=fKt&&fKt(),e._content.hideFlags|=$s.Flags.DontSave|$s.Flags.HideInHierarchy,e._updatedTime=performance.now(),e}s(e,t);var i=e.prototype;return i.onLoad=function(){Bs.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=Bs.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,n=513;if(e<=n&&i<=n){var r=n/e,s=n/i,o=r<s?r:s;e*=o,i*=o}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(GF),this._sprite||(this._sprite=this._content.addComponent(GF)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new wP;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(OO),e=this._content.getComponent(OO),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=wM.getViewportRect(),o=e.getBoundingBoxToWorld(),a=wM.getVisibleSize(),h=ko.devicePixelRatio,u=(s.width*(o.x/a.width)+s.x)/h,l=(s.height*(o.y/a.height)+s.y)/h,c=s.width*(o.width/a.width)/h,_=s.height*(o.height/a.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:l,width:c,height:_})}},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(Nm.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(Nm.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(Nm.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(Nm.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(Nm.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(Nm.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}(Lp),_Kt=fa(cKt.prototype,"_fps",[Ma],(function(){return 60})),fKt=fa(cKt.prototype,"_designResolutionSize",[Ma],(function(){return new Kn(640,960)})),lKt=cKt))||lKt)||lKt)||lKt);v.SubContextView=mKt,St({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 gKt,yKt,vKt,SKt=t("h5",Ta("cc.UIReorderComponent")(dKt=function(){$(1408,"UIReorderComponent")})||dKt);v.UIReorderComponent=SKt,v.ButtonComponent=VHt,ie(VHt,"cc.ButtonComponent"),v.EditBoxComponent=ajt,ie(ajt,"cc.EditBoxComponent"),v.LayoutComponent=bjt,ie(bjt,"cc.LayoutComponent"),v.ProgressBarComponent=Fjt,ie(Fjt,"cc.ProgressBarComponent"),v.ScrollViewComponent=FXt,ie(FXt,"cc.ScrollViewComponent"),v.ScrollBarComponent=Xjt,ie(Xjt,"cc.ScrollBarComponent"),v.SliderComponent=JXt,ie(JXt,"cc.SliderComponent"),v.ToggleComponent=aYt,ie(aYt,"cc.ToggleComponent"),v.ToggleContainerComponent=OYt,ie(OYt,"cc.ToggleContainerComponent"),v.WidgetComponent=tqt,ie(tqt,"cc.WidgetComponent"),v.PageViewComponent=Pqt,ie(Pqt,"cc.PageViewComponent"),v.PageViewIndicatorComponent=wqt,ie(wqt,"cc.PageViewIndicatorComponent"),v.SafeAreaComponent=sKt,ie(sKt,"cc.SafeAreaComponent"),ie(aKt,"cc.UICoordinateTrackerComponent"),v.BlockInputEventsComponent=pKt,ie(pKt,"cc.BlockInputEventsComponent"),ut(mM.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"}]),lt(mM.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 AKt=t("h6",Ta("cc.VideoClip")((yKt=function(t){function e(){var e;return(e=t.call(this)||this)._duration=vKt&&vKt(),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}(Fd),vKt=fa(yKt.prototype,"_duration",[Ma],(function(){return 0})),gKt=yKt))||gKt),TKt=A.document;function bKt(t,e,i){var n=TKt.createElement("video"),r=TKt.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;G(e),i(new Error(e))},s.send()}function EKt(t,e,i,n){var r=new AKt;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}oA.register({".mp4":bKt,".avi":bKt,".mov":bKt,".mpg":bKt,".mpeg":bKt,".rm":bKt,".rmvb":bKt}),yA.register({".mp4":EKt,".avi":EKt,".mov":EKt,".mpg":EKt,".mpeg":EKt,".rm":EKt,".rmvb":EKt});var CKt,xKt,wKt=be({REMOTE:0,LOCAL:1});!function(t){t.NONE="none",t.PLAYING="playing",t.PAUSED="paused",t.STOPPED="stopped",t.COMPLETED="completed",t.META_LOADED="meta-loaded",t.READY_TO_PLAY="ready-to-play",t.ERROR="error",t.CLICKED="clicked"}(CKt||(CKt={})),function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(xKt||(xKt={}));var DKt=function(){function t(t){var e=this;this._componentEventList=new Map,this._state=CKt.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(OO),this._onInterruptedBegin=function(){e.video&&e._state===CKt.PLAYING&&(e.video.pause(),e._interrupted=!0)},this._onInterruptedEnd=function(){e._interrupted&&e.video&&(e.video.play(),e._interrupted=!1)},v.game.on(v.Game.EVENT_PAUSE,this._onInterruptedBegin),v.game.on(v.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(CKt.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(CKt.READY_TO_PLAY)},e.onPlay=function(){this._playing=!0,this.dispatchEvent(CKt.PLAYING)},e.onPlaying=function(){this.dispatchEvent(CKt.PLAYING)},e.onPause=function(){this._playing=!1,this._ignorePause?this._ignorePause=!1:this.dispatchEvent(CKt.PAUSED)},e.onStoped=function(){this._playing=!1,this._ignorePause=!1,this.dispatchEvent(CKt.STOPPED)},e.onEnded=function(){this._playing=!1,this.dispatchEvent(CKt.COMPLETED)},e.onClick=function(){this.dispatchEvent(CKt.CLICKED)},e.onError=function(t){this.dispatchEvent(CKt.ERROR);var e=t.target;e&&e.error&&z("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){this._uiTrans&&(this._uiTrans.width=t,this._uiTrans.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(),v.game.off(v.Game.EVENT_PAUSE,this._onInterruptedBegin),v.game.off(v.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 FI.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();v.internal.VideoPlayerImpl=DKt;var RKt,IKt,MKt,PKt,BKt,OKt,LKt,NKt,FKt,kKt,VKt,GKt,UKt,zKt,HKt,WKt,jKt,XKt,YKt,qKt,KKt,QKt=A.document,ZKt=-Math.pow(2,15),JKt=Hn(),$Kt=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();A.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(CKt.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){Uo.browserType!==co.UC?this.video&&(this.video.playbackRate=t):U("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&&i.readyState===xKt.HAVE_ENOUGH_DATA)return Uo.os===po.IOS&&Uo.isBrowser?(t?i.webkitEnterFullscreen&&i.webkitEnterFullscreen():i.webkitExitFullscreen&&i.webkitExitFullscreen(),void(this._fullScreenOnAwake=i.webkitDisplayingFullscreen)):Go.supportsFullScreen?void(t?(Uo.browserType===co.IE&&(i.style.transform=""),i.setAttribute("x5-video-player-fullscreen","true"),Go.requestFullScreen(i,(function(t){var n=Uo.browserType===co.IE?t.msFullscreenElement:t.fullscreenElement;e._fullScreenOnAwake=n===i}),(function(){e._fullScreenOnAwake=!1}))):(i.removeAttribute("x5-video-player-fullscreen"),Go.exitFullScreen())):(this._fullScreenOnAwake=t,this._forceUpdate=!0,void this.syncMatrix())},i.syncStayOnBottom=function(t){this._video&&(this._video.style["z-index"]=t?ZKt: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&&Ue(MM.container,t)&&(MM.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=QKt.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(),MM.container.appendChild(e);var i=QKt.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 xKt.HAVE_METADATA:case xKt.HAVE_ENOUGH_DATA: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&&!Go.fullScreen()){this._dirty&&(this._dirty=!1,this._stayOnBottom?(this._clearColorA=t.clearColor.w,this._clearFlag=t.clearFlag,t.clearColor.w=0,t.clearFlag=n_.ALL):this._clearFlag&&(t.clearColor.w=this._clearColorA,t.clearFlag=this._clearFlag,this._clearColorA=-1,this._clearFlag=null)),this._component.node.getWorldMatrix(JKt),t.update(!0),t.worldMatrixToScreen(JKt,JKt,MM.canvas.width,MM.canvas.height);var e=0,i=0;if(this._fullScreenOnAwake?(e=zo.width,i=zo.height):(e=this._uiTrans.contentSize.width,i=this._uiTrans.contentSize.height),this._forceUpdate||this._m00!==JKt.m00||this._m01!==JKt.m01||this._m04!==JKt.m04||this._m05!==JKt.m05||this._m12!==JKt.m12||this._m13!==JKt.m13||this._w!==e||this._h!==i){this._m00=JKt.m00,this._m01=JKt.m01,this._m04=JKt.m04,this._m05=JKt.m05,this._m12=JKt.m12,this._m13=JKt.m13,this._w=e,this._h=i;var n=ko.devicePixelRatio,r=1/n,s=1/n,o=MM.container,a=JKt.m00*r,h=JKt.m01,u=JKt.m04,l=JKt.m05*s;this._video.style.width=this._w+"px",this._video.style.height=this._h+"px",Uo.browserType!==co.MOBILE_QQ?this._video.style.objectFit=this._keepAspectRatio?"none":"fill":U("keepAspectRatio is not supported by the qq mobile browser.");var c=this._w*r,_=this._h*s,f=this._uiTrans.anchorPoint,d=f.x,p=f.y,m=c*JKt.m00*d,g=_*JKt.m05*p,y=o&&o.style.paddingLeft?parseInt(o.style.paddingLeft):0,v=o&&o.style.paddingBottom?parseInt(o.style.paddingBottom):0,S="matrix("+a+","+-h+","+-u+","+l+","+(JKt.m12*r-m+y)+","+-(JKt.m13*s-g+v)+")";this._video.style.transform=S,this._video.style["-webkit-transform"]=S,Uo.browserType!==co.IE&&(this._forceUpdate=!1)}}}},e}(DKt),tQt=function(){function t(){}return t.getImpl=function(t){return new $Kt(t)},t}();v.internal.VideoPlayerImplManager=tQt;var eQt,iQt=t("h7",(RKt=Ta("cc.VideoPlayer"),IKt=ba(OO),MKt=eh(AKt),PKt=eh(wKt),BKt=eh(AKt),OKt=eh([Pp]),RKt(LKt=IKt(((KKt=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)._resourceType=FKt&&FKt(),e._remoteURL=kKt&&kKt(),e._clip=VKt&&VKt(),e._playOnAwake=GKt&&GKt(),e._volume=UKt&&UKt(),e._mute=zKt&&zKt(),e._playbackRate=HKt&&HKt(),e._loop=WKt&&WKt(),e._fullScreenOnAwake=jKt&&jKt(),e._stayOnBottom=XKt&&XKt(),e._keepAspectRatio=YKt&&YKt(),e._impl=null,e._cachedCurrentTime=0,e.videoPlayerEvent=qKt&&qKt(),e}s(e,t);var i=e.prototype;return i.syncSource=function(){this._impl&&(this._resourceType===wKt.REMOTE?this._impl.syncURL(this._remoteURL):this._impl.syncClip(this._clip),this._cachedCurrentTime=0,this._impl.syncLoop(this._loop),this._impl.syncVolume(this._volume),this._impl.syncMute(this._mute),this._impl.seekTo(this._cachedCurrentTime),this._impl.syncPlaybackRate(this._playbackRate),this._impl.syncStayOnBottom(this._stayOnBottom),this._impl.syncKeepAspectRatio(this._keepAspectRatio),this._impl.syncFullScreenOnAwake(this._fullScreenOnAwake))},i.__preload=function(){this._impl=tQt.getImpl(this),this.syncSource(),this._impl.componentEventList.set(CKt.META_LOADED,this.onMetaLoaded.bind(this)),this._impl.componentEventList.set(CKt.READY_TO_PLAY,this.onReadyToPlay.bind(this)),this._impl.componentEventList.set(CKt.PLAYING,this.onPlaying.bind(this)),this._impl.componentEventList.set(CKt.PAUSED,this.onPaused.bind(this)),this._impl.componentEventList.set(CKt.STOPPED,this.onStopped.bind(this)),this._impl.componentEventList.set(CKt.COMPLETED,this.onCompleted.bind(this)),this._impl.componentEventList.set(CKt.ERROR,this.onError.bind(this)),this._impl.componentEventList.set(CKt.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(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.META_LOADED),this.node.emit("meta-loaded",this)},i.onReadyToPlay=function(){this._playOnAwake&&!this.isPlaying&&this.play(),Pp.emitEvents(this.videoPlayerEvent,this,CKt.READY_TO_PLAY),this.node.emit(CKt.READY_TO_PLAY,this)},i.onPlaying=function(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.PLAYING),this.node.emit(CKt.PLAYING,this)},i.onPaused=function(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.PAUSED),this.node.emit(CKt.PAUSED,this)},i.onStopped=function(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.STOPPED),this.node.emit(CKt.STOPPED,this)},i.onCompleted=function(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.COMPLETED),this.node.emit(CKt.COMPLETED,this)},i.onError=function(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.ERROR),this.node.emit(CKt.ERROR,this)},i.onClicked=function(){Pp.emitEvents(this.videoPlayerEvent,this,CKt.CLICKED),this.node.emit(CKt.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)?U("illegal video time! value:"+t):(t=Ni(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:CKt.NONE}},{key:"isPlaying",get:function(){return!!this._impl&&this._impl.isPlaying}}]),e}(Lp)).EventType=CKt,KKt.ResourceType=wKt,FKt=fa((NKt=KKt).prototype,"_resourceType",[Ma],(function(){return wKt.LOCAL})),kKt=fa(NKt.prototype,"_remoteURL",[Ma],(function(){return""})),VKt=fa(NKt.prototype,"_clip",[MKt,Ma],(function(){return null})),GKt=fa(NKt.prototype,"_playOnAwake",[Ma],(function(){return!0})),UKt=fa(NKt.prototype,"_volume",[Ma],(function(){return 1})),zKt=fa(NKt.prototype,"_mute",[Ma],(function(){return!1})),HKt=fa(NKt.prototype,"_playbackRate",[Ma],(function(){return 1})),WKt=fa(NKt.prototype,"_loop",[Ma],(function(){return!1})),jKt=fa(NKt.prototype,"_fullScreenOnAwake",[Ma],(function(){return!1})),XKt=fa(NKt.prototype,"_stayOnBottom",[Ma],(function(){return!1})),YKt=fa(NKt.prototype,"_keepAspectRatio",[Ma],(function(){return!0})),m(NKt.prototype,"resourceType",[PKt],Object.getOwnPropertyDescriptor(NKt.prototype,"resourceType"),NKt.prototype),m(NKt.prototype,"clip",[BKt],Object.getOwnPropertyDescriptor(NKt.prototype,"clip"),NKt.prototype),qKt=fa(NKt.prototype,"videoPlayerEvent",[Ma,OKt],(function(){return[]})),LKt=NKt))||LKt)||LKt));v.internal.VideoPlayer=iQt,ht(iQt.prototype,"VideoPlayer.prototype",[{name:"onPasued",newName:"onPaused"}]),function(t){t.NONE="none",t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"}(eQt||(eQt={}));var nQt=function(){function t(t){this._componentEventList=new Map,this._state=eQt.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(OO),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=eQt.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 FI.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();v.internal.WebViewImpl=nQt;var rQt,sQt,oQt,aQt,hQt,uQt,lQt,cQt,_Qt=A.document,fQt=Hn(),dQt=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(eQt.LOADED);var i=e.target,n=i.contentDocument&&i.contentDocument.body;n&&n.innerHTML.includes("404")&&t.dispatchEvent(eQt.ERROR,n.innerHTML)}))},i.loadURL=function(t){this.webview&&(this.webview.src=t,this.dispatchEvent(eQt.LOADING))},i.createWebView=function(){var t=_Qt.createElement("div");this._wrapper=t,t.id="webview-wrapper",t.style["-webkit-overflow"]="auto",t.style["-webkit-overflow-scrolling"]="touch",t.style.position="absolute",t.style.bottom="0px",t.style.left="0px",t.style.transformOrigin="0px 100% 0px",t.style["-webkit-transform-origin"]="0px 100% 0px",MM.container.appendChild(t);var e=_Qt.createElement("iframe");this._webview=e,e.id="webview",e.style.border="none",e.style.width="100%",e.style.height="100%",t.appendChild(e),this._bindDomEvent()},i.removeWebView=function(){var t=this._wrapper;Ue(MM.container,t)&&MM.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(eQt.ERROR,t),z(t)}}},i.setOnJSCallback=function(){U("The platform does not support")},i.setJavascriptInterfaceScheme=function(){U("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(fQt),t.update(!0),t.worldMatrixToScreen(fQt,fQt,MM.canvas.width,MM.canvas.height);var e=this._uiTrans.contentSize,i=e.width,n=e.height;if(this._forceUpdate||this._m00!==fQt.m00||this._m01!==fQt.m01||this._m04!==fQt.m04||this._m05!==fQt.m05||this._m12!==fQt.m12||this._m13!==fQt.m13||this._w!==i||this._h!==n){this._m00=fQt.m00,this._m01=fQt.m01,this._m04=fQt.m04,this._m05=fQt.m05,this._m12=fQt.m12,this._m13=fQt.m13,this._w=i,this._h=n;var r=ko.devicePixelRatio,s=1/r,o=1/r,a=MM.container,h=fQt.m00*s,u=fQt.m01,l=fQt.m04,c=fQt.m05*o;this._wrapper.style.width=i+"px",this._wrapper.style.height=n+"px";var _=this._w*s,f=this._h*o,d=_*fQt.m00*this._uiTrans.anchorX,p=f*fQt.m05*this._uiTrans.anchorY,m=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,g=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,y="matrix("+h+","+-u+","+-l+","+c+","+(fQt.m12*s-d+m)+","+-(fQt.m13*o-p+g)+")";this._wrapper.style.transform=y,this._wrapper.style["-webkit-transform"]=y,this._forceUpdate=!1}}}},e}(nQt),pQt=function(){function t(){}return t.getImpl=function(t){return new dQt(t)},t}();v.internal.WebViewImplManager=pQt;var mQt=t("h8",(rQt=Ta("cc.WebView"),sQt=ba(OO),oQt=eh([Pp]),rQt(aQt=sQt(((cQt=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)._url=uQt&&uQt(),e._impl=null,e.webviewEvents=lQt&&lQt(),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=pQt.getImpl(this),this._impl.componentEventList.set(eQt.LOADING,this.onLoading.bind(this)),this._impl.componentEventList.set(eQt.LOADED,this.onLoaded.bind(this)),this._impl.componentEventList.set(eQt.ERROR,this.onError.bind(this)),this._impl.loadURL(this._url)},i.onLoading=function(){Pp.emitEvents(this.webviewEvents,this,eQt.LOADING),this.node.emit(eQt.LOADING,this)},i.onLoaded=function(){Pp.emitEvents(this.webviewEvents,this,eQt.LOADED),this.node.emit(eQt.LOADED,this)},i.onError=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];Pp.emitEvents(this.webviewEvents,this,eQt.ERROR,e),this.node.emit(eQt.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:eQt.NONE}}]),e}(Lp)).EventType=eQt,uQt=fa((hQt=cQt).prototype,"_url",[Ma],(function(){return"https://cocos.com"})),lQt=fa(hQt.prototype,"webviewEvents",[Ma,oQt],(function(){return[]})),aQt=hQt))||aQt)||aQt));v.internal.WebView=mQt}}}));
|