@galacean/effects 2.1.3-alpha.2 → 2.1.3-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -3,6 +3,6 @@
3
3
  * Description: Galacean Effects runtime player for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.3-alpha.2
7
- */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,function(t){"use strict";function e(t,e,i,r,n,s,a){try{var o=t[s](a),u=o.value}catch(t){i(t);return}o.done?e(u):Promise.resolve(u).then(r,n)}function i(t){return function(){var i=this,r=arguments;return new Promise(function(n,s){var a=t.apply(i,r);function o(t){e(a,n,s,o,u,"next",t)}function u(t){e(a,n,s,o,u,"throw",t)}o(void 0)})}}function r(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):r(t,e)}function n(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function s(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}function a(t,e){var i,r,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R,O,M,I,P,L,F,V,N,D,k,z,U,B,G,X,j,H,Y,W,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ts,ta,to,tu,th,tc,tl,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tA,tS,tC,tw,tR,tO,tM,tI,tP,tL,tF,tV,tN,tD,tk,tz,tU,tB,tG,tX,tj,tH,tY,tW,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,es,ea,eo,eu,eh,ec,el,ef,ed,ep,em,ev=new Uint8Array(16),ey=[],eg=0;eg<256;++eg)ey.push((eg+256).toString(16).slice(1));var ex={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function eb(t,e){return t.includes(e)||t.push(e),t}function eT(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function eE(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(s);return a.set(t),a}return t}function e_(t,e){var i=[0,0,0,0];if(ej(t)){t=t.replace(/[\s\t\r\n]/g,"");var n=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(n){var s=+n[4];i=[+n[1],+n[2],+n[3],isNaN(s)?255:255*s]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),255])}else r(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function eA(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var s=t[n-1],a=t[n];if(s.stop<=e&&e<=a.stop){r=eC(s.color,a.color,(e-s.stop)/(a.stop-s.stop));break}}return r||(r=t[t.length-1].color),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}function eS(t){var e=[];if(r(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4];e.push({stop:ew(i),color:[r,n,s,a]})}):Object.keys(t).forEach(function(i){var r=e_(t[i]);e.push({stop:ew(i),color:r})}),(e=e.sort(function(t,e){return t.stop-e.stop})).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function eC(t,e,i,r){var n=[],s=1-i;if(r)for(var a=0;a<4;a++)n[a]=t[a]*s+e[a]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*s+e[o]*e[o]*i));n[3]=Math.round(t[3]*s+e[3]*i)}return n}function ew(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eR(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);return Math.min(screen.width/t*2,2)}return 1}function eO(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function eM(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eI(){return eM()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eP(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eL(){return"miniprogram"===window.__wxjs_environment}function eF(t){ej(t)&&(t=e_(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function eV(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eS(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var s=n/128,a=void 0,o=void 0,u=0;u<r.length&&(a=r[u],o=r[u+1],!(a.stop<=s)||!(o.stop>s));u++);var h=eC(a.color,o.color,(s-a.stop)/(o.stop-a.stop));i.set(h,4*n)}i.set(r[r.length-1].color,508)}return e}function eN(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var s,a,o=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>o.priority&&h>=u;)h--;for(;e[u].priority<=o.priority&&u<h;)u++}else{for(;e[h].priority<o.priority&&h>=u;)h--;for(;e[u].priority>=o.priority&&u<h;)u++}s=[e[h],e[u]],e[u]=s[0],e[h]=s[1]}return a=[e[u],e[r]],e[r]=a[0],e[u]=a[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)ek(t,r,e);return t}function eD(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&ek(t,t.length-1,i)),t}function ek(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function ez(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eU(t){return/^[^\d.][\w-]*$/.test(t)}function eB(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(o=t.OrderType||(t.OrderType={}))[o.none=1]="none",o[o.ascending=2]="ascending",o[o.descending=3]="descending";var eG={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(eB(t),[r])),null==tb||tb("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(eB(t))),null==tb||tb("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(eB(t))),null==tb||tb("warn",t,r)},register:function(t){t&&eY(t)&&(tb=t)}};function eX(){}function ej(t){return"string"==typeof t}t.DestroyOptions=void 0,(u=t.DestroyOptions||(t.DestroyOptions={}))[u.destroy=0]="destroy",u[u.keep=1]="keep",u[u.force=0]="force";var eH=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eY(t){return"[object Function]"===Object.prototype.toString.call(t)}function eW(t){return"[object Object]"===Object.prototype.toString.call(t)}function eZ(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eq(t,e){return t+Math.random()*(e-t)}function eK(){throw Error("Destroyed item cannot be used again.")}function eQ(){return(function(t,e,i){if(ex.randomUUID&&!t)return ex.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tx&&!(tx="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tx(ev)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),ey[n[r+0]]+ey[n[r+1]]+ey[n[r+2]]+ey[n[r+3]]+"-"+ey[n[r+4]]+ey[n[r+5]]+"-"+ey[n[r+6]]+ey[n[r+7]]+"-"+ey[n[r+8]]+ey[n[r+9]]+"-"+ey[n[r+10]]+ey[n[r+11]]+ey[n[r+12]]+ey[n[r+13]]+ey[n[r+14]]+ey[n[r+15]]})().replace(/-/g,"")}function eJ(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],s=0;s<r.length;s+=512){for(var a=r.slice(s,s+512),o=Array(a.length),u=0;u<a.length;u++)o[u]=a.charCodeAt(u);var h=new Uint8Array(o);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function e$(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var e0={},e1=[],e2={};function e3(t,e,i,r){e2[t]&&eG.error("Duplicate registration for plugin "+t+"."),e2[t]=i,e0[t]=e,r&&eb(e1,t)}var e4=function(){function t(t){var e={},i=[],r=function(t){var r=e0[t];i.includes(r)||(i.push(r),e[t]=r)};e1.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=e0[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=e5[t])?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""));var r=new i;return r.name=t,r}).sort(function(t,e){return t.order-e.order})}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},e.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},e.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},e.processRawJSON=function(t,e){var r=this;return i(function(){return a(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var r=this;return i(function(){return a(this,function(i){return[2,r.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e,r){var n=this;return i(function(){return a(this,function(i){return[2,n.callStatic("precompile",t,e,r)]})})()},e.loadResources=function(t,e){var r=this;return i(function(){return a(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var s=this;return i(function(){var e,i,n,o,u,h;return a(this,function(a){for(n=0,e=[],i=s.plugins;n<i.length;n++)t in(o=e0[i[n].name])&&e.push(Promise.resolve(null==(h=o[t])?void 0:(u=h).call.apply(u,[].concat([o],r))));return[2,Promise.all(e)]})})()},t}(),e5={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",richtext:"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"},e6=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t.precompile=function(t,e){return Promise.resolve()},t}();function e8(t,e){return(e8=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function e9(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&e8(t,e)}(h=tT||(tT={})).S="S",h.APlus="A+",h.A="A",h.BPlus="B+",h.B="B",(c=tE||(tE={}))[c.ALPHA=0]="ALPHA",c[c.ADD=1]="ADD",c[c.MULTIPLY=2]="MULTIPLY",c[c.BRIGHTNESS=3]="BRIGHTNESS",c[c.SUBTRACTION=4]="SUBTRACTION",c[c.STRONG_LIGHT=5]="STRONG_LIGHT",c[c.WEAK_LIGHT=6]="WEAK_LIGHT",c[c.SUPERPOSITION=7]="SUPERPOSITION",(l=t_||(t_={}))[l.DOUBLE=1032]="DOUBLE",l[l.FRONT=1028]="FRONT",l[l.BACK=1029]="BACK",(f=tA||(tA={}))[f.NONE=0]="NONE",f[f.MASK=1]="MASK",f[f.OBSCURED=2]="OBSCURED",f[f.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(d=tS||(tS={}))[d.NONE=0]="NONE",d[d.SPHERE=1]="SPHERE",d[d.CONE=2]="CONE",d[d.HEMISPHERE=3]="HEMISPHERE",d[d.CIRCLE=4]="CIRCLE",d[d.DONUT=5]="DONUT",d[d.RECTANGLE=6]="RECTANGLE",d[d.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",d[d.EDGE=8]="EDGE",d[d.TEXTURE=9]="TEXTURE",(p=tC||(tC={}))[p.GYROSCOPE=0]="GYROSCOPE",p[p.SPINE=1]="SPINE",(m=tw||(tw={}))[m.CLICK=0]="CLICK",m[m.MESSAGE=1]="MESSAGE",m[m.DRAG=2]="DRAG",(v=tR||(tR={}))[v.NONE=0]="NONE",v[v.NOTIFY=1]="NOTIFY",v[v.RESUME_PLAYER=2]="RESUME_PLAYER",v[v.REMOVE=3]="REMOVE",v[v.PAUSE=4]="PAUSE",(y=tO||(tO={})).base="0",y.sprite="1",y.particle="2",y.null="3",y.interact="4",y.plugin="5",y.camera="6",y.composition="7",y.spine="spine",y.mesh="mesh",y.tree="tree",y.text="text",y.light="light",y.skybox="skybox",y.effect="effect",y.shape="shape",y.postProcessVolume="postProcessVolume",y.node="node",y.video="video",y.audio="audio",y.richtext="richtext",(g=tM||(tM={}))[g.BILLBOARD=0]="BILLBOARD",g[g.MESH=1]="MESH",g[g.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",g[g.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(x=tI||(tI={}))[x.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",x[x.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",x[x.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",x[x.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",x[x.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",x[x.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",x[x.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",x[x.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",x[x.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(b=tP||(tP={})).Opaque="Opaque",b.Transparent="Transparent",(T=tL||(tL={})).Both="Both",T.Back="Back",T.Front="Front",(E=tF||(tF={}))[E.portrait=1]="portrait",E[E.landscape=0]="landscape",(_=tV||(tV={}))[_.CONSTANT=0]="CONSTANT",_[_.CONSTANT_VEC2=1]="CONSTANT_VEC2",_[_.CONSTANT_VEC3=2]="CONSTANT_VEC3",_[_.CONSTANT_VEC4=3]="CONSTANT_VEC4",_[_.RANDOM=4]="RANDOM",_[_.LINE=5]="LINE",_[_.CURVE=6]="CURVE",_[_.BEZIER_PATH=7]="BEZIER_PATH",_[_.RGBA_COLOR=8]="RGBA_COLOR",_[_.GRADIENT_COLOR=9]="GRADIENT_COLOR",_[_.SHAPE_POINTS=10]="SHAPE_POINTS",_[_.SHAPE_SPLITS=11]="SHAPE_SPLITS",_[_.LINEAR_PATH=12]="LINEAR_PATH",_[_.COLORS=13]="COLORS",_[_.BINARY=20]="BINARY",_[_.BEZIER_CURVE=21]="BEZIER_CURVE",_[_.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",_[_.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",_[_.COLOR_CURVE=24]="COLOR_CURVE",_[_.VECTOR4_CURVE=25]="VECTOR4_CURVE",(A=tN||(tN={}))[A.AUTO=0]="AUTO",A[A.EASE=1]="EASE",A[A.EASE_IN=2]="EASE_IN",A[A.EASE_OUT=3]="EASE_OUT",A[A.LINE=4]="LINE",A[A.HOLD=5]="HOLD",A[A.LINE_OUT=6]="LINE_OUT",(S=tD||(tD={}))[S.destroy=0]="destroy",S[S.restart=5]="restart",S[S.forward=2]="forward",S[S.freeze=4]="freeze",(C=tk||(tk={}))[C.destroyChildren=6]="destroyChildren",(w=tz||(tz={}))[w.none=0]="none",w[w.removeParticle=1]="removeParticle",(R=tU||(tU={}))[R.RANDOM=0]="RANDOM",R[R.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",R[R.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",R[R.UNIFORM_BURST=3]="UNIFORM_BURST",(O=tB||(tB={})).point="point",O.spot="spot",O.directional="directional",O.ambient="ambient",(M=tG||(tG={}))[M.box=2]="box",M[M.sphere=3]="sphere",(I=tX||(tX={})).orthographic="orthographic",I.perspective="perspective",(P=tj||(tj={})).unlit="unlit",P.pbr="pbr",P.hair="hair",(L=tH||(tH={}))[L.opaque=100]="opaque",L[L.masked=101]="masked",L[L.translucent=102]="translucent",L[L.additive=103]="additive",(F=tY||(tY={})).none="none",F.uv="uv",F.normal="normal",F.basecolor="basecolor",F.alpha="alpha",F.metallic="metallic",F.roughness="roughness",F.ao="ao",F.emissive="emissive",F.diffuse="diffuse",(V=tW||(tW={}))[V.display=0]="display",V[V.clip=1]="clip",V[V.ellipsis=2]="ellipsis",(N=tZ||(tZ={}))[N.top=0]="top",N[N.middle=1]="middle",N[N.bottom=2]="bottom",(D=tq||(tq={}))[D.left=0]="left",D[D.middle=1]="middle",D[D.right=2]="right",(k=tK||(tK={})).normal="normal",k.bold="bold",k.lighter="lighter",(z=tQ||(tQ={})).normal="normal",z.italic="italic",z.oblique="oblique";var e7={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(U=tJ||(tJ={}))[U.Custom=0]="Custom",U[U.Rectangle=1]="Rectangle",U[U.Ellipse=2]="Ellipse",U[U.Polygon=3]="Polygon",U[U.Star=4]="Star",t$||(t$={}),t0||(t0={}),(B=t1||(t1={})).video="video",B.image="image",(G=t2||(t2={})).video="video",G.audio="audio",(X=t3||(t3={})).VFXItemData="VFXItemData",X.EffectComponent="EffectComponent",X.Material="Material",X.Shader="Shader",X.SpriteComponent="SpriteComponent",X.ParticleSystem="ParticleSystem",X.InteractComponent="InteractComponent",X.CameraController="CameraController",X.PostProcessVolume="PostProcessVolume",X.Geometry="Geometry",X.Texture="Texture",X.Image="Image",X.AnimationClip="AnimationClip",X.TextComponent="TextComponent",X.BinaryAsset="BinaryAsset",X.TrackAsset="TrackAsset",X.TimelineAsset="TimelineAsset",X.ObjectBindingTrack="ObjectBindingTrack",X.TransformTrack="TransformTrack",X.SpriteColorTrack="SpriteColorTrack",X.ActivationTrack="ActivationTrack",X.SubCompositionTrack="SubCompositionTrack",X.FloatPropertyTrack="FloatPropertyTrack",X.ColorPropertyTrack="ColorPropertyTrack",X.Vector4PropertyTrack="Vector4PropertyTrack",X.TransformPlayableAsset="TransformPlayableAsset",X.SpriteColorPlayableAsset="SpriteColorPlayableAsset",X.ActivationPlayableAsset="ActivationPlayableAsset",X.SubCompositionPlayableAsset="SubCompositionPlayableAsset",X.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",X.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",X.MeshComponent="MeshComponent",X.SkyboxComponent="SkyboxComponent",X.LightComponent="LightComponent",X.CameraComponent="CameraComponent",X.ModelPluginComponent="ModelPluginComponent",X.TreeComponent="TreeComponent",X.AnimationComponent="AnimationComponent",X.SpineComponent="SpineComponent",X.VideoComponent="VideoComponent",X.AudioComponent="AudioComponent",X.RichTextComponent="RichTextComponent",X.OrientationComponent="OrientationComponent",X.ShapeComponent="ShapeComponent",X.TimelineClip="TimelineClip",(j=t4||(t4={}))[j.POINTS=0]="POINTS",j[j.LINES=1]="LINES",j[j.LINE_LOOP=2]="LINE_LOOP",j[j.LINE_STRIP=3]="LINE_STRIP",j[j.TRIANGLES=4]="TRIANGLES",j[j.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",j[j.TRIANGLE_FAN=6]="TRIANGLE_FAN",(H=t5||(t5={}))[H.Float16=0]="Float16",H[H.Float32=1]="Float32",H[H.Int8=2]="Int8",H[H.Int16=3]="Int16",H[H.Int32=4]="Int32",H[H.UInt8=5]="UInt8",H[H.UInt16=6]="UInt16",H[H.UInt32=7]="UInt32",(Y=t6||(t6={}))[Y.None=-1]="None",Y[Y.UInt8=0]="UInt8",Y[Y.UInt16=1]="UInt16",Y[Y.UInt32=2]="UInt32",(W=t8||(t8={})).Position="POSITION",W.Uv="TEXCOORD0",W.Uv2="TEXCOORD1",W.Normal="NORMAL",W.Tangent="TANGENT",W.Color="COLOR",W.Joints="JOINTS",W.Weights="WEIGHTS",W.PositionBS0="POSITION_BS0",W.PositionBS1="POSITION_BS1",W.PositionBS2="POSITION_BS2",W.PositionBS3="POSITION_BS3",W.PositionBS4="POSITION_BS4",W.PositionBS5="POSITION_BS5",W.PositionBS6="POSITION_BS6",W.PositionBS7="POSITION_BS7",W.NormalBS0="NORMAL_BS0",W.NormalBS1="NORMAL_BS1",W.NormalBS2="NORMAL_BS2",W.NormalBS3="NORMAL_BS3",W.TangentBS0="TANGENT_BS0",W.TangentBS1="TANGENT_BS1",W.TangentBS2="TANGENT_BS2",W.TangentBS3="TANGENT_BS3";var it=Object.freeze({__proto__:null,get RenderLevel(){return tT},get BlendingMode(){return tE},get SideMode(){return t_},get MaskMode(){return tA},get ParticleEmitterShapeType(){return tS},get PluginType(){return tC},get InteractType(){return tw},get InteractBehavior(){return tR},get ItemType(){return tO},get RenderMode(){return tM},get ParticleOrigin(){return tI},get RenderType(){return tP},get RenderFace(){return tL},get CameraClipMode(){return tF},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return tV},get BezierKeyframeType(){return tN},get EndBehavior(){return tD},get ParentItemEndBehavior(){return tk},get ParticleInteractionBehavior(){return tz},get ShapeArcMode(){return tU},get LightType(){return tB},get ModelBoundingType(){return tG},get CameraType(){return tX},get MaterialType(){return tj},get MaterialBlending(){return tH},get RenderMode3D(){return tY},get TextOverflow(){return tW},get TextBaseline(){return tZ},get TextAlignment(){return tq},get TextWeight(){return tK},get FontStyle(){return tQ},BuiltinObjectGUID:e7,get ShapePrimitiveType(){return tJ},get ShapeConnectType(){return t$},get ShapePointType(){return t0},get BackgroundType(){return t1},get MultimediaType(){return t2},get DataType(){return t3},get GeometryType(){return t4},get VertexFormatType(){return t5},get IndexFormatType(){return t6},get VertexBufferSemantic(){return t8}});function ie(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ii(t,e,i){return e&&ie(t.prototype,e),i&&ie(t,i),t}var ir=new Map,is=new Map,ia={};function io(t){return function(e,i){ia[t]&&console.warn("Class "+t+" is already registered."),ia[t]=e}}function iu(t){var e=t.constructor;if(is.get(e))return is.get(e);var i={};is.set(e,i);for(var r=t,n=e;n;){var s=ir.get(n);for(var a in s)i[a]=s[a];var o=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(o).constructor)===Object)break;r=o}return i}function ih(t,e){return function(i,r){var n,s=(n=i.constructor,ir.get(n)||ir.set(n,{}),ir.get(n));s&&(s[r]||(s[r]={type:t,sourceName:e}))}}var ic=function(){function t(t){this.engine=t,this.guid=eQ(),this.taggedProperties={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return r(e,t)&&"guid"in e},t}(),il=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}e9(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&eT(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},ii(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(ic);s([ih(void 0,void 0)],il.prototype,"_enabled",void 0);var id=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(il),ip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}e9(e,t);var i=e.prototype;return i.render=function(t){},i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e),this.item.rendererComponents.push(this)},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&eT(this.item.rendererComponents,this),t.prototype.dispose.call(this)},ii(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(il);s([ih(void 0,void 0)],ip.prototype,"materials",void 0),s([ih(void 0,void 0)],ip.prototype,"_priority",void 0);var im=Math.PI/180,iv=180/Math.PI;function iy(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ig=function(t,e,i){return(1-i)*t+i*e};function ix(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}var ib=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):r(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):r(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):r(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):r(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,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.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();ib.ONE=new ib(1,1),ib.ZERO=new ib(0,0);var iT=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}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):r(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):r(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):r(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):r(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,s=e.x,a=e.y,o=e.z;return this.x=r*o-n*a,this.y=n*s-i*o,this.z=i*a-r*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new ib(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iT.X=new iT(1,0,0),iT.Y=new iT(0,1,0),iT.Z=new iT(0,0,1),iT.ONE=new iT(1,1,1),iT.ZERO=new iT(0,0,0);var iE=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):r(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):r(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):r(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):r(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new iT(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iE.ONE=new iE(1,1,1,1),iE.ZERO=new iE(0,0,0,0);var i_=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new sd,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}e9(e,t);var i=e.prototype;return i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(ip);function iA(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}s([ih(void 0,void 0)],i_.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="EffectComponent",i}e9(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.item.time,r=null!=(e=this.material.getVector4("_Time"))?e:new iE;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i))},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(i_),t.EffectComponent=s([io(t3.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return e9(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(id),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=s([io(t3.PostProcessVolume)],t.PostProcessVolume);var iS=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],s=e[1],a=e[5],o=e[9],u=e[2],h=e[6],c=e[10],l=i+a+c;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(h-o)*f,this.y=(n-u)*f,this.z=(s-r)*f}else if(i>a&&i>c){var d=2*Math.sqrt(1+i-a-c);this.w=(h-o)/d,this.x=.25*d,this.y=(r+s)/d,this.z=(n+u)/d,this.negate()}else if(a>c){var p=2*Math.sqrt(1+a-i-c);this.w=(n-u)/p,this.x=(r+s)/p,this.y=.25*p,this.z=(o+h)/p,this.negate()}else{var m=2*Math.sqrt(1+c-i-a);this.w=(s-r)/m,this.x=(n+u)/m,this.y=(o+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(ix(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,a=e.x,o=e.y,u=e.z,h=e.w;return this.x=i*h+s*a+r*u-n*o,this.y=r*h+s*o+n*a-i*u,this.z=n*h+s*u+i*o-r*a,this.w=s*h-i*a-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,s=this.w,a=s*t.w+i*t.x+r*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=s,this.x=i,this.y=r,this.z=n,this;var o=1-a*a;if(o<=Number.EPSILON){var u=1-e;return this.w=u*s+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(o),c=Math.atan2(h,a),l=Math.sin((1-e)*c)/h,f=Math.sin(e*c)/h;return this.w=s*l+this.w*f,this.x=i*l+this.x*f,this.y=r*l+this.y*f,this.z=n*l+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,s=this.w,a=t.x,o=t.y,u=t.z,h=s*a+r*u-n*o,c=s*o+n*a-i*u,l=s*u+i*o-r*a,f=-i*a-r*o-n*u,d=null!=e?e:t;return d.x=h*s+-(f*i)+-(c*n)- -(l*r),d.y=c*s+-(f*r)+-(l*i)- -(h*n),d.z=l*s+-(f*n)+-(h*r)- -(c*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(iT.ZERO,this,iT.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();iS.tempVec0=new iT;var iC=function(){function t(t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=s,v[6]=a,v[7]=o,v[8]=u,v[9]=h,v[10]=c,v[11]=l,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=s,v[9]=a,v[13]=o,v[2]=u,v[6]=h,v[10]=c,v[14]=l,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),s=Math.sin(i),a=1-n,o=r.x,u=r.y,h=r.z,c=a*o,l=a*u;return this.set(c*o+n,c*u+s*h,c*h-s*u,0,c*u-s*h,l*u+n,l*h+s*o,0,c*h+s*u,l*h-s*o,a*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(iT.ZERO,t,iT.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,s=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,i),a.normalize(),n.crossVectors(r,a),n.normalize(),s.crossVectors(a,n);var o=this.elements;return o[0]=n.x,o[1]=s.x,o[2]=a.x,o[3]=0,o[4]=n.y,o[5]=s.y,o[6]=a.y,o[7]=0,o[8]=n.z,o[9]=s.z,o[10]=a.z,o[11]=0,o[12]=-n.dot(e),o[13]=-s.dot(e),o[14]=-a.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],a=i[4],o=i[8],u=i[12],h=i[1],c=i[5],l=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],A=r[12],S=r[1],C=r[5],w=r[9],R=r[13],O=r[2],M=r[6],I=r[10],P=r[14],L=r[3],F=r[7],V=r[11],N=r[15];return n[0]=s*T+a*S+o*O+u*L,n[4]=s*E+a*C+o*M+u*F,n[8]=s*_+a*w+o*I+u*V,n[12]=s*A+a*R+o*P+u*N,n[1]=h*T+c*S+l*O+f*L,n[5]=h*E+c*C+l*M+f*F,n[9]=h*_+c*w+l*I+f*V,n[13]=h*A+c*R+l*P+f*N,n[2]=d*T+p*S+m*O+v*L,n[6]=d*E+p*C+m*M+v*F,n[10]=d*_+p*w+m*I+v*V,n[14]=d*A+p*R+m*P+v*N,n[3]=y*T+g*S+x*O+b*L,n[7]=y*E+g*C+x*M+b*F,n[11]=y*_+g*w+x*I+b*V,n[15]=y*A+g*R+x*P+b*N,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],s=t[1],a=t[5],o=t[9],u=t[13],h=t[2],c=t[6],l=t[10],f=t[14];return t[3]*(+n*o*c-r*u*c-n*a*l+i*u*l+r*a*f-i*o*f)+t[7]*(+e*o*f-e*u*l+n*s*l-r*s*f+r*u*h-n*o*h)+t[11]*(+e*u*c-e*a*f-n*s*c+i*s*f+n*a*h-i*u*h)+t[15]*(-r*a*h-e*o*c+e*a*l+r*s*c-i*s*l+i*o*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],a=t[5],o=t[6],u=t[7],h=t[8],c=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=c*m*u-p*l*u+p*o*f-a*m*f-c*o*v+a*l*v,g=d*l*u-h*m*u-d*o*f+s*m*f+h*o*v-s*l*v,x=h*p*u-d*c*u+d*a*f-s*p*f-h*a*v+s*c*v,b=d*c*o-h*p*o-d*a*l+s*p*l+h*a*m-s*c*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*l*n-c*m*n-p*r*f+i*m*f+c*r*v-i*l*v)*E,t[2]=(a*m*n-p*o*n+p*r*u-i*m*u-a*r*v+i*o*v)*E,t[3]=(c*o*n-a*l*n-c*r*u+i*l*u+a*r*f-i*o*f)*E,t[4]=g*E,t[5]=(h*m*n-d*l*n+d*r*f-e*m*f-h*r*v+e*l*v)*E,t[6]=(d*o*n-s*m*n-d*r*u+e*m*u+s*r*v-e*o*v)*E,t[7]=(s*l*n-h*o*n+h*r*u-e*l*u-s*r*f+e*o*f)*E,t[8]=x*E,t[9]=(d*c*n-h*p*n-d*i*f+e*p*f+h*i*v-e*c*v)*E,t[10]=(s*p*n-d*a*n+d*i*u-e*p*u-s*i*v+e*a*v)*E,t[11]=(h*a*n-s*c*n-h*i*u+e*c*u+s*i*f-e*a*f)*E,t[12]=b*E,t[13]=(h*p*r-d*c*r+d*i*l-e*p*l-h*i*m+e*c*m)*E,t[14]=(d*a*r-s*p*r-d*i*o+e*p*o+s*i*m-e*a*m)*E,t[15]=(s*c*r-h*a*r+h*i*o-e*c*o-s*i*l+e*a*l)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=iT.ZERO);var n=this.elements,s=e.x,a=e.y,o=e.z,u=e.w,h=-r.x,c=-r.y,l=-r.z,f=s+s,d=a+a,p=o+o,m=s*f,v=s*d,y=s*p,g=a*d,x=a*p,b=o*p,T=u*f,E=u*d,_=u*p,A=i.x,S=i.y,C=i.z;return n[0]=(1-(g+b))*A,n[1]=(v+_)*A,n[2]=(y-E)*A,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*C,n[9]=(x-T)*C,n[10]=(1-(m+g))*C,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,s=this.elements,a=n.set(s[0],s[1],s[2]).length(),o=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();0>this.determinant()&&(a=-a),e.x=s[12],e.y=s[13],e.z=s[14];var h=t.tempMat0;h.copyFrom(this);var c=1/a,l=1/o,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=a,r.y=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new iT,e=new iS,i=new iT;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,s){var a=1/(e-t),o=1/(i-r),u=1/(s-n),h=-(e+t)*a,c=-(i+r)*o,l=-(s+n)*u;a*=2,o*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=c,f[14]=l,f[15]=1,this},e.perspective=function(t,e,i,r,n){var s=1/Math.tan(.5*t),a=1/(i-r),o=this.elements;return o[0]=n?s:s/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?s*e:s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*a,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*a,o[15]=0,(null===r||r===1/0)&&(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;a.x=s[0]*i+s[4]*r+s[8]*n+s[12],a.y=s[1]*i+s[5]*r+s[9]*n+s[13],a.z=s[2]*i+s[6]*r+s[10]*n+s[14];var o=s[3]*i+s[7]*r+s[11]*n+s[15];return a.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n+s[12],a.y=s[1]*i+s[5]*r+s[9]*n+s[13],a.z=s[2]*i+s[6]*r+s[10]*n+s[14],a},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n,a.y=s[1]*i+s[5]*r+s[9]*n,a.z=s[2]*i+s[6]*r+s[10]*n,a.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12]*s,o.y=a[1]*i+a[5]*r+a[9]*n+a[13]*s,o.z=a[2]*i+a[6]*r+a[10]*n+a[14]*s,o.w=a[3]*i+a[7]*r+a[11]*n+a[15]*s,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!iy(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,s){return new t().perspective(e,i,r,n,s)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,s,a,o,u,h,c,l,f,d,p,m,v){return new t(e,s,h,d,i,a,c,p,r,o,l,m,n,u,f,v)},t}();function iw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function iR(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 iw(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return iw(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}iC.IDENTITY=new iC(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),iC.ZERO=new iC(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),iC.tempVec0=new iT,iC.tempVec1=new iT,iC.tempVec2=new iT,iC.tempMat0=new iC,t.ShaderCompileResultStatus=void 0,(Z=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Z.noShader=0]="noShader",Z[Z.success=1]="success",Z[Z.fail=2]="fail",Z[Z.compiling=3]="compiling",t.GLSLVersion=void 0,(q=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",q.GLSL3="300 es";var iO=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return e9(e,t),e}(ic);t.Shader=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=iR(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var s=this.engine.getShaderLibrary().createShader(this.shaderData,e);return s.shader=this,s},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(ic),t.Shader=s([io(t3.Shader)],t.Shader);var iM="effects-internal-copy",iI="effects-internal-copy-mesh",iP="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",iL="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function iF(e,i){return{name:iM,vertex:iP,fragment:iL,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:iI+ +i}}function iV(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function iN(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),n=i(function(){return a(this,function(i){return[2,new Promise(function(i,s){if(r){var a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),o=t.getParameter(e.GPU_DISJOINT_EXT);a&&!o&&i(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(a||o)&&(t.deleteQuery(r),r=null),null!==a&&r&&window.setTimeout(function(){n().then(i).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}var iD=[],ik={};function iz(){"function"==typeof WebGL2RenderingContext?iB(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iB(WebGLRenderingContext),iB(WebGLRenderingContext.prototype)):iD.push("iOS16 lockdown mode, WebGL Constants not in global"),iD.length||"HALF_FLOAT"in ik||(ik.HALF_FLOAT=5131)}function iU(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function iB(t){for(var e in t)/^[A-Z_]/.test(e)&&(ik[e]=t[e])}function iG(t){switch(t){case t5.Float32:return WebGLRenderingContext.FLOAT;case t5.Int16:return WebGLRenderingContext.SHORT;case t5.Int8:return WebGLRenderingContext.BYTE;case t5.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case t5.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function iX(t){switch(t){case tE.ALPHA:case tE.ADD:case tE.SUBTRACTION:case tE.STRONG_LIGHT:case tE.WEAK_LIGHT:return 1;case tE.SUPERPOSITION:return 2;case tE.BRIGHTNESS:return 3;case tE.MULTIPLY:return 0;default:return 1}}function ij(t,e){switch(e){case void 0:case tE.ALPHA:t.blendFunction=[ik.ONE,ik.ONE_MINUS_SRC_ALPHA,ik.ONE,ik.ONE_MINUS_SRC_ALPHA];break;case tE.ADD:t.blendFunction=[ik.ONE,ik.ONE,ik.ONE,ik.ONE];break;case tE.SUBTRACTION:t.blendFunction=[ik.ONE,ik.ONE,ik.ZERO,ik.ONE],t.blendEquation=[ik.FUNC_REVERSE_SUBTRACT,ik.FUNC_REVERSE_SUBTRACT];break;case tE.SUPERPOSITION:t.blendFunction=[ik.ONE,ik.ONE,ik.ONE,ik.ONE];break;case tE.MULTIPLY:t.blendFunction=[ik.DST_COLOR,ik.ONE_MINUS_SRC_ALPHA,ik.DST_COLOR,ik.ONE_MINUS_SRC_ALPHA];break;case tE.BRIGHTNESS:t.blendFunction=[ik.ONE,ik.ONE_MINUS_SRC_ALPHA,ik.ONE,ik.ONE_MINUS_SRC_ALPHA];break;case tE.STRONG_LIGHT:t.blendFunction=[ik.DST_COLOR,ik.DST_ALPHA,ik.ZERO,ik.ONE];break;case tE.WEAK_LIGHT:t.blendFunction=[ik.DST_COLOR,ik.ZERO,ik.ZERO,ik.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iH(t,e){e===t_.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=ik.CW,t.cullFace=e===t_.BACK?ik.BACK:ik.FRONT)}function iY(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tA.MASK:t.stencilTest=!0,t.stencilFunc=[ik.ALWAYS,ik.ALWAYS],t.stencilOpZPass=[ik.REPLACE,ik.REPLACE];break;case tA.OBSCURED:t.stencilTest=!0,t.stencilFunc=[ik.EQUAL,ik.EQUAL];break;case tA.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[ik.NOTEQUAL,ik.NOTEQUAL];break;case tA.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iW(){return(iW=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}iD.length||iz(),t.ShaderType=void 0,(K=t.ShaderType||(t.ShaderType={}))[K.vertex=0]="vertex",K[K.fragment=1]="fragment",t.TextureLoadAction=void 0,(Q=t.TextureLoadAction||(t.TextureLoadAction={}))[Q.whatever=0]="whatever",Q[Q.clear=2]="clear",t.TextureSourceType=void 0,(J=t.TextureSourceType||(t.TextureSourceType={}))[J.none=0]="none",J[J.data=1]="data",J[J.image=2]="image",J[J.compressed=3]="compressed",J[J.video=4]="video",J[J.canvas=5]="canvas",J[J.framebuffer=6]="framebuffer",J[J.mipmaps=7]="mipmaps";var iZ=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var s=new XMLHttpRequest,a=function(){n.finish(t,s.status,s.response)};s.responseType=e,s.addEventListener("load",function(){200==s.status||0==s.status?n.finish(t,200,s.response):a()}),s.addEventListener("error",a),s.open("GET",t,!0),s.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[i]:[e,i],s=n.length-1,a=r.length;s<a;s+=2)r[s].apply(null,n)},t}(),iq=!1,iK=!1;function iQ(t,e){return iJ.apply(this,arguments)}function iJ(){return(iJ=i(function(t,e){return a(this,function(i){switch(i.label){case 0:if(!(iq||!e))return[3,2];return[4,i1(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,i1(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iq=!0,[4,i1(t)];case 6:return[2]}})})).apply(this,arguments)}function i$(t,e){return i0.apply(this,arguments)}function i0(){return(i0=i(function(t,e){return a(this,function(i){switch(i.label){case 0:if(!(iK||!e))return[3,2];return[4,i1(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,i1(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iK=!0,[4,i1(t)];case 6:return[2]}})})).apply(this,arguments)}function i1(t){return i2.apply(this,arguments)}function i2(){return(i2=i(function(t){var e,i;return a(this,function(n){if(e="",r(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else r(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function i3(t){return i4.apply(this,arguments)}function i4(){return(i4=i(function(t){return a(this,function(e){return[2,new Promise(function(e,i){new iZ().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function i5(){return(i5=i(function(t){return a(this,function(e){return[2,new Promise(function(e,i){new iZ().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function i6(t){return i8.apply(this,arguments)}function i8(){return(i8=i(function(t){var e;return a(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eM()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play();r?r.then(function(){return t(e)}):e.addEventListener("loadeddata",function i(){t(e),e.removeEventListener("loadeddata",i)},!0),e.addEventListener("error",function(t){i("Load video fail.")})})]})})).apply(this,arguments)}function i9(t,e){return i7.apply(this,arguments)}function i7(){return(i7=i(function(t,e){return a(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function rt(t,e,i){return re.apply(this,arguments)}function re(){return(re=i(function(e,i,r,n){var s,o,u,h,c,l,f;return a(this,function(a){switch(a.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return s=e.mipmaps,o=e.target,[4,Promise.all(s.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:ri(t,i)}))}))];case 1:return u=a.sent(),[2,iW({keepImageSource:!1},e,{mipmaps:u,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return h=e.mipmaps,c=e.target,[4,Promise.all(h.map(function(t){return ri(t,i)}))];case 3:return l=a.sent(),f=n[h[0][1][0]].url,[2,iW({keepImageSource:!1},e,{mipmaps:l,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:h.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function ri(t,e){return rr.apply(this,arguments)}function rr(){return(rr=i(function(t,e){var i,r,n,s,o;return a(this,function(a){if(r=(i=t[1])[0],n=i[1],s=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,i1(new Blob([new Uint8Array(o,n,s)]))]})})).apply(this,arguments)}var rn=1,rs=function(e){function r(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+rn++,i}e9(r,e);var n=r.prototype;return n.getWidth=function(){return this.width||0},n.getHeight=function(){return this.height||0},n.uploadCurrentVideoFrame=function(){},n.offloadData=function(){},n.reloadData=function(){},n.initialize=function(){},n.assembleOptions=function(e){var i=e.target,r=void 0===i?ik.TEXTURE_2D:i,n=e.format,s=void 0===n?ik.RGBA:n;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=0),iW({minFilter:ik.NEAREST,magFilter:ik.NEAREST,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE,target:r,format:ik.RGBA,internalFormat:s,type:ik.UNSIGNED_BYTE},e)},r.fromImage=function(e,n,s){return i(function(){var i,o;return a(this,function(a){switch(a.label){case 0:return[4,i1(e)];case 1:return i=a.sent(),(o=r.create(n,iW({sourceType:t.TextureSourceType.image,image:i,target:ik.TEXTURE_2D,id:eQ(),flipY:!0},s))).initialize(),[2,o]}})})()},r.fromVideo=function(e,n,s){return i(function(){var i,o;return a(this,function(a){switch(a.label){case 0:return[4,i6(e)];case 1:return i=a.sent(),(o=r.create(n,iW({sourceType:t.TextureSourceType.video,video:i,id:eQ(),flipY:!0},s))).initialize(),[2,o]}})})()},ii(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(ic);function ra(t,e,i,r){var n,s,a=e.length/i/r;return s=n=4===a||0===a?ik.RGBA:3===a?ik.RGB:2===a?ik.LUMINANCE_ALPHA:ik.LUMINANCE,rs.createWithData(t,{data:e,width:i,height:r},{type:ik.HALF_FLOAT,format:n,internalFormat:s,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE})}var ro={type:ik.UNSIGNED_BYTE,format:ik.RGBA,internalFormat:ik.RGBA,wrapS:ik.MIRRORED_REPEAT,wrapT:ik.MIRRORED_REPEAT,minFilter:ik.NEAREST,magFilter:ik.NEAREST};function ru(e){return rs.create(e,iW({id:e7.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},ro))}function rh(e){return rs.create(e,iW({id:e7.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},ro))}var rc=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===s.getUint32(0,!0);if(this.glType=s.getUint32(1*n,a),this.glTypeSize=s.getUint32(2*n,a),this.glFormat=s.getUint32(3*n,a),this.glInternalFormat=s.getUint32(4*n,a),this.glBaseInternalFormat=s.getUint32(5*n,a),this.pixelWidth=s.getUint32(6*n,a),this.pixelHeight=s.getUint32(7*n,a),this.pixelDepth=s.getUint32(8*n,a),this.numberOfArrayElements=s.getUint32(9*n,a),this.numberOfFaces=s.getUint32(10*n,a),this.numberOfMipmapLevels=s.getUint32(11*n,a),this.bytesOfKeyValueData=s.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eG.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eG.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eG.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+".");return}0===this.glType?this.loadType=0:this.loadType=2}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,a=0;a<s;a++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,o);e.push({data:h,width:r,height:n}),i+=o+4+(3-(o+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function rl(e){var i=new rc(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,s=i.pixelHeight,a=i.glType,o=i.numberOfFaces,u=i.glInternalFormat,h=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===o?ik.TEXTURE_CUBE_MAP:ik.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,s))+1))}}var rf=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return i(function(){var i,r;return a(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,s=e.url;return r===ik.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:ej(s)&&s.length>0}if(i===t.TextureSourceType.mipmaps){var a=e.bin,o=e.mipmaps,u=e.target,h=e.maps,c=e.urls;return a?o.length>0:u===ik.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):c.every(function(t){return ej(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var n=this;return i(function(){var i,s,o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E;return a(this,function(a){switch(a.label){case 0:if(i=e.type,s=e.target,o=e.map,u=e.url,h=e.bin,c=e.mipmaps,l=e.urls,f=e.maps,!(s===ik.TEXTURE_CUBE_MAP&&i!==t.TextureSourceType.mipmaps))return[3,2];return[4,n.loadCubeMap(o)];case 1:return d=a.sent(),[2,iW({},r,{cube:d,target:ik.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iW({},o),target:ik.TEXTURE_CUBE_MAP}})];case 2:if(i!==t.TextureSourceType.image)return[3,4];return[4,i1(u)];case 3:return p=a.sent(),[2,iW({},r,{image:p,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:u,target:ik.TEXTURE_2D}})];case 4:if(i!==t.TextureSourceType.video)return[3,6];return[4,i6(u)];case 5:return m=a.sent(),[2,iW({},r,{video:m,sourceType:t.TextureSourceType.video})];case 6:if(i!==t.TextureSourceType.compressed)return[3,8];return[4,i3(u)];case 7:return v=a.sent(),[2,iW({},rl(v),r,{sourceFrom:{url:u,type:t.TextureSourceType.compressed}})];case 8:if(i!==t.TextureSourceType.mipmaps)return[3,17];if(!h)return[3,13];return[4,i3(h)];case 9:if(y=a.sent(),x=(g=null!=s?s:ik.TEXTURE_2D)===ik.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),s!==ik.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return n.loadMipmapImages(t,y)}))];case 10:return b=a.sent(),[3,12];case 11:b=n.loadMipmapImages(c,y),a.label=12;case 12:return[2,iW({},r,{mipmaps:b,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:h,mipmaps:x,target:g,type:t.TextureSourceType.mipmaps}})];case 13:if(!(s===ik.TEXTURE_2D||!s))return[3,15];return[4,Promise.all(l.map(function(t){return i1(t)}))];case 14:return T=a.sent(),[2,iW({},r,{mipmaps:T,target:ik.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:ik.TEXTURE_2D}})];case 15:if(s!==ik.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(f.map(function(t){return n.loadCubeMap(t)}))];case 16:return E=a.sent(),[2,iW({},r,{mipmaps:E,target:ik.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map(function(t){return iW({},t)}),target:ik.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+i+".")}})})()},r.loadMipmapImages=function(t,e){return i(function(){return a(this,function(i){return[2,Promise.all(t.map(function(t){return i1(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return i(function(){return a(this,function(e){return[2,Promise.all(t.map(function(t){return i1(t)}))]})})()},e}();function rd(){return t9||(t9=new rf),t9}var rp=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function rm(t){return"object"==typeof t&&t&&void 0===t.length&&r(t,rs)}t.MaterialRenderType=void 0,($=t.MaterialRenderType||(t.MaterialRenderType={}))[$.normal=0]="normal",$[$.transformFeedback=1]="transformFeedback";var rv=1,ry=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,s=void 0===n?"Material"+rv++:n,a=i.renderType,o=i.shader,u=i.uniformSemantics;r.name=s,r.renderType=void 0===a?0:a,r.shaderSource=o,r.props=i,r.uniformSemantics=iW({},u)}else r.name="Material"+rv++,r.renderType=0;return r}e9(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},ii(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(ic),rg={format:ik.RGBA,type:ik.UNSIGNED_BYTE,minFilter:ik.LINEAR,magFilter:ik.LINEAR,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE},rx=Symbol("dispose"),rb=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,s=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:s},o=[s];Object.getOwnPropertyNames(rg).forEach(function(t){var i,r=null!=(i=e[t])?i:rg[t];a[t]=r,o.push(t,r)});var u=o.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var c=this.engine;ez(c),h=rs.create(c,a),this.textureCache[u]=h,this.textureRef[u]=1,h[rx]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[rx](),i.dispose=i[rx]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[rx](),i.dispose=i[rx]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),rT=function(){function t(t){void 0===t&&(t={}),this.semantics=iW({},t)}var e=t.prototype;return e.toObject=function(){return iW({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return eY(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach(function(e){delete t.semantics[e]})},t}(),rE=((t7={})[ik.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t7[ik.INT]=Int32Array.BYTES_PER_ELEMENT,t7[ik.SHORT]=Int16Array.BYTES_PER_ELEMENT,t7[ik.BYTE]=Int8Array.BYTES_PER_ELEMENT,t7),r_=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(ic);function rA(t){return t===ik.INT?new Int32Array(0):t===ik.SHORT?new Int16Array(0):new Float32Array(0)}(tt=et||(et={}))[tt.XYZ=0]="XYZ",tt[tt.XZY=1]="XZY",tt[tt.YXZ=2]="YXZ",tt[tt.YZX=3]="YZX",tt[tt.ZXY=4]="ZXY",tt[tt.ZYX=5]="ZYX";var rS=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],s=i[8],a=i[1],o=i[5],u=i[9],h=i[2],c=i[6],l=i[10];switch(e){case et.XYZ:this.y=Math.asin(ix(s,-1,1)),.9999999>Math.abs(s)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(c,o),this.z=0);break;case et.YXZ:this.x=Math.asin(-ix(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(s,l),this.z=Math.atan2(a,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case et.ZXY:this.x=Math.asin(ix(c,-1,1)),.9999999>Math.abs(c)?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(a,r));break;case et.ZYX:this.y=Math.asin(-ix(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(c,l),this.z=Math.atan2(a,r)):(this.x=0,this.z=Math.atan2(-n,o));break;case et.YZX:this.z=Math.asin(ix(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(s,l));break;case et.XZY:this.z=Math.asin(-ix(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(c,o),this.y=Math.atan2(s,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=iv,this.y*=iv,this.z*=iv,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,s,a;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(a=t[e+3])?a:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new iS;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,s=Math.cos(e*im*.5),a=Math.cos(i*im*.5),o=Math.cos(r*im*.5),u=Math.sin(e*im*.5),h=Math.sin(i*im*.5),c=Math.sin(r*im*.5);switch(n){case et.XYZ:t.set(u*a*o+s*h*c,s*h*o-u*a*c,s*a*c+u*h*o,s*a*o-u*h*c);break;case et.YXZ:t.set(u*a*o+s*h*c,s*h*o-u*a*c,s*a*c-u*h*o,s*a*o+u*h*c);break;case et.ZXY:t.set(u*a*o-s*h*c,s*h*o+u*a*c,s*a*c+u*h*o,s*a*o-u*h*c);break;case et.ZYX:t.set(u*a*o-s*h*c,s*h*o+u*a*c,s*a*c-u*h*o,s*a*o+u*h*c);break;case et.YZX:t.set(u*a*o+s*h*c,s*h*o+u*a*c,s*a*c-u*h*o,s*a*o-u*h*c);break;case et.XZY:t.set(u*a*o-s*h*c,s*h*o-u*a*c,s*a*c+u*h*o,s*a*o+u*h*c);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,s=this.order,a=Math.cos(i*im),o=Math.sin(i*im),u=Math.cos(r*im),h=Math.sin(r*im),c=Math.cos(n*im),l=Math.sin(n*im);if(s===et.XYZ){var f=a*c,d=a*l,p=o*c,m=o*l;e[0]=u*c,e[4]=-u*l,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-o*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=a*u}else if(s===et.YXZ){var v=u*c,y=u*l,g=h*c,x=h*l;e[0]=v+x*o,e[4]=g*o-y,e[8]=a*h,e[1]=a*l,e[5]=a*c,e[9]=-o,e[2]=y*o-g,e[6]=x+v*o,e[10]=a*u}else if(s===et.ZXY){var b=u*c,T=u*l,E=h*c,_=h*l;e[0]=b-_*o,e[4]=-a*l,e[8]=E+T*o,e[1]=T+E*o,e[5]=a*c,e[9]=_-b*o,e[2]=-a*h,e[6]=o,e[10]=a*u}else if(s===et.ZYX){var A=a*c,S=a*l,C=o*c,w=o*l;e[0]=u*c,e[4]=C*h-S,e[8]=A*h+w,e[1]=u*l,e[5]=w*h+A,e[9]=S*h-C,e[2]=-h,e[6]=o*u,e[10]=a*u}else if(s===et.YZX){var R=a*u,O=a*h,M=o*u,I=o*h;e[0]=u*c,e[4]=I-R*l,e[8]=M*l+O,e[1]=l,e[5]=a*c,e[9]=-o*c,e[2]=-h*c,e[6]=O*l+M,e[10]=R-I*l}else if(s===et.XZY){var P=a*u,L=a*h,F=o*u,V=o*h;e[0]=u*c,e[4]=-l,e[8]=h*c,e[1]=P*l+V,e[5]=a*c,e[9]=L*l-F,e[2]=F*l-L,e[6]=o*c,e[10]=V*l+P}else console.error("toMatrix4: Invalid order "+s);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();rS.DEFAULT_ORDER=et.ZYX,rS.tempQuat0=new iS,rS.tempMat0=new iC;var rC=function(){function t(t,e,i,r,n,s,a,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,s,a,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=a,h[1]=e,h[4]=n,h[7]=o,h[2]=i,h[5]=s,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=s,h[2]=a,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,s=e+e,a=i+i,o=r+r,u=e*s,h=e*a,c=e*o,l=i*a,f=i*o,d=r*o,p=n*s,m=n*a,v=n*o,y=this.elements;return y[0]=1-(l+d),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=c+m,y[7]=f-p,y[8]=1-(u+l),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],s=r[3],a=r[6],o=r[1],u=r[4],h=r[7];return r[0]=e*n+i*o,r[3]=e*s+i*u,r[6]=e*a+i*h,r[1]=-i*n+e*o,r[4]=-i*s+e*u,r[7]=-i*a+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],a=i[3],o=i[6],u=i[1],h=i[4],c=i[7],l=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=s*p+a*y+o*b,n[3]=s*m+a*g+o*T,n[6]=s*v+a*x+o*E,n[1]=u*p+h*y+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*p+f*y+d*b,n[5]=l*m+f*g+d*T,n[8]=l*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8];return e*(s*h-u*a)+n*(u*r-i*h)+o*(i*a-s*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8],c=h*s-u*a,l=u*r-h*i,f=a*i-s*r,d=e*c+n*l+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=c*p,t[1]=(o*a-h*n)*p,t[2]=(u*n-o*s)*p,t[3]=l*p,t[4]=(h*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-a*e)*p,t[8]=(s*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[3]*r+s[6]*n,a.y=s[1]*i+s[4]*r+s[7]*n,a.z=s[2]*i+s[5]*r+s[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!iy(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,s,a,o,u,h){return new t(e,n,o,i,s,u,r,a,h)},t}(),rw=function(){function t(t,e){void 0===t&&(t=iT.ZERO),void 0===e&&(e=iT.X),this.origin=new iT,this.direction=new iT,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new iT;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,s,a,o,u=this.origin,h=u.x,c=u.y,l=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,A=1/d,S=1/p,C=1/m;if(A>=0?(i=(y-h)*A,r=(T-h)*A):(i=(T-h)*A,r=(y-h)*A),S>=0?(n=(g-c)*S,s=(E-c)*S):(n=(E-c)*S,s=(g-c)*S),!(i>s)&&!(n>r)&&((n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),(n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),C>=0?(a=(x-l)*C,o=(_-l)*C):(a=(_-l)*C,o=(x-l)*C),!(i>o)&&!(a>r))&&((a>i||i!=i)&&(i=a),(o<r||r!=r)&&(r=o),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new iT).copyFrom(this.origin):void 0;var s=-(this.origin.dot(i)+r)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),s=n.dot(this.direction),a=n.dot(n)-s*s,o=e.radius*e.radius;if(!(a>o)){var u=Math.sqrt(o-a),h=s-u,c=s+u;if(!(c<0))return h>=0?this.at(h,i):this.at(c,i)}},e.intersectTriangle=function(e,i,r){var n,s=e.p0,a=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(a,s),h=t.tempVec1.subtractVectors(o,s),c=t.tempVec2.subtractVectors(this.origin,s),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(c);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();rw.tempVec0=new iT,rw.tempVec1=new iT,rw.tempVec2=new iT,rw.tempVec3=new iT;var rR=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,s=t/60,a=n*(1-Math.abs(s%2-1)),o=0,u=0,h=0;s>=0&&s<=1?(o=n,u=a):s>=1&&s<=2?(o=a,u=n):s>=2&&s<=3?(u=n,h=a):s>=3&&s<=4?(u=a,h=n):s>=4&&s<=5?(o=a,h=n):s>=5&&s<=6&&(o=n,h=a);var c=i-n;return this.set(o+c,u+c,h+c,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):r(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):r(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):r(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):r(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new iE(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,s=Math.max(e,i,r),a=Math.min(e,i,r),o=s-a,u=0,h=0;return 0!==s&&(h=o/s),s!=a&&(s==e?(u=(i-r)/o,i<r&&(u+=6)):s==i?u=(r-e)/o+2:s==r&&(u=(e-i)/o+4),u*=60),new t(u,h,s,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+s:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();rR.BLACK=new rR(0,0,0,1),rR.BLUE=new rR(0,0,1,1),rR.CLEAR=new rR(0,0,0,0),rR.CYAN=new rR(0,1,1,1),rR.GRAY=new rR(.5,.5,.5,1),rR.GREEN=new rR(0,1,0,1),rR.MAGENTA=new rR(1,0,1,1),rR.RED=new rR(1,0,0,1),rR.WHITE=new rR(1,1,1,1),rR.YELLOW=new rR(1,.92,.016,1);var rO=function(){function t(t,e){void 0===t&&(t=new iT(1/0,1/0,1/0)),void 0===e&&(e=new iT(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,s=-1/0,a=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],c=t[o+1],l=t[o+2];h<e&&(e=h),c<i&&(i=c),l<r&&(r=l),h>n&&(n=h),c>s&&(s=c),l>a&&(a=l)}return this.min.set(e,i,r),this.max.set(n,s,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new iT),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new iT),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,s=0,a=n.length;s<a;s++)this.expandByObject(n[s]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new iT),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new iT;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new iT),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new iT),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new iT),this.isEmpty())return[];var i=[];return i[0]=new iT(this.min.x,this.min.y,this.min.z),i[1]=new iT(this.min.x,this.min.y,this.max.z),i[2]=new iT(this.min.x,this.max.y,this.min.z),i[3]=new iT(this.min.x,this.max.y,this.max.z),i[4]=new iT(this.max.x,this.min.y,this.min.z),i[5]=new iT(this.max.x,this.min.y,this.max.z),i[6]=new iT(this.max.x,this.max.y,this.min.z),i[7]=new iT(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new iT;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),rM=function(){function t(t,e){void 0===t&&(t=iT.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var s=new rO().setFromPoints(t);s.getCenter(i),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new iT),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new rO),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new iT().subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=(r-this.radius)*.5;this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new iT,i=new iT;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=new iT().subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),rI=Object.freeze({__proto__:null,get EulerOrder(){return et},Euler:rS,Quaternion:iS,Vector2:ib,Vector3:iT,Vector4:iE,Matrix3:rC,Matrix4:iC,Ray:rw,PI2:2*Math.PI,DEG2RAD:im,RAD2DEG:iv,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:iy,damp:function(t,e,i,r){return ig(t,e,1-Math.exp(-i*r))},lerp:ig,degToRad:function(t){return t*im},radToDeg:function(t){return t*iv},clamp:ix,Color:rR,Box3:rO,Sphere:rM}),rP=1,rL=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,s=i.geometry,a=i.name,o=i.priority,u=i.worldMatrix,h=void 0===u?iC.fromIdentity():u;r.id="Mesh"+rP++,r.name=void 0===a?"<unnamed>":a,r.geometry=s,r.material=n,r.priority=void 0===o?0:o,r.worldMatrix=h}else r.id="Mesh"+rP++,r.name="<unnamed>",r.worldMatrix=iC.fromIdentity(),r._priority=0;return r}e9(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.restore=function(){},r.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var i=null==e?void 0:e.material;i!==t.DestroyOptions.keep&&this.material.dispose(i),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},ii(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ip);t.RenderPassAttachmentStorageType=void 0,(te=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[te.none=0]="none",te[te.color=1]="color",te[te.stencil_8_opaque=2]="stencil_8_opaque",te[te.depth_16_opaque=3]="depth_16_opaque",te[te.depth_stencil_opaque=4]="depth_stencil_opaque",te[te.depth_16_texture=5]="depth_16_texture",te[te.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(ti=t.TextureStoreAction||(t.TextureStoreAction={}))[ti.store=0]="store",ti[ti.clear=2]="clear";var rF=function(){function e(e,i){if(this.destroyed=!1,i){var n=i.texture,s=i.size;if(r(n,rs))this.texture=n,this.externalTexture=!0;else if(n){var a=n.wrapT,o=n.wrapS,u=n.minFilter,h=n.magFilter,c=n.internalFormat,l=n.format,f=void 0===l?ik.RGBA:l,d=n.type,p=void 0===d?ik.UNSIGNED_BYTE:d;this.externalTexture=!1,this.textureOptions={size:s,format:f,type:p,internalFormat:c||f,wrapT:a,wrapS:o,minFilter:u,magFilter:h,name:i.name},this.texture=rs.create(e,iW({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:s[0],height:s[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},ii(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),e}();t.RenderPassDestroyAttachmentType=void 0,(tr=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tr.force=0]="force",tr[tr.keep=1]="keep",tr[tr.keepExternal=2]="keepExternal",tr[tr.destroy=0]="destroy";var rV=1,rN=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+rV++:r,s=i.clearAction,a=i.semantics,o=i.depthStencilAttachment,u=i.storeAction,h=i.priority,c=i.meshOrder,l=void 0===c?t.OrderType.ascending:c,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=l,this.meshes=eN((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==o?void 0:o.storageType)||0,this.clearAction=iW({},s),this.storeAction=iW({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new rT(a),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){eD(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eT(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eN(this.meshes,this.meshOrder),this.meshes},i.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},i.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],s=e[3];t.setViewport(i,r,n,s)}},i.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},i.frameCleanup=function(t){},i.resetColorAttachments=function(e){var i=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new rF(i.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(e.map(function(t){return t})))}else this.resetAttachments({attachments:e.map(function(t){return{texture:t}})})},i.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},i.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},i._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*s,r.getHeight()*s],o=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map(function(t,e){var r;return new rF(i.renderer.engine,iW({size:o,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var c=ne.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);c.bind(),c.unbind(),this.framebuffer=c}else this.attachments.length=0},i.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},i.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},i.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},i.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},i.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},i.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},i.dispose=function(e){if(!this.destroyed){var i,r,n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(n)}),this.meshes.length=0;var s=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===s||1===s||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,o=this.framebuffer;o&&(o.dispose({depthStencilAttachment:a}),o.externalStorage&&2===a||1===a||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eK}},ii(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),e}(),rD="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",rk="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",rz="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",rU="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",rB="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",rG="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",rX="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",rj="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",rH="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",rY="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",rW="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",rZ="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",rq={},rK=function(){function e(){}return e.registerInclude=function(t,e){rq[t]&&eG.warn('The "'+t+'" shader include already exist.'),rq[t]=e},e.unRegisterInclude=function(t){delete rq[t]},e.unRegisterAllIncludes=function(){Object.keys(rq).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,s=i.shader,a=i.macros,o=i.removeVersion,u=e.genMacroString(r,a),h=e.genShaderVersion(r),c=e.parseIncludes(s),l=e.isVersion300(c);return(c=e.removeWebGLVersion(c),2!==r||l||(c=e.convertTo300(c,n===t.ShaderType.fragment)),o)?u+c:h+u+c},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=rq[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&i.add(s[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),rQ=function(e){function i(i,r){var n,s=(n=e.call(this,i,r)||this).renderer.engine,a=r_.create(s,{mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=ry.create(s,{shader:{vertex:rX,fragment:rZ,glslVersion:t.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,n.screenMesh=rL.create(s,{geometry:a,material:o,priority:0}),n.priority=5e3,n}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var i,r,n,s=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.screenMesh.material.setFloat("_Threshold",s),e.renderMeshes([this.screenMesh])},i}(rN),rJ=function(e){function i(i,r,n){(s=e.call(this,i,n)||this).type=r;var s,a=s.renderer.engine,o="PostProcess",u=r_.create(a,{name:o,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:rX,fragment:"H"==r?rH:rY,glslVersion:t.GLSLVersion.GLSL1},c=ry.create(a,{name:o,shader:h});return c.blending=!1,c.depthTest=!1,c.culling=!1,s.screenMesh=rL.create(a,{name:o,geometry:u,material:c,priority:0}),s.priority=5e3,s}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",r4(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(rN),r$=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",s=r.renderer.engine,a=r_.create(s,{name:n,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=ry.create(s,{name:n,shader:{vertex:rX,fragment:rW}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=rL.create(s,{name:n,geometry:a,material:o,priority:0}),r.priority=5e3,r}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",r4(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(rN),r0=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,s="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=r||new rF(a);var o=r_.create(a,{name:s,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ry.create(a,{name:s,shader:{vertex:rX,fragment:rj,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=rL.create(a,{name:s,geometry:o,material:u,priority:0}),n.priority=5e3,n}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=iW({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=iW({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),s=iW({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),a=iW({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,s.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*s.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*s.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new ib(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iT(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),e.renderMeshes([this.screenMesh])},i}(rN),r1="_effects_default_",r2=1,r3=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,s=e.keepColorBuffer,a=e.renderer,o=e.editorTransform,u=e.globalVolume,h=e.postProcessingEnabled,c=void 0!==h&&h,l=e.clearAction,f=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,d=a.engine;u&&(this.globalVolume=u),this.globalUniforms=new r6;var p=[],m={};if(this.renderer=a,c){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=ik.HALF_FLOAT;p=[{texture:{format:ik.RGBA,type:v,magFilter:ik.LINEAR,minFilter:ik.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new rN(a,{name:r1,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),c){var g=new rF(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=ik.HALF_FLOAT,E=new rQ(a,{name:"BloomThresholdPass",attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new rF(d);var A=new rJ(a,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]}),S=new rJ(a,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]});S.gaussianResult=b[_],this.addRenderPass(A),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var C=0;C<6;C++){var w=new r$(a,{name:"GaussianUpPass"+C,viewport:x,attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]});w.gaussianDownSampleResult=b[5-C],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new r0(a,g);this.addRenderPass(R)}this.semantics=new rT(e.semantics),this.clearAction=f,this.name="RenderFrame"+r2++;var O=y[0];this.emptyTexture=ru(d),this.transparentTexture=rh(d),this.camera=n,this.keepColorBuffer=s,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=iE.fromArray(void 0===o?[1,1,0,0]:o),e.clearAction||this.resetClearActions(),this.passTextureCache=new rb(d);var M=d.gpuCapability,I=M.detail,P=iF(M.level,I.readableDepthStencilTextures&&I.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(P)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var i,r,n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach(function(t){t.dispose(n)}),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(i=r.texture)||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},i.resetRenderPassDefaultAttachment=function(t,e){for(var i=this.resource,r=i.color_a,n=i.color_b,s=e;s<t.length;s++){var a,o,u,h=t[s],c=null==(o=h.attachments[0])?void 0:o.texture;if(c&&a===c){var l=c===r?n:r;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(a=c)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(r1)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},i.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var i,r=t[0],n=r.texture,s=r.persistent,a=n.format,o=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(a===ik.RGBA&&!s){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},i.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},i.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},i.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},i.createResource=function(){var e=this.renderer.engine;if(!this.resource){var i,r=e.gpuCapability,n=r.detail,s=r.level,a=this.renderer.getWidth(),o=this.renderer.getHeight(),u=2===s?ik.LINEAR:ik.NEAREST,h=rs.create(e,{sourceType:t.TextureSourceType.framebuffer,format:ik.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=rs.create(e,{sourceType:t.TextureSourceType.framebuffer,format:ik.RGBA,data:{width:a,height:o},minFilter:u,magFilter:u,name:"frame_b"}),l=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new rN(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:h}]}).initialize(this.renderer),d=new r5(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(i=f.getDepthAttachment())?void 0:i.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:c,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=r_.create(i,{name:iM,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=iF(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var s=ry.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:iM,shader:n});return s.blending=!1,s.depthTest=!1,s.culling=!1,(null==t?void 0:t.blend)&&(s.blending=!0,s.blendFunction=[ik.SRC_ALPHA,ik.ONE_MINUS_SRC_ALPHA,ik.SRC_ALPHA,ik.ONE_MINUS_SRC_ALPHA]),rL.create(i,{name:iM,geometry:r,material:s,priority:0})},i.removeRenderPass=function(t){eT(this._renderPasses,t)},ii(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function r4(t){return t?new ib(t.getWidth(),t.getHeight()):new ib}var r5=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",r4(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(rN),r6=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},r8=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return ii(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),r9="function"==typeof WebGL2RenderingContext,r7=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=r9&&r(t,WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),n&&!o&&(o=nt(t,t.HALF_FLOAT)),n&&!u&&(u=nt(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=n||t.getExtension("OES_texture_float")?t.FLOAT:0,c=n?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,l={floatTexture:h,halfFloatTexture:c,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0,halfFloatLinear:o,floatLinear:u,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!a,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=l,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&i>0)throw Error("Draw multiple color buffers not available.");var a=s?s["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];a?t.framebufferTexture2D(e,a,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function nt(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.COMPRESSED_TEXTURE=void 0,(tn=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tn.NONE=0]="NONE",tn[tn.PVRTC=1]="PVRTC",tn[tn.ASTC=2]="ASTC",t.FilterMode=void 0,(ts=t.FilterMode||(t.FilterMode={}))[ts.Nearest=0]="Nearest",ts[ts.Linear=1]="Linear",t.RenderTextureFormat=void 0,(ta=t.RenderTextureFormat||(t.RenderTextureFormat={}))[ta.RGBA32=0]="RGBA32",ta[ta.RGBAHalf=1]="RGBAHalf";var ne=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},ii(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),ni=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,s){return null},e.dispose=function(t){},t}(),nr=(tu=new Int32Array((to=new Float32Array(1)).buffer),function(t){to[0]=t;var e=tu[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),nn=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=nr(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=nr(t[i])},t}(),ns=new rS,na=new iC;function no(t,e,i,r,n,s,a){var o=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(s),t.addScaledVector(a,u),t.addScaledVector(i,c);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iT;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(o):e.getIntegrateValue(0,r,n):0});ns.setFromArray(v).negate(),na.setFromEuler(ns);var y=na.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,b=l.y,T=l.z;if(x){var E=g?x.getValue(o):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(o):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var A=g?T.getValue(o):T.getIntegrateValue(0,r,n);t.z=t.z+A}}return t}function nu(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function nh(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function nc(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(i&&t!==i)for(var a=0;a<i.length;a++)t[a]=i[a];return t}var nl=((ee={})[tI.PARTICLE_ORIGIN_CENTER]=[0,0],ee[tI.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ee[tI.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ee[tI.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ee[tI.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ee[tI.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ee[tI.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ee[tI.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ee[tI.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ee);function nf(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function nd(t,e,i){var r=i.position,n=new iT(t,e,0),s=new iT;return i.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(r),new rw(r,s)}function np(t,e,i){var r=t.x,n=t.y,s=t.z,a=new iT(r-e,n+i,s),o=new iT(r-e,n-i,s),u=new iT(r+e,n-i,s),h=new iT(r+e,n+i,s);return[{p0:a,p1:o,p2:u},{p0:a.clone(),p1:u.clone(),p2:h}]}function nm(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function nv(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var ny={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new ib(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tN.LINE?0:e===tN.EASE_OUT?0:e===tN.EASE_IN?2:e===tN.EASE?2:e===tN.HOLD&&i===tN.EASE_IN?2:0;return{xIndex:r,yIndex:r+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tN.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tN.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tN.EASE,tN.EASE_IN,tN.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tN.EASE,tN.EASE_OUT,tN.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tN.HOLD&&[tN.HOLD,tN.LINE_OUT,tN.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tN.HOLD&&[tN.HOLD,tN.LINE,tN.EASE_IN].includes(i)}},ng=function(t,e){this.points=t,this.totalLength=e},nx={},nb={};function nT(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function nE(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var n_=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=nv(e.x-t.x,3)+"_"+nv(e.y-t.y,3)+"_"+nv(e.z-t.z,3)+"&"+(nv(i.x-t.x,3)+"_"+nv(i.y-t.y,3))+"_"+nv(i.z-t.z,3)+"&"+(nv(r.x-t.x,3)+"_"+nv(r.y-t.y,3))+"_"+nv(r.z-t.z,3);if(nb[n])return{data:nb[n],interval:t};for(var s=[],a=null,o=0,u=0,h=0;h<300;h+=1){var c=new iT,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(i.x-t.x)+3*(1-l)*Math.pow(l,2)*(r.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(i.y-t.y)+3*(1-l)*Math.pow(l,2)*(r.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(i.z-t.z)+3*(1-l)*Math.pow(l,2)*(r.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==a&&(u+=Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2)+Math.pow(c.z-a.z,2)),a=c,o+=u=Math.sqrt(u),s[h]={partialLength:u,point:c}}var f=new ng(s,o);return nb[n]=f,{data:f,interval:new iT(t.x,t.y,t.z)}}(t,e,i,r),s=n.data,a=n.interval;this.lengthData=s,this.interval=a,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(nm(1-t,0))return e.points[299].point.clone().add(this.interval);if(nm(e.totalLength,0))return this.p1.clone();var i=new iT,r=nv(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(nm(n,r))return e.points[s].point.clone().add(this.interval);var a=!0,o=1;for(r<n&&(o=-1);a;){if(r>=n){if(299===s){i.x=e.points[s].point.x,i.y=e.points[s].point.y,i.z=e.points[s].point.z;break}if(r<n+e.points[s+1].partialLength){var u=(r-n)/e.points[s+1].partialLength;i.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,i.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,i.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}o>0&&s<299?(s+=o,n+=nv(e.points[s].partialLength,5)):o<0&&s>0?(n-=nv(e.points[s].partialLength,5),s+=o):a=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),nA=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iS,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):nm(1-t,0)?this.temp.copyFrom(this.p2):(nw.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),nS=function(){function t(t,e,i,r){this.mX1=t,this.mY1=e,this.mX2=i,this.mY2=r,this.precomputed=!1,this.mSampleValues=Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,(this.mX1!==this.mY1||this.mX2!==this.mY2)&&this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),nT(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=nT(.1*t,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,s=nE(n,this.mX1,this.mX2);return s>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var s=nE(e,i,r);if(0===s)break;var a=nT(e,i,r)-t;e-=a/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,i,r,n){var s,a,o=0;do(s=nT(a=e+(i-e)/2,r,n)-t)>0?i=a:e=a;while(Math.abs(s)>1e-7&&++o<10);return a}(t,i,i+.1,this.mX1,this.mX2)},t}();function nC(t,e){var i,r,n,s=function(t,e,i){var r=t[1],n=ny.isHoldOutKeyframe(t),s=ny.isHoldInKeyframe(e),a=!s&&ny.isRightSideEase(t),o=!n&&ny.isLeftSideEase(e);if(a&&!o&&!s){var u=new ib(r[r.length-4],r[r.length-3]),h=new ib(r[r.length-2],r[r.length-1]),c=ny.getPointInCurve(e),l=new ib(c.x,c.y),f=new ib(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:h,p2:f,p3:l}}if(!a&&o&&!n){var d=e[1],p=ny.getPointInCurve(t),m=new ib(p.x,p.y),v=new ib(d[0],d[1]),y=new ib(d[2],d[3]),g=new ib(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(a&&o){var x=e[1];return{type:"ease",p0:new ib(r[r.length-4],r[r.length-3]),p1:new ib(r[r.length-2],r[r.length-1]),p2:new ib(x[0],x[1]),p3:new ib(x[2],x[3])}}var b=ny.getPointInCurve(t),T=ny.getPointInCurve(e);if(n?T.y=b.y:s&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||s,leftHoldLine:n,rightHoldLine:s};var E=new ib((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new ib((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"ease",p0:b,p1:E,p2:_,p3:T,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),a=s.p0,o=s.p1,u=s.p2,h=s.p3;ez(u),ez(h);var c=h.x-a.x,l=h.y-a.y,f=nv((o.x-a.x)/c,5),d=nv((u.x-a.x)/c,5);nm(l,0)?i=r=NaN:(i=nv((o.y-a.y)/l,5),r=nv((u.y-a.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,o,u,h),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",a,o,u,h),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,o,u,h),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",a,o,u,h),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return nx[p]?n=nx[p]:(n=new nS(f,i,d,r),nx[p]=n),{points:[a,o,u,h],timeInterval:c,valueInterval:l,curve:n}}var nw=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,s=e.y,a=e.z,o=e.w,u=i.x,h=i.y,c=i.z,l=i.w;if(0===r){t.x=n,t.y=s,t.z=a,t.w=o;return}if(1===r){t.x=u,t.y=h,t.z=c,t.w=l;return}if(o!==l||n!==u||s!==h||a!==c){var f=1-r,d=n*u+s*h+a*c+o*l,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,s=s*f+h*g,a=a*f+c*g,o=o*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+s*s+a*a+o*o);n*=x,s*=x,a*=x,o*=x}}t.x=n,t.y=s,t.z=a,t.w=o},t}(),nR="not_implement",nO=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(nR)},e.getIntegrateValue=function(t,e,i){throw Error(nR)},e.getIntegrateByTime=function(t,e){throw Error(nR)},e.getValue=function(t){throw Error(nR)},e.getMaxTime=function(){throw Error(nR)},e.toUniform=function(t){throw Error(nR)},e.map=function(t){throw Error(nR)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(nR)},t.getAllData=function(t,e){for(var i=new(e?nn:Float32Array)(4*t.index),r=0,n=0,s=t.curves;r<s.length;r++){var a=s[r].toData();i.set(a,n),n+=a.length}return e?i.data:i},t}(),nM=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(nO),nI=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(nO),nP=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(nO),nL=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var s=Math.random();r[n]=e[n]*(1-s)+i[n]*s}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(nO),nF=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,s=this.xCoord*i;return((r+e/s*(n-r)+r)*e-(r+t/s*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return nG(e,0,this.xCoord,this.min,this.max)-nG(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(nO),nV=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eS(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1];if(n.stop<=t&&s.stop>t){var a=(t-n.stop)/(s.stop-n.stop);return eC(n.color,s.color,a,!0)}}return e[i].color.slice()},e}(nO),nN=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1],a=n[0],o=s[0];if(t>=a&&t<=o){var u=(t-a)/(o-a),h=n[1];return h+u*(s[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,s=e?nG:nB,a=0;a<n;a++){var o=i[a],u=i[a+1],h=o[0],c=u[0];if(t>h&&t<=c)return r+s(t,h,c,o[1],u[1]);r+=s(c,h,c,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(nO),nD=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.curveMap={},this.keys=[];for(var e=0;e<t.length-1;e++){var i=nC(t[e],t[e+1]),r=i.points,n=i.curve,s=i.timeInterval,a=i.valueInterval,o=r[0],u=r[r.length-1];this.keys.push([].concat(o.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[o.x+"&"+u.x]={points:r,timeInterval:s,valueInterval:a,curve:n,timeStart:Number(o.x),timeEnd:Number(u.x)}}this.keyTimeData=Object.keys(this.curveMap)},i.getValue=function(t){var e=0,i=this.keyTimeData,r=this.curveMap[i[0]].timeStart,n=this.curveMap[i[i.length-1]].timeEnd;if(t<=r)return this.getCurveValue(i[0],r);if(t>=n)return this.getCurveValue(i[i.length-1],n);for(var s=0;s<i.length;s++){var a=this.curveMap[i[s]].timeStart,o=this.curveMap[i[s]].timeEnd;if(t>=Number(a)&&t<Number(o)){e=this.getCurveValue(i[s],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,s=Object.keys(this.curveMap);if(r<=this.curveMap[s[0]].timeStart)return 0;for(var a=0;a<s.length;a++){var o=this.curveMap[s[a]].timeStart,u=this.curveMap[s[a]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(s[a],Number(u))),r>=Number(o)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(s[a],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,a=0,o=(e-r.x)/20,u=0;u<=20;u++){var h=u*o/n,c=r.y+s*i.curve.getValue(h);0===u||20===u?a+=c:u%2==1?a+=4*c:a+=2*c}return o/3*a},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,a=(e-r.x)/n,o=i.curve.getValue(a);return r.y+s*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){var t=Object.keys(this.curveMap);return Number(t[t.length-1].split("&")[1])},e}(nO),nk=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],s=e[r+1];if(n[0]<=t&&s[0]>=t){var a=s[1]-n[1],o=void 0;return o=0===a?(t-n[0])/(s[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,s=i[2]*r,a=(t-e[0])/r,o=a*a,u=o*a;return(2*u-3*o+1)*e[1]+(u-2*o+a)*n+(u-o)*s+(-2*u+3*o)*i[1]}(t,n,s)-n[1])/a,this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],s=0;s<i.length;s++)n[s]=i[s]*(1-e)+r[s]*e;return n},e}(nO),nz=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=new iT(i[n][0],i[n][1],i[n][2]),u=new iT(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iT(r[2*n][0],r[2*n][1],r[2*n][2]),c=new iT(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=nC(s,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new n_(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=nv(t,5),i=0,r=new iT,n=Object.keys(this.curveSegments);if(!n.length)return r;var s=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=s)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<n.length;o++){var u=n[o].split("&"),h=u[0],c=u[1];if(e>=Number(h)&&e<Number(c)){var l=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=nv((e-r.x)/n,4);return ix(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(nO),nU=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=iS.fromArray(i[n]),u=iS.fromArray(i[n+1]),h=iS.fromArray(r[2*n]),c=iS.fromArray(r[2*n+1]),l=nC(s,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new nA(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=nv(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),s=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=s)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<r.length;a++){var o=r[a].split("&"),u=o[0],h=o[1];if(i>=Number(u)&&i<Number(h)){var c=this.curveSegments[r[a]].pathCurve;return e=this.getPercValue(r[a],i),c.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=nv((e-r.x)/n,4);return ix(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(nO);function nB(t,e,i,r,n){var s=t-e;return(r+r+(n-r)*s/(i-e))*s/2}function nG(t,e,i,r,n){var s=t*t,a=e*e;return(s*t*2*(r-n)+3*s*(e*n-i*r)-a*e*(2*r+n)+3*a*i*r)/(6*(e-i))}function nX(t,e){if(e){var i=e[0],r=e[1];if(i===tV.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===tV.LINE){var s=r.length;if(2===s&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&s++,r[r.length-1][0]<1&&s++;var a=Math.ceil(s/2);t.lineSegCount+=a,t.curves.push(r),t.index+=a,t.max=Math.max(t.max,a)}else if(i===tV.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function nj(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function nH(t,e,i){return(nH=!function(){if("undefined"==typeof Reflect||!Reflect.construct||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(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&e8(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var nY=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iE,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=nK(t[0]),this.yCurve=nK(t[1]),this.zCurve=nK(t[2]),this.wCurve=nK(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},e}(nO),nW="editor",nZ={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"},nq=((ei={})[tV.RANDOM]=function(t){return r(t[0],Array)?new nL(t):new nP(t)},ei[tV.CONSTANT]=function(t){return new nM(t)},ei[tV.CONSTANT_VEC2]=function(t){return new nM(t)},ei[tV.CONSTANT_VEC3]=function(t){return new nM(t)},ei[tV.CONSTANT_VEC4]=function(t){return new nM(t)},ei[tV.RGBA_COLOR]=function(t){return new nM(t)},ei[tV.COLORS]=function(t){return new nI(t.map(function(t){return e_(t,!1)}))},ei[tV.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new nF([t[0][1],t[1][1]]):new nN(t)},ei[tV.GRADIENT_COLOR]=function(t){return new nV(t)},ei[tV.LINEAR_PATH]=function(t){return new nk(t)},ei[tV.BEZIER_CURVE]=function(t){return 1===t.length?new nM(t[0][1][1]):new nD(t)},ei[tV.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new nM(nH(iT,[].concat(t[1][0]))):new nz(t)},ei[tV.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new nM(nH(iS,[].concat(t[1][0]))):new nU(t)},ei[tV.COLOR_CURVE]=function(t){return new nQ(t)},ei[tV.VECTOR4_CURVE]=function(t){return new nY(t)},ei);function nK(t){if(!t||!isNaN(+t))return new nM(t||0);if(r(t,nO))return t;if(eY(nq[t[0]]))return nq[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nZ["ValueType: 21/22 is not supported"]+".")}var nQ=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rR,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=nK(t[0]),this.gCurve=nK(t[1]),this.bCurve=nK(t[2]),this.aCurve=nK(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},e}(nO),nJ=function(e){function i(t){(i=e.call(this,t)||this).cachePrefix="-",i.color=[1,1,1,1],i.visible=!0,i.isManualTimeSet=!1,i.frameAnimationTime=0,i.getHitTestParams=function(t){var e=i.interaction;if(t||e){var r,n=i.getBoundingBox();if(n)return{behavior:(null==(r=i.interaction)?void 0:r.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===t_.FRONT}}},i.renderer={renderMode:tM.MESH,blending:tE.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:t_.DOUBLE,mask:0,maskMode:tA.NONE,order:0},i.emptyTexture=i.engine.emptyTexture,i.renderInfo=n$(iA(i));var i,r=i.createMaterial(i.renderInfo,2);return i.worldMatrix=iC.fromIdentity(),i.material=r,i.material.setVector4("_Color",new iE().setFromArray([1,1,1,1])),i.material.setVector4("_TexOffset",new iE().setFromArray([0,0,1,1])),i}e9(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setVector4("_Color",new iE().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("_MainTex",t)},r.setAnimationTime=function(t){this.frameAnimationTime=t,this.isManualTimeSet=!0},r.render=function(t){if(this.getVisible()){var e=this.material,i=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),(this.renderer.renderMode===tM.BILLBOARD||this.renderer.renderMode===tM.VERTICAL_BILLBOARD||this.renderer.renderMode===tM.HORIZONTAL_BILLBOARD)&&this.material.setVector3("_Scale",this.transform.scale),t.drawGeometry(i,e)}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(){this.geoData=this.getItemGeometryData();var t=this.geoData,e=t.index,i=t.atlasOffset,r=e.length,n=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new e.constructor(r);if(!this.wireframe)for(var s=0;s<r;s++)n[s]=0+e[s];return{atlasOffset:i,index:n}},r.setItem=function(){var t=this.renderer.texture;t&&eb([],t),t=this.renderer.texture;var e=this.getItemInitData(),i=this.renderer,r=this.material.getVector4("_TexParams");r&&(r.x=i.occlusion?+i.transparentOcclusion:1,r.y=+this.preMultiAlpha,r.z=i.renderMode);var n={atlasOffset:new Float32Array(e.atlasOffset.length),index:new Uint16Array(e.index.length)};n.atlasOffset.set(e.atlasOffset),n.index.set(e.index);var s=this.material,a=this.geometry,o=n.index;a.setIndexData(o),a.setAttributeData("atlasOffset",n.atlasOffset),a.setDrawCount(e.index.length),s.setTexture("_MainTex",t)},r.getItemGeometryData=function(){var t=this.renderer;if(!t.shape)return this.geometry.setAttributeData("aPos",new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])),{index:[0,1,2,2,1,3],atlasOffset:[0,1,0,0,1,1,1,0]};for(var e=t.shape,i=e.index,r=e.aPoint,n=void 0===r?[]:r,s=new Float32Array(n),a=[],o=[],u=0;u<s.length;u+=6)o.push(n[u+2],n[u+3]),a.push(s[u],s[u+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(a)),{index:void 0===i?[]:i,atlasOffset:o}},r.createGeometry=function(t){return r_.create(this.engine,{attributes:{aPos:{type:ik.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:ik.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:4})},r.createMaterial=function(t,e){var i=t.side,r=t.occlusion,n=t.blending,s=t.maskMode,a=t.mask,o={shader:sy(t,e,1)};this.preMultiAlpha=iX(n);var u=ry.create(this.engine,o),h={side:i,blending:!0,blendMode:n,mask:a,maskMode:s,depthTest:!0,depthMask:r};return u.blending=h.blending,u.stencilRef=void 0!==h.mask?[h.mask,h.mask]:void 0,u.depthTest=h.depthTest,u.depthMask=h.depthMask,ij(u,h.blendMode),iY(u,h.maskMode),iH(u,h.side),u.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',u.hasUniform("_Color")||u.setVector4("_Color",new iE(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new iE),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new iE),u},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),i=np(iT.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}}},i}(ip);function n$(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,s=e.mask,a=e.maskMode,o=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:s,maskMode:a,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+o+"+"+a+"."+s}}var n0=function(){},n1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n2={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function s(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function c(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function l(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=K(t),t.a.c=t.c,m(t,K(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=K(e),e.a.c=e.c,m(e,K(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,K(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var E,_=4*1e150;function A(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,s){return(t=t.a,e=e.a,s=s.a,e.b.a===t)?s.b.a===t?i(e.a,s.a)?0>=n(s.b.a,e.a,s.a):0<=n(e.b.a,s.a,e.a):0>=n(s.b.a,t,s.a):s.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(s.b.a,t,s.a))}function C(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function w(t,e){l(t.a),t.c=!1,t.a=e,e.i=t}function R(t){var e=t.a.a;do t=tc(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tc(t)),t}function O(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function M(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function I(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,C(t)}function P(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){I(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(c(K(n),n),c(e,n)),I(t),e=r.a,t=r}return e}function L(t,e,i,r,n,s){var a=!0;do O(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(c(K(i),i),c(K(n),i)),r.f=e.f-i.f,r.d=M(t,r.f),e.b=!0,!a&&D(t,e)&&(A(i,n),C(e),l(n)),a=!1,e=r,n=i;e.b=!0,s&&z(t,e)}function F(t,e,i,r,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,i,r,t.c)||null,null===e.d&&(n?t.n||(W(t,100156),t.n=!0):e.d=i[0])}function V(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,F(t,e.a,r,[.5,.5,0,0],!1),c(e,i)}function N(t,e,i,r,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),a=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),o=n+1;r[n]=.5*a/(s+a),r[o]=.5*s/(s+a),t.g[0]+=r[n]*e.g[0]+r[o]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[o]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[o]*i.g[2]}function D(t,r){var s=th(r),a=r.a,o=s.a;if(i(a.a,o.a)){if(0<n(o.b.a,a.a,o.a))return!1;if(e(a.a,o.a)){if(a.a!==o.a){var s=t.e,u=a.a.h;if(0<=u){var s=s.b,h=s.d,l=s.e,d=s.c,p=d[u];h[p]=h[s.a],d[h[p]]=p,p<=--s.a&&(1>=p?ta(s,p):i(l[h[p>>1]],l[h[p]])?ta(s,p):to(s,p)),l[u]=null,d[u]=s.b,s.b=u}else for(s.c[-(u+1)]=null;0<s.a&&null===s.c[s.d[s.a-1]];)--s.a;V(t,K(o),a)}}else f(o.b),c(a,K(o)),r.b=s.b=!0}else{if(0>n(a.b.a,o.a,a.a))return!1;tc(r).b=r.b=!0,f(a.b),c(K(o),a)}return!0}function k(t,h){var l=th(h),d=h.a,p=l.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,E=y,_=m,A=g,S=v;if(i(E,_)||(b=E,E=_,_=b),i(A,S)||(b=A,A=S,S=b),i(E,A)||(b=E,E=A,A=b,b=_,_=S,S=b),i(A,_)?i(_,S)?(0>(b=r(E,A,_))+(T=r(A,_,S))&&(b=-b,T=-T),x.b=u(b,A.b,T,_.b)):(0>(b=n(E,A,_))+(T=-n(E,S,_))&&(b=-b,T=-T),x.b=u(b,A.b,T,S.b)):x.b=(A.b+_.b)/2,s(E,_)||(b=E,E=_,_=b),s(A,S)||(b=A,A=S,S=b),s(E,A)||(b=E,E=A,A=b,b=_,_=S,S=b),s(A,_)?s(_,S)?(0>(b=a(E,A,_))+(T=a(A,_,S))&&(b=-b,T=-T),x.a=u(b,A.a,T,_.a)):(0>(b=o(E,A,_))+(T=-o(E,S,_))&&(b=-b,T=-T),x.a=u(b,A.a,T,S.a)):x.a=(A.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(m,v)?m:v,i(E,x)&&(x.b=E.b,x.a=E.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),c(p.b,d),d=th(h=R(h)).a,P(t,th(h),l),L(t,h,K(d),d,d,!0),!0;if(y===t.a){f(p.b),c(d.e,K(p)),v=(m=l=h).a.b.a;do m=tc(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,l.a=K(p),p=P(t,l,null),L(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tc(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=l.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),c(K(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,N(d,m,y,p,0),N(d,v,g,p,2),F(t,d,x,p,!0),tc(h).b=h.b=l.b=!0,!1}function z(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tc(e))||!e.b))break;e.b=!1;var s,a=e.a,o=r.a;if(s=a.b.a!==o.b.a)t:{var u=th(s=e),h=s.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){s=!1;break t}tc(s).b=s.b=!0,p=f(h),c(d.b,p),p.d.c=s.d}else{if(0<n(d.b.a,h.b.a,d.a)){s=!1;break t}s.b=u.b=!0,p=f(d),c(h.e,d.b),p.b.d.c=s.d}s=!0}if(s&&(r.c?(C(r),l(o),o=(r=th(e)).a):e.c&&(C(e),l(a),a=(e=tc(r)).a)),a.a!==o.a){if(a.b.a===o.b.a||e.c||r.c||a.b.a!==t.a&&o.b.a!==t.a)D(t,e);else if(k(t,e))break}a.a===o.a&&a.b.a===o.b.a&&(A(o,a),C(e),l(a),e=tc(r))}}function U(t,e){var i=new tu,r=h(t.b);r.a.b=_,r.a.a=e,r.b.a.b=-_,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function B(t){this.a=new X,this.b=t,this.c=S}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new X(i,e.a,e),e.a.c=t,e.a=t}function X(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function j(){this.d=H,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var H=0;function Y(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case H:W(t,100151),t.u(null);break;case 1:W(t,100152),t.t()}else switch(t.d){case 2:W(t,100154),t.v();break;case 1:W(t,100153),t.w()}}function W(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function K(t){return t.b.e}function Q(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&to(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ts(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ts(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ts(t){var e=t.d,i=t.e,r=t.c,n=e[1],s=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ta(t,1)),s}function ta(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[o],n[h])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function to(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a>>1,h=r[u];if(0===u||i(n[h],n[o])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tc(t){return t.e.a.b}(E=j.prototype).x=function(){Y(this,H)},E.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:W(this,100900);return}W(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:W(this,100900)}return!1},E.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},E.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:W(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];Y(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,i=!0),1e150<s&&(s=1e150,i=!0),r[n]=s}i&&W(this,100155),null===(i=this.q)?c(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},E.u=function(t){Y(this,H),this.d=1,this.b=new Q,this.c=t},E.t=function(){Y(this,1),this.d=2,this.q=null},E.v=function(){Y(this,2),this.d=1},E.w=function(){Y(this,1),this.d=H;var t,r,s=this.j[0],a=this.j[1],o=this.j[2],u=!1,h=[s,a,o];if(0===s&&0===a&&0===o){for(var a=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],o=[],v=[],u=this.b.c,s=u.e;s!==u;s=s.e)for(var y=0;3>y;++y){var b=s.g[y];b<p[y]&&(p[y]=b,v[y]=s),b>a[y]&&(a[y]=b,o[y]=s)}if(s=0,a[1]-p[1]>a[0]-p[0]&&(s=1),a[2]-p[2]>a[s]-p[s]&&(s=2),p[s]>=a[s])h[0]=0,h[1]=0,h[2]=1;else{for(a=0,p=v[s],o=o[s],v=[0,0,0],p=[p.g[0]-o.g[0],p.g[1]-o.g[1],p.g[2]-o.g[2]],y=[0,0,0],s=u.e;s!==u;s=s.e)y[0]=s.g[0]-o.g[0],y[1]=s.g[1]-o.g[1],y[2]=s.g[2]-o.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>a&&(a=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=a&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),s=this.b.c,a=(v+1)%3,o=(v+2)%3,v=0<h[v]?1:-1,h=s.e;h!==s;h=h.e)h.b=h.g[a],h.a=v*h.g[o];if(u){for(h=0,s=(u=this.b.a).b;s!==u;s=s.b)if(!(0>=(a=s.a).f))do h+=(a.a.b-a.b.a.b)*(a.a.a+a.b.a.a),a=a.e;while(a!==s.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,s=(h=this.b.b).h;s!==h;s=u)u=s.h,a=s.e,e(s.a,s.b.a)&&s.e.e!==s&&(V(this,a,s),l(s),a=(s=a).e),a.e===s&&(a!==s&&((a===u||a===u.b)&&(u=u.h),l(a)),(s===u||s===u.b)&&(u=u.h),l(s));for(this.e=h=new $,s=(u=this.b.c).e;s!==u;s=s.e)s.h=tt(h,s);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ta(t,e);t.h=!0}(t.b)}(h),this.f=new B(this),U(this,-_),U(this,_);null!==(h=te(this.e));){for(;;){t:if(0===(s=this.e).a)u=tn(s.b);else if(u=s.c[s.d[s.a-1]],0!==s.b.a&&i(s=tn(s.b),u)){u=s;break t}if(null===u||!e(u,h))break;u=te(this.e),V(this,h.c,u.c)}!function t(r,s){r.a=s;for(var a=s.c;null===a.i;)if((a=a.c)===s.c){var a=r,o=s,u=new tu;u.a=o.c.b;var h=a.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,o,u.a))e((u=h.a).a,o)||e(u.b.a,o)||(f(u.b),h.c&&(l(u.c),h.c=!1),c(o.c,u),t(a,o));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(o.c.b,u.e):d(p.b.c.b,o.c).b,v.c?w(v,m):(u=a,(h=O(a,h,m)).f=tc(h).f+h.a.f,h.d=M(u,h.f)),t(a,o)):L(a,h,o.c,o.c,null,!0)}return}if(h=(u=th(a=R(a.i))).a,(u=P(r,u,null)).c===h){var h=u,u=h.c,p=th(a),m=a.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,a),e(m.a,r.a)&&(c(K(u),m),u=th(a=R(a)).a,P(r,th(a),p),y=!0),e(v.a,r.a)&&(c(h,K(v)),h=P(r,p,null),y=!0),y?L(r,a,h.c,u,u,!0):(o=i(v.a,m.a)?K(v):m,L(r,a,o=d(h.c.b,o),o.c,o.c,!1),o.b.i.c=!0,z(r,a))}else L(r,a,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,C(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,s=(h=this.b).a.b;s!==h.a;s=u)u=s.b,(s=s.a).e.e===s&&(A(s.c,s),l(s));if(!this.n){if(h=this.b,this.m)for(s=h.b.h;s!==h.b;s=u)u=s.h,s.b.d.c!==s.d.c?s.f=s.d.c?1:-1:l(s);else for(s=h.a.b;s!==h.a;s=u)if(u=s.b,s.c){for(s=s.a;i(s.b.a,s.a);s=s.c.b);for(;i(s.a,s.b.a);s=s.e);for(a=s.c.b,o=void 0;s.e!==a;)if(i(s.b.a,a.a)){for(;a.e!==s&&(i((t=a.e).b.a,t.a)||0>=n(a.a,a.b.a,a.e.b.a));)a=(o=d(a.e,a)).b;a=a.c.b}else{for(;a.e!==s&&(i((r=s.c.b).a,r.b.a)||0<=n(s.b.a,s.a,s.c.b.a));)s=(o=d(s,s.c.b)).b;s=s.e}for(;a.e.e!==s;)a=(o=d(a.e,a)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),s=u.a;do this.k&&this.k(s.a.d,this.c),s=s.e;while(s!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,s=!1,a=-1,o=h.a.d;o!==h.a;o=o.d)if(o.c){s||(this.h&&this.h(4,this.c),s=!0),v=o.a;do u&&a!==(p=v.b.d.c?0:1)&&(a=p,this.l&&this.l(!!a,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==o.a)}s&&this.i&&this.i(this.c)}}if(this.r){for(s=(h=this.b).a.b;s!==h.a;s=u)if(u=s.b,!s.c){o=(a=s.a).e,v=void 0;do o=(v=o).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,K(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,K(p))),g(v));while(v!==a);a=s.d,(s=s.b).d=a,a.b=s}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},n1.libtess={GluTesselator:j,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},j.prototype.gluDeleteTess=j.prototype.x,j.prototype.gluTessProperty=j.prototype.B,j.prototype.gluGetTessProperty=j.prototype.y,j.prototype.gluTessNormal=j.prototype.A,j.prototype.gluTessCallback=j.prototype.z,j.prototype.gluTessVertex=j.prototype.C,j.prototype.gluTessBeginPolygon=j.prototype.u,j.prototype.gluTessBeginContour=j.prototype.t,j.prototype.gluTessEndContour=j.prototype.v,j.prototype.gluTessEndPolygon=j.prototype.w,t.exports=n1.libtess}(n2);var n3=((th=new n2.exports.GluTesselator).gluTessCallback(n2.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==n2.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),th);function n4(t){n3.gluTessNormal(0,0,1);var e=[];n3.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){n3.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var s=[r[n],r[n+1],0];n3.gluTessVertex(s,s)}n3.gluTessEndContour()}return n3.gluTessEndPolygon(),e}var n5=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var s=Array.isArray(r[0])?r[0]:r;if("number"!=typeof s[0]){for(var a=[],o=0,u=s.length;o<u;o++)a.push(s[o].x,s[o].y);s=a}return e.points=s,e.closePath=!0,e}e9(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n<r;s=n++){var a=this.points[2*n],o=this.points[2*n+1],u=this.points[2*s],h=this.points[2*s+1];o>e!=h>e&&t<(e-o)/(h-o)*(u-a)+a&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){for(var s=n4([t]),a=0;a<s.length;a++)e[i+a]=s[a];for(var o=s.length/2,u=0;u<o;u++)r[n+u]=u},ii(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(n0);function n6(t,e,i,r,n,s,a,o,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,s,a,o,u,h,c,l){if(!(l>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+s)/2,m=(n+a)/2,v=(s+o)/2,y=(a+u)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(m+y)/2,E=(g+b)/2,_=(x+T)/2;if(l>0){var A=o-e,S=u-i,C=Math.abs((r-o)*S-(n-u)*A),w=Math.abs((s-o)*S-(a-u)*A);if(C>11920929e-14&&w>11920929e-14){if((C+w)*(C+w)<=c*(A*A+S*S)){h.push(E,_);return}}else if(C>11920929e-14){if(C*C<=c*(A*A+S*S)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=c*(A*A+S*S)){h.push(E,_);return}}else if((A=E-(e+o)/2)*A+(S=_-(i+u)/2)*S<=c){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,c,l+1),t(E,_,b,T,v,y,o,u,h,c,l+1)}}(e,i,r,n,s,a,o,u,t,c*=c,0),t.push(o,u),t}var n8=function(t){function e(e,i,r,n){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=i,s.halfWidth=r,s.halfHeight=n,s}e9(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var s=i/2,a=r-s,o=n-s,u=r+s,h=n+s,c=t-this.x,l=e-this.y;return c*c/(a*a)+l*l/(o*o)>1&&c*c/(u*u)+l*l/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(r+n)),a=8*s+0+0;if(0===a)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var o=0,u=4*s+0+2,h=u,c=a,l=0+r,f=0,d=e+l,p=e-l,m=i+0;t[o++]=d,t[o++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<s;v++){var y=Math.PI/2*(v/s),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[o++]=b,t[o++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--c]=_,t[--c]=b}l=0,f=0+n,d=e+l,p=e-l,m=i+f;var A=i-f;return t[o++]=d,t[o++]=m,t[--c]=A,t[--c]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var s=0,a=0,o=0;o<t.length;o+=2)s+=t[o],a+=t[o+1];s/=t.length/2,a/=t.length/2;var u=i;e[2*u]=s,e[2*u+1]=a;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(n0);(tc=er||(er={}))[tc.Star=0]="Star",tc[tc.Polygon=1]="Polygon";var n9=function(t){function e(e,i,r,n,s,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=i,o.innerRadius=r,o.outerRoundness=n,o.innerRoundness=s,o.starType=a,o.v=[],o.in=[],o.out=[],o}e9(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)n6(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;n6(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var s=n4([t]),a=0;a<s.length;a++)e[i+a]=s[a];for(var o=s.length/2,u=0;u<o;u++)r[n+u]=u},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,a=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,c=this.innerRoundness/100,l=2*Math.PI*o/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=a?o:u,i=a?h:c,r=a?l:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,a=!a,d+=1*s}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*r/(4*e),a=-(.5*Math.PI);for(t=0;t<e;t++){var o=r*Math.cos(a),u=r*Math.sin(a),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),c=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),l=2*t;this.v[l]=o,this.v[l+1]=u,this.in[l]=o+h*s*n*1,this.in[l+1]=u+c*s*n*1,this.out[l]=o-h*s*n*1,this.out[l+1]=u-c*s*n*1,a+=1*i}},e}(n0),n7=function(t){function e(e,i,r,n){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(s=t.call(this)||this).x=Number(e),s.y=Number(i),s.width=Number(r),s.height=Number(n),s}e9(e,t);var i=e.prototype;return i.isEmpty=function(){return this.left===this.right||this.top===this.bottom},i.clone=function(){return new e(this.x,this.y,this.width,this.height)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.copyTo=function(t){return t.copyFrom(this),t},i.contains=function(t,e){return!(this.width<=0)&&!(this.height<=0)&&t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height},i.strokeContains=function(t,e,i){var r=this.width,n=this.height;if(r<=0||n<=0)return!1;var s=this.x,a=this.y;return t>=s-i/2&&t<=s+r+i/2&&e>=a-i/2&&e<=a+n+i/2&&!(t>s+i/2&&t<s+r-i/2&&e>a+i/2&&e<a+n-i/2)},i.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},i.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this},i.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this},i.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this},i.getBounds=function(t){return(t=t||new e).copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.width,n=this.height;return r>=0&&n>=0&&(t[0]=e,t[1]=i,t[2]=e+r,t[3]=i,t[4]=e+r,t[5]=i+n,t[6]=e,t[7]=i+n),t},i.triangulate=function(t,e,i,r,n){var s=0;e[(i*=2)+0]=t[0],e[i+s+1]=t[1],e[i+(s+=2)]=t[2],e[i+s+1]=t[3],e[i+(s+=2)]=t[6],e[i+s+1]=t[7],e[i+(s+=2)]=t[4],e[i+s+1]=t[5],s+=2;var a=i/2;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2},ii(e,[{key:"left",get:function(){return this.x}},{key:"right",get:function(){return this.x+this.width}},{key:"top",get:function(){return this.y}},{key:"bottom",get:function(){return this.y+this.height}}],[{key:"EMPTY",get:function(){return new e(0,0,0,0)}}]),e}(n0),st=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=iR(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,s=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5],s[6]);break;case"moveTo":this.moveTo(s[0],s[1]);break;case"ellipse":this.ellipse(s[0],s[1],s[2],s[3],s[4]);break;case"polyStar":this.polyStar(s[0],s[1],s[2],s[3],s[4],s[5],s[6]);break;case"rect":this.rect(s[0],s[1],s[2],s[3],s[4])}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,s,a){this.ensurePoly();var o=this.currentPoly;return n6(o.points,o.lastX,o.lastY,t,e,i,r,n,s,a),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new n8(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,s,a){return this.drawShape(new n9(t,e,i,r,n,s),a),this},e.rect=function(t,e,i,r,n){return this.drawShape(new n7(t,e,i,r),n),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new n5).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new n5,this.currentPoly.points.push(0,0))},t}(),se=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,s,a){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,s,a]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n){return this.instructions.push({action:"rect",data:[t,e,i,r,n]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,s,a){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,s,a]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},ii(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new st(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();t.ShapeComponent=function(e){function i(i){var r;if((r=e.call(this,i)||this).path=new se,r.curveValues=[],r.animated=!0,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",r.geometry||(r.geometry=r_.create(i,{attributes:{aPos:{type:ik.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:ik.FLOAT,size:2,data:new Float32Array}},mode:ik.TRIANGLES,drawCount:4})),!r.material){var n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}};r.material=ry.create(i,n),r.material.setColor("_Color",new rR(1,1,1,1)),r.material.depthMask=!1,r.material.depthTest=!0,r.material.blending=!0}return r}e9(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){this.animated&&(this.buildPath(this.data),this.buildGeometryFromPath(this.path.shapePath))},r.buildGeometryFromPath=function(t){for(var e,i=t.shapePrimitives,r=[],n=[],s=iR(i);!(e=s()).done;){var a=e.value.shape,o=[],u=n.length,h=r.length/2;a.build(o),a.triangulate(o,r,h,n,u)}var c=r.length/2,l=this.geometry.getAttributeData("aPos"),f=this.geometry.getAttributeData("aUV"),d=this.geometry.getIndexData();(!l||l.length<3*c)&&(l=new Float32Array(3*c)),(!f||f.length<2*c)&&(f=new Float32Array(2*c)),d||(d=new Uint16Array(n.length));for(var p=0;p<c;p++){var m=3*p,v=2*p,y=2*p;l[m]=r[v],l[m+1]=r[v+1],l[m+2]=0,f[y]=l[m],f[y+1]=l[m+1]}d.set(n),this.geometry.setAttributeData("aPos",l),this.geometry.setAttributeData("aUV",f),this.geometry.setIndexData(d),this.geometry.setDrawCount(n.length)},r.buildPath=function(t){switch(this.path.clear(),t.type){case tJ.Custom:var e=t.points,i=t.easingIns,r=t.easingOuts;this.curveValues=[];for(var n,s=iR(t.shapes);!(n=s()).done;){var a=n.value;this.setFillColor(a.fill);for(var o=a.indexes,u=1;u<o.length;u++){var h=o[u],c=o[u-1];this.curveValues.push({point:e[h.point],controlPoint1:r[c.easingOut],controlPoint2:i[h.easingIn]})}this.curveValues.push({point:e[o[0].point],controlPoint1:r[o[o.length-1].easingOut],controlPoint2:i[o[0].easingIn]})}this.path.moveTo(this.curveValues[this.curveValues.length-1].point.x,this.curveValues[this.curveValues.length-1].point.y);for(var l,f=iR(this.curveValues);!(l=f()).done;){var d=l.value,p=d.point,m=d.controlPoint1,v=d.controlPoint2;this.path.bezierCurveTo(m.x,m.y,v.x,v.y,p.x,p.y,1)}break;case tJ.Ellipse:this.path.ellipse(0,0,t.xRadius,t.yRadius),this.setFillColor(t.fill);break;case tJ.Rectangle:this.path.rect(-t.width/2,-t.height/2,t.width,t.height),this.setFillColor(t.fill);break;case tJ.Star:this.path.polyStar(t.pointCount,t.outerRadius,t.innerRadius,t.outerRoundness,t.innerRoundness,er.Star),this.setFillColor(t.fill);break;case tJ.Polygon:this.path.polyStar(t.pointCount,t.radius,t.radius,t.roundness,t.roundness,er.Polygon),this.setFillColor(t.fill)}},r.setFillColor=function(t){if(t){var e=t.color;this.material.setColor("_Color",new rR(e.r,e.g,e.b,e.a))}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.data=t;var i=this.material;i.stencilRef=void 0!==t.renderer.mask?[t.renderer.mask,t.renderer.mask]:void 0,iY(i,t.renderer.maskMode)},i}(i_),t.ShapeComponent=s([io("ShapeComponent")],t.ShapeComponent),t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}e9(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,i=this.startPositionY*(1-s)+s*this.endPositionY,r=this.startPositionZ*(1-s)+s*this.endPositionZ}var a=this.effectComponent.material;a.setFloat("_PosX",e*this.amountOfMotion),a.setFloat("_PosY",i*this.amountOfMotion),a.setFloat("_PosZ",r*this.amountOfMotion)}},i}(il),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=s([io("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tl=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tl.Circular=0]="Circular",tl[tl.Linear=1]="Linear",t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}e9(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.position=this.transform.getWorldPosition(),t.rotation=this.transform.getWorldRotation()}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(id),t.CameraController=s([io(t3.CameraController)],t.CameraController);var si=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6);t.HitTestType=void 0,(tf=t.HitTestType||(t.HitTestType={}))[tf.triangle=1]="triangle",tf[tf.box=2]="box",tf[tf.sphere=3]="sphere",tf[tf.custom=4]="custom";var sr="click",sn="touchstart",ss="touchmove",sa="touchend",so=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,s,a=this;n=function(t){return t};var o="mousedown",u="mousemove",h="mouseup",c=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=0);var o=0,u=0,h=performance.now();if(!a.target)return eG.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:s,ts:h,width:0,height:0,origin:t};var c=a.target,l=c.width,f=c.height;if(r){var d=h-r.ts;o=(n-r.dx)/d||0,u=(s-r.dy)/d||0,r={dx:n,dy:s,ts:h}}return{x:e,y:i,vx:o,vy:u,dx:n,dy:s,ts:h,width:l,height:f,origin:t}};eI()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},o="touchstart",u="touchmove",h="touchend"),this.nativeHandlers=((s={})[o]=function(s){if(a.enabled){var o=n(s),u=su(o);t=u.x,e=u.y,r=i={clientX:o.clientX,clientY:o.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(sn,c(s,t,e))}},s[u]=function(r){if(i&&a.enabled){var s=su(n(r));t=s.x,e=s.y,a.dispatchEvent(ss,c(r,t,e,t-i.x,e-i.y))}},s[h]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var s=n(r),o=su(s),u=Math.abs(i.clientX-s.clientX)+Math.abs(i.clientY-s.clientY);t=o.x,e=o.y,u<4&&a.dispatchEvent(sr,c(r,t,e)),a.dispatchEvent(sa,c(r,t,e,t-i.x,e-i.y))}i=0},s),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),eb(i,e),function(){eT(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eT(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function su(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),s=n.left,a=n.top;return{x:(i-s)/n.width*2-1,y:1-(r-a)/n.height*2}}var sh=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),sc=1,sl=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new iT,n=new iS,s=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,s),e.x=s.x,e.y=s.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(e){var i,r=[["ENV_EDITOR",(null==(i=this.engine.renderer)?void 0:i.env)===nW]],n=nK(this.color).getValue(0),s={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=ry.create(this.engine,s);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new iE(0,0,0,0)),a.setVector2("uSize",new ib(1,1)),a.setVector4("uColor",new iE(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new iS(0,0,0,0)),a},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return r_.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:ik.LINES,maxVertex:4})},i.createMesh=function(t,e){return rL.create(this.engine,{name:"Interact_preview"+sc++,priority:0,worldMatrix:iC.fromIdentity(),geometry:t,material:e})},e}();function sf(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.duringPlay=!1,t._interactive=!0,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i}}},t}e9(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.props.content.options,e=this.item.engine.renderer.env,i=this.item.composition,r=this.interactData.options,n=r.type,s=r.showPreview;if(n===tw.CLICK&&(this.clickable=!0,s&&e===nW)){var a=null==i?void 0:i.getRendererOptions();void 0!==a&&(this.previewContent=new sl(this.item.props.content,a,this.transform,this.engine))}t.type===tw.DRAG&&(e!==nW||t.enableInEditor)&&(null==i?void 0:i.event)&&this.beginDragTarget(t,i.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this),this.interactData.options.type===tw.CLICK&&(this.clickable=!0)},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.item.time>0&&this.item.time-t/1e3<=0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,sf(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,s=n.position,a=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=s[2],c=Math.tan(a*Math.PI/180/2)*Math.abs(h),l=this.dragRange,f=l.dxRange,d=l.dyRange,p=s[0]-this.dragRatio[0]*(u*c),m=s[1]-this.dragRatio[1]*(o*c),v=f[0],y=f[1],g=d[0],x=d[1];p=ix(p,v,y),m=ix(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new iT(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var s={touchstart:function(t){if(n.canInteract()){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.handleDragMove(r,t),n.bouncingArg=t},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!sf(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iW({},r)),r=null}}};Object.keys(s).forEach(function(t){e.addEventListener(t,s[t])}),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(s).forEach(function(t){e.removeEventListener(t,s[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=np(iT.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tw.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},ii(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ip),t.InteractComponent=s([io(t3.InteractComponent)],t.InteractComponent);var sd=function(){function e(){this.triangles=[]}var i=e.prototype;return i.getBoundingBoxData=function(){return this.boundingBoxData},i.getBoundingBox=function(){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,s=Number.MAX_VALUE,a=iR(this.boundingBoxData.area);!(e=a()).done;){var o=e.value;i=Math.max(o.p0.x,o.p1.x,o.p2.x,i),r=Math.max(o.p0.y,o.p1.y,o.p2.y,r),n=Math.min(o.p0.x,o.p1.x,o.p2.x,n),s=Math.min(o.p0.y,o.p1.y,o.p2.y,s)}var u=[],h=new iT(n,r,0),c=new iT(i,r,0),l=new iT(i,s,0),f=new iT(n,s,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),{type:t.HitTestType.triangle,area:u}},i.setGeometry=function(e,i){this.geometry!==e&&(this.triangles=this.geometryToTriangles(e),this.geometry=e);for(var r,n=[],s=iR(this.triangles);!(r=s()).done;){var a=r.value;n.push({p0:a.p0,p1:a.p1,p2:a.p2})}i&&n.forEach(function(t){t.p0=i.transformPoint(t.p0,new iT),t.p1=i.transformPoint(t.p1,new iT),t.p2=i.transformPoint(t.p2,new iT)}),this.boundingBoxData={type:t.HitTestType.triangle,area:n}},i.geometryToTriangles=function(t){for(var e,i,r=null!=(e=t.getIndexData())?e:[],n=null!=(i=t.getAttributeData("aPos"))?i:[],s=[],a=0;a<r.length;a+=3){var o=3*r[a],u=3*r[a+1],h=3*r[a+2],c={x:n[o],y:n[o+1],z:n[o+2]},l={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[h],y:n[h+1],z:n[h+2]};s.push({p0:c,p1:l,p2:f})}return s},e}();function sp(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0}function sm(e,i){var r=null!=i?i:{},n=r.env,s=r.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===nW]];return{fragment:s?rD:rz,vertex:rk,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function sv(t,e){return t.cachePrefix+"_effects_sprite_"+e}function sy(t,e,i,r){var n=t.wireframe,s=sm(i,{wireframe:n,env:r});return s.shared=!0,n||(s.cacheId=sv(t,e)),s}t.maxSpriteMeshItemCount=8;var sg={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},sx=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return e9(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),s=i.engine.gpuCapability,a=s.level,o=s.detail,u=(null!=r?r:{}).env;return(null==n?void 0:n.shaderResults[sv(sg,2)])||(null==n||n.addShader(sy(sg,2,1,u)),null==n||n.addShader(sy(sg,t.maxSpriteMeshItemCount,1,u)),o.writableFragDepth&&(null==n||n.addShader(iF(a,!0)))),Promise.resolve()},i}(e6),sb=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=iR(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=iR(this.playableOutputs);!(r=n()).done;){var s=r.value;this.prepareFrameWithRoot(s)}for(var a,o=iR(this.playableOutputs);!(a=o()).done;){var u=a.value;this.processFrameWithRoot(u)}for(var h,c=iR(this.playables);!(h=c()).done;){var l=h.value;this.updatePlayableTime(l,t/1e3)}},e.connect=function(t,e,i,r){i.connectInput(r,t,e)},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrameRecursive(t.context,t.getSourceOutputPort()),t.processFrame()},e.prepareFrameWithRoot=function(t){t.sourcePlayable.prepareFrameRecursive(t.context,t.getSourceOutputPort()),t.prepareFrame()},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),sT=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=0,this.time=0,t.addPlayable(this),this.inputs=Array(e),this.inputOuputPorts=Array(e),this.inputWeight=Array(e)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){0===this.playState&&(this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1)},e.connectInput=function(t,e,i,r){void 0===r&&(r=1),this.setInput(e,t),this.setInputWeight(t,r),e.setOutput(this,i),this.inputOuputPorts.length<t+1&&(this.inputOuputPorts.length=t+1),this.inputOuputPorts[t]=i},e.addInput=function(t,e,i){void 0===i&&(i=1),this.connectInput(this.getInputCount(),t,e,i)},e.getInputCount=function(){return this.inputs.length},e.getInputs=function(){return this.inputs},e.getInput=function(t){return this.inputs[t]},e.getOutputCount=function(){return this.outputs.length},e.getOutputs=function(){return this.outputs},e.getOutput=function(t){return this.outputs[t]},e.getInputWeight=function(t){return this.inputWeight[t]},e.setInputWeight=function(e,i){if(r(e,t)){for(var n=0;n<this.inputs.length;n++)if(this.inputs[n]===e){this.inputWeight[n]=i;return}}else this.inputWeight.length<e+1&&(this.inputWeight.length=e+1),this.inputWeight[e]=i},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.setTraversalMode=function(t){this.traversalMode=t},e.getTraversalMode=function(){return this.traversalMode},e.onPlayablePlay=function(t){},e.onPlayablePause=function(t){},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},e.prepareFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState)switch(this.onPlayablePlayFlag&&(this.onPlayablePlay(t),this.onPlayablePlayFlag=!1),this.onPlayablePauseFlag&&(this.onPlayablePause(t),this.onPlayablePauseFlag=!1),0===e&&this.prepareFrame(t),this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).prepareFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).prepareFrameRecursive(t,this.inputOuputPorts[e])}},e.processFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState){switch(this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).processFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).processFrameRecursive(t,this.inputOuputPorts[e])}this.processFrame(t)}},e.setOutput=function(t,e){this.outputs.length<e+1&&(this.outputs.length=e+1),this.outputs[e]=t},e.setInput=function(t,e){this.inputs.length<e+1&&(this.inputs.length=e+1),this.inputs[e]=t},t}(),sE=function(){function t(){this.sourceOutputPort=0,this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t,e){void 0===e&&(e=0),this.sourcePlayable=t,this.sourceOutputPort=e},e.getSourceOutputPort=function(){return this.sourceOutputPort},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),s_=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic);(td=en||(en={}))[td.Playing=0]="Playing",td[td.Paused=1]="Paused",(tp=es||(es={}))[tp.Mix=0]="Mix",tp[tp.Passthrough=1]="Passthrough";var sA=new iS,sS=1,sC=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iT(0,0,0),this.quat=new iS(0,0,0,1),this.rotation=new rS(0,0,0),this.scale=new iT(1,1,1),this.anchor=new iT(0,0,0),this.size=new ib(1,1),this.children=[],this.worldMatrix=iC.fromIdentity(),this.localMatrix=iC.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iT(0,0,0),quat:new iS(0,0,0,1),scale:new iT(1,1,1)},this.name="transform_"+sS++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,n=t.rotation,s=t.scale,a=t.size,o=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(r(i,iT)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)r(o,iS)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(n){var c=e?-1:1;r(n,rS)?this.setRotation(n.x*c,n.y*c,n.z*c):this.setRotation(n[0]*c,n[1]*c,n[2]*c)}s&&(r(s,iT)?this.setScale(s.x,s.y,s.z):this.setScale(s[0],s[1],s[2])),a&&this.setSize(a.x,a.y),h&&(r(h,ib)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){eb(this.children,t)},e.removeChild=function(t){eT(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rS)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new rS)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={position:new iT().copyFrom(t.position),rotation:new rS(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new iT().copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=sA.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},ii(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),sw=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,s=i.options;r.apply(void 0,[].concat(n)),(null==s?void 0:s.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}};t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new sC,r.time=0,r.duration=0,r.start=0,r.endBehavior=tD.forward,r.type=tO.base,r.isDuringPlay=!1,r.components=[],r.rendererComponents=[],r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new sw,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}e9(i,e);var n=i.prototype;return n.on=function(t,e,i){this.eventProcessor.on(t,e,i)},n.off=function(t,e){this.eventProcessor.off(t,e)},n.once=function(t,e){this.eventProcessor.once(t,e)},n.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},n.getListeners=function(t){return this.eventProcessor.getListeners(t)},n.setSpeed=function(t){this.speed=t},n.getSpeed=function(){return this.speed},n.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},n.getComponent=function(t){for(var e,i,n=iR(this.components);!(i=n()).done;){var s=i.value;if(r(s,t)){e=s;break}}return e},n.getComponents=function(t){for(var e,i=[],n=iR(this.components);!(e=n()).done;){var s=e.value;r(s,t)&&i.push(s)}return i},n.setParent=function(t){(t!==this||t)&&(this.parent&&eT(this.parent.children,this),this.parent=t,i.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},n.setColor=function(t,e,i,r){},n.setOpacity=function(t){},n.setActive=function(t){this.active!==t&&(this.active=!!t,this.onActiveChanged())},n.setVisible=function(t){for(var e,i=iR(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},n.getVisible=function(){return this.visible},n.getWorldTransform=function(t){var e=null!=t?t:new sC({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},n.translate=function(t,e,i){this.transform.translate(t,e,i)},n.rotate=function(t,e,i){var r=new rS(t,e,i),n=iS.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},n.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},n.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,s=r.y,a=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/o)*s,i)}},n.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},n.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},n.setScale=function(t,e,i){this.transform.setScale(t,e,i)},n.getBoundingBox=function(){},n.getHitTestParams=function(t){},n.getCurrentPosition=function(){var t=new iT;return this.transform.assignWorldTRS(t),t},n.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},n.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=iR(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},n.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},n.onEnable=function(){this.isEnabled=!0;for(var t,e=iR(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=iR(this.components);!(r=n()).done;){var s=r.value;s.enabled&&!s.isEnableCalled&&s.enable()}},n.onDisable=function(){this.isEnabled=!1;for(var t,e=iR(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},n.fromData=function(i){e.prototype.fromData.call(this,i);var n=i.id,s=i.name,a=i.delay,o=i.parentId,u=i.endBehavior,h=i.transform,c=i.listIndex,l=i.duration,f=void 0===l?0:l;if(this.props=i,this.type=i.type,this.id=n.toString(),this.name=s,this.start=a||this.start,h&&(h.position=new iT().copyFrom(h.position),h.quat?h.quat=new iS(h.quat.x,h.quat.y,h.quat.z,h.quat.w):h.rotation=new rS().copyFrom(null!=(d=h.eulerHint)?d:h.rotation),h.scale=new iT().copyFrom(h.scale),h.size&&(h.size=new ib().copyFrom(h.size)),h.anchor&&(h.anchor=new ib().copyFrom(h.anchor)),this.transform.setTransform(h)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=f,this.endBehavior=u,i.content||(i.content={options:{}}),f<0)throw Error("Item duration can't be less than 0, see "+nZ["Item duration can't be less than 0"]+".");this.rendererComponents.length=0;for(var d,p,m=iR(this.components);!(p=m()).done;){var v=p.value;v.item=this,r(v,ip)&&this.rendererComponents.push(v),r(v,t.ParticleSystem)&&(this.components.includes(v.renderer)||this.components.push(v.renderer),this.rendererComponents.push(v.renderer))}this.renderOrder=void 0===c?0:c},n.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=t3.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(i=this.parent)?void 0:i.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,i,n,s=iR(this.components);!(n=s()).done;){var a=n.value;r(a,t.EffectComponent)&&this.taggedProperties.components.push(a)}}this.taggedProperties.content={}},n.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,s=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(s),o=a.x,u=a.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},n.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=iR(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this.transform.setValid(!1)}},n.resetChildrenParent=function(){for(var t,e,i=iR(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eT(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tO.composition},i.isSprite=function(t){return t.type===tO.sprite},i.isParticle=function(t){return t.type===tO.particle},i.isNull=function(t){return t.type===tO.null},i.isTree=function(t){return t.type===tO.tree},i.isCamera=function(t){return t.type===tO.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},ii(i,[{key:"content",get:function(){return this._content}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=iR(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),i}(ic),s([ih(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=s([io(t3.VFXItemData)],t.VFXItem),t.Item=void 0,(tm=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tm.isComposition=function(t){return t.type===tO.composition},tm.isParticle=function(t){return t.type===tO.particle},tm.isNull=function(t){return t.type===tO.null};var sR=[1,1,1,1],sO=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}e9(i,e);var n=i.prototype;return n.processFrame=function(e){var i,n,s,a=e.output.getUserData();if(r(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(u=this.activeComponent)?void 0:u.material;var o,u,h,c=null==(h=this.activeMaterial)?void 0:h.getVector4("_Color");c&&(this.startColor=c.toArray())}null==(o=this.activeComponent)||o.setAnimationTime(this.time);var l=nh(sR,1),f=this.time/a.duration,d=this.opacityOverLifetime,p=this.colorOverLifetime;p&&(l=eA(p,f,!0),i=!0),d&&(l[3]*=d.getValue(f),i=!0),i&&(nc(this.renderColor,l,this.startColor),null==(s=this.activeMaterial)||null==(n=s.getVector4("_Color"))||n.setFromArray(this.renderColor))}},n.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=nK(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tV.GRADIENT_COLOR&&(this.colorOverLifetime=eS(i.color[1]))),this},n.getActiveComponent=function(t){return t.getComponent(nJ)},i}(sT),sM=[[0,0,1,1,void 0]],sI=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new sO(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(s_),t.SpriteColorPlayableAsset=s([io(t3.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).splits=sM,r.frameAnimationLoop=!1,r.name="MSprite"+sI++,r.geometry=r.createGeometry(ik.TRIANGLES),r.setItem(),i&&r.fromData(i),r}e9(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this;this.isManualTimeSet||(this.frameAnimationTime+=t/1e3,this.isManualTimeSet=!1);var i=this.frameAnimationTime,r=this.item.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),s=this.textureSheetAnimation,a=this.renderer.texture.source.video;if(a&&(0===i?a.pause():a.play().catch(function(t){e.engine.renderErrors.add(t)})),s){var o,u,h,c,l,f=s.total||s.row*s.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/s.row*m,c=1/s.col*v):(h=1/s.col*m,c=1/s.row*v),s.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/s.col),b=g-x*s.col;l=u?[h*x,c*(s.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([d+l[0],v+p-l[1],h,c])}},r.onDestroy=function(){var e=this.getTextures();this.item&&this.item.composition&&this.item.composition.destroyTextures(e),e.forEach(function(e){var i=e.source;i.sourceType===t.TextureSourceType.video&&(null==i?void 0:i.video)&&(i.video.pause(),i.video.src="",i.video.load())})},r.createGeometry=function(t){var e=12*this.splits.length;return r_.create(this.engine,{attributes:{aPos:{type:ik.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:ik.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.getItemGeometryData=function(){var t=this.splits,e=this.textureSheetAnimation,i=this.renderer;if(i.shape){for(var r=i.shape,n=r.index,s=r.aPoint,a=void 0===s?[]:s,o=new Float32Array(a),u=[],h=[],c=0;c<o.length;c+=6)o[c]*=1,o[c+1]*=1,h.push(a[c+2],a[c+3]),u.push(o[c],o[c+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:void 0===n?[]:n,atlasOffset:h}}var l=[],f=[],d=2,p=2;1===t.length&&(d=1,p=1);for(var m=[],v=0;v<d;v++)for(var y=0;y<p;y++){var g=(2*y+v)*4,x=e?[0,0,1,1,t[0][4]]:t[2*y+v],b=x[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],T=((v+v+1)/d-1)/2,E=((y+y+1)/p-1)/2,_=x[0],A=x[1],S=x[4]?x[3]:x[2],C=x[4]?x[2]:x[3],w=[-.5/d+T,.5/p+E,-.5/d+T,-.5/p+E,.5/d+T,.5/p+E,.5/d+T,-.5/p+E];l.push(b[0]*S+_,b[1]*C+A,b[2]*S+_,b[3]*C+A,b[4]*S+_,b[5]*C+A,b[6]*S+_,b[7]*C+A),m.push(1*w[0],1*w[1],0,1*w[2],1*w[3],0,1*w[4],1*w[5],0,1*w[6],1*w[7],0),f.push(g,1+g,2+g,2+g,1+g,3+g)}return this.geometry.setAttributeData("aPos",new Float32Array(m)),{index:f,atlasOffset:l}},r.fromData=function(t){e.prototype.fromData.call(this,t);var i,r,n,s,a,o,u=t.interaction,h=t.options,c=t.listIndex,l=t.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tM.MESH,blending:null!=(r=l.blending)?r:tE.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tA.MASK,side:null!=(s=l.side)?s:t_.DOUBLE,shape:l.shape,mask:null!=(a=l.mask)?a:0,maskMode:null!=(o=l.maskMode)?o:tA.NONE,order:void 0===c?0:c},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||sM,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=n$(this);var f=this.createGeometry(ik.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=iC.fromIdentity(),this.material=d,this.geometry=f;var p=h.startColor||[1,1,1,1];this.material.setVector4("_Color",new iE().setFromArray(p)),this.material.setVector4("_TexOffset",new iE().setFromArray([0,0,1,1])),this.setItem()},i}(nJ),t.SpriteComponent=s([io(t3.SpriteComponent)],t.SpriteComponent);var sP="lookup_texture",sL="offscreen_canvas",sF={},sV=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*im),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eq(0,1)),direction:n.normalize()}},t}();function sN(t,e,i){if(e===tU.RANDOM)t=eq(0,t);else if(e===tU.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tU.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===tU.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var sD=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),sk=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eq(-this._d,this._d),i=eq(-this._h,this._h);return{direction:new iT(0,0,1),position:new iT(e,i,0)}},t}(),sz=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,s=Math.atan2(n,r),a=Math.tan(e),o=new iT;return e<s?o.set(r,r*a,0):e>=s&&e<Math.PI-s?o.set(n/a,n,0):e<Math.PI+s?o.set(-r,-r*a,0):e<2*Math.PI-s?o.set(-n/a,-n,0):o.set(r,r*a,0),{direction:i,position:o}},t}(),sU=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tU.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eq(0,1);return{direction:new iT(0,1,0),position:new iT(this._d*(e-.5),0,0)}},t}(),sB=new iC,sG=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=eq(0,2*Math.PI),n=sN(this.arc,this.arcMode,t)*im,s=sB.setFromRotationZ(n),a=new iT(Math.cos(r),Math.sin(r),0),o=new iT(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:s.transformNormal(a),position:s.transformPoint(o)}},t}(),sX=new iC,sj=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return eq(-90,90)},e.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=this.getHorizontalAngle()*im,r=this.radius,n=new iT(Math.cos(i),0,Math.sin(i)),s=sX.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(r),direction:s}},t}(),sH=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.getHorizontalAngle=function(){return eq(0,90)},e}(sj),sY=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=ix(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(sN(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,s=new iT(r,n,0);return{position:new iT(r*this.width,n*this.height,0),direction:s.normalize()}},t}(),sW=function(){function t(){}return t.prototype.generate=function(){return{position:new iT,direction:new iT}},t}(),sZ=((ea={})[tS.NONE]=sW,ea[tS.CONE]=sV,ea[tS.SPHERE]=sj,ea[tS.HEMISPHERE]=sH,ea[tS.CIRCLE]=sD,ea[tS.DONUT]=sG,ea[tS.RECTANGLE]=sk,ea[tS.EDGE]=sU,ea[tS.RECTANGLE_EDGE]=sz,ea[tS.TEXTURE]=sY,ea);function sq(t){if(!t)return new sW;var e=iW({radius:1,arc:360,angle:0,arcMode:tU.RANDOM},t),i=t.type,r=sZ[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tS.NONE){var s=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=s,n.upDirection=iT.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function sK(t,e,i,r,n){var s,a;if(n===function(t,e,i,r){for(var n=0,s=e,a=i-r;s<i;s+=r)n+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return n}(t,e,i,r)>0)for(s=e;s<i;s+=r)a=s9(s,t[s],t[s+1],a);else for(s=i-r;s>=e;s-=r)a=s9(s,t[s],t[s+1],a);return a&&s2(a,a.next)&&(s7(a),a=a.next),a}function sQ(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(s2(r,r.next)||0===s1(r.prev,r,r.next))){if(s7(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function sJ(t,e){return t.x-e.x}function s$(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function s0(t,e,i,r,n,s,a,o){return(n-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(r-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(n-a)*(r-o)>=0}function s1(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function s2(t,e){return t.x===e.x&&t.y===e.y}function s3(t,e,i,r){var n=s5(s1(t,e,i)),s=s5(s1(t,e,r)),a=s5(s1(i,r,t)),o=s5(s1(i,r,e));return!!(n!==s&&a!==o||0===n&&s4(t,i,e)||0===s&&s4(t,r,e)||0===a&&s4(i,t,r)||0===o&&s4(i,e,r))}function s4(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function s5(t){return t>0?1:t<0?-1:0}function s6(t,e){return 0>s1(t.prev,t,t.next)?s1(t,e,t.next)>=0&&s1(t,t.prev,e)>=0:0>s1(t,e,t.prev)||0>s1(t,t.next,e)}function s8(t,e){var i=new at(t.i,t.x,t.y),r=new at(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function s9(t,e,i,r){var n=new at(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function s7(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 at(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ae=0;function ai(t,e,i,r){i=i||2,ae=r||0;var n,s,a,o,u,h,c,l=e&&e.length,f=l?e[0]*i:t.length,d=sK(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,s,a,o,u,h=[];for(n=0,s=e.length;n<s;n++)a=e[n]*r,o=n<s-1?e[n+1]*r:t.length,(u=sK(t,a,o,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(sJ),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,s=e,a=t.x,o=t.y,u=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var h=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(h<=a&&h>u){if(u=h,h===a){if(o===s.y)return s;if(o===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}s=s.next}while(s!==e);if(!n)return null;if(a===u)return n;var c,l=n,f=n.x,d=n.y,p=1/0;s=n;do a>=s.x&&s.x>=f&&a!==s.x&&s0(o<d?a:u,o,f,d,o<d?u:a,o,s.x,s.y)&&(c=Math.abs(o-s.y)/(a-s.x),s6(s,t)&&(c<p||c===p&&(s.x>n.x||s.x===n.x&&(i=n,r=s,0>s1(i.prev,i,r.prev)&&0>s1(r.next,i,i.next))))&&(n=s,p=c)),s=s.next;while(s!==l);return n}(t,e)){var i=s8(e,t);sQ(e,e.next),sQ(i,i.next)}})(h[n],i),i=sQ(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],s=o=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<s&&(s=h),u>a&&(a=u),h>o&&(o=h);c=0!==(c=Math.max(a-n,o-s))?1/c:0}return function t(e,i,r,n,s,a,o){if(e){!o&&a&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=s$(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,s,a,o,u,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,r=i,o=0,e=0;e<h&&(o++,r=r.nextZ);e++);for(u=h;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,h*=2}while(a>1)}(n)}(e,n,s,a);for(var u,h,c=e;e.prev!==e.next;){if(u=e.prev,h=e.next,a?function(t,e,i,r){var n=t.prev,s=t.next;if(s1(n,t,s)>=0)return!1;for(var a=n.x<t.x?n.x<s.x?n.x:s.x:t.x<s.x?t.x:s.x,o=n.y<t.y?n.y<s.y?n.y:s.y:t.y<s.y?t.y:s.y,u=n.x>t.x?n.x>s.x?n.x:s.x:t.x>s.x?t.x:s.x,h=n.y>t.y?n.y>s.y?n.y:s.y:t.y>s.y?t.y:s.y,c=s$(a,o,e,i,r),l=s$(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=c&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,f.x,f.y)&&s1(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,d.x,d.y)&&s1(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,f.x,f.y)&&s1(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,d.x,d.y)&&s1(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,s,a):function(t){var e=t.prev,i=t.next;if(s1(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(s0(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&s1(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+ae),i.push(e.i/r+ae),i.push(h.i/r+ae),s7(e),e=h.next,c=h.next;continue}if((e=h)===c){o?1===o?t(e=function(t,e,i){var r=t;do{var n=r.prev,s=r.next.next;!s2(n,s)&&s3(n,r,r.next,s)&&s6(n,s)&&s6(s,n)&&(e.push(n.i/i+ae),e.push(r.i/i+ae),e.push(s.i/i+ae),s7(r),s7(r.next),r=t=s),r=r.next}while(r!==t);return sQ(r)}(sQ(e),i,r),i,r,n,s,a,2):2===o&&function(e,i,r,n,s,a){var o=e;do{for(var u,h,c=o.next.next;c!==o.prev;){if(o.i!==c.i&&(u=o,h=c,u.next.i!==h.i&&u.prev.i!==h.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&&s3(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(s6(u,h)&&s6(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(s1(u.prev,u,h.prev)||s1(u,h.prev,h))||s2(u,h)&&s1(u.prev,u,u.next)>0&&s1(h.prev,h,h.next)>0))){var l=s8(o,c);o=sQ(o,o.next),l=sQ(l,l.next),t(o,i,r,n,s,a),t(l,i,r,n,s,a);return}c=c.next}o=o.next}while(o!==e)}(e,i,r,n,s,a):t(sQ(e),i,r,n,s,a,1);break}}}}(d,p,i,n,s,c),p}function ar(t,e){for(var i,r,n=t.s,s=t.p,a=n[1],o=s[1],u=0,h=0;h<a.length;h++)u+=a[h].length-1;var c,l=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(c=d[4])?d[3]:d[2],g=c?d[2]:d[3]);for(var x=[0,0],b=0===c?0:-Math.PI/2,T=0;T<a.length;T++)for(var E=a[T],_=o[T],A=o[T+1]||o[0],S=[0,0],C=0;C<E.length-1;C++)(function(t,e,i,r,n,s,a,o){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=h*i[0]+c*n+l*a+f*r[0],t[1]=h*i[1]+c*s+l*o+f*r[1]})(S,E[C],_,A,_[4],_[5],A[2],A[3]),i=S[0],r=S[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,as(x,x,b),l[p++]=m+(x[0]+1)/2*y,l[p++]=v+(x[1]+1)/2*g):(l[p++]=(i+1)/2,l[p++]=(r+1)/2),p+=2;var w=ai(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function an(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tV.SHAPE_POINTS,t.p],s:[tV.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tV.SHAPE_POINTS,t.g.p],s:[tV.SHAPE_SPLITS,t.g.s]}):i.push(t),i),s=0,a=0,o=0,u=0;u<n.length;u++){var h=ar(n[u],{indexBase:s,uvTransform:e});s+=h.aPoint.length/5,r.push(h),a+=h.aPoint.length,o+=h.index.length}if(1===r.length)return r[0];for(var c=new Float32Array(a),l=new Uint16Array(o),f=0,d=0,p=0;f<r[f];f++){var m=r[f];c.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:c,index:l}}function as(t,e,i){var r=Math.cos(i),n=Math.sin(i),s=e[0],a=e[1];return t[0]=r*s+n*a,t[1]=-n*s+r*a,t}var aa=function(){function t(t){var e=t.time,i=t.interval,n=t.count,s=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=r(n,nO)?n:nK(n),this.cycles=+s||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),ao=function(t){this.content=t},au=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new ao(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new ao(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),ah=new iT,ac=new iT,al=function(){function e(e,i){this.pointStart=[];var n,s=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,u=i.opacityOverLifetime,h=void 0===u?nK(1):u,c=i.widthOverTrail,l=i.name,f=i.occlusion,d=i.blending,p=i.maskMode,m=i.textureMap,v=i.texture,y=i.transparentOcclusion,g=i.minimumVertexDistance,x=i.lifetime,b=i.matrix,T=e.gpuCapability,E=T.detail,_=T.level,A=Math.max(i.pointCountPerTrail,2),S=nj(),C=E.maxVertexTextures>0,w=(null!=(n=e.renderer)?n:{}).env,R={},O=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===nW]],M=o>64,I=0;s&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,R.uColorOverLifetime=rs.createWithData(e,eV(s))),a&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,R.uColorOverTrail=rs.createWithData(e,eV(a))),M?(O.push(["ATTR_TRAIL_START",1]),I|=8):R.uTrailStart=new Float32Array(o),R.uOpacityOverLifetimeValue=h.toUniform(S);var P=c.toUniform(S);O.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),R.uVCurveValues=nO.getAllData(S);var L={shader:{vertex:rG,fragment:rU,macros:O,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+l,cacheId:"-t:+"+I+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},F=A*o*2,V=(A-1)*o,N=Float32Array.BYTES_PER_ELEMENT,D=12*N,k={attributes:{aColor:{size:4,stride:D,data:new Float32Array(12*F)},aSeed:{size:1,stride:D,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:D,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:D,offset:8*N,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(F)},aDir:{size:3,data:new Float32Array(3*F)}},indices:{data:new Uint16Array(6*F)},drawCount:6*V,name:"trail#"+l,bufferUsage:ik.DYNAMIC_DRAW};if(M)k.attributes.aTrailStart={size:1,data:new Float32Array(F)};else{var z=new Float32Array(F);k.attributes.aTrailStartIndex={size:1,data:z};for(var U=0;U<o;U++)for(var B=2*A,G=U*B,X=0;X<B;X++)z[G+X]=U}var j=iX(d),H=ry.create(e,L);H.blending=!0,H.depthMask=f,H.depthTest=!0,iY(H,p),ij(H,d);var Y=this.mesh=rL.create(e,{name:"MTrail_"+l,material:H,geometry:r_.create(e,k)}),W=null!=v?v:rs.createWithData(e);Object.keys(R).map(function(t){var e=R[t];if(r(e,rs))H.setTexture(t,e);else if("uTrailStart"===t)H.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],n=0;n<e.length;n+=4){var s=new iE(e[n],e[n+1],e[n+2],e[n+3]);i.push(s)}H.setVector4Array(t,i)}else H.setVector4(t,iE.fromArray(e))}),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",iE.fromArray(P)),H.setVector2("uTexOffset",new ib(0,0)),H.setVector4("uTextureMap",iE.fromArray(void 0===m?[0,0,1,1]:m)),H.setVector4("uParams",new iE(0,A-1,0,0)),H.setTexture("uMaskTex",W),H.setVector4("uColorParams",new iE(v?1:0,+j,0,+(f&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=A,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=M,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(o)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,a=n-1,o=r%n,u=(r-1)%n,h=(r-2)%n,c=this.getTrailPosition(t,u,ah);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+o,f=am(c,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),s.setAttributeSubData("aDir",6*l,v),s.setAttributeSubData("aTime",2*l,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,s.setAttributeSubData("aColor",24*l,g),u>=0){var b=new Float32Array(am(this.getTrailPosition(t,h,ac),c,e)),T=(t*n+u)*6;s.setAttributeSubData("aDir",T,b),s.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*o+E,2*o+E,2*u+1+E,2*o+1+E]),A=(t*a+(r-1)%a)*6;s.setIndexSubData(A,_)}r=++this.trailCursors[t];var S=this.mesh.material,C=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var R=2*n,O=new Float32Array(R),M=0;M<R;M++)O[M]=w;s.setAttributeSubData("aTrailStart",t*O.length,O)}else{var I=S.getFloats("uTrailStart");void 0!=I&&(I[t]=w,S.setFloats("uTrailStart",I))}C&&(C.y=Math.max(C.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",C))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,s=this.geometry.getAttributeData("aColor");return ez(s),i.x=s[n],i.y=s[1+n],i.z=s[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();ez(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");ez(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();ez(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},ii(e,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),e}(),af=new iT,ad=new iT,ap=new iT;function am(t,e,i){return t||i?(t?i?(ad.subtractVectors(e,t).normalize(),ad.subtractVectors(i,e),ap.copyFrom(ad).normalize(),af.addVectors(ad,ap)):af.subtractVectors(e,t):af.subtractVectors(i,e),af.normalize().toArray()):[0,0,0]}var av=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new aO(e,i)),r&&(n.trailMesh=new al(e,r));var n,s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}e9(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=iR(this.meshes);!(t=e()).done;)t.value.onStart()},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new iE;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){for(var e,i=iR(this.meshes);!(e=i()).done;)e.value.render(t)},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(ip);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).destroyed=!1,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===tz.removeParticle,ray:t})}}},r&&n.fromData(r),n}e9(i,e);var n=i.prototype;return n.isFrozen=function(){return this.frozen},n.isEnded=function(){return this.ended},n.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===tV.CONSTANT_VEC3?e.add(r[1]):t=nK(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,s=e.clone();if(t&&s.add(t.getValue(0)),this.transform.setPosition(s.x,s.y,s.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},n.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var s=this.item.duration;n.add(r.getValue(t/s))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},n.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var s=r.first;r.removeNode(s),i=n[1]=s.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},n.setVisible=function(t){this.renderer.setVisible(t)},n.setOpacity=function(t){var e,i=this.renderer.particleMesh.mesh.material,r=this.renderer.particleMesh.mesh.geometry,n=(null==(e=i.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];i.setVector4("uOpacityOverLifetimeValue",new iE(n[0],n[1],n[2],t));for(var s=r.getAttributeData("aColor")||[],a=0;a<s.length;a+=32)s[8*a+7]=t},n.setColor=function(t,e,i,r){var n,s=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,o=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new iE(o[0],o[1],o[2],r));for(var u=a.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=i,u[8*h+7]=r},n.setParentTransform=function(t){},n.getTextures=function(){return this.renderer.getTextures()},n.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},n.stop=function(){this.ended=!0,this.started=!1},n.reset=function(){this.renderer.reset(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new au(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1,this.destroyed=!1},n.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var a=this.particleLink,o=(i-n)/this.item.duration,u=this.timePassed,h=!1,c=function(){e.trails&&!h&&(h=!0,a.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,s,n)}))};if(this.ended){if(this.item.endBehavior!==tD.restart&&tD.destroy===this.item.endBehavior){var l=a.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/s.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var b=this.createPoint(d);b.delay+=i+x*v,this.addParticle(b,y),this.lastEmitTime=u}for(var T=s.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var A=T[E],S=!A.disabled&&A.getGeneratorOptions(u,d);if(S){var C=[0,0,0],w=s.burstOffsets[E],R=w&&w[S.cycleIndex]||C;A.once&&this.removeBurst(E);for(var O=0;O<S.count&&_<y&&!g();O++){var M,I=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:O,burstCount:S.count}));I.delay+=i,_++,(M=I.transform).translate.apply(M,[].concat(R)),this.addParticle(I,y)}}}}else this.item.endBehavior===tD.restart?(c(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=f,t[2]-=f,t[3].delay-=f}),this.renderer.minusTimeForLoop(f)):(this.ended=!0,this.item.endBehavior===tD.freeze&&(this.frozen=!0))}c()}},n.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),this.meshes.forEach(function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})}))},n.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var s=t.last,a=!1;!a;){var o=s.content[0],u=s.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),s.pre?s=s.pre:a=!0}++n>r&&(a=!0)}return i},n.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],s=new iT,a=!1;if(r&&r.content)do{var o=r.content,u=o[0],h=o[1];o[2];var c=o[3];if(u>this.timePassed){var l=this.getPointPosition(c),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},s)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(a=!0))}else break}while((r=r.pre)&&!a);return n}},n.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},n.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var s=this.trails,a=this.getPointPosition(i),o=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(h*=u[0]),s.sizeAffectsLifetime&&(c*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:o,lifetime:c,size:h,time:r})}},n.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},n.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,s=t.gravity,a=this.options.forceTarget,o=this.lastUpdate-n,u=new iT,h=iT.fromArray(void 0===s?[]:s);e.assignWorldTRS(u);var c=no(new iT,this.options,h,o,r,u,i);if(a){var l=a.target||[0,0,0],f=a.curve.getValue(o/r),d=1-f;c.x=c.x*d+l[0]*f,c.y=c.y*d+l[1]*f,c.z=c.z*d+l[2]*f}return c},n.initPoint=function(t){var e,i,r,n,s=this.options,a=this.lifetime,o=this.shape,u=s.startSpeed.getValue(a),h=s.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),c=t.position,l=new sC({position:h.transformPoint(c,new iT),valid:!0}),f=t.direction;if(f=h.transformNormal(f,ay).normalize(),s.startTurbulence&&s.turbulence){for(var d=0;d<3;d++)aE.setElement(d,s.turbulence[d].getValue(a));a_.setFromVector3(aE.negate()),aS.setFromEuler(a_).transformNormal(f).normalize()}o.alignSpeedDirection?(aT.copyFrom(f),this.upDirectionWorld||(o.upDirection?this.upDirectionWorld=o.upDirection.clone():this.upDirectionWorld=iT.Z.clone(),h.transformNormal(this.upDirectionWorld)),ab.crossVectors(aT,this.upDirectionWorld).normalize(),ab.isZero()&&ab.set(1,0,0)):(ab.set(1,0,0),aT.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=aA)[0]=p.animationDelay.getValue(a),n[1]=p.animationDuration.getValue(a),n[2]=p.cycles.getValue(a)),s.start3DRotation?ax.set(s.startRotationX.getValue(a),s.startRotationY.getValue(a),s.startRotationZ.getValue(a)):s.startRotation?ax.set(0,0,s.startRotation.getValue(a)):ax.set(0,0,0),l.setRotation(ax.x,ax.y,ax.z);var m=s.startColor.getValue(a);if(3===m.length&&(m[3]=1),s.start3DSize)ag.x=s.startSizeX.getValue(a),ag.y=s.startSizeY.getValue(a);else{var v=s.startSize.getValue(a),y=s.sizeAspect.getValue(a);ag.x=v,ag.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!s.particleFollowParent){var x=new iT;this.transform.assignWorldTRS(void 0,void 0,x),ag.x*=x.x,ag.y*=x.y}return l.setScale(ag.x,ag.y,1),{size:ag,vel:g,color:m,delay:s.startDelay.getValue(a),lifetime:s.startLifetime.getValue(a),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:s.gravity,sprite:n,dirY:aT,dirX:ab,transform:l}},n.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&r(e,Array)){var n=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[n]=e,n}return -1},n.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},n.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},n.stopParticleEmission=function(){this.emissionStopped=!0},n.resumeParticleEmission=function(){this.emissionStopped=!1},n.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},n.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,n,s,a,o,u,h,c,l,f,d,p,m,v,y=t.options,g=t.positionOverLifetime,x=void 0===g?{}:g,b=t.shape,T=null==x?void 0:x.gravityOverLifetime,E=nu(null==x?void 0:x.gravity),_=t.textureSheetAnimation,A=_?{animationDelay:nK(_.animationDelay||0),animationDuration:nK(_.animationDuration||1),cycles:nK(_.cycles||1),animate:_.animate,col:_.col,row:_.row,total:_.total||_.col*_.row}:void 0,S=!!(b&&b.turbulenceX||(null==b?void 0:b.turbulenceY)||(null==b?void 0:b.turbulenceZ));S&&(s=[nK(null!=(a=b.turbulenceX)?a:0),nK(null!=(o=b.turbulenceY)?o:0),nK(null!=(u=b.turbulenceZ)?u:0)]),this.name="ParticleSystem",this.shape=sq(b),this.emission={rateOverTime:nK(t.emission.rateOverTime),burstOffsets:(i=null!=(h=t.emission.burstOffsets)?h:[],n={},Array.isArray(i)&&i.forEach(function(t){var e=r(t,Array),i=e?t[0]:t.index,s=n[i];s||(s=n[i]=[]),e?s.push(t.slice(1,4)):s.push([+t.x,+t.y,+t.z])}),n),bursts:(t.emission.bursts||[]).map(function(t){return new aa(t)})},this.textureSheetAnimation=A;var C=t.renderer||{},w=t.rotationOverLifetime;w&&((c={}).asRotation=!!w.asRotation,c.z=w.z?nK(w.z):nK(0),w.separateAxes&&(c.x=w.x&&nK(w.x),c.y=w.y&&nK(w.y))),(null==x?void 0:x.forceTarget)&&(l={target:x.target||[0,0,0],curve:nK(x.forceCurve||[tV.LINE,[[0,0],[1,1]]])});var R={x:x.linearX&&nK(x.linearX||0),y:x.linearY&&nK(x.linearY||0),z:x.linearZ&&nK(x.linearZ||0),asMovement:x.asMovement},O={x:x.orbitalX&&nK(x.orbitalX),y:x.orbitalY&&nK(x.orbitalY),z:x.orbitalZ&&nK(x.orbitalZ),center:x.orbCenter,asRotation:x.asRotation},M=t.sizeOverLifetime||{},I=t.colorOverLifetime,P=(null==M?void 0:M.separateAxes)?{separateAxes:!0,x:nK(M.x),y:nK(M.y)}:{separateAxes:!1,x:nK(("size"in M?M.size:M.x)||1)};C.anchor=C.anchor||[0,0];var L=ib.fromArray(C.anchor);this.options={particleFollowParent:!!y.particleFollowParent,startLifetime:nK(y.startLifetime),startDelay:nK(y.startDelay||0),startSpeed:nK(x.startSpeed||0),startColor:nK(y.startColor),looping:!1,maxCount:null!=(f=y.maxCount)?f:0,gravityModifier:nK(T||0),gravity:E,start3DSize:!!y.start3DSize,startTurbulence:S,turbulence:s,speedOverLifetime:x.speedOverLifetime&&nK(x.speedOverLifetime),linearVelOverLifetime:R,orbitalVelOverLifetime:O,forceTarget:l},y.startRotationZ&&(this.options.startRotation=nK(y.startRotationZ||0)),(y.startRotationX||y.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=nK(y.startRotationX||0),this.options.startRotationY=nK(y.startRotationY||0),this.options.startRotationZ=nK(y.startRotationZ||0)),y.start3DSize?(this.options.startSizeX=nK(y.startSizeX),this.options.startSizeY=nK(y.startSizeY)):(this.options.startSize=nK(y.startSize),this.options.sizeAspect=nK(y.sizeAspect||1));var F={meshSlots:y.meshSlots,name:this.name,matrix:iC.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tM.BILLBOARD,side:C.side||t_.DOUBLE,gravity:E,blending:C.blending||tE.ALPHA,rotationOverLifetime:c,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:A,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:y.maxCount,mask:C.mask,maskMode:null!=(d=C.maskMode)?d:tA.NONE,forceTarget:l,diffuse:C.texture,sizeOverLifetime:P,anchor:L};if(I){var V=I.color,N=I.opacity;F.colorOverLifetime={},N&&(F.colorOverLifetime.opacity=nK(I.opacity)),V&&(V[0]===tV.GRADIENT_COLOR?F.colorOverLifetime.color=I.color[1]:V[0]===tV.RGBA_COLOR?F.colorOverLifetime.color=rs.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):r(V,rs)&&(F.colorOverLifetime.color=V))}var D=[],k=[0,0,1,1];if(t.splits){var z=t.splits[0];k=(p=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(A&&!A.animate)for(var U=p?A.row:A.col,B=p?A.col:A.row,G=A.total||U*B,X=0,j=0;j<U;j++)for(var H=0;H<B&&X<G;H++,X++)D.push([j*k[2]/U+k[0],H*k[3]/B+k[1],k[2]/U,k[3]/B]);else D.push(k);this.uvs=D,F.textureFlip=p;var Y=t.trails;Y&&(this.trails={lifetime:nK(Y.lifetime),dieWithParticles:!1!==Y.dieWithParticles,sizeAffectsWidth:!!Y.sizeAffectsWidth,sizeAffectsLifetime:!!Y.sizeAffectsLifetime,inheritParticleColor:!!Y.inheritParticleColor,parentAffectsPosition:!!Y.parentAffectsPosition},m={name:"Trail",matrix:iC.IDENTITY,minimumVertexDistance:Y.minimumVertexDistance||.02,maxTrailCount:y.maxCount,pointCountPerTrail:Math.round(Y.maxPointPerTrail)||32,blending:Y.blending,texture:Y.texture,opacityOverLifetime:nK(Y.opacityOverLifetime||1),widthOverTrail:nK(Y.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!Y.occlusion,transparentOcclusion:!!Y.transparentOcclusion,textureMap:Y.textureMap,mask:C.mask,maskMode:C.maskMode},Y.colorOverLifetime&&Y.colorOverLifetime[0]===tV.GRADIENT_COLOR&&(m.colorOverLifetime=Y.colorOverLifetime[1]),Y.colorOverTrail&&Y.colorOverTrail[0]===tV.GRADIENT_COLOR&&(m.colorOverTrail=Y.colorOverTrail[1])),this.renderer=new av(this.engine,F,m),this.renderer.item=this.item,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(v=W.radius)?v:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},ii(i,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}}]),i}(il),t.ParticleSystem=s([io(t3.ParticleSystem)],t.ParticleSystem);var ay=new iT,ag=new ib,ax=new rS,ab=new iT,aT=new iT,aE=new iT,a_=new rS,aA=[0,0,0],aS=new iC,aC=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}e9(i,e);var n=i.prototype;return n.start=function(e){var i=e.output.getUserData();!this.particleSystem&&r(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},n.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var i=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),.001>Math.abs(this.time-this.lastTime)&&(i=0),e.update(i)}this.lastTime=this.time},i}(sT),aw=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new aC(t)},e}(s_),aR={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"},aO=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iT,this.cachedRotationMatrix=new rC,this.cachedLinearMove=new iT,this.tempMatrix3=new rC,this.VERT_MAX_KEY_FRAME_COUNT=0;var n,s,a,o,u,h,c,l,f,d=(null!=(c=e.renderer)?c:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,b=i.sprite,T=i.gravityModifier,E=i.maxCount,_=i.textureFlip,A=i.useSprite,S=i.name,C=i.gravity,w=i.forceTarget,R=i.side,O=i.occlusion,M=i.anchor,I=i.blending,P=i.maskMode,L=i.mask,F=i.transparentOcclusion,V=i.meshSlots,N=i.renderMode,D=void 0===N?0:N,k=i.diffuse,z=void 0===k?rs.createWithData(e):k,U=e.gpuCapability.detail,B=U.halfFloatTexture,G=U.maxVertexUniforms,X=[["RENDER_MODE",+D],["ENV_EDITOR",d===nW]],j=e.gpuCapability.level,H=nj(),Y=nj(),W=G>0,Z={},q=0,K=0;this.useSprite=A,W&&X.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(X.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=p.toUniform(H)),(null==b?void 0:b.animate)&&(X.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([b.col,b.row,b.total,b.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(X.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=r(m.color,rs)?m.color:rs.createWithData(e,eV(m.color))),(null==m?void 0:m.opacity)?Z.uOpacityOverLifetimeValue=m.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=nK(1).toUniform(H),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(Z["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,K|=1<<7+e,v.enabled=!0),X.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(Z["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(H),r=1,K|=1<<10+e,l=!0,y.enabled=!0),X.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(X.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),l&&((null==y?void 0:y.asRotation)&&(X.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(H),(null==g?void 0:g.separateAxes)&&(X.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null==g?void 0:null==(f=g.y)?void 0:f.toUniform(H)),(null==x?void 0:x.z)&&(Z.uRZByLifeTimeValue=x.z.toUniform(H),K|=32768,X.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(Z.uRXByLifeTimeValue=x.x.toUniform(H),K|=65536,X.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(Z.uRYByLifeTimeValue=x.y.toUniform(H),K|=131072,X.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(X.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=262144),Z.uGravityModifierValue=T.toUniform(H),w&&(X.push(["FINAL_TARGET",!0]),K|=524288,Z.uFinalTarget=new Float32Array(w.target||[0,0,0]),Z.uForceCurve=w.curve.toUniform(H)),B&&Y.max?(K|=1048576,Z.uFCurveValueTexture=ra(e,nO.getAllData(Y,!0),Y.index,1)):Z.uFCurveValues=nO.getAllData(Y);var Q=H.max+H.curves.length-32>G;if(2===j&&(H.max=-1,H.index=V?V[0]:aI(H.index),Y.index>0&&(Y.max=-1,Y.index=V?V[1]:aI(Y.index))),Q&&B&&W){var J=ra(e,nO.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=J,q=1}else Z.uVCurveValues=nO.getAllData(H);var $=["-p:",D,K,H.index,H.max,Y.index,Y.max].join("+");X.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",Y.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",Y.max]),this.VERT_MAX_KEY_FRAME_COUNT=H.max;var tt={fragment:rU,vertex:"#define LOOKUP_TEXTURE_CURVE "+q+"\n"+rB,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:$,macros:X,name:"particle#"+S},te=iX(I);Z.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Z.uMaskTex=z,Z.uColorParams=new Float32Array([z?1:0,+te,0,+(!!O&&!F)]),Z.uParams=[0,0,0,0],Z.uAcceleration=[(null==C?void 0:C[0])||0,(null==C?void 0:C[1])||0,(null==C?void 0:C[2])||0,0];var ti=ry.create(e,{shader:tt,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});ti.blending=!0,ti.depthTest=!0,ti.depthMask=!!O,ti.stencilRef=L?[L,L]:void 0,iY(ti,P),ij(ti,I),iH(ti,R),Object.keys(Z).map(function(t){var e=Z[t];if(r(e,rs)){ti.setTexture(t,e);return}var i=[];switch(aR[t]){case"vec4":ti.setVector4(t,iE.fromArray(e));break;case"vec3":ti.setVector3(t,iT.fromArray(e));break;case"vec2":ti.setVector2(t,ib.fromArray(e));break;case"vec4Array":for(var n=0;n<e.length;n+=4){var s=new iE(e[n],e[n+1],e[n+2],e[n+3]);i.push(s)}ti.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),ti.setVector3("emissionColor",new iT(0,0,0)),ti.setFloat("emissionIntensity",0);var tr=r_.create(e,(n=4*E,s=this.useSprite,a="particle#"+S,h={aPos:{size:3,offset:0,stride:u=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:u,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:u,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:u,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*o,data:new Float32Array(0)},aSeed:{size:1,offset:3*o,stride:8*o,dataSource:"aRot"},aColor:{size:4,offset:4*o,stride:8*o,dataSource:"aRot"},aOffset:{size:4,stride:4*o,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*o,data:new Float32Array(0)},aRotation1:{size:3,offset:3*o,stride:9*o,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*o,stride:9*o,dataSource:"aRotation0"}},s&&(h.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:h,indices:{data:new Uint16Array(0)},name:a,maxVertex:n})),tn=rL.create(e,{name:"MParticle_"+S,material:ti,geometry:tr});this.anchor=M,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=w,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=T,this.rotationOverLifetime=x,this.maxCount=E,this.textureOffsets=_?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return ez(e),[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},i.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new i.constructor(0))},i.onUpdate=function(t){var e=Math.ceil(this.geometry.getAttributeData("aPos").length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r,n=t+1,s=4*n,a=this.geometry,o=n>this.maxParticleBufferCount,u=1;this.particleCount>300?u=(this.particleCount+100)/this.particleCount:this.particleCount>100?u=1.4:this.particleCount>0&&(u=2);var h={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},c=this.useSprite;c&&(h.aSprite=new Float32Array(12));var l=new iT,f=new iS,d=new iT(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=sC.getRotation(f,new rS),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();c&&(r=e.sprite);for(var A=0;A<4;A++){var S=2*A,C=3*A,w=4*A,R=12*A,O=8*A;h.aPos.set(m,R),b.fill(h.aPos,R+3),h.aRot.set(v,O),h.aRot[O+3]=_,h.aRot.set(T,O+4),c&&h.aSprite.set(r,C);var M=e.uv||x;if(M){var I=c?1-y[S+1]:y[S+1];g[0]=M[0]+y[S]*M[2],g[1]=M[1]+I*M[3]}h.aOffset.set(g,w);for(var P=A+A,L=(E[P]-this.anchor.x)*d.x,F=(E[P+1]-this.anchor.y)*d.y,V=0;V<3;V++)h.aPos[R+6+V]=e.dirX.getElement(V)*L,h.aPos[R+9+V]=e.dirY.getElement(V)*F}var N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(o){var D=eE(a.getIndexData(),6*n,6*i,u);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(h).forEach(function(e){var r=h[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var c=a.getAttributeData(e);ez(c);var l=eE(c,s*n,4*i*n,u);l.set(r,r.length*t),a.setAttributeData(e,l)}else a.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var a=0,o=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;a=n[f],o=n[f+1],u=n[f+2];var d=i-s[4*l+2],p=s[4*l+3];if(h&&c){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);a=a*x+v,o=o*x+y,u=u*x+g}else a+=v,o+=y,u+=g}var b=3*l;if(s[4*l+2]<i){var T=e/1e3*a,E=e/1e3*o,_=e/1e3*u;r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),n=this.geometry.getAttributeData("aOffset"),s=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),o=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var c=o-n[4*h+2],l=n[4*h+3],f=ix(c/l,0,1),d=8*h,p=this.cachedRotationVector3.set(s[d],s[d+1],s[d+2]),m=a[8*h+3];this.rotationOverLifetime?this.rotationOverLifetime.asRotation?(this.rotationOverLifetime.x&&(r(this.rotationOverLifetime.x,nP)?p.x+=this.rotationOverLifetime.x.getValue(f,m):p.x+=this.rotationOverLifetime.x.getValue(f)),this.rotationOverLifetime.y&&(r(this.rotationOverLifetime.y,nP)?p.y+=this.rotationOverLifetime.y.getValue(f,m):p.y+=this.rotationOverLifetime.y.getValue(f)),this.rotationOverLifetime.z&&(r(this.rotationOverLifetime.z,nP)?p.z+=this.rotationOverLifetime.z.getValue(f,m):p.z+=this.rotationOverLifetime.z.getValue(f))):(this.rotationOverLifetime.x&&(r(this.rotationOverLifetime.x,nP)?p.x+=this.rotationOverLifetime.x.getIntegrateValue(0,f,m)*l:p.x+=this.rotationOverLifetime.x.getIntegrateValue(0,f,l)*l),this.rotationOverLifetime.y&&(r(this.rotationOverLifetime.y,nP)?p.y+=this.rotationOverLifetime.y.getIntegrateValue(0,f,m)*l:p.y+=this.rotationOverLifetime.y.getIntegrateValue(0,f,l)*l),this.rotationOverLifetime.z&&(r(this.rotationOverLifetime.z,nP)?p.z+=this.rotationOverLifetime.z.getIntegrateValue(0,f,m)*l:p.z+=this.rotationOverLifetime.z.getIntegrateValue(0,f,l)*l)):u.setZero(),0===p.dot(p)&&u.identity();var v=Math.PI/180,y=p.x*v,g=p.y*v,x=p.z*v,b=Math.sin(y),T=Math.sin(g),E=Math.sin(x),_=Math.cos(y),A=Math.cos(g),S=Math.cos(x);u.set(S,-E,0,E,S,0,0,0,1),u.multiply(this.tempMatrix3.set(A,0,T,0,1,0,-T,0,A)),u.multiply(this.tempMatrix3.set(1,0,0,0,_,-b,0,b,_));var C=9*h,w=u.elements;i.set(w,C),h+4<=t&&(i.set(w,C+9),i.set(w,C+18),i.set(w,C+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),n=this.geometry.getAttributeData("aOffset"),s=this.geometry.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=a-n[4*u+2],c=n[4*u+3],l=h/c,f=s[8*u+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(r(this.linearVelOverLifetime.x,nP)?o.x=this.linearVelOverLifetime.x.getValue(l,f):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(r(this.linearVelOverLifetime.y,nP)?o.y=this.linearVelOverLifetime.y.getValue(l,f):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(r(this.linearVelOverLifetime.z,nP)?o.z=this.linearVelOverLifetime.z.getValue(l,f):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(r(this.linearVelOverLifetime.x,nP)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.y&&(r(this.linearVelOverLifetime.y,nP)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.z&&(r(this.linearVelOverLifetime.z,nP)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,c)));var d=3*u;i[d]=o.x,i[d+1]=o.y,i[d+2]=o.z,i[d+3]=o.x,i[d+4]=o.y,i[d+5]=o.z,i[d+6]=o.x,i[d+7]=o.y,i[d+8]=o.z,i[d+9]=o.x,i[d+10]=o.y,i[d+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),aM=[10,32,64,160];function aI(t){for(var e=0;e<aM.length;e++){var i=aM[e];if(i>t)return i}return t||aM[0]}function aP(t,e,i){void 0===i&&(i="");var r,n,s,a=t.content,o=+((null==(r=a.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",o],["ENV_EDITOR",i===nW]],h=e.level,c=e.detail,l=nj(),f=nj(),d=c.maxVertexUniforms>0,p=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,nX(l,p));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&nX(l,x);var b=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(nX(l,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==b?void 0:b[n])&&(nX(l,b[n]),a=1,v|=1<<10+e,s=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),s&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var T=a.sizeOverLifetime;T.separateAxes?(nX(l,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,nX(l,T.y)):nX(l,T.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(nX(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(nX(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(nX(l,E.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}nX(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,nX(l,b.forceCurve));var _=c.halfFloatTexture;_&&f.max&&(v|=1048576);var A=c.maxVertexUniforms,S=l.max+l.curves.length-32>A;sF[sP]&&(S=!0),2===h&&(l.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var C={fragment:rU,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+rB,shared:!0,cacheId:["-p:",o,v,l.index,l.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:C,vertex:l.index,fragment:f.index}}function aL(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var a=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=i;break}}}var aF=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,s=n.level,a=(null!=r?r:{}).env,o=i.getShaderLibrary(),u=[],h=[],c=0,l=0;return e.forEach(function(e){e.items.forEach(function(e){t.Item.isParticle(e)&&u.push(e)})}),u.forEach(function(e){var i=aP(e,n,a),r=i.shader,u=i.fragment,f=i.vertex;if(h.push(r),c=Math.max(c,u),l=Math.max(l,f),e.content.trails){var d,p,m,v,y,g,x,b,T=(d=e.content.trails,p=e.content.options.maxCount,m=e.name,void 0===(v=a)&&(v=""),y=0,g=sF[sP]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===nW]],b=nj(),d.colorOverLifetime&&(x.push(["COLOR_OVER_LIFETIME",!0]),y|=1),d.colorOverTrail&&(x.push(["COLOR_OVER_TRAIL",!0]),y|=4),p>64&&(x.push(["ATTR_TRAIL_START",1]),y|=8),nX(b,d.opacityOverLifetime),nX(b,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),{vertex:rG,fragment:rU,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+b.index+"+"+b.max});T.glslVersion=2===s?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,null==o||o.addShader(T)}}),h.forEach(function(e){2===s?(aL(e,l,c),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,null==o||o.addShader(e)}),2===s&&u.forEach(function(t){t.content.options.meshSlots=[l,c]}),Promise.resolve()},i}(e6),aV=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),aN=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},e.getInputStream=function(t){var e=this.playable.getInput(t);if(r(e,aD))return e.animationStream},t}(),aD=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new aN(iA(i)),i}return e9(e,t),e}(sT),ak=new rS,az=new iT(1,1,1),aU=new iT,aB=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var n=i.prototype;return n.start=function(){var t,e=this.boundObject,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new iT(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=nK(r.path));var a=r.linearX||r.linearY||r.linearZ;a&&(this.linearVelOverLifetime={x:r.linearX&&nK(r.linearX),y:r.linearY&&nK(r.linearY),z:r.linearZ&&nK(r.linearZ),asMovement:r.asMovement,enabled:!!a});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&nK(r.orbitalX),y:r.orbitalY&&nK(r.orbitalY),z:r.orbitalZ&&nK(r.orbitalZ),center:nu(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&nK(r.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=nK(s.x||1),this.sizeYOverLifetime=nK(s.y||1),this.sizeZOverLifetime=nK(s.z||1)):this.sizeXOverLifetime=nK(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:nK(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=nK(n.x||0),u.y=nK(n.y||0)}this.gravity=iT.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=nK(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iT.fromArray(r.direction).normalize():new iT,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},n.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();r(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},n.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){az.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(az.y=this.sizeYOverLifetime.getValue(r),az.z=this.sizeZOverLifetime.getValue(r)):az.z=az.y=az.x;var n=this.originalTransform.scale;e.transform.setScale(az.x*n.x,az.y*n.y,az.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},a=s(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;ak.x=o?s(this.rotationOverLifetime.x):0,ak.y=o?s(this.rotationOverLifetime.y):0,ak.z=a;var u=ak.addEulers(this.originalTransform.rotation,ak);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(no(aU,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&aU.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(aU.x,aU.y,aU.z))},i}(aD);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new aB(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(s_),t.TransformPlayableAsset=s([io(t3.TransformPlayableAsset)],t.TransformPlayableAsset);var aG=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();r(i,t.VFXItem)&&(i.time=this.time)},i}(sT);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new aG(t)},e}(s_),t.ActivationPlayableAsset=s([io(t3.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}e9(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){var i=e/t.duration;i=i<0?0:i>1?1:i;for(var r,n=iR(this.positionCurves);!(r=n()).done;){var s=r.value,a=s.keyFrames.getValue(i),o=this.findTarget(t,s.path);null==o||o.transform.setPosition(a.x,a.y,a.z)}for(var u,h=iR(this.rotationCurves);!(u=h()).done;){var c=u.value,l=c.keyFrames.getValue(i),f=this.findTarget(t,c.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=iR(this.scaleCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(i),y=this.findTarget(t,m.path);null==y||y.transform.setScale(v.x,v.y,v.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,i=iR(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:nK(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var s,a=iR(t.rotationCurves);!(s=a()).done;){var o=s.value,u={path:o.path,keyFrames:nK(o.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var h,c=iR(t.scaleCurves);!(h=c()).done;){var l=h.value,f={path:l.path,keyFrames:nK(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=iR(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:nK(m.keyFrames),property:m.property,className:m.className};this.duration=Math.max(this.duration,v.keyFrames.getMaxTime()),this.floatCurves.push(v)}},i.findTarget=function(t,e){for(var i,r=t,n=iR(e);!(i=n()).done;){for(var s,a=i.value,o=!1,u=iR(r.children);!(s=u()).done;){var h=s.value;if(h.name===a){r=h,o=!0;break}}if(!o)return}return r},e}(ic),t.AnimationClip=s([io(t3.AnimationClip)],t.AnimationClip);var aX=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();r(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(sT),aj=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===tD.restart?e%=i:this.endBehavior===tD.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}e9(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new sT(t)},i.createOutput=function(){return new sE},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=iR(this.clips);!(i=n()).done;){var s=i.value;r.push(s)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),s=iR(e);!(r=s()).done;){var a=r.value,o=this.createClipPlayable(t,a);o.setDuration(a.duration);var u=new aH(a,o,n,this);i.push(u),n.addInput(o,0),n.setInputWeight(o,0)}return n},i.createPlayable=function(t){return new sT(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new aj;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=iR(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=iR(this.children);!(i=r()).done;)i.value.parent=this},e}(s_),s([ih(aj,void 0)],t.TrackAsset.prototype,"clips",void 0),s([ih(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=s([io(t3.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tv=t.TrackType||(t.TrackType={}))[tv.MasterTrack=0]="MasterTrack",tv[tv.ObjectTrack=1]="ObjectTrack";var aH=function(){function e(e,i,n,s){this.clip=e,this.playable=i,this.parentMixer=n,this.track=s,r(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,n=1,s=!1,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tD.destroy?r(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?n=1:(n=0,s=!0):e-this.clip.start>=0?(n=1,a=!0):e<i.start&&(n=0),a&&this.playable.getPlayState()!==en.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,n);var u=i.toLocalTime(e);this.playable.setTime(u),s&&this.playable.getPlayState()===en.Playing&&this.playable.pause()},ii(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}(),aY=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();if(r(i,t.VFXItem)){for(var n=!1,s=0;s<this.getInputCount();s++)if(this.getInputWeight(s)>0){n=!0;break}n?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sT);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){return new aY(t)},e}(t.TrackAsset),t.ActivationTrack=s([io(t3.ActivationTrack)],t.ActivationTrack);var aW=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(sT),aZ=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){for(var i=!1,n=0,s=0;s<this.getInputCount();s++){var a=this.getInputWeight(s);if(a>0){var o=this.getInput(s);if(!r(o,aW)){console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");continue}n+=o.value*a,i=!0}}i&&(e[this.propertyName]=n)}},e}(sT),aq=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=iu(e);if(r)for(var n,s=iR(Object.keys(r));!(n=s()).done;){var a=n.value,o=e.taggedProperties[a];if(void 0===o&&(o=e[a]),ic.is(o))t.collectSerializableObject(o,i);else if(eH(o))for(var u,h=iR(o);!(u=h()).done;){var c=u.value;ic.is(c)&&t.collectSerializableObject(c,i)}else if(eW(o))for(var l,f=iR(Object.keys(o));!(l=f()).done;){var d=o[l.value];ic.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iW({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var s,a=iR(Object.keys(i));!(s=a()).done;){var o=i[s.value];n[o.getInstanceId()]||(n[o.getInstanceId()]={}),t.serialize(o,n[o.getInstanceId()])}return n},t.serialize=function(e,i){e.toData(),i||(i={});var r=iu(e);if(r)for(var n,s=iR(Object.keys(r));!(n=s()).done;){var a=n.value,o=e[a];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[a]=o:eH(o)?(i[a]||(i[a]=[]),t.serializeArrayProperty(o,i[a],0)):ic.is(o)?i[a]={id:o.getInstanceId()}:eW(o)&&(i[a]||(i[a]={}),t.serializeObjectProperty(o,i[a],0))}for(var u,h=iR(Object.keys(e.taggedProperties));!(u=h()).done;){var c=u.value,l=e.taggedProperties[c];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[c]=l:eH(l)?(i[c]||(i[c]=[]),t.serializeArrayProperty(l,i[c],0)):ic.is(l)?i[c]={id:l.getInstanceId()}:eW(l)&&(i[c]||(i[c]={}),t.serializeObjectProperty(l,i[c],0))}return i},t.deserialize=function(e,i){for(var r,n=i.taggedProperties,s=iu(i),a=i.engine,o=iR(Object.keys(e));!(r=o()).done;){var u=r.value;if(!s||!s[u]){var h=e[u];n[u]=t.deserializeProperty(h,a,0)}}if(s)for(var c,l=iR(Object.keys(s));!(c=l()).done;){var f=c.value,d=e[f];if(void 0!==d){var p=s[f].type;i[f]=t.deserializeProperty(d,a,0,p)}}i.fromData(n)},t.deserializeAsync=function(e,r){return i(function(){var i,n,s,o,u,h,c,l,f,d,p,m;return a(this,function(a){switch(a.label){case 0:i=r.taggedProperties,n=iu(r),s=r.engine,o=iR(Object.keys(e)),a.label=1;case 1:if((u=o()).done)return[3,4];if(h=u.value,n&&n[h])return[3,3];return c=e[h],[4,t.deserializePropertyAsync(c,s,0)];case 2:i[h]=a.sent(),a.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];l=iR(Object.keys(n)),a.label=5;case 5:if((f=l()).done)return[3,8];if(void 0===(p=e[d=f.value]))return[3,7];return m=n[d].type,[4,t.deserializePropertyAsync(p,s,0,m)];case 6:r[d]=a.sent(),a.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}})})()},t.checkTypedArray=function(t){return r(t,Int8Array)||r(t,Uint8Array)||r(t,Uint8ClampedArray)||r(t,Int16Array)||r(t,Uint16Array)||r(t,Int32Array)||r(t,Uint32Array)||r(t,Float32Array)||r(t,Float64Array)||r(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eW(t)&&1===Object.keys(t).length&&"id"in t&&ej(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eW(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eZ(t)||r(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eH(e)){for(var s,a=[],o=iR(e);!(s=o()).done;){var u=s.value;a.push(t.deserializeProperty(u,i,r+1,n))}return a}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!eW(e)||e.constructor!==Object)return e;h=n?new n:{};for(var h,c,l=iR(Object.keys(e));!(c=l()).done;){var f=c.value;h[f]=t.deserializeProperty(e[f],i,r+1)}return h},t.deserializePropertyAsync=function(e,r,n,s){return i(function(){var i,o,u,h,c,l,f,d,p;return a(this,function(a){switch(a.label){case 0:if(n>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eH(e))return[3,5];i=[],o=iR(e),a.label=1;case 1:if((u=o()).done)return[3,4];return h=u.value,c=i.push,[4,t.deserializePropertyAsync(h,r,n+1,s)];case 2:c.apply(i,[a.sent()]),a.label=3;case 3:return[3,1];case 4:return[2,i];case 5:if(!t.checkDataPath(e))return[3,7];return[4,r.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,a.sent()];case 7:if(!(eW(e)&&e.constructor===Object))return[3,12];l=s?new s:{},f=iR(Object.keys(e)),a.label=8;case 8:if((d=f()).done)return[3,11];return p=d.value,[4,t.deserializePropertyAsync(e[p],r,n+1)];case 9:l[p]=a.sent(),a.label=10;case 10:return[3,8];case 11:return[2,l];case 12:return[2,e];case 13:return[2]}})})()},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var n,s=iR(Object.keys(e));!(n=s()).done;){var a=n.value,o=e[a];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[a]=o:eH(o)?(i[a]||(i[a]=[]),t.serializeArrayProperty(o,i[a],r+1)):ic.is(o)?i[a]={id:o.getInstanceId()}:eW(o)&&(i[a]||(i[a]={}),t.serializeObjectProperty(o,i[a],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[n]=s:eH(s)?(i[n]||(i[n]=[]),t.serializeArrayProperty(s,i[n],r+1)):ic.is(s)?i[n]={id:s.getInstanceId()}:eW(s)&&(i[n]||(i[n]={}),t.serializeObjectProperty(s,i[n],r+1))}},t}(),aK=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.reusable=!1,t.sceneBindings=[],t.graph=new sb,t}e9(i,e);var s=i.prototype;return s.onStart=function(){this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tD.destroy&&this.setReusable(!0)},s.setReusable=function(e){for(var n,s=iR(this.timelineAsset.tracks);!(n=s()).done;){var a=n.value.boundObject;if(r(a,t.VFXItem)){var o=a.getComponent(i);o&&o.setReusable(e)}}},s.getReusable=function(){return this.reusable},s.onUpdate=function(t){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.graph.evaluate(t)},s.createContent=function(){if(this.item.composition)for(var e,r=iR(this.items);!(e=r()).done;){var n=e.value;if(n.composition=this.item.composition,t.VFXItem.isComposition(n)){this.item.composition.refContent.push(n);var s=n.props.content.options.refId,a=this.item.composition.refCompositionProps.get(s);if(!a)throw Error("Referenced precomposition with Id: "+s+" does not exist.");var o=n.addComponent(i);aq.deserialize(a,o),o.createContent();for(var u,h=iR(o.items);!(u=h()).done;){var c=u.value;c.setInstanceId(eQ());for(var l,f=iR(c.components);!(l=f()).done;)l.value.setInstanceId(eQ())}}}},s.onEnable=function(){for(var t,e=iR(this.items);!(t=e()).done;)t.value.setActive(!0)},s.onDisable=function(){for(var t,e=iR(this.items);!(t=e()).done;)t.value.setActive(!1)},s.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},s.hitTest=function(e,i,r,s,a,o){for(var u,h=[],c=(null==o?void 0:o.stop)||eX,l=(null==o?void 0:o.skip)||eX,f=(null==o?void 0:o.maxCount)||this.items.length,d=0;d<this.items.length&&s.length<f;d++){var p=(u=this,function(n){var o=u.items[n];if(o.isActive&&o.transform.getValid()&&!t.VFXItem.isComposition(o)&&!l(o)){var f=o.getHitTestParams(a);if(f){var d=!1,p=new iT;if(f.type===t.HitTestType.triangle)for(var m=f.triangles,v=f.backfaceCulling,y=0;y<m.length;y++){var g=m[y];if(e.intersectTriangle(g,p,v)){d=!0,h.push(p);break}}else if(f.type===t.HitTestType.box){var x=f.center,b=f.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:E},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,A=f.radius;e.intersectSphere({center:_,radius:A},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new ib(i,r));S&&S.length>0&&(S.forEach(function(t){h.push(t)}),d=!0)}if(d){var C={compContent:u.item,id:o.id,name:o.name,position:h[h.length-1],parentId:o.parentId,hitPositions:h,behavior:f.behavior};if(o.emit("click",C),s.push(C),c(C))return{v:s}}}}}(d));if("object"===n(p))return p.v}return s},s.fromData=function(t){var i;e.prototype.fromData.call(this,t),this.items=t.items,this.startTime=null!=(i=t.startTime)?i:0,this.sceneBindings=t.sceneBindings,this.timelineAsset=t.timelineAsset},s.resolveBindings=function(){for(var t,e=iR(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=iR(this.timelineAsset.tracks);!(r=n()).done;){var s=r.value;this.updateTrackAnimatedObject(s)}},s.updateTrackAnimatedObject=function(t){for(var e,i=iR(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(id),aQ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();r(e,aK)&&(e.time=this.getTime())},e}(sT),aJ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(r(e,aK)){for(var i=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){i=!0;break}i?e.item.setActive(!0):e.item.setActive(!1)}},e}(sT),a$=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){var i=!1,n=e[this.propertyName];if(r(n,iE)){n.setZero();for(var s=0;s<this.getInputCount();s++){var a=this.getInputWeight(s);if(a>0){var o=this.getInput(s);if(!r(o,aW)){console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");continue}var u=o.value;n.x+=u.x*a,n.y+=u.y*a,n.z+=u.z*a,n.w+=u.w*a,i=!0}}i&&(e[this.propertyName]=n)}}},e}(sT),a0=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){var i=!1,n=e[this.propertyName];if(r(n,rR)){n.setZero();for(var s=0;s<this.getInputCount();s++){var a=this.getInputWeight(s);if(a>0){var o=this.getInput(s);if(!r(o,aW)){console.error("ColorPropertyMixerPlayable received incompatible input");continue}var u=o.value;n.r+=u.r*a,n.g+=u.g*a,n.b+=u.b*a,n.a+=u.a*a,i=!0}}i&&(e[this.propertyName]=n)}}},e}(sT),a1=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}e9(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);s([ih(void 0,void 0)],a1.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new aZ(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(a1),t.FloatPropertyTrack=s([io(t3.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(t.TrackAsset),t.SpriteColorTrack=s([io(t3.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var n=i.prototype;return n.updateAnimatedObject=function(){if(!this.parent||!r(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(aK)},n.createTrackMixer=function(t){return new aJ(t)},i}(t.TrackAsset),t.SubCompositionTrack=s([io(t3.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(t.TrackAsset),t.TransformTrack=s([io(t3.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.updateAnimatedObject=function(){r(this.parent.boundObject,ip)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),s([ih(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=s([io("MaterialTrack")],t.MaterialTrack),t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new a$(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(a1),t.Vector4PropertyTrack=s([io(t3.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new a0(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(a1),t.ColorPropertyTrack=s([io(t3.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new aW(t);return e.curve=nK(this.curveData),e.value=e.curve.getValue(0),e},e}(s_),s([ih(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=s([io(t3.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new aW(t);return e.curve=nK(this.curveData),e.value=e.curve.getValue(0),e},e}(s_),s([ih(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=s([io(t3.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new aQ(t)},e}(s_),t.SubCompositionPlayableAsset=s([io(t3.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset);var a2=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t.cacheFlattenedTracks=null,t}e9(i,e);var n=i.prototype;return n.createPlayable=function(e){var i=new a3(e);i.setTraversalMode(es.Passthrough);for(var n,s=iR(this.tracks);!(n=s()).done;){var a=n.value;r(a,t.ObjectBindingTrack)&&a.create(this)}return this.sortTracks(this.tracks),i.compileTracks(e,this.flattenedTracks),i},n.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},n.invalidate=function(){this.cacheFlattenedTracks=null},n.addSubTracksRecursive=function(t,e){for(var i,r=iR(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var s,a=iR(t.getChildTracks());!(s=a()).done;){var o=s.value;this.addSubTracksRecursive(o,e)}},n.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new a4(t[i],i));e.sort(a5),t.length=0;for(var r,n=iR(e);!(r=n()).done;){var s=r.value;t.push(s.track)}},n.fromData=function(t){},ii(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=iR(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(s_),s([ih(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=s([io(t3.TimelineAsset)],t.TimelineAsset);var a3=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}e9(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=iR(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},n=iR(e);!(i=n()).done;){var s=i.value,a=s.createPlayableGraph(t,this.clips);this.addInput(a,0);var o=s.createOutput();o.setUserData(s.boundObject),t.addOutput(o),o.setSourcePlayable(this,this.getInputCount()-1);var u=new a2(s,a,o);r[s.getInstanceId()]=u,s.parent||this.masterTrackInstances.push(u)}for(var h,c=iR(e);!(h=c()).done;)for(var l,f=h.value,d=r[f.getInstanceId()],p=iR(f.getChildTracks());!(l=p()).done;){var m=r[l.value.getInstanceId()];d.addChild(m)}},e}(sT),a4=function(t,e){this.track=t,this.originalIndex=e};function a5(e,i){var n=e.track.boundObject,s=i.track.boundObject;return r(n,t.VFXItem)&&r(s,t.VFXItem)?t.VFXItem.isAncestor(n,s)?-1:t.VFXItem.isAncestor(s,n)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}function a6(t,e){return e&&("object"===n(e)||"function"==typeof e)?e:iA(t)}t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new aW(t);return e.curve=nK(this.curveData),e.value=e.curve.getValue(0),e},e}(s_),s([ih(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=s([io("Vector4PropertyPlayableAsset")],t.Vector4PropertyPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var n=i.prototype;return n.updateAnimatedObject=function(){},n.create=function(e){if(r(this.boundObject,t.VFXItem)){var i=this.boundObject;if(i.getComponent(t.ParticleSystem)){var n=e.createTrack(t.TrackAsset,this,"ParticleTrack");n.boundObject=this.boundObject;var s=n.createClip(aw);s.start=i.start,s.duration=i.duration,s.endBehavior=i.endBehavior}}},i}(t.TrackAsset),t.ObjectBindingTrack=s([io(t3.ObjectBindingTrack)],t.ObjectBindingTrack);var a8=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tW.display:r,s=t.textBaseline,a=void 0===s?tZ.top:s,o=t.textAlign,u=void 0===o?tq.left:o,h=t.text,c=t.letterSpace,l=void 0===c?0:c,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+l),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=l,this.overFlow=n,this.textBaseline=a,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,s=t.fontScale,a=(i-r)/3,o=r+n*s,u=i*(e-1),h=0;switch(this.textBaseline){case tZ.top:h=o+a;break;case tZ.middle:h=(this.height*s-u+o)/2;break;case tZ.bottom:h=this.height*s-u-a}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tq.left:i=t.outlineWidth*t.fontScale;break;case tq.middle:i=(this.width*t.fontScale-e)/2;break;case tq.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),a9=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,s,a,o=t.textColor,u=t.fontSize,h=t.outline,c=t.shadow,l=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===o?[1,1,1,1]:o,this.textWeight=void 0===l?"normal":l,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===d?"sans-serif":d,this.fontSize=void 0===u?40:u,h&&(this.isOutlined=!0,this.outlineColor=null!=(e=h.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=h.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),c&&(this.hasShadow=!0,this.shadowBlur=null!=(r=c.shadowBlur)?r:2,this.shadowColor=null!=(n=c.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=c.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(a=c.shadowOffsetY)?a:0),this.fontStyle!==tQ.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},a7=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return ez(t),t}if(sF[sL])return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?eb(this.elements,t):t.remove()},t}()),ot=["serif","sans-serif","monospace","courier"],oe=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+oe++,r.geometry=r.createGeometry(ik.TRIANGLES),i&&r.fromData(i),r.canvas=a7.getCanvas(),a7.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),r.setItem(),!i)return a6(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e9(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,s,a,o,u=e.interaction,h=e.options,c=e.listIndex,l=e.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tM.MESH,blending:null!=(r=l.blending)?r:tE.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tA.MASK,side:null!=(s=l.side)?s:t_.DOUBLE,mask:null!=(a=l.mask)?a:0,maskMode:null!=(o=l.maskMode)?o:tA.NONE,order:void 0===c?0:c},this.interaction=u,this.updateWithOptions(h),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(nJ),t.TextComponent=s([io(t3.TextComponent)],t.TextComponent);var oi=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new a9(t),this.textLayout=new a8(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout.letterSpace,n=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,s=this.textLayout.width+this.textStyle.fontOffset,a=1,o=0,u=0;u<t.length;u++){var h,c,l=t[u],f=(null!=(c=null==i?void 0:null==(h=i.measureText(l))?void 0:h.width)?c:0)*n;((o+=r)+f>s&&u>0||"\n"===l)&&(a++,o=0),"\n"!==l&&(o+=f)}return a},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(this.textStyle.fontFamily===t&&!eU(t)){console.warn("The font is either the current font or an risky font family.");return}this.textStyle.fontFamily=t,this.isDirty=!0},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,s=(r.width+i.fontOffset)*n,a=r.lineHeight*this.lineCount,o=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=s,r.autoWidth?(this.canvas.height=a*n,this.item.transform.size.set(1,a/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.clearRect(0,0,s,h),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),e.fillRect(0,0,s,h),i.fontDesc=this.getFontDesc(),e.font=i.fontDesc,i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var c=[],l=0,f=r.getOffsetY(i,this.lineCount,u,o),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=r.letterSpace*n)+y.width>s&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:d,charOffsetX:p}),l=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(l),l+=y.width)}c.push({y:f,width:l,chars:d,charOffsetX:p}),c.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,s){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[s],t.y),e.fillText(r,n+t.charOffsetX[s],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("_MainTex",rs.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:ik.LINEAR,minFilter:ik.LINEAR,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE})),this.isDirty=!1}},e.getFontDesc=function(){var t=this.textStyle,e=t.fontSize,i=t.fontScale,r=t.fontFamily,n=t.textWeight,s=t.fontStyle,a=""+(e*i).toString()+"px ";return ot.includes(r)?a+=r:a+='"'+r+'"',n!==tK.normal&&(a=n+" "+a),s!==tQ.normal&&(a=s+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],s=i[1],a=i[2],o=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*a+", "+o+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,a=i[0],o=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*a+", "+255*o+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();e$(t.TextComponent,[oi]);var or=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),on=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.fromData=function(t){},e}(ic),s([ih(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=s([io(t3.BinaryAsset)],t.BinaryAsset);var os=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var i,r=this.findData(e);if(!r){console.error("Object data with uuid: "+e+" not found.");return}switch(r.dataType){case t3.Material:i=ry.create(this.engine);break;case t3.Geometry:i=r_.create(this.engine);break;case t3.Texture:i=rs.create(this.engine);break;default:var n=t.getClass(r.dataType);n&&(i=new n(this.engine))}if(!i){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return i.setInstanceId(r.id),this.engine.addInstance(i),aq.deserialize(r,i),i},e.loadGUIDAsync=function(e){var r=this;return i(function(){var i,n,s;return a(this,function(a){switch(a.label){case 0:if(r.engine.objectInstance[e])return[2,r.engine.objectInstance[e]];if(i=r.findData(e))return[3,2];if(!r.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,r.engine.database.loadGUID(e)];case 1:if(!(n=a.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return r.engine.addInstance(n),[2,n];case 2:switch(i.dataType){case t3.Material:n=ry.create(r.engine);break;case t3.Geometry:n=r_.create(r.engine);break;case t3.Texture:n=rs.create(r.engine);break;default:(s=t.getClass(i.dataType))&&(n=new s(r.engine))}if(!n)return console.error("Constructor for DataType: "+i.dataType+" not found."),[2,void 0];return n.setInstanceId(i.id),r.engine.addInstance(n),[4,aq.deserializeAsync(i,n)];case 3:return a.sent(),[2,n]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return ia[t]},t}(),oa=function(){function t(){}return t.prototype.loadGUID=function(t){return i(function(){return a(this,function(t){return[2,void 0]})})()},t}();function oo(t,e){if(!t.includes(e))return t.push(e),!0}function ou(t){if(Number.isFinite(t))return[tV.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tV.CONSTANT)return[tV.CONSTANT,t[1]];if("lines"===e)return[tV.LINE,t[1]];if(e===tV.LINE){var r=i.map(function(t){return[tN.LINE,t]});return[tV.BEZIER_CURVE,r]}return"curve"===e||e===tV.CURVE?[tV.BEZIER_CURVE,oS(i)]:t}}function oh(t,e){return Array.isArray(t)&&"random"===t[0]?[tV.CONSTANT,t[1][e]]:ou(t)}function oc(t){return t&&"color"===t[0]?od(t[1],!0):[1,1,1,1]}function ol(t){return t&&"random"===t[0]?[tV.RANDOM,t[1]]:ou(t)}function of(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,s=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,a=od(t[r],e);i.push([s,a[0],a[1],a[2],a[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tV.GRADIENT_COLOR,i]}}function od(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var n=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(n){var s=+n[4];i=[+n[1],+n[2],+n[3],isNaN(s)?255:Math.round(255*s)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),255])}else r(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=op(i)),i}function op(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function om(t,e){return Array.isArray(t)?t[0]===tV.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&of(t[1],e):of(t,e)}function ov(t){if(t){if(3===t.length)return[tV.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tV.BEZIER_PATH||e===tV.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],s=i[2],a=oS(r);if(!s){s=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o||o<n.length-1&&s.push(u),s.push(u)}}return[tV.BEZIER_CURVE_PATH,[a,n,s]]}return t}}function oy(t){for(var e,i=iR(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function og(t){for(var e,i=iR(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var ox=Math.cos,ob=Math.sin,oT=Math.PI/180,oE=180/Math.PI;function o_(t,e){return t?[t[0]-.5,.5-t[1]]:e?oA[e]:[0,0]}var oA=((eo={})[tI.PARTICLE_ORIGIN_CENTER]=[0,0],eo[tI.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eo[tI.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eo[tI.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eo[tI.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eo[tI.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eo[tI.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eo[tI.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eo[tI.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eo);function oS(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var a=t[s][3]*(e-i),o=t[s+1][2]*(e-i),u=[t[s][0],t[s][1]],h=[t[s+1][0],t[s+1][1]];if(u[0]!=h[0]){var c=function(t,e,i,r){var n=i[0],s=i[1],a=r[0],o=r[1],u=a-n;return[[n+(a-n)/3,s+(t*=u)/3],[a-(a-n)/3,o-(e*=u)/3]]}(a,o,u,h),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[tN.EASE_OUT,t]:e===n.length-1?[tN.EASE_IN,t]:[tN.EASE,t]})}function oC(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tO.null&&t.endBehavior===tD.destroy&&(t.endBehavior=tD.freeze)})}),t.version="2.1",t}function ow(t){for(var e,i=iW({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=iR(i.images);!(e=r()).done;)e.value.id=eQ();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eQ(),t.dataType=t3.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:eQ(),dataType:t3.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(s=t.bins,i.bins=s.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eQ()}}));for(var s,a,o={},u={},h=iR(t.compositions);!(a=h()).done;)!function(){var t=a.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tD.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tO.particle&&t.content.filter&&delete t.content.filter});for(var e,r=iR(t.items);!(e=r()).done;){var n=e.value;o[n.id]=eQ(),n.oldId=n.id,n.id=o[n.id],u[n.id]=n}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],s=e.parentId.split("^")[1];e.parentId=o[n]+"^"+s}else e.parentId=o[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var s=iW({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(s),function(t,e,i){for(var r,n=[],s=[],a=[],o={tracks:[],id:eQ(),dataType:"TimelineAsset"},u=iR(t.items);!(r=u()).done;){var h=e[r.value.id],c=[],l={id:eQ(),dataType:"ActivationPlayableAsset"};a.push(l);var f={id:eQ(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:l.id}}]};if(c.push({id:f.id}),s.push(f),h.type!==tO.particle){var d={id:eQ(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};a.push(d);var p={id:eQ(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};c.push({id:p.id}),s.push(p)}if(h.type===tO.sprite||h.type===tO.text){var m={id:eQ(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};a.push(m);var v={id:eQ(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};c.push({id:v.id}),s.push(v)}if(h.type===tO.composition){var y={id:eQ(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:eQ(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};c.push({id:g.id}),s.push(g)}var x={id:eQ(),dataType:"ObjectBindingTrack",children:c,clips:[]};s.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=iR(s);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var A,S=iR(s);!(A=S()).done;){var C=A.value;i.miscs.push(C)}for(var w,R=iR(a);!(w=R()).done;){var O=w.value;i.miscs.push(O)}}(s,u,i)}();for(var c,l=iR(i.items);!(c=l()).done;){var f=c.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tO.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tO.sprite){var g,x,b,T,E,_,A,S=f.content;S.renderer||(S.renderer={});var C=S.renderer,w=o_(C.anchor,C.particleOrigin),R=f.transform.size;C.anchor||void 0===C.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(T=null==R?void 0:R.x)?T:1),f.transform.position.y+=-w[1]*(null!=(E=null==R?void 0:R.y)?E:1)),f.transform.anchor={x:w[0]*(null!=(_=null==R?void 0:R.x)?_:1),y:w[1]*(null!=(A=null==R?void 0:R.y)?A:1)}}}if(f.type===tO.particle){var O=f.content;O.renderer||(O.renderer={});var M=O.renderer;O.renderer.anchor=o_(M.anchor,M.particleOrigin)}if(f.type===tO.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var I=f.pn,P=t.plugins,L=void 0===P?[]:P;void 0!==I&&Number.isInteger(I)&&(f.pluginName=L[I])}switch("editor-gizmo"===f.pluginName&&(f.type="editor-gizmo"),"orientation-transformer"===f.pluginName&&(f.type="orientation-transformer"),f.content.options.target&&"editor-gizmo"===f.pluginName&&(f.content.options.target=o[f.content.options.target]),f.type===tO.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,i),(f.type===tO.sprite||f.type===tO.particle||f.type===tO.mesh||f.type===tO.skybox||f.type===tO.light||"camera"===f.type||f.type===tO.tree||f.type===tO.interact||f.type===tO.camera||f.type===tO.text||f.type===tO.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eQ(),f.content.item={id:f.id},f.dataType=t3.VFXItemData,f.components.push({id:f.content.id})),(f.type===tO.null||f.type===tO.composition)&&(f.components=[],f.dataType=t3.VFXItemData),f.type){case tO.sprite:f.content.dataType=t3.SpriteComponent;break;case tO.particle:f.content.dataType=t3.ParticleSystem;break;case tO.mesh:f.content.dataType=t3.MeshComponent;break;case tO.skybox:f.content.dataType=t3.SkyboxComponent;break;case tO.light:f.content.dataType=t3.LightComponent;break;case"camera":f.content.dataType=t3.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tO.tree:f.content.dataType=t3.TreeComponent;break;case tO.interact:f.content.dataType=t3.InteractComponent;break;case tO.camera:f.content.dataType=t3.CameraController;break;case tO.text:f.content.dataType=t3.TextComponent;break;case tO.spine:f.content.dataType=t3.SpineComponent}}return i.version="3.0",i}function oR(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},s={path:ov(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:ou(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:ou(n.linearX),linearY:ou(n.linearY),linearZ:ou(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:ou(n.orbitalX),orbitalY:ou(n.orbitalY),orbitalZ:ou(n.orbitalZ),speedOverLifetime:ou(n.speedOverLifetime)};og(s);var a={options:{startColor:oc(r.startColor)},positionOverLifetime:s};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=a.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=ou(o.x),u.y=ou(o.y),u.z=ou(o.z)):u.z=ou(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=a.colorOverLifetime={opacity:ou(h.opacity)};h.color&&(c.color=om(h.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:ou(l.size),x:ou(l.x),y:ou(l.y),z:ou(l.z)}),a}var oO=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,oM=/^(\d+)\.(\d+)$/,oI=!1;function oP(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(c=(h=t).version)?void 0:c.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||h.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tO.mesh||t.type===tO.light)&&(t.endBehavior=1===t.endBehavior?tD.destroy:t.endBehavior)})}),oO.test(t.version)){var e,i,r,n,s,a,o,u;return oI=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",ow(oC((oL="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(oL="1.3"),s=(e.requires||[]).slice(),a=e.images.map(function(t,i){return oF(t,i,e.imageTags||[])}),o=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:oL,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return oV(t,{plugins:n,requires:s})}),images:a,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:o,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u)))}oI=!1;var h,c,l,f,d,p=oM.exec(t.version)||[],m=Number(p[1]),v=Number(p[2]);if(m)return(m<2||2===m&&v<4)&&((d=t).compositions.map(function(t){for(var e,i=iR(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=iR(Object.keys(e));!(i=r()).done;){var n=i.value,s=e[n],a=Array.isArray(s);a&&2===s.length&&Array.isArray(s[1])?"path"===n?e[n]=ov(s):e[n]=ou(s):a||"object"!=typeof s||t(s)}})(e.value.content)}),t=d),m<3?ow(oC(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var oL="1.0";function oF(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eQ(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eQ(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eQ(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eQ(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function oV(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iW({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return oD(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var s=null==(i=t.meta)?void 0:i.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(r.previewSize=s),r}var oN=[0,0,0,1];function oD(t,e){void 0===e&&(e={});var i=tO.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tO.plugin,m=t.pn,p=t.pluginName,f=t.content,l=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),c=t.transform||b(l.transform)):t.particle?(i=tO.particle,c=b((l=t.particle).transform,oI,!0),f=function(t){var e=t.options,i=t.transform,r={type:tS.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iW({},t.shape,{type:tS[s]}),t.shape.upDirection){var a=t.shape.upDirection,o=a[0],u=a[1],h=a[2];0===o&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=ol(e.turbulenceX),r.turbulenceY=ol(e.turbulenceY),r.turbulenceZ=ol(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return oy(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return oy(t)})),c.rateOverTime&&(c.rateOverTime=ol(c.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:c,options:{startLifetime:ol(e.startLifetime),start3DSize:!!e.start3DSize,startSize:ol(e.startSize),startSizeX:ol(e.startSizeX),startSizeY:ol(e.startSizeY),sizeAspect:ol(e.sizeAspect),maxCount:e.maxCount,startDelay:ol(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tV.COLORS,t[1].map(function(t){return od(t,e)})]:"gradient"===t[0]?of(t[1],e):"color"===t[0]?[tV.RGBA_COLOR,od(t[1],e)]:t}(e.startColor,!0),startRotationZ:ol(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=ol(e.startRotationX),l.options.startRotationY=ol(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:ov(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:ol(f.x),y:ol(f.y)}:l.sizeOverLifetime={size:ol(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?ou(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:ou(e.gravityModifier),startSpeed:ol(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:ol(d.linearX),linearY:ol(d.linearY),linearZ:ol(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:ol(d.orbitalX),orbitalY:ol(d.orbitalY),orbitalZ:ol(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:ou(d.forceCurve)},og(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:ol(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=ou(m.y),l.rotationOverLifetime.x=ou(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:ou(v.opacity)};v.color&&(y.color=om(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:ou(g.cycles),animationDelay:oh(g.animationDelay,0),animationDuration:oh(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:ol(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:ou(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&om(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&om(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:ol(x.opacityOverLifetime)}),l.trails&&og(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(l)):t.sprite?(i=tO.sprite,c=b((l=t.sprite).transform,!1,!0),o=oR(a=l,c),(u=a.textureSheetAnimation)&&(o.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),o.renderer=a.renderer,a.splits&&(o.splits=a.splits),a.interaction&&(o.interaction=a.interaction),f=o):t.cal?(i=tO.null,c=b((l=t.cal).transform,!1,!0),f=oR(l,c)):t.ui?(i=tO.interact,c=b((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tw.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&oc(i.previewColor),behavior:i.behavior||tR.NOTIFY};break;case"drag":e={type:tw.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tw.MESSAGE}}return{options:e}}(l),c.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tO.camera,c=b(l.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,s,a={path:ov(null==(s=t.transform)?void 0:s.path),linearX:ou(null==r?void 0:r.translateX),linearY:ou(null==r?void 0:r.translateY),linearZ:ou(null==r?void 0:r.translateZ)};og(a),i.positionOverLifetime=a}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:ou(null==o?void 0:o.rotateX),y:ou(null==o?void 0:o.rotateY),z:o.separateAxes?ou(null==o?void 0:o.rotateZ):ou(o.rotation)};og(u),i.rotationOverLifetime=u}return i}(l))),null==(h=f.renderer)?void 0:h.anchor){var s=new Float32Array(f.renderer.anchor);.5==s[0]&&.5==s[1]?delete f.renderer.anchor:e.requires&&oo(e.requires,"anchor")}if(l){var a,o,u,h,c,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tD.restart:tD.destroy:tD.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tD.destroy,l.options.renderLevel&&(d=l.options.renderLevel),isNaN(n)&&(n=l.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:c,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(oo(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var s,a,o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R,O=(s=r.rotation[0],a=r.rotation[1],o=r.rotation[2],u=ox(s*oT/2),h=ox(a*oT/2),c=ox(o*oT/2),l=ob(s*oT/2),f=ob(a*oT/2),d=ob(o*oT/2),oN[0]=l*h*c+u*f*d,oN[1]=u*f*c-l*h*d,oN[2]=u*h*d+l*f*c,oN[3]=u*h*c-l*f*d,oN);r.rotation=(p=[],m=O[0],v=O[1],y=O[2],g=O[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,A=v*b,S=y*T,C=g*T,w=y*x-g*b,p[1]=Math.asin((R=-w)>1?1:R<-1?-1:R)*oE,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-A)*oE,p[2]=Math.atan2(_+C,1-A-S)*oE):(p[0]=0,p[2]=Math.atan2(-(_-C),1-E-S)*oE),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var ok=((eu={})[tT.S]=[tT.S,tT.BPlus,tT.APlus],eu[tT.A]=[tT.A,tT.BPlus,tT.APlus],eu[tT.B]=[tT.B,tT.BPlus],eu);function oz(t,e){if(!t||!e)return!0;var i=ok[e];return!!i&&i.includes(t)}function oU(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},s=n.name,a=n.url;return s&&(e&&e[s]?i=e[s]:a&&(i=a)),i}function oB(t,e,i){return oG.apply(this,arguments)}function oG(){return(oG=i(function(t,e,i){var n,s;return a(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,i1(t)];case 1:return n=a.sent(),[3,3];case 2:n=t,a.label=3;case 3:if(!n)throw Error("Image not provided.");if(!e)return[2,n];if(s=oU(e,i)){if(ej(s)&&s!==n.src)return[2,i1(s)];if(r(s,HTMLImageElement))return[2,s]}return[2,n]}})})).apply(this,arguments)}t.Scene=void 0,(ty=t.Scene||(t.Scene={})).isJSONObject=function(t){return eW(t)&&"jsonScene"in t},ty.isURL=function(t){return eW(t)&&"url"in t},ty.isWithOptions=function(t){return eW(t)&&"options"in t};var oX=1,oj=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iZ),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=oX++,this.timers=[],this.updateOptions(t)}var n=e.prototype;return n.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},n.loadScene=function(e,r,n){var s=this;return i(function(){var o,u,h,c,l,f,d,p,m,v,y,g;return a(this,function(x){return u=ej(e)?e:s.id,h=performance.now(),c=[],d=null!=(f=null==(l=null==r?void 0:r.engine.gpuCapability)?void 0:l.detail.compressedTexture)?f:t.COMPRESSED_TEXTURE.NONE,p={},v=!1,y=new Promise(function(t,e){m=window.setTimeout(function(){v=!0,s.removeTimer(m),e(Error("Load time out: totalTime: "+(performance.now()-h).toFixed(4)+"ms "+c.join(" ")+", url: "+u+"."))},1e3*s.timeout),s.timers.push(m)}),g=i(function(t,e){var i,r,n;return a(this,function(s){switch(s.label){case 0:if(v)return[3,4];i=performance.now(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e()];case 2:return r=s.sent(),n=performance.now()-i,c.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+s.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([y,i(function(){var i,l,f,v,y,x,b,T,E,_,A,S,C,w,R,O,M,I,P,L;return a(this,function(a){switch(a.label){case 0:if(!ej(e))return[3,2];return l=new URL(e,location.href).href,s.baseUrl=l,[4,g("loadJSON",function(){return s.loadJSON(l)})];case 1:return o=a.sent(),[3,3];case 2:o=e,s.baseUrl=location.href,a.label=3;case 3:if(!t.Scene.isJSONObject(o))return[3,5];return f=(i=iW({},o)).jsonScene,v=i.pluginSystem,y=i.images,x=f.compositions,b=f.images,s.assignImagesToAssets(b,y),[4,Promise.all([g("plugin:processAssets",function(){return s.processPluginAssets(f,v,n)}),g("plugin:precompile",function(){return s.precompile(x,v,r,n)})])];case 4:return a.sent(),[3,10];case 5:return[4,g("processJSON",function(){return s.processJSON(o)})];case 6:return E=(T=a.sent()).jsonScene,_=T.pluginSystem,S=void 0===(A=E.bins)?[]:A,C=E.images,w=E.compositions,R=E.fonts,[4,Promise.all([g("processBins",function(){return s.processBins(S)}),g("processImages",function(){return s.processImages(C,d)}),g("plugin:processAssets",function(){return s.processPluginAssets(E,_,n)}),g("plugin:precompile",function(){return s.precompile(w,_,r,n)}),g("processFontURL",function(){return s.processFontURL(R)})])];case 7:return M=(O=a.sent())[0],I=O[1],[4,g("processTextures",function(){return s.processTextures(I,M,E)})];case 8:return P=a.sent(),i={timeInfos:p,url:e,renderLevel:s.options.renderLevel,storage:{},pluginSystem:_,jsonScene:E,bins:M,images:I,textureOptions:P},[4,g("plugin:prepareResource",function(){return _.loadResources(i,s.options)})];case 9:a.sent(),a.label=10;case 10:return[4,g("prepareAssets",function(){return s.prepareAssets(null==r?void 0:r.engine)})];case 11:return a.sent(),L=performance.now()-h,eG.info("Load asset: totalTime: "+L.toFixed(4)+"ms "+c.join(" ")+", url: "+u+"."),window.clearTimeout(m),s.removeTimer(m),i.totalTime=L,i.startTime=h,i.timeInfos=p,[2,i]}})})()])]})})()},n.precompile=function(t,e,r,n){return i(function(){return a(this,function(i){switch(i.label){case 0:if(!r||!r.getShaderLibrary())return[2];return[4,e.precompile(t,r,n)];case 1:return i.sent(),[2]}})})()},n.processJSON=function(t){var e=this;return i(function(){var i,r,n;return a(this,function(s){switch(s.label){case 0:return[4,(n=new e4(void 0===(r=(i=oP(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return s.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},n.processBins=function(t){var e=this;return i(function(){var i,n;return a(this,function(s){return i=e.options.renderLevel,n=e.baseUrl,[2,Promise.all(t.map(function(s){if(r(s,ArrayBuffer))return s;if(oz(s.renderLevel,i))return e.loadBins(new URL(s.url,n).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},n.processFontURL=function(t){var r=this;return i(function(){return a(this,function(n){return t?[2,Promise.all(t.map(i(function(t){var i,n,s;return a(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];eU(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),i=new URL(t.fontURL,r.baseUrl).href,[4,(s=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")")).load()];case 2:return a.sent(),document.fonts.add(s),e.fontCache.add(t.fontFamily),[3,4];case 3:return a.sent(),eG.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},n.processImages=function(e,n){void 0===n&&(n=0);var s=this;return i(function(){var o,u,h,c,l;return a(this,function(f){switch(f.label){case 0:return u=(o=s.options).useCompressedTexture,h=o.variables,c=s.baseUrl,[4,Promise.all(e.map(i(function(e,i){var o,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R,O,M;return a(this,function(i){switch(i.label){case 0:if(o=e.url,l=e.webp,f=e.avif,d=new URL(o,c).href,p=l&&new URL(l,c).href,m=f&&new URL(f,c).href,v=e.id,!("template"in e))return[3,8];if(!(g=(y=e.template).background))return[3,7];x=oU(y,h),b=g.type===t1.video,T=g&&b?i6:i1,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,i9(x,T)];case 2:if(!r(E=i.sent(),HTMLVideoElement))return[3,3];return s.sourceFrom[v]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return g&&Array.isArray(x)&&h&&(h[g.name]=E.src),s.sourceFrom[v]={url:E.src,type:t.TextureSourceType.image},[4,oB(E,y,h)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw _=i.sent(),Error("Failed to load. Check the template or if the URL is "+(b?"video":"image")+" type, URL: "+x+", Error: "+(_.message||_)+".");case 7:return[3,9];case 8:if("compressed"in e&&u&&n){if(A=e.compressed,n===t.COMPRESSED_TEXTURE.ASTC?S=A.astc:n===t.COMPRESSED_TEXTURE.PVRTC&&(S=A.pvrtc),S)return C=new URL(S,c).href,s.sourceFrom[v]={url:C,type:t.TextureSourceType.compressed},[2,s.loadBins(C)]}else if(r(e,HTMLImageElement)||r(e,HTMLCanvasElement)||r(e,HTMLVideoElement)||r(e,rs))return[2,e];i.label=9;case 9:if(!m)return[3,11];return[4,i$(d,m)];case 10:return M=i.sent(),[3,13];case 11:return[4,iQ(d,p)];case 12:M=i.sent(),i.label=13;case 13:return R=(w=M).url,O=w.image,s.sourceFrom[v]={url:R,type:t.TextureSourceType.image},[2,O]}})})))];case 1:return l=f.sent(),s.assignImagesToAssets(e,l),[2,l]}})})()},n.processPluginAssets=function(t,e,r){var n=this;return i(function(){var i,s,o,u;return a(this,function(a){switch(a.label){case 0:return[4,e.processAssets(t,r)];case 1:for(s=(i=a.sent().reduce(function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t},{assets:[],loadedAssets:[]})).assets,o=i.loadedAssets,u=0;u<s.length;u++)n.assets[s[u].id]=o[u];return[2]}})})()},n.prepareAssets=function(t){var e=this;return i(function(){var i,r,n,s,o;return a(this,function(a){if(!t)return[2];for(i=iR(Object.keys(e.assets));!(r=i()).done;)n=r.value,s=e.assets[n],(o=new on(t)).data=s,o.setInstanceId(n),t.addInstance(o);return[2]})})()},n.processTextures=function(e,n,s){var o=this;return i(function(){var u;return a(this,function(h){return[2,Promise.all((null!=(u=s.textures)?u:e.map(function(t,e){return{source:e}})).map(i(function(e,i){var u,h,c,l,f;return a(this,function(a){switch(a.label){case 0:if(r(e,rs))return[2,e];if(!("mipmaps"in e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,rt(e,n,o.assets,s.bins)];case 2:return[2,a.sent()];case 3:throw Error("Load texture "+i+" fails, error message: "+a.sent()+".");case 4:if(u=e.source,h=e.id,l="",!eW(u))return[3,5];return c=o.assets[u.id],l=u.id,[3,7];case 5:if("string"!=typeof u)return[3,7];return[4,i1(eJ(u))];case 6:c=a.sent(),a.label=7;case 7:if(c)return[2,(f=function(e,i,n){var s={id:n,dataType:t3.Texture};if(r(e,rs))return iW({},e.source,s);if(r(e,HTMLImageElement)||eZ(e))return iW({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:ik.LINEAR,magFilter:ik.LINEAR},s);if(r(e,HTMLVideoElement))return iW({sourceType:t.TextureSourceType.video,video:e,minFilter:ik.LINEAR,magFilter:ik.LINEAR},s);if(r(e,ArrayBuffer))return iW({},rl(e),{sourceFrom:i},s);if("width"in e&&"height"in e&&"data"in e)return iW({sourceType:t.TextureSourceType.data,data:e,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE,minFilter:ik.NEAREST,magFilter:ik.NEAREST},s);throw Error("Invalid texture options.")}(c,o.sourceFrom[l],h)).sourceType===t.TextureSourceType.compressed?f:iW({},f,e)];throw Error("Invalid texture source: "+u+".")}})})))]})})()},n.loadJSON=function(t){var e=this;return i(function(){return a(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},n.loadBins=function(t){var e=this;return i(function(){return a(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},n.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},n.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},n.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();oj.fontCache=new Set;var oH=new iT(1,1,1),oY=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=iC.fromIdentity(),this.viewMatrix=iC.fromIdentity(),this.projectionMatrix=iC.fromIdentity(),this.viewProjectionMatrix=iC.fromIdentity(),this.inverseViewMatrix=iC.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,s=e.aspect,a=e.clipMode,o=void 0===a?tF.portrait:a,u=e.position,h=e.rotation;this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===s?1:s,clipMode:o,position:iT.fromArray(void 0===u?[0,0,8]:u),rotation:rS.fromArray(void 0===h?[0,0,0]:h)},this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new iT(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var s=i.projectPoint(e).z,a=r.projectPoint(new iT(1,1,s)),o=a.x,u=a.y,h=r.projectPoint(new iT(-1,-1,s));return new iT((o-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0),this.dirty&&this.setRotationByQuat(t)},e.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new iS;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},e.getOptions=function(){return this.options},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,s=t.aspect,a=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=s,this.position=a,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,s=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*im,i,r,n,s===tF.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(a,this.getQuat(),oH),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){sC.getRotation(t,this.options.rotation)},ii(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)}},{key:"rotation",get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)}}]),t}(),oW=0,oZ=function(){function t(t,e){this.refCompositionProps=new Map,this.imgUsage={},this.mask=0,this.refCompositions=new Map,this.engine=e;var i=t.jsonScene,r=t.renderLevel,n=t.textureOptions,s=t.pluginSystem,a=t.totalTime,o=i.compositions,u=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var h,c=iR(o);!(h=c()).done;){var l=h.value;l.id===u?this.composition=l:this.refCompositions.set(l.id,l)}if(!this.composition)throw Error("Invalid composition id: "+u+".");this.jsonScene=i,this.renderLevel=r,this.pluginSystem=s,this.totalTime=null!=a?a:0,this.textures=n,oW=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=iW({},t);return this.assembleItems(e),isNaN(e.endBehavior)&&(e.endBehavior=tD.freeze),e.startTime||(e.startTime=0),e},e.assembleItems=function(t){this.mask++;var e={},i=[];if(this.jsonScene){for(var r,n=iR(this.jsonScene.components);!(r=n()).done;){var s=r.value;e[s.id]=s}for(var a,o=iR(t.items);!(a=o()).done;){var u=a.value,h=this.engine.jsonSceneData[u.id];if(oz(h.renderLevel,this.renderLevel)){if(h.listIndex=oW++,h.type===tO.sprite||h.type===tO.particle||h.type===tO.spine||h.type===tO.shape)for(var c,l=iR(h.components);!(c=l()).done;){var f=e[c.value.id];this.preProcessItemContent(f)}if(h.type===tO.composition){var d=h.content.options.refId,p=this.refCompositions.get(d);if(!p)throw Error("Invalid ref composition id: "+d+".");var m=this.getContent(p);this.refCompositionProps.has(d)||this.refCompositionProps.set(d,m)}i.push(u)}}t.items=i}},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),"mask"in t.renderer||this.processMask(t.renderer);var e,i,r=t.splits&&!t.textureSheetAnimation?t.splits[0]:void 0,n=t.renderer.shape;Number.isInteger(n)?e=null==(i=this.jsonScene)?void 0:i.shapes[n]:n&&(e=n),void 0===e||"aPoint"in e&&"index"in e||(t.renderer.shape=an(e,r))}"trails"in t&&void 0!==t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,i=null!=(e=this.imgUsage)?e:{};t&&i&&(Object.prototype.hasOwnProperty.call(i,t)||(i[t]=0),i[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tA.NONE&&(t.mask||(e===tA.MASK?t.mask=++this.mask:e!==tA.OBSCURED&&e!==tA.REVERSE_OBSCURED||(t.mask=this.mask)))},e.dispose=function(){this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}(),oq=function(){function t(){this.update=new oQ,this.lateUpdate=new oJ}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==il.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==il.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==il.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==il.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),oK=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),oQ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iR(t);!(i=r()).done;)i.value.onUpdate(e)},e}(oK),oJ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iR(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(oK),o$=function(e){function r(i,r){(n=e.call(this)||this).sceneTicking=new oq,n.speed=1,n.isEnded=!1,n.loaderData={},n.refContent=[],n.refCompositionProps=new Map,n.postProcessingEnabled=!1,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.lastVideoUpdateTime=0,n.isEndCalled=!1;var n,s,a,o,u=i.reusable,h=void 0!==u&&u,c=i.speed,l=i.baseRenderOrder,f=i.renderer,d=i.event,p=i.width,m=i.height,v=i.handleItemMessage;n.compositionSourceManager=new oZ(r,f.engine),h&&(n.keepResource=!0,r.textures=void 0,r.consumed=!0);var y=n.compositionSourceManager,g=y.sourceContent,x=y.pluginSystem,b=y.imgUsage,T=y.totalTime,E=y.refCompositionProps;return n.postProcessingEnabled=null!=(a=null==(s=r.jsonScene.renderSettings)?void 0:s.postProcessingEnabled)&&a,ez(g),n.renderer=f,n.refCompositionProps=E,n.rootItem=new t.VFXItem(n.getEngine(),g),n.rootItem.name="rootItem",n.rootItem.composition=iA(n),n.rootComposition=n.rootItem.addComponent(aK),n.width=p,n.height=m,n.renderOrder=void 0===l?0:l,n.id=g.id,n.renderer=f,n.texInfo=h?{}:b,n.event=d,n.statistic={loadStart:null!=(o=r.startTime)?o:0,loadTime:null!=T?T:0,compileTime:0,firstFrameTime:0},n.reusable=h,n.speed=void 0===c?1:c,n.autoRefTex=!n.keepResource&&n.texInfo&&n.rootItem.endBehavior!==tD.restart,n.name=g.name,n.pluginSystem=x,n.pluginSystem.initializeComposition(iA(n),r),n.camera=new oY(n.name,iW({},null==g?void 0:g.camera,{aspect:p/m})),n.url=r.url,n.assigned=!0,n.interactive=!0,n.handleItemMessage=v,n.createRenderFrame(),n.rendererOptions=null,aq.deserialize(g,n.rootComposition),n.rootComposition.createContent(),n.buildItemTree(n.rootItem),n.pluginSystem.resetComposition(iA(n),n.renderFrame),n}e9(r,e);var n=r.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(t){this.renderOrder=t},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(t){this.speed=t},n.setVisible=function(t){this.rootItem.setVisible(t)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},n.pause=function(){this.paused=!0},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1},n.gotoAndPlay=function(t){this.setTime(t),this.resume()},n.gotoAndStop=function(t){this.setTime(t),this.pause()},n.createRenderFrame=function(){this.renderFrame=new r3({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},n.setTime=function(t){var e=this.speed,i=this.paused;i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&this.pause(),this.emit("goto",{time:t})},n.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},n.forwardTime=function(t){for(var e=1e3*t-1e3*this.rootComposition.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},n.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},n.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},n.update=function(t){if(this.assigned&&!this.paused){var e=this.getUpdateTime(t*this.speed);this.updateRootComposition(e/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay()),this.sceneTicking.update.tick(e),this.sceneTicking.lateUpdate.tick(e),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tD.destroy&&!this.reusable},n.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},n.callAwake=function(t){for(var e,i=iR(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,s=iR(t.children);!(n=s()).done;){var a=n.value;this.callAwake(a)}},n.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(aK).items,s=iR(n);!(i=s()).done;){var a=i.value;r.set(a.id,a)}for(var o,u=iR(n);!(o=u()).done;){var h=o.value;if(void 0===h.parentId)h.setParent(e);else{var c=r.get(h.parentId);if(c)h.parent=c,h.transform.parentTransform=c.transform,c.children.push(h);else throw Error("The element references a non-existent element, please check the data.")}}for(var l,f=iR(n);!(l=f()).done;){var d=l.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},n.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach(function(t){return null==t?void 0:t.uploadCurrentVideoFrame()}),this.lastVideoUpdateTime=e)},n.updateCamera=function(){this.camera.updateMatrix()},n.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},n.updateRootComposition=function(t){if(this.rootComposition.isActiveAndEnabled){var e=parseFloat((this.time+t-this.rootItem.start).toFixed(3)),i=!1,r=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-r>.001)switch(i=!0,n){case tD.restart:e%=r,this.restart();break;case tD.freeze:e=Math.min(r,e);case tD.forward:case tD.destroy:}this.rootComposition.time=e,this.isEnded!==i&&(i?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.getItemByName=function(t){return this.rootItem.find(t)},n.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return nd((t-i.z)/r,(e-i.w)/n,this.camera)},n.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},n.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,s=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(aK))||n.hitTest(a,t,e,s,i,r),this.refContent.forEach(function(n){var o;null==(o=n.getComponent(aK))||o.hitTest(a,t,e,s,i,r)}),s},n.addInteractiveItem=function(t,e){if(e===tw.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},n.removeInteractiveItem=function(t,e){e===tw.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},n.destroyTextures=function(e){for(var i=0;i<e.length;i++){var r,n=e[i];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose();continue}!this.autoRefTex||--this.texInfo[n.getInstanceId()]||n.dispose()}}},n.destroyItem=function(t){var e=this;t.type==tO.composition?t.endBehavior!==tD.freeze&&t.getComponent(aK).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(eT(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},n.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},n.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},s=this.textures;s&&this.keepResource&&s.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eX)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eG.error("Update disposed composition: "+r.name+".")},this.dispose=eX,s&&this.keepResource&&s.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==nW&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},n.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},n.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},n.translate=function(t,e,i){this.rootItem.translate(t,e,i)},n.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},n.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},n.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},n.scale=function(t,e,i){this.rootItem.scale(t,e,i)},n.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},n.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},n.reloadTexture=function(){var t=this;return i(function(){return a(this,function(e){switch(e.label){case 0:if(!t.textureOffloaded)return[3,2];return[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},ii(r,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),r}(sw),o0=new Int32Array(2),o1=new Float32Array(o0.buffer),o2=new Float64Array(o0.buffer),o3=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tg=eh||(eh={}))[tg.UTF8_BYTES=1]="UTF8_BYTES",tg[tg.UTF16_STRING=2]="UTF16_STRING";var o4=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return o0[0]=this.readInt32(t),o1[0]},e.readFloat64=function(t){return o0[o3?0:1]=this.readInt32(t),o0[o3?1:0]=this.readInt32(t+4),o2[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){o1[0]=e,this.writeInt32(t,o0[0])},e.writeFloat64=function(t,e){o2[0]=e,this.writeInt32(t,o0[o3?0:1]),this.writeInt32(t+4,o0[o3?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===eh.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),o5=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=o4.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,s=this.space;e:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var o=2;o<r;o+=2)if(this.bb.readInt16(s+o)!=this.bb.readInt16(a+o))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(r(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=o4.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),o6=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new o8(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),o8=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=o6.createDataVector(t,this.data);return o6.createFBEffectsObjectData(t,e,i)},t}(),o9=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new o6).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new o7(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),o7=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=o9.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return o9.createFBEffectsPackageData(t,e)},t}(),ut=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new ue(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),ue=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return ut.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ui=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new ur(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,s,a){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),ur=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return ui.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),un=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new ui).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new us(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),us=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=un.createChannelsVector(t,t.createObjectOffsetList(this.channels));return un.createFBVertexData(t,this.vertexCount,e)},t}(),ua=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new un).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new uo(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),uo=function(){function t(t,e,i,r,n,s,a,o,u,h,c,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===a&&(a=0),void 0===o&&(o=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===c&&(c=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=s,this.mode=a,this.buffer=o,this.binaryData=u,this.boneNames=h,this.rootBoneName=c,this.inverseBindMatrices=l}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=ua.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,a=ua.createBinaryDataVector(t,this.binaryData),o=ua.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=ua.createInverseBindMatricesVector(t,this.inverseBindMatrices);return ua.startFBGeometryData(t),ua.addId(t,e),ua.addName(t,i),ua.addVertexData(t,r),ua.addIndexFormat(t,this.indexFormat),ua.addIndexOffset(t,this.indexOffset),ua.addSubMeshes(t,n),ua.addMode(t,this.mode),ua.addBuffer(t,s),ua.addBinaryData(t,a),ua.addBoneNames(t,o),ua.addRootBoneName(t,u),ua.addInverseBindMatrices(t,h),ua.endFBGeometryData(t)},t}(),uu=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new o5(1),i=new o7,r=[],n=iR(this.exportObjectDatas);!(t=n()).done;){var s=t.value,a=void 0;s.dataType===t3.Geometry&&(a=new o8("Geometry",this.geometryDataToBinary(s))),a&&r.push(a)}return i.exportObjects=r,o9.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new o4(t),i=o9.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var s=n.dataArray(),a=n.dataType();if(s){var o=void 0;a===t3.Geometry&&(o=this.binaryToGeometryData(s)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new o5(1),i=new uo,r=t.indexFormat,n=t.indexOffset,s=t.mode,a=t.id,o=t.vertexData,u=t.boneNames,h=t.rootBoneName,c=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=s,i.id=a,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===c?[]:c,i.binaryData=void 0===l?[]:l;var f=new us;f.vertexCount=o.vertexCount,f.channels=[];for(var d,p=iR(o.channels);!(d=p()).done;){var m=d.value,v=new ur(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=iR(t.subMeshes);!(y=x()).done;){var b=y.value,T=new ue(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,o9.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,s=new o4(t),a=ua.getRootAsFBGeometryData(s),o={vertexCount:0,channels:[]},u=a.vertexData();if(u){o.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var c,l=u.channels(h);if(l){var f={semantic:null!=(c=l.semantic())?c:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};o.channels.push(f)}}}for(var d=[],p=0;p<a.subMeshesLength();p++){var m=a.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<a.boneNamesLength();g++){var x=a.boneNames(g);y.push(x)}var b=a.inverseBindMatricesArray();return{vertexData:o,indexFormat:a.indexFormat(),indexOffset:a.indexOffset(),subMeshes:d,mode:a.mode(),buffer:null!=(e=a.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=a.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=a.binaryDataArray())?r:void 0,id:null!=(n=a.id())?n:"",dataType:t3.Geometry}},t}(),uh=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new os(this),this.emptyTexture=ru(this),this.transparentTexture=rh(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.getInstance=function(t){return this.objectInstance[t]},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=i.items,s=i.materials,a=i.shaders,o=i.geometries,u=i.components,h=i.animations,c=i.bins,l=void 0===c?[]:c,f=i.miscs,d=iR(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=iR(void 0===s?[]:s);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=iR(void 0===a?[]:a);!(g=x()).done;){var b=g.value;this.addEffectsObjectData(b)}for(var T,E=iR(void 0===o?[]:o);!(T=E()).done;){var _=T.value;this.addEffectsObjectData(_)}for(var A,S=iR(void 0===u?[]:u);!(A=S()).done;){var C=A.value;this.addEffectsObjectData(C)}for(var w,R=iR(void 0===h?[]:h);!(w=R()).done;){var O=w.value;this.addEffectsObjectData(O)}for(var M,I=iR(void 0===f?[]:f);!(M=I()).done;){var P=M.value;this.addEffectsObjectData(P)}for(var L=0;L<l.length;L++){var F=l[L],V=t.bins[L];if(F.dataType===t3.BinaryAsset)F.buffer=V,F.id&&this.addEffectsObjectData(F);else{var N=new uu;N.deserializeFromBinary(new Uint8Array(V));for(var D,k=iR(N.exportObjectDatas);!(D=k()).done;){var z=D.value;this.addEffectsObjectData(z)}}}for(var U,B=iR(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return i(function(){var i,r,n,s;return a(this,function(a){switch(a.label){case 0:i=iR(t.jsonScene.items),a.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(s=(n=r.value).type)||"camera"===s||s===tO.sprite||s===tO.particle||s===tO.mesh||s===tO.skybox||s===tO.light||s===tO.tree||s===tO.interact||s===tO.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:a.sent(),a.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||eb(this.textures,t)},e.removeTexture=function(t){this.destroyed||eT(this.textures,t)},e.addMaterial=function(t){this.destroyed||eb(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eT(this.materials,t)},e.addGeometry=function(t){this.destroyed||eb(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eT(this.geometries,t)},e.addMesh=function(t){this.destroyed||eb(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eT(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||eb(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eT(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&eG.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach(function(t){return t.dispose()}),this.meshes.forEach(function(t){return t.dispose()}),this.geometries.forEach(function(t){return t.dispose()}),this.materials.forEach(function(t){return t.dispose()}),this.textures.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},ii(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),uc=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=ix(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++)(0,this.tickers[e])(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},ii(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();e3("camera",si,t.VFXItem,!0),e3("text",or,t.VFXItem,!0),e3("sprite",sx,t.VFXItem,!0),e3("particle",aF,t.VFXItem,!0),e3("cal",aV,t.VFXItem,!0),e3("interact",sh,t.VFXItem,!0),eG.info("Core version: 2.1.3-alpha.2.");var ul=((ec={})[ik.RGBA]=34842,ec[ik.RGB]=34843,ec[ik.ALPHA]=33325,ec[ik.RED]=33325,ec[ik.LUMINANCE_ALPHA]=33327,ec[ik.LUMINANCE]=33325,ec),uf=((el={})[ik.RGBA]=34836,el[ik.RGB]=34837,el[ik.ALPHA]=33326,el[ik.RED]=33326,el[ik.LUMINANCE_ALPHA]=33328,el[ik.LUMINANCE]=33326,el),ud=function(e){function r(t,i){var r;return(r=e.call(this,t)||this).initialized=!1,i&&r.fromData(i),r}e9(r,e);var n=r.prototype;return n.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,s=i.name;this.textureBuffer=e.createTexture(),ug(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},n.clone=function(){var t=new r(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.update=function(e){var i,r,n,s,a,o=this;if(!this.pipelineContext||!this.textureBuffer){this.width=0,this.height=0;return}var u=this.target,h=this.source,c=this.pipelineContext.gl,l=this.engine.gpuCapability.detail,f=h.sourceType,d=h.data,p=h.cube,m=h.image,v=h.video,y=h.mipmaps,g=h.mipmaps,x=e.data,b=e.cube,T=e.generateMipmap,E=e.mipmaps,_=h.format,A=h.type,S=h.internalFormat,C=0,w=0;(this.bind(f===t.TextureSourceType.video),A===ik.HALF_FLOAT?((A=l.halfFloatTexture)||eG.error("Half float texture is not support."),iU(c)&&S===_&&(_===ik.LUMINANCE&&(_=ik.RED),S=ul[_]),l.halfFloatLinear||(h.minFilter=h.magFilter=c.NEAREST,eG.warn("Half float linear not support, change to NEAREST."))):A!==c.FLOAT||((A=l.floatTexture)||eG.error("Float texture is not support."),iU(c)&&S===_&&(_===ik.LUMINANCE&&(_=ik.RED),S=uf[_]),l.floatLinear||(h.minFilter=c.NEAREST,h.magFilter=c.NEAREST,eG.warn("Float linear not support, change to NEAREST."))),void 0===h.premultiplyAlpha&&(h.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),void 0===h.flipY&&(h.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,h.flipY),f===t.TextureSourceType.framebuffer)?x&&(C=null!=(i=x.width)?i:0,w=null!=(r=x.height)?r:0,C&&w&&(this.width!==C||this.height!==w)&&c.texImage2D(u,0,S,C,w,0,_,A,null)):f===t.TextureSourceType.data?u===c.TEXTURE_CUBE_MAP?b.forEach(function(t,e){var i=o.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),r=i[0],n=i[1];C=Math.max(r,C),w=Math.max(n,w)}):(C=(n=this.texImage2DData(c,u,0,S,_,A,d))[0],w=n[1]):f===t.TextureSourceType.image||f===t.TextureSourceType.video?(u===c.TEXTURE_CUBE_MAP?p.forEach(function(t,e){var i=o.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),r=i[0],n=i[1];C=Math.max(r,C),w=Math.max(n,w)}):u===c.TEXTURE_2D&&(C=(s=this.texImage2D(c,u,0,S,_,A,null!=m?m:v))[0],w=s[1]),T&&(up(C)&&up(w)||iU(c))&&c.generateMipmap(u)):f===t.TextureSourceType.mipmaps?u===c.TEXTURE_2D?y.forEach(function(t,e){if(a="data"in t?o.texImage2DData(c,u,e,S,_,A,t):o.texImage2D(c,u,e,S,_,A,t),0===e){var i;C=(i=a)[0],w=i[1]}}):u===c.TEXTURE_CUBE_MAP&&g.forEach(function(t,e){t.forEach(function(t,i){if(a="data"in t?o.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,A,t):o.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,A,t),0===e){var r;C=(r=a)[0],w=r[1]}})}):f===t.TextureSourceType.compressed&&E&&0!==E.length&&(C=E[0].width,w=E[0].height,E.forEach(function(t,e){c.compressedTexImage2D(u,e,S,t.width,t.height,0,t.data)})),this.width=C,this.height=w,this.setTextureFilters(c,u,h)},n.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=i.wrapS,s=void 0===n?t.CLAMP_TO_EDGE:n,a=i.wrapT,o=void 0===a?t.CLAMP_TO_EDGE:a,u=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&u.setTextureAnisotropic(t,this.target,void 0===r?4:r);var h=iU(t)||up(this.width)&&up(this.height),c=i.magFilter?i.magFilter:t.NEAREST,l=i.minFilter?i.minFilter:t.NEAREST;h||l!==t.LINEAR_MIPMAP_LINEAR&&l!==t.LINEAR_MIPMAP_NEAREST&&l!==t.NEAREST_MIPMAP_LINEAR&&l!==t.NEAREST_MIPMAP_NEAREST||(l=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,l),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,h?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,h?o:t.CLAMP_TO_EDGE)},n.fromData=function(t){e.prototype.fromData.call(this,t);var i=this.assembleOptions(t),r=i.sourceType,n=i.sourceFrom,s=i.name;this.source=i,this.sourceType=r,this.sourceFrom=n,this.name=void 0===s?"":s,this.guid=t.id},n.texImage2D=function(e,i,r,n,s,a,o){var u,h=this,c=this.source,l=c.sourceType,f=c.minFilter,d=c.magFilter,p=c.wrapS,m=c.wrapT,v=null!=(u=this.engine.gpuCapability.detail.maxTextureSize)?u:2048,y=o;if(l!==t.TextureSourceType.video){var g=f!==e.NEAREST||d!==e.NEAREST||p!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||o.width>v||o.height>v)&&setTimeout(function(){y=h.resizeImage(o)})}e.texImage2D(i,r,n,s,a,y);var x=[y.width,y.height];return l===t.TextureSourceType.video?[o.videoWidth,o.videoHeight]:x},n.texImage2DData=function(t,e,i,r,n,s,a){var o=a.data,u=a.width,h=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,h,0,n,s,c),[u,h]},n.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;return iU(this.pipelineContext.gl)&&t.width<n&&t.height<n?t:function(t,e,i,r){var n=t.width,s=t.height,a=Math.min(e,i||nf(n)),o=Math.min(e,r||nf(s));if(o!==s||a!==n){var u=a7.getCanvas(),h=u.getContext("2d");return u.width=a,u.height=o,null==h||h.drawImage(t,0,0,n,s,0,0,a,o),eG.warn("Image resize from "+n+"x"+s+" to "+a+"x"+o+"."),u}}(t,n,e,i)||t},n.reloadData=function(){var t=this;return i(function(){return a(this,function(e){switch(e.label){case 0:if(!t.offloaded)return[3,2];return[4,rd().reload(t)];case 1:e.sent(),e.label=2;case 2:return[2]}})})()},n.offloadData=function(){if(this.initialized&&rd().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.uploadCurrentVideoFrame=function(){var e=this;return i(function(){return a(this,function(i){return e.source.sourceType===t.TextureSourceType.video&&e.source.video&&e.initialized?(e.update({video:e.source.video}),[2,!0]):[2,!1]})})()},n.updateSource=function(t){this.source=this.assembleOptions(iW({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.restore=function(){},n.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){eG.error("This texture has been destroyed.")},this.initialize=eK,void 0!==this.engine&&this.engine.removeTexture(this)},r}(rs);function up(t){return(t&t-1)==0&&0!==t}var um=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return iU(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),ug(e,t),e},e.bindVertexArray=function(t){if(iU(this.gl))this.gl.bindVertexArray(t);else{var e;null==(e=this.vaoExt)||e.bindVertexArrayOES(t)}},e.dispose=function(){if(iU(this.gl))this.gl.deleteVertexArray(this.vao);else{var t;null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)}},t}(),uv=1,uy=function(){function e(e){this.engine=e,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var i={width:1,height:1,data:new Uint8Array([255])},r=e.getGLPipelineContext(),n=r.gl;this.gl=n,this.pipelineContext=r,this.emptyTexture2D=new ud(e,{data:i,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new ud(e,{target:n.TEXTURE_CUBE_MAP,cube:[i,i,i,i,i,i],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+uv,uv++}var i=e.prototype;return i.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},i.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},i.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&eb(this.renderbuffers,t),e},i.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach(function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)}))},i.drawGeometry=function(t,e,i){if(!this.gl){console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.");return}var r=e.shaderVariant.program;if(r){var n=r.setupAttributes(t),s=this.gl,a=t.indicesBuffer,o=t.drawStart,u=t.drawCount,h=t.mode,c=t.subMeshes;if(c&&c.length){var l,f=c[i];if(u<0)return;o=f.offset,u=a?null!=(l=f.indexCount)?l:0:f.vertexCount}a?s.drawElements(h,u,a.type,null!=o?o:0):s.drawArrays(h,o,u),null==n||n.unbind()}},i.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();return i&&(eb(this.framebuffers,t),ug(i,e,e)),i},i.createVAO=function(t){return new um(this.engine,t)},i.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),eT(this.textures,t),delete t.textureBuffer)},i.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},i.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),eT(this.framebuffers,t),delete t.fbo)},i.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),eT(this.renderbuffers,t),delete t.buffer)},i.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach(function(e){return t.deleteGLFramebuffer(e)}),this.framebuffers.length=0,this.renderbuffers.forEach(function(e){return t.deleteGLRenderbuffer(e)}),this.renderbuffers.length=0,this.textures.forEach(function(e){return t.deleteGLTexture(e)}),this.textures.length=0)},i.lost=function(t){eG.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},i.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},ii(e,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function ug(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var ux=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i,r,n=e.name,s=e.data,a=e.elementCount,o=e.target,u=void 0===o?ik.ARRAY_BUFFER:o,h=e.type,c=void 0===h?ik.FLOAT:h,l=e.usage,f=void 0===l?ik.STATIC_DRAW:l,d=null!=(r=null==(i=ub[c])?void 0:i.BYTES_PER_ELEMENT)?r:0;this.target=u,this.type=c,this.usage=f,this.glBuffer=this.createGLBuffer(n),this.bytesPerElement=d,s?this.bufferData(s):a&&this.bufferData(d*a)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return ug(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;i.bindBuffer(r,this.glBuffer),s>this.byteLength&&(this.byteLength=s,i.bufferData(r,s,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!iU(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},ii(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ub=((ef={})[ik.INT]=Int32Array,ef[ik.FLOAT]=Float32Array,ef[ik.SHORT]=Int16Array,ef[ik.BYTE]=Int8Array,ef[ik.UNSIGNED_BYTE]=Uint8Array,ef[ik.UNSIGNED_INT]=Uint32Array,ef[ik.UNSIGNED_SHORT]=Uint16Array,ef),uT=((ed={})[Uint8Array.BYTES_PER_ELEMENT]=ik.UNSIGNED_BYTE,ed[Uint16Array.BYTES_PER_ELEMENT]=ik.UNSIGNED_SHORT,ed[Uint32Array.BYTES_PER_ELEMENT]=ik.UNSIGNED_INT,ed),uE=1,u_=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}e9(e,t);var i=e.prototype;return i.getOptions=function(){return iW({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;ez(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach(function(e){t.buffers[e]=new ux(i,t.bufferProps[e])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(void 0!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,s=i.target;this.bufferProps[r]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(void 0!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(void 0!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&void 0!=r.data){var n=e+i.length;if(r.data.length<n){var s=new i.constructor(n);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,e)),void 0!==a.end&&(a.end=Math.max(a.end,n-1))}r.data.set(i,e),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(r(t,Uint8Array)||r(t,Uint16Array)||r(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t+e.length;if(this.indices.length<r){var n=new e.constructor(r);n.set(this.indices),this.indices=n,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;void 0!==s.start&&(s.start=Math.min(s.start,t)),void 0!==s.end&&(s.end=Math.max(s.end,r-1))}null==(i=this.indices)||i.set(e,t),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*rE[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=uT[e.BYTES_PER_ELEMENT];return new ux(t,{data:e,target:ik.ELEMENT_ARRAY_BUFFER,type:i,name:""+this.name+"##index"})},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach(function(n){var s,a,o=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,a=r;else{var u=e[n].dataSource;s=t.buffers[u],a=i[u].data}if((o.dirty||o.discard)&&s&&a){if(o.discard)s.bufferData(a);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=o.end-o.start+1,l=new a.constructor(a.buffer,h,c);s.bufferSubData(o.start,l)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(r){var n=t.attributesReleasable[r],s=e[r].dataSource;i[s]&&n&&(i[s].data=void 0)}),this.indicesReleasable}},i.processProps=function(t){var e=t.drawStart,i=t.drawCount,n=t.mode,s=t.indices,a=t.name,o=void 0===a?"effectsGeometry:"+uE++:a,u=t.bufferUsage,h=void 0===u?ik.STATIC_DRAW:u;this.name=o;var c={},l=[],f={},d={},p={};this.drawStart=void 0===e?0:e,void 0!==i&&(this.drawCount=i),this.mode=isNaN(n)?ik.TRIANGLES:n,Object.keys(t.attributes).forEach(function(e){var i=t.attributes[e],n=i.size,s=i.stride,a=i.offset,o=i.normalize,u=i.type,m=void 0===u?ik.FLOAT:u,v=i.releasable,y=i.data;if(!m||"dataSource"in i||y||(y=rA(m)),y){var g=r(y,Float32Array)?ik.FLOAT:ik.INT;c[e]={data:y,usage:h,target:ik.ARRAY_BUFFER,name:e},f[e]={size:n,stride:s,offset:a,type:null!=m?m:g,normalize:!!o,dataSource:e},p[e]=null!=v&&v,d[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(f[e]={size:n,stride:s,offset:a,type:m,dataSource:x,normalize:!!o})}l.push(e)}),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=(null==s?void 0:s.releasable)===!0,this.bufferProps=c,this.attributes=f,this.attributesName=l,this.attributesReleasable=p,this.dirtyFlags=d,this.options=t,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:ik.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(t){var e,a=null!=(e=uA[t.semantic])?e:t.semantic,o=r.createVertexTypedArray(t,i,n);s.attributes[a]={type:iG(t.format),size:t.dimension,data:o,normalize:t.normalize}}),e.indexFormat!==t6.None){var a=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:a},s.drawCount=a.length}else s.drawCount=n;this.processProps(s)}else{var o=e.vertexData.channels[0],u=e.vertexData.channels[1],h=e.vertexData.channels[2],c=this.createVertexTypedArray(o,i,n),l=this.createVertexTypedArray(u,i,n),f=this.createVertexTypedArray(h,i,n),d=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),p={mode:ik.TRIANGLES,attributes:{aPos:{type:iG(o.format),size:3,data:c,normalize:o.normalize},aUV:{type:iG(u.format),size:2,data:l,normalize:u.normalize},aNormal:{type:iG(h.format),size:3,data:f,normalize:h.normalize}}};p.indices={data:d},p.drawCount=d.length,this.processProps(p)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach(function(t){e.buffers[t].dispose()}),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach(function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0}),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case t5.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case t6.UInt16:return new Uint16Array(r,e.byteOffset+i);case t6.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach(function(t){t.semantic&&t.semantic.length>0&&(e=!0)}),e},ii(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(r_),uA={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},uS=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.colorMask[0]!==e||this.colorMask[1]!==i||this.colorMask[2]!==r||this.colorMask[3]!==n)&&(this.colorMask[0]=e,this.colorMask[1]=i,this.colorMask[2]=r,this.colorMask[3]=n)},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[ik.ONE,ik.ONE_MINUS_SRC_ALPHA,ik.ONE,ik.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[ik.FUNC_ADD,ik.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=ik.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[ik.ALWAYS,ik.ALWAYS],this.stencilOpFail=[ik.KEEP,ik.KEEP],this.stencilOpZFail=[ik.KEEP,ik.KEEP],this.stencilOpZPass=[ik.KEEP,ik.KEEP],this.culling=!1,this.frontFace=ik.CCW,this.cullFace=ik.FRONT},e.apply=function(t){if(t.toggle(ik.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(ik.BLEND,this.blending),t.toggle(ik.DEPTH_TEST,this.depthTest),t.toggle(ik.STENCIL_TEST,this.stencilTest),t.toggle(ik.CULL_FACE,this.culling),t.toggle(ik.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(ik.BACK,this.stencilMask[1]),t.stencilMaskSeparate(ik.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(ik.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(ik.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(ik.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(ik.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),uC=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirty=!0,n.macrosDirty=!0,n.glMaterialState=new uS,r&&(n.shader=new t.Shader(i),n.shader.shaderData=iW({},r.shader,{id:eQ(),dataType:t3.Shader})),n}e9(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!eY(i.initialize)){eG.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var i=t.engine.getGLPipelineContext(),r=this.shaderVariant;if(!r.program){null==(n=this.engine)||n.renderErrors.add(Error("Shader program is not initialized."));return}if(r.program.bind(),this.setupStates(i),e){for(var n,s,a,o=iR(e.uniforms);!(a=o()).done;)s=a.value,this.checkUniform(s);for(var u,h=iR(e.samplers);!(u=h()).done;)s=u.value,this.samplers.includes(s)||(this.samplers.push(s),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(s in e.floats)r.setFloat(s,e.floats[s]);for(s in e.ints)r.setInt(s,e.ints[s]);for(s in e.vector4s)r.setVector4(s,e.vector4s[s]);for(s in e.vector3s)r.setVector3(s,e.vector3s[s]);for(s in e.matrices)r.setMatrix(s,e.matrices[s])}for(s in this.textures)this.textures[s].textureBuffer||this.textures[s].initialize();for(s in this.floats)r.setFloat(s,this.floats[s]);for(s in this.ints)r.setInt(s,this.ints[s]);for(s in this.floatArrays)r.setFloats(s,this.floatArrays[s]);for(s in this.textures)r.setTexture(s,this.textures[s]);for(s in this.vector2s)r.setVector2(s,this.vector2s[s]);for(s in this.vector3s)r.setVector3(s,this.vector3s[s]);for(s in this.vector4s)r.setVector4(s,this.vector4s[s]);for(s in this.colors)r.setColor(s,this.colors[s]);for(s in this.quaternions)r.setQuaternion(s,this.quaternions[s]);for(s in this.matrices)r.setMatrix(s,this.matrices[s]);for(s in this.matrice3s)r.setMatrix3(s,this.matrice3s[s]);for(s in this.vector4Arrays)r.setVector4Array(s,this.vector4Arrays[s]);for(s in this.matrixArrays)r.setMatrixArray(s,this.matrixArrays[s])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=iR(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=iR(e);!(i=r()).done;)for(var n=i.value,s=0;s<16;s++)this.matrixArrays[t].push(n.elements[s])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;ez(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new uS,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=iW({},t);void 0!==t.stringTags.RenderType&&(this.blending=t.stringTags.RenderType===tP.Transparent),void 0!==t.floats.ZTest&&(this.depthTest=0!==t.floats.ZTest),void 0!==t.floats.ZWrite&&(this.depthMask=0!==t.floats.ZWrite);var s=t.stringTags.RenderFace;for(i in s===tL.Front?(this.culling=!0,this.cullFace=ik.BACK):s===tL.Back?(this.culling=!0,this.cullFace=ik.FRONT):this.culling=!1,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var a=n.vector4s[i];this.setVector4(i,new iE(a.x,a.y,a.z,a.w))}for(i in n.colors){var o=n.colors[i];this.setColor(i,new rR(o.r,o.g,o.b,o.a))}for(i in n.textures){var u=n.textures[i];this.setTexture(i,u.texture);var h=u.offset,c=u.scale;h&&c&&this.setVector4(i+"_ST",new iE(c.x,c.y,h.x,h.y))}t.shader&&(this.shader=t.shader,this.shaderSource=this.shader.shaderData),this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.taggedProperties;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=t3.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var a=t.textures[s],o=this.getVector4(s+"_ST");o&&(a.scale={x:o.x,y:o.y},a.offset={x:o.z,y:o.w},delete t.vector4s[s+"_ST"])}return t},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new iE(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],s=0;s<t.matrixArrays[e].length;s+=16){for(var a=iC.fromIdentity(),o=0;o<16;o++)a.elements[o]=t.matrixArrays[e][s+o];n.push(a)}this.setMatrixArray(e,n)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(e){var i,r=this;this.destroyed||(null==(i=this.shaderVariant)||i.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach(function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()}),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=eK,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},ii(i,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ry),uw=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var i=e.prototype;return i.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},i.copyTexture=function(e,i){this.renderer&&(e.initialize(),i.initialize(),i.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:i.getWidth()||e.getWidth(),height:i.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,i):this.copy1(e,i))},i.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},i.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},i.createCopyRenderPass=function(){var e="mri-copy-mesh",i={texture:{format:ik.RGBA}},r=this.renderer.engine,n=new u_(r,{name:e,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r.gpuCapability.level,a=new uC(r,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===s?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var o=new rL(r,{name:e,geometry:n,material:a,priority:0});return new uR(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[i],meshes:[o]})},i.dispose=function(){if(this.renderer){var t;null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0}},e}(),uR=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(rN),uO=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],ez(t),this.gl=iV(t,e,i),this.contextLostListener=function(t){for(var e,i,n=iR(r.lostHandlers);!(i=n()).done;)i.value.lost(t);null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=iR(r.restoreHandlers);!(i=n()).done;)i.value.restore();null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),uM=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new r7(e),i}e9(e,t);var i=e.prototype;return i.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(uh),uI=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}e9(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(!this.initialized){eG.error("Can't set size for uninitialized render buffer.");return}if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):eG.error("Invalid render buffer size: "+t+"x"+e+".")}},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=eK},e}(r8),uP=1,uL=function(e){function i(i,r){(n=e.call(this)||this).attachmentTextures=[];var n,s,a=i.depthStencilAttachment,o=i.viewport,u=i.isCustomViewport,h=i.storeAction,c=i.viewportScale,l=i.name,f=void 0===l?"GLFramebuffer"+uP++:l;return n.renderer=r,n.engine=r.engine,n.depthStencilStorageType=null!=(s=null==a?void 0:a.storageType)?s:t.RenderPassAttachmentStorageType.none,n.viewport=o,n.isCustomViewport=!!u,n.viewportScale=void 0===c?1:c,n.name=f,n.storeAction=h,n.updateProps(i),n}e9(i,e);var n=i.prototype;return n.getDepthTexture=function(){return this.depthTexture},n.getStencilTexture=function(){return this.stencilTexture},n.getColorTextures=function(){return this.colorTextures},n.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach(function(e){e.initialize(),eb(t.attachmentTextures,e.textureBuffer)}),this.stencilTexture&&eb(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&eb(this.attachmentTextures,this.depthTexture.textureBuffer)},n.updateProps=function(e){var i,n,s=this.renderer,a=this.engine.gpuCapability,o=null!=(n=e.depthStencilAttachment)?n:{storageType:t.RenderPassAttachmentStorageType.none},u=e.attachments.length>0,h=!0;if(this.externalStorage=!1,e.attachments.length>1&&!a.detail.drawBuffers)throw Error("Multiple color attachments not support.");var c=null==(i=e.depthStencilAttachment)?void 0:i.texture,l=a.detail.readableDepthStencilTextures,f=o.storageType,d=o.storage;if(this.colorTextures=e.attachments.slice(),!u&&f!==t.RenderPassAttachmentStorageType.none)throw Error("Use depth stencil attachment without color attachments.");switch(u&&(this.fbo=s.glRenderer.createGLFramebuffer(this,this.name)),f){case t.RenderPassAttachmentStorageType.depth_stencil_opaque:if(d){if(r(d,uI))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth stencil attachment storage.")}else this.depthStencilRenderbuffer=new uI({format:ik.DEPTH_STENCIL,attachment:ik.DEPTH_STENCIL_ATTACHMENT,storageType:f},s.glRenderer);h=!1;break;case t.RenderPassAttachmentStorageType.depth_16_opaque:if(d){if(r(d,uI))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth attachment storage.")}else this.depthStencilRenderbuffer=new uI({attachment:ik.DEPTH_ATTACHMENT,format:ik.DEPTH_COMPONENT16,storageType:f},s.glRenderer);break;case t.RenderPassAttachmentStorageType.stencil_8_opaque:if(d){if(r(d,uI))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid stencil attachment storage.")}else this.depthStencilRenderbuffer=new uI({attachment:ik.STENCIL_ATTACHMENT,format:ik.STENCIL_INDEX8,storageType:f},s.glRenderer);break;case t.RenderPassAttachmentStorageType.depth_16_texture:if(!l)throw Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=c?c:new ud(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:ik.DEPTH_COMPONENT,internalFormat:a.internalFormatDepth16,type:ik.UNSIGNED_SHORT,name:""+this.name+"##depthTex"}),this.depthTexture.initialize();break;case t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!l)throw Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=c?c:new ud(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:ik.DEPTH_STENCIL,internalFormat:a.internalFormatDepth24_stencil8,type:a.UNSIGNED_INT_24_8,name:""+this.name+"##dpthStclTex"}),this.depthTexture.initialize(),h=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,h),this.updateAttachmentTextures()},n.getStoreAttachments=function(e,i){var r=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&iU(r)&&n>0){var s=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&eb(s,i?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&eb(s,i?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var a=0;a<n;a++)eb(s,r["COLOR_ATTACHMENT"+a]);return s}},n.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;iU(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},n.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],s=r[1],a=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,s,a,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach(function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())});for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var c=this.depthStencilRenderbuffer,l=this.depthTexture,f=this.stencilTexture;if(i.activeTexture(e.TEXTURE0),c)c.setSize(a,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,c.attachment,e.RENDERBUFFER,c.buffer);else if(l){l.source.data={width:a,height:o},l.update({data:{width:a,height:o,data:new Uint16Array(0)}});var d=l&&f?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,l.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var p=e.checkFramebufferStatus(e.FRAMEBUFFER);if(p!==e.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer failed, status: "+p+", error: "+e.getError()+".");this.ready=!0}}},n.resetColorTextures=function(t){var e=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,r=this.viewport,n=[];if(t){for(var s,a=iR(t);!(s=a()).done;)s.value.initialize();this.colorTextures=t.slice()}this.renderer.pipelineContext.activeTexture(e.TEXTURE0),this.colorTextures.forEach(function(t,s){var a={width:r[2],height:r[3],data:new Uint8Array(0)};t.update({data:a}),i.framebufferTexture2D(e,e.FRAMEBUFFER,s,e.TEXTURE_2D,t.textureBuffer),n.push(!0)}),i.drawBuffers(e,n),this.updateAttachmentTextures()},n.resize=function(t,e,i,r){var n=this.viewport,s=n[0],a=n[1],o=n[2],u=n[3];(s!==t||a!==e||o!==i||u!==r)&&(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},n.dispose=function(e){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;n!==t.RenderPassDestroyAttachmentType.force&&(n!==t.RenderPassDestroyAttachmentType.keepExternal||this.externalStorage)||(null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose()),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},ii(i,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),i}(ne),uF=function(t){for(var e=5381,i=t.length;i;)e=33*e^t.charCodeAt(--i);return e>>>0},uV=((ep={})[ik.FLOAT]=1,ep[ik.INT]=1,ep[ik.UNSIGNED_INT]=1,ep[ik.SHORT]=1,ep[ik.BOOL]=1,ep[ik.UNSIGNED_SHORT]=1,ep[ik.FLOAT_VEC2]=2,ep[ik.FLOAT_VEC3]=3,ep[ik.FLOAT_VEC4]=4,ep[ik.FLOAT_MAT2]=4,ep[ik.FLOAT_MAT3]=9,ep[ik.FLOAT_MAT4]=16,ep[ik.FLOAT_MAT2x3]=6,ep[ik.FLOAT_MAT2x4]=8,ep[ik.FLOAT_MAT4x3]=12,ep[ik.FLOAT_MAT4x2]=8,ep[ik.FLOAT_MAT3x4]=12,ep[ik.FLOAT_MAT3x2]=6,ep[ik.INT_VEC2]=2,ep[ik.INT_VEC3]=3,ep[ik.INT_VEC4]=4,ep[ik.UNSIGNED_INT_VEC2]=2,ep[ik.UNSIGNED_INT_VEC3]=3,ep[ik.UNSIGNED_INT_VEC4]=4,ep[ik.BOOL_VEC2]=2,ep[ik.BOOL_VEC3]=3,ep[ik.BOOL_VEC4]=4,ep),uN=uU(Float32Array),uD=uU(Int32Array),uk=uU(Uint8Array);function uz(t){return function(e,i,r,n){var s={start:i[1],dirty:!0};if(i[2]>1){if(e.length){for(var a=n[1]||e.length,o=i[4]/t.BYTES_PER_ELEMENT,u=s.buffer=new t(a*o),h=n[0]||0,c=0;c<a;c++)u[c*o]=e[c+h];s.start+=h*o}}else s.buffer=new t([e]);return s}}function uU(t){return function(e,i,r,n){for(var s=i[8],a=i[2],o=i[5],u=1===a?s:i[4],h=o?u/o:1,c=u/t.BYTES_PER_ELEMENT/h,l=s/t.BYTES_PER_ELEMENT/c,f=uV[i[0]],d=f/h,p=(n[0]||0)*f,m=n[1]?h*n[1]:l,v=new t(c*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=p;g<m;g++){for(var T=0;T<d;T++)v[x+T]=e[b+T];x+=c,b+=d}return y}}(em={})[ik.FLOAT]=uz(Float32Array),em[ik.INT]=uz(Int32Array),em[ik.UNSIGNED_INT]=uz(Uint32Array),em[ik.SHORT]=uz(Int16Array),em[ik.BOOL]=uz(Uint8Array),em[ik.UNSIGNED_SHORT]=uz(Uint16Array),em[ik.FLOAT_VEC2]=uN,em[ik.FLOAT_VEC3]=uN,em[ik.FLOAT_VEC4]=uN,em[ik.FLOAT_MAT2]=uN,em[ik.FLOAT_MAT3]=uN,em[ik.FLOAT_MAT4]=uN,em[ik.FLOAT_MAT2x3]=uN,em[ik.FLOAT_MAT2x4]=uN,em[ik.FLOAT_MAT4x3]=uN,em[ik.FLOAT_MAT4x2]=uN,em[ik.FLOAT_MAT3x4]=uN,em[ik.FLOAT_MAT3x2]=uN,em[ik.INT_VEC2]=uD,em[ik.INT_VEC3]=uD,em[ik.INT_VEC4]=uD,em[ik.UNSIGNED_INT_VEC2]=uD,em[ik.UNSIGNED_INT_VEC3]=uD,em[ik.UNSIGNED_INT_VEC4]=uD,em[ik.BOOL_VEC2]=uk,em[ik.BOOL_VEC3]=uk,em[ik.BOOL_VEC4]=uk;var uB=function(){function t(t,e,i){var r=this;this.engine=t,this.program=e,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),iU(n)&&(function(t,e){for(var i=[],r=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),s=0;s<n;++s)!function(n){var s=t.getActiveUniformBlockName(e,n);ez(s);var a={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,i[n]=a;for(var o=a.uniformIndices,u=[],h=0;h<o.length;h++){var c=t.getActiveUniform(e,o[h]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,h,0],u[h]=c,r.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach(function(i,r){t.getActiveUniforms(e,o,i).forEach(function(t,e){var i=u[e];a.uniforms[i][r]=+t})});for(var l=0;l<u.length;l++){var f=a.uniforms[u[l]],d=a.uniforms[u[l+1]],p=d?d[1]:a.size;f[8]=p-f[1]}a.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices;return Object.keys(r).map(function(t){return t+"["+r[t].join(":")+"]"}).join("+"),uF(""+e+"+",""+i+"+",""+n.length+"+")}(a)+""}(s);return{blockSpecs:i,blockUniformNames:r}})(n,e).blockSpecs.forEach(function(t){return r.uniformBlockMap[t.name]=t}),this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:(i=new um(this.engine,t.name+"-"+n),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach(function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");a.bind(),s.enableVertexAttribArray(i.loc),s.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}}),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=t.getActiveAttrib(e,n);if(s){var a=s.name,o=s.type,u=s.size,h=t.getAttribLocation(e,a);i[a]={type:o,name:a,size:u,loc:h}}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),uG=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}e9(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i,r=e.slice();t=t.concat(r);for(var n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++)null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--);for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},i.toData=function(){var t=this.taggedProperties;t.dataType=t3.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(iO),uX=0,uj=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=e.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=iR(Object.keys(this.cachedShaders));!(i=n()).done;){var s=i.value;this.cachedShaders[s].initialized||r.push(s)}t?r.length?Promise.all(r.map(function(t){return new Promise(function(i){return e.compileShader(e.cachedShaders[t],i)})})).then(t).catch(function(){return 0}):t([]):r.map(function(t){return e.compileShader(e.cachedShaders[t])}),this.shaderAllDone=!0}},i.addShader=function(e,i){var r=[];e.macros&&r.push.apply(r,[].concat(e.macros)),i&&r.push.apply(r,[].concat(i));var n=iW({},e,{vertex:rK.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:e.vertex,macros:r}),fragment:rK.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:e.fragment,macros:r})}),s=this.computeShaderCacheId(n);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var a=!1;return(n.shared||n.cacheId)&&(a=!0),this.cachedShaders[s]=new uG(this.engine,iW({},n,{vertex:n.vertex,fragment:n.fragment,name:n.name||s,shared:a})),this.cachedShaders[s].id=s,s},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(e,i){var r=this,n=e.source,s=n.shared,a=n.vertex,o=n.fragment,u=n.name,h=e.source.cacheId,c=!1;(s||h)&&(c=!0);var l=this.pipelineContext.gl,f={shared:c,status:t.ShaderCompileResultStatus.compiling},d=this.createProgram(l,a,o,f),p=this.glAsyncCompileExt,m=performance.now(),v=function(i){f.status=t.ShaderCompileResultStatus.success,f.compileTime=performance.now()-m,e.program=i,e.initialized=!0,e.pipelineContext=r.pipelineContext,void 0!==r.programMap[e.id]&&console.warn("Find duplicated shader id: "+e.id+"."),r.programMap[e.id]=i},y=function(){if(r.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(e.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&!0==l.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==t.ShaderCompileResultStatus.fail){ug(n,u);var s=new uB(r.engine,n,e.id);if(l.validateProgram(n),l.getProgramParameter(n,l.VALIDATE_STATUS))v(s);else{var h=l.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))?v(s):(f.status=t.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",a,"\nfragment:\n",o),l.deleteProgram(n))}}null==i||i(f)}else i&&requestAnimationFrame(y)};e.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=t.fragment,r=t.shared,n=t.cacheId;return r||n?n||"shared_"+function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var s=e[n],a=0;a<s.length;a++)r=Math.imul(31,r)+s.charCodeAt(a)|0;return r}(void 0===e?"":e,void 0===i?"":i):"instanced_"+uX++},i.createProgram=function(e,i,r,n){var s=e.createProgram(),a=this.createGLShader(e,e.VERTEX_SHADER,i),o=this.createGLShader(e,e.FRAGMENT_SHADER,r);return s&&a&&o?(e.attachShader(s,a),e.attachShader(s,o),e.linkProgram(s),n.program=s,n.status=t.ShaderCompileResultStatus.compiling,function(){if(n.program=void 0,!e.getProgramParameter(s,e.LINK_STATUS)){console.error("Failed to link program: "+e.getProgramInfoLog(s)+".");var u=uH(e,a,"vertex",i),h=uH(e,o,"fragment",r);n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),h&&(n.error=h.error,n.status=h.status)}return s}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=uF(null!=i?i:""),s=r.get(n);if(s)return s;var a=t.createShader(e);return a&&(t.shaderSource(a,i),t.compileShader(a),r.set(n,a)),a},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(e){t.programMap[e].dispose()}),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function uH(e,i,r,n){if(!e.getShaderParameter(i,e.COMPILE_STATUS)){var s=e.getShaderInfoLog(i);return console.error("compile "+r+" error: "+s,(null!=n?n:"").split("\n").map(function(t,e){return e+1+" "+t}).join("\n")),{error:s,status:t.ShaderCompileResultStatus.fail}}}var uY=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new uj(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=ik.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),(r.x!==e||r.y!==i)&&this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),(n.x!==e||n.y!==i||n.z!==r)&&this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),(s.x!==e||s.y!==i||s.z!==r||s.w!==n)&&this.gl[t](s.x=e,s.y=i,s.z=r,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),uW=function(e){function i(i,r,n){(s=e.call(this)||this).canvas=i,s.temporaryRTs={};var s,a=iW({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);s.context=new uO(i,r,a);var o=s.context.gl;return ez(o),s.engine=new uM(o),s.engine.renderer=iA(s),s.pipelineContext=new uY(s.engine,o),s.glRenderer=new uy(s.engine),s.extension=new uw(iA(s)),s.renderingData={currentFrame:{}},s.framebuffer=new uL({storeAction:{},viewport:[0,0,s.width,s.height],attachments:[new ud(s.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:s.width,height:s.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},iA(s)),s}e9(i,e);var r=i.prototype;return r.renderRenderFrame=function(t){t.resource&&t.resource.color_b.initialize(),t.emptyTexture.initialize(),t.transparentTexture.initialize();var e=t._renderPasses;if(this.isDestroyed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(r=t.renderer.getShaderLibrary())||r.compileAllShaders(),this.setFramebuffer(null),this.clear(t.clearAction);var i=t.camera;this.renderingData.currentFrame=t,this.renderingData.currentCamera=i,this.setGlobalMatrix("effects_MatrixInvV",i.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",i.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",i.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",i.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",i.position),eN(e);for(var r,n,s=iR(e);!(n=s()).done;){var a=n.value,o=a.delegate;null==o.willBeginRenderPass||o.willBeginRenderPass.call(o,a,this.renderingData),this.renderRenderPass(a),null==o.didEndRenderPass||o.didEndRenderPass.call(o,a,this.renderingData)}for(var u,h=iR(e);!(u=h()).done;)u.value.frameCleanup(this)},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=iR(t);!(e=r()).done;){var n=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,n,this.renderingData),n.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){console.error(t);return}this.glRenderer.drawGeometry(t,e,i)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(e,i,r,n,s,a){if(this.temporaryRTs[e])return this.temporaryRTs[e];var o,u,h=t.RenderPassAttachmentStorageType.none;s===t.FilterMode.Linear?o=ik.LINEAR:s===t.FilterMode.Nearest&&(o=ik.NEAREST),a===t.RenderTextureFormat.RGBA32?u=ik.UNSIGNED_BYTE:a===t.RenderTextureFormat.RGBAHalf&&(u=ik.HALF_FLOAT),0===n?h=t.RenderPassAttachmentStorageType.none:16===n?h=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(h=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var c=new uL({name:e,storeAction:{},viewport:[0,0,i,r],viewportScale:1,isCustomViewport:!0,attachments:[new ud(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:o,magFilter:o,internalFormat:ik.RGBA,format:ik.RGBA,type:u})],depthStencilAttachment:{storageType:h}},this);return this.temporaryRTs[e]=c,c},r.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},r.clear=function(e){var i=this.pipelineContext,r=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&i.clearColor(n[0],n[1],n[2],n[3]),i.colorMask(!0,!0,!0,!0),r=ik.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(i.stencilMask(255),i.clearStencil(e.clearStencil||0),r|=ik.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var s=e.clearDepth;i.depthMask(!0),i.clearDepth(Number.isFinite(s)?s:1),r|=ik.DEPTH_BUFFER_BIT}r&&i.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw Error("Can not restore automatically because losing gl context.");this.engine=new uM(t),this.engine.renderer=this,this.pipelineContext=new uY(this.engine,t),this.glRenderer=new uy(this.engine),this.extension=new uw(this)},r.resize=function(t,e){var i=this.glRenderer;i&&(this.width!==t||this.height!==e)&&i.resize(t,e)},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},ii(i,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),i}(ni),uZ={"Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Never use destroyed player again":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr","Current running player count":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ","Create player with different WebGL version":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg"},uq=new Map,uK=!1,uQ=1,uJ=function(e){function n(t){(n=e.call(this)||this).builtinObjects=[],n.compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach(function(e){return e.lost(t)}),n.renderer.lost(t),n.emit("webglcontextlost",t),u$(iA(n),!1)};var r,n,s=iA(n);n.restore=i(function(){var t;return a(this,function(e){switch(e.label){case 0:return s.renderer.restore(),[4,Promise.all(s.compositions.map(i(function(t){var e,i,r,n,o,u,h,c,l,f,d,p;return a(this,function(a){switch(a.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.keepResource,o=t.reusable,u=t.renderOrder,h=t.transform,c=t.videoState,[4,s.loadScene(i)];case 1:(l=a.sent()).speed=r,l.reusable=o,l.keepResource=n,l.renderOrder=u,l.transform.setPosition(h.position.x,h.position.y,h.position.z),l.transform.setRotation(h.rotation.x,h.rotation.y,h.rotation.z),l.transform.setScale(h.scale.x,h.scale.y,h.scale.z),f=0,a.label=2;case 2:if(!(f<c.length))return[3,5];if(!c[f])return[3,4];return(d=l.textures[f].source.video).currentTime=null!=(p=c[f])?p:0,[4,d.play()];case 3:a.sent(),a.label=4;case 4:return f++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}})})))];case 1:return s.compositions=e.sent(),s.emit("webglcontextrestored"),null==(t=s.ticker)||t.resume(),eO()&&s.canvas&&(s.canvas.style.display="none",window.setTimeout(function(){s.canvas.style.display=""},0)),[2]}})}),n.handleResume=function(){n.emit("update",{player:iA(n),playing:!0})},n.handleClick=function(t){var e=t.x,i=t.y;n.compositions.forEach(function(t){var r=t.hitTest(e,i);if(r.length)for(var s=0;s<r.length;s++){var a=r[s].behavior||tR.NOTIFY;a===tR.NOTIFY?(n.emit("click",iW({},r[s],{compositionId:t.id,compositionName:t.name,player:iA(n)})),t.emit("click",iW({},r[s],{compositionId:t.id,compositionName:t.name}))):a===tR.RESUME_PLAYER&&n.resume()}})};var o=t.container,u=t.canvas,h=t.fps,c=t.name,l=t.pixelRatio,f=t.manualRender,d=t.reportGPUTime,p=t.renderFramework,m=t.notifyTouch,v=t.interactive,y=t.renderOptions,g=void 0===y?{}:y,x=t.env,b=void 0===x?"":x,T=g.willCaptureImage,E=g.premultipliedAlpha;if(iD.length)throw Error("Errors before player create: "+iD.map(function(t,e){return"\n "+(e+1)+": "+t})+".");if(uK||"debug-disable"===p)return a6(n);var _=eM()||(r=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===r[1]||"16"===r[1]&&"5"===r[2])?"webgl":"webgl2";return p&&(_="webgl"===p?"webgl":"webgl2"),n.reportGPUTime=d,n.pixelRatio=Number.isFinite(l)?l:eR(),n.offscreenMode=!0,n.env=b,n.name=c||""+uQ++,u?n.canvas=u:(u0(o),n.canvas=document.createElement("canvas"),o.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=ni.create(n.canvas,_,{preserveDrawingBuffer:T,premultipliedAlpha:E}),n.renderer.env=b,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.builtinObjects.push(ru(n.renderer.engine)),uq.forEach(function(t){t.gpuCapability.type!==n.gpuCapability.type&&eG.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+uZ["Create player with different WebGL version"]+".")}),f||(n.ticker=new uc(h),n.ticker.add(n.tick.bind(iA(n)))),n.event=new so(n.canvas,!!m),n.event.bindListeners(),n.event.addEventListener(sr,n.handleClick),n.interactive=void 0!==v&&v,n.resize(),sp(n.gpuCapability.detail),uq.set(n.canvas,iA(n)),function(){for(var t,e=[],i=iR(uq.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&eG.error("Current running player count: "+e.length+", see "+uZ["Current running player count"]+".",e)}(),u$(iA(n),!0),n}e9(n,e);var s=n.prototype;return s.setSpeed=function(t){isNaN(t)||(this.speed=t)},s.getSpeed=function(){return this.speed},s.getCompositionByName=function(t){return this.compositions.find(function(e){return e.name===t})},s.getCompositions=function(){return this.compositions},s.getAssetManager=function(){return this.assetManagers},s.loadScene=function(t,e){var r=this;return i(function(){var n,s,o;return a(this,function(u){switch(u.label){case 0:if(o=r.baseCompositionIndex,!eH(t))return[3,2];return r.baseCompositionIndex+=t.length,[4,Promise.all(t.map(i(function(t,i){var n;return a(this,function(s){switch(s.label){case 0:return[4,r.createComposition(t,e)];case 1:return(n=s.sent()).setIndex(o+i),[2,n]}})})))];case 1:return s=u.sent(),[3,4];case 2:return r.baseCompositionIndex+=1,[4,r.createComposition(t,e)];case 3:(s=u.sent()).setIndex(o),u.label=4;case 4:return null==(n=r.ticker)||n.start(),[2,s]}})})()},s.createComposition=function(e,n){void 0===n&&(n={});var s=this;return i(function(){var i,o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R;return a(this,function(a){switch(a.label){case 0:return c=null==(o=(h=(u=s.renderer).engine).gpuCapability)?void 0:null==(i=o.detail)?void 0:i.asyncShaderCompile,l=performance.now(),f=iW({autoplay:!0},n),d=e,t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(d=e.url),t.Scene.isWithOptions(e)&&(f=iW({},f,e.options))),p=new oj(f),h.clearResources(),s.assetManagers.push(p),[4,p.loadScene(d,s.renderer,{env:s.env})];case 1:for(m=a.sent(),h.addPackageDatas(m),v=iR(s.builtinObjects);!(y=v()).done;)g=y.value,h.addInstance(g);if(s.updateTextVariables(m,f.variables),s.disposed)throw Error("Disposed player can not used to create Composition.");for(x=0;x<m.textureOptions.length;x++)r(b=m.textureOptions[x],rs)?h.addInstance(b):(b=h.assetLoader.loadGUID(m.textureOptions[x].id),m.textureOptions[x]=b),b.initialize();if(!h.database)return[3,3];return[4,h.createVFXItems(m)];case 2:a.sent(),a.label=3;case 3:if(T=new o$(iW({},f,{renderer:u,width:u.getWidth(),height:u.getHeight(),event:s.event,handleItemMessage:function(t){s.emit("message",t)}}),m),s.ticker&&(f.renderLevel===tT.B?s.ticker.setFPS(Math.min(s.ticker.getFPS(),30)):s.ticker.setFPS(60)),s.env!==nW)for(E=iR(Object.keys(s.renderer.engine.objectInstance));!(_=E()).done;)A=_.value,r(S=s.renderer.engine.objectInstance[A],ry)&&S.createShaderVariant();return C=performance.now(),[4,new Promise(function(t){var e;null==(e=s.renderer.getShaderLibrary())||e.compileAllShaders(function(){t(null)})})];case 4:return a.sent(),f.autoplay?(s.autoPlaying=!0,T.play()):T.pause(),w=performance.now()-C,R=performance.now()-l,T.statistic.compileTime=w,T.statistic.firstFrameTime=R,eG.info("Shader "+(c?"async":"sync")+" compile ["+T.name+"]: "+w.toFixed(4)+"ms."),eG.info("First frame ["+T.name+"]: "+R.toFixed(4)+"ms."),s.compositions.push(T),[2,T]}})})()},s.updateTextVariables=function(t,e){void 0===e&&(e={});var i=this.renderer.engine;t.jsonScene.items.forEach(function(t){if(t.type===tO.text||t.type===tO.richtext){var r=e[t.name];r&&t.components.forEach(function(t){var e=t.id,n=i.findEffectsObjectData(e);((null==n?void 0:n.dataType)===t3.TextComponent||(null==n?void 0:n.dataType)===t3.RichTextComponent)&&(n.options.text=r)})}})},s.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(t){t.play()}),null==(t=this.ticker)||t.start()},s.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(e){e.gotoAndPlay(t)}),this.ticker?this.ticker.start():this.doTick(0,!0)},s.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(e){e.gotoAndStop(t)}),(!this.ticker||(null==(e=this.ticker)?void 0:e.getPaused()))&&this.doTick(0,!0),this.emit("update",{player:this,playing:!1})},s.playSequence=function(t){for(var e,i=function(e){t[e].on("end",function(){t[e+1].play()})},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},s.pause=function(t){var e;!this.paused&&(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},s.resume=function(){var t=this;return i(function(){var e;return a(this,function(i){switch(i.label){case 0:if(t.resumePending)return[2];if(!t.paused)return[3,2];return t.resumePending=!0,[4,Promise.all(t.compositions.map(function(t){return t.reloadTexture()}))];case 1:i.sent(),t.resumePending=!1,t.handleResume(),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}})})()},s.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},s.doTick=function(e,i){var r,n,s=this,a=this.renderer.engine.renderErrors;a.size>0&&(this.emit("rendererror",a.values().next().value),null==(r=this.ticker)||r.pause()),e=Math.min(e,33)*this.speed;var o=this.compositions,u=!1;o.sort(function(t,e){return t.getIndex()-e.getIndex()});for(var h=[],c=0;c<o.length;c++){var l=o[c];if(l.textureOffloaded){u=!0,eG.error("Composition "+l.name+" texture offloaded, skip render."),h.push(l);continue}!l.isDestroyed&&l.renderer&&l.update(e),l.isDestroyed||h.push(l)}if(this.compositions=h,this.baseCompositionIndex=this.compositions.length,u)return this.emit("rendererror",Error("Play when texture offloaded.")),null==(n=this.ticker)?void 0:n.pause();if(!this.paused||i){var f=this.gpuCapability.level,d=this.renderer.context.gl,p=2===f&&this.reportGPUTime?iN(d):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<o.length||i){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var m=0;m<o.length;m++)o[m].renderFrame.isDestroyed||this.renderer.renderRenderFrame(o[m].renderFrame)}null==p||p.end(),null==p||p.getTime().then(function(t){return null==s.reportGPUTime?void 0:s.reportGPUTime.call(s,null!=t?t:0)}).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},s.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},s.resize=function(){var t=this.canvas.parentElement;if(t){var e=this.getTargetSize(t);r=e[0],n=e[1],s=e[2],a=e[3]}else r=s=this.canvas.width,n=a=this.canvas.height;var i=r/n;if(r&&n){var r,n,s,a,o,u=document.documentElement.clientWidth;s>2*u&&eG.error("DPI overflowed, width "+s+" is more than 2x document width "+u+", see "+uZ["DPI overflowed"]+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(s>h||a>h)&&(eG.error("Container size overflowed "+s+"x"+a+", see "+uZ["Container size overflowed"]+"."),i>1?(s=Math.round(h),a=Math.round(h/i)):(a=Math.round(h),s=Math.round(h*i))),this.renderer.resize(s,a),this.canvas.style.width=r+"px",this.canvas.style.height=n+"px",eG.info("Resize player "+this.name+" ["+s+","+a+","+r+","+n+"]."),null==(o=this.compositions)||o.forEach(function(t){t.camera.aspect=i})}},s.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},s.destroyCurrentCompositions=function(){this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.baseCompositionIndex=0},s.dispose=function(t){if(eG.info("Call player destroyed: "+this.name+"."),!this.disposed){uq.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach(function(t){return t.dispose()}),this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!t),this.destroyBuiltinObjects(),u$(this,!1),r(this.canvas,HTMLCanvasElement)&&!t&&this.renderer.context&&(a7.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var e,i="Never use destroyed player: "+this.name+" again, see "+uZ["Never use destroyed player again"]+".",n=function(){return function(t){throw Error(t)}(i)},s=function(){return Promise.reject(i)};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},s.offloadTexture=function(){this.compositions.forEach(function(t){return t.offloadTexture()})},s.getTargetSize=function(t){u0(t);var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),s=0,a=0;n?(s=parseInt(n.width,10),a=parseInt(n.height,10)):(s=t.clientWidth,a=t.clientHeight),r?s/a>r?e=(i=a*this.displayScale)*r:i=(e=s*this.displayScale)/r:(e=s,i=a);var o=this.pixelRatio,u=e,h=i;if(e=Math.round(e*o),(i=Math.round(i*o))<1||i<1){if(this.offscreenMode)e=i=u=h=1;else throw Error("Invalid container size "+e+"x"+i+", see "+uZ["Invalid container size"]+".")}return[u,h,e,i]},s.destroyBuiltinObjects=function(){for(var t,e=iR(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},ii(n,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),n}(sw);function u$(t,e){Object.keys(e0).forEach(function(i){var r=e0[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)})}function u0(t){if(null==t)throw Error("Container is not an HTMLElement, see "+uZ["Container is not an HTMLElement"]+".")}rs.create=function(t,e){return new ud(t,e)},rs.createWithData=function(e,i,r){void 0===i&&(i=eF("#fff")),void 0===r&&(r={});var n=r.type,s=void 0===n?ik.UNSIGNED_BYTE:n,a=r.format,o=void 0===a?ik.RGBA:a,u=r.internalFormat,h=r.wrapS,c=void 0===h?ik.MIRRORED_REPEAT:h,l=r.wrapT,f=void 0===l?ik.MIRRORED_REPEAT:l,d=r.minFilter,p=void 0===d?ik.NEAREST:d,m=r.magFilter,v=void 0===m?ik.NEAREST:m,y=r.flipY;return new ud(e,{data:i,type:s,sourceType:t.TextureSourceType.data,format:o,internalFormat:u||o,wrapS:c,wrapT:f,minFilter:p,magFilter:v,flipY:void 0!==y&&y})},ry.create=function(t,e){return new uC(t,e)},r_.create=function(t,e){return new u_(t,e)},rL.create=function(t,e){return new rL(t,e)},r8.create=function(t){return new uI(t)},ne.create=function(t,e){return new uL(t,e)},ni.create=function(t,e,i){return new uW(t,e,i)},uh.create=function(t){return new uM(t)};var u1="2.1.3-alpha.2";eG.info("Player version: "+u1+"."),t.AbstractPlugin=e6,t.ActivationPlayable=aG,t.AnimationClipPlayable=aX,t.Asset=on,t.AssetLoader=os,t.AssetManager=oj,t.BYTES_TYPE_MAP=rE,t.BaseRenderComponent=nJ,t.Behaviour=id,t.BezierCurve=nD,t.BezierCurvePath=nz,t.BezierCurveQuat=nU,t.COPY_FRAGMENT_SHADER=iL,t.COPY_MESH_SHADER_ID=iI,t.COPY_VERTEX_SHADER=iP,t.CalculateLoader=aV,t.Camera=oY,t.CameraVFXItemLoader=si,t.ColorCurve=nQ,t.Component=il,t.Composition=o$,t.CompositionComponent=aK,t.CompositionSourceManager=oZ,t.DEFAULT_FONTS=ot,t.DEFAULT_FPS=60,t.Database=oa,t.Downloader=iZ,t.EFFECTS_COPY_MESH_NAME=iM,t.EVENT_TYPE_CLICK=sr,t.EVENT_TYPE_TOUCH_END=sa,t.EVENT_TYPE_TOUCH_MOVE=ss,t.EVENT_TYPE_TOUCH_START=sn,t.EffectsObject=ic,t.EffectsPackage=uu,t.Engine=uh,t.EventEmitter=sw,t.EventSystem=so,t.Float16ArrayWrapper=nn,t.Framebuffer=ne,t.GLEngine=uM,t.GLGeometry=u_,t.GLRenderer=uW,t.GPUCapability=r7,t.Geometry=r_,t.GlobalUniforms=r6,t.GradientValue=nV,t.HELP_LINK=nZ,t.InteractLoader=sh,t.InteractMesh=sl,t.KTXTexture=rc,t.LineSegments=nN,t.LinearValue=nF,t.Material=ry,t.MaterialDataBlock=rp,t.Mesh=rL,t.MeshCollider=sd,t.PLAYER_OPTIONS_ENV_EDITOR=nW,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=aC,t.ParticleBehaviourPlayableAsset=aw,t.ParticleLoader=aF,t.ParticleMesh=aO,t.ParticleSystemRenderer=av,t.PassTextureCache=rb,t.PathSegments=nk,t.Player=uJ,t.PluginSystem=e4,t.PropertyTrack=a1,t.RENDER_PASS_NAME_PREFIX=r1,t.RENDER_PREFER_LOOKUP_TEXTURE=sP,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=nI,t.RandomValue=nP,t.RandomVectorValue=nL,t.RenderFrame=r3,t.RenderPass=rN,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=rF,t.Renderbuffer=r8,t.Renderer=ni,t.RendererComponent=ip,t.RuntimeClip=aH,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=6,t.SemanticMap=rT,t.SerializationHelper=aq,t.ShaderFactory=rK,t.ShaderVariant=iO,t.SpriteLoader=sx,t.StaticValue=nM,t.TEMPLATE_USE_OFFSCREEN_CANVAS=sL,t.TextComponentBase=oi,t.TextLayout=a8,t.TextLoader=or,t.TextStyle=a9,t.Texture=rs,t.TextureFactory=rf,t.Ticker=uc,t.TimelineClip=aj,t.TimelinePlayable=a3,t.TrackSortWrapper=a4,t.Transform=sC,t.TransformAnimationPlayable=aB,t.ValueGetter=nO,t.Vector4Curve=nY,t.addByOrder=eD,t.addItem=eb,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(r)for(;t[n-1][i]<s[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>s[i]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},t.applyMixins=e$,t.assertExist=ez,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=eJ,t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.calculateTranslation=no,t.canvasPool=a7,t.colorGradingFrag=rj,t.colorStopsFromGradient=eS,t.colorToArr=e_,t.combineImageTemplate=oB,t.createCopyShader=iF,t.createGLContext=iV,t.createKeyFrameMeta=nj,t.createShape=sq,t.createValueGetter=nK,t.decimalEqual=nm,t.defaultPlugins=e1,t.deserializeMipmapTexture=rt,t.disableAllPlayer=function(t){uK=!!t},t.earcut=ai,t.effectsClass=io,t.effectsClassStore=ia,t.enlargeBuffer=eE,t.ensureFixedNumber=ou,t.ensureVec3=nu,t.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=rH,t.gaussianDownVFrag=rY,t.gaussianUpFrag=rW,t.generateEmptyTypedArray=rA,t.generateGUID=eQ,t.generateHalfFloatTexture=ra,t.generateTransparentTexture=rh,t.generateWhiteTexture=ru,t.getActivePlayers=function(){return Array.from(uq.values())},t.getBackgroundImage=oU,t.getColorFromGradientStops=eA,t.getConfig=function(t){return sF[t]},t.getDefaultTextureFactory=rd,t.getGeometryByShape=an,t.getGeometryTriangles=ar,t.getImageItemRenderInfo=n$,t.getKTXTextureOptions=rl,t.getKeyFrameMetaByRawValue=nX,t.getMergedStore=iu,t.getParticleMeshShader=aP,t.getPixelRatio=eR,t.getPlayerByCanvas=function(t){return uq.get(t)},t.getPreMultiAlpha=iX,t.getStandardComposition=oV,t.getStandardImage=oF,t.getStandardItem=oD,t.getStandardJSON=oP,t.getTextureSize=r4,t.glContext=ik,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return t5.Float32;case WebGLRenderingContext.SHORT:return t5.Int16;case WebGLRenderingContext.BYTE:return t5.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return t5.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return t5.UInt8;default:return t5.Float32}},t.gpuTimer=iN,t.imageDataFromColor=eF,t.imageDataFromGradient=eV,t.initErrors=iD,t.initGLContext=iz,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=eC,t.isAlipayMiniApp=eP,t.isAndroid=eM,t.isArray=eH,t.isCanvas=eZ,t.isCanvasUsedByPlayer=function(t){return uq.has(t)},t.isFunction=eY,t.isIOS=eO,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return eP()||eL()},t.isObject=eW,t.isSimulatorCellPhone=eI,t.isString=ej,t.isUniformStruct=rm,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&rm(t[0])},t.isValidFontFamily=eU,t.isWebGL2=iU,t.isWechatMiniApp=eL,t.itemFrag=rz,t.itemFrameFrag=rD,t.itemVert=rk,t.loadAVIFOptional=i$,t.loadBinary=i3,t.loadBlob=function(t){return i5.apply(this,arguments)},t.loadImage=i1,t.loadMedia=i9,t.loadVideo=i6,t.loadWebPOptional=iQ,t.logger=eG,t.math=rI,t.modifyMaxKeyframeShader=aL,t.nearestPowerOfTwo=nf,t.noop=eX,t.normalizeColor=op,t.numberToFix=nv,t.parsePercent=ew,t.particleFrag=rU,t.particleOriginTranslateMap=nl,t.particleUniformTypeMap=aR,t.particleVert=rB,t.passRenderLevel=oz,t.pluginLoaderMap=e0,t.randomInRange=eq,t.registerPlugin=e3,t.removeItem=eT,t.rotateVec2=as,t.screenMeshVert=rX,t.serialize=function(t,e){return ih(t,e)},t.setBlendMode=ij,t.setConfig=function(t,e){return sF[t]=e},t.setDefaultTextureFactory=function(t){t9=t},t.setMaskMode=iY,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=nd,t.setSideMode=iH,t.setSpriteMeshMaxItemCountByGPU=sp,t.sortByOrder=eN,t.spec=it,t.spriteMeshShaderFromFilter=sm,t.spriteMeshShaderFromRenderInfo=sy,t.spriteMeshShaderIdFromRenderInfo=sv,t.thresholdFrag=rZ,t.throwDestroyedError=eK,t.trailVert=rG,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=np,t.unregisterPlugin=function(t){delete e2[t],delete e0[t],eT(e1,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=nh,t.vecMulCombine=nc,t.version=u1,t.vertexFormatType2GLType=iG,Object.defineProperty(t,"__esModule",{value:!0})});
6
+ * Version: v2.1.3-alpha.3
7
+ */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,function(t){"use strict";function e(t,e,i,r,n,s,a){try{var o=t[s](a),u=o.value}catch(t){i(t);return}o.done?e(u):Promise.resolve(u).then(r,n)}function i(t){return function(){var i=this,r=arguments;return new Promise(function(n,s){var a=t.apply(i,r);function o(t){e(a,n,s,o,u,"next",t)}function u(t){e(a,n,s,o,u,"throw",t)}o(void 0)})}}function r(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):r(t,e)}function n(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function s(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}function a(t,e){var i,r,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R,O,M,I,P,L,F,V,N,D,k,z,U,B,G,X,j,H,Y,W,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ts,ta,to,tu,th,tc,tl,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tA,tS,tC,tw,tR,tO,tM,tI,tP,tL,tF,tV,tN,tD,tk,tz,tU,tB,tG,tX,tj,tH,tY,tW,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,es,ea,eo,eu,eh,ec,el,ef,ed,ep,em,ev=new Uint8Array(16),ey=[],eg=0;eg<256;++eg)ey.push((eg+256).toString(16).slice(1));var ex={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function eb(t,e){return t.includes(e)||t.push(e),t}function eT(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function eE(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(s);return a.set(t),a}return t}function e_(t,e){var i=[0,0,0,0];if(ej(t)){t=t.replace(/[\s\t\r\n]/g,"");var n=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(n){var s=+n[4];i=[+n[1],+n[2],+n[3],isNaN(s)?255:255*s]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),255])}else r(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function eA(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var s=t[n-1],a=t[n];if(s.stop<=e&&e<=a.stop){r=eC(s.color,a.color,(e-s.stop)/(a.stop-s.stop));break}}return r||(r=t[t.length-1].color),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}function eS(t){var e=[];if(r(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4];e.push({stop:ew(i),color:[r,n,s,a]})}):Object.keys(t).forEach(function(i){var r=e_(t[i]);e.push({stop:ew(i),color:r})}),(e=e.sort(function(t,e){return t.stop-e.stop})).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function eC(t,e,i,r){var n=[],s=1-i;if(r)for(var a=0;a<4;a++)n[a]=t[a]*s+e[a]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*s+e[o]*e[o]*i));n[3]=Math.round(t[3]*s+e[3]*i)}return n}function ew(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eR(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);return Math.min(screen.width/t*2,2)}return 1}function eO(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function eM(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eI(){return eM()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eP(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eL(){return"miniprogram"===window.__wxjs_environment}function eF(t){ej(t)&&(t=e_(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function eV(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eS(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var s=n/128,a=void 0,o=void 0,u=0;u<r.length&&(a=r[u],o=r[u+1],!(a.stop<=s)||!(o.stop>s));u++);var h=eC(a.color,o.color,(s-a.stop)/(o.stop-a.stop));i.set(h,4*n)}i.set(r[r.length-1].color,508)}return e}function eN(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var s,a,o=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>o.priority&&h>=u;)h--;for(;e[u].priority<=o.priority&&u<h;)u++}else{for(;e[h].priority<o.priority&&h>=u;)h--;for(;e[u].priority>=o.priority&&u<h;)u++}s=[e[h],e[u]],e[u]=s[0],e[h]=s[1]}return a=[e[u],e[r]],e[r]=a[0],e[u]=a[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)ek(t,r,e);return t}function eD(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&ek(t,t.length-1,i)),t}function ek(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function ez(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eU(t){return/^[^\d.][\w-]*$/.test(t)}function eB(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(o=t.OrderType||(t.OrderType={}))[o.none=1]="none",o[o.ascending=2]="ascending",o[o.descending=3]="descending";var eG={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(eB(t),[r])),null==tb||tb("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(eB(t))),null==tb||tb("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(eB(t))),null==tb||tb("warn",t,r)},register:function(t){t&&eY(t)&&(tb=t)}};function eX(){}function ej(t){return"string"==typeof t}t.DestroyOptions=void 0,(u=t.DestroyOptions||(t.DestroyOptions={}))[u.destroy=0]="destroy",u[u.keep=1]="keep",u[u.force=0]="force";var eH=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eY(t){return"[object Function]"===Object.prototype.toString.call(t)}function eW(t){return"[object Object]"===Object.prototype.toString.call(t)}function eZ(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eq(t,e){return t+Math.random()*(e-t)}function eK(){throw Error("Destroyed item cannot be used again.")}function eQ(){return(function(t,e,i){if(ex.randomUUID&&!t)return ex.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tx&&!(tx="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tx(ev)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),ey[n[r+0]]+ey[n[r+1]]+ey[n[r+2]]+ey[n[r+3]]+"-"+ey[n[r+4]]+ey[n[r+5]]+"-"+ey[n[r+6]]+ey[n[r+7]]+"-"+ey[n[r+8]]+ey[n[r+9]]+"-"+ey[n[r+10]]+ey[n[r+11]]+ey[n[r+12]]+ey[n[r+13]]+ey[n[r+14]]+ey[n[r+15]]})().replace(/-/g,"")}function eJ(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],s=0;s<r.length;s+=512){for(var a=r.slice(s,s+512),o=Array(a.length),u=0;u<a.length;u++)o[u]=a.charCodeAt(u);var h=new Uint8Array(o);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function e$(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var e0={},e1=[],e2={};function e3(t,e,i,r){e2[t]&&eG.error("Duplicate registration for plugin "+t+"."),e2[t]=i,e0[t]=e,r&&eb(e1,t)}var e4=function(){function t(t){var e={},i=[],r=function(t){var r=e0[t];i.includes(r)||(i.push(r),e[t]=r)};e1.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=e0[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=e5[t])?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""));var r=new i;return r.name=t,r}).sort(function(t,e){return t.order-e.order})}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},e.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},e.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},e.processRawJSON=function(t,e){var r=this;return i(function(){return a(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var r=this;return i(function(){return a(this,function(i){return[2,r.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e,r){var n=this;return i(function(){return a(this,function(i){return[2,n.callStatic("precompile",t,e,r)]})})()},e.loadResources=function(t,e){var r=this;return i(function(){return a(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var s=this;return i(function(){var e,i,n,o,u,h;return a(this,function(a){for(n=0,e=[],i=s.plugins;n<i.length;n++)t in(o=e0[i[n].name])&&e.push(Promise.resolve(null==(h=o[t])?void 0:(u=h).call.apply(u,[].concat([o],r))));return[2,Promise.all(e)]})})()},t}(),e5={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",richtext:"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"},e6=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t.precompile=function(t,e){return Promise.resolve()},t}();function e8(t,e){return(e8=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function e9(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&e8(t,e)}(h=tT||(tT={})).S="S",h.APlus="A+",h.A="A",h.BPlus="B+",h.B="B",(c=tE||(tE={}))[c.ALPHA=0]="ALPHA",c[c.ADD=1]="ADD",c[c.MULTIPLY=2]="MULTIPLY",c[c.BRIGHTNESS=3]="BRIGHTNESS",c[c.SUBTRACTION=4]="SUBTRACTION",c[c.STRONG_LIGHT=5]="STRONG_LIGHT",c[c.WEAK_LIGHT=6]="WEAK_LIGHT",c[c.SUPERPOSITION=7]="SUPERPOSITION",(l=t_||(t_={}))[l.DOUBLE=1032]="DOUBLE",l[l.FRONT=1028]="FRONT",l[l.BACK=1029]="BACK",(f=tA||(tA={}))[f.NONE=0]="NONE",f[f.MASK=1]="MASK",f[f.OBSCURED=2]="OBSCURED",f[f.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(d=tS||(tS={}))[d.NONE=0]="NONE",d[d.SPHERE=1]="SPHERE",d[d.CONE=2]="CONE",d[d.HEMISPHERE=3]="HEMISPHERE",d[d.CIRCLE=4]="CIRCLE",d[d.DONUT=5]="DONUT",d[d.RECTANGLE=6]="RECTANGLE",d[d.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",d[d.EDGE=8]="EDGE",d[d.TEXTURE=9]="TEXTURE",(p=tC||(tC={}))[p.GYROSCOPE=0]="GYROSCOPE",p[p.SPINE=1]="SPINE",(m=tw||(tw={}))[m.CLICK=0]="CLICK",m[m.MESSAGE=1]="MESSAGE",m[m.DRAG=2]="DRAG",(v=tR||(tR={}))[v.NONE=0]="NONE",v[v.NOTIFY=1]="NOTIFY",v[v.RESUME_PLAYER=2]="RESUME_PLAYER",v[v.REMOVE=3]="REMOVE",v[v.PAUSE=4]="PAUSE",(y=tO||(tO={})).base="0",y.sprite="1",y.particle="2",y.null="3",y.interact="4",y.plugin="5",y.camera="6",y.composition="7",y.spine="spine",y.mesh="mesh",y.tree="tree",y.text="text",y.light="light",y.skybox="skybox",y.effect="effect",y.shape="shape",y.postProcessVolume="postProcessVolume",y.node="node",y.video="video",y.audio="audio",y.richtext="richtext",(g=tM||(tM={}))[g.BILLBOARD=0]="BILLBOARD",g[g.MESH=1]="MESH",g[g.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",g[g.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(x=tI||(tI={}))[x.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",x[x.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",x[x.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",x[x.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",x[x.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",x[x.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",x[x.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",x[x.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",x[x.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(b=tP||(tP={})).Opaque="Opaque",b.Transparent="Transparent",(T=tL||(tL={})).Both="Both",T.Back="Back",T.Front="Front",(E=tF||(tF={}))[E.portrait=1]="portrait",E[E.landscape=0]="landscape",(_=tV||(tV={}))[_.CONSTANT=0]="CONSTANT",_[_.CONSTANT_VEC2=1]="CONSTANT_VEC2",_[_.CONSTANT_VEC3=2]="CONSTANT_VEC3",_[_.CONSTANT_VEC4=3]="CONSTANT_VEC4",_[_.RANDOM=4]="RANDOM",_[_.LINE=5]="LINE",_[_.CURVE=6]="CURVE",_[_.BEZIER_PATH=7]="BEZIER_PATH",_[_.RGBA_COLOR=8]="RGBA_COLOR",_[_.GRADIENT_COLOR=9]="GRADIENT_COLOR",_[_.SHAPE_POINTS=10]="SHAPE_POINTS",_[_.SHAPE_SPLITS=11]="SHAPE_SPLITS",_[_.LINEAR_PATH=12]="LINEAR_PATH",_[_.COLORS=13]="COLORS",_[_.BINARY=20]="BINARY",_[_.BEZIER_CURVE=21]="BEZIER_CURVE",_[_.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",_[_.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",_[_.COLOR_CURVE=24]="COLOR_CURVE",_[_.VECTOR4_CURVE=25]="VECTOR4_CURVE",(A=tN||(tN={}))[A.AUTO=0]="AUTO",A[A.EASE=1]="EASE",A[A.EASE_IN=2]="EASE_IN",A[A.EASE_OUT=3]="EASE_OUT",A[A.LINE=4]="LINE",A[A.HOLD=5]="HOLD",A[A.LINE_OUT=6]="LINE_OUT",(S=tD||(tD={}))[S.destroy=0]="destroy",S[S.restart=5]="restart",S[S.forward=2]="forward",S[S.freeze=4]="freeze",(C=tk||(tk={}))[C.destroyChildren=6]="destroyChildren",(w=tz||(tz={}))[w.none=0]="none",w[w.removeParticle=1]="removeParticle",(R=tU||(tU={}))[R.RANDOM=0]="RANDOM",R[R.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",R[R.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",R[R.UNIFORM_BURST=3]="UNIFORM_BURST",(O=tB||(tB={})).point="point",O.spot="spot",O.directional="directional",O.ambient="ambient",(M=tG||(tG={}))[M.box=2]="box",M[M.sphere=3]="sphere",(I=tX||(tX={})).orthographic="orthographic",I.perspective="perspective",(P=tj||(tj={})).unlit="unlit",P.pbr="pbr",P.hair="hair",(L=tH||(tH={}))[L.opaque=100]="opaque",L[L.masked=101]="masked",L[L.translucent=102]="translucent",L[L.additive=103]="additive",(F=tY||(tY={})).none="none",F.uv="uv",F.normal="normal",F.basecolor="basecolor",F.alpha="alpha",F.metallic="metallic",F.roughness="roughness",F.ao="ao",F.emissive="emissive",F.diffuse="diffuse",(V=tW||(tW={}))[V.display=0]="display",V[V.clip=1]="clip",V[V.ellipsis=2]="ellipsis",(N=tZ||(tZ={}))[N.top=0]="top",N[N.middle=1]="middle",N[N.bottom=2]="bottom",(D=tq||(tq={}))[D.left=0]="left",D[D.middle=1]="middle",D[D.right=2]="right",(k=tK||(tK={})).normal="normal",k.bold="bold",k.lighter="lighter",(z=tQ||(tQ={})).normal="normal",z.italic="italic",z.oblique="oblique";var e7={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(U=tJ||(tJ={}))[U.Custom=0]="Custom",U[U.Rectangle=1]="Rectangle",U[U.Ellipse=2]="Ellipse",U[U.Polygon=3]="Polygon",U[U.Star=4]="Star",t$||(t$={}),t0||(t0={}),(B=t1||(t1={})).video="video",B.image="image",(G=t2||(t2={})).video="video",G.audio="audio",(X=t3||(t3={})).VFXItemData="VFXItemData",X.EffectComponent="EffectComponent",X.Material="Material",X.Shader="Shader",X.SpriteComponent="SpriteComponent",X.ParticleSystem="ParticleSystem",X.InteractComponent="InteractComponent",X.CameraController="CameraController",X.PostProcessVolume="PostProcessVolume",X.Geometry="Geometry",X.Texture="Texture",X.Image="Image",X.AnimationClip="AnimationClip",X.TextComponent="TextComponent",X.BinaryAsset="BinaryAsset",X.TrackAsset="TrackAsset",X.TimelineAsset="TimelineAsset",X.ObjectBindingTrack="ObjectBindingTrack",X.TransformTrack="TransformTrack",X.SpriteColorTrack="SpriteColorTrack",X.ActivationTrack="ActivationTrack",X.SubCompositionTrack="SubCompositionTrack",X.FloatPropertyTrack="FloatPropertyTrack",X.ColorPropertyTrack="ColorPropertyTrack",X.Vector4PropertyTrack="Vector4PropertyTrack",X.TransformPlayableAsset="TransformPlayableAsset",X.SpriteColorPlayableAsset="SpriteColorPlayableAsset",X.ActivationPlayableAsset="ActivationPlayableAsset",X.SubCompositionPlayableAsset="SubCompositionPlayableAsset",X.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",X.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",X.MeshComponent="MeshComponent",X.SkyboxComponent="SkyboxComponent",X.LightComponent="LightComponent",X.CameraComponent="CameraComponent",X.ModelPluginComponent="ModelPluginComponent",X.TreeComponent="TreeComponent",X.AnimationComponent="AnimationComponent",X.SpineComponent="SpineComponent",X.VideoComponent="VideoComponent",X.AudioComponent="AudioComponent",X.RichTextComponent="RichTextComponent",X.OrientationComponent="OrientationComponent",X.ShapeComponent="ShapeComponent",X.TimelineClip="TimelineClip",(j=t4||(t4={}))[j.POINTS=0]="POINTS",j[j.LINES=1]="LINES",j[j.LINE_LOOP=2]="LINE_LOOP",j[j.LINE_STRIP=3]="LINE_STRIP",j[j.TRIANGLES=4]="TRIANGLES",j[j.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",j[j.TRIANGLE_FAN=6]="TRIANGLE_FAN",(H=t5||(t5={}))[H.Float16=0]="Float16",H[H.Float32=1]="Float32",H[H.Int8=2]="Int8",H[H.Int16=3]="Int16",H[H.Int32=4]="Int32",H[H.UInt8=5]="UInt8",H[H.UInt16=6]="UInt16",H[H.UInt32=7]="UInt32",(Y=t6||(t6={}))[Y.None=-1]="None",Y[Y.UInt8=0]="UInt8",Y[Y.UInt16=1]="UInt16",Y[Y.UInt32=2]="UInt32",(W=t8||(t8={})).Position="POSITION",W.Uv="TEXCOORD0",W.Uv2="TEXCOORD1",W.Normal="NORMAL",W.Tangent="TANGENT",W.Color="COLOR",W.Joints="JOINTS",W.Weights="WEIGHTS",W.PositionBS0="POSITION_BS0",W.PositionBS1="POSITION_BS1",W.PositionBS2="POSITION_BS2",W.PositionBS3="POSITION_BS3",W.PositionBS4="POSITION_BS4",W.PositionBS5="POSITION_BS5",W.PositionBS6="POSITION_BS6",W.PositionBS7="POSITION_BS7",W.NormalBS0="NORMAL_BS0",W.NormalBS1="NORMAL_BS1",W.NormalBS2="NORMAL_BS2",W.NormalBS3="NORMAL_BS3",W.TangentBS0="TANGENT_BS0",W.TangentBS1="TANGENT_BS1",W.TangentBS2="TANGENT_BS2",W.TangentBS3="TANGENT_BS3";var it=Object.freeze({__proto__:null,get RenderLevel(){return tT},get BlendingMode(){return tE},get SideMode(){return t_},get MaskMode(){return tA},get ParticleEmitterShapeType(){return tS},get PluginType(){return tC},get InteractType(){return tw},get InteractBehavior(){return tR},get ItemType(){return tO},get RenderMode(){return tM},get ParticleOrigin(){return tI},get RenderType(){return tP},get RenderFace(){return tL},get CameraClipMode(){return tF},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return tV},get BezierKeyframeType(){return tN},get EndBehavior(){return tD},get ParentItemEndBehavior(){return tk},get ParticleInteractionBehavior(){return tz},get ShapeArcMode(){return tU},get LightType(){return tB},get ModelBoundingType(){return tG},get CameraType(){return tX},get MaterialType(){return tj},get MaterialBlending(){return tH},get RenderMode3D(){return tY},get TextOverflow(){return tW},get TextBaseline(){return tZ},get TextAlignment(){return tq},get TextWeight(){return tK},get FontStyle(){return tQ},BuiltinObjectGUID:e7,get ShapePrimitiveType(){return tJ},get ShapeConnectType(){return t$},get ShapePointType(){return t0},get BackgroundType(){return t1},get MultimediaType(){return t2},get DataType(){return t3},get GeometryType(){return t4},get VertexFormatType(){return t5},get IndexFormatType(){return t6},get VertexBufferSemantic(){return t8}});function ie(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ii(t,e,i){return e&&ie(t.prototype,e),i&&ie(t,i),t}var ir=new Map,is=new Map,ia={};function io(t){return function(e,i){ia[t]&&console.warn("Class "+t+" is already registered."),ia[t]=e}}function iu(t){var e=t.constructor;if(is.get(e))return is.get(e);var i={};is.set(e,i);for(var r=t,n=e;n;){var s=ir.get(n);for(var a in s)i[a]=s[a];var o=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(o).constructor)===Object)break;r=o}return i}function ih(t,e){return function(i,r){var n,s=(n=i.constructor,ir.get(n)||ir.set(n,{}),ir.get(n));s&&(s[r]||(s[r]={type:t,sourceName:e}))}}var ic=function(){function t(t){this.engine=t,this.guid=eQ(),this.taggedProperties={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return r(e,t)&&"guid"in e},t}(),il=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}e9(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&eT(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},ii(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(ic);s([ih(void 0,void 0)],il.prototype,"_enabled",void 0);var id=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(il),ip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}e9(e,t);var i=e.prototype;return i.render=function(t){},i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e),this.item.rendererComponents.push(this)},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&eT(this.item.rendererComponents,this),t.prototype.dispose.call(this)},ii(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(il);s([ih(void 0,void 0)],ip.prototype,"materials",void 0),s([ih(void 0,void 0)],ip.prototype,"_priority",void 0);var im=Math.PI/180,iv=180/Math.PI;function iy(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ig=function(t,e,i){return(1-i)*t+i*e};function ix(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}var ib=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):r(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):r(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):r(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):r(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,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.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();ib.ONE=new ib(1,1),ib.ZERO=new ib(0,0);var iT=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}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):r(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):r(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):r(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):r(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,s=e.x,a=e.y,o=e.z;return this.x=r*o-n*a,this.y=n*s-i*o,this.z=i*a-r*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new ib(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iT.X=new iT(1,0,0),iT.Y=new iT(0,1,0),iT.Z=new iT(0,0,1),iT.ONE=new iT(1,1,1),iT.ZERO=new iT(0,0,0);var iE=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):r(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):r(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):r(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):r(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new iT(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iE.ONE=new iE(1,1,1,1),iE.ZERO=new iE(0,0,0,0);var i_=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new sd,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}e9(e,t);var i=e.prototype;return i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(ip);function iA(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}s([ih(void 0,void 0)],i_.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="EffectComponent",i}e9(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.item.time,r=null!=(e=this.material.getVector4("_Time"))?e:new iE;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i))},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(i_),t.EffectComponent=s([io(t3.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return e9(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(id),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),s([ih(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=s([io(t3.PostProcessVolume)],t.PostProcessVolume);var iS=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],s=e[1],a=e[5],o=e[9],u=e[2],h=e[6],c=e[10],l=i+a+c;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(h-o)*f,this.y=(n-u)*f,this.z=(s-r)*f}else if(i>a&&i>c){var d=2*Math.sqrt(1+i-a-c);this.w=(h-o)/d,this.x=.25*d,this.y=(r+s)/d,this.z=(n+u)/d,this.negate()}else if(a>c){var p=2*Math.sqrt(1+a-i-c);this.w=(n-u)/p,this.x=(r+s)/p,this.y=.25*p,this.z=(o+h)/p,this.negate()}else{var m=2*Math.sqrt(1+c-i-a);this.w=(s-r)/m,this.x=(n+u)/m,this.y=(o+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(ix(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,a=e.x,o=e.y,u=e.z,h=e.w;return this.x=i*h+s*a+r*u-n*o,this.y=r*h+s*o+n*a-i*u,this.z=n*h+s*u+i*o-r*a,this.w=s*h-i*a-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,s=this.w,a=s*t.w+i*t.x+r*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=s,this.x=i,this.y=r,this.z=n,this;var o=1-a*a;if(o<=Number.EPSILON){var u=1-e;return this.w=u*s+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(o),c=Math.atan2(h,a),l=Math.sin((1-e)*c)/h,f=Math.sin(e*c)/h;return this.w=s*l+this.w*f,this.x=i*l+this.x*f,this.y=r*l+this.y*f,this.z=n*l+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,s=this.w,a=t.x,o=t.y,u=t.z,h=s*a+r*u-n*o,c=s*o+n*a-i*u,l=s*u+i*o-r*a,f=-i*a-r*o-n*u,d=null!=e?e:t;return d.x=h*s+-(f*i)+-(c*n)- -(l*r),d.y=c*s+-(f*r)+-(l*i)- -(h*n),d.z=l*s+-(f*n)+-(h*r)- -(c*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(iT.ZERO,this,iT.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();iS.tempVec0=new iT;var iC=function(){function t(t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=s,v[6]=a,v[7]=o,v[8]=u,v[9]=h,v[10]=c,v[11]=l,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,s,a,o,u,h,c,l,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=s,v[9]=a,v[13]=o,v[2]=u,v[6]=h,v[10]=c,v[14]=l,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),s=Math.sin(i),a=1-n,o=r.x,u=r.y,h=r.z,c=a*o,l=a*u;return this.set(c*o+n,c*u+s*h,c*h-s*u,0,c*u-s*h,l*u+n,l*h+s*o,0,c*h+s*u,l*h-s*o,a*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(iT.ZERO,t,iT.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,s=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,i),a.normalize(),n.crossVectors(r,a),n.normalize(),s.crossVectors(a,n);var o=this.elements;return o[0]=n.x,o[1]=s.x,o[2]=a.x,o[3]=0,o[4]=n.y,o[5]=s.y,o[6]=a.y,o[7]=0,o[8]=n.z,o[9]=s.z,o[10]=a.z,o[11]=0,o[12]=-n.dot(e),o[13]=-s.dot(e),o[14]=-a.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],a=i[4],o=i[8],u=i[12],h=i[1],c=i[5],l=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],A=r[12],S=r[1],C=r[5],w=r[9],R=r[13],O=r[2],M=r[6],I=r[10],P=r[14],L=r[3],F=r[7],V=r[11],N=r[15];return n[0]=s*T+a*S+o*O+u*L,n[4]=s*E+a*C+o*M+u*F,n[8]=s*_+a*w+o*I+u*V,n[12]=s*A+a*R+o*P+u*N,n[1]=h*T+c*S+l*O+f*L,n[5]=h*E+c*C+l*M+f*F,n[9]=h*_+c*w+l*I+f*V,n[13]=h*A+c*R+l*P+f*N,n[2]=d*T+p*S+m*O+v*L,n[6]=d*E+p*C+m*M+v*F,n[10]=d*_+p*w+m*I+v*V,n[14]=d*A+p*R+m*P+v*N,n[3]=y*T+g*S+x*O+b*L,n[7]=y*E+g*C+x*M+b*F,n[11]=y*_+g*w+x*I+b*V,n[15]=y*A+g*R+x*P+b*N,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],s=t[1],a=t[5],o=t[9],u=t[13],h=t[2],c=t[6],l=t[10],f=t[14];return t[3]*(+n*o*c-r*u*c-n*a*l+i*u*l+r*a*f-i*o*f)+t[7]*(+e*o*f-e*u*l+n*s*l-r*s*f+r*u*h-n*o*h)+t[11]*(+e*u*c-e*a*f-n*s*c+i*s*f+n*a*h-i*u*h)+t[15]*(-r*a*h-e*o*c+e*a*l+r*s*c-i*s*l+i*o*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],a=t[5],o=t[6],u=t[7],h=t[8],c=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=c*m*u-p*l*u+p*o*f-a*m*f-c*o*v+a*l*v,g=d*l*u-h*m*u-d*o*f+s*m*f+h*o*v-s*l*v,x=h*p*u-d*c*u+d*a*f-s*p*f-h*a*v+s*c*v,b=d*c*o-h*p*o-d*a*l+s*p*l+h*a*m-s*c*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*l*n-c*m*n-p*r*f+i*m*f+c*r*v-i*l*v)*E,t[2]=(a*m*n-p*o*n+p*r*u-i*m*u-a*r*v+i*o*v)*E,t[3]=(c*o*n-a*l*n-c*r*u+i*l*u+a*r*f-i*o*f)*E,t[4]=g*E,t[5]=(h*m*n-d*l*n+d*r*f-e*m*f-h*r*v+e*l*v)*E,t[6]=(d*o*n-s*m*n-d*r*u+e*m*u+s*r*v-e*o*v)*E,t[7]=(s*l*n-h*o*n+h*r*u-e*l*u-s*r*f+e*o*f)*E,t[8]=x*E,t[9]=(d*c*n-h*p*n-d*i*f+e*p*f+h*i*v-e*c*v)*E,t[10]=(s*p*n-d*a*n+d*i*u-e*p*u-s*i*v+e*a*v)*E,t[11]=(h*a*n-s*c*n-h*i*u+e*c*u+s*i*f-e*a*f)*E,t[12]=b*E,t[13]=(h*p*r-d*c*r+d*i*l-e*p*l-h*i*m+e*c*m)*E,t[14]=(d*a*r-s*p*r-d*i*o+e*p*o+s*i*m-e*a*m)*E,t[15]=(s*c*r-h*a*r+h*i*o-e*c*o-s*i*l+e*a*l)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=iT.ZERO);var n=this.elements,s=e.x,a=e.y,o=e.z,u=e.w,h=-r.x,c=-r.y,l=-r.z,f=s+s,d=a+a,p=o+o,m=s*f,v=s*d,y=s*p,g=a*d,x=a*p,b=o*p,T=u*f,E=u*d,_=u*p,A=i.x,S=i.y,C=i.z;return n[0]=(1-(g+b))*A,n[1]=(v+_)*A,n[2]=(y-E)*A,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*C,n[9]=(x-T)*C,n[10]=(1-(m+g))*C,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,s=this.elements,a=n.set(s[0],s[1],s[2]).length(),o=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();0>this.determinant()&&(a=-a),e.x=s[12],e.y=s[13],e.z=s[14];var h=t.tempMat0;h.copyFrom(this);var c=1/a,l=1/o,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=a,r.y=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new iT,e=new iS,i=new iT;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,s){var a=1/(e-t),o=1/(i-r),u=1/(s-n),h=-(e+t)*a,c=-(i+r)*o,l=-(s+n)*u;a*=2,o*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=c,f[14]=l,f[15]=1,this},e.perspective=function(t,e,i,r,n){var s=1/Math.tan(.5*t),a=1/(i-r),o=this.elements;return o[0]=n?s:s/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?s*e:s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*a,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*a,o[15]=0,(null===r||r===1/0)&&(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;a.x=s[0]*i+s[4]*r+s[8]*n+s[12],a.y=s[1]*i+s[5]*r+s[9]*n+s[13],a.z=s[2]*i+s[6]*r+s[10]*n+s[14];var o=s[3]*i+s[7]*r+s[11]*n+s[15];return a.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n+s[12],a.y=s[1]*i+s[5]*r+s[9]*n+s[13],a.z=s[2]*i+s[6]*r+s[10]*n+s[14],a},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n,a.y=s[1]*i+s[5]*r+s[9]*n,a.z=s[2]*i+s[6]*r+s[10]*n,a.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12]*s,o.y=a[1]*i+a[5]*r+a[9]*n+a[13]*s,o.z=a[2]*i+a[6]*r+a[10]*n+a[14]*s,o.w=a[3]*i+a[7]*r+a[11]*n+a[15]*s,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!iy(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,s){return new t().perspective(e,i,r,n,s)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,s,a,o,u,h,c,l,f,d,p,m,v){return new t(e,s,h,d,i,a,c,p,r,o,l,m,n,u,f,v)},t}();function iw(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function iR(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 iw(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return iw(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}iC.IDENTITY=new iC(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),iC.ZERO=new iC(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),iC.tempVec0=new iT,iC.tempVec1=new iT,iC.tempVec2=new iT,iC.tempMat0=new iC,t.ShaderCompileResultStatus=void 0,(Z=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Z.noShader=0]="noShader",Z[Z.success=1]="success",Z[Z.fail=2]="fail",Z[Z.compiling=3]="compiling",t.GLSLVersion=void 0,(q=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",q.GLSL3="300 es";var iO=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return e9(e,t),e}(ic);t.Shader=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=iR(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var s=this.engine.getShaderLibrary().createShader(this.shaderData,e);return s.shader=this,s},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(ic),t.Shader=s([io(t3.Shader)],t.Shader);var iM="effects-internal-copy",iI="effects-internal-copy-mesh",iP="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",iL="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function iF(e,i){return{name:iM,vertex:iP,fragment:iL,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:iI+ +i}}function iV(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function iN(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),n=i(function(){return a(this,function(i){return[2,new Promise(function(i,s){if(r){var a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),o=t.getParameter(e.GPU_DISJOINT_EXT);a&&!o&&i(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(a||o)&&(t.deleteQuery(r),r=null),null!==a&&r&&window.setTimeout(function(){n().then(i).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}var iD=[],ik={};function iz(){"function"==typeof WebGL2RenderingContext?iB(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iB(WebGLRenderingContext),iB(WebGLRenderingContext.prototype)):iD.push("iOS16 lockdown mode, WebGL Constants not in global"),iD.length||"HALF_FLOAT"in ik||(ik.HALF_FLOAT=5131)}function iU(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function iB(t){for(var e in t)/^[A-Z_]/.test(e)&&(ik[e]=t[e])}function iG(t){switch(t){case t5.Float32:return WebGLRenderingContext.FLOAT;case t5.Int16:return WebGLRenderingContext.SHORT;case t5.Int8:return WebGLRenderingContext.BYTE;case t5.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case t5.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function iX(t){switch(t){case tE.ALPHA:case tE.ADD:case tE.SUBTRACTION:case tE.STRONG_LIGHT:case tE.WEAK_LIGHT:return 1;case tE.SUPERPOSITION:return 2;case tE.BRIGHTNESS:return 3;case tE.MULTIPLY:return 0;default:return 1}}function ij(t,e){switch(e){case void 0:case tE.ALPHA:t.blendFunction=[ik.ONE,ik.ONE_MINUS_SRC_ALPHA,ik.ONE,ik.ONE_MINUS_SRC_ALPHA];break;case tE.ADD:t.blendFunction=[ik.ONE,ik.ONE,ik.ONE,ik.ONE];break;case tE.SUBTRACTION:t.blendFunction=[ik.ONE,ik.ONE,ik.ZERO,ik.ONE],t.blendEquation=[ik.FUNC_REVERSE_SUBTRACT,ik.FUNC_REVERSE_SUBTRACT];break;case tE.SUPERPOSITION:t.blendFunction=[ik.ONE,ik.ONE,ik.ONE,ik.ONE];break;case tE.MULTIPLY:t.blendFunction=[ik.DST_COLOR,ik.ONE_MINUS_SRC_ALPHA,ik.DST_COLOR,ik.ONE_MINUS_SRC_ALPHA];break;case tE.BRIGHTNESS:t.blendFunction=[ik.ONE,ik.ONE_MINUS_SRC_ALPHA,ik.ONE,ik.ONE_MINUS_SRC_ALPHA];break;case tE.STRONG_LIGHT:t.blendFunction=[ik.DST_COLOR,ik.DST_ALPHA,ik.ZERO,ik.ONE];break;case tE.WEAK_LIGHT:t.blendFunction=[ik.DST_COLOR,ik.ZERO,ik.ZERO,ik.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iH(t,e){e===t_.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=ik.CW,t.cullFace=e===t_.BACK?ik.BACK:ik.FRONT)}function iY(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tA.MASK:t.stencilTest=!0,t.stencilFunc=[ik.ALWAYS,ik.ALWAYS],t.stencilOpZPass=[ik.REPLACE,ik.REPLACE];break;case tA.OBSCURED:t.stencilTest=!0,t.stencilFunc=[ik.EQUAL,ik.EQUAL];break;case tA.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[ik.NOTEQUAL,ik.NOTEQUAL];break;case tA.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iW(){return(iW=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}iD.length||iz(),t.ShaderType=void 0,(K=t.ShaderType||(t.ShaderType={}))[K.vertex=0]="vertex",K[K.fragment=1]="fragment",t.TextureLoadAction=void 0,(Q=t.TextureLoadAction||(t.TextureLoadAction={}))[Q.whatever=0]="whatever",Q[Q.clear=2]="clear",t.TextureSourceType=void 0,(J=t.TextureSourceType||(t.TextureSourceType={}))[J.none=0]="none",J[J.data=1]="data",J[J.image=2]="image",J[J.compressed=3]="compressed",J[J.video=4]="video",J[J.canvas=5]="canvas",J[J.framebuffer=6]="framebuffer",J[J.mipmaps=7]="mipmaps";var iZ=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var s=new XMLHttpRequest,a=function(){n.finish(t,s.status,s.response)};s.responseType=e,s.addEventListener("load",function(){200==s.status||0==s.status?n.finish(t,200,s.response):a()}),s.addEventListener("error",a),s.open("GET",t,!0),s.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[i]:[e,i],s=n.length-1,a=r.length;s<a;s+=2)r[s].apply(null,n)},t}(),iq=!1,iK=!1;function iQ(t,e){return iJ.apply(this,arguments)}function iJ(){return(iJ=i(function(t,e){return a(this,function(i){switch(i.label){case 0:if(!(iq||!e))return[3,2];return[4,i1(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,i1(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iq=!0,[4,i1(t)];case 6:return[2]}})})).apply(this,arguments)}function i$(t,e){return i0.apply(this,arguments)}function i0(){return(i0=i(function(t,e){return a(this,function(i){switch(i.label){case 0:if(!(iK||!e))return[3,2];return[4,i1(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,i1(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iK=!0,[4,i1(t)];case 6:return[2]}})})).apply(this,arguments)}function i1(t){return i2.apply(this,arguments)}function i2(){return(i2=i(function(t){var e,i;return a(this,function(n){if(e="",r(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else r(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function i3(t){return i4.apply(this,arguments)}function i4(){return(i4=i(function(t){return a(this,function(e){return[2,new Promise(function(e,i){new iZ().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function i5(){return(i5=i(function(t){return a(this,function(e){return[2,new Promise(function(e,i){new iZ().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function i6(t){return i8.apply(this,arguments)}function i8(){return(i8=i(function(t){var e;return a(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eM()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play();r?r.then(function(){return t(e)}):e.addEventListener("loadeddata",function i(){t(e),e.removeEventListener("loadeddata",i)},!0),e.addEventListener("error",function(t){i("Load video fail.")})})]})})).apply(this,arguments)}function i9(t,e){return i7.apply(this,arguments)}function i7(){return(i7=i(function(t,e){return a(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function rt(t,e,i){return re.apply(this,arguments)}function re(){return(re=i(function(e,i,r,n){var s,o,u,h,c,l,f;return a(this,function(a){switch(a.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return s=e.mipmaps,o=e.target,[4,Promise.all(s.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:ri(t,i)}))}))];case 1:return u=a.sent(),[2,iW({keepImageSource:!1},e,{mipmaps:u,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return h=e.mipmaps,c=e.target,[4,Promise.all(h.map(function(t){return ri(t,i)}))];case 3:return l=a.sent(),f=n[h[0][1][0]].url,[2,iW({keepImageSource:!1},e,{mipmaps:l,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:h.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function ri(t,e){return rr.apply(this,arguments)}function rr(){return(rr=i(function(t,e){var i,r,n,s,o;return a(this,function(a){if(r=(i=t[1])[0],n=i[1],s=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,i1(new Blob([new Uint8Array(o,n,s)]))]})})).apply(this,arguments)}var rn=1,rs=function(e){function r(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+rn++,i}e9(r,e);var n=r.prototype;return n.getWidth=function(){return this.width||0},n.getHeight=function(){return this.height||0},n.uploadCurrentVideoFrame=function(){},n.offloadData=function(){},n.reloadData=function(){},n.initialize=function(){},n.assembleOptions=function(e){var i=e.target,r=void 0===i?ik.TEXTURE_2D:i,n=e.format,s=void 0===n?ik.RGBA:n;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=0),iW({minFilter:ik.NEAREST,magFilter:ik.NEAREST,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE,target:r,format:ik.RGBA,internalFormat:s,type:ik.UNSIGNED_BYTE},e)},r.fromImage=function(e,n,s){return i(function(){var i,o;return a(this,function(a){switch(a.label){case 0:return[4,i1(e)];case 1:return i=a.sent(),(o=r.create(n,iW({sourceType:t.TextureSourceType.image,image:i,target:ik.TEXTURE_2D,id:eQ(),flipY:!0},s))).initialize(),[2,o]}})})()},r.fromVideo=function(e,n,s){return i(function(){var i,o;return a(this,function(a){switch(a.label){case 0:return[4,i6(e)];case 1:return i=a.sent(),(o=r.create(n,iW({sourceType:t.TextureSourceType.video,video:i,id:eQ(),flipY:!0},s))).initialize(),[2,o]}})})()},ii(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(ic);function ra(t,e,i,r){var n,s,a=e.length/i/r;return s=n=4===a||0===a?ik.RGBA:3===a?ik.RGB:2===a?ik.LUMINANCE_ALPHA:ik.LUMINANCE,rs.createWithData(t,{data:e,width:i,height:r},{type:ik.HALF_FLOAT,format:n,internalFormat:s,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE})}var ro={type:ik.UNSIGNED_BYTE,format:ik.RGBA,internalFormat:ik.RGBA,wrapS:ik.MIRRORED_REPEAT,wrapT:ik.MIRRORED_REPEAT,minFilter:ik.NEAREST,magFilter:ik.NEAREST};function ru(e){return rs.create(e,iW({id:e7.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},ro))}function rh(e){return rs.create(e,iW({id:e7.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},ro))}var rc=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===s.getUint32(0,!0);if(this.glType=s.getUint32(1*n,a),this.glTypeSize=s.getUint32(2*n,a),this.glFormat=s.getUint32(3*n,a),this.glInternalFormat=s.getUint32(4*n,a),this.glBaseInternalFormat=s.getUint32(5*n,a),this.pixelWidth=s.getUint32(6*n,a),this.pixelHeight=s.getUint32(7*n,a),this.pixelDepth=s.getUint32(8*n,a),this.numberOfArrayElements=s.getUint32(9*n,a),this.numberOfFaces=s.getUint32(10*n,a),this.numberOfMipmapLevels=s.getUint32(11*n,a),this.bytesOfKeyValueData=s.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eG.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eG.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eG.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+".");return}0===this.glType?this.loadType=0:this.loadType=2}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,a=0;a<s;a++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,o);e.push({data:h,width:r,height:n}),i+=o+4+(3-(o+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function rl(e){var i=new rc(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,s=i.pixelHeight,a=i.glType,o=i.numberOfFaces,u=i.glInternalFormat,h=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===o?ik.TEXTURE_CUBE_MAP:ik.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,s))+1))}}var rf=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return i(function(){var i,r;return a(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,s=e.url;return r===ik.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:ej(s)&&s.length>0}if(i===t.TextureSourceType.mipmaps){var a=e.bin,o=e.mipmaps,u=e.target,h=e.maps,c=e.urls;return a?o.length>0:u===ik.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):c.every(function(t){return ej(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var n=this;return i(function(){var i,s,o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E;return a(this,function(a){switch(a.label){case 0:if(i=e.type,s=e.target,o=e.map,u=e.url,h=e.bin,c=e.mipmaps,l=e.urls,f=e.maps,!(s===ik.TEXTURE_CUBE_MAP&&i!==t.TextureSourceType.mipmaps))return[3,2];return[4,n.loadCubeMap(o)];case 1:return d=a.sent(),[2,iW({},r,{cube:d,target:ik.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iW({},o),target:ik.TEXTURE_CUBE_MAP}})];case 2:if(i!==t.TextureSourceType.image)return[3,4];return[4,i1(u)];case 3:return p=a.sent(),[2,iW({},r,{image:p,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:u,target:ik.TEXTURE_2D}})];case 4:if(i!==t.TextureSourceType.video)return[3,6];return[4,i6(u)];case 5:return m=a.sent(),[2,iW({},r,{video:m,sourceType:t.TextureSourceType.video})];case 6:if(i!==t.TextureSourceType.compressed)return[3,8];return[4,i3(u)];case 7:return v=a.sent(),[2,iW({},rl(v),r,{sourceFrom:{url:u,type:t.TextureSourceType.compressed}})];case 8:if(i!==t.TextureSourceType.mipmaps)return[3,17];if(!h)return[3,13];return[4,i3(h)];case 9:if(y=a.sent(),x=(g=null!=s?s:ik.TEXTURE_2D)===ik.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),s!==ik.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return n.loadMipmapImages(t,y)}))];case 10:return b=a.sent(),[3,12];case 11:b=n.loadMipmapImages(c,y),a.label=12;case 12:return[2,iW({},r,{mipmaps:b,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:h,mipmaps:x,target:g,type:t.TextureSourceType.mipmaps}})];case 13:if(!(s===ik.TEXTURE_2D||!s))return[3,15];return[4,Promise.all(l.map(function(t){return i1(t)}))];case 14:return T=a.sent(),[2,iW({},r,{mipmaps:T,target:ik.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:ik.TEXTURE_2D}})];case 15:if(s!==ik.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(f.map(function(t){return n.loadCubeMap(t)}))];case 16:return E=a.sent(),[2,iW({},r,{mipmaps:E,target:ik.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map(function(t){return iW({},t)}),target:ik.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+i+".")}})})()},r.loadMipmapImages=function(t,e){return i(function(){return a(this,function(i){return[2,Promise.all(t.map(function(t){return i1(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return i(function(){return a(this,function(e){return[2,Promise.all(t.map(function(t){return i1(t)}))]})})()},e}();function rd(){return t9||(t9=new rf),t9}var rp=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function rm(t){return"object"==typeof t&&t&&void 0===t.length&&r(t,rs)}t.MaterialRenderType=void 0,($=t.MaterialRenderType||(t.MaterialRenderType={}))[$.normal=0]="normal",$[$.transformFeedback=1]="transformFeedback";var rv=1,ry=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,s=void 0===n?"Material"+rv++:n,a=i.renderType,o=i.shader,u=i.uniformSemantics;r.name=s,r.renderType=void 0===a?0:a,r.shaderSource=o,r.props=i,r.uniformSemantics=iW({},u)}else r.name="Material"+rv++,r.renderType=0;return r}e9(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},ii(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(ic),rg={format:ik.RGBA,type:ik.UNSIGNED_BYTE,minFilter:ik.LINEAR,magFilter:ik.LINEAR,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE},rx=Symbol("dispose"),rb=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,s=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:s},o=[s];Object.getOwnPropertyNames(rg).forEach(function(t){var i,r=null!=(i=e[t])?i:rg[t];a[t]=r,o.push(t,r)});var u=o.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var c=this.engine;ez(c),h=rs.create(c,a),this.textureCache[u]=h,this.textureRef[u]=1,h[rx]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[rx](),i.dispose=i[rx]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[rx](),i.dispose=i[rx]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),rT=function(){function t(t){void 0===t&&(t={}),this.semantics=iW({},t)}var e=t.prototype;return e.toObject=function(){return iW({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return eY(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach(function(e){delete t.semantics[e]})},t}(),rE=((t7={})[ik.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t7[ik.INT]=Int32Array.BYTES_PER_ELEMENT,t7[ik.SHORT]=Int16Array.BYTES_PER_ELEMENT,t7[ik.BYTE]=Int8Array.BYTES_PER_ELEMENT,t7),r_=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(ic);function rA(t){return t===ik.INT?new Int32Array(0):t===ik.SHORT?new Int16Array(0):new Float32Array(0)}(tt=et||(et={}))[tt.XYZ=0]="XYZ",tt[tt.XZY=1]="XZY",tt[tt.YXZ=2]="YXZ",tt[tt.YZX=3]="YZX",tt[tt.ZXY=4]="ZXY",tt[tt.ZYX=5]="ZYX";var rS=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],s=i[8],a=i[1],o=i[5],u=i[9],h=i[2],c=i[6],l=i[10];switch(e){case et.XYZ:this.y=Math.asin(ix(s,-1,1)),.9999999>Math.abs(s)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(c,o),this.z=0);break;case et.YXZ:this.x=Math.asin(-ix(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(s,l),this.z=Math.atan2(a,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case et.ZXY:this.x=Math.asin(ix(c,-1,1)),.9999999>Math.abs(c)?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(a,r));break;case et.ZYX:this.y=Math.asin(-ix(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(c,l),this.z=Math.atan2(a,r)):(this.x=0,this.z=Math.atan2(-n,o));break;case et.YZX:this.z=Math.asin(ix(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(s,l));break;case et.XZY:this.z=Math.asin(-ix(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(c,o),this.y=Math.atan2(s,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=iv,this.y*=iv,this.z*=iv,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,s,a;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(a=t[e+3])?a:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new iS;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,s=Math.cos(e*im*.5),a=Math.cos(i*im*.5),o=Math.cos(r*im*.5),u=Math.sin(e*im*.5),h=Math.sin(i*im*.5),c=Math.sin(r*im*.5);switch(n){case et.XYZ:t.set(u*a*o+s*h*c,s*h*o-u*a*c,s*a*c+u*h*o,s*a*o-u*h*c);break;case et.YXZ:t.set(u*a*o+s*h*c,s*h*o-u*a*c,s*a*c-u*h*o,s*a*o+u*h*c);break;case et.ZXY:t.set(u*a*o-s*h*c,s*h*o+u*a*c,s*a*c+u*h*o,s*a*o-u*h*c);break;case et.ZYX:t.set(u*a*o-s*h*c,s*h*o+u*a*c,s*a*c-u*h*o,s*a*o+u*h*c);break;case et.YZX:t.set(u*a*o+s*h*c,s*h*o+u*a*c,s*a*c-u*h*o,s*a*o-u*h*c);break;case et.XZY:t.set(u*a*o-s*h*c,s*h*o-u*a*c,s*a*c+u*h*o,s*a*o+u*h*c);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,s=this.order,a=Math.cos(i*im),o=Math.sin(i*im),u=Math.cos(r*im),h=Math.sin(r*im),c=Math.cos(n*im),l=Math.sin(n*im);if(s===et.XYZ){var f=a*c,d=a*l,p=o*c,m=o*l;e[0]=u*c,e[4]=-u*l,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-o*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=a*u}else if(s===et.YXZ){var v=u*c,y=u*l,g=h*c,x=h*l;e[0]=v+x*o,e[4]=g*o-y,e[8]=a*h,e[1]=a*l,e[5]=a*c,e[9]=-o,e[2]=y*o-g,e[6]=x+v*o,e[10]=a*u}else if(s===et.ZXY){var b=u*c,T=u*l,E=h*c,_=h*l;e[0]=b-_*o,e[4]=-a*l,e[8]=E+T*o,e[1]=T+E*o,e[5]=a*c,e[9]=_-b*o,e[2]=-a*h,e[6]=o,e[10]=a*u}else if(s===et.ZYX){var A=a*c,S=a*l,C=o*c,w=o*l;e[0]=u*c,e[4]=C*h-S,e[8]=A*h+w,e[1]=u*l,e[5]=w*h+A,e[9]=S*h-C,e[2]=-h,e[6]=o*u,e[10]=a*u}else if(s===et.YZX){var R=a*u,O=a*h,M=o*u,I=o*h;e[0]=u*c,e[4]=I-R*l,e[8]=M*l+O,e[1]=l,e[5]=a*c,e[9]=-o*c,e[2]=-h*c,e[6]=O*l+M,e[10]=R-I*l}else if(s===et.XZY){var P=a*u,L=a*h,F=o*u,V=o*h;e[0]=u*c,e[4]=-l,e[8]=h*c,e[1]=P*l+V,e[5]=a*c,e[9]=L*l-F,e[2]=F*l-L,e[6]=o*c,e[10]=V*l+P}else console.error("toMatrix4: Invalid order "+s);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();rS.DEFAULT_ORDER=et.ZYX,rS.tempQuat0=new iS,rS.tempMat0=new iC;var rC=function(){function t(t,e,i,r,n,s,a,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,s,a,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=a,h[1]=e,h[4]=n,h[7]=o,h[2]=i,h[5]=s,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=s,h[2]=a,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,s=e+e,a=i+i,o=r+r,u=e*s,h=e*a,c=e*o,l=i*a,f=i*o,d=r*o,p=n*s,m=n*a,v=n*o,y=this.elements;return y[0]=1-(l+d),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=c+m,y[7]=f-p,y[8]=1-(u+l),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],s=r[3],a=r[6],o=r[1],u=r[4],h=r[7];return r[0]=e*n+i*o,r[3]=e*s+i*u,r[6]=e*a+i*h,r[1]=-i*n+e*o,r[4]=-i*s+e*u,r[7]=-i*a+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],a=i[3],o=i[6],u=i[1],h=i[4],c=i[7],l=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=s*p+a*y+o*b,n[3]=s*m+a*g+o*T,n[6]=s*v+a*x+o*E,n[1]=u*p+h*y+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*p+f*y+d*b,n[5]=l*m+f*g+d*T,n[8]=l*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8];return e*(s*h-u*a)+n*(u*r-i*h)+o*(i*a-s*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8],c=h*s-u*a,l=u*r-h*i,f=a*i-s*r,d=e*c+n*l+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=c*p,t[1]=(o*a-h*n)*p,t[2]=(u*n-o*s)*p,t[3]=l*p,t[4]=(h*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-a*e)*p,t[8]=(s*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[3]*r+s[6]*n,a.y=s[1]*i+s[4]*r+s[7]*n,a.z=s[2]*i+s[5]*r+s[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!iy(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,s,a,o,u,h){return new t(e,n,o,i,s,u,r,a,h)},t}(),rw=function(){function t(t,e){void 0===t&&(t=iT.ZERO),void 0===e&&(e=iT.X),this.origin=new iT,this.direction=new iT,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new iT;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,s,a,o,u=this.origin,h=u.x,c=u.y,l=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,A=1/d,S=1/p,C=1/m;if(A>=0?(i=(y-h)*A,r=(T-h)*A):(i=(T-h)*A,r=(y-h)*A),S>=0?(n=(g-c)*S,s=(E-c)*S):(n=(E-c)*S,s=(g-c)*S),!(i>s)&&!(n>r)&&((n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),(n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),C>=0?(a=(x-l)*C,o=(_-l)*C):(a=(_-l)*C,o=(x-l)*C),!(i>o)&&!(a>r))&&((a>i||i!=i)&&(i=a),(o<r||r!=r)&&(r=o),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new iT).copyFrom(this.origin):void 0;var s=-(this.origin.dot(i)+r)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),s=n.dot(this.direction),a=n.dot(n)-s*s,o=e.radius*e.radius;if(!(a>o)){var u=Math.sqrt(o-a),h=s-u,c=s+u;if(!(c<0))return h>=0?this.at(h,i):this.at(c,i)}},e.intersectTriangle=function(e,i,r){var n,s=e.p0,a=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(a,s),h=t.tempVec1.subtractVectors(o,s),c=t.tempVec2.subtractVectors(this.origin,s),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(c);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();rw.tempVec0=new iT,rw.tempVec1=new iT,rw.tempVec2=new iT,rw.tempVec3=new iT;var rR=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,s=t/60,a=n*(1-Math.abs(s%2-1)),o=0,u=0,h=0;s>=0&&s<=1?(o=n,u=a):s>=1&&s<=2?(o=a,u=n):s>=2&&s<=3?(u=n,h=a):s>=3&&s<=4?(u=a,h=n):s>=4&&s<=5?(o=a,h=n):s>=5&&s<=6&&(o=n,h=a);var c=i-n;return this.set(o+c,u+c,h+c,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):r(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):r(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):r(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):r(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new iE(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,s=Math.max(e,i,r),a=Math.min(e,i,r),o=s-a,u=0,h=0;return 0!==s&&(h=o/s),s!=a&&(s==e?(u=(i-r)/o,i<r&&(u+=6)):s==i?u=(r-e)/o+2:s==r&&(u=(e-i)/o+4),u*=60),new t(u,h,s,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+s:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();rR.BLACK=new rR(0,0,0,1),rR.BLUE=new rR(0,0,1,1),rR.CLEAR=new rR(0,0,0,0),rR.CYAN=new rR(0,1,1,1),rR.GRAY=new rR(.5,.5,.5,1),rR.GREEN=new rR(0,1,0,1),rR.MAGENTA=new rR(1,0,1,1),rR.RED=new rR(1,0,0,1),rR.WHITE=new rR(1,1,1,1),rR.YELLOW=new rR(1,.92,.016,1);var rO=function(){function t(t,e){void 0===t&&(t=new iT(1/0,1/0,1/0)),void 0===e&&(e=new iT(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,s=-1/0,a=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],c=t[o+1],l=t[o+2];h<e&&(e=h),c<i&&(i=c),l<r&&(r=l),h>n&&(n=h),c>s&&(s=c),l>a&&(a=l)}return this.min.set(e,i,r),this.max.set(n,s,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new iT),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new iT),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,s=0,a=n.length;s<a;s++)this.expandByObject(n[s]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new iT),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new iT;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new iT),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new iT),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new iT),this.isEmpty())return[];var i=[];return i[0]=new iT(this.min.x,this.min.y,this.min.z),i[1]=new iT(this.min.x,this.min.y,this.max.z),i[2]=new iT(this.min.x,this.max.y,this.min.z),i[3]=new iT(this.min.x,this.max.y,this.max.z),i[4]=new iT(this.max.x,this.min.y,this.min.z),i[5]=new iT(this.max.x,this.min.y,this.max.z),i[6]=new iT(this.max.x,this.max.y,this.min.z),i[7]=new iT(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new iT;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),rM=function(){function t(t,e){void 0===t&&(t=iT.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var s=new rO().setFromPoints(t);s.getCenter(i),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new iT),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new rO),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new iT().subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=(r-this.radius)*.5;this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new iT,i=new iT;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=new iT().subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),rI=Object.freeze({__proto__:null,get EulerOrder(){return et},Euler:rS,Quaternion:iS,Vector2:ib,Vector3:iT,Vector4:iE,Matrix3:rC,Matrix4:iC,Ray:rw,PI2:2*Math.PI,DEG2RAD:im,RAD2DEG:iv,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:iy,damp:function(t,e,i,r){return ig(t,e,1-Math.exp(-i*r))},lerp:ig,degToRad:function(t){return t*im},radToDeg:function(t){return t*iv},clamp:ix,Color:rR,Box3:rO,Sphere:rM}),rP=1,rL=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,s=i.geometry,a=i.name,o=i.priority,u=i.worldMatrix,h=void 0===u?iC.fromIdentity():u;r.id="Mesh"+rP++,r.name=void 0===a?"<unnamed>":a,r.geometry=s,r.material=n,r.priority=void 0===o?0:o,r.worldMatrix=h}else r.id="Mesh"+rP++,r.name="<unnamed>",r.worldMatrix=iC.fromIdentity(),r._priority=0;return r}e9(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.restore=function(){},r.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var i=null==e?void 0:e.material;i!==t.DestroyOptions.keep&&this.material.dispose(i),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},ii(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ip);t.RenderPassAttachmentStorageType=void 0,(te=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[te.none=0]="none",te[te.color=1]="color",te[te.stencil_8_opaque=2]="stencil_8_opaque",te[te.depth_16_opaque=3]="depth_16_opaque",te[te.depth_stencil_opaque=4]="depth_stencil_opaque",te[te.depth_16_texture=5]="depth_16_texture",te[te.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(ti=t.TextureStoreAction||(t.TextureStoreAction={}))[ti.store=0]="store",ti[ti.clear=2]="clear";var rF=function(){function e(e,i){if(this.destroyed=!1,i){var n=i.texture,s=i.size;if(r(n,rs))this.texture=n,this.externalTexture=!0;else if(n){var a=n.wrapT,o=n.wrapS,u=n.minFilter,h=n.magFilter,c=n.internalFormat,l=n.format,f=void 0===l?ik.RGBA:l,d=n.type,p=void 0===d?ik.UNSIGNED_BYTE:d;this.externalTexture=!1,this.textureOptions={size:s,format:f,type:p,internalFormat:c||f,wrapT:a,wrapS:o,minFilter:u,magFilter:h,name:i.name},this.texture=rs.create(e,iW({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:s[0],height:s[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},ii(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),e}();t.RenderPassDestroyAttachmentType=void 0,(tr=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tr.force=0]="force",tr[tr.keep=1]="keep",tr[tr.keepExternal=2]="keepExternal",tr[tr.destroy=0]="destroy";var rV=1,rN=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+rV++:r,s=i.clearAction,a=i.semantics,o=i.depthStencilAttachment,u=i.storeAction,h=i.priority,c=i.meshOrder,l=void 0===c?t.OrderType.ascending:c,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=l,this.meshes=eN((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==o?void 0:o.storageType)||0,this.clearAction=iW({},s),this.storeAction=iW({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new rT(a),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){eD(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eT(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eN(this.meshes,this.meshOrder),this.meshes},i.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},i.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],s=e[3];t.setViewport(i,r,n,s)}},i.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},i.frameCleanup=function(t){},i.resetColorAttachments=function(e){var i=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new rF(i.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(e.map(function(t){return t})))}else this.resetAttachments({attachments:e.map(function(t){return{texture:t}})})},i.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},i.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},i._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*s,r.getHeight()*s],o=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map(function(t,e){var r;return new rF(i.renderer.engine,iW({size:o,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var c=ne.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);c.bind(),c.unbind(),this.framebuffer=c}else this.attachments.length=0},i.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},i.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},i.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},i.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},i.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},i.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},i.dispose=function(e){if(!this.destroyed){var i,r,n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(n)}),this.meshes.length=0;var s=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===s||1===s||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,o=this.framebuffer;o&&(o.dispose({depthStencilAttachment:a}),o.externalStorage&&2===a||1===a||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eK}},ii(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),e}(),rD="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",rk="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",rz="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(_MainTex,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",rU="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",rB="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",rG="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",rX="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",rj="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",rH="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",rY="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",rW="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",rZ="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",rq={},rK=function(){function e(){}return e.registerInclude=function(t,e){rq[t]&&eG.warn('The "'+t+'" shader include already exist.'),rq[t]=e},e.unRegisterInclude=function(t){delete rq[t]},e.unRegisterAllIncludes=function(){Object.keys(rq).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,s=i.shader,a=i.macros,o=i.removeVersion,u=e.genMacroString(r,a),h=e.genShaderVersion(r),c=e.parseIncludes(s),l=e.isVersion300(c);return(c=e.removeWebGLVersion(c),2!==r||l||(c=e.convertTo300(c,n===t.ShaderType.fragment)),o)?u+c:h+u+c},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=rq[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&i.add(s[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),rQ=function(e){function i(i,r){var n,s=(n=e.call(this,i,r)||this).renderer.engine,a=r_.create(s,{mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=ry.create(s,{shader:{vertex:rX,fragment:rZ,glslVersion:t.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,n.screenMesh=rL.create(s,{geometry:a,material:o,priority:0}),n.priority=5e3,n}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var i,r,n,s=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.screenMesh.material.setFloat("_Threshold",s),e.renderMeshes([this.screenMesh])},i}(rN),rJ=function(e){function i(i,r,n){(s=e.call(this,i,n)||this).type=r;var s,a=s.renderer.engine,o="PostProcess",u=r_.create(a,{name:o,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:rX,fragment:"H"==r?rH:rY,glslVersion:t.GLSLVersion.GLSL1},c=ry.create(a,{name:o,shader:h});return c.blending=!1,c.depthTest=!1,c.culling=!1,s.screenMesh=rL.create(a,{name:o,geometry:u,material:c,priority:0}),s.priority=5e3,s}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",r4(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(rN),r$=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",s=r.renderer.engine,a=r_.create(s,{name:n,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=ry.create(s,{name:n,shader:{vertex:rX,fragment:rW}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=rL.create(s,{name:n,geometry:a,material:o,priority:0}),r.priority=5e3,r}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",r4(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(rN),r0=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,s="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=r||new rF(a);var o=r_.create(a,{name:s,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ry.create(a,{name:s,shader:{vertex:rX,fragment:rj,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=rL.create(a,{name:s,geometry:o,material:u,priority:0}),n.priority=5e3,n}e9(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=iW({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=iW({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),s=iW({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),a=iW({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,s.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*s.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*s.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new ib(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iT(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),e.renderMeshes([this.screenMesh])},i}(rN),r1="_effects_default_",r2=1,r3=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,s=e.keepColorBuffer,a=e.renderer,o=e.editorTransform,u=e.globalVolume,h=e.postProcessingEnabled,c=void 0!==h&&h,l=e.clearAction,f=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,d=a.engine;u&&(this.globalVolume=u),this.globalUniforms=new r6;var p=[],m={};if(this.renderer=a,c){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=ik.HALF_FLOAT;p=[{texture:{format:ik.RGBA,type:v,magFilter:ik.LINEAR,minFilter:ik.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new rN(a,{name:r1,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),c){var g=new rF(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=ik.HALF_FLOAT,E=new rQ(a,{name:"BloomThresholdPass",attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new rF(d);var A=new rJ(a,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]}),S=new rJ(a,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]});S.gaussianResult=b[_],this.addRenderPass(A),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var C=0;C<6;C++){var w=new r$(a,{name:"GaussianUpPass"+C,viewport:x,attachments:[{texture:{format:ik.RGBA,type:T,minFilter:ik.LINEAR,magFilter:ik.LINEAR}}]});w.gaussianDownSampleResult=b[5-C],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new r0(a,g);this.addRenderPass(R)}this.semantics=new rT(e.semantics),this.clearAction=f,this.name="RenderFrame"+r2++;var O=y[0];this.emptyTexture=ru(d),this.transparentTexture=rh(d),this.camera=n,this.keepColorBuffer=s,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=iE.fromArray(void 0===o?[1,1,0,0]:o),e.clearAction||this.resetClearActions(),this.passTextureCache=new rb(d);var M=d.gpuCapability,I=M.detail,P=iF(M.level,I.readableDepthStencilTextures&&I.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(P)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var i,r,n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach(function(t){t.dispose(n)}),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(i=r.texture)||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},i.resetRenderPassDefaultAttachment=function(t,e){for(var i=this.resource,r=i.color_a,n=i.color_b,s=e;s<t.length;s++){var a,o,u,h=t[s],c=null==(o=h.attachments[0])?void 0:o.texture;if(c&&a===c){var l=c===r?n:r;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(a=c)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(r1)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},i.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var i,r=t[0],n=r.texture,s=r.persistent,a=n.format,o=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(a===ik.RGBA&&!s){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},i.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},i.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},i.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},i.createResource=function(){var e=this.renderer.engine;if(!this.resource){var i,r=e.gpuCapability,n=r.detail,s=r.level,a=this.renderer.getWidth(),o=this.renderer.getHeight(),u=2===s?ik.LINEAR:ik.NEAREST,h=rs.create(e,{sourceType:t.TextureSourceType.framebuffer,format:ik.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=rs.create(e,{sourceType:t.TextureSourceType.framebuffer,format:ik.RGBA,data:{width:a,height:o},minFilter:u,magFilter:u,name:"frame_b"}),l=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new rN(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:h}]}).initialize(this.renderer),d=new r5(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(i=f.getDepthAttachment())?void 0:i.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:c,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=r_.create(i,{name:iM,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=iF(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var s=ry.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:iM,shader:n});return s.blending=!1,s.depthTest=!1,s.culling=!1,(null==t?void 0:t.blend)&&(s.blending=!0,s.blendFunction=[ik.SRC_ALPHA,ik.ONE_MINUS_SRC_ALPHA,ik.SRC_ALPHA,ik.ONE_MINUS_SRC_ALPHA]),rL.create(i,{name:iM,geometry:r,material:s,priority:0})},i.removeRenderPass=function(t){eT(this._renderPasses,t)},ii(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function r4(t){return t?new ib(t.getWidth(),t.getHeight()):new ib}var r5=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",r4(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(rN),r6=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},r8=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return ii(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),r9="function"==typeof WebGL2RenderingContext,r7=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=r9&&r(t,WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),n&&!o&&(o=nt(t,t.HALF_FLOAT)),n&&!u&&(u=nt(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=n||t.getExtension("OES_texture_float")?t.FLOAT:0,c=n?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,l={floatTexture:h,halfFloatTexture:c,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0,halfFloatLinear:o,floatLinear:u,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!a,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=l,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&i>0)throw Error("Draw multiple color buffers not available.");var a=s?s["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];a?t.framebufferTexture2D(e,a,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function nt(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.COMPRESSED_TEXTURE=void 0,(tn=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tn.NONE=0]="NONE",tn[tn.PVRTC=1]="PVRTC",tn[tn.ASTC=2]="ASTC",t.FilterMode=void 0,(ts=t.FilterMode||(t.FilterMode={}))[ts.Nearest=0]="Nearest",ts[ts.Linear=1]="Linear",t.RenderTextureFormat=void 0,(ta=t.RenderTextureFormat||(t.RenderTextureFormat={}))[ta.RGBA32=0]="RGBA32",ta[ta.RGBAHalf=1]="RGBAHalf";var ne=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},ii(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),ni=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,s){return null},e.dispose=function(t){},t}(),nr=(tu=new Int32Array((to=new Float32Array(1)).buffer),function(t){to[0]=t;var e=tu[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),nn=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=nr(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=nr(t[i])},t}(),ns=new rS,na=new iC;function no(t,e,i,r,n,s,a){var o=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(s),t.addScaledVector(a,u),t.addScaledVector(i,c);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iT;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(o):e.getIntegrateValue(0,r,n):0});ns.setFromArray(v).negate(),na.setFromEuler(ns);var y=na.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,b=l.y,T=l.z;if(x){var E=g?x.getValue(o):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(o):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var A=g?T.getValue(o):T.getIntegrateValue(0,r,n);t.z=t.z+A}}return t}function nu(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function nh(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function nc(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(i&&t!==i)for(var a=0;a<i.length;a++)t[a]=i[a];return t}var nl=((ee={})[tI.PARTICLE_ORIGIN_CENTER]=[0,0],ee[tI.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ee[tI.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ee[tI.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ee[tI.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ee[tI.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ee[tI.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ee[tI.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ee[tI.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ee);function nf(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function nd(t,e,i){var r=i.position,n=new iT(t,e,0),s=new iT;return i.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(r),new rw(r,s)}function np(t,e,i){var r=t.x,n=t.y,s=t.z,a=new iT(r-e,n+i,s),o=new iT(r-e,n-i,s),u=new iT(r+e,n-i,s),h=new iT(r+e,n+i,s);return[{p0:a,p1:o,p2:u},{p0:a.clone(),p1:u.clone(),p2:h}]}function nm(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function nv(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var ny={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new ib(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tN.LINE?0:e===tN.EASE_OUT?0:e===tN.EASE_IN?2:e===tN.EASE?2:e===tN.HOLD&&i===tN.EASE_IN?2:0;return{xIndex:r,yIndex:r+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tN.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tN.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tN.EASE,tN.EASE_IN,tN.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tN.EASE,tN.EASE_OUT,tN.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tN.HOLD&&[tN.HOLD,tN.LINE_OUT,tN.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tN.HOLD&&[tN.HOLD,tN.LINE,tN.EASE_IN].includes(i)}},ng=function(t,e){this.points=t,this.totalLength=e},nx={},nb={};function nT(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function nE(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var n_=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=nv(e.x-t.x,3)+"_"+nv(e.y-t.y,3)+"_"+nv(e.z-t.z,3)+"&"+(nv(i.x-t.x,3)+"_"+nv(i.y-t.y,3))+"_"+nv(i.z-t.z,3)+"&"+(nv(r.x-t.x,3)+"_"+nv(r.y-t.y,3))+"_"+nv(r.z-t.z,3);if(nb[n])return{data:nb[n],interval:t};for(var s=[],a=null,o=0,u=0,h=0;h<300;h+=1){var c=new iT,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(i.x-t.x)+3*(1-l)*Math.pow(l,2)*(r.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(i.y-t.y)+3*(1-l)*Math.pow(l,2)*(r.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(i.z-t.z)+3*(1-l)*Math.pow(l,2)*(r.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==a&&(u+=Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2)+Math.pow(c.z-a.z,2)),a=c,o+=u=Math.sqrt(u),s[h]={partialLength:u,point:c}}var f=new ng(s,o);return nb[n]=f,{data:f,interval:new iT(t.x,t.y,t.z)}}(t,e,i,r),s=n.data,a=n.interval;this.lengthData=s,this.interval=a,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(nm(1-t,0))return e.points[299].point.clone().add(this.interval);if(nm(e.totalLength,0))return this.p1.clone();var i=new iT,r=nv(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(nm(n,r))return e.points[s].point.clone().add(this.interval);var a=!0,o=1;for(r<n&&(o=-1);a;){if(r>=n){if(299===s){i.x=e.points[s].point.x,i.y=e.points[s].point.y,i.z=e.points[s].point.z;break}if(r<n+e.points[s+1].partialLength){var u=(r-n)/e.points[s+1].partialLength;i.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,i.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,i.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}o>0&&s<299?(s+=o,n+=nv(e.points[s].partialLength,5)):o<0&&s>0?(n-=nv(e.points[s].partialLength,5),s+=o):a=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),nA=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iS,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):nm(1-t,0)?this.temp.copyFrom(this.p2):(nw.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),nS=function(){function t(t,e,i,r){this.mX1=t,this.mY1=e,this.mX2=i,this.mY2=r,this.precomputed=!1,this.mSampleValues=Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,(this.mX1!==this.mY1||this.mX2!==this.mY2)&&this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),nT(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=nT(.1*t,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,s=nE(n,this.mX1,this.mX2);return s>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var s=nE(e,i,r);if(0===s)break;var a=nT(e,i,r)-t;e-=a/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,i,r,n){var s,a,o=0;do(s=nT(a=e+(i-e)/2,r,n)-t)>0?i=a:e=a;while(Math.abs(s)>1e-7&&++o<10);return a}(t,i,i+.1,this.mX1,this.mX2)},t}();function nC(t,e){var i,r,n,s=function(t,e,i){var r=t[1],n=ny.isHoldOutKeyframe(t),s=ny.isHoldInKeyframe(e),a=!s&&ny.isRightSideEase(t),o=!n&&ny.isLeftSideEase(e);if(a&&!o&&!s){var u=new ib(r[r.length-4],r[r.length-3]),h=new ib(r[r.length-2],r[r.length-1]),c=ny.getPointInCurve(e),l=new ib(c.x,c.y),f=new ib(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:h,p2:f,p3:l}}if(!a&&o&&!n){var d=e[1],p=ny.getPointInCurve(t),m=new ib(p.x,p.y),v=new ib(d[0],d[1]),y=new ib(d[2],d[3]),g=new ib(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(a&&o){var x=e[1];return{type:"ease",p0:new ib(r[r.length-4],r[r.length-3]),p1:new ib(r[r.length-2],r[r.length-1]),p2:new ib(x[0],x[1]),p3:new ib(x[2],x[3])}}var b=ny.getPointInCurve(t),T=ny.getPointInCurve(e);if(n?T.y=b.y:s&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||s,leftHoldLine:n,rightHoldLine:s};var E=new ib((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new ib((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"ease",p0:b,p1:E,p2:_,p3:T,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),a=s.p0,o=s.p1,u=s.p2,h=s.p3;ez(u),ez(h);var c=h.x-a.x,l=h.y-a.y,f=nv((o.x-a.x)/c,5),d=nv((u.x-a.x)/c,5);nm(l,0)?i=r=NaN:(i=nv((o.y-a.y)/l,5),r=nv((u.y-a.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,o,u,h),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",a,o,u,h),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,o,u,h),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",a,o,u,h),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return nx[p]?n=nx[p]:(n=new nS(f,i,d,r),nx[p]=n),{points:[a,o,u,h],timeInterval:c,valueInterval:l,curve:n}}var nw=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,s=e.y,a=e.z,o=e.w,u=i.x,h=i.y,c=i.z,l=i.w;if(0===r){t.x=n,t.y=s,t.z=a,t.w=o;return}if(1===r){t.x=u,t.y=h,t.z=c,t.w=l;return}if(o!==l||n!==u||s!==h||a!==c){var f=1-r,d=n*u+s*h+a*c+o*l,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,s=s*f+h*g,a=a*f+c*g,o=o*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+s*s+a*a+o*o);n*=x,s*=x,a*=x,o*=x}}t.x=n,t.y=s,t.z=a,t.w=o},t}(),nR="not_implement",nO=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(nR)},e.getIntegrateValue=function(t,e,i){throw Error(nR)},e.getIntegrateByTime=function(t,e){throw Error(nR)},e.getValue=function(t){throw Error(nR)},e.getMaxTime=function(){throw Error(nR)},e.toUniform=function(t){throw Error(nR)},e.map=function(t){throw Error(nR)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(nR)},t.getAllData=function(t,e){for(var i=new(e?nn:Float32Array)(4*t.index),r=0,n=0,s=t.curves;r<s.length;r++){var a=s[r].toData();i.set(a,n),n+=a.length}return e?i.data:i},t}(),nM=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(nO),nI=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(nO),nP=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(nO),nL=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var s=Math.random();r[n]=e[n]*(1-s)+i[n]*s}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(nO),nF=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,s=this.xCoord*i;return((r+e/s*(n-r)+r)*e-(r+t/s*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return nG(e,0,this.xCoord,this.min,this.max)-nG(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(nO),nV=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eS(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1];if(n.stop<=t&&s.stop>t){var a=(t-n.stop)/(s.stop-n.stop);return eC(n.color,s.color,a,!0)}}return e[i].color.slice()},e}(nO),nN=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1],a=n[0],o=s[0];if(t>=a&&t<=o){var u=(t-a)/(o-a),h=n[1];return h+u*(s[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,s=e?nG:nB,a=0;a<n;a++){var o=i[a],u=i[a+1],h=o[0],c=u[0];if(t>h&&t<=c)return r+s(t,h,c,o[1],u[1]);r+=s(c,h,c,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(nO),nD=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.curveMap={},this.keys=[];for(var e=0;e<t.length-1;e++){var i=nC(t[e],t[e+1]),r=i.points,n=i.curve,s=i.timeInterval,a=i.valueInterval,o=r[0],u=r[r.length-1];this.keys.push([].concat(o.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[o.x+"&"+u.x]={points:r,timeInterval:s,valueInterval:a,curve:n,timeStart:Number(o.x),timeEnd:Number(u.x)}}this.keyTimeData=Object.keys(this.curveMap)},i.getValue=function(t){var e=0,i=this.keyTimeData,r=this.curveMap[i[0]].timeStart,n=this.curveMap[i[i.length-1]].timeEnd;if(t<=r)return this.getCurveValue(i[0],r);if(t>=n)return this.getCurveValue(i[i.length-1],n);for(var s=0;s<i.length;s++){var a=this.curveMap[i[s]].timeStart,o=this.curveMap[i[s]].timeEnd;if(t>=Number(a)&&t<Number(o)){e=this.getCurveValue(i[s],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,s=Object.keys(this.curveMap);if(r<=this.curveMap[s[0]].timeStart)return 0;for(var a=0;a<s.length;a++){var o=this.curveMap[s[a]].timeStart,u=this.curveMap[s[a]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(s[a],Number(u))),r>=Number(o)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(s[a],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,a=0,o=(e-r.x)/20,u=0;u<=20;u++){var h=u*o/n,c=r.y+s*i.curve.getValue(h);0===u||20===u?a+=c:u%2==1?a+=4*c:a+=2*c}return o/3*a},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,a=(e-r.x)/n,o=i.curve.getValue(a);return r.y+s*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){var t=Object.keys(this.curveMap);return Number(t[t.length-1].split("&")[1])},e}(nO),nk=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],s=e[r+1];if(n[0]<=t&&s[0]>=t){var a=s[1]-n[1],o=void 0;return o=0===a?(t-n[0])/(s[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,s=i[2]*r,a=(t-e[0])/r,o=a*a,u=o*a;return(2*u-3*o+1)*e[1]+(u-2*o+a)*n+(u-o)*s+(-2*u+3*o)*i[1]}(t,n,s)-n[1])/a,this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],s=0;s<i.length;s++)n[s]=i[s]*(1-e)+r[s]*e;return n},e}(nO),nz=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=new iT(i[n][0],i[n][1],i[n][2]),u=new iT(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iT(r[2*n][0],r[2*n][1],r[2*n][2]),c=new iT(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=nC(s,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new n_(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=nv(t,5),i=0,r=new iT,n=Object.keys(this.curveSegments);if(!n.length)return r;var s=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=s)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<n.length;o++){var u=n[o].split("&"),h=u[0],c=u[1];if(e>=Number(h)&&e<Number(c)){var l=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=nv((e-r.x)/n,4);return ix(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(nO),nU=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=iS.fromArray(i[n]),u=iS.fromArray(i[n+1]),h=iS.fromArray(r[2*n]),c=iS.fromArray(r[2*n+1]),l=nC(s,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new nA(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=nv(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),s=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=s)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<r.length;a++){var o=r[a].split("&"),u=o[0],h=o[1];if(i>=Number(u)&&i<Number(h)){var c=this.curveSegments[r[a]].pathCurve;return e=this.getPercValue(r[a],i),c.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=nv((e-r.x)/n,4);return ix(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(nO);function nB(t,e,i,r,n){var s=t-e;return(r+r+(n-r)*s/(i-e))*s/2}function nG(t,e,i,r,n){var s=t*t,a=e*e;return(s*t*2*(r-n)+3*s*(e*n-i*r)-a*e*(2*r+n)+3*a*i*r)/(6*(e-i))}function nX(t,e){if(e){var i=e[0],r=e[1];if(i===tV.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===tV.LINE){var s=r.length;if(2===s&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&s++,r[r.length-1][0]<1&&s++;var a=Math.ceil(s/2);t.lineSegCount+=a,t.curves.push(r),t.index+=a,t.max=Math.max(t.max,a)}else if(i===tV.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function nj(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function nH(t,e,i){return(nH=!function(){if("undefined"==typeof Reflect||!Reflect.construct||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(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&e8(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var nY=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iE,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=nK(t[0]),this.yCurve=nK(t[1]),this.zCurve=nK(t[2]),this.wCurve=nK(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},e}(nO),nW="editor",nZ={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"},nq=((ei={})[tV.RANDOM]=function(t){return r(t[0],Array)?new nL(t):new nP(t)},ei[tV.CONSTANT]=function(t){return new nM(t)},ei[tV.CONSTANT_VEC2]=function(t){return new nM(t)},ei[tV.CONSTANT_VEC3]=function(t){return new nM(t)},ei[tV.CONSTANT_VEC4]=function(t){return new nM(t)},ei[tV.RGBA_COLOR]=function(t){return new nM(t)},ei[tV.COLORS]=function(t){return new nI(t.map(function(t){return e_(t,!1)}))},ei[tV.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new nF([t[0][1],t[1][1]]):new nN(t)},ei[tV.GRADIENT_COLOR]=function(t){return new nV(t)},ei[tV.LINEAR_PATH]=function(t){return new nk(t)},ei[tV.BEZIER_CURVE]=function(t){return 1===t.length?new nM(t[0][1][1]):new nD(t)},ei[tV.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new nM(nH(iT,[].concat(t[1][0]))):new nz(t)},ei[tV.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new nM(nH(iS,[].concat(t[1][0]))):new nU(t)},ei[tV.COLOR_CURVE]=function(t){return new nQ(t)},ei[tV.VECTOR4_CURVE]=function(t){return new nY(t)},ei);function nK(t){if(!t||!isNaN(+t))return new nM(t||0);if(r(t,nO))return t;if(eY(nq[t[0]]))return nq[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nZ["ValueType: 21/22 is not supported"]+".")}var nQ=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rR,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=nK(t[0]),this.gCurve=nK(t[1]),this.bCurve=nK(t[2]),this.aCurve=nK(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},e}(nO),nJ=function(e){function i(t){(i=e.call(this,t)||this).cachePrefix="-",i.color=[1,1,1,1],i.visible=!0,i.isManualTimeSet=!1,i.frameAnimationTime=0,i.getHitTestParams=function(t){var e=i.interaction;if(t||e){var r,n=i.getBoundingBox();if(n)return{behavior:(null==(r=i.interaction)?void 0:r.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===t_.FRONT}}},i.renderer={renderMode:tM.MESH,blending:tE.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:t_.DOUBLE,mask:0,maskMode:tA.NONE,order:0},i.emptyTexture=i.engine.emptyTexture,i.renderInfo=n$(iA(i));var i,r=i.createMaterial(i.renderInfo,2);return i.worldMatrix=iC.fromIdentity(),i.material=r,i.material.setVector4("_Color",new iE().setFromArray([1,1,1,1])),i.material.setVector4("_TexOffset",new iE().setFromArray([0,0,1,1])),i}e9(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setVector4("_Color",new iE().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("_MainTex",t)},r.setAnimationTime=function(t){this.frameAnimationTime=t,this.isManualTimeSet=!0},r.render=function(t){if(this.getVisible()){var e=this.material,i=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),(this.renderer.renderMode===tM.BILLBOARD||this.renderer.renderMode===tM.VERTICAL_BILLBOARD||this.renderer.renderMode===tM.HORIZONTAL_BILLBOARD)&&this.material.setVector3("_Scale",this.transform.scale),t.drawGeometry(i,e)}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(){this.geoData=this.getItemGeometryData();var t=this.geoData,e=t.index,i=t.atlasOffset,r=e.length,n=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new e.constructor(r);if(!this.wireframe)for(var s=0;s<r;s++)n[s]=0+e[s];return{atlasOffset:i,index:n}},r.setItem=function(){var t=this.renderer.texture;t&&eb([],t),t=this.renderer.texture;var e=this.getItemInitData(),i=this.renderer,r=this.material.getVector4("_TexParams");r&&(r.x=i.occlusion?+i.transparentOcclusion:1,r.y=+this.preMultiAlpha,r.z=i.renderMode);var n={atlasOffset:new Float32Array(e.atlasOffset.length),index:new Uint16Array(e.index.length)};n.atlasOffset.set(e.atlasOffset),n.index.set(e.index);var s=this.material,a=this.geometry,o=n.index;a.setIndexData(o),a.setAttributeData("atlasOffset",n.atlasOffset),a.setDrawCount(e.index.length),s.setTexture("_MainTex",t)},r.getItemGeometryData=function(){var t=this.renderer;if(!t.shape)return this.geometry.setAttributeData("aPos",new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])),{index:[0,1,2,2,1,3],atlasOffset:[0,1,0,0,1,1,1,0]};for(var e=t.shape,i=e.index,r=e.aPoint,n=void 0===r?[]:r,s=new Float32Array(n),a=[],o=[],u=0;u<s.length;u+=6)o.push(n[u+2],n[u+3]),a.push(s[u],s[u+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(a)),{index:void 0===i?[]:i,atlasOffset:o}},r.createGeometry=function(t){return r_.create(this.engine,{attributes:{aPos:{type:ik.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:ik.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:4})},r.createMaterial=function(t,e){var i=t.side,r=t.occlusion,n=t.blending,s=t.maskMode,a=t.mask,o={shader:sy(t,e,1)};this.preMultiAlpha=iX(n);var u=ry.create(this.engine,o),h={side:i,blending:!0,blendMode:n,mask:a,maskMode:s,depthTest:!0,depthMask:r};return u.blending=h.blending,u.stencilRef=void 0!==h.mask?[h.mask,h.mask]:void 0,u.depthTest=h.depthTest,u.depthMask=h.depthMask,ij(u,h.blendMode),iY(u,h.maskMode),iH(u,h.side),u.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',u.hasUniform("_Color")||u.setVector4("_Color",new iE(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new iE),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new iE),u},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),i=np(iT.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}}},i}(ip);function n$(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,s=e.mask,a=e.maskMode,o=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:s,maskMode:a,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+o+"+"+a+"."+s}}var n0=function(){},n1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n2={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function s(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function c(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function l(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=K(t),t.a.c=t.c,m(t,K(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=K(e),e.a.c=e.c,m(e,K(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,K(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var E,_=4*1e150;function A(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,s){return(t=t.a,e=e.a,s=s.a,e.b.a===t)?s.b.a===t?i(e.a,s.a)?0>=n(s.b.a,e.a,s.a):0<=n(e.b.a,s.a,e.a):0>=n(s.b.a,t,s.a):s.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(s.b.a,t,s.a))}function C(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function w(t,e){l(t.a),t.c=!1,t.a=e,e.i=t}function R(t){var e=t.a.a;do t=tc(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tc(t)),t}function O(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function M(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function I(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,C(t)}function P(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){I(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(c(K(n),n),c(e,n)),I(t),e=r.a,t=r}return e}function L(t,e,i,r,n,s){var a=!0;do O(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(c(K(i),i),c(K(n),i)),r.f=e.f-i.f,r.d=M(t,r.f),e.b=!0,!a&&D(t,e)&&(A(i,n),C(e),l(n)),a=!1,e=r,n=i;e.b=!0,s&&z(t,e)}function F(t,e,i,r,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,i,r,t.c)||null,null===e.d&&(n?t.n||(W(t,100156),t.n=!0):e.d=i[0])}function V(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,F(t,e.a,r,[.5,.5,0,0],!1),c(e,i)}function N(t,e,i,r,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),a=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),o=n+1;r[n]=.5*a/(s+a),r[o]=.5*s/(s+a),t.g[0]+=r[n]*e.g[0]+r[o]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[o]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[o]*i.g[2]}function D(t,r){var s=th(r),a=r.a,o=s.a;if(i(a.a,o.a)){if(0<n(o.b.a,a.a,o.a))return!1;if(e(a.a,o.a)){if(a.a!==o.a){var s=t.e,u=a.a.h;if(0<=u){var s=s.b,h=s.d,l=s.e,d=s.c,p=d[u];h[p]=h[s.a],d[h[p]]=p,p<=--s.a&&(1>=p?ta(s,p):i(l[h[p>>1]],l[h[p]])?ta(s,p):to(s,p)),l[u]=null,d[u]=s.b,s.b=u}else for(s.c[-(u+1)]=null;0<s.a&&null===s.c[s.d[s.a-1]];)--s.a;V(t,K(o),a)}}else f(o.b),c(a,K(o)),r.b=s.b=!0}else{if(0>n(a.b.a,o.a,a.a))return!1;tc(r).b=r.b=!0,f(a.b),c(K(o),a)}return!0}function k(t,h){var l=th(h),d=h.a,p=l.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,E=y,_=m,A=g,S=v;if(i(E,_)||(b=E,E=_,_=b),i(A,S)||(b=A,A=S,S=b),i(E,A)||(b=E,E=A,A=b,b=_,_=S,S=b),i(A,_)?i(_,S)?(0>(b=r(E,A,_))+(T=r(A,_,S))&&(b=-b,T=-T),x.b=u(b,A.b,T,_.b)):(0>(b=n(E,A,_))+(T=-n(E,S,_))&&(b=-b,T=-T),x.b=u(b,A.b,T,S.b)):x.b=(A.b+_.b)/2,s(E,_)||(b=E,E=_,_=b),s(A,S)||(b=A,A=S,S=b),s(E,A)||(b=E,E=A,A=b,b=_,_=S,S=b),s(A,_)?s(_,S)?(0>(b=a(E,A,_))+(T=a(A,_,S))&&(b=-b,T=-T),x.a=u(b,A.a,T,_.a)):(0>(b=o(E,A,_))+(T=-o(E,S,_))&&(b=-b,T=-T),x.a=u(b,A.a,T,S.a)):x.a=(A.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(m,v)?m:v,i(E,x)&&(x.b=E.b,x.a=E.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),c(p.b,d),d=th(h=R(h)).a,P(t,th(h),l),L(t,h,K(d),d,d,!0),!0;if(y===t.a){f(p.b),c(d.e,K(p)),v=(m=l=h).a.b.a;do m=tc(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,l.a=K(p),p=P(t,l,null),L(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tc(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=l.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),c(K(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,N(d,m,y,p,0),N(d,v,g,p,2),F(t,d,x,p,!0),tc(h).b=h.b=l.b=!0,!1}function z(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tc(e))||!e.b))break;e.b=!1;var s,a=e.a,o=r.a;if(s=a.b.a!==o.b.a)t:{var u=th(s=e),h=s.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){s=!1;break t}tc(s).b=s.b=!0,p=f(h),c(d.b,p),p.d.c=s.d}else{if(0<n(d.b.a,h.b.a,d.a)){s=!1;break t}s.b=u.b=!0,p=f(d),c(h.e,d.b),p.b.d.c=s.d}s=!0}if(s&&(r.c?(C(r),l(o),o=(r=th(e)).a):e.c&&(C(e),l(a),a=(e=tc(r)).a)),a.a!==o.a){if(a.b.a===o.b.a||e.c||r.c||a.b.a!==t.a&&o.b.a!==t.a)D(t,e);else if(k(t,e))break}a.a===o.a&&a.b.a===o.b.a&&(A(o,a),C(e),l(a),e=tc(r))}}function U(t,e){var i=new tu,r=h(t.b);r.a.b=_,r.a.a=e,r.b.a.b=-_,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function B(t){this.a=new X,this.b=t,this.c=S}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new X(i,e.a,e),e.a.c=t,e.a=t}function X(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function j(){this.d=H,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var H=0;function Y(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case H:W(t,100151),t.u(null);break;case 1:W(t,100152),t.t()}else switch(t.d){case 2:W(t,100154),t.v();break;case 1:W(t,100153),t.w()}}function W(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function K(t){return t.b.e}function Q(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&to(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ts(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ts(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ts(t){var e=t.d,i=t.e,r=t.c,n=e[1],s=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ta(t,1)),s}function ta(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[o],n[h])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function to(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a>>1,h=r[u];if(0===u||i(n[h],n[o])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tc(t){return t.e.a.b}(E=j.prototype).x=function(){Y(this,H)},E.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:W(this,100900);return}W(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:W(this,100900)}return!1},E.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},E.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:W(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];Y(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,i=!0),1e150<s&&(s=1e150,i=!0),r[n]=s}i&&W(this,100155),null===(i=this.q)?c(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},E.u=function(t){Y(this,H),this.d=1,this.b=new Q,this.c=t},E.t=function(){Y(this,1),this.d=2,this.q=null},E.v=function(){Y(this,2),this.d=1},E.w=function(){Y(this,1),this.d=H;var t,r,s=this.j[0],a=this.j[1],o=this.j[2],u=!1,h=[s,a,o];if(0===s&&0===a&&0===o){for(var a=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],o=[],v=[],u=this.b.c,s=u.e;s!==u;s=s.e)for(var y=0;3>y;++y){var b=s.g[y];b<p[y]&&(p[y]=b,v[y]=s),b>a[y]&&(a[y]=b,o[y]=s)}if(s=0,a[1]-p[1]>a[0]-p[0]&&(s=1),a[2]-p[2]>a[s]-p[s]&&(s=2),p[s]>=a[s])h[0]=0,h[1]=0,h[2]=1;else{for(a=0,p=v[s],o=o[s],v=[0,0,0],p=[p.g[0]-o.g[0],p.g[1]-o.g[1],p.g[2]-o.g[2]],y=[0,0,0],s=u.e;s!==u;s=s.e)y[0]=s.g[0]-o.g[0],y[1]=s.g[1]-o.g[1],y[2]=s.g[2]-o.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>a&&(a=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=a&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),s=this.b.c,a=(v+1)%3,o=(v+2)%3,v=0<h[v]?1:-1,h=s.e;h!==s;h=h.e)h.b=h.g[a],h.a=v*h.g[o];if(u){for(h=0,s=(u=this.b.a).b;s!==u;s=s.b)if(!(0>=(a=s.a).f))do h+=(a.a.b-a.b.a.b)*(a.a.a+a.b.a.a),a=a.e;while(a!==s.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,s=(h=this.b.b).h;s!==h;s=u)u=s.h,a=s.e,e(s.a,s.b.a)&&s.e.e!==s&&(V(this,a,s),l(s),a=(s=a).e),a.e===s&&(a!==s&&((a===u||a===u.b)&&(u=u.h),l(a)),(s===u||s===u.b)&&(u=u.h),l(s));for(this.e=h=new $,s=(u=this.b.c).e;s!==u;s=s.e)s.h=tt(h,s);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ta(t,e);t.h=!0}(t.b)}(h),this.f=new B(this),U(this,-_),U(this,_);null!==(h=te(this.e));){for(;;){t:if(0===(s=this.e).a)u=tn(s.b);else if(u=s.c[s.d[s.a-1]],0!==s.b.a&&i(s=tn(s.b),u)){u=s;break t}if(null===u||!e(u,h))break;u=te(this.e),V(this,h.c,u.c)}!function t(r,s){r.a=s;for(var a=s.c;null===a.i;)if((a=a.c)===s.c){var a=r,o=s,u=new tu;u.a=o.c.b;var h=a.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,o,u.a))e((u=h.a).a,o)||e(u.b.a,o)||(f(u.b),h.c&&(l(u.c),h.c=!1),c(o.c,u),t(a,o));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(o.c.b,u.e):d(p.b.c.b,o.c).b,v.c?w(v,m):(u=a,(h=O(a,h,m)).f=tc(h).f+h.a.f,h.d=M(u,h.f)),t(a,o)):L(a,h,o.c,o.c,null,!0)}return}if(h=(u=th(a=R(a.i))).a,(u=P(r,u,null)).c===h){var h=u,u=h.c,p=th(a),m=a.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,a),e(m.a,r.a)&&(c(K(u),m),u=th(a=R(a)).a,P(r,th(a),p),y=!0),e(v.a,r.a)&&(c(h,K(v)),h=P(r,p,null),y=!0),y?L(r,a,h.c,u,u,!0):(o=i(v.a,m.a)?K(v):m,L(r,a,o=d(h.c.b,o),o.c,o.c,!1),o.b.i.c=!0,z(r,a))}else L(r,a,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,C(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,s=(h=this.b).a.b;s!==h.a;s=u)u=s.b,(s=s.a).e.e===s&&(A(s.c,s),l(s));if(!this.n){if(h=this.b,this.m)for(s=h.b.h;s!==h.b;s=u)u=s.h,s.b.d.c!==s.d.c?s.f=s.d.c?1:-1:l(s);else for(s=h.a.b;s!==h.a;s=u)if(u=s.b,s.c){for(s=s.a;i(s.b.a,s.a);s=s.c.b);for(;i(s.a,s.b.a);s=s.e);for(a=s.c.b,o=void 0;s.e!==a;)if(i(s.b.a,a.a)){for(;a.e!==s&&(i((t=a.e).b.a,t.a)||0>=n(a.a,a.b.a,a.e.b.a));)a=(o=d(a.e,a)).b;a=a.c.b}else{for(;a.e!==s&&(i((r=s.c.b).a,r.b.a)||0<=n(s.b.a,s.a,s.c.b.a));)s=(o=d(s,s.c.b)).b;s=s.e}for(;a.e.e!==s;)a=(o=d(a.e,a)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),s=u.a;do this.k&&this.k(s.a.d,this.c),s=s.e;while(s!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,s=!1,a=-1,o=h.a.d;o!==h.a;o=o.d)if(o.c){s||(this.h&&this.h(4,this.c),s=!0),v=o.a;do u&&a!==(p=v.b.d.c?0:1)&&(a=p,this.l&&this.l(!!a,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==o.a)}s&&this.i&&this.i(this.c)}}if(this.r){for(s=(h=this.b).a.b;s!==h.a;s=u)if(u=s.b,!s.c){o=(a=s.a).e,v=void 0;do o=(v=o).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,K(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,K(p))),g(v));while(v!==a);a=s.d,(s=s.b).d=a,a.b=s}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},n1.libtess={GluTesselator:j,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},j.prototype.gluDeleteTess=j.prototype.x,j.prototype.gluTessProperty=j.prototype.B,j.prototype.gluGetTessProperty=j.prototype.y,j.prototype.gluTessNormal=j.prototype.A,j.prototype.gluTessCallback=j.prototype.z,j.prototype.gluTessVertex=j.prototype.C,j.prototype.gluTessBeginPolygon=j.prototype.u,j.prototype.gluTessBeginContour=j.prototype.t,j.prototype.gluTessEndContour=j.prototype.v,j.prototype.gluTessEndPolygon=j.prototype.w,t.exports=n1.libtess}(n2);var n3=((th=new n2.exports.GluTesselator).gluTessCallback(n2.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==n2.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),th.gluTessCallback(n2.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),th);function n4(t){n3.gluTessNormal(0,0,1);var e=[];n3.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){n3.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var s=[r[n],r[n+1],0];n3.gluTessVertex(s,s)}n3.gluTessEndContour()}return n3.gluTessEndPolygon(),e}var n5=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var s=Array.isArray(r[0])?r[0]:r;if("number"!=typeof s[0]){for(var a=[],o=0,u=s.length;o<u;o++)a.push(s[o].x,s[o].y);s=a}return e.points=s,e.closePath=!0,e}e9(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,s=r-1;n<r;s=n++){var a=this.points[2*n],o=this.points[2*n+1],u=this.points[2*s],h=this.points[2*s+1];o>e!=h>e&&t<(e-o)/(h-o)*(u-a)+a&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){for(var s=n4([t]),a=0;a<s.length;a++)e[i+a]=s[a];for(var o=s.length/2,u=0;u<o;u++)r[n+u]=u},ii(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(n0);function n6(t,e,i,r,n,s,a,o,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,s,a,o,u,h,c,l){if(!(l>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+s)/2,m=(n+a)/2,v=(s+o)/2,y=(a+u)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(m+y)/2,E=(g+b)/2,_=(x+T)/2;if(l>0){var A=o-e,S=u-i,C=Math.abs((r-o)*S-(n-u)*A),w=Math.abs((s-o)*S-(a-u)*A);if(C>11920929e-14&&w>11920929e-14){if((C+w)*(C+w)<=c*(A*A+S*S)){h.push(E,_);return}}else if(C>11920929e-14){if(C*C<=c*(A*A+S*S)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=c*(A*A+S*S)){h.push(E,_);return}}else if((A=E-(e+o)/2)*A+(S=_-(i+u)/2)*S<=c){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,c,l+1),t(E,_,b,T,v,y,o,u,h,c,l+1)}}(e,i,r,n,s,a,o,u,t,c*=c,0),t.push(o,u),t}var n8=function(t){function e(e,i,r,n){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=i,s.halfWidth=r,s.halfHeight=n,s}e9(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var s=i/2,a=r-s,o=n-s,u=r+s,h=n+s,c=t-this.x,l=e-this.y;return c*c/(a*a)+l*l/(o*o)>1&&c*c/(u*u)+l*l/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(r+n)),a=8*s+0+0;if(0===a)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var o=0,u=4*s+0+2,h=u,c=a,l=0+r,f=0,d=e+l,p=e-l,m=i+0;t[o++]=d,t[o++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<s;v++){var y=Math.PI/2*(v/s),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[o++]=b,t[o++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--c]=_,t[--c]=b}l=0,f=0+n,d=e+l,p=e-l,m=i+f;var A=i-f;return t[o++]=d,t[o++]=m,t[--c]=A,t[--c]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var s=0,a=0,o=0;o<t.length;o+=2)s+=t[o],a+=t[o+1];s/=t.length/2,a/=t.length/2;var u=i;e[2*u]=s,e[2*u+1]=a;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(n0);(tc=er||(er={}))[tc.Star=0]="Star",tc[tc.Polygon=1]="Polygon";var n9=function(t){function e(e,i,r,n,s,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=i,o.innerRadius=r,o.outerRoundness=n,o.innerRoundness=s,o.starType=a,o.v=[],o.in=[],o.out=[],o}e9(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)n6(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;n6(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var s=n4([t]),a=0;a<s.length;a++)e[i+a]=s[a];for(var o=s.length/2,u=0;u<o;u++)r[n+u]=u},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,a=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,c=this.innerRoundness/100,l=2*Math.PI*o/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=a?o:u,i=a?h:c,r=a?l:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,a=!a,d+=1*s}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*r/(4*e),a=-(.5*Math.PI);for(t=0;t<e;t++){var o=r*Math.cos(a),u=r*Math.sin(a),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),c=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),l=2*t;this.v[l]=o,this.v[l+1]=u,this.in[l]=o+h*s*n*1,this.in[l+1]=u+c*s*n*1,this.out[l]=o-h*s*n*1,this.out[l+1]=u-c*s*n*1,a+=1*i}},e}(n0),n7=function(t){function e(e,i,r,n){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(s=t.call(this)||this).x=Number(e),s.y=Number(i),s.width=Number(r),s.height=Number(n),s}e9(e,t);var i=e.prototype;return i.isEmpty=function(){return this.left===this.right||this.top===this.bottom},i.clone=function(){return new e(this.x,this.y,this.width,this.height)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},i.copyTo=function(t){return t.copyFrom(this),t},i.contains=function(t,e){return!(this.width<=0)&&!(this.height<=0)&&t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height},i.strokeContains=function(t,e,i){var r=this.width,n=this.height;if(r<=0||n<=0)return!1;var s=this.x,a=this.y;return t>=s-i/2&&t<=s+r+i/2&&e>=a-i/2&&e<=a+n+i/2&&!(t>s+i/2&&t<s+r-i/2&&e>a+i/2&&e<a+n-i/2)},i.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},i.fit=function(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this},i.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this},i.enlarge=function(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this},i.getBounds=function(t){return(t=t||new e).copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.width,n=this.height;return r>=0&&n>=0&&(t[0]=e,t[1]=i,t[2]=e+r,t[3]=i,t[4]=e+r,t[5]=i+n,t[6]=e,t[7]=i+n),t},i.triangulate=function(t,e,i,r,n){var s=0;e[(i*=2)+0]=t[0],e[i+s+1]=t[1],e[i+(s+=2)]=t[2],e[i+s+1]=t[3],e[i+(s+=2)]=t[6],e[i+s+1]=t[7],e[i+(s+=2)]=t[4],e[i+s+1]=t[5],s+=2;var a=i/2;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2},ii(e,[{key:"left",get:function(){return this.x}},{key:"right",get:function(){return this.x+this.width}},{key:"top",get:function(){return this.y}},{key:"bottom",get:function(){return this.y+this.height}}],[{key:"EMPTY",get:function(){return new e(0,0,0,0)}}]),e}(n0),st=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=iR(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,s=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5],s[6]);break;case"moveTo":this.moveTo(s[0],s[1]);break;case"ellipse":this.ellipse(s[0],s[1],s[2],s[3],s[4]);break;case"polyStar":this.polyStar(s[0],s[1],s[2],s[3],s[4],s[5],s[6]);break;case"rect":this.rect(s[0],s[1],s[2],s[3],s[4])}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,s,a){this.ensurePoly();var o=this.currentPoly;return n6(o.points,o.lastX,o.lastY,t,e,i,r,n,s,a),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new n8(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,s,a){return this.drawShape(new n9(t,e,i,r,n,s),a),this},e.rect=function(t,e,i,r,n){return this.drawShape(new n7(t,e,i,r),n),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new n5).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new n5,this.currentPoly.points.push(0,0))},t}(),se=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,s,a){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,s,a]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n){return this.instructions.push({action:"rect",data:[t,e,i,r,n]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,s,a){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,s,a]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},ii(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new st(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();t.ShapeComponent=function(e){function i(i){var r;if((r=e.call(this,i)||this).path=new se,r.curveValues=[],r.animated=!0,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",r.geometry||(r.geometry=r_.create(i,{attributes:{aPos:{type:ik.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:ik.FLOAT,size:2,data:new Float32Array}},mode:ik.TRIANGLES,drawCount:4})),!r.material){var n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}};r.material=ry.create(i,n),r.material.setColor("_Color",new rR(1,1,1,1)),r.material.depthMask=!1,r.material.depthTest=!0,r.material.blending=!0}return r}e9(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){this.animated&&(this.buildPath(this.data),this.buildGeometryFromPath(this.path.shapePath))},r.buildGeometryFromPath=function(t){for(var e,i=t.shapePrimitives,r=[],n=[],s=iR(i);!(e=s()).done;){var a=e.value.shape,o=[],u=n.length,h=r.length/2;a.build(o),a.triangulate(o,r,h,n,u)}var c=r.length/2,l=this.geometry.getAttributeData("aPos"),f=this.geometry.getAttributeData("aUV"),d=this.geometry.getIndexData();(!l||l.length<3*c)&&(l=new Float32Array(3*c)),(!f||f.length<2*c)&&(f=new Float32Array(2*c)),d||(d=new Uint16Array(n.length));for(var p=0;p<c;p++){var m=3*p,v=2*p,y=2*p;l[m]=r[v],l[m+1]=r[v+1],l[m+2]=0,f[y]=l[m],f[y+1]=l[m+1]}d.set(n),this.geometry.setAttributeData("aPos",l),this.geometry.setAttributeData("aUV",f),this.geometry.setIndexData(d),this.geometry.setDrawCount(n.length)},r.buildPath=function(t){switch(this.path.clear(),t.type){case tJ.Custom:var e=t.points,i=t.easingIns,r=t.easingOuts;this.curveValues=[];for(var n,s=iR(t.shapes);!(n=s()).done;){var a=n.value;this.setFillColor(a.fill);for(var o=a.indexes,u=1;u<o.length;u++){var h=o[u],c=o[u-1];this.curveValues.push({point:e[h.point],controlPoint1:r[c.easingOut],controlPoint2:i[h.easingIn]})}this.curveValues.push({point:e[o[0].point],controlPoint1:r[o[o.length-1].easingOut],controlPoint2:i[o[0].easingIn]})}this.path.moveTo(this.curveValues[this.curveValues.length-1].point.x,this.curveValues[this.curveValues.length-1].point.y);for(var l,f=iR(this.curveValues);!(l=f()).done;){var d=l.value,p=d.point,m=d.controlPoint1,v=d.controlPoint2;this.path.bezierCurveTo(m.x,m.y,v.x,v.y,p.x,p.y,1)}break;case tJ.Ellipse:this.path.ellipse(0,0,t.xRadius,t.yRadius),this.setFillColor(t.fill);break;case tJ.Rectangle:this.path.rect(-t.width/2,-t.height/2,t.width,t.height),this.setFillColor(t.fill);break;case tJ.Star:this.path.polyStar(t.pointCount,t.outerRadius,t.innerRadius,t.outerRoundness,t.innerRoundness,er.Star),this.setFillColor(t.fill);break;case tJ.Polygon:this.path.polyStar(t.pointCount,t.radius,t.radius,t.roundness,t.roundness,er.Polygon),this.setFillColor(t.fill)}},r.setFillColor=function(t){if(t){var e=t.color;this.material.setColor("_Color",new rR(e.r,e.g,e.b,e.a))}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.data=t;var i=this.material;i.stencilRef=void 0!==t.renderer.mask?[t.renderer.mask,t.renderer.mask]:void 0,iY(i,t.renderer.maskMode)},i}(i_),t.ShapeComponent=s([io("ShapeComponent")],t.ShapeComponent),t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}e9(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,i=this.startPositionY*(1-s)+s*this.endPositionY,r=this.startPositionZ*(1-s)+s*this.endPositionZ}var a=this.effectComponent.material;a.setFloat("_PosX",e*this.amountOfMotion),a.setFloat("_PosY",i*this.amountOfMotion),a.setFloat("_PosZ",r*this.amountOfMotion)}},i}(il),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),s([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=s([io("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tl=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tl.Circular=0]="Circular",tl[tl.Linear=1]="Linear",t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}e9(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.position=this.transform.getWorldPosition(),t.rotation=this.transform.getWorldRotation()}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(id),t.CameraController=s([io(t3.CameraController)],t.CameraController);var si=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6);t.HitTestType=void 0,(tf=t.HitTestType||(t.HitTestType={}))[tf.triangle=1]="triangle",tf[tf.box=2]="box",tf[tf.sphere=3]="sphere",tf[tf.custom=4]="custom";var sr="click",sn="touchstart",ss="touchmove",sa="touchend",so=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,s,a=this;n=function(t){return t};var o="mousedown",u="mousemove",h="mouseup",c=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=0);var o=0,u=0,h=performance.now();if(!a.target)return eG.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:s,ts:h,width:0,height:0,origin:t};var c=a.target,l=c.width,f=c.height;if(r){var d=h-r.ts;o=(n-r.dx)/d||0,u=(s-r.dy)/d||0,r={dx:n,dy:s,ts:h}}return{x:e,y:i,vx:o,vy:u,dx:n,dy:s,ts:h,width:l,height:f,origin:t}};eI()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},o="touchstart",u="touchmove",h="touchend"),this.nativeHandlers=((s={})[o]=function(s){if(a.enabled){var o=n(s),u=su(o);t=u.x,e=u.y,r=i={clientX:o.clientX,clientY:o.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(sn,c(s,t,e))}},s[u]=function(r){if(i&&a.enabled){var s=su(n(r));t=s.x,e=s.y,a.dispatchEvent(ss,c(r,t,e,t-i.x,e-i.y))}},s[h]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var s=n(r),o=su(s),u=Math.abs(i.clientX-s.clientX)+Math.abs(i.clientY-s.clientY);t=o.x,e=o.y,u<4&&a.dispatchEvent(sr,c(r,t,e)),a.dispatchEvent(sa,c(r,t,e,t-i.x,e-i.y))}i=0},s),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),eb(i,e),function(){eT(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eT(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function su(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),s=n.left,a=n.top;return{x:(i-s)/n.width*2-1,y:1-(r-a)/n.height*2}}var sh=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),sc=1,sl=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new iT,n=new iS,s=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,s),e.x=s.x,e.y=s.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(e){var i,r=[["ENV_EDITOR",(null==(i=this.engine.renderer)?void 0:i.env)===nW]],n=nK(this.color).getValue(0),s={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=ry.create(this.engine,s);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new iE(0,0,0,0)),a.setVector2("uSize",new ib(1,1)),a.setVector4("uColor",new iE(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new iS(0,0,0,0)),a},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return r_.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:ik.LINES,maxVertex:4})},i.createMesh=function(t,e){return rL.create(this.engine,{name:"Interact_preview"+sc++,priority:0,worldMatrix:iC.fromIdentity(),geometry:t,material:e})},e}();function sf(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.duringPlay=!1,t._interactive=!0,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i}}},t}e9(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.props.content.options,e=this.item.engine.renderer.env,i=this.item.composition,r=this.interactData.options,n=r.type,s=r.showPreview;if(n===tw.CLICK&&(this.clickable=!0,s&&e===nW)){var a=null==i?void 0:i.getRendererOptions();void 0!==a&&(this.previewContent=new sl(this.item.props.content,a,this.transform,this.engine))}t.type===tw.DRAG&&(e!==nW||t.enableInEditor)&&(null==i?void 0:i.event)&&this.beginDragTarget(t,i.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this),this.interactData.options.type===tw.CLICK&&(this.clickable=!0)},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.item.time>0&&this.item.time-t/1e3<=0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,sf(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,s=n.position,a=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=s[2],c=Math.tan(a*Math.PI/180/2)*Math.abs(h),l=this.dragRange,f=l.dxRange,d=l.dyRange,p=s[0]-this.dragRatio[0]*(u*c),m=s[1]-this.dragRatio[1]*(o*c),v=f[0],y=f[1],g=d[0],x=d[1];p=ix(p,v,y),m=ix(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new iT(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var s={touchstart:function(t){if(n.canInteract()){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.handleDragMove(r,t),n.bouncingArg=t},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!sf(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iW({},r)),r=null}}};Object.keys(s).forEach(function(t){e.addEventListener(t,s[t])}),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(s).forEach(function(t){e.removeEventListener(t,s[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=np(iT.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tw.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},ii(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ip),t.InteractComponent=s([io(t3.InteractComponent)],t.InteractComponent);var sd=function(){function e(){this.triangles=[]}var i=e.prototype;return i.getBoundingBoxData=function(){return this.boundingBoxData},i.getBoundingBox=function(){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,s=Number.MAX_VALUE,a=iR(this.boundingBoxData.area);!(e=a()).done;){var o=e.value;i=Math.max(o.p0.x,o.p1.x,o.p2.x,i),r=Math.max(o.p0.y,o.p1.y,o.p2.y,r),n=Math.min(o.p0.x,o.p1.x,o.p2.x,n),s=Math.min(o.p0.y,o.p1.y,o.p2.y,s)}var u=[],h=new iT(n,r,0),c=new iT(i,r,0),l=new iT(i,s,0),f=new iT(n,s,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),{type:t.HitTestType.triangle,area:u}},i.setGeometry=function(e,i){this.geometry!==e&&(this.triangles=this.geometryToTriangles(e),this.geometry=e);for(var r,n=[],s=iR(this.triangles);!(r=s()).done;){var a=r.value;n.push({p0:a.p0,p1:a.p1,p2:a.p2})}i&&n.forEach(function(t){t.p0=i.transformPoint(t.p0,new iT),t.p1=i.transformPoint(t.p1,new iT),t.p2=i.transformPoint(t.p2,new iT)}),this.boundingBoxData={type:t.HitTestType.triangle,area:n}},i.geometryToTriangles=function(t){for(var e,i,r=null!=(e=t.getIndexData())?e:[],n=null!=(i=t.getAttributeData("aPos"))?i:[],s=[],a=0;a<r.length;a+=3){var o=3*r[a],u=3*r[a+1],h=3*r[a+2],c={x:n[o],y:n[o+1],z:n[o+2]},l={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[h],y:n[h+1],z:n[h+2]};s.push({p0:c,p1:l,p2:f})}return s},e}();function sp(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0}function sm(e,i){var r=null!=i?i:{},n=r.env,s=r.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===nW]];return{fragment:s?rD:rz,vertex:rk,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function sv(t,e){return t.cachePrefix+"_effects_sprite_"+e}function sy(t,e,i,r){var n=t.wireframe,s=sm(i,{wireframe:n,env:r});return s.shared=!0,n||(s.cacheId=sv(t,e)),s}t.maxSpriteMeshItemCount=8;var sg={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},sx=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return e9(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),s=i.engine.gpuCapability,a=s.level,o=s.detail,u=(null!=r?r:{}).env;return(null==n?void 0:n.shaderResults[sv(sg,2)])||(null==n||n.addShader(sy(sg,2,1,u)),null==n||n.addShader(sy(sg,t.maxSpriteMeshItemCount,1,u)),o.writableFragDepth&&(null==n||n.addShader(iF(a,!0)))),Promise.resolve()},i}(e6),sb=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=iR(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=iR(this.playableOutputs);!(r=n()).done;){var s=r.value;this.prepareFrameWithRoot(s)}for(var a,o=iR(this.playableOutputs);!(a=o()).done;){var u=a.value;this.processFrameWithRoot(u)}for(var h,c=iR(this.playables);!(h=c()).done;){var l=h.value;this.updatePlayableTime(l,t/1e3)}},e.connect=function(t,e,i,r){i.connectInput(r,t,e)},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrameRecursive(t.context,t.getSourceOutputPort()),t.processFrame()},e.prepareFrameWithRoot=function(t){t.sourcePlayable.prepareFrameRecursive(t.context,t.getSourceOutputPort()),t.prepareFrame()},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),sT=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=0,this.time=0,t.addPlayable(this),this.inputs=Array(e),this.inputOuputPorts=Array(e),this.inputWeight=Array(e)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){0===this.playState&&(this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1)},e.connectInput=function(t,e,i,r){void 0===r&&(r=1),this.setInput(e,t),this.setInputWeight(t,r),e.setOutput(this,i),this.inputOuputPorts.length<t+1&&(this.inputOuputPorts.length=t+1),this.inputOuputPorts[t]=i},e.addInput=function(t,e,i){void 0===i&&(i=1),this.connectInput(this.getInputCount(),t,e,i)},e.getInputCount=function(){return this.inputs.length},e.getInputs=function(){return this.inputs},e.getInput=function(t){return this.inputs[t]},e.getOutputCount=function(){return this.outputs.length},e.getOutputs=function(){return this.outputs},e.getOutput=function(t){return this.outputs[t]},e.getInputWeight=function(t){return this.inputWeight[t]},e.setInputWeight=function(e,i){if(r(e,t)){for(var n=0;n<this.inputs.length;n++)if(this.inputs[n]===e){this.inputWeight[n]=i;return}}else this.inputWeight.length<e+1&&(this.inputWeight.length=e+1),this.inputWeight[e]=i},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.setTraversalMode=function(t){this.traversalMode=t},e.getTraversalMode=function(){return this.traversalMode},e.onPlayablePlay=function(t){},e.onPlayablePause=function(t){},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},e.prepareFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState)switch(this.onPlayablePlayFlag&&(this.onPlayablePlay(t),this.onPlayablePlayFlag=!1),this.onPlayablePauseFlag&&(this.onPlayablePause(t),this.onPlayablePauseFlag=!1),0===e&&this.prepareFrame(t),this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).prepareFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).prepareFrameRecursive(t,this.inputOuputPorts[e])}},e.processFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState){switch(this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).processFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).processFrameRecursive(t,this.inputOuputPorts[e])}this.processFrame(t)}},e.setOutput=function(t,e){this.outputs.length<e+1&&(this.outputs.length=e+1),this.outputs[e]=t},e.setInput=function(t,e){this.inputs.length<e+1&&(this.inputs.length=e+1),this.inputs[e]=t},t}(),sE=function(){function t(){this.sourceOutputPort=0,this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t,e){void 0===e&&(e=0),this.sourcePlayable=t,this.sourceOutputPort=e},e.getSourceOutputPort=function(){return this.sourceOutputPort},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),s_=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic);(td=en||(en={}))[td.Playing=0]="Playing",td[td.Paused=1]="Paused",(tp=es||(es={}))[tp.Mix=0]="Mix",tp[tp.Passthrough=1]="Passthrough";var sA=new iS,sS=1,sC=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iT(0,0,0),this.quat=new iS(0,0,0,1),this.rotation=new rS(0,0,0),this.scale=new iT(1,1,1),this.anchor=new iT(0,0,0),this.size=new ib(1,1),this.children=[],this.worldMatrix=iC.fromIdentity(),this.localMatrix=iC.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iT(0,0,0),quat:new iS(0,0,0,1),scale:new iT(1,1,1)},this.name="transform_"+sS++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,n=t.rotation,s=t.scale,a=t.size,o=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(r(i,iT)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)r(o,iS)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(n){var c=e?-1:1;r(n,rS)?this.setRotation(n.x*c,n.y*c,n.z*c):this.setRotation(n[0]*c,n[1]*c,n[2]*c)}s&&(r(s,iT)?this.setScale(s.x,s.y,s.z):this.setScale(s[0],s[1],s[2])),a&&this.setSize(a.x,a.y),h&&(r(h,ib)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){eb(this.children,t)},e.removeChild=function(t){eT(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rS)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new rS)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={position:new iT().copyFrom(t.position),rotation:new rS(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new iT().copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=sA.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},ii(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),sw=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,s=i.options;r.apply(void 0,[].concat(n)),(null==s?void 0:s.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}};t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new sC,r.time=0,r.duration=0,r.start=0,r.endBehavior=tD.forward,r.type=tO.base,r.isDuringPlay=!1,r.components=[],r.rendererComponents=[],r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new sw,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}e9(i,e);var n=i.prototype;return n.on=function(t,e,i){this.eventProcessor.on(t,e,i)},n.off=function(t,e){this.eventProcessor.off(t,e)},n.once=function(t,e){this.eventProcessor.once(t,e)},n.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},n.getListeners=function(t){return this.eventProcessor.getListeners(t)},n.setSpeed=function(t){this.speed=t},n.getSpeed=function(){return this.speed},n.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},n.getComponent=function(t){for(var e,i,n=iR(this.components);!(i=n()).done;){var s=i.value;if(r(s,t)){e=s;break}}return e},n.getComponents=function(t){for(var e,i=[],n=iR(this.components);!(e=n()).done;){var s=e.value;r(s,t)&&i.push(s)}return i},n.setParent=function(t){(t!==this||t)&&(this.parent&&eT(this.parent.children,this),this.parent=t,i.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},n.setColor=function(t,e,i,r){},n.setOpacity=function(t){},n.setActive=function(t){this.active!==t&&(this.active=!!t,this.onActiveChanged())},n.setVisible=function(t){for(var e,i=iR(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},n.getVisible=function(){return this.visible},n.getWorldTransform=function(t){var e=null!=t?t:new sC({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},n.translate=function(t,e,i){this.transform.translate(t,e,i)},n.rotate=function(t,e,i){var r=new rS(t,e,i),n=iS.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},n.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},n.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,s=r.y,a=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/o)*s,i)}},n.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},n.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},n.setScale=function(t,e,i){this.transform.setScale(t,e,i)},n.getBoundingBox=function(){},n.getHitTestParams=function(t){},n.getCurrentPosition=function(){var t=new iT;return this.transform.assignWorldTRS(t),t},n.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},n.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=iR(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},n.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},n.onEnable=function(){this.isEnabled=!0;for(var t,e=iR(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=iR(this.components);!(r=n()).done;){var s=r.value;s.enabled&&!s.isEnableCalled&&s.enable()}},n.onDisable=function(){this.isEnabled=!1;for(var t,e=iR(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},n.fromData=function(i){e.prototype.fromData.call(this,i);var n=i.id,s=i.name,a=i.delay,o=i.parentId,u=i.endBehavior,h=i.transform,c=i.listIndex,l=i.duration,f=void 0===l?0:l;if(this.props=i,this.type=i.type,this.id=n.toString(),this.name=s,this.start=a||this.start,h&&(h.position=new iT().copyFrom(h.position),h.quat?h.quat=new iS(h.quat.x,h.quat.y,h.quat.z,h.quat.w):h.rotation=new rS().copyFrom(null!=(d=h.eulerHint)?d:h.rotation),h.scale=new iT().copyFrom(h.scale),h.size&&(h.size=new ib().copyFrom(h.size)),h.anchor&&(h.anchor=new ib().copyFrom(h.anchor)),this.transform.setTransform(h)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=f,this.endBehavior=u,i.content||(i.content={options:{}}),f<0)throw Error("Item duration can't be less than 0, see "+nZ["Item duration can't be less than 0"]+".");this.rendererComponents.length=0;for(var d,p,m=iR(this.components);!(p=m()).done;){var v=p.value;v.item=this,r(v,ip)&&this.rendererComponents.push(v),r(v,t.ParticleSystem)&&(this.components.includes(v.renderer)||this.components.push(v.renderer),this.rendererComponents.push(v.renderer))}this.renderOrder=void 0===c?0:c},n.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=t3.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(i=this.parent)?void 0:i.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,i,n,s=iR(this.components);!(n=s()).done;){var a=n.value;r(a,t.EffectComponent)&&this.taggedProperties.components.push(a)}}this.taggedProperties.content={}},n.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,s=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(s),o=a.x,u=a.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},n.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=iR(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this.transform.setValid(!1)}},n.resetChildrenParent=function(){for(var t,e,i=iR(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eT(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tO.composition},i.isSprite=function(t){return t.type===tO.sprite},i.isParticle=function(t){return t.type===tO.particle},i.isNull=function(t){return t.type===tO.null},i.isTree=function(t){return t.type===tO.tree},i.isCamera=function(t){return t.type===tO.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},ii(i,[{key:"content",get:function(){return this._content}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=iR(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),i}(ic),s([ih(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=s([io(t3.VFXItemData)],t.VFXItem),t.Item=void 0,(tm=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tm.isComposition=function(t){return t.type===tO.composition},tm.isParticle=function(t){return t.type===tO.particle},tm.isNull=function(t){return t.type===tO.null};var sR=[1,1,1,1],sO=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}e9(i,e);var n=i.prototype;return n.processFrame=function(e){var i,n,s,a=e.output.getUserData();if(r(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(u=this.activeComponent)?void 0:u.material;var o,u,h,c=null==(h=this.activeMaterial)?void 0:h.getVector4("_Color");c&&(this.startColor=c.toArray())}null==(o=this.activeComponent)||o.setAnimationTime(this.time);var l=nh(sR,1),f=this.time/a.duration,d=this.opacityOverLifetime,p=this.colorOverLifetime;p&&(l=eA(p,f,!0),i=!0),d&&(l[3]*=d.getValue(f),i=!0),i&&(nc(this.renderColor,l,this.startColor),null==(s=this.activeMaterial)||null==(n=s.getVector4("_Color"))||n.setFromArray(this.renderColor))}},n.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=nK(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tV.GRADIENT_COLOR&&(this.colorOverLifetime=eS(i.color[1]))),this},n.getActiveComponent=function(t){return t.getComponent(nJ)},i}(sT),sM=[[0,0,1,1,void 0]],sI=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new sO(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(s_),t.SpriteColorPlayableAsset=s([io(t3.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).splits=sM,r.frameAnimationLoop=!1,r.name="MSprite"+sI++,r.geometry=r.createGeometry(ik.TRIANGLES),r.setItem(),i&&r.fromData(i),r}e9(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this;this.isManualTimeSet||(this.frameAnimationTime+=t/1e3,this.isManualTimeSet=!1);var i=this.frameAnimationTime,r=this.item.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),s=this.textureSheetAnimation,a=this.renderer.texture.source.video;if(a&&(0===i?a.pause():a.play().catch(function(t){e.engine.renderErrors.add(t)})),s){var o,u,h,c,l,f=s.total||s.row*s.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/s.row*m,c=1/s.col*v):(h=1/s.col*m,c=1/s.row*v),s.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/s.col),b=g-x*s.col;l=u?[h*x,c*(s.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([d+l[0],v+p-l[1],h,c])}},r.onDestroy=function(){var e=this.getTextures();this.item&&this.item.composition&&this.item.composition.destroyTextures(e),e.forEach(function(e){var i=e.source;i.sourceType===t.TextureSourceType.video&&(null==i?void 0:i.video)&&(i.video.pause(),i.video.src="",i.video.load())})},r.createGeometry=function(t){var e=12*this.splits.length;return r_.create(this.engine,{attributes:{aPos:{type:ik.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:ik.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.getItemGeometryData=function(){var t=this.splits,e=this.textureSheetAnimation,i=this.renderer;if(i.shape){for(var r=i.shape,n=r.index,s=r.aPoint,a=void 0===s?[]:s,o=new Float32Array(a),u=[],h=[],c=0;c<o.length;c+=6)o[c]*=1,o[c+1]*=1,h.push(a[c+2],a[c+3]),u.push(o[c],o[c+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:void 0===n?[]:n,atlasOffset:h}}var l=[],f=[],d=2,p=2;1===t.length&&(d=1,p=1);for(var m=[],v=0;v<d;v++)for(var y=0;y<p;y++){var g=(2*y+v)*4,x=e?[0,0,1,1,t[0][4]]:t[2*y+v],b=x[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],T=((v+v+1)/d-1)/2,E=((y+y+1)/p-1)/2,_=x[0],A=x[1],S=x[4]?x[3]:x[2],C=x[4]?x[2]:x[3],w=[-.5/d+T,.5/p+E,-.5/d+T,-.5/p+E,.5/d+T,.5/p+E,.5/d+T,-.5/p+E];l.push(b[0]*S+_,b[1]*C+A,b[2]*S+_,b[3]*C+A,b[4]*S+_,b[5]*C+A,b[6]*S+_,b[7]*C+A),m.push(1*w[0],1*w[1],0,1*w[2],1*w[3],0,1*w[4],1*w[5],0,1*w[6],1*w[7],0),f.push(g,1+g,2+g,2+g,1+g,3+g)}return this.geometry.setAttributeData("aPos",new Float32Array(m)),{index:f,atlasOffset:l}},r.fromData=function(t){e.prototype.fromData.call(this,t);var i,r,n,s,a,o,u=t.interaction,h=t.options,c=t.listIndex,l=t.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tM.MESH,blending:null!=(r=l.blending)?r:tE.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tA.MASK,side:null!=(s=l.side)?s:t_.DOUBLE,shape:l.shape,mask:null!=(a=l.mask)?a:0,maskMode:null!=(o=l.maskMode)?o:tA.NONE,order:void 0===c?0:c},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||sM,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=n$(this);var f=this.createGeometry(ik.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=iC.fromIdentity(),this.material=d,this.geometry=f;var p=h.startColor||[1,1,1,1];this.material.setVector4("_Color",new iE().setFromArray(p)),this.material.setVector4("_TexOffset",new iE().setFromArray([0,0,1,1])),this.setItem()},i}(nJ),t.SpriteComponent=s([io(t3.SpriteComponent)],t.SpriteComponent);var sP="lookup_texture",sL="offscreen_canvas",sF={},sV=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*im),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eq(0,1)),direction:n.normalize()}},t}();function sN(t,e,i){if(e===tU.RANDOM)t=eq(0,t);else if(e===tU.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tU.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===tU.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var sD=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),sk=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eq(-this._d,this._d),i=eq(-this._h,this._h);return{direction:new iT(0,0,1),position:new iT(e,i,0)}},t}(),sz=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,s=Math.atan2(n,r),a=Math.tan(e),o=new iT;return e<s?o.set(r,r*a,0):e>=s&&e<Math.PI-s?o.set(n/a,n,0):e<Math.PI+s?o.set(-r,-r*a,0):e<2*Math.PI-s?o.set(-n/a,-n,0):o.set(r,r*a,0),{direction:i,position:o}},t}(),sU=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tU.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eq(0,1);return{direction:new iT(0,1,0),position:new iT(this._d*(e-.5),0,0)}},t}(),sB=new iC,sG=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=eq(0,2*Math.PI),n=sN(this.arc,this.arcMode,t)*im,s=sB.setFromRotationZ(n),a=new iT(Math.cos(r),Math.sin(r),0),o=new iT(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:s.transformNormal(a),position:s.transformPoint(o)}},t}(),sX=new iC,sj=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return eq(-90,90)},e.generate=function(t){var e=sN(this.arc,this.arcMode,t)*im,i=this.getHorizontalAngle()*im,r=this.radius,n=new iT(Math.cos(i),0,Math.sin(i)),s=sX.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(r),direction:s}},t}(),sH=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.getHorizontalAngle=function(){return eq(0,90)},e}(sj),sY=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=ix(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(sN(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,s=new iT(r,n,0);return{position:new iT(r*this.width,n*this.height,0),direction:s.normalize()}},t}(),sW=function(){function t(){}return t.prototype.generate=function(){return{position:new iT,direction:new iT}},t}(),sZ=((ea={})[tS.NONE]=sW,ea[tS.CONE]=sV,ea[tS.SPHERE]=sj,ea[tS.HEMISPHERE]=sH,ea[tS.CIRCLE]=sD,ea[tS.DONUT]=sG,ea[tS.RECTANGLE]=sk,ea[tS.EDGE]=sU,ea[tS.RECTANGLE_EDGE]=sz,ea[tS.TEXTURE]=sY,ea);function sq(t){if(!t)return new sW;var e=iW({radius:1,arc:360,angle:0,arcMode:tU.RANDOM},t),i=t.type,r=sZ[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tS.NONE){var s=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=s,n.upDirection=iT.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function sK(t,e,i,r,n){var s,a;if(n===function(t,e,i,r){for(var n=0,s=e,a=i-r;s<i;s+=r)n+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return n}(t,e,i,r)>0)for(s=e;s<i;s+=r)a=s9(s,t[s],t[s+1],a);else for(s=i-r;s>=e;s-=r)a=s9(s,t[s],t[s+1],a);return a&&s2(a,a.next)&&(s7(a),a=a.next),a}function sQ(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(s2(r,r.next)||0===s1(r.prev,r,r.next))){if(s7(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function sJ(t,e){return t.x-e.x}function s$(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function s0(t,e,i,r,n,s,a,o){return(n-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(r-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(n-a)*(r-o)>=0}function s1(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function s2(t,e){return t.x===e.x&&t.y===e.y}function s3(t,e,i,r){var n=s5(s1(t,e,i)),s=s5(s1(t,e,r)),a=s5(s1(i,r,t)),o=s5(s1(i,r,e));return!!(n!==s&&a!==o||0===n&&s4(t,i,e)||0===s&&s4(t,r,e)||0===a&&s4(i,t,r)||0===o&&s4(i,e,r))}function s4(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function s5(t){return t>0?1:t<0?-1:0}function s6(t,e){return 0>s1(t.prev,t,t.next)?s1(t,e,t.next)>=0&&s1(t,t.prev,e)>=0:0>s1(t,e,t.prev)||0>s1(t,t.next,e)}function s8(t,e){var i=new at(t.i,t.x,t.y),r=new at(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function s9(t,e,i,r){var n=new at(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function s7(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 at(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ae=0;function ai(t,e,i,r){i=i||2,ae=r||0;var n,s,a,o,u,h,c,l=e&&e.length,f=l?e[0]*i:t.length,d=sK(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,s,a,o,u,h=[];for(n=0,s=e.length;n<s;n++)a=e[n]*r,o=n<s-1?e[n+1]*r:t.length,(u=sK(t,a,o,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(sJ),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,s=e,a=t.x,o=t.y,u=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var h=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(h<=a&&h>u){if(u=h,h===a){if(o===s.y)return s;if(o===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}s=s.next}while(s!==e);if(!n)return null;if(a===u)return n;var c,l=n,f=n.x,d=n.y,p=1/0;s=n;do a>=s.x&&s.x>=f&&a!==s.x&&s0(o<d?a:u,o,f,d,o<d?u:a,o,s.x,s.y)&&(c=Math.abs(o-s.y)/(a-s.x),s6(s,t)&&(c<p||c===p&&(s.x>n.x||s.x===n.x&&(i=n,r=s,0>s1(i.prev,i,r.prev)&&0>s1(r.next,i,i.next))))&&(n=s,p=c)),s=s.next;while(s!==l);return n}(t,e)){var i=s8(e,t);sQ(e,e.next),sQ(i,i.next)}})(h[n],i),i=sQ(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],s=o=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<s&&(s=h),u>a&&(a=u),h>o&&(o=h);c=0!==(c=Math.max(a-n,o-s))?1/c:0}return function t(e,i,r,n,s,a,o){if(e){!o&&a&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=s$(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,s,a,o,u,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,r=i,o=0,e=0;e<h&&(o++,r=r.nextZ);e++);for(u=h;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,h*=2}while(a>1)}(n)}(e,n,s,a);for(var u,h,c=e;e.prev!==e.next;){if(u=e.prev,h=e.next,a?function(t,e,i,r){var n=t.prev,s=t.next;if(s1(n,t,s)>=0)return!1;for(var a=n.x<t.x?n.x<s.x?n.x:s.x:t.x<s.x?t.x:s.x,o=n.y<t.y?n.y<s.y?n.y:s.y:t.y<s.y?t.y:s.y,u=n.x>t.x?n.x>s.x?n.x:s.x:t.x>s.x?t.x:s.x,h=n.y>t.y?n.y>s.y?n.y:s.y:t.y>s.y?t.y:s.y,c=s$(a,o,e,i,r),l=s$(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=c&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,f.x,f.y)&&s1(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,d.x,d.y)&&s1(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,f.x,f.y)&&s1(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&s0(n.x,n.y,t.x,t.y,s.x,s.y,d.x,d.y)&&s1(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,s,a):function(t){var e=t.prev,i=t.next;if(s1(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(s0(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&s1(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+ae),i.push(e.i/r+ae),i.push(h.i/r+ae),s7(e),e=h.next,c=h.next;continue}if((e=h)===c){o?1===o?t(e=function(t,e,i){var r=t;do{var n=r.prev,s=r.next.next;!s2(n,s)&&s3(n,r,r.next,s)&&s6(n,s)&&s6(s,n)&&(e.push(n.i/i+ae),e.push(r.i/i+ae),e.push(s.i/i+ae),s7(r),s7(r.next),r=t=s),r=r.next}while(r!==t);return sQ(r)}(sQ(e),i,r),i,r,n,s,a,2):2===o&&function(e,i,r,n,s,a){var o=e;do{for(var u,h,c=o.next.next;c!==o.prev;){if(o.i!==c.i&&(u=o,h=c,u.next.i!==h.i&&u.prev.i!==h.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&&s3(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(s6(u,h)&&s6(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(s1(u.prev,u,h.prev)||s1(u,h.prev,h))||s2(u,h)&&s1(u.prev,u,u.next)>0&&s1(h.prev,h,h.next)>0))){var l=s8(o,c);o=sQ(o,o.next),l=sQ(l,l.next),t(o,i,r,n,s,a),t(l,i,r,n,s,a);return}c=c.next}o=o.next}while(o!==e)}(e,i,r,n,s,a):t(sQ(e),i,r,n,s,a,1);break}}}}(d,p,i,n,s,c),p}function ar(t,e){for(var i,r,n=t.s,s=t.p,a=n[1],o=s[1],u=0,h=0;h<a.length;h++)u+=a[h].length-1;var c,l=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(c=d[4])?d[3]:d[2],g=c?d[2]:d[3]);for(var x=[0,0],b=0===c?0:-Math.PI/2,T=0;T<a.length;T++)for(var E=a[T],_=o[T],A=o[T+1]||o[0],S=[0,0],C=0;C<E.length-1;C++)(function(t,e,i,r,n,s,a,o){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=h*i[0]+c*n+l*a+f*r[0],t[1]=h*i[1]+c*s+l*o+f*r[1]})(S,E[C],_,A,_[4],_[5],A[2],A[3]),i=S[0],r=S[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,as(x,x,b),l[p++]=m+(x[0]+1)/2*y,l[p++]=v+(x[1]+1)/2*g):(l[p++]=(i+1)/2,l[p++]=(r+1)/2),p+=2;var w=ai(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function an(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tV.SHAPE_POINTS,t.p],s:[tV.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tV.SHAPE_POINTS,t.g.p],s:[tV.SHAPE_SPLITS,t.g.s]}):i.push(t),i),s=0,a=0,o=0,u=0;u<n.length;u++){var h=ar(n[u],{indexBase:s,uvTransform:e});s+=h.aPoint.length/5,r.push(h),a+=h.aPoint.length,o+=h.index.length}if(1===r.length)return r[0];for(var c=new Float32Array(a),l=new Uint16Array(o),f=0,d=0,p=0;f<r[f];f++){var m=r[f];c.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:c,index:l}}function as(t,e,i){var r=Math.cos(i),n=Math.sin(i),s=e[0],a=e[1];return t[0]=r*s+n*a,t[1]=-n*s+r*a,t}var aa=function(){function t(t){var e=t.time,i=t.interval,n=t.count,s=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=r(n,nO)?n:nK(n),this.cycles=+s||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),ao=function(t){this.content=t},au=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new ao(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new ao(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),ah=new iT,ac=new iT,al=function(){function e(e,i){this.pointStart=[];var n,s=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,u=i.opacityOverLifetime,h=void 0===u?nK(1):u,c=i.widthOverTrail,l=i.name,f=i.occlusion,d=i.blending,p=i.maskMode,m=i.textureMap,v=i.texture,y=i.transparentOcclusion,g=i.minimumVertexDistance,x=i.lifetime,b=i.matrix,T=e.gpuCapability,E=T.detail,_=T.level,A=Math.max(i.pointCountPerTrail,2),S=nj(),C=E.maxVertexTextures>0,w=(null!=(n=e.renderer)?n:{}).env,R={},O=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===nW]],M=o>64,I=0;s&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,R.uColorOverLifetime=rs.createWithData(e,eV(s))),a&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,R.uColorOverTrail=rs.createWithData(e,eV(a))),M?(O.push(["ATTR_TRAIL_START",1]),I|=8):R.uTrailStart=new Float32Array(o),R.uOpacityOverLifetimeValue=h.toUniform(S);var P=c.toUniform(S);O.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),R.uVCurveValues=nO.getAllData(S);var L={shader:{vertex:rG,fragment:rU,macros:O,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+l,cacheId:"-t:+"+I+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},F=A*o*2,V=(A-1)*o,N=Float32Array.BYTES_PER_ELEMENT,D=12*N,k={attributes:{aColor:{size:4,stride:D,data:new Float32Array(12*F)},aSeed:{size:1,stride:D,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:D,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:D,offset:8*N,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(F)},aDir:{size:3,data:new Float32Array(3*F)}},indices:{data:new Uint16Array(6*F)},drawCount:6*V,name:"trail#"+l,bufferUsage:ik.DYNAMIC_DRAW};if(M)k.attributes.aTrailStart={size:1,data:new Float32Array(F)};else{var z=new Float32Array(F);k.attributes.aTrailStartIndex={size:1,data:z};for(var U=0;U<o;U++)for(var B=2*A,G=U*B,X=0;X<B;X++)z[G+X]=U}var j=iX(d),H=ry.create(e,L);H.blending=!0,H.depthMask=f,H.depthTest=!0,iY(H,p),ij(H,d);var Y=this.mesh=rL.create(e,{name:"MTrail_"+l,material:H,geometry:r_.create(e,k)}),W=null!=v?v:rs.createWithData(e);Object.keys(R).map(function(t){var e=R[t];if(r(e,rs))H.setTexture(t,e);else if("uTrailStart"===t)H.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],n=0;n<e.length;n+=4){var s=new iE(e[n],e[n+1],e[n+2],e[n+3]);i.push(s)}H.setVector4Array(t,i)}else H.setVector4(t,iE.fromArray(e))}),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",iE.fromArray(P)),H.setVector2("uTexOffset",new ib(0,0)),H.setVector4("uTextureMap",iE.fromArray(void 0===m?[0,0,1,1]:m)),H.setVector4("uParams",new iE(0,A-1,0,0)),H.setTexture("uMaskTex",W),H.setVector4("uColorParams",new iE(v?1:0,+j,0,+(f&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=A,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=M,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(o)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,a=n-1,o=r%n,u=(r-1)%n,h=(r-2)%n,c=this.getTrailPosition(t,u,ah);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+o,f=am(c,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),s.setAttributeSubData("aDir",6*l,v),s.setAttributeSubData("aTime",2*l,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,s.setAttributeSubData("aColor",24*l,g),u>=0){var b=new Float32Array(am(this.getTrailPosition(t,h,ac),c,e)),T=(t*n+u)*6;s.setAttributeSubData("aDir",T,b),s.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*o+E,2*o+E,2*u+1+E,2*o+1+E]),A=(t*a+(r-1)%a)*6;s.setIndexSubData(A,_)}r=++this.trailCursors[t];var S=this.mesh.material,C=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var R=2*n,O=new Float32Array(R),M=0;M<R;M++)O[M]=w;s.setAttributeSubData("aTrailStart",t*O.length,O)}else{var I=S.getFloats("uTrailStart");void 0!=I&&(I[t]=w,S.setFloats("uTrailStart",I))}C&&(C.y=Math.max(C.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",C))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,s=this.geometry.getAttributeData("aColor");return ez(s),i.x=s[n],i.y=s[1+n],i.z=s[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();ez(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");ez(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();ez(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},ii(e,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),e}(),af=new iT,ad=new iT,ap=new iT;function am(t,e,i){return t||i?(t?i?(ad.subtractVectors(e,t).normalize(),ad.subtractVectors(i,e),ap.copyFrom(ad).normalize(),af.addVectors(ad,ap)):af.subtractVectors(e,t):af.subtractVectors(i,e),af.normalize().toArray()):[0,0,0]}var av=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new aO(e,i)),r&&(n.trailMesh=new al(e,r));var n,s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}e9(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=iR(this.meshes);!(t=e()).done;)t.value.onStart()},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new iE;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){for(var e,i=iR(this.meshes);!(e=i()).done;)e.value.render(t)},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(ip);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).destroyed=!1,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===tz.removeParticle,ray:t})}}},r&&n.fromData(r),n}e9(i,e);var n=i.prototype;return n.isFrozen=function(){return this.frozen},n.isEnded=function(){return this.ended},n.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===tV.CONSTANT_VEC3?e.add(r[1]):t=nK(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,s=e.clone();if(t&&s.add(t.getValue(0)),this.transform.setPosition(s.x,s.y,s.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},n.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var s=this.item.duration;n.add(r.getValue(t/s))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},n.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var s=r.first;r.removeNode(s),i=n[1]=s.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},n.setVisible=function(t){this.renderer.setVisible(t)},n.setOpacity=function(t){var e,i=this.renderer.particleMesh.mesh.material,r=this.renderer.particleMesh.mesh.geometry,n=(null==(e=i.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];i.setVector4("uOpacityOverLifetimeValue",new iE(n[0],n[1],n[2],t));for(var s=r.getAttributeData("aColor")||[],a=0;a<s.length;a+=32)s[8*a+7]=t},n.setColor=function(t,e,i,r){var n,s=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,o=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new iE(o[0],o[1],o[2],r));for(var u=a.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=i,u[8*h+7]=r},n.setParentTransform=function(t){},n.getTextures=function(){return this.renderer.getTextures()},n.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},n.stop=function(){this.ended=!0,this.started=!1},n.reset=function(){this.renderer.reset(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new au(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1,this.destroyed=!1},n.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var a=this.particleLink,o=(i-n)/this.item.duration,u=this.timePassed,h=!1,c=function(){e.trails&&!h&&(h=!0,a.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,s,n)}))};if(this.ended){if(this.item.endBehavior!==tD.restart&&tD.destroy===this.item.endBehavior){var l=a.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/s.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var b=this.createPoint(d);b.delay+=i+x*v,this.addParticle(b,y),this.lastEmitTime=u}for(var T=s.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var A=T[E],S=!A.disabled&&A.getGeneratorOptions(u,d);if(S){var C=[0,0,0],w=s.burstOffsets[E],R=w&&w[S.cycleIndex]||C;A.once&&this.removeBurst(E);for(var O=0;O<S.count&&_<y&&!g();O++){var M,I=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:O,burstCount:S.count}));I.delay+=i,_++,(M=I.transform).translate.apply(M,[].concat(R)),this.addParticle(I,y)}}}}else this.item.endBehavior===tD.restart?(c(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=f,t[2]-=f,t[3].delay-=f}),this.renderer.minusTimeForLoop(f)):(this.ended=!0,this.item.endBehavior===tD.freeze&&(this.frozen=!0))}c()}},n.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),this.meshes.forEach(function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})}))},n.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var s=t.last,a=!1;!a;){var o=s.content[0],u=s.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),s.pre?s=s.pre:a=!0}++n>r&&(a=!0)}return i},n.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],s=new iT,a=!1;if(r&&r.content)do{var o=r.content,u=o[0],h=o[1];o[2];var c=o[3];if(u>this.timePassed){var l=this.getPointPosition(c),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},s)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(a=!0))}else break}while((r=r.pre)&&!a);return n}},n.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},n.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var s=this.trails,a=this.getPointPosition(i),o=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(h*=u[0]),s.sizeAffectsLifetime&&(c*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:o,lifetime:c,size:h,time:r})}},n.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},n.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,s=t.gravity,a=this.options.forceTarget,o=this.lastUpdate-n,u=new iT,h=iT.fromArray(void 0===s?[]:s);e.assignWorldTRS(u);var c=no(new iT,this.options,h,o,r,u,i);if(a){var l=a.target||[0,0,0],f=a.curve.getValue(o/r),d=1-f;c.x=c.x*d+l[0]*f,c.y=c.y*d+l[1]*f,c.z=c.z*d+l[2]*f}return c},n.initPoint=function(t){var e,i,r,n,s=this.options,a=this.lifetime,o=this.shape,u=s.startSpeed.getValue(a),h=s.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),c=t.position,l=new sC({position:h.transformPoint(c,new iT),valid:!0}),f=t.direction;if(f=h.transformNormal(f,ay).normalize(),s.startTurbulence&&s.turbulence){for(var d=0;d<3;d++)aE.setElement(d,s.turbulence[d].getValue(a));a_.setFromVector3(aE.negate()),aS.setFromEuler(a_).transformNormal(f).normalize()}o.alignSpeedDirection?(aT.copyFrom(f),this.upDirectionWorld||(o.upDirection?this.upDirectionWorld=o.upDirection.clone():this.upDirectionWorld=iT.Z.clone(),h.transformNormal(this.upDirectionWorld)),ab.crossVectors(aT,this.upDirectionWorld).normalize(),ab.isZero()&&ab.set(1,0,0)):(ab.set(1,0,0),aT.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=aA)[0]=p.animationDelay.getValue(a),n[1]=p.animationDuration.getValue(a),n[2]=p.cycles.getValue(a)),s.start3DRotation?ax.set(s.startRotationX.getValue(a),s.startRotationY.getValue(a),s.startRotationZ.getValue(a)):s.startRotation?ax.set(0,0,s.startRotation.getValue(a)):ax.set(0,0,0),l.setRotation(ax.x,ax.y,ax.z);var m=s.startColor.getValue(a);if(3===m.length&&(m[3]=1),s.start3DSize)ag.x=s.startSizeX.getValue(a),ag.y=s.startSizeY.getValue(a);else{var v=s.startSize.getValue(a),y=s.sizeAspect.getValue(a);ag.x=v,ag.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!s.particleFollowParent){var x=new iT;this.transform.assignWorldTRS(void 0,void 0,x),ag.x*=x.x,ag.y*=x.y}return l.setScale(ag.x,ag.y,1),{size:ag,vel:g,color:m,delay:s.startDelay.getValue(a),lifetime:s.startLifetime.getValue(a),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:s.gravity,sprite:n,dirY:aT,dirX:ab,transform:l}},n.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&r(e,Array)){var n=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[n]=e,n}return -1},n.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},n.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},n.stopParticleEmission=function(){this.emissionStopped=!0},n.resumeParticleEmission=function(){this.emissionStopped=!1},n.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},n.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,n,s,a,o,u,h,c,l,f,d,p,m,v,y=t.options,g=t.positionOverLifetime,x=void 0===g?{}:g,b=t.shape,T=null==x?void 0:x.gravityOverLifetime,E=nu(null==x?void 0:x.gravity),_=t.textureSheetAnimation,A=_?{animationDelay:nK(_.animationDelay||0),animationDuration:nK(_.animationDuration||1),cycles:nK(_.cycles||1),animate:_.animate,col:_.col,row:_.row,total:_.total||_.col*_.row}:void 0,S=!!(b&&b.turbulenceX||(null==b?void 0:b.turbulenceY)||(null==b?void 0:b.turbulenceZ));S&&(s=[nK(null!=(a=b.turbulenceX)?a:0),nK(null!=(o=b.turbulenceY)?o:0),nK(null!=(u=b.turbulenceZ)?u:0)]),this.name="ParticleSystem",this.shape=sq(b),this.emission={rateOverTime:nK(t.emission.rateOverTime),burstOffsets:(i=null!=(h=t.emission.burstOffsets)?h:[],n={},Array.isArray(i)&&i.forEach(function(t){var e=r(t,Array),i=e?t[0]:t.index,s=n[i];s||(s=n[i]=[]),e?s.push(t.slice(1,4)):s.push([+t.x,+t.y,+t.z])}),n),bursts:(t.emission.bursts||[]).map(function(t){return new aa(t)})},this.textureSheetAnimation=A;var C=t.renderer||{},w=t.rotationOverLifetime;w&&((c={}).asRotation=!!w.asRotation,c.z=w.z?nK(w.z):nK(0),w.separateAxes&&(c.x=w.x&&nK(w.x),c.y=w.y&&nK(w.y))),(null==x?void 0:x.forceTarget)&&(l={target:x.target||[0,0,0],curve:nK(x.forceCurve||[tV.LINE,[[0,0],[1,1]]])});var R={x:x.linearX&&nK(x.linearX||0),y:x.linearY&&nK(x.linearY||0),z:x.linearZ&&nK(x.linearZ||0),asMovement:x.asMovement},O={x:x.orbitalX&&nK(x.orbitalX),y:x.orbitalY&&nK(x.orbitalY),z:x.orbitalZ&&nK(x.orbitalZ),center:x.orbCenter,asRotation:x.asRotation},M=t.sizeOverLifetime||{},I=t.colorOverLifetime,P=(null==M?void 0:M.separateAxes)?{separateAxes:!0,x:nK(M.x),y:nK(M.y)}:{separateAxes:!1,x:nK(("size"in M?M.size:M.x)||1)};C.anchor=C.anchor||[0,0];var L=ib.fromArray(C.anchor);this.options={particleFollowParent:!!y.particleFollowParent,startLifetime:nK(y.startLifetime),startDelay:nK(y.startDelay||0),startSpeed:nK(x.startSpeed||0),startColor:nK(y.startColor),looping:!1,maxCount:null!=(f=y.maxCount)?f:0,gravityModifier:nK(T||0),gravity:E,start3DSize:!!y.start3DSize,startTurbulence:S,turbulence:s,speedOverLifetime:x.speedOverLifetime&&nK(x.speedOverLifetime),linearVelOverLifetime:R,orbitalVelOverLifetime:O,forceTarget:l},y.startRotationZ&&(this.options.startRotation=nK(y.startRotationZ||0)),(y.startRotationX||y.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=nK(y.startRotationX||0),this.options.startRotationY=nK(y.startRotationY||0),this.options.startRotationZ=nK(y.startRotationZ||0)),y.start3DSize?(this.options.startSizeX=nK(y.startSizeX),this.options.startSizeY=nK(y.startSizeY)):(this.options.startSize=nK(y.startSize),this.options.sizeAspect=nK(y.sizeAspect||1));var F={meshSlots:y.meshSlots,name:this.name,matrix:iC.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tM.BILLBOARD,side:C.side||t_.DOUBLE,gravity:E,blending:C.blending||tE.ALPHA,rotationOverLifetime:c,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:A,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:y.maxCount,mask:C.mask,maskMode:null!=(d=C.maskMode)?d:tA.NONE,forceTarget:l,diffuse:C.texture,sizeOverLifetime:P,anchor:L};if(I){var V=I.color,N=I.opacity;F.colorOverLifetime={},N&&(F.colorOverLifetime.opacity=nK(I.opacity)),V&&(V[0]===tV.GRADIENT_COLOR?F.colorOverLifetime.color=I.color[1]:V[0]===tV.RGBA_COLOR?F.colorOverLifetime.color=rs.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):r(V,rs)&&(F.colorOverLifetime.color=V))}var D=[],k=[0,0,1,1];if(t.splits){var z=t.splits[0];k=(p=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(A&&!A.animate)for(var U=p?A.row:A.col,B=p?A.col:A.row,G=A.total||U*B,X=0,j=0;j<U;j++)for(var H=0;H<B&&X<G;H++,X++)D.push([j*k[2]/U+k[0],H*k[3]/B+k[1],k[2]/U,k[3]/B]);else D.push(k);this.uvs=D,F.textureFlip=p;var Y=t.trails;Y&&(this.trails={lifetime:nK(Y.lifetime),dieWithParticles:!1!==Y.dieWithParticles,sizeAffectsWidth:!!Y.sizeAffectsWidth,sizeAffectsLifetime:!!Y.sizeAffectsLifetime,inheritParticleColor:!!Y.inheritParticleColor,parentAffectsPosition:!!Y.parentAffectsPosition},m={name:"Trail",matrix:iC.IDENTITY,minimumVertexDistance:Y.minimumVertexDistance||.02,maxTrailCount:y.maxCount,pointCountPerTrail:Math.round(Y.maxPointPerTrail)||32,blending:Y.blending,texture:Y.texture,opacityOverLifetime:nK(Y.opacityOverLifetime||1),widthOverTrail:nK(Y.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!Y.occlusion,transparentOcclusion:!!Y.transparentOcclusion,textureMap:Y.textureMap,mask:C.mask,maskMode:C.maskMode},Y.colorOverLifetime&&Y.colorOverLifetime[0]===tV.GRADIENT_COLOR&&(m.colorOverLifetime=Y.colorOverLifetime[1]),Y.colorOverTrail&&Y.colorOverTrail[0]===tV.GRADIENT_COLOR&&(m.colorOverTrail=Y.colorOverTrail[1])),this.renderer=new av(this.engine,F,m),this.renderer.item=this.item,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(v=W.radius)?v:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},ii(i,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}}]),i}(il),t.ParticleSystem=s([io(t3.ParticleSystem)],t.ParticleSystem);var ay=new iT,ag=new ib,ax=new rS,ab=new iT,aT=new iT,aE=new iT,a_=new rS,aA=[0,0,0],aS=new iC,aC=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}e9(i,e);var n=i.prototype;return n.start=function(e){var i=e.output.getUserData();!this.particleSystem&&r(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},n.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var i=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),.001>Math.abs(this.time-this.lastTime)&&(i=0),e.update(i)}this.lastTime=this.time},i}(sT),aw=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new aC(t)},e}(s_),aR={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"},aO=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iT,this.cachedRotationMatrix=new rC,this.cachedLinearMove=new iT,this.tempMatrix3=new rC,this.VERT_MAX_KEY_FRAME_COUNT=0;var n,s,a,o,u,h,c,l,f,d=(null!=(c=e.renderer)?c:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,b=i.sprite,T=i.gravityModifier,E=i.maxCount,_=i.textureFlip,A=i.useSprite,S=i.name,C=i.gravity,w=i.forceTarget,R=i.side,O=i.occlusion,M=i.anchor,I=i.blending,P=i.maskMode,L=i.mask,F=i.transparentOcclusion,V=i.meshSlots,N=i.renderMode,D=void 0===N?0:N,k=i.diffuse,z=void 0===k?rs.createWithData(e):k,U=e.gpuCapability.detail,B=U.halfFloatTexture,G=U.maxVertexUniforms,X=[["RENDER_MODE",+D],["ENV_EDITOR",d===nW]],j=e.gpuCapability.level,H=nj(),Y=nj(),W=G>0,Z={},q=0,K=0;this.useSprite=A,W&&X.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(X.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=p.toUniform(H)),(null==b?void 0:b.animate)&&(X.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([b.col,b.row,b.total,b.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(X.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=r(m.color,rs)?m.color:rs.createWithData(e,eV(m.color))),(null==m?void 0:m.opacity)?Z.uOpacityOverLifetimeValue=m.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=nK(1).toUniform(H),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(Z["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,K|=1<<7+e,v.enabled=!0),X.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(Z["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(H),r=1,K|=1<<10+e,l=!0,y.enabled=!0),X.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(X.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),l&&((null==y?void 0:y.asRotation)&&(X.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(H),(null==g?void 0:g.separateAxes)&&(X.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null==g?void 0:null==(f=g.y)?void 0:f.toUniform(H)),(null==x?void 0:x.z)&&(Z.uRZByLifeTimeValue=x.z.toUniform(H),K|=32768,X.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(Z.uRXByLifeTimeValue=x.x.toUniform(H),K|=65536,X.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(Z.uRYByLifeTimeValue=x.y.toUniform(H),K|=131072,X.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(X.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=262144),Z.uGravityModifierValue=T.toUniform(H),w&&(X.push(["FINAL_TARGET",!0]),K|=524288,Z.uFinalTarget=new Float32Array(w.target||[0,0,0]),Z.uForceCurve=w.curve.toUniform(H)),B&&Y.max?(K|=1048576,Z.uFCurveValueTexture=ra(e,nO.getAllData(Y,!0),Y.index,1)):Z.uFCurveValues=nO.getAllData(Y);var Q=H.max+H.curves.length-32>G;if(2===j&&(H.max=-1,H.index=V?V[0]:aI(H.index),Y.index>0&&(Y.max=-1,Y.index=V?V[1]:aI(Y.index))),Q&&B&&W){var J=ra(e,nO.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=J,q=1}else Z.uVCurveValues=nO.getAllData(H);var $=["-p:",D,K,H.index,H.max,Y.index,Y.max].join("+");X.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",Y.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",Y.max]),this.VERT_MAX_KEY_FRAME_COUNT=H.max;var tt={fragment:rU,vertex:"#define LOOKUP_TEXTURE_CURVE "+q+"\n"+rB,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:$,macros:X,name:"particle#"+S},te=iX(I);Z.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Z.uMaskTex=z,Z.uColorParams=new Float32Array([z?1:0,+te,0,+(!!O&&!F)]),Z.uParams=[0,0,0,0],Z.uAcceleration=[(null==C?void 0:C[0])||0,(null==C?void 0:C[1])||0,(null==C?void 0:C[2])||0,0];var ti=ry.create(e,{shader:tt,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});ti.blending=!0,ti.depthTest=!0,ti.depthMask=!!O,ti.stencilRef=L?[L,L]:void 0,iY(ti,P),ij(ti,I),iH(ti,R),Object.keys(Z).map(function(t){var e=Z[t];if(r(e,rs)){ti.setTexture(t,e);return}var i=[];switch(aR[t]){case"vec4":ti.setVector4(t,iE.fromArray(e));break;case"vec3":ti.setVector3(t,iT.fromArray(e));break;case"vec2":ti.setVector2(t,ib.fromArray(e));break;case"vec4Array":for(var n=0;n<e.length;n+=4){var s=new iE(e[n],e[n+1],e[n+2],e[n+3]);i.push(s)}ti.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),ti.setVector3("emissionColor",new iT(0,0,0)),ti.setFloat("emissionIntensity",0);var tr=r_.create(e,(n=4*E,s=this.useSprite,a="particle#"+S,h={aPos:{size:3,offset:0,stride:u=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:u,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:u,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:u,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*o,data:new Float32Array(0)},aSeed:{size:1,offset:3*o,stride:8*o,dataSource:"aRot"},aColor:{size:4,offset:4*o,stride:8*o,dataSource:"aRot"},aOffset:{size:4,stride:4*o,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*o,data:new Float32Array(0)},aRotation1:{size:3,offset:3*o,stride:9*o,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*o,stride:9*o,dataSource:"aRotation0"}},s&&(h.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:h,indices:{data:new Uint16Array(0)},name:a,maxVertex:n})),tn=rL.create(e,{name:"MParticle_"+S,material:ti,geometry:tr});this.anchor=M,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=w,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=T,this.rotationOverLifetime=x,this.maxCount=E,this.textureOffsets=_?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return ez(e),[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},i.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new i.constructor(0))},i.onUpdate=function(t){var e=Math.ceil(this.geometry.getAttributeData("aPos").length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r,n=t+1,s=4*n,a=this.geometry,o=n>this.maxParticleBufferCount,u=1;this.particleCount>300?u=(this.particleCount+100)/this.particleCount:this.particleCount>100?u=1.4:this.particleCount>0&&(u=2);var h={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},c=this.useSprite;c&&(h.aSprite=new Float32Array(12));var l=new iT,f=new iS,d=new iT(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=sC.getRotation(f,new rS),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();c&&(r=e.sprite);for(var A=0;A<4;A++){var S=2*A,C=3*A,w=4*A,R=12*A,O=8*A;h.aPos.set(m,R),b.fill(h.aPos,R+3),h.aRot.set(v,O),h.aRot[O+3]=_,h.aRot.set(T,O+4),c&&h.aSprite.set(r,C);var M=e.uv||x;if(M){var I=c?1-y[S+1]:y[S+1];g[0]=M[0]+y[S]*M[2],g[1]=M[1]+I*M[3]}h.aOffset.set(g,w);for(var P=A+A,L=(E[P]-this.anchor.x)*d.x,F=(E[P+1]-this.anchor.y)*d.y,V=0;V<3;V++)h.aPos[R+6+V]=e.dirX.getElement(V)*L,h.aPos[R+9+V]=e.dirY.getElement(V)*F}var N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(o){var D=eE(a.getIndexData(),6*n,6*i,u);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(h).forEach(function(e){var r=h[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var c=a.getAttributeData(e);ez(c);var l=eE(c,s*n,4*i*n,u);l.set(r,r.length*t),a.setAttributeData(e,l)}else a.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var a=0,o=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;a=n[f],o=n[f+1],u=n[f+2];var d=i-s[4*l+2],p=s[4*l+3];if(h&&c){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);a=a*x+v,o=o*x+y,u=u*x+g}else a+=v,o+=y,u+=g}var b=3*l;if(s[4*l+2]<i){var T=e/1e3*a,E=e/1e3*o,_=e/1e3*u;r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),n=this.geometry.getAttributeData("aOffset"),s=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),o=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var c=o-n[4*h+2],l=n[4*h+3],f=ix(c/l,0,1),d=8*h,p=this.cachedRotationVector3.set(s[d],s[d+1],s[d+2]),m=a[8*h+3];this.rotationOverLifetime?this.rotationOverLifetime.asRotation?(this.rotationOverLifetime.x&&(r(this.rotationOverLifetime.x,nP)?p.x+=this.rotationOverLifetime.x.getValue(f,m):p.x+=this.rotationOverLifetime.x.getValue(f)),this.rotationOverLifetime.y&&(r(this.rotationOverLifetime.y,nP)?p.y+=this.rotationOverLifetime.y.getValue(f,m):p.y+=this.rotationOverLifetime.y.getValue(f)),this.rotationOverLifetime.z&&(r(this.rotationOverLifetime.z,nP)?p.z+=this.rotationOverLifetime.z.getValue(f,m):p.z+=this.rotationOverLifetime.z.getValue(f))):(this.rotationOverLifetime.x&&(r(this.rotationOverLifetime.x,nP)?p.x+=this.rotationOverLifetime.x.getIntegrateValue(0,f,m)*l:p.x+=this.rotationOverLifetime.x.getIntegrateValue(0,f,l)*l),this.rotationOverLifetime.y&&(r(this.rotationOverLifetime.y,nP)?p.y+=this.rotationOverLifetime.y.getIntegrateValue(0,f,m)*l:p.y+=this.rotationOverLifetime.y.getIntegrateValue(0,f,l)*l),this.rotationOverLifetime.z&&(r(this.rotationOverLifetime.z,nP)?p.z+=this.rotationOverLifetime.z.getIntegrateValue(0,f,m)*l:p.z+=this.rotationOverLifetime.z.getIntegrateValue(0,f,l)*l)):u.setZero(),0===p.dot(p)&&u.identity();var v=Math.PI/180,y=p.x*v,g=p.y*v,x=p.z*v,b=Math.sin(y),T=Math.sin(g),E=Math.sin(x),_=Math.cos(y),A=Math.cos(g),S=Math.cos(x);u.set(S,-E,0,E,S,0,0,0,1),u.multiply(this.tempMatrix3.set(A,0,T,0,1,0,-T,0,A)),u.multiply(this.tempMatrix3.set(1,0,0,0,_,-b,0,b,_));var C=9*h,w=u.elements;i.set(w,C),h+4<=t&&(i.set(w,C+9),i.set(w,C+18),i.set(w,C+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),n=this.geometry.getAttributeData("aOffset"),s=this.geometry.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=a-n[4*u+2],c=n[4*u+3],l=h/c,f=s[8*u+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(r(this.linearVelOverLifetime.x,nP)?o.x=this.linearVelOverLifetime.x.getValue(l,f):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(r(this.linearVelOverLifetime.y,nP)?o.y=this.linearVelOverLifetime.y.getValue(l,f):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(r(this.linearVelOverLifetime.z,nP)?o.z=this.linearVelOverLifetime.z.getValue(l,f):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(r(this.linearVelOverLifetime.x,nP)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.y&&(r(this.linearVelOverLifetime.y,nP)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.z&&(r(this.linearVelOverLifetime.z,nP)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,c)));var d=3*u;i[d]=o.x,i[d+1]=o.y,i[d+2]=o.z,i[d+3]=o.x,i[d+4]=o.y,i[d+5]=o.z,i[d+6]=o.x,i[d+7]=o.y,i[d+8]=o.z,i[d+9]=o.x,i[d+10]=o.y,i[d+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),aM=[10,32,64,160];function aI(t){for(var e=0;e<aM.length;e++){var i=aM[e];if(i>t)return i}return t||aM[0]}function aP(t,e,i){void 0===i&&(i="");var r,n,s,a=t.content,o=+((null==(r=a.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",o],["ENV_EDITOR",i===nW]],h=e.level,c=e.detail,l=nj(),f=nj(),d=c.maxVertexUniforms>0,p=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,nX(l,p));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&nX(l,x);var b=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(nX(l,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==b?void 0:b[n])&&(nX(l,b[n]),a=1,v|=1<<10+e,s=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),s&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var T=a.sizeOverLifetime;T.separateAxes?(nX(l,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,nX(l,T.y)):nX(l,T.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(nX(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(nX(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(nX(l,E.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}nX(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,nX(l,b.forceCurve));var _=c.halfFloatTexture;_&&f.max&&(v|=1048576);var A=c.maxVertexUniforms,S=l.max+l.curves.length-32>A;sF[sP]&&(S=!0),2===h&&(l.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var C={fragment:rU,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+rB,shared:!0,cacheId:["-p:",o,v,l.index,l.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:C,vertex:l.index,fragment:f.index}}function aL(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var a=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=i;break}}}var aF=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,s=n.level,a=(null!=r?r:{}).env,o=i.getShaderLibrary(),u=[],h=[],c=0,l=0;return e.forEach(function(e){e.items.forEach(function(e){t.Item.isParticle(e)&&u.push(e)})}),u.forEach(function(e){var i=aP(e,n,a),r=i.shader,u=i.fragment,f=i.vertex;if(h.push(r),c=Math.max(c,u),l=Math.max(l,f),e.content.trails){var d,p,m,v,y,g,x,b,T=(d=e.content.trails,p=e.content.options.maxCount,m=e.name,void 0===(v=a)&&(v=""),y=0,g=sF[sP]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===nW]],b=nj(),d.colorOverLifetime&&(x.push(["COLOR_OVER_LIFETIME",!0]),y|=1),d.colorOverTrail&&(x.push(["COLOR_OVER_TRAIL",!0]),y|=4),p>64&&(x.push(["ATTR_TRAIL_START",1]),y|=8),nX(b,d.opacityOverLifetime),nX(b,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),{vertex:rG,fragment:rU,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+b.index+"+"+b.max});T.glslVersion=2===s?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,null==o||o.addShader(T)}}),h.forEach(function(e){2===s?(aL(e,l,c),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,null==o||o.addShader(e)}),2===s&&u.forEach(function(t){t.content.options.meshSlots=[l,c]}),Promise.resolve()},i}(e6),aV=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),aN=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},e.getInputStream=function(t){var e=this.playable.getInput(t);if(r(e,aD))return e.animationStream},t}(),aD=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new aN(iA(i)),i}return e9(e,t),e}(sT),ak=new rS,az=new iT(1,1,1),aU=new iT,aB=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var n=i.prototype;return n.start=function(){var t,e=this.boundObject,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new iT(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=nK(r.path));var a=r.linearX||r.linearY||r.linearZ;a&&(this.linearVelOverLifetime={x:r.linearX&&nK(r.linearX),y:r.linearY&&nK(r.linearY),z:r.linearZ&&nK(r.linearZ),asMovement:r.asMovement,enabled:!!a});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&nK(r.orbitalX),y:r.orbitalY&&nK(r.orbitalY),z:r.orbitalZ&&nK(r.orbitalZ),center:nu(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&nK(r.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=nK(s.x||1),this.sizeYOverLifetime=nK(s.y||1),this.sizeZOverLifetime=nK(s.z||1)):this.sizeXOverLifetime=nK(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:nK(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=nK(n.x||0),u.y=nK(n.y||0)}this.gravity=iT.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=nK(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iT.fromArray(r.direction).normalize():new iT,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},n.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();r(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},n.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){az.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(az.y=this.sizeYOverLifetime.getValue(r),az.z=this.sizeZOverLifetime.getValue(r)):az.z=az.y=az.x;var n=this.originalTransform.scale;e.transform.setScale(az.x*n.x,az.y*n.y,az.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},a=s(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;ak.x=o?s(this.rotationOverLifetime.x):0,ak.y=o?s(this.rotationOverLifetime.y):0,ak.z=a;var u=ak.addEulers(this.originalTransform.rotation,ak);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(no(aU,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&aU.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(aU.x,aU.y,aU.z))},i}(aD);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new aB(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(s_),t.TransformPlayableAsset=s([io(t3.TransformPlayableAsset)],t.TransformPlayableAsset);var aG=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();r(i,t.VFXItem)&&(i.time=this.time)},i}(sT);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new aG(t)},e}(s_),t.ActivationPlayableAsset=s([io(t3.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}e9(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){var i=e/t.duration;i=i<0?0:i>1?1:i;for(var r,n=iR(this.positionCurves);!(r=n()).done;){var s=r.value,a=s.keyFrames.getValue(i),o=this.findTarget(t,s.path);null==o||o.transform.setPosition(a.x,a.y,a.z)}for(var u,h=iR(this.rotationCurves);!(u=h()).done;){var c=u.value,l=c.keyFrames.getValue(i),f=this.findTarget(t,c.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=iR(this.scaleCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(i),y=this.findTarget(t,m.path);null==y||y.transform.setScale(v.x,v.y,v.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,i=iR(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:nK(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var s,a=iR(t.rotationCurves);!(s=a()).done;){var o=s.value,u={path:o.path,keyFrames:nK(o.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var h,c=iR(t.scaleCurves);!(h=c()).done;){var l=h.value,f={path:l.path,keyFrames:nK(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=iR(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:nK(m.keyFrames),property:m.property,className:m.className};this.duration=Math.max(this.duration,v.keyFrames.getMaxTime()),this.floatCurves.push(v)}},i.findTarget=function(t,e){for(var i,r=t,n=iR(e);!(i=n()).done;){for(var s,a=i.value,o=!1,u=iR(r.children);!(s=u()).done;){var h=s.value;if(h.name===a){r=h,o=!0;break}}if(!o)return}return r},e}(ic),t.AnimationClip=s([io(t3.AnimationClip)],t.AnimationClip);var aX=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();r(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(sT),aj=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===tD.restart?e%=i:this.endBehavior===tD.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}e9(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new sT(t)},i.createOutput=function(){return new sE},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=iR(this.clips);!(i=n()).done;){var s=i.value;r.push(s)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),s=iR(e);!(r=s()).done;){var a=r.value,o=this.createClipPlayable(t,a);o.setDuration(a.duration);var u=new aH(a,o,n,this);i.push(u),n.addInput(o,0),n.setInputWeight(o,0)}return n},i.createPlayable=function(t){return new sT(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new aj;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=iR(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=iR(this.children);!(i=r()).done;)i.value.parent=this},e}(s_),s([ih(aj,void 0)],t.TrackAsset.prototype,"clips",void 0),s([ih(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=s([io(t3.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tv=t.TrackType||(t.TrackType={}))[tv.MasterTrack=0]="MasterTrack",tv[tv.ObjectTrack=1]="ObjectTrack";var aH=function(){function e(e,i,n,s){this.clip=e,this.playable=i,this.parentMixer=n,this.track=s,r(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,n=1,s=!1,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tD.destroy?r(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?n=1:(n=0,s=!0):e-this.clip.start>=0?(n=1,a=!0):e<i.start&&(n=0),a&&this.playable.getPlayState()!==en.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,n);var u=i.toLocalTime(e);this.playable.setTime(u),s&&this.playable.getPlayState()===en.Playing&&this.playable.pause()},ii(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}(),aY=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();if(r(i,t.VFXItem)){for(var n=!1,s=0;s<this.getInputCount();s++)if(this.getInputWeight(s)>0){n=!0;break}n?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sT);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){return new aY(t)},e}(t.TrackAsset),t.ActivationTrack=s([io(t3.ActivationTrack)],t.ActivationTrack);var aW=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(sT),aZ=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){for(var i=!1,n=0,s=0;s<this.getInputCount();s++){var a=this.getInputWeight(s);if(a>0){var o=this.getInput(s);if(!r(o,aW)){console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");continue}n+=o.value*a,i=!0}}i&&(e[this.propertyName]=n)}},e}(sT),aq=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=iu(e);if(r)for(var n,s=iR(Object.keys(r));!(n=s()).done;){var a=n.value,o=e.taggedProperties[a];if(void 0===o&&(o=e[a]),ic.is(o))t.collectSerializableObject(o,i);else if(eH(o))for(var u,h=iR(o);!(u=h()).done;){var c=u.value;ic.is(c)&&t.collectSerializableObject(c,i)}else if(eW(o))for(var l,f=iR(Object.keys(o));!(l=f()).done;){var d=o[l.value];ic.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iW({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var s,a=iR(Object.keys(i));!(s=a()).done;){var o=i[s.value];n[o.getInstanceId()]||(n[o.getInstanceId()]={}),t.serialize(o,n[o.getInstanceId()])}return n},t.serialize=function(e,i){e.toData(),i||(i={});var r=iu(e);if(r)for(var n,s=iR(Object.keys(r));!(n=s()).done;){var a=n.value,o=e[a];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[a]=o:eH(o)?(i[a]||(i[a]=[]),t.serializeArrayProperty(o,i[a],0)):ic.is(o)?i[a]={id:o.getInstanceId()}:eW(o)&&(i[a]||(i[a]={}),t.serializeObjectProperty(o,i[a],0))}for(var u,h=iR(Object.keys(e.taggedProperties));!(u=h()).done;){var c=u.value,l=e.taggedProperties[c];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[c]=l:eH(l)?(i[c]||(i[c]=[]),t.serializeArrayProperty(l,i[c],0)):ic.is(l)?i[c]={id:l.getInstanceId()}:eW(l)&&(i[c]||(i[c]={}),t.serializeObjectProperty(l,i[c],0))}return i},t.deserialize=function(e,i){for(var r,n=i.taggedProperties,s=iu(i),a=i.engine,o=iR(Object.keys(e));!(r=o()).done;){var u=r.value;if(!s||!s[u]){var h=e[u];n[u]=t.deserializeProperty(h,a,0)}}if(s)for(var c,l=iR(Object.keys(s));!(c=l()).done;){var f=c.value,d=e[f];if(void 0!==d){var p=s[f].type;i[f]=t.deserializeProperty(d,a,0,p)}}i.fromData(n)},t.deserializeAsync=function(e,r){return i(function(){var i,n,s,o,u,h,c,l,f,d,p,m;return a(this,function(a){switch(a.label){case 0:i=r.taggedProperties,n=iu(r),s=r.engine,o=iR(Object.keys(e)),a.label=1;case 1:if((u=o()).done)return[3,4];if(h=u.value,n&&n[h])return[3,3];return c=e[h],[4,t.deserializePropertyAsync(c,s,0)];case 2:i[h]=a.sent(),a.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];l=iR(Object.keys(n)),a.label=5;case 5:if((f=l()).done)return[3,8];if(void 0===(p=e[d=f.value]))return[3,7];return m=n[d].type,[4,t.deserializePropertyAsync(p,s,0,m)];case 6:r[d]=a.sent(),a.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}})})()},t.checkTypedArray=function(t){return r(t,Int8Array)||r(t,Uint8Array)||r(t,Uint8ClampedArray)||r(t,Int16Array)||r(t,Uint16Array)||r(t,Int32Array)||r(t,Uint32Array)||r(t,Float32Array)||r(t,Float64Array)||r(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eW(t)&&1===Object.keys(t).length&&"id"in t&&ej(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eW(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eZ(t)||r(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eH(e)){for(var s,a=[],o=iR(e);!(s=o()).done;){var u=s.value;a.push(t.deserializeProperty(u,i,r+1,n))}return a}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!eW(e)||e.constructor!==Object)return e;h=n?new n:{};for(var h,c,l=iR(Object.keys(e));!(c=l()).done;){var f=c.value;h[f]=t.deserializeProperty(e[f],i,r+1)}return h},t.deserializePropertyAsync=function(e,r,n,s){return i(function(){var i,o,u,h,c,l,f,d,p;return a(this,function(a){switch(a.label){case 0:if(n>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eH(e))return[3,5];i=[],o=iR(e),a.label=1;case 1:if((u=o()).done)return[3,4];return h=u.value,c=i.push,[4,t.deserializePropertyAsync(h,r,n+1,s)];case 2:c.apply(i,[a.sent()]),a.label=3;case 3:return[3,1];case 4:return[2,i];case 5:if(!t.checkDataPath(e))return[3,7];return[4,r.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,a.sent()];case 7:if(!(eW(e)&&e.constructor===Object))return[3,12];l=s?new s:{},f=iR(Object.keys(e)),a.label=8;case 8:if((d=f()).done)return[3,11];return p=d.value,[4,t.deserializePropertyAsync(e[p],r,n+1)];case 9:l[p]=a.sent(),a.label=10;case 10:return[3,8];case 11:return[2,l];case 12:return[2,e];case 13:return[2]}})})()},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var n,s=iR(Object.keys(e));!(n=s()).done;){var a=n.value,o=e[a];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[a]=o:eH(o)?(i[a]||(i[a]=[]),t.serializeArrayProperty(o,i[a],r+1)):ic.is(o)?i[a]={id:o.getInstanceId()}:eW(o)&&(i[a]||(i[a]={}),t.serializeObjectProperty(o,i[a],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[n]=s:eH(s)?(i[n]||(i[n]=[]),t.serializeArrayProperty(s,i[n],r+1)):ic.is(s)?i[n]={id:s.getInstanceId()}:eW(s)&&(i[n]||(i[n]={}),t.serializeObjectProperty(s,i[n],r+1))}},t}(),aK=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.reusable=!1,t.sceneBindings=[],t.graph=new sb,t}e9(i,e);var s=i.prototype;return s.onStart=function(){this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tD.destroy&&this.setReusable(!0)},s.setReusable=function(e){for(var n,s=iR(this.timelineAsset.tracks);!(n=s()).done;){var a=n.value.boundObject;if(r(a,t.VFXItem)){var o=a.getComponent(i);o&&o.setReusable(e)}}},s.getReusable=function(){return this.reusable},s.onUpdate=function(t){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.graph.evaluate(t)},s.createContent=function(){if(this.item.composition)for(var e,r=iR(this.items);!(e=r()).done;){var n=e.value;if(n.composition=this.item.composition,t.VFXItem.isComposition(n)){this.item.composition.refContent.push(n);var s=n.props.content.options.refId,a=this.item.composition.refCompositionProps.get(s);if(!a)throw Error("Referenced precomposition with Id: "+s+" does not exist.");var o=n.addComponent(i);aq.deserialize(a,o),o.createContent();for(var u,h=iR(o.items);!(u=h()).done;){var c=u.value;c.setInstanceId(eQ());for(var l,f=iR(c.components);!(l=f()).done;)l.value.setInstanceId(eQ())}}}},s.onEnable=function(){for(var t,e=iR(this.items);!(t=e()).done;)t.value.setActive(!0)},s.onDisable=function(){for(var t,e=iR(this.items);!(t=e()).done;)t.value.setActive(!1)},s.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},s.hitTest=function(e,i,r,s,a,o){for(var u,h=[],c=(null==o?void 0:o.stop)||eX,l=(null==o?void 0:o.skip)||eX,f=(null==o?void 0:o.maxCount)||this.items.length,d=0;d<this.items.length&&s.length<f;d++){var p=(u=this,function(n){var o=u.items[n];if(o.isActive&&o.transform.getValid()&&!t.VFXItem.isComposition(o)&&!l(o)){var f=o.getHitTestParams(a);if(f){var d=!1,p=new iT;if(f.type===t.HitTestType.triangle)for(var m=f.triangles,v=f.backfaceCulling,y=0;y<m.length;y++){var g=m[y];if(e.intersectTriangle(g,p,v)){d=!0,h.push(p);break}}else if(f.type===t.HitTestType.box){var x=f.center,b=f.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:E},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,A=f.radius;e.intersectSphere({center:_,radius:A},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new ib(i,r));S&&S.length>0&&(S.forEach(function(t){h.push(t)}),d=!0)}if(d){var C={compContent:u.item,id:o.id,name:o.name,position:h[h.length-1],parentId:o.parentId,hitPositions:h,behavior:f.behavior};if(o.emit("click",C),s.push(C),c(C))return{v:s}}}}}(d));if("object"===n(p))return p.v}return s},s.fromData=function(t){var i;e.prototype.fromData.call(this,t),this.items=t.items,this.startTime=null!=(i=t.startTime)?i:0,this.sceneBindings=t.sceneBindings,this.timelineAsset=t.timelineAsset},s.resolveBindings=function(){for(var t,e=iR(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=iR(this.timelineAsset.tracks);!(r=n()).done;){var s=r.value;this.updateTrackAnimatedObject(s)}},s.updateTrackAnimatedObject=function(t){for(var e,i=iR(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(id),aQ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();r(e,aK)&&(e.time=this.getTime())},e}(sT),aJ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(r(e,aK)){for(var i=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){i=!0;break}i?e.item.setActive(!0):e.item.setActive(!1)}},e}(sT),a$=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){var i=!1,n=e[this.propertyName];if(r(n,iE)){n.setZero();for(var s=0;s<this.getInputCount();s++){var a=this.getInputWeight(s);if(a>0){var o=this.getInput(s);if(!r(o,aW)){console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");continue}var u=o.value;n.x+=u.x*a,n.y+=u.y*a,n.z+=u.z*a,n.w+=u.w*a,i=!0}}i&&(e[this.propertyName]=n)}}},e}(sT),a0=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){var i=!1,n=e[this.propertyName];if(r(n,rR)){n.setZero();for(var s=0;s<this.getInputCount();s++){var a=this.getInputWeight(s);if(a>0){var o=this.getInput(s);if(!r(o,aW)){console.error("ColorPropertyMixerPlayable received incompatible input");continue}var u=o.value;n.r+=u.r*a,n.g+=u.g*a,n.b+=u.b*a,n.a+=u.a*a,i=!0}}i&&(e[this.propertyName]=n)}}},e}(sT),a1=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}e9(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);s([ih(void 0,void 0)],a1.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new aZ(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(a1),t.FloatPropertyTrack=s([io(t3.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(t.TrackAsset),t.SpriteColorTrack=s([io(t3.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var n=i.prototype;return n.updateAnimatedObject=function(){if(!this.parent||!r(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(aK)},n.createTrackMixer=function(t){return new aJ(t)},i}(t.TrackAsset),t.SubCompositionTrack=s([io(t3.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(t.TrackAsset),t.TransformTrack=s([io(t3.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.updateAnimatedObject=function(){r(this.parent.boundObject,ip)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),s([ih(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=s([io("MaterialTrack")],t.MaterialTrack),t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new a$(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(a1),t.Vector4PropertyTrack=s([io(t3.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new a0(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(a1),t.ColorPropertyTrack=s([io(t3.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new aW(t);return e.curve=nK(this.curveData),e.value=e.curve.getValue(0),e},e}(s_),s([ih(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=s([io(t3.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new aW(t);return e.curve=nK(this.curveData),e.value=e.curve.getValue(0),e},e}(s_),s([ih(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=s([io(t3.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new aQ(t)},e}(s_),t.SubCompositionPlayableAsset=s([io(t3.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset);var a2=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t.cacheFlattenedTracks=null,t}e9(i,e);var n=i.prototype;return n.createPlayable=function(e){var i=new a3(e);i.setTraversalMode(es.Passthrough);for(var n,s=iR(this.tracks);!(n=s()).done;){var a=n.value;r(a,t.ObjectBindingTrack)&&a.create(this)}return this.sortTracks(this.tracks),i.compileTracks(e,this.flattenedTracks),i},n.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},n.invalidate=function(){this.cacheFlattenedTracks=null},n.addSubTracksRecursive=function(t,e){for(var i,r=iR(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var s,a=iR(t.getChildTracks());!(s=a()).done;){var o=s.value;this.addSubTracksRecursive(o,e)}},n.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new a4(t[i],i));e.sort(a5),t.length=0;for(var r,n=iR(e);!(r=n()).done;){var s=r.value;t.push(s.track)}},n.fromData=function(t){},ii(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=iR(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(s_),s([ih(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=s([io(t3.TimelineAsset)],t.TimelineAsset);var a3=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}e9(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=iR(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},n=iR(e);!(i=n()).done;){var s=i.value,a=s.createPlayableGraph(t,this.clips);this.addInput(a,0);var o=s.createOutput();o.setUserData(s.boundObject),t.addOutput(o),o.setSourcePlayable(this,this.getInputCount()-1);var u=new a2(s,a,o);r[s.getInstanceId()]=u,s.parent||this.masterTrackInstances.push(u)}for(var h,c=iR(e);!(h=c()).done;)for(var l,f=h.value,d=r[f.getInstanceId()],p=iR(f.getChildTracks());!(l=p()).done;){var m=r[l.value.getInstanceId()];d.addChild(m)}},e}(sT),a4=function(t,e){this.track=t,this.originalIndex=e};function a5(e,i){var n=e.track.boundObject,s=i.track.boundObject;return r(n,t.VFXItem)&&r(s,t.VFXItem)?t.VFXItem.isAncestor(n,s)?-1:t.VFXItem.isAncestor(s,n)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}function a6(t,e){return e&&("object"===n(e)||"function"==typeof e)?e:iA(t)}t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new aW(t);return e.curve=nK(this.curveData),e.value=e.curve.getValue(0),e},e}(s_),s([ih(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=s([io("Vector4PropertyPlayableAsset")],t.Vector4PropertyPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var n=i.prototype;return n.updateAnimatedObject=function(){},n.create=function(e){if(r(this.boundObject,t.VFXItem)){var i=this.boundObject;if(i.getComponent(t.ParticleSystem)){var n=e.createTrack(t.TrackAsset,this,"ParticleTrack");n.boundObject=this.boundObject;var s=n.createClip(aw);s.start=i.start,s.duration=i.duration,s.endBehavior=i.endBehavior}}},i}(t.TrackAsset),t.ObjectBindingTrack=s([io(t3.ObjectBindingTrack)],t.ObjectBindingTrack);var a8=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tW.display:r,s=t.textBaseline,a=void 0===s?tZ.top:s,o=t.textAlign,u=void 0===o?tq.left:o,h=t.text,c=t.letterSpace,l=void 0===c?0:c,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+l),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=l,this.overFlow=n,this.textBaseline=a,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,s=t.fontScale,a=(i-r)/3,o=r+n*s,u=i*(e-1),h=0;switch(this.textBaseline){case tZ.top:h=o+a;break;case tZ.middle:h=(this.height*s-u+o)/2;break;case tZ.bottom:h=this.height*s-u-a}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tq.left:i=t.outlineWidth*t.fontScale;break;case tq.middle:i=(this.width*t.fontScale-e)/2;break;case tq.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),a9=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,s,a,o=t.textColor,u=t.fontSize,h=t.outline,c=t.shadow,l=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===o?[1,1,1,1]:o,this.textWeight=void 0===l?"normal":l,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===d?"sans-serif":d,this.fontSize=void 0===u?40:u,h&&(this.isOutlined=!0,this.outlineColor=null!=(e=h.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=h.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),c&&(this.hasShadow=!0,this.shadowBlur=null!=(r=c.shadowBlur)?r:2,this.shadowColor=null!=(n=c.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=c.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(a=c.shadowOffsetY)?a:0),this.fontStyle!==tQ.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},a7=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return ez(t),t}if(sF[sL])return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?eb(this.elements,t):t.remove()},t}()),ot=["serif","sans-serif","monospace","courier"],oe=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+oe++,r.geometry=r.createGeometry(ik.TRIANGLES),i&&r.fromData(i),r.canvas=a7.getCanvas(),a7.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),r.setItem(),!i)return a6(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e9(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,s,a,o,u=e.interaction,h=e.options,c=e.listIndex,l=e.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tM.MESH,blending:null!=(r=l.blending)?r:tE.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tA.MASK,side:null!=(s=l.side)?s:t_.DOUBLE,mask:null!=(a=l.mask)?a:0,maskMode:null!=(o=l.maskMode)?o:tA.NONE,order:void 0===c?0:c},this.interaction=u,this.updateWithOptions(h),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(nJ),t.TextComponent=s([io(t3.TextComponent)],t.TextComponent);var oi=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new a9(t),this.textLayout=new a8(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout.letterSpace,n=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,s=this.textLayout.width+this.textStyle.fontOffset,a=1,o=0,u=0;u<t.length;u++){var h,c,l=t[u],f=(null!=(c=null==i?void 0:null==(h=i.measureText(l))?void 0:h.width)?c:0)*n;((o+=r)+f>s&&u>0||"\n"===l)&&(a++,o=0),"\n"!==l&&(o+=f)}return a},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(this.textStyle.fontFamily===t&&!eU(t)){console.warn("The font is either the current font or an risky font family.");return}this.textStyle.fontFamily=t,this.isDirty=!0},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,s=(r.width+i.fontOffset)*n,a=r.lineHeight*this.lineCount,o=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=s,r.autoWidth?(this.canvas.height=a*n,this.item.transform.size.set(1,a/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.clearRect(0,0,s,h),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),e.fillRect(0,0,s,h),i.fontDesc=this.getFontDesc(),e.font=i.fontDesc,i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var c=[],l=0,f=r.getOffsetY(i,this.lineCount,u,o),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=r.letterSpace*n)+y.width>s&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:d,charOffsetX:p}),l=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(l),l+=y.width)}c.push({y:f,width:l,chars:d,charOffsetX:p}),c.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,s){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[s],t.y),e.fillText(r,n+t.charOffsetX[s],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("_MainTex",rs.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:ik.LINEAR,minFilter:ik.LINEAR,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE})),this.isDirty=!1}},e.getFontDesc=function(){var t=this.textStyle,e=t.fontSize,i=t.fontScale,r=t.fontFamily,n=t.textWeight,s=t.fontStyle,a=""+(e*i).toString()+"px ";return ot.includes(r)?a+=r:a+='"'+r+'"',n!==tK.normal&&(a=n+" "+a),s!==tQ.normal&&(a=s+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],s=i[1],a=i[2],o=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*a+", "+o+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,a=i[0],o=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*a+", "+255*o+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();e$(t.TextComponent,[oi]);var or=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),on=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.fromData=function(t){},e}(ic),s([ih(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=s([io(t3.BinaryAsset)],t.BinaryAsset);var os=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var i,r=this.findData(e);if(!r){console.error("Object data with uuid: "+e+" not found.");return}switch(r.dataType){case t3.Material:i=ry.create(this.engine);break;case t3.Geometry:i=r_.create(this.engine);break;case t3.Texture:i=rs.create(this.engine);break;default:var n=t.getClass(r.dataType);n&&(i=new n(this.engine))}if(!i){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return i.setInstanceId(r.id),this.engine.addInstance(i),aq.deserialize(r,i),i},e.loadGUIDAsync=function(e){var r=this;return i(function(){var i,n,s;return a(this,function(a){switch(a.label){case 0:if(r.engine.objectInstance[e])return[2,r.engine.objectInstance[e]];if(i=r.findData(e))return[3,2];if(!r.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,r.engine.database.loadGUID(e)];case 1:if(!(n=a.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return r.engine.addInstance(n),[2,n];case 2:switch(i.dataType){case t3.Material:n=ry.create(r.engine);break;case t3.Geometry:n=r_.create(r.engine);break;case t3.Texture:n=rs.create(r.engine);break;default:(s=t.getClass(i.dataType))&&(n=new s(r.engine))}if(!n)return console.error("Constructor for DataType: "+i.dataType+" not found."),[2,void 0];return n.setInstanceId(i.id),r.engine.addInstance(n),[4,aq.deserializeAsync(i,n)];case 3:return a.sent(),[2,n]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return ia[t]},t}(),oa=function(){function t(){}return t.prototype.loadGUID=function(t){return i(function(){return a(this,function(t){return[2,void 0]})})()},t}();function oo(t,e){if(!t.includes(e))return t.push(e),!0}function ou(t){if(Number.isFinite(t))return[tV.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tV.CONSTANT)return[tV.CONSTANT,t[1]];if("lines"===e)return[tV.LINE,t[1]];if(e===tV.LINE){var r=i.map(function(t){return[tN.LINE,t]});return[tV.BEZIER_CURVE,r]}return"curve"===e||e===tV.CURVE?[tV.BEZIER_CURVE,oS(i)]:t}}function oh(t,e){return Array.isArray(t)&&"random"===t[0]?[tV.CONSTANT,t[1][e]]:ou(t)}function oc(t){return t&&"color"===t[0]?od(t[1],!0):[1,1,1,1]}function ol(t){return t&&"random"===t[0]?[tV.RANDOM,t[1]]:ou(t)}function of(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,s=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,a=od(t[r],e);i.push([s,a[0],a[1],a[2],a[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tV.GRADIENT_COLOR,i]}}function od(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var n=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(n){var s=+n[4];i=[+n[1],+n[2],+n[3],isNaN(s)?255:Math.round(255*s)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),255])}else r(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=op(i)),i}function op(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function om(t,e){return Array.isArray(t)?t[0]===tV.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&of(t[1],e):of(t,e)}function ov(t){if(t){if(3===t.length)return[tV.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tV.BEZIER_PATH||e===tV.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],s=i[2],a=oS(r);if(!s){s=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o||o<n.length-1&&s.push(u),s.push(u)}}return[tV.BEZIER_CURVE_PATH,[a,n,s]]}return t}}function oy(t){for(var e,i=iR(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function og(t){for(var e,i=iR(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var ox=Math.cos,ob=Math.sin,oT=Math.PI/180,oE=180/Math.PI;function o_(t,e){return t?[t[0]-.5,.5-t[1]]:e?oA[e]:[0,0]}var oA=((eo={})[tI.PARTICLE_ORIGIN_CENTER]=[0,0],eo[tI.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eo[tI.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eo[tI.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eo[tI.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eo[tI.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eo[tI.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eo[tI.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eo[tI.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eo);function oS(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var a=t[s][3]*(e-i),o=t[s+1][2]*(e-i),u=[t[s][0],t[s][1]],h=[t[s+1][0],t[s+1][1]];if(u[0]!=h[0]){var c=function(t,e,i,r){var n=i[0],s=i[1],a=r[0],o=r[1],u=a-n;return[[n+(a-n)/3,s+(t*=u)/3],[a-(a-n)/3,o-(e*=u)/3]]}(a,o,u,h),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[tN.EASE_OUT,t]:e===n.length-1?[tN.EASE_IN,t]:[tN.EASE,t]})}function oC(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tO.null&&t.endBehavior===tD.destroy&&(t.endBehavior=tD.freeze)})}),t.version="2.1",t}function ow(t){for(var e,i=iW({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=iR(i.images);!(e=r()).done;)e.value.id=eQ();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eQ(),t.dataType=t3.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:eQ(),dataType:t3.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(s=t.bins,i.bins=s.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eQ()}}));for(var s,a,o={},u={},h=iR(t.compositions);!(a=h()).done;)!function(){var t=a.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tD.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tO.particle&&t.content.filter&&delete t.content.filter});for(var e,r=iR(t.items);!(e=r()).done;){var n=e.value;o[n.id]=eQ(),n.oldId=n.id,n.id=o[n.id],u[n.id]=n}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],s=e.parentId.split("^")[1];e.parentId=o[n]+"^"+s}else e.parentId=o[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var s=iW({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(s),function(t,e,i){for(var r,n=[],s=[],a=[],o={tracks:[],id:eQ(),dataType:"TimelineAsset"},u=iR(t.items);!(r=u()).done;){var h=e[r.value.id],c=[],l={id:eQ(),dataType:"ActivationPlayableAsset"};a.push(l);var f={id:eQ(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:l.id}}]};if(c.push({id:f.id}),s.push(f),h.type!==tO.particle){var d={id:eQ(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};a.push(d);var p={id:eQ(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};c.push({id:p.id}),s.push(p)}if(h.type===tO.sprite||h.type===tO.text){var m={id:eQ(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};a.push(m);var v={id:eQ(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};c.push({id:v.id}),s.push(v)}if(h.type===tO.composition){var y={id:eQ(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:eQ(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};c.push({id:g.id}),s.push(g)}var x={id:eQ(),dataType:"ObjectBindingTrack",children:c,clips:[]};s.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=iR(s);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var A,S=iR(s);!(A=S()).done;){var C=A.value;i.miscs.push(C)}for(var w,R=iR(a);!(w=R()).done;){var O=w.value;i.miscs.push(O)}}(s,u,i)}();for(var c,l=iR(i.items);!(c=l()).done;){var f=c.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tO.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tO.sprite){var g,x,b,T,E,_,A,S=f.content;S.renderer||(S.renderer={});var C=S.renderer,w=o_(C.anchor,C.particleOrigin),R=f.transform.size;C.anchor||void 0===C.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(T=null==R?void 0:R.x)?T:1),f.transform.position.y+=-w[1]*(null!=(E=null==R?void 0:R.y)?E:1)),f.transform.anchor={x:w[0]*(null!=(_=null==R?void 0:R.x)?_:1),y:w[1]*(null!=(A=null==R?void 0:R.y)?A:1)}}}if(f.type===tO.particle){var O=f.content;O.renderer||(O.renderer={});var M=O.renderer;O.renderer.anchor=o_(M.anchor,M.particleOrigin)}if(f.type===tO.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var I=f.pn,P=t.plugins,L=void 0===P?[]:P;void 0!==I&&Number.isInteger(I)&&(f.pluginName=L[I])}switch("editor-gizmo"===f.pluginName&&(f.type="editor-gizmo"),"orientation-transformer"===f.pluginName&&(f.type="orientation-transformer"),f.content.options.target&&"editor-gizmo"===f.pluginName&&(f.content.options.target=o[f.content.options.target]),f.type===tO.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,i),(f.type===tO.sprite||f.type===tO.particle||f.type===tO.mesh||f.type===tO.skybox||f.type===tO.light||"camera"===f.type||f.type===tO.tree||f.type===tO.interact||f.type===tO.camera||f.type===tO.text||f.type===tO.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eQ(),f.content.item={id:f.id},f.dataType=t3.VFXItemData,f.components.push({id:f.content.id})),(f.type===tO.null||f.type===tO.composition)&&(f.components=[],f.dataType=t3.VFXItemData),f.type){case tO.sprite:f.content.dataType=t3.SpriteComponent;break;case tO.particle:f.content.dataType=t3.ParticleSystem;break;case tO.mesh:f.content.dataType=t3.MeshComponent;break;case tO.skybox:f.content.dataType=t3.SkyboxComponent;break;case tO.light:f.content.dataType=t3.LightComponent;break;case"camera":f.content.dataType=t3.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tO.tree:f.content.dataType=t3.TreeComponent;break;case tO.interact:f.content.dataType=t3.InteractComponent;break;case tO.camera:f.content.dataType=t3.CameraController;break;case tO.text:f.content.dataType=t3.TextComponent;break;case tO.spine:f.content.dataType=t3.SpineComponent}}return i.version="3.0",i}function oR(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},s={path:ov(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:ou(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:ou(n.linearX),linearY:ou(n.linearY),linearZ:ou(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:ou(n.orbitalX),orbitalY:ou(n.orbitalY),orbitalZ:ou(n.orbitalZ),speedOverLifetime:ou(n.speedOverLifetime)};og(s);var a={options:{startColor:oc(r.startColor)},positionOverLifetime:s};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=a.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=ou(o.x),u.y=ou(o.y),u.z=ou(o.z)):u.z=ou(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=a.colorOverLifetime={opacity:ou(h.opacity)};h.color&&(c.color=om(h.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:ou(l.size),x:ou(l.x),y:ou(l.y),z:ou(l.z)}),a}var oO=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,oM=/^(\d+)\.(\d+)$/,oI=!1;function oP(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(c=(h=t).version)?void 0:c.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||h.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tO.mesh||t.type===tO.light)&&(t.endBehavior=1===t.endBehavior?tD.destroy:t.endBehavior)})}),oO.test(t.version)){var e,i,r,n,s,a,o,u;return oI=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",ow(oC((oL="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(oL="1.3"),s=(e.requires||[]).slice(),a=e.images.map(function(t,i){return oF(t,i,e.imageTags||[])}),o=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:oL,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return oV(t,{plugins:n,requires:s})}),images:a,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:o,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u)))}oI=!1;var h,c,l,f,d,p=oM.exec(t.version)||[],m=Number(p[1]),v=Number(p[2]);if(m)return(m<2||2===m&&v<4)&&((d=t).compositions.map(function(t){for(var e,i=iR(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=iR(Object.keys(e));!(i=r()).done;){var n=i.value,s=e[n],a=Array.isArray(s);a&&2===s.length&&Array.isArray(s[1])?"path"===n?e[n]=ov(s):e[n]=ou(s):a||"object"!=typeof s||t(s)}})(e.value.content)}),t=d),m<3?ow(oC(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var oL="1.0";function oF(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eQ(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eQ(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eQ(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eQ(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function oV(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iW({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return oD(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var s=null==(i=t.meta)?void 0:i.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(r.previewSize=s),r}var oN=[0,0,0,1];function oD(t,e){void 0===e&&(e={});var i=tO.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tO.plugin,m=t.pn,p=t.pluginName,f=t.content,l=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),c=t.transform||b(l.transform)):t.particle?(i=tO.particle,c=b((l=t.particle).transform,oI,!0),f=function(t){var e=t.options,i=t.transform,r={type:tS.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iW({},t.shape,{type:tS[s]}),t.shape.upDirection){var a=t.shape.upDirection,o=a[0],u=a[1],h=a[2];0===o&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=ol(e.turbulenceX),r.turbulenceY=ol(e.turbulenceY),r.turbulenceZ=ol(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return oy(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return oy(t)})),c.rateOverTime&&(c.rateOverTime=ol(c.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:c,options:{startLifetime:ol(e.startLifetime),start3DSize:!!e.start3DSize,startSize:ol(e.startSize),startSizeX:ol(e.startSizeX),startSizeY:ol(e.startSizeY),sizeAspect:ol(e.sizeAspect),maxCount:e.maxCount,startDelay:ol(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tV.COLORS,t[1].map(function(t){return od(t,e)})]:"gradient"===t[0]?of(t[1],e):"color"===t[0]?[tV.RGBA_COLOR,od(t[1],e)]:t}(e.startColor,!0),startRotationZ:ol(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=ol(e.startRotationX),l.options.startRotationY=ol(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:ov(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:ol(f.x),y:ol(f.y)}:l.sizeOverLifetime={size:ol(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?ou(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:ou(e.gravityModifier),startSpeed:ol(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:ol(d.linearX),linearY:ol(d.linearY),linearZ:ol(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:ol(d.orbitalX),orbitalY:ol(d.orbitalY),orbitalZ:ol(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:ou(d.forceCurve)},og(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:ol(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=ou(m.y),l.rotationOverLifetime.x=ou(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:ou(v.opacity)};v.color&&(y.color=om(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:ou(g.cycles),animationDelay:oh(g.animationDelay,0),animationDuration:oh(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:ol(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:ou(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&om(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&om(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:ol(x.opacityOverLifetime)}),l.trails&&og(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(l)):t.sprite?(i=tO.sprite,c=b((l=t.sprite).transform,!1,!0),o=oR(a=l,c),(u=a.textureSheetAnimation)&&(o.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),o.renderer=a.renderer,a.splits&&(o.splits=a.splits),a.interaction&&(o.interaction=a.interaction),f=o):t.cal?(i=tO.null,c=b((l=t.cal).transform,!1,!0),f=oR(l,c)):t.ui?(i=tO.interact,c=b((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tw.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&oc(i.previewColor),behavior:i.behavior||tR.NOTIFY};break;case"drag":e={type:tw.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tw.MESSAGE}}return{options:e}}(l),c.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tO.camera,c=b(l.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,s,a={path:ov(null==(s=t.transform)?void 0:s.path),linearX:ou(null==r?void 0:r.translateX),linearY:ou(null==r?void 0:r.translateY),linearZ:ou(null==r?void 0:r.translateZ)};og(a),i.positionOverLifetime=a}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:ou(null==o?void 0:o.rotateX),y:ou(null==o?void 0:o.rotateY),z:o.separateAxes?ou(null==o?void 0:o.rotateZ):ou(o.rotation)};og(u),i.rotationOverLifetime=u}return i}(l))),null==(h=f.renderer)?void 0:h.anchor){var s=new Float32Array(f.renderer.anchor);.5==s[0]&&.5==s[1]?delete f.renderer.anchor:e.requires&&oo(e.requires,"anchor")}if(l){var a,o,u,h,c,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tD.restart:tD.destroy:tD.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tD.destroy,l.options.renderLevel&&(d=l.options.renderLevel),isNaN(n)&&(n=l.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:c,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(oo(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var s,a,o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R,O=(s=r.rotation[0],a=r.rotation[1],o=r.rotation[2],u=ox(s*oT/2),h=ox(a*oT/2),c=ox(o*oT/2),l=ob(s*oT/2),f=ob(a*oT/2),d=ob(o*oT/2),oN[0]=l*h*c+u*f*d,oN[1]=u*f*c-l*h*d,oN[2]=u*h*d+l*f*c,oN[3]=u*h*c-l*f*d,oN);r.rotation=(p=[],m=O[0],v=O[1],y=O[2],g=O[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,A=v*b,S=y*T,C=g*T,w=y*x-g*b,p[1]=Math.asin((R=-w)>1?1:R<-1?-1:R)*oE,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-A)*oE,p[2]=Math.atan2(_+C,1-A-S)*oE):(p[0]=0,p[2]=Math.atan2(-(_-C),1-E-S)*oE),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var ok=((eu={})[tT.S]=[tT.S,tT.BPlus,tT.APlus],eu[tT.A]=[tT.A,tT.BPlus,tT.APlus],eu[tT.B]=[tT.B,tT.BPlus],eu);function oz(t,e){if(!t||!e)return!0;var i=ok[e];return!!i&&i.includes(t)}function oU(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},s=n.name,a=n.url;return s&&(e&&e[s]?i=e[s]:a&&(i=a)),i}function oB(t,e,i){return oG.apply(this,arguments)}function oG(){return(oG=i(function(t,e,i){var n,s;return a(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,i1(t)];case 1:return n=a.sent(),[3,3];case 2:n=t,a.label=3;case 3:if(!n)throw Error("Image not provided.");if(!e)return[2,n];if(s=oU(e,i)){if(ej(s)&&s!==n.src)return[2,i1(s)];if(r(s,HTMLImageElement))return[2,s]}return[2,n]}})})).apply(this,arguments)}t.Scene=void 0,(ty=t.Scene||(t.Scene={})).isJSONObject=function(t){return eW(t)&&"jsonScene"in t},ty.isURL=function(t){return eW(t)&&"url"in t},ty.isWithOptions=function(t){return eW(t)&&"options"in t};var oX=1,oj=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iZ),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=oX++,this.timers=[],this.updateOptions(t)}var n=e.prototype;return n.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},n.loadScene=function(e,r,n){var s=this;return i(function(){var o,u,h,c,l,f,d,p,m,v,y,g;return a(this,function(x){return u=ej(e)?e:s.id,h=performance.now(),c=[],d=null!=(f=null==(l=null==r?void 0:r.engine.gpuCapability)?void 0:l.detail.compressedTexture)?f:t.COMPRESSED_TEXTURE.NONE,p={},v=!1,y=new Promise(function(t,e){m=window.setTimeout(function(){v=!0,s.removeTimer(m),e(Error("Load time out: totalTime: "+(performance.now()-h).toFixed(4)+"ms "+c.join(" ")+", url: "+u+"."))},1e3*s.timeout),s.timers.push(m)}),g=i(function(t,e){var i,r,n;return a(this,function(s){switch(s.label){case 0:if(v)return[3,4];i=performance.now(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e()];case 2:return r=s.sent(),n=performance.now()-i,c.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+s.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([y,i(function(){var i,l,f,v,y,x,b,T,E,_,A,S,C,w,R,O,M,I,P,L;return a(this,function(a){switch(a.label){case 0:if(!ej(e))return[3,2];return l=new URL(e,location.href).href,s.baseUrl=l,[4,g("loadJSON",function(){return s.loadJSON(l)})];case 1:return o=a.sent(),[3,3];case 2:o=e,s.baseUrl=location.href,a.label=3;case 3:if(!t.Scene.isJSONObject(o))return[3,5];return f=(i=iW({},o)).jsonScene,v=i.pluginSystem,y=i.images,x=f.compositions,b=f.images,s.assignImagesToAssets(b,y),[4,Promise.all([g("plugin:processAssets",function(){return s.processPluginAssets(f,v,n)}),g("plugin:precompile",function(){return s.precompile(x,v,r,n)})])];case 4:return a.sent(),[3,10];case 5:return[4,g("processJSON",function(){return s.processJSON(o)})];case 6:return E=(T=a.sent()).jsonScene,_=T.pluginSystem,S=void 0===(A=E.bins)?[]:A,C=E.images,w=E.compositions,R=E.fonts,[4,Promise.all([g("processBins",function(){return s.processBins(S)}),g("processImages",function(){return s.processImages(C,d)}),g("plugin:processAssets",function(){return s.processPluginAssets(E,_,n)}),g("plugin:precompile",function(){return s.precompile(w,_,r,n)}),g("processFontURL",function(){return s.processFontURL(R)})])];case 7:return M=(O=a.sent())[0],I=O[1],[4,g("processTextures",function(){return s.processTextures(I,M,E)})];case 8:return P=a.sent(),i={timeInfos:p,url:e,renderLevel:s.options.renderLevel,storage:{},pluginSystem:_,jsonScene:E,bins:M,images:I,textureOptions:P},[4,g("plugin:prepareResource",function(){return _.loadResources(i,s.options)})];case 9:a.sent(),a.label=10;case 10:return[4,g("prepareAssets",function(){return s.prepareAssets(null==r?void 0:r.engine)})];case 11:return a.sent(),L=performance.now()-h,eG.info("Load asset: totalTime: "+L.toFixed(4)+"ms "+c.join(" ")+", url: "+u+"."),window.clearTimeout(m),s.removeTimer(m),i.totalTime=L,i.startTime=h,i.timeInfos=p,[2,i]}})})()])]})})()},n.precompile=function(t,e,r,n){return i(function(){return a(this,function(i){switch(i.label){case 0:if(!r||!r.getShaderLibrary())return[2];return[4,e.precompile(t,r,n)];case 1:return i.sent(),[2]}})})()},n.processJSON=function(t){var e=this;return i(function(){var i,r,n;return a(this,function(s){switch(s.label){case 0:return[4,(n=new e4(void 0===(r=(i=oP(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return s.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},n.processBins=function(t){var e=this;return i(function(){var i,n;return a(this,function(s){return i=e.options.renderLevel,n=e.baseUrl,[2,Promise.all(t.map(function(s){if(r(s,ArrayBuffer))return s;if(oz(s.renderLevel,i))return e.loadBins(new URL(s.url,n).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},n.processFontURL=function(t){var r=this;return i(function(){return a(this,function(n){return t?[2,Promise.all(t.map(i(function(t){var i,n,s;return a(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];eU(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),i=new URL(t.fontURL,r.baseUrl).href,[4,(s=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")")).load()];case 2:return a.sent(),document.fonts.add(s),e.fontCache.add(t.fontFamily),[3,4];case 3:return a.sent(),eG.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},n.processImages=function(e,n){void 0===n&&(n=0);var s=this;return i(function(){var o,u,h,c,l;return a(this,function(f){switch(f.label){case 0:return u=(o=s.options).useCompressedTexture,h=o.variables,c=s.baseUrl,[4,Promise.all(e.map(i(function(e,i){var o,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R,O,M;return a(this,function(i){switch(i.label){case 0:if(o=e.url,l=e.webp,f=e.avif,d=new URL(o,c).href,p=l&&new URL(l,c).href,m=f&&new URL(f,c).href,v=e.id,!("template"in e))return[3,8];if(!(g=(y=e.template).background))return[3,7];x=oU(y,h),b=g.type===t1.video,T=g&&b?i6:i1,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,i9(x,T)];case 2:if(!r(E=i.sent(),HTMLVideoElement))return[3,3];return s.sourceFrom[v]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return g&&Array.isArray(x)&&h&&(h[g.name]=E.src),s.sourceFrom[v]={url:E.src,type:t.TextureSourceType.image},[4,oB(E,y,h)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw _=i.sent(),Error("Failed to load. Check the template or if the URL is "+(b?"video":"image")+" type, URL: "+x+", Error: "+(_.message||_)+".");case 7:return[3,9];case 8:if("compressed"in e&&u&&n){if(A=e.compressed,n===t.COMPRESSED_TEXTURE.ASTC?S=A.astc:n===t.COMPRESSED_TEXTURE.PVRTC&&(S=A.pvrtc),S)return C=new URL(S,c).href,s.sourceFrom[v]={url:C,type:t.TextureSourceType.compressed},[2,s.loadBins(C)]}else if(r(e,HTMLImageElement)||r(e,HTMLCanvasElement)||r(e,HTMLVideoElement)||r(e,rs))return[2,e];i.label=9;case 9:if(!m)return[3,11];return[4,i$(d,m)];case 10:return M=i.sent(),[3,13];case 11:return[4,iQ(d,p)];case 12:M=i.sent(),i.label=13;case 13:return R=(w=M).url,O=w.image,s.sourceFrom[v]={url:R,type:t.TextureSourceType.image},[2,O]}})})))];case 1:return l=f.sent(),s.assignImagesToAssets(e,l),[2,l]}})})()},n.processPluginAssets=function(t,e,r){var n=this;return i(function(){var i,s,o,u;return a(this,function(a){switch(a.label){case 0:return[4,e.processAssets(t,r)];case 1:for(s=(i=a.sent().reduce(function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t},{assets:[],loadedAssets:[]})).assets,o=i.loadedAssets,u=0;u<s.length;u++)n.assets[s[u].id]=o[u];return[2]}})})()},n.prepareAssets=function(t){var e=this;return i(function(){var i,r,n,s,o;return a(this,function(a){if(!t)return[2];for(i=iR(Object.keys(e.assets));!(r=i()).done;)n=r.value,s=e.assets[n],(o=new on(t)).data=s,o.setInstanceId(n),t.addInstance(o);return[2]})})()},n.processTextures=function(e,n,s){var o=this;return i(function(){var u;return a(this,function(h){return[2,Promise.all((null!=(u=s.textures)?u:e.map(function(t,e){return{source:e}})).map(i(function(e,i){var u,h,c,l,f;return a(this,function(a){switch(a.label){case 0:if(r(e,rs))return[2,e];if(!("mipmaps"in e))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,rt(e,n,o.assets,s.bins)];case 2:return[2,a.sent()];case 3:throw Error("Load texture "+i+" fails, error message: "+a.sent()+".");case 4:if(u=e.source,h=e.id,l="",!eW(u))return[3,5];return c=o.assets[u.id],l=u.id,[3,7];case 5:if("string"!=typeof u)return[3,7];return[4,i1(eJ(u))];case 6:c=a.sent(),a.label=7;case 7:if(c)return[2,(f=function(e,i,n){var s={id:n,dataType:t3.Texture};if(r(e,rs))return iW({},e.source,s);if(r(e,HTMLImageElement)||eZ(e))return iW({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:ik.LINEAR,magFilter:ik.LINEAR},s);if(r(e,HTMLVideoElement))return iW({sourceType:t.TextureSourceType.video,video:e,minFilter:ik.LINEAR,magFilter:ik.LINEAR},s);if(r(e,ArrayBuffer))return iW({},rl(e),{sourceFrom:i},s);if("width"in e&&"height"in e&&"data"in e)return iW({sourceType:t.TextureSourceType.data,data:e,wrapS:ik.CLAMP_TO_EDGE,wrapT:ik.CLAMP_TO_EDGE,minFilter:ik.NEAREST,magFilter:ik.NEAREST},s);throw Error("Invalid texture options.")}(c,o.sourceFrom[l],h)).sourceType===t.TextureSourceType.compressed?f:iW({},f,e)];throw Error("Invalid texture source: "+u+".")}})})))]})})()},n.loadJSON=function(t){var e=this;return i(function(){return a(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},n.loadBins=function(t){var e=this;return i(function(){return a(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},n.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},n.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},n.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();oj.fontCache=new Set;var oH=new iT(1,1,1),oY=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=iC.fromIdentity(),this.viewMatrix=iC.fromIdentity(),this.projectionMatrix=iC.fromIdentity(),this.viewProjectionMatrix=iC.fromIdentity(),this.inverseViewMatrix=iC.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,s=e.aspect,a=e.clipMode,o=void 0===a?tF.portrait:a,u=e.position,h=e.rotation;this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===s?1:s,clipMode:o,position:iT.fromArray(void 0===u?[0,0,8]:u),rotation:rS.fromArray(void 0===h?[0,0,0]:h)},this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new iT(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var s=i.projectPoint(e).z,a=r.projectPoint(new iT(1,1,s)),o=a.x,u=a.y,h=r.projectPoint(new iT(-1,-1,s));return new iT((o-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0),this.dirty&&this.setRotationByQuat(t)},e.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new iS;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},e.getOptions=function(){return this.options},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,s=t.aspect,a=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=s,this.position=a,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,s=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*im,i,r,n,s===tF.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(a,this.getQuat(),oH),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){sC.getRotation(t,this.options.rotation)},ii(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)}},{key:"rotation",get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)}}]),t}(),oW=0,oZ=function(){function t(t,e){this.refCompositionProps=new Map,this.imgUsage={},this.mask=0,this.refCompositions=new Map,this.engine=e;var i=t.jsonScene,r=t.renderLevel,n=t.textureOptions,s=t.pluginSystem,a=t.totalTime,o=i.compositions,u=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var h,c=iR(o);!(h=c()).done;){var l=h.value;l.id===u?this.composition=l:this.refCompositions.set(l.id,l)}if(!this.composition)throw Error("Invalid composition id: "+u+".");this.jsonScene=i,this.renderLevel=r,this.pluginSystem=s,this.totalTime=null!=a?a:0,this.textures=n,oW=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=iW({},t);return this.assembleItems(e),isNaN(e.endBehavior)&&(e.endBehavior=tD.freeze),e.startTime||(e.startTime=0),e},e.assembleItems=function(t){this.mask++;var e={},i=[];if(this.jsonScene){for(var r,n=iR(this.jsonScene.components);!(r=n()).done;){var s=r.value;e[s.id]=s}for(var a,o=iR(t.items);!(a=o()).done;){var u=a.value,h=this.engine.jsonSceneData[u.id];if(oz(h.renderLevel,this.renderLevel)){if(h.listIndex=oW++,h.type===tO.sprite||h.type===tO.particle||h.type===tO.spine||h.type===tO.shape)for(var c,l=iR(h.components);!(c=l()).done;){var f=e[c.value.id];this.preProcessItemContent(f)}if(h.type===tO.composition){var d=h.content.options.refId,p=this.refCompositions.get(d);if(!p)throw Error("Invalid ref composition id: "+d+".");var m=this.getContent(p);this.refCompositionProps.has(d)||this.refCompositionProps.set(d,m)}i.push(u)}}t.items=i}},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),"mask"in t.renderer||this.processMask(t.renderer);var e,i,r=t.splits&&!t.textureSheetAnimation?t.splits[0]:void 0,n=t.renderer.shape;Number.isInteger(n)?e=null==(i=this.jsonScene)?void 0:i.shapes[n]:n&&(e=n),void 0===e||"aPoint"in e&&"index"in e||(t.renderer.shape=an(e,r))}"trails"in t&&void 0!==t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,i=null!=(e=this.imgUsage)?e:{};t&&i&&(Object.prototype.hasOwnProperty.call(i,t)||(i[t]=0),i[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tA.NONE&&(t.mask||(e===tA.MASK?t.mask=++this.mask:e!==tA.OBSCURED&&e!==tA.REVERSE_OBSCURED||(t.mask=this.mask)))},e.dispose=function(){this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}(),oq=function(){function t(){this.update=new oQ,this.lateUpdate=new oJ}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==il.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==il.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==il.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==il.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),oK=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),oQ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iR(t);!(i=r()).done;)i.value.onUpdate(e)},e}(oK),oJ=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iR(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(oK),o$=function(e){function r(i,r){(n=e.call(this)||this).sceneTicking=new oq,n.speed=1,n.isEnded=!1,n.loaderData={},n.refContent=[],n.refCompositionProps=new Map,n.postProcessingEnabled=!1,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.lastVideoUpdateTime=0,n.isEndCalled=!1;var n,s,a,o,u=i.reusable,h=void 0!==u&&u,c=i.speed,l=i.baseRenderOrder,f=i.renderer,d=i.event,p=i.width,m=i.height,v=i.handleItemMessage;n.compositionSourceManager=new oZ(r,f.engine),h&&(n.keepResource=!0,r.textures=void 0,r.consumed=!0);var y=n.compositionSourceManager,g=y.sourceContent,x=y.pluginSystem,b=y.imgUsage,T=y.totalTime,E=y.refCompositionProps;return n.postProcessingEnabled=null!=(a=null==(s=r.jsonScene.renderSettings)?void 0:s.postProcessingEnabled)&&a,ez(g),n.renderer=f,n.refCompositionProps=E,n.rootItem=new t.VFXItem(n.getEngine(),g),n.rootItem.name="rootItem",n.rootItem.composition=iA(n),n.rootComposition=n.rootItem.addComponent(aK),n.width=p,n.height=m,n.renderOrder=void 0===l?0:l,n.id=g.id,n.renderer=f,n.texInfo=h?{}:b,n.event=d,n.statistic={loadStart:null!=(o=r.startTime)?o:0,loadTime:null!=T?T:0,compileTime:0,firstFrameTime:0},n.reusable=h,n.speed=void 0===c?1:c,n.autoRefTex=!n.keepResource&&n.texInfo&&n.rootItem.endBehavior!==tD.restart,n.name=g.name,n.pluginSystem=x,n.pluginSystem.initializeComposition(iA(n),r),n.camera=new oY(n.name,iW({},null==g?void 0:g.camera,{aspect:p/m})),n.url=r.url,n.assigned=!0,n.interactive=!0,n.handleItemMessage=v,n.createRenderFrame(),n.rendererOptions=null,aq.deserialize(g,n.rootComposition),n.rootComposition.createContent(),n.buildItemTree(n.rootItem),n.pluginSystem.resetComposition(iA(n),n.renderFrame),n}e9(r,e);var n=r.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(t){this.renderOrder=t},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(t){this.speed=t},n.setVisible=function(t){this.rootItem.setVisible(t)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},n.pause=function(){this.paused=!0},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1},n.gotoAndPlay=function(t){this.setTime(t),this.resume()},n.gotoAndStop=function(t){this.setTime(t),this.pause()},n.createRenderFrame=function(){this.renderFrame=new r3({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},n.setTime=function(t){var e=this.speed,i=this.paused;i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&this.pause(),this.emit("goto",{time:t})},n.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},n.forwardTime=function(t){for(var e=1e3*t-1e3*this.rootComposition.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},n.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},n.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},n.update=function(t){if(this.assigned&&!this.paused){var e=this.getUpdateTime(t*this.speed);this.updateRootComposition(e/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay()),this.sceneTicking.update.tick(e),this.sceneTicking.lateUpdate.tick(e),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tD.destroy&&!this.reusable},n.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},n.callAwake=function(t){for(var e,i=iR(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,s=iR(t.children);!(n=s()).done;){var a=n.value;this.callAwake(a)}},n.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(aK).items,s=iR(n);!(i=s()).done;){var a=i.value;r.set(a.id,a)}for(var o,u=iR(n);!(o=u()).done;){var h=o.value;if(void 0===h.parentId)h.setParent(e);else{var c=r.get(h.parentId);if(c)h.parent=c,h.transform.parentTransform=c.transform,c.children.push(h);else throw Error("The element references a non-existent element, please check the data.")}}for(var l,f=iR(n);!(l=f()).done;){var d=l.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},n.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach(function(t){return null==t?void 0:t.uploadCurrentVideoFrame()}),this.lastVideoUpdateTime=e)},n.updateCamera=function(){this.camera.updateMatrix()},n.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},n.updateRootComposition=function(t){if(this.rootComposition.isActiveAndEnabled){var e=parseFloat((this.time+t-this.rootItem.start).toFixed(3)),i=!1,r=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-r>.001)switch(i=!0,n){case tD.restart:e%=r,this.restart();break;case tD.freeze:e=Math.min(r,e);case tD.forward:case tD.destroy:}this.rootComposition.time=e,this.isEnded!==i&&(i?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.getItemByName=function(t){return this.rootItem.find(t)},n.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return nd((t-i.z)/r,(e-i.w)/n,this.camera)},n.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},n.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,s=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(aK))||n.hitTest(a,t,e,s,i,r),this.refContent.forEach(function(n){var o;null==(o=n.getComponent(aK))||o.hitTest(a,t,e,s,i,r)}),s},n.addInteractiveItem=function(t,e){if(e===tw.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},n.removeInteractiveItem=function(t,e){e===tw.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},n.destroyTextures=function(e){for(var i=0;i<e.length;i++){var r,n=e[i];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose();continue}!this.autoRefTex||--this.texInfo[n.getInstanceId()]||n.dispose()}}},n.destroyItem=function(t){var e=this;t.type==tO.composition?t.endBehavior!==tD.freeze&&t.getComponent(aK).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(eT(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},n.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},n.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},s=this.textures;s&&this.keepResource&&s.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eX)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eG.error("Update disposed composition: "+r.name+".")},this.dispose=eX,s&&this.keepResource&&s.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==nW&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},n.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},n.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},n.translate=function(t,e,i){this.rootItem.translate(t,e,i)},n.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},n.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},n.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},n.scale=function(t,e,i){this.rootItem.scale(t,e,i)},n.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},n.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},n.reloadTexture=function(){var t=this;return i(function(){return a(this,function(e){switch(e.label){case 0:if(!t.textureOffloaded)return[3,2];return[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},ii(r,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),r}(sw),o0=new Int32Array(2),o1=new Float32Array(o0.buffer),o2=new Float64Array(o0.buffer),o3=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tg=eh||(eh={}))[tg.UTF8_BYTES=1]="UTF8_BYTES",tg[tg.UTF16_STRING=2]="UTF16_STRING";var o4=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return o0[0]=this.readInt32(t),o1[0]},e.readFloat64=function(t){return o0[o3?0:1]=this.readInt32(t),o0[o3?1:0]=this.readInt32(t+4),o2[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){o1[0]=e,this.writeInt32(t,o0[0])},e.writeFloat64=function(t,e){o2[0]=e,this.writeInt32(t,o0[o3?0:1]),this.writeInt32(t+4,o0[o3?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===eh.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),o5=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=o4.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,s=this.space;e:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var o=2;o<r;o+=2)if(this.bb.readInt16(s+o)!=this.bb.readInt16(a+o))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(r(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=o4.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),o6=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new o8(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),o8=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=o6.createDataVector(t,this.data);return o6.createFBEffectsObjectData(t,e,i)},t}(),o9=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new o6).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new o7(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),o7=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=o9.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return o9.createFBEffectsPackageData(t,e)},t}(),ut=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new ue(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),ue=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return ut.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ui=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new ur(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,s,a){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),ur=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return ui.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),un=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new ui).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new us(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),us=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=un.createChannelsVector(t,t.createObjectOffsetList(this.channels));return un.createFBVertexData(t,this.vertexCount,e)},t}(),ua=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new un).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new ut).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new uo(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),uo=function(){function t(t,e,i,r,n,s,a,o,u,h,c,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===a&&(a=0),void 0===o&&(o=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===c&&(c=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=s,this.mode=a,this.buffer=o,this.binaryData=u,this.boneNames=h,this.rootBoneName=c,this.inverseBindMatrices=l}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=ua.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,a=ua.createBinaryDataVector(t,this.binaryData),o=ua.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=ua.createInverseBindMatricesVector(t,this.inverseBindMatrices);return ua.startFBGeometryData(t),ua.addId(t,e),ua.addName(t,i),ua.addVertexData(t,r),ua.addIndexFormat(t,this.indexFormat),ua.addIndexOffset(t,this.indexOffset),ua.addSubMeshes(t,n),ua.addMode(t,this.mode),ua.addBuffer(t,s),ua.addBinaryData(t,a),ua.addBoneNames(t,o),ua.addRootBoneName(t,u),ua.addInverseBindMatrices(t,h),ua.endFBGeometryData(t)},t}(),uu=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new o5(1),i=new o7,r=[],n=iR(this.exportObjectDatas);!(t=n()).done;){var s=t.value,a=void 0;s.dataType===t3.Geometry&&(a=new o8("Geometry",this.geometryDataToBinary(s))),a&&r.push(a)}return i.exportObjects=r,o9.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new o4(t),i=o9.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var s=n.dataArray(),a=n.dataType();if(s){var o=void 0;a===t3.Geometry&&(o=this.binaryToGeometryData(s)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new o5(1),i=new uo,r=t.indexFormat,n=t.indexOffset,s=t.mode,a=t.id,o=t.vertexData,u=t.boneNames,h=t.rootBoneName,c=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=s,i.id=a,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===c?[]:c,i.binaryData=void 0===l?[]:l;var f=new us;f.vertexCount=o.vertexCount,f.channels=[];for(var d,p=iR(o.channels);!(d=p()).done;){var m=d.value,v=new ur(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=iR(t.subMeshes);!(y=x()).done;){var b=y.value,T=new ue(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,o9.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,s=new o4(t),a=ua.getRootAsFBGeometryData(s),o={vertexCount:0,channels:[]},u=a.vertexData();if(u){o.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var c,l=u.channels(h);if(l){var f={semantic:null!=(c=l.semantic())?c:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};o.channels.push(f)}}}for(var d=[],p=0;p<a.subMeshesLength();p++){var m=a.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<a.boneNamesLength();g++){var x=a.boneNames(g);y.push(x)}var b=a.inverseBindMatricesArray();return{vertexData:o,indexFormat:a.indexFormat(),indexOffset:a.indexOffset(),subMeshes:d,mode:a.mode(),buffer:null!=(e=a.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=a.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=a.binaryDataArray())?r:void 0,id:null!=(n=a.id())?n:"",dataType:t3.Geometry}},t}(),uh=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new os(this),this.emptyTexture=ru(this),this.transparentTexture=rh(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.getInstance=function(t){return this.objectInstance[t]},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=i.items,s=i.materials,a=i.shaders,o=i.geometries,u=i.components,h=i.animations,c=i.bins,l=void 0===c?[]:c,f=i.miscs,d=iR(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=iR(void 0===s?[]:s);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=iR(void 0===a?[]:a);!(g=x()).done;){var b=g.value;this.addEffectsObjectData(b)}for(var T,E=iR(void 0===o?[]:o);!(T=E()).done;){var _=T.value;this.addEffectsObjectData(_)}for(var A,S=iR(void 0===u?[]:u);!(A=S()).done;){var C=A.value;this.addEffectsObjectData(C)}for(var w,R=iR(void 0===h?[]:h);!(w=R()).done;){var O=w.value;this.addEffectsObjectData(O)}for(var M,I=iR(void 0===f?[]:f);!(M=I()).done;){var P=M.value;this.addEffectsObjectData(P)}for(var L=0;L<l.length;L++){var F=l[L],V=t.bins[L];if(F.dataType===t3.BinaryAsset)F.buffer=V,F.id&&this.addEffectsObjectData(F);else{var N=new uu;N.deserializeFromBinary(new Uint8Array(V));for(var D,k=iR(N.exportObjectDatas);!(D=k()).done;){var z=D.value;this.addEffectsObjectData(z)}}}for(var U,B=iR(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return i(function(){var i,r,n,s;return a(this,function(a){switch(a.label){case 0:i=iR(t.jsonScene.items),a.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(s=(n=r.value).type)||"camera"===s||s===tO.sprite||s===tO.particle||s===tO.mesh||s===tO.skybox||s===tO.light||s===tO.tree||s===tO.interact||s===tO.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:a.sent(),a.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||eb(this.textures,t)},e.removeTexture=function(t){this.destroyed||eT(this.textures,t)},e.addMaterial=function(t){this.destroyed||eb(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eT(this.materials,t)},e.addGeometry=function(t){this.destroyed||eb(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eT(this.geometries,t)},e.addMesh=function(t){this.destroyed||eb(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eT(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||eb(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eT(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&eG.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach(function(t){return t.dispose()}),this.meshes.forEach(function(t){return t.dispose()}),this.geometries.forEach(function(t){return t.dispose()}),this.materials.forEach(function(t){return t.dispose()}),this.textures.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},ii(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),uc=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=ix(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++)(0,this.tickers[e])(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},ii(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();e3("camera",si,t.VFXItem,!0),e3("text",or,t.VFXItem,!0),e3("sprite",sx,t.VFXItem,!0),e3("particle",aF,t.VFXItem,!0),e3("cal",aV,t.VFXItem,!0),e3("interact",sh,t.VFXItem,!0),eG.info("Core version: 2.1.3-alpha.3.");var ul=((ec={})[ik.RGBA]=34842,ec[ik.RGB]=34843,ec[ik.ALPHA]=33325,ec[ik.RED]=33325,ec[ik.LUMINANCE_ALPHA]=33327,ec[ik.LUMINANCE]=33325,ec),uf=((el={})[ik.RGBA]=34836,el[ik.RGB]=34837,el[ik.ALPHA]=33326,el[ik.RED]=33326,el[ik.LUMINANCE_ALPHA]=33328,el[ik.LUMINANCE]=33326,el),ud=function(e){function r(t,i){var r;return(r=e.call(this,t)||this).initialized=!1,i&&r.fromData(i),r}e9(r,e);var n=r.prototype;return n.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,s=i.name;this.textureBuffer=e.createTexture(),ug(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},n.clone=function(){var t=new r(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.update=function(e){var i,r,n,s,a,o=this;if(!this.pipelineContext||!this.textureBuffer){this.width=0,this.height=0;return}var u=this.target,h=this.source,c=this.pipelineContext.gl,l=this.engine.gpuCapability.detail,f=h.sourceType,d=h.data,p=h.cube,m=h.image,v=h.video,y=h.mipmaps,g=h.mipmaps,x=e.data,b=e.cube,T=e.generateMipmap,E=e.mipmaps,_=h.format,A=h.type,S=h.internalFormat,C=0,w=0;(this.bind(f===t.TextureSourceType.video),A===ik.HALF_FLOAT?((A=l.halfFloatTexture)||eG.error("Half float texture is not support."),iU(c)&&S===_&&(_===ik.LUMINANCE&&(_=ik.RED),S=ul[_]),l.halfFloatLinear||(h.minFilter=h.magFilter=c.NEAREST,eG.warn("Half float linear not support, change to NEAREST."))):A!==c.FLOAT||((A=l.floatTexture)||eG.error("Float texture is not support."),iU(c)&&S===_&&(_===ik.LUMINANCE&&(_=ik.RED),S=uf[_]),l.floatLinear||(h.minFilter=c.NEAREST,h.magFilter=c.NEAREST,eG.warn("Float linear not support, change to NEAREST."))),void 0===h.premultiplyAlpha&&(h.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),void 0===h.flipY&&(h.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,h.flipY),f===t.TextureSourceType.framebuffer)?x&&(C=null!=(i=x.width)?i:0,w=null!=(r=x.height)?r:0,C&&w&&(this.width!==C||this.height!==w)&&c.texImage2D(u,0,S,C,w,0,_,A,null)):f===t.TextureSourceType.data?u===c.TEXTURE_CUBE_MAP?b.forEach(function(t,e){var i=o.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),r=i[0],n=i[1];C=Math.max(r,C),w=Math.max(n,w)}):(C=(n=this.texImage2DData(c,u,0,S,_,A,d))[0],w=n[1]):f===t.TextureSourceType.image||f===t.TextureSourceType.video?(u===c.TEXTURE_CUBE_MAP?p.forEach(function(t,e){var i=o.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),r=i[0],n=i[1];C=Math.max(r,C),w=Math.max(n,w)}):u===c.TEXTURE_2D&&(C=(s=this.texImage2D(c,u,0,S,_,A,null!=m?m:v))[0],w=s[1]),T&&(up(C)&&up(w)||iU(c))&&c.generateMipmap(u)):f===t.TextureSourceType.mipmaps?u===c.TEXTURE_2D?y.forEach(function(t,e){if(a="data"in t?o.texImage2DData(c,u,e,S,_,A,t):o.texImage2D(c,u,e,S,_,A,t),0===e){var i;C=(i=a)[0],w=i[1]}}):u===c.TEXTURE_CUBE_MAP&&g.forEach(function(t,e){t.forEach(function(t,i){if(a="data"in t?o.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,A,t):o.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,A,t),0===e){var r;C=(r=a)[0],w=r[1]}})}):f===t.TextureSourceType.compressed&&E&&0!==E.length&&(C=E[0].width,w=E[0].height,E.forEach(function(t,e){c.compressedTexImage2D(u,e,S,t.width,t.height,0,t.data)})),this.width=C,this.height=w,this.setTextureFilters(c,u,h)},n.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=i.wrapS,s=void 0===n?t.CLAMP_TO_EDGE:n,a=i.wrapT,o=void 0===a?t.CLAMP_TO_EDGE:a,u=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&u.setTextureAnisotropic(t,this.target,void 0===r?4:r);var h=iU(t)||up(this.width)&&up(this.height),c=i.magFilter?i.magFilter:t.NEAREST,l=i.minFilter?i.minFilter:t.NEAREST;h||l!==t.LINEAR_MIPMAP_LINEAR&&l!==t.LINEAR_MIPMAP_NEAREST&&l!==t.NEAREST_MIPMAP_LINEAR&&l!==t.NEAREST_MIPMAP_NEAREST||(l=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,l),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,h?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,h?o:t.CLAMP_TO_EDGE)},n.fromData=function(t){e.prototype.fromData.call(this,t);var i=this.assembleOptions(t),r=i.sourceType,n=i.sourceFrom,s=i.name;this.source=i,this.sourceType=r,this.sourceFrom=n,this.name=void 0===s?"":s,this.guid=t.id},n.texImage2D=function(e,i,r,n,s,a,o){var u,h=this,c=this.source,l=c.sourceType,f=c.minFilter,d=c.magFilter,p=c.wrapS,m=c.wrapT,v=null!=(u=this.engine.gpuCapability.detail.maxTextureSize)?u:2048,y=o;if(l!==t.TextureSourceType.video){var g=f!==e.NEAREST||d!==e.NEAREST||p!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||o.width>v||o.height>v)&&setTimeout(function(){y=h.resizeImage(o)})}e.texImage2D(i,r,n,s,a,y);var x=[y.width,y.height];return l===t.TextureSourceType.video?[o.videoWidth,o.videoHeight]:x},n.texImage2DData=function(t,e,i,r,n,s,a){var o=a.data,u=a.width,h=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,h,0,n,s,c),[u,h]},n.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;return iU(this.pipelineContext.gl)&&t.width<n&&t.height<n?t:function(t,e,i,r){var n=t.width,s=t.height,a=Math.min(e,i||nf(n)),o=Math.min(e,r||nf(s));if(o!==s||a!==n){var u=a7.getCanvas(),h=u.getContext("2d");return u.width=a,u.height=o,null==h||h.drawImage(t,0,0,n,s,0,0,a,o),eG.warn("Image resize from "+n+"x"+s+" to "+a+"x"+o+"."),u}}(t,n,e,i)||t},n.reloadData=function(){var t=this;return i(function(){return a(this,function(e){switch(e.label){case 0:if(!t.offloaded)return[3,2];return[4,rd().reload(t)];case 1:e.sent(),e.label=2;case 2:return[2]}})})()},n.offloadData=function(){if(this.initialized&&rd().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.uploadCurrentVideoFrame=function(){var e=this;return i(function(){return a(this,function(i){return e.source.sourceType===t.TextureSourceType.video&&e.source.video&&e.initialized?(e.update({video:e.source.video}),[2,!0]):[2,!1]})})()},n.updateSource=function(t){this.source=this.assembleOptions(iW({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.restore=function(){},n.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){eG.error("This texture has been destroyed.")},this.initialize=eK,void 0!==this.engine&&this.engine.removeTexture(this)},r}(rs);function up(t){return(t&t-1)==0&&0!==t}var um=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return iU(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),ug(e,t),e},e.bindVertexArray=function(t){if(iU(this.gl))this.gl.bindVertexArray(t);else{var e;null==(e=this.vaoExt)||e.bindVertexArrayOES(t)}},e.dispose=function(){if(iU(this.gl))this.gl.deleteVertexArray(this.vao);else{var t;null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)}},t}(),uv=1,uy=function(){function e(e){this.engine=e,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var i={width:1,height:1,data:new Uint8Array([255])},r=e.getGLPipelineContext(),n=r.gl;this.gl=n,this.pipelineContext=r,this.emptyTexture2D=new ud(e,{data:i,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new ud(e,{target:n.TEXTURE_CUBE_MAP,cube:[i,i,i,i,i,i],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+uv,uv++}var i=e.prototype;return i.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},i.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},i.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&eb(this.renderbuffers,t),e},i.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach(function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)}))},i.drawGeometry=function(t,e,i){if(!this.gl){console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.");return}var r=e.shaderVariant.program;if(r){var n=r.setupAttributes(t),s=this.gl,a=t.indicesBuffer,o=t.drawStart,u=t.drawCount,h=t.mode,c=t.subMeshes;if(c&&c.length){var l,f=c[i];if(u<0)return;o=f.offset,u=a?null!=(l=f.indexCount)?l:0:f.vertexCount}a?s.drawElements(h,u,a.type,null!=o?o:0):s.drawArrays(h,o,u),null==n||n.unbind()}},i.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();return i&&(eb(this.framebuffers,t),ug(i,e,e)),i},i.createVAO=function(t){return new um(this.engine,t)},i.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),eT(this.textures,t),delete t.textureBuffer)},i.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},i.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),eT(this.framebuffers,t),delete t.fbo)},i.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),eT(this.renderbuffers,t),delete t.buffer)},i.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach(function(e){return t.deleteGLFramebuffer(e)}),this.framebuffers.length=0,this.renderbuffers.forEach(function(e){return t.deleteGLRenderbuffer(e)}),this.renderbuffers.length=0,this.textures.forEach(function(e){return t.deleteGLTexture(e)}),this.textures.length=0)},i.lost=function(t){eG.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},i.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},ii(e,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function ug(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var ux=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i,r,n=e.name,s=e.data,a=e.elementCount,o=e.target,u=void 0===o?ik.ARRAY_BUFFER:o,h=e.type,c=void 0===h?ik.FLOAT:h,l=e.usage,f=void 0===l?ik.STATIC_DRAW:l,d=null!=(r=null==(i=ub[c])?void 0:i.BYTES_PER_ELEMENT)?r:0;this.target=u,this.type=c,this.usage=f,this.glBuffer=this.createGLBuffer(n),this.bytesPerElement=d,s?this.bufferData(s):a&&this.bufferData(d*a)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return ug(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;i.bindBuffer(r,this.glBuffer),s>this.byteLength&&(this.byteLength=s,i.bufferData(r,s,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!iU(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},ii(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ub=((ef={})[ik.INT]=Int32Array,ef[ik.FLOAT]=Float32Array,ef[ik.SHORT]=Int16Array,ef[ik.BYTE]=Int8Array,ef[ik.UNSIGNED_BYTE]=Uint8Array,ef[ik.UNSIGNED_INT]=Uint32Array,ef[ik.UNSIGNED_SHORT]=Uint16Array,ef),uT=((ed={})[Uint8Array.BYTES_PER_ELEMENT]=ik.UNSIGNED_BYTE,ed[Uint16Array.BYTES_PER_ELEMENT]=ik.UNSIGNED_SHORT,ed[Uint32Array.BYTES_PER_ELEMENT]=ik.UNSIGNED_INT,ed),uE=1,u_=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}e9(e,t);var i=e.prototype;return i.getOptions=function(){return iW({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;ez(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach(function(e){t.buffers[e]=new ux(i,t.bufferProps[e])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(void 0!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,s=i.target;this.bufferProps[r]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(void 0!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(void 0!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&void 0!=r.data){var n=e+i.length;if(r.data.length<n){var s=new i.constructor(n);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,e)),void 0!==a.end&&(a.end=Math.max(a.end,n-1))}r.data.set(i,e),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(r(t,Uint8Array)||r(t,Uint16Array)||r(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t+e.length;if(this.indices.length<r){var n=new e.constructor(r);n.set(this.indices),this.indices=n,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;void 0!==s.start&&(s.start=Math.min(s.start,t)),void 0!==s.end&&(s.end=Math.max(s.end,r-1))}null==(i=this.indices)||i.set(e,t),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*rE[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=uT[e.BYTES_PER_ELEMENT];return new ux(t,{data:e,target:ik.ELEMENT_ARRAY_BUFFER,type:i,name:""+this.name+"##index"})},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach(function(n){var s,a,o=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,a=r;else{var u=e[n].dataSource;s=t.buffers[u],a=i[u].data}if((o.dirty||o.discard)&&s&&a){if(o.discard)s.bufferData(a);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=o.end-o.start+1,l=new a.constructor(a.buffer,h,c);s.bufferSubData(o.start,l)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(r){var n=t.attributesReleasable[r],s=e[r].dataSource;i[s]&&n&&(i[s].data=void 0)}),this.indicesReleasable}},i.processProps=function(t){var e=t.drawStart,i=t.drawCount,n=t.mode,s=t.indices,a=t.name,o=void 0===a?"effectsGeometry:"+uE++:a,u=t.bufferUsage,h=void 0===u?ik.STATIC_DRAW:u;this.name=o;var c={},l=[],f={},d={},p={};this.drawStart=void 0===e?0:e,void 0!==i&&(this.drawCount=i),this.mode=isNaN(n)?ik.TRIANGLES:n,Object.keys(t.attributes).forEach(function(e){var i=t.attributes[e],n=i.size,s=i.stride,a=i.offset,o=i.normalize,u=i.type,m=void 0===u?ik.FLOAT:u,v=i.releasable,y=i.data;if(!m||"dataSource"in i||y||(y=rA(m)),y){var g=r(y,Float32Array)?ik.FLOAT:ik.INT;c[e]={data:y,usage:h,target:ik.ARRAY_BUFFER,name:e},f[e]={size:n,stride:s,offset:a,type:null!=m?m:g,normalize:!!o,dataSource:e},p[e]=null!=v&&v,d[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(f[e]={size:n,stride:s,offset:a,type:m,dataSource:x,normalize:!!o})}l.push(e)}),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=(null==s?void 0:s.releasable)===!0,this.bufferProps=c,this.attributes=f,this.attributesName=l,this.attributesReleasable=p,this.dirtyFlags=d,this.options=t,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:ik.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(t){var e,a=null!=(e=uA[t.semantic])?e:t.semantic,o=r.createVertexTypedArray(t,i,n);s.attributes[a]={type:iG(t.format),size:t.dimension,data:o,normalize:t.normalize}}),e.indexFormat!==t6.None){var a=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:a},s.drawCount=a.length}else s.drawCount=n;this.processProps(s)}else{var o=e.vertexData.channels[0],u=e.vertexData.channels[1],h=e.vertexData.channels[2],c=this.createVertexTypedArray(o,i,n),l=this.createVertexTypedArray(u,i,n),f=this.createVertexTypedArray(h,i,n),d=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),p={mode:ik.TRIANGLES,attributes:{aPos:{type:iG(o.format),size:3,data:c,normalize:o.normalize},aUV:{type:iG(u.format),size:2,data:l,normalize:u.normalize},aNormal:{type:iG(h.format),size:3,data:f,normalize:h.normalize}}};p.indices={data:d},p.drawCount=d.length,this.processProps(p)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach(function(t){e.buffers[t].dispose()}),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach(function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0}),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case t5.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case t5.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case t6.UInt16:return new Uint16Array(r,e.byteOffset+i);case t6.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach(function(t){t.semantic&&t.semantic.length>0&&(e=!0)}),e},ii(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(r_),uA={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},uS=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.colorMask[0]!==e||this.colorMask[1]!==i||this.colorMask[2]!==r||this.colorMask[3]!==n)&&(this.colorMask[0]=e,this.colorMask[1]=i,this.colorMask[2]=r,this.colorMask[3]=n)},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[ik.ONE,ik.ONE_MINUS_SRC_ALPHA,ik.ONE,ik.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[ik.FUNC_ADD,ik.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=ik.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[ik.ALWAYS,ik.ALWAYS],this.stencilOpFail=[ik.KEEP,ik.KEEP],this.stencilOpZFail=[ik.KEEP,ik.KEEP],this.stencilOpZPass=[ik.KEEP,ik.KEEP],this.culling=!1,this.frontFace=ik.CCW,this.cullFace=ik.FRONT},e.apply=function(t){if(t.toggle(ik.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(ik.BLEND,this.blending),t.toggle(ik.DEPTH_TEST,this.depthTest),t.toggle(ik.STENCIL_TEST,this.stencilTest),t.toggle(ik.CULL_FACE,this.culling),t.toggle(ik.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(ik.BACK,this.stencilMask[1]),t.stencilMaskSeparate(ik.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(ik.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(ik.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(ik.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(ik.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),uC=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirty=!0,n.macrosDirty=!0,n.glMaterialState=new uS,r&&(n.shader=new t.Shader(i),n.shader.shaderData=iW({},r.shader,{id:eQ(),dataType:t3.Shader})),n}e9(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!eY(i.initialize)){eG.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var i=t.engine.getGLPipelineContext(),r=this.shaderVariant;if(!r.program){null==(n=this.engine)||n.renderErrors.add(Error("Shader program is not initialized."));return}if(r.program.bind(),this.setupStates(i),e){for(var n,s,a,o=iR(e.uniforms);!(a=o()).done;)s=a.value,this.checkUniform(s);for(var u,h=iR(e.samplers);!(u=h()).done;)s=u.value,this.samplers.includes(s)||(this.samplers.push(s),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(s in e.floats)r.setFloat(s,e.floats[s]);for(s in e.ints)r.setInt(s,e.ints[s]);for(s in e.vector4s)r.setVector4(s,e.vector4s[s]);for(s in e.vector3s)r.setVector3(s,e.vector3s[s]);for(s in e.matrices)r.setMatrix(s,e.matrices[s])}for(s in this.textures)this.textures[s].textureBuffer||this.textures[s].initialize();for(s in this.floats)r.setFloat(s,this.floats[s]);for(s in this.ints)r.setInt(s,this.ints[s]);for(s in this.floatArrays)r.setFloats(s,this.floatArrays[s]);for(s in this.textures)r.setTexture(s,this.textures[s]);for(s in this.vector2s)r.setVector2(s,this.vector2s[s]);for(s in this.vector3s)r.setVector3(s,this.vector3s[s]);for(s in this.vector4s)r.setVector4(s,this.vector4s[s]);for(s in this.colors)r.setColor(s,this.colors[s]);for(s in this.quaternions)r.setQuaternion(s,this.quaternions[s]);for(s in this.matrices)r.setMatrix(s,this.matrices[s]);for(s in this.matrice3s)r.setMatrix3(s,this.matrice3s[s]);for(s in this.vector4Arrays)r.setVector4Array(s,this.vector4Arrays[s]);for(s in this.matrixArrays)r.setMatrixArray(s,this.matrixArrays[s])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=iR(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=iR(e);!(i=r()).done;)for(var n=i.value,s=0;s<16;s++)this.matrixArrays[t].push(n.elements[s])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;ez(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new uS,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=iW({},t);void 0!==t.stringTags.RenderType&&(this.blending=t.stringTags.RenderType===tP.Transparent),void 0!==t.floats.ZTest&&(this.depthTest=0!==t.floats.ZTest),void 0!==t.floats.ZWrite&&(this.depthMask=0!==t.floats.ZWrite);var s=t.stringTags.RenderFace;for(i in s===tL.Front?(this.culling=!0,this.cullFace=ik.BACK):s===tL.Back?(this.culling=!0,this.cullFace=ik.FRONT):this.culling=!1,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var a=n.vector4s[i];this.setVector4(i,new iE(a.x,a.y,a.z,a.w))}for(i in n.colors){var o=n.colors[i];this.setColor(i,new rR(o.r,o.g,o.b,o.a))}for(i in n.textures){var u=n.textures[i];this.setTexture(i,u.texture);var h=u.offset,c=u.scale;h&&c&&this.setVector4(i+"_ST",new iE(c.x,c.y,h.x,h.y))}t.shader&&(this.shader=t.shader,this.shaderSource=this.shader.shaderData),this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.taggedProperties;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=t3.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var a=t.textures[s],o=this.getVector4(s+"_ST");o&&(a.scale={x:o.x,y:o.y},a.offset={x:o.z,y:o.w},delete t.vector4s[s+"_ST"])}return t},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new iE(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],s=0;s<t.matrixArrays[e].length;s+=16){for(var a=iC.fromIdentity(),o=0;o<16;o++)a.elements[o]=t.matrixArrays[e][s+o];n.push(a)}this.setMatrixArray(e,n)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(e){var i,r=this;this.destroyed||(null==(i=this.shaderVariant)||i.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach(function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()}),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=eK,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},ii(i,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ry),uw=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var i=e.prototype;return i.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},i.copyTexture=function(e,i){this.renderer&&(e.initialize(),i.initialize(),i.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:i.getWidth()||e.getWidth(),height:i.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,i):this.copy1(e,i))},i.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},i.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},i.createCopyRenderPass=function(){var e="mri-copy-mesh",i={texture:{format:ik.RGBA}},r=this.renderer.engine,n=new u_(r,{name:e,mode:ik.TRIANGLE_STRIP,attributes:{aPos:{type:ik.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r.gpuCapability.level,a=new uC(r,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===s?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var o=new rL(r,{name:e,geometry:n,material:a,priority:0});return new uR(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[i],meshes:[o]})},i.dispose=function(){if(this.renderer){var t;null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0}},e}(),uR=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(rN),uO=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],ez(t),this.gl=iV(t,e,i),this.contextLostListener=function(t){for(var e,i,n=iR(r.lostHandlers);!(i=n()).done;)i.value.lost(t);null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=iR(r.restoreHandlers);!(i=n()).done;)i.value.restore();null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),uM=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new r7(e),i}e9(e,t);var i=e.prototype;return i.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(uh),uI=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}e9(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(!this.initialized){eG.error("Can't set size for uninitialized render buffer.");return}if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):eG.error("Invalid render buffer size: "+t+"x"+e+".")}},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=eK},e}(r8),uP=1,uL=function(e){function i(i,r){(n=e.call(this)||this).attachmentTextures=[];var n,s,a=i.depthStencilAttachment,o=i.viewport,u=i.isCustomViewport,h=i.storeAction,c=i.viewportScale,l=i.name,f=void 0===l?"GLFramebuffer"+uP++:l;return n.renderer=r,n.engine=r.engine,n.depthStencilStorageType=null!=(s=null==a?void 0:a.storageType)?s:t.RenderPassAttachmentStorageType.none,n.viewport=o,n.isCustomViewport=!!u,n.viewportScale=void 0===c?1:c,n.name=f,n.storeAction=h,n.updateProps(i),n}e9(i,e);var n=i.prototype;return n.getDepthTexture=function(){return this.depthTexture},n.getStencilTexture=function(){return this.stencilTexture},n.getColorTextures=function(){return this.colorTextures},n.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach(function(e){e.initialize(),eb(t.attachmentTextures,e.textureBuffer)}),this.stencilTexture&&eb(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&eb(this.attachmentTextures,this.depthTexture.textureBuffer)},n.updateProps=function(e){var i,n,s=this.renderer,a=this.engine.gpuCapability,o=null!=(n=e.depthStencilAttachment)?n:{storageType:t.RenderPassAttachmentStorageType.none},u=e.attachments.length>0,h=!0;if(this.externalStorage=!1,e.attachments.length>1&&!a.detail.drawBuffers)throw Error("Multiple color attachments not support.");var c=null==(i=e.depthStencilAttachment)?void 0:i.texture,l=a.detail.readableDepthStencilTextures,f=o.storageType,d=o.storage;if(this.colorTextures=e.attachments.slice(),!u&&f!==t.RenderPassAttachmentStorageType.none)throw Error("Use depth stencil attachment without color attachments.");switch(u&&(this.fbo=s.glRenderer.createGLFramebuffer(this,this.name)),f){case t.RenderPassAttachmentStorageType.depth_stencil_opaque:if(d){if(r(d,uI))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth stencil attachment storage.")}else this.depthStencilRenderbuffer=new uI({format:ik.DEPTH_STENCIL,attachment:ik.DEPTH_STENCIL_ATTACHMENT,storageType:f},s.glRenderer);h=!1;break;case t.RenderPassAttachmentStorageType.depth_16_opaque:if(d){if(r(d,uI))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth attachment storage.")}else this.depthStencilRenderbuffer=new uI({attachment:ik.DEPTH_ATTACHMENT,format:ik.DEPTH_COMPONENT16,storageType:f},s.glRenderer);break;case t.RenderPassAttachmentStorageType.stencil_8_opaque:if(d){if(r(d,uI))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid stencil attachment storage.")}else this.depthStencilRenderbuffer=new uI({attachment:ik.STENCIL_ATTACHMENT,format:ik.STENCIL_INDEX8,storageType:f},s.glRenderer);break;case t.RenderPassAttachmentStorageType.depth_16_texture:if(!l)throw Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=c?c:new ud(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:ik.DEPTH_COMPONENT,internalFormat:a.internalFormatDepth16,type:ik.UNSIGNED_SHORT,name:""+this.name+"##depthTex"}),this.depthTexture.initialize();break;case t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!l)throw Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=c?c:new ud(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:ik.DEPTH_STENCIL,internalFormat:a.internalFormatDepth24_stencil8,type:a.UNSIGNED_INT_24_8,name:""+this.name+"##dpthStclTex"}),this.depthTexture.initialize(),h=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,h),this.updateAttachmentTextures()},n.getStoreAttachments=function(e,i){var r=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&iU(r)&&n>0){var s=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&eb(s,i?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&eb(s,i?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var a=0;a<n;a++)eb(s,r["COLOR_ATTACHMENT"+a]);return s}},n.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;iU(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},n.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],s=r[1],a=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,s,a,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach(function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())});for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var c=this.depthStencilRenderbuffer,l=this.depthTexture,f=this.stencilTexture;if(i.activeTexture(e.TEXTURE0),c)c.setSize(a,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,c.attachment,e.RENDERBUFFER,c.buffer);else if(l){l.source.data={width:a,height:o},l.update({data:{width:a,height:o,data:new Uint16Array(0)}});var d=l&&f?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,l.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var p=e.checkFramebufferStatus(e.FRAMEBUFFER);if(p!==e.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer failed, status: "+p+", error: "+e.getError()+".");this.ready=!0}}},n.resetColorTextures=function(t){var e=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,r=this.viewport,n=[];if(t){for(var s,a=iR(t);!(s=a()).done;)s.value.initialize();this.colorTextures=t.slice()}this.renderer.pipelineContext.activeTexture(e.TEXTURE0),this.colorTextures.forEach(function(t,s){var a={width:r[2],height:r[3],data:new Uint8Array(0)};t.update({data:a}),i.framebufferTexture2D(e,e.FRAMEBUFFER,s,e.TEXTURE_2D,t.textureBuffer),n.push(!0)}),i.drawBuffers(e,n),this.updateAttachmentTextures()},n.resize=function(t,e,i,r){var n=this.viewport,s=n[0],a=n[1],o=n[2],u=n[3];(s!==t||a!==e||o!==i||u!==r)&&(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},n.dispose=function(e){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;n!==t.RenderPassDestroyAttachmentType.force&&(n!==t.RenderPassDestroyAttachmentType.keepExternal||this.externalStorage)||(null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose()),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},ii(i,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),i}(ne),uF=function(t){for(var e=5381,i=t.length;i;)e=33*e^t.charCodeAt(--i);return e>>>0},uV=((ep={})[ik.FLOAT]=1,ep[ik.INT]=1,ep[ik.UNSIGNED_INT]=1,ep[ik.SHORT]=1,ep[ik.BOOL]=1,ep[ik.UNSIGNED_SHORT]=1,ep[ik.FLOAT_VEC2]=2,ep[ik.FLOAT_VEC3]=3,ep[ik.FLOAT_VEC4]=4,ep[ik.FLOAT_MAT2]=4,ep[ik.FLOAT_MAT3]=9,ep[ik.FLOAT_MAT4]=16,ep[ik.FLOAT_MAT2x3]=6,ep[ik.FLOAT_MAT2x4]=8,ep[ik.FLOAT_MAT4x3]=12,ep[ik.FLOAT_MAT4x2]=8,ep[ik.FLOAT_MAT3x4]=12,ep[ik.FLOAT_MAT3x2]=6,ep[ik.INT_VEC2]=2,ep[ik.INT_VEC3]=3,ep[ik.INT_VEC4]=4,ep[ik.UNSIGNED_INT_VEC2]=2,ep[ik.UNSIGNED_INT_VEC3]=3,ep[ik.UNSIGNED_INT_VEC4]=4,ep[ik.BOOL_VEC2]=2,ep[ik.BOOL_VEC3]=3,ep[ik.BOOL_VEC4]=4,ep),uN=uU(Float32Array),uD=uU(Int32Array),uk=uU(Uint8Array);function uz(t){return function(e,i,r,n){var s={start:i[1],dirty:!0};if(i[2]>1){if(e.length){for(var a=n[1]||e.length,o=i[4]/t.BYTES_PER_ELEMENT,u=s.buffer=new t(a*o),h=n[0]||0,c=0;c<a;c++)u[c*o]=e[c+h];s.start+=h*o}}else s.buffer=new t([e]);return s}}function uU(t){return function(e,i,r,n){for(var s=i[8],a=i[2],o=i[5],u=1===a?s:i[4],h=o?u/o:1,c=u/t.BYTES_PER_ELEMENT/h,l=s/t.BYTES_PER_ELEMENT/c,f=uV[i[0]],d=f/h,p=(n[0]||0)*f,m=n[1]?h*n[1]:l,v=new t(c*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=p;g<m;g++){for(var T=0;T<d;T++)v[x+T]=e[b+T];x+=c,b+=d}return y}}(em={})[ik.FLOAT]=uz(Float32Array),em[ik.INT]=uz(Int32Array),em[ik.UNSIGNED_INT]=uz(Uint32Array),em[ik.SHORT]=uz(Int16Array),em[ik.BOOL]=uz(Uint8Array),em[ik.UNSIGNED_SHORT]=uz(Uint16Array),em[ik.FLOAT_VEC2]=uN,em[ik.FLOAT_VEC3]=uN,em[ik.FLOAT_VEC4]=uN,em[ik.FLOAT_MAT2]=uN,em[ik.FLOAT_MAT3]=uN,em[ik.FLOAT_MAT4]=uN,em[ik.FLOAT_MAT2x3]=uN,em[ik.FLOAT_MAT2x4]=uN,em[ik.FLOAT_MAT4x3]=uN,em[ik.FLOAT_MAT4x2]=uN,em[ik.FLOAT_MAT3x4]=uN,em[ik.FLOAT_MAT3x2]=uN,em[ik.INT_VEC2]=uD,em[ik.INT_VEC3]=uD,em[ik.INT_VEC4]=uD,em[ik.UNSIGNED_INT_VEC2]=uD,em[ik.UNSIGNED_INT_VEC3]=uD,em[ik.UNSIGNED_INT_VEC4]=uD,em[ik.BOOL_VEC2]=uk,em[ik.BOOL_VEC3]=uk,em[ik.BOOL_VEC4]=uk;var uB=function(){function t(t,e,i){var r=this;this.engine=t,this.program=e,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),iU(n)&&(function(t,e){for(var i=[],r=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),s=0;s<n;++s)!function(n){var s=t.getActiveUniformBlockName(e,n);ez(s);var a={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,i[n]=a;for(var o=a.uniformIndices,u=[],h=0;h<o.length;h++){var c=t.getActiveUniform(e,o[h]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,h,0],u[h]=c,r.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach(function(i,r){t.getActiveUniforms(e,o,i).forEach(function(t,e){var i=u[e];a.uniforms[i][r]=+t})});for(var l=0;l<u.length;l++){var f=a.uniforms[u[l]],d=a.uniforms[u[l+1]],p=d?d[1]:a.size;f[8]=p-f[1]}a.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices;return Object.keys(r).map(function(t){return t+"["+r[t].join(":")+"]"}).join("+"),uF(""+e+"+",""+i+"+",""+n.length+"+")}(a)+""}(s);return{blockSpecs:i,blockUniformNames:r}})(n,e).blockSpecs.forEach(function(t){return r.uniformBlockMap[t.name]=t}),this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:(i=new um(this.engine,t.name+"-"+n),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach(function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");a.bind(),s.enableVertexAttribArray(i.loc),s.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}}),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=t.getActiveAttrib(e,n);if(s){var a=s.name,o=s.type,u=s.size,h=t.getAttribLocation(e,a);i[a]={type:o,name:a,size:u,loc:h}}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),uG=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}e9(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i,r=e.slice();t=t.concat(r);for(var n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++)null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--);for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},i.toData=function(){var t=this.taggedProperties;t.dataType=t3.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(iO),uX=0,uj=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=e.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=iR(Object.keys(this.cachedShaders));!(i=n()).done;){var s=i.value;this.cachedShaders[s].initialized||r.push(s)}t?r.length?Promise.all(r.map(function(t){return new Promise(function(i){return e.compileShader(e.cachedShaders[t],i)})})).then(t).catch(function(){return 0}):t([]):r.map(function(t){return e.compileShader(e.cachedShaders[t])}),this.shaderAllDone=!0}},i.addShader=function(e,i){var r=[];e.macros&&r.push.apply(r,[].concat(e.macros)),i&&r.push.apply(r,[].concat(i));var n=iW({},e,{vertex:rK.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:e.vertex,macros:r}),fragment:rK.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:e.fragment,macros:r})}),s=this.computeShaderCacheId(n);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var a=!1;return(n.shared||n.cacheId)&&(a=!0),this.cachedShaders[s]=new uG(this.engine,iW({},n,{vertex:n.vertex,fragment:n.fragment,name:n.name||s,shared:a})),this.cachedShaders[s].id=s,s},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(e,i){var r=this,n=e.source,s=n.shared,a=n.vertex,o=n.fragment,u=n.name,h=e.source.cacheId,c=!1;(s||h)&&(c=!0);var l=this.pipelineContext.gl,f={shared:c,status:t.ShaderCompileResultStatus.compiling},d=this.createProgram(l,a,o,f),p=this.glAsyncCompileExt,m=performance.now(),v=function(i){f.status=t.ShaderCompileResultStatus.success,f.compileTime=performance.now()-m,e.program=i,e.initialized=!0,e.pipelineContext=r.pipelineContext,void 0!==r.programMap[e.id]&&console.warn("Find duplicated shader id: "+e.id+"."),r.programMap[e.id]=i},y=function(){if(r.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(e.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&!0==l.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==t.ShaderCompileResultStatus.fail){ug(n,u);var s=new uB(r.engine,n,e.id);if(l.validateProgram(n),l.getProgramParameter(n,l.VALIDATE_STATUS))v(s);else{var h=l.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))?v(s):(f.status=t.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",a,"\nfragment:\n",o),l.deleteProgram(n))}}null==i||i(f)}else i&&requestAnimationFrame(y)};e.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=t.fragment,r=t.shared,n=t.cacheId;return r||n?n||"shared_"+function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var s=e[n],a=0;a<s.length;a++)r=Math.imul(31,r)+s.charCodeAt(a)|0;return r}(void 0===e?"":e,void 0===i?"":i):"instanced_"+uX++},i.createProgram=function(e,i,r,n){var s=e.createProgram(),a=this.createGLShader(e,e.VERTEX_SHADER,i),o=this.createGLShader(e,e.FRAGMENT_SHADER,r);return s&&a&&o?(e.attachShader(s,a),e.attachShader(s,o),e.linkProgram(s),n.program=s,n.status=t.ShaderCompileResultStatus.compiling,function(){if(n.program=void 0,!e.getProgramParameter(s,e.LINK_STATUS)){console.error("Failed to link program: "+e.getProgramInfoLog(s)+".");var u=uH(e,a,"vertex",i),h=uH(e,o,"fragment",r);n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),h&&(n.error=h.error,n.status=h.status)}return s}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=uF(null!=i?i:""),s=r.get(n);if(s)return s;var a=t.createShader(e);return a&&(t.shaderSource(a,i),t.compileShader(a),r.set(n,a)),a},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(e){t.programMap[e].dispose()}),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function uH(e,i,r,n){if(!e.getShaderParameter(i,e.COMPILE_STATUS)){var s=e.getShaderInfoLog(i);return console.error("compile "+r+" error: "+s,(null!=n?n:"").split("\n").map(function(t,e){return e+1+" "+t}).join("\n")),{error:s,status:t.ShaderCompileResultStatus.fail}}}var uY=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new uj(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=ik.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),(r.x!==e||r.y!==i)&&this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),(n.x!==e||n.y!==i||n.z!==r)&&this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),(s.x!==e||s.y!==i||s.z!==r||s.w!==n)&&this.gl[t](s.x=e,s.y=i,s.z=r,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),uW=function(e){function i(i,r,n){(s=e.call(this)||this).canvas=i,s.temporaryRTs={};var s,a=iW({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);s.context=new uO(i,r,a);var o=s.context.gl;return ez(o),s.engine=new uM(o),s.engine.renderer=iA(s),s.pipelineContext=new uY(s.engine,o),s.glRenderer=new uy(s.engine),s.extension=new uw(iA(s)),s.renderingData={currentFrame:{}},s.framebuffer=new uL({storeAction:{},viewport:[0,0,s.width,s.height],attachments:[new ud(s.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:s.width,height:s.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},iA(s)),s}e9(i,e);var r=i.prototype;return r.renderRenderFrame=function(t){t.resource&&t.resource.color_b.initialize(),t.emptyTexture.initialize(),t.transparentTexture.initialize();var e=t._renderPasses;if(this.isDestroyed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(r=t.renderer.getShaderLibrary())||r.compileAllShaders(),this.setFramebuffer(null),this.clear(t.clearAction);var i=t.camera;this.renderingData.currentFrame=t,this.renderingData.currentCamera=i,this.setGlobalMatrix("effects_MatrixInvV",i.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",i.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",i.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",i.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",i.position),eN(e);for(var r,n,s=iR(e);!(n=s()).done;){var a=n.value,o=a.delegate;null==o.willBeginRenderPass||o.willBeginRenderPass.call(o,a,this.renderingData),this.renderRenderPass(a),null==o.didEndRenderPass||o.didEndRenderPass.call(o,a,this.renderingData)}for(var u,h=iR(e);!(u=h()).done;)u.value.frameCleanup(this)},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=iR(t);!(e=r()).done;){var n=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,n,this.renderingData),n.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){console.error(t);return}this.glRenderer.drawGeometry(t,e,i)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(e,i,r,n,s,a){if(this.temporaryRTs[e])return this.temporaryRTs[e];var o,u,h=t.RenderPassAttachmentStorageType.none;s===t.FilterMode.Linear?o=ik.LINEAR:s===t.FilterMode.Nearest&&(o=ik.NEAREST),a===t.RenderTextureFormat.RGBA32?u=ik.UNSIGNED_BYTE:a===t.RenderTextureFormat.RGBAHalf&&(u=ik.HALF_FLOAT),0===n?h=t.RenderPassAttachmentStorageType.none:16===n?h=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(h=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var c=new uL({name:e,storeAction:{},viewport:[0,0,i,r],viewportScale:1,isCustomViewport:!0,attachments:[new ud(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:o,magFilter:o,internalFormat:ik.RGBA,format:ik.RGBA,type:u})],depthStencilAttachment:{storageType:h}},this);return this.temporaryRTs[e]=c,c},r.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},r.clear=function(e){var i=this.pipelineContext,r=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&i.clearColor(n[0],n[1],n[2],n[3]),i.colorMask(!0,!0,!0,!0),r=ik.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(i.stencilMask(255),i.clearStencil(e.clearStencil||0),r|=ik.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var s=e.clearDepth;i.depthMask(!0),i.clearDepth(Number.isFinite(s)?s:1),r|=ik.DEPTH_BUFFER_BIT}r&&i.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw Error("Can not restore automatically because losing gl context.");this.engine=new uM(t),this.engine.renderer=this,this.pipelineContext=new uY(this.engine,t),this.glRenderer=new uy(this.engine),this.extension=new uw(this)},r.resize=function(t,e){var i=this.glRenderer;i&&(this.width!==t||this.height!==e)&&i.resize(t,e)},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},ii(i,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),i}(ni),uZ={"Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Never use destroyed player again":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr","Current running player count":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ","Create player with different WebGL version":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg"},uq=new Map,uK=!1,uQ=1,uJ=function(e){function n(t){(n=e.call(this)||this).builtinObjects=[],n.compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach(function(e){return e.lost(t)}),n.renderer.lost(t),n.emit("webglcontextlost",t),u$(iA(n),!1)};var r,n,s=iA(n);n.restore=i(function(){var t;return a(this,function(e){switch(e.label){case 0:return s.renderer.restore(),[4,Promise.all(s.compositions.map(i(function(t){var e,i,r,n,o,u,h,c,l,f,d,p;return a(this,function(a){switch(a.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.keepResource,o=t.reusable,u=t.renderOrder,h=t.transform,c=t.videoState,[4,s.loadScene(i)];case 1:(l=a.sent()).speed=r,l.reusable=o,l.keepResource=n,l.renderOrder=u,l.transform.setPosition(h.position.x,h.position.y,h.position.z),l.transform.setRotation(h.rotation.x,h.rotation.y,h.rotation.z),l.transform.setScale(h.scale.x,h.scale.y,h.scale.z),f=0,a.label=2;case 2:if(!(f<c.length))return[3,5];if(!c[f])return[3,4];return(d=l.textures[f].source.video).currentTime=null!=(p=c[f])?p:0,[4,d.play()];case 3:a.sent(),a.label=4;case 4:return f++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}})})))];case 1:return s.compositions=e.sent(),s.emit("webglcontextrestored"),null==(t=s.ticker)||t.resume(),eO()&&s.canvas&&(s.canvas.style.display="none",window.setTimeout(function(){s.canvas.style.display=""},0)),[2]}})}),n.handleResume=function(){n.emit("update",{player:iA(n),playing:!0})},n.handleClick=function(t){var e=t.x,i=t.y;n.compositions.forEach(function(t){var r=t.hitTest(e,i);if(r.length)for(var s=0;s<r.length;s++){var a=r[s].behavior||tR.NOTIFY;a===tR.NOTIFY?(n.emit("click",iW({},r[s],{compositionId:t.id,compositionName:t.name,player:iA(n)})),t.emit("click",iW({},r[s],{compositionId:t.id,compositionName:t.name}))):a===tR.RESUME_PLAYER&&n.resume()}})};var o=t.container,u=t.canvas,h=t.fps,c=t.name,l=t.pixelRatio,f=t.manualRender,d=t.reportGPUTime,p=t.renderFramework,m=t.notifyTouch,v=t.interactive,y=t.renderOptions,g=void 0===y?{}:y,x=t.env,b=void 0===x?"":x,T=g.willCaptureImage,E=g.premultipliedAlpha;if(iD.length)throw Error("Errors before player create: "+iD.map(function(t,e){return"\n "+(e+1)+": "+t})+".");if(uK||"debug-disable"===p)return a6(n);var _=eM()||(r=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===r[1]||"16"===r[1]&&"5"===r[2])?"webgl":"webgl2";return p&&(_="webgl"===p?"webgl":"webgl2"),n.reportGPUTime=d,n.pixelRatio=Number.isFinite(l)?l:eR(),n.offscreenMode=!0,n.env=b,n.name=c||""+uQ++,u?n.canvas=u:(u0(o),n.canvas=document.createElement("canvas"),o.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=ni.create(n.canvas,_,{preserveDrawingBuffer:T,premultipliedAlpha:E}),n.renderer.env=b,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.builtinObjects.push(ru(n.renderer.engine)),uq.forEach(function(t){t.gpuCapability.type!==n.gpuCapability.type&&eG.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+uZ["Create player with different WebGL version"]+".")}),f||(n.ticker=new uc(h),n.ticker.add(n.tick.bind(iA(n)))),n.event=new so(n.canvas,!!m),n.event.bindListeners(),n.event.addEventListener(sr,n.handleClick),n.interactive=void 0!==v&&v,n.resize(),sp(n.gpuCapability.detail),uq.set(n.canvas,iA(n)),function(){for(var t,e=[],i=iR(uq.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&eG.error("Current running player count: "+e.length+", see "+uZ["Current running player count"]+".",e)}(),u$(iA(n),!0),n}e9(n,e);var s=n.prototype;return s.setSpeed=function(t){isNaN(t)||(this.speed=t)},s.getSpeed=function(){return this.speed},s.getCompositionByName=function(t){return this.compositions.find(function(e){return e.name===t})},s.getCompositions=function(){return this.compositions},s.getAssetManager=function(){return this.assetManagers},s.loadScene=function(t,e){var r=this;return i(function(){var n,s,o;return a(this,function(u){switch(u.label){case 0:if(o=r.baseCompositionIndex,!eH(t))return[3,2];return r.baseCompositionIndex+=t.length,[4,Promise.all(t.map(i(function(t,i){var n;return a(this,function(s){switch(s.label){case 0:return[4,r.createComposition(t,e)];case 1:return(n=s.sent()).setIndex(o+i),[2,n]}})})))];case 1:return s=u.sent(),[3,4];case 2:return r.baseCompositionIndex+=1,[4,r.createComposition(t,e)];case 3:(s=u.sent()).setIndex(o),u.label=4;case 4:return null==(n=r.ticker)||n.start(),[2,s]}})})()},s.createComposition=function(e,n){void 0===n&&(n={});var s=this;return i(function(){var i,o,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,A,S,C,w,R;return a(this,function(a){switch(a.label){case 0:return c=null==(o=(h=(u=s.renderer).engine).gpuCapability)?void 0:null==(i=o.detail)?void 0:i.asyncShaderCompile,l=performance.now(),f=iW({autoplay:!0},n),d=e,t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(d=e.url),t.Scene.isWithOptions(e)&&(f=iW({},f,e.options))),p=new oj(f),h.clearResources(),s.assetManagers.push(p),[4,p.loadScene(d,s.renderer,{env:s.env})];case 1:for(m=a.sent(),h.addPackageDatas(m),v=iR(s.builtinObjects);!(y=v()).done;)g=y.value,h.addInstance(g);if(s.updateTextVariables(m,f.variables),s.disposed)throw Error("Disposed player can not used to create Composition.");for(x=0;x<m.textureOptions.length;x++)r(b=m.textureOptions[x],rs)?h.addInstance(b):(b=h.assetLoader.loadGUID(m.textureOptions[x].id),m.textureOptions[x]=b),b.initialize();if(!h.database)return[3,3];return[4,h.createVFXItems(m)];case 2:a.sent(),a.label=3;case 3:if(T=new o$(iW({},f,{renderer:u,width:u.getWidth(),height:u.getHeight(),event:s.event,handleItemMessage:function(t){s.emit("message",t)}}),m),s.ticker&&(f.renderLevel===tT.B?s.ticker.setFPS(Math.min(s.ticker.getFPS(),30)):s.ticker.setFPS(60)),s.env!==nW)for(E=iR(Object.keys(s.renderer.engine.objectInstance));!(_=E()).done;)A=_.value,r(S=s.renderer.engine.objectInstance[A],ry)&&S.createShaderVariant();return C=performance.now(),[4,new Promise(function(t){var e;null==(e=s.renderer.getShaderLibrary())||e.compileAllShaders(function(){t(null)})})];case 4:return a.sent(),f.autoplay?(s.autoPlaying=!0,T.play()):T.pause(),w=performance.now()-C,R=performance.now()-l,T.statistic.compileTime=w,T.statistic.firstFrameTime=R,eG.info("Shader "+(c?"async":"sync")+" compile ["+T.name+"]: "+w.toFixed(4)+"ms."),eG.info("First frame ["+T.name+"]: "+R.toFixed(4)+"ms."),s.compositions.push(T),[2,T]}})})()},s.updateTextVariables=function(t,e){void 0===e&&(e={});var i=this.renderer.engine;t.jsonScene.items.forEach(function(t){if(t.type===tO.text||t.type===tO.richtext){var r=e[t.name];r&&t.components.forEach(function(t){var e=t.id,n=i.findEffectsObjectData(e);((null==n?void 0:n.dataType)===t3.TextComponent||(null==n?void 0:n.dataType)===t3.RichTextComponent)&&(n.options.text=r)})}})},s.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(t){t.play()}),null==(t=this.ticker)||t.start()},s.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(e){e.gotoAndPlay(t)}),this.ticker?this.ticker.start():this.doTick(0,!0)},s.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(e){e.gotoAndStop(t)}),(!this.ticker||(null==(e=this.ticker)?void 0:e.getPaused()))&&this.doTick(0,!0),this.emit("update",{player:this,playing:!1})},s.playSequence=function(t){for(var e,i=function(e){t[e].on("end",function(){t[e+1].play()})},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},s.pause=function(t){var e;!this.paused&&(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},s.resume=function(){var t=this;return i(function(){var e;return a(this,function(i){switch(i.label){case 0:if(t.resumePending)return[2];if(!t.paused)return[3,2];return t.resumePending=!0,[4,Promise.all(t.compositions.map(function(t){return t.reloadTexture()}))];case 1:i.sent(),t.resumePending=!1,t.handleResume(),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}})})()},s.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},s.doTick=function(e,i){var r,n,s=this,a=this.renderer.engine.renderErrors;a.size>0&&(this.emit("rendererror",a.values().next().value),null==(r=this.ticker)||r.pause()),e=Math.min(e,33)*this.speed;var o=this.compositions,u=!1;o.sort(function(t,e){return t.getIndex()-e.getIndex()});for(var h=[],c=0;c<o.length;c++){var l=o[c];if(l.textureOffloaded){u=!0,eG.error("Composition "+l.name+" texture offloaded, skip render."),h.push(l);continue}!l.isDestroyed&&l.renderer&&l.update(e),l.isDestroyed||h.push(l)}if(this.compositions=h,this.baseCompositionIndex=this.compositions.length,u)return this.emit("rendererror",Error("Play when texture offloaded.")),null==(n=this.ticker)?void 0:n.pause();if(!this.paused||i){var f=this.gpuCapability.level,d=this.renderer.context.gl,p=2===f&&this.reportGPUTime?iN(d):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<o.length||i){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var m=0;m<o.length;m++)o[m].renderFrame.isDestroyed||this.renderer.renderRenderFrame(o[m].renderFrame)}null==p||p.end(),null==p||p.getTime().then(function(t){return null==s.reportGPUTime?void 0:s.reportGPUTime.call(s,null!=t?t:0)}).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},s.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},s.resize=function(){var t=this.canvas.parentElement;if(t){var e=this.getTargetSize(t);r=e[0],n=e[1],s=e[2],a=e[3]}else r=s=this.canvas.width,n=a=this.canvas.height;var i=r/n;if(r&&n){var r,n,s,a,o,u=document.documentElement.clientWidth;s>2*u&&eG.error("DPI overflowed, width "+s+" is more than 2x document width "+u+", see "+uZ["DPI overflowed"]+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(s>h||a>h)&&(eG.error("Container size overflowed "+s+"x"+a+", see "+uZ["Container size overflowed"]+"."),i>1?(s=Math.round(h),a=Math.round(h/i)):(a=Math.round(h),s=Math.round(h*i))),this.renderer.resize(s,a),this.canvas.style.width=r+"px",this.canvas.style.height=n+"px",eG.info("Resize player "+this.name+" ["+s+","+a+","+r+","+n+"]."),null==(o=this.compositions)||o.forEach(function(t){t.camera.aspect=i})}},s.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},s.destroyCurrentCompositions=function(){this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.baseCompositionIndex=0},s.dispose=function(t){if(eG.info("Call player destroyed: "+this.name+"."),!this.disposed){uq.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach(function(t){return t.dispose()}),this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!t),this.destroyBuiltinObjects(),u$(this,!1),r(this.canvas,HTMLCanvasElement)&&!t&&this.renderer.context&&(a7.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var e,i="Never use destroyed player: "+this.name+" again, see "+uZ["Never use destroyed player again"]+".",n=function(){return function(t){throw Error(t)}(i)},s=function(){return Promise.reject(i)};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},s.offloadTexture=function(){this.compositions.forEach(function(t){return t.offloadTexture()})},s.getTargetSize=function(t){u0(t);var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),s=0,a=0;n?(s=parseInt(n.width,10),a=parseInt(n.height,10)):(s=t.clientWidth,a=t.clientHeight),r?s/a>r?e=(i=a*this.displayScale)*r:i=(e=s*this.displayScale)/r:(e=s,i=a);var o=this.pixelRatio,u=e,h=i;if(e=Math.round(e*o),(i=Math.round(i*o))<1||i<1){if(this.offscreenMode)e=i=u=h=1;else throw Error("Invalid container size "+e+"x"+i+", see "+uZ["Invalid container size"]+".")}return[u,h,e,i]},s.destroyBuiltinObjects=function(){for(var t,e=iR(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},ii(n,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),n}(sw);function u$(t,e){Object.keys(e0).forEach(function(i){var r=e0[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)})}function u0(t){if(null==t)throw Error("Container is not an HTMLElement, see "+uZ["Container is not an HTMLElement"]+".")}rs.create=function(t,e){return new ud(t,e)},rs.createWithData=function(e,i,r){void 0===i&&(i=eF("#fff")),void 0===r&&(r={});var n=r.type,s=void 0===n?ik.UNSIGNED_BYTE:n,a=r.format,o=void 0===a?ik.RGBA:a,u=r.internalFormat,h=r.wrapS,c=void 0===h?ik.MIRRORED_REPEAT:h,l=r.wrapT,f=void 0===l?ik.MIRRORED_REPEAT:l,d=r.minFilter,p=void 0===d?ik.NEAREST:d,m=r.magFilter,v=void 0===m?ik.NEAREST:m,y=r.flipY;return new ud(e,{data:i,type:s,sourceType:t.TextureSourceType.data,format:o,internalFormat:u||o,wrapS:c,wrapT:f,minFilter:p,magFilter:v,flipY:void 0!==y&&y})},ry.create=function(t,e){return new uC(t,e)},r_.create=function(t,e){return new u_(t,e)},rL.create=function(t,e){return new rL(t,e)},r8.create=function(t){return new uI(t)},ne.create=function(t,e){return new uL(t,e)},ni.create=function(t,e,i){return new uW(t,e,i)},uh.create=function(t){return new uM(t)};var u1="2.1.3-alpha.3";eG.info("Player version: "+u1+"."),t.AbstractPlugin=e6,t.ActivationPlayable=aG,t.AnimationClipPlayable=aX,t.Asset=on,t.AssetLoader=os,t.AssetManager=oj,t.BYTES_TYPE_MAP=rE,t.BaseRenderComponent=nJ,t.Behaviour=id,t.BezierCurve=nD,t.BezierCurvePath=nz,t.BezierCurveQuat=nU,t.COPY_FRAGMENT_SHADER=iL,t.COPY_MESH_SHADER_ID=iI,t.COPY_VERTEX_SHADER=iP,t.CalculateLoader=aV,t.Camera=oY,t.CameraVFXItemLoader=si,t.ColorCurve=nQ,t.Component=il,t.Composition=o$,t.CompositionComponent=aK,t.CompositionSourceManager=oZ,t.DEFAULT_FONTS=ot,t.DEFAULT_FPS=60,t.Database=oa,t.Downloader=iZ,t.EFFECTS_COPY_MESH_NAME=iM,t.EVENT_TYPE_CLICK=sr,t.EVENT_TYPE_TOUCH_END=sa,t.EVENT_TYPE_TOUCH_MOVE=ss,t.EVENT_TYPE_TOUCH_START=sn,t.EffectsObject=ic,t.EffectsPackage=uu,t.Engine=uh,t.EventEmitter=sw,t.EventSystem=so,t.Float16ArrayWrapper=nn,t.Framebuffer=ne,t.GLEngine=uM,t.GLGeometry=u_,t.GLRenderer=uW,t.GPUCapability=r7,t.Geometry=r_,t.GlobalUniforms=r6,t.GradientValue=nV,t.HELP_LINK=nZ,t.InteractLoader=sh,t.InteractMesh=sl,t.KTXTexture=rc,t.LineSegments=nN,t.LinearValue=nF,t.Material=ry,t.MaterialDataBlock=rp,t.Mesh=rL,t.MeshCollider=sd,t.PLAYER_OPTIONS_ENV_EDITOR=nW,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=aC,t.ParticleBehaviourPlayableAsset=aw,t.ParticleLoader=aF,t.ParticleMesh=aO,t.ParticleSystemRenderer=av,t.PassTextureCache=rb,t.PathSegments=nk,t.Player=uJ,t.PluginSystem=e4,t.PropertyTrack=a1,t.RENDER_PASS_NAME_PREFIX=r1,t.RENDER_PREFER_LOOKUP_TEXTURE=sP,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=nI,t.RandomValue=nP,t.RandomVectorValue=nL,t.RenderFrame=r3,t.RenderPass=rN,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=rF,t.Renderbuffer=r8,t.Renderer=ni,t.RendererComponent=ip,t.RuntimeClip=aH,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=6,t.SemanticMap=rT,t.SerializationHelper=aq,t.ShaderFactory=rK,t.ShaderVariant=iO,t.SpriteLoader=sx,t.StaticValue=nM,t.TEMPLATE_USE_OFFSCREEN_CANVAS=sL,t.TextComponentBase=oi,t.TextLayout=a8,t.TextLoader=or,t.TextStyle=a9,t.Texture=rs,t.TextureFactory=rf,t.Ticker=uc,t.TimelineClip=aj,t.TimelinePlayable=a3,t.TrackSortWrapper=a4,t.Transform=sC,t.TransformAnimationPlayable=aB,t.ValueGetter=nO,t.Vector4Curve=nY,t.addByOrder=eD,t.addItem=eb,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(r)for(;t[n-1][i]<s[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>s[i]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},t.applyMixins=e$,t.assertExist=ez,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=eJ,t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.calculateTranslation=no,t.canvasPool=a7,t.colorGradingFrag=rj,t.colorStopsFromGradient=eS,t.colorToArr=e_,t.combineImageTemplate=oB,t.createCopyShader=iF,t.createGLContext=iV,t.createKeyFrameMeta=nj,t.createShape=sq,t.createValueGetter=nK,t.decimalEqual=nm,t.defaultPlugins=e1,t.deserializeMipmapTexture=rt,t.disableAllPlayer=function(t){uK=!!t},t.earcut=ai,t.effectsClass=io,t.effectsClassStore=ia,t.enlargeBuffer=eE,t.ensureFixedNumber=ou,t.ensureVec3=nu,t.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=rH,t.gaussianDownVFrag=rY,t.gaussianUpFrag=rW,t.generateEmptyTypedArray=rA,t.generateGUID=eQ,t.generateHalfFloatTexture=ra,t.generateTransparentTexture=rh,t.generateWhiteTexture=ru,t.getActivePlayers=function(){return Array.from(uq.values())},t.getBackgroundImage=oU,t.getColorFromGradientStops=eA,t.getConfig=function(t){return sF[t]},t.getDefaultTextureFactory=rd,t.getGeometryByShape=an,t.getGeometryTriangles=ar,t.getImageItemRenderInfo=n$,t.getKTXTextureOptions=rl,t.getKeyFrameMetaByRawValue=nX,t.getMergedStore=iu,t.getParticleMeshShader=aP,t.getPixelRatio=eR,t.getPlayerByCanvas=function(t){return uq.get(t)},t.getPreMultiAlpha=iX,t.getStandardComposition=oV,t.getStandardImage=oF,t.getStandardItem=oD,t.getStandardJSON=oP,t.getTextureSize=r4,t.glContext=ik,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return t5.Float32;case WebGLRenderingContext.SHORT:return t5.Int16;case WebGLRenderingContext.BYTE:return t5.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return t5.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return t5.UInt8;default:return t5.Float32}},t.gpuTimer=iN,t.imageDataFromColor=eF,t.imageDataFromGradient=eV,t.initErrors=iD,t.initGLContext=iz,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=eC,t.isAlipayMiniApp=eP,t.isAndroid=eM,t.isArray=eH,t.isCanvas=eZ,t.isCanvasUsedByPlayer=function(t){return uq.has(t)},t.isFunction=eY,t.isIOS=eO,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return eP()||eL()},t.isObject=eW,t.isSimulatorCellPhone=eI,t.isString=ej,t.isUniformStruct=rm,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&rm(t[0])},t.isValidFontFamily=eU,t.isWebGL2=iU,t.isWechatMiniApp=eL,t.itemFrag=rz,t.itemFrameFrag=rD,t.itemVert=rk,t.loadAVIFOptional=i$,t.loadBinary=i3,t.loadBlob=function(t){return i5.apply(this,arguments)},t.loadImage=i1,t.loadMedia=i9,t.loadVideo=i6,t.loadWebPOptional=iQ,t.logger=eG,t.math=rI,t.modifyMaxKeyframeShader=aL,t.nearestPowerOfTwo=nf,t.noop=eX,t.normalizeColor=op,t.numberToFix=nv,t.parsePercent=ew,t.particleFrag=rU,t.particleOriginTranslateMap=nl,t.particleUniformTypeMap=aR,t.particleVert=rB,t.passRenderLevel=oz,t.pluginLoaderMap=e0,t.randomInRange=eq,t.registerPlugin=e3,t.removeItem=eT,t.rotateVec2=as,t.screenMeshVert=rX,t.serialize=function(t,e){return ih(t,e)},t.setBlendMode=ij,t.setConfig=function(t,e){return sF[t]=e},t.setDefaultTextureFactory=function(t){t9=t},t.setMaskMode=iY,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=nd,t.setSideMode=iH,t.setSpriteMeshMaxItemCountByGPU=sp,t.sortByOrder=eN,t.spec=it,t.spriteMeshShaderFromFilter=sm,t.spriteMeshShaderFromRenderInfo=sy,t.spriteMeshShaderIdFromRenderInfo=sv,t.thresholdFrag=rZ,t.throwDestroyedError=eK,t.trailVert=rG,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=np,t.unregisterPlugin=function(t){delete e2[t],delete e0[t],eT(e1,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=nh,t.vecMulCombine=nc,t.version=u1,t.vertexFormatType2GLType=iG,Object.defineProperty(t,"__esModule",{value:!0})});
8
8
  //# sourceMappingURL=index.min.js.map