@galacean/effects-threejs 2.1.0-alpha.7 → 2.1.0-alpha.9

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 threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.0-alpha.7
7
- */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,c,h,l,f,d,p,m,v,y,g,x,b,T,E,_,S,C,A,w,O,R,I,M,L,P,V,F,D,N,z,k,U,B,G,j,X,H,W,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,tc,th,tl,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tS,tC,tA,tw,tO,tR,tI,tM,tL,tP,tV,tF,tD,tN,tz,tk,tU,tB,tG,tj,tX,tH,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function en(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function ea(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){en(a,r,n,o,s,"next",t)}function s(t){en(a,r,n,o,s,"throw",t)}o(void 0)})}}function eo(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):eo(t,e)}function es(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function eu(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function ec(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var eh=new Uint8Array(16),el=[],ef=0;ef<256;++ef)el.push((ef+256).toString(16).slice(1));var ed={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ep(t,e){return t.includes(e)||t.push(e),t}function em(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ev(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 a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}function ey(t,e){var i=[0,0,0,0];if(eF(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}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]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eo(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 eg(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.stop<=e&&e<=o.stop){r=eb(a.color,o.color,(e-a.stop)/(o.stop-a.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 ex(t){var e=[];if(eo(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({stop:eT(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=ey(t[i]);e.push({stop:eT(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 eb(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function eT(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eE(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function e_(){return eE()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eS(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eC(){return"miniprogram"===window.__wxjs_environment}function eA(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=ex(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var a=n/128,o=void 0,s=void 0,u=0;u<r.length&&(o=r[u],s=r[u+1],!(o.stop<=a)||!(s.stop>a));u++);var c=eb(o.color,s.color,(a-o.stop)/(s.stop-o.stop));i.set(c,4*n)}i.set(r[r.length-1].color,508)}return e}function ew(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 a,o,s=e[r],u=r,c=n;u<c;){if(2===i){for(;e[c].priority>s.priority&&c>=u;)c--;for(;e[u].priority<=s.priority&&u<c;)u++}else{for(;e[c].priority<s.priority&&c>=u;)c--;for(;e[u].priority>=s.priority&&u<c;)u++}a=[e[c],e[u]],e[u]=a[0],e[c]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,c+1,n),e}(t,e);for(var r=1;r<i;r++)eR(t,r,e);return t}function eO(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&eR(t,t.length-1,i)),t}function eR(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 eI(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eM(t){return/^[^\d.][\w-]*$/.test(t)}function eL(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var eP={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(eL(t),[r])),null==td||td("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(eL(t))),null==td||td("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(eL(t))),null==td||td("warn",t,r)},register:function(t){t&&eN(t)&&(td=t)}};function eV(){}function eF(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var eD=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eN(t){return"[object Function]"===Object.prototype.toString.call(t)}function ez(t){return"[object Object]"===Object.prototype.toString.call(t)}function ek(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eU(t,e){return t+Math.random()*(e-t)}function eB(){throw Error("Destroyed item cannot be used again.")}function eG(){return(function(t,e,i){if(ed.randomUUID&&!t)return ed.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tf&&!(tf="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 tf(eh)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),el[n[r+0]]+el[n[r+1]]+el[n[r+2]]+el[n[r+3]]+"-"+el[n[r+4]]+el[n[r+5]]+"-"+el[n[r+6]]+el[n[r+7]]+"-"+el[n[r+8]]+el[n[r+9]]+"-"+el[n[r+10]]+el[n[r+11]]+el[n[r+12]]+el[n[r+13]]+el[n[r+14]]+el[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=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var c=new Uint8Array(s);n.push(c)}return new File([new Blob(n,{type:i})],e,{type:i})}function eX(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 eH={},eW=[],eY={};function eZ(t,e,i,r){eY[t]&&eP.error("Duplicate registration for plugin "+t+"."),eY[t]=i,eH[t]=e,r&&ep(eW,t)}var eq=function(){function t(t){var e={},i=[],r=function(t){var r=eH[t];i.includes(r)||(i.push(r),e[t]=r)};eW.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=eH[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=eQ[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 i=this;return ea(function(){return ec(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var i=this;return ea(function(){return ec(this,function(r){return[2,i.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e,i){var r=this;return ea(function(){return ec(this,function(n){return[2,r.callStatic("precompile",t,e,i)]})})()},e.loadResources=function(t,e){var i=this;return ea(function(){return ec(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return ea(function(){var e,r,a,o,s,u;return ec(this,function(c){for(a=0,e=[],r=n.plugins;a<r.length;a++)t in(o=eH[r[a].name])&&e.push(Promise.resolve(null==(u=o[t])?void 0:(s=u).call.apply(s,[].concat([o],i))));return[2,Promise.all(e)]})})()},t}(),eQ={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"},eK=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 eJ(t,e){return(eJ=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function e$(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&&eJ(t,e)}(n=tp||(tp={})).S="S",n.APlus="A+",n.A="A",n.BPlus="B+",n.B="B",(a=tm||(tm={}))[a.ALPHA=0]="ALPHA",a[a.ADD=1]="ADD",a[a.MULTIPLY=2]="MULTIPLY",a[a.BRIGHTNESS=3]="BRIGHTNESS",a[a.SUBTRACTION=4]="SUBTRACTION",a[a.STRONG_LIGHT=5]="STRONG_LIGHT",a[a.WEAK_LIGHT=6]="WEAK_LIGHT",a[a.SUPERPOSITION=7]="SUPERPOSITION",(o=tv||(tv={}))[o.DOUBLE=1032]="DOUBLE",o[o.FRONT=1028]="FRONT",o[o.BACK=1029]="BACK",(s=ty||(ty={}))[s.NONE=0]="NONE",s[s.MASK=1]="MASK",s[s.OBSCURED=2]="OBSCURED",s[s.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(u=tg||(tg={}))[u.NONE=0]="NONE",u[u.SPHERE=1]="SPHERE",u[u.CONE=2]="CONE",u[u.HEMISPHERE=3]="HEMISPHERE",u[u.CIRCLE=4]="CIRCLE",u[u.DONUT=5]="DONUT",u[u.RECTANGLE=6]="RECTANGLE",u[u.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",u[u.EDGE=8]="EDGE",u[u.TEXTURE=9]="TEXTURE",(c=tx||(tx={}))[c.GYROSCOPE=0]="GYROSCOPE",c[c.SPINE=1]="SPINE",(h=tb||(tb={}))[h.CLICK=0]="CLICK",h[h.MESSAGE=1]="MESSAGE",h[h.DRAG=2]="DRAG",(l=tT||(tT={}))[l.NONE=0]="NONE",l[l.NOTIFY=1]="NOTIFY",l[l.RESUME_PLAYER=2]="RESUME_PLAYER",l[l.REMOVE=3]="REMOVE",l[l.PAUSE=4]="PAUSE",(f=tE||(tE={})).base="0",f.sprite="1",f.particle="2",f.null="3",f.interact="4",f.plugin="5",f.camera="6",f.composition="7",f.spine="spine",f.mesh="mesh",f.tree="tree",f.text="text",f.light="light",f.skybox="skybox",f.effect="effect",f.node="node",f.video="video",f.audio="audio",(d=t_||(t_={}))[d.BILLBOARD=0]="BILLBOARD",d[d.MESH=1]="MESH",d[d.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",d[d.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(p=tS||(tS={}))[p.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",p[p.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",p[p.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",p[p.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",p[p.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",p[p.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",p[p.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",p[p.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",p[p.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(m=tC||(tC={})).Opaque="Opaque",m.Transparent="Transparent",(v=tA||(tA={})).Both="Both",v.Back="Back",v.Front="Front",(y=tw||(tw={}))[y.portrait=1]="portrait",y[y.landscape=0]="landscape",(g=tO||(tO={}))[g.CONSTANT=0]="CONSTANT",g[g.CONSTANT_VEC2=1]="CONSTANT_VEC2",g[g.CONSTANT_VEC3=2]="CONSTANT_VEC3",g[g.CONSTANT_VEC4=3]="CONSTANT_VEC4",g[g.RANDOM=4]="RANDOM",g[g.LINE=5]="LINE",g[g.CURVE=6]="CURVE",g[g.BEZIER_PATH=7]="BEZIER_PATH",g[g.RGBA_COLOR=8]="RGBA_COLOR",g[g.GRADIENT_COLOR=9]="GRADIENT_COLOR",g[g.SHAPE_POINTS=10]="SHAPE_POINTS",g[g.SHAPE_SPLITS=11]="SHAPE_SPLITS",g[g.LINEAR_PATH=12]="LINEAR_PATH",g[g.COLORS=13]="COLORS",g[g.BINARY=20]="BINARY",g[g.BEZIER_CURVE=21]="BEZIER_CURVE",g[g.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",g[g.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",(x=tR||(tR={}))[x.AUTO=0]="AUTO",x[x.EASE=1]="EASE",x[x.EASE_IN=2]="EASE_IN",x[x.EASE_OUT=3]="EASE_OUT",x[x.LINE=4]="LINE",x[x.HOLD=5]="HOLD",x[x.LINE_OUT=6]="LINE_OUT",(b=tI||(tI={}))[b.destroy=0]="destroy",b[b.restart=5]="restart",b[b.forward=2]="forward",b[b.freeze=4]="freeze",(T=tM||(tM={}))[T.destroyChildren=6]="destroyChildren",(E=tL||(tL={}))[E.none=0]="none",E[E.removeParticle=1]="removeParticle",(_=tP||(tP={}))[_.RANDOM=0]="RANDOM",_[_.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",_[_.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",_[_.UNIFORM_BURST=3]="UNIFORM_BURST",(S=tV||(tV={})).point="point",S.spot="spot",S.directional="directional",S.ambient="ambient",(C=tF||(tF={}))[C.box=2]="box",C[C.sphere=3]="sphere",(A=tD||(tD={})).orthographic="orthographic",A.perspective="perspective",(w=tN||(tN={})).unlit="unlit",w.pbr="pbr",w.hair="hair",(O=tz||(tz={}))[O.opaque=100]="opaque",O[O.masked=101]="masked",O[O.translucent=102]="translucent",O[O.additive=103]="additive",(R=tk||(tk={})).none="none",R.uv="uv",R.normal="normal",R.basecolor="basecolor",R.alpha="alpha",R.metallic="metallic",R.roughness="roughness",R.ao="ao",R.emissive="emissive",R.diffuse="diffuse",(I=tU||(tU={}))[I.display=0]="display",I[I.clip=1]="clip",I[I.ellipsis=2]="ellipsis",(M=tB||(tB={}))[M.top=0]="top",M[M.middle=1]="middle",M[M.bottom=2]="bottom",(L=tG||(tG={}))[L.left=0]="left",L[L.middle=1]="middle",L[L.right=2]="right",(P=tj||(tj={})).normal="normal",P.bold="bold",P.lighter="lighter",(V=tX||(tX={})).normal="normal",V.italic="italic",V.oblique="oblique",(F=tH||(tH={})).VFXItemData="VFXItemData",F.EffectComponent="EffectComponent",F.Material="Material",F.Shader="Shader",F.SpriteComponent="SpriteComponent",F.ParticleSystem="ParticleSystem",F.InteractComponent="InteractComponent",F.CameraController="CameraController",F.Geometry="Geometry",F.Texture="Texture",F.AnimationClip="AnimationClip",F.TextComponent="TextComponent",F.BinaryAsset="BinaryAsset",F.TrackAsset="TrackAsset",F.TimelineAsset="TimelineAsset",F.ObjectBindingTrack="ObjectBindingTrack",F.TransformTrack="TransformTrack",F.SpriteColorTrack="SpriteColorTrack",F.ActivationTrack="ActivationTrack",F.SubCompositionTrack="SubCompositionTrack",F.TransformPlayableAsset="TransformPlayableAsset",F.SpriteColorPlayableAsset="SpriteColorPlayableAsset",F.ActivationPlayableAsset="ActivationPlayableAsset",F.SubCompositionPlayableAsset="SubCompositionPlayableAsset",F.MeshComponent="MeshComponent",F.SkyboxComponent="SkyboxComponent",F.LightComponent="LightComponent",F.CameraComponent="CameraComponent",F.ModelPluginComponent="ModelPluginComponent",F.TreeComponent="TreeComponent",F.AnimationComponent="AnimationComponent",F.SpineComponent="SpineComponent",F.VideoComponent="VideoComponent",F.AudioComponent="AudioComponent",F.TimelineClip="TimelineClip",(D=tW||(tW={}))[D.POINTS=0]="POINTS",D[D.LINES=1]="LINES",D[D.LINE_LOOP=2]="LINE_LOOP",D[D.LINE_STRIP=3]="LINE_STRIP",D[D.TRIANGLES=4]="TRIANGLES",D[D.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",D[D.TRIANGLE_FAN=6]="TRIANGLE_FAN",(N=tY||(tY={}))[N.Float16=0]="Float16",N[N.Float32=1]="Float32",N[N.Int8=2]="Int8",N[N.Int16=3]="Int16",N[N.Int32=4]="Int32",N[N.UInt8=5]="UInt8",N[N.UInt16=6]="UInt16",N[N.UInt32=7]="UInt32",(z=tZ||(tZ={}))[z.None=-1]="None",z[z.UInt8=0]="UInt8",z[z.UInt16=1]="UInt16",z[z.UInt32=2]="UInt32",(k=tq||(tq={})).Position="POSITION",k.Uv="TEXCOORD0",k.Uv2="TEXCOORD1",k.Normal="NORMAL",k.Tangent="TANGENT",k.Color="COLOR",k.Joints="JOINTS",k.Weights="WEIGHTS",k.PositionBS0="POSITION_BS0",k.PositionBS1="POSITION_BS1",k.PositionBS2="POSITION_BS2",k.PositionBS3="POSITION_BS3",k.PositionBS4="POSITION_BS4",k.PositionBS5="POSITION_BS5",k.PositionBS6="POSITION_BS6",k.PositionBS7="POSITION_BS7",k.NormalBS0="NORMAL_BS0",k.NormalBS1="NORMAL_BS1",k.NormalBS2="NORMAL_BS2",k.NormalBS3="NORMAL_BS3",k.TangentBS0="TANGENT_BS0",k.TangentBS1="TANGENT_BS1",k.TangentBS2="TANGENT_BS2",k.TangentBS3="TANGENT_BS3";var e0={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(U=tQ||(tQ={})).video="video",U.image="image",(B=tK||(tK={})).video="video",B.audio="audio";var e1=Object.freeze({__proto__:null,get RenderLevel(){return tp},get BlendingMode(){return tm},get SideMode(){return tv},get MaskMode(){return ty},get ShapeType(){return tg},get PluginType(){return tx},get InteractType(){return tb},get InteractBehavior(){return tT},get ItemType(){return tE},get RenderMode(){return t_},get ParticleOrigin(){return tS},get RenderType(){return tC},get RenderFace(){return tA},get CameraClipMode(){return tw},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 tO},get BezierKeyframeType(){return tR},get EndBehavior(){return tI},get ParentItemEndBehavior(){return tM},get ParticleInteractionBehavior(){return tL},get ShapeArcMode(){return tP},get LightType(){return tV},get ModelBoundingType(){return tF},get CameraType(){return tD},get MaterialType(){return tN},get MaterialBlending(){return tz},get RenderMode3D(){return tk},get TextOverflow(){return tU},get TextBaseline(){return tB},get TextAlignment(){return tG},get TextWeight(){return tj},get FontStyle(){return tX},get DataType(){return tH},get GeometryType(){return tW},get VertexFormatType(){return tY},get IndexFormatType(){return tZ},get VertexBufferSemantic(){return tq},BuiltinObjectGUID:e0,get BackgroundType(){return tQ},get MultimediaType(){return tK}});function e2(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 e3(t,e,i){return e&&e2(t.prototype,e),i&&e2(t,i),t}var e4=new Map,e5=new Map,e6={};function e8(t){return function(e,i){e6[t]&&console.warn("Class "+t+" is already registered."),e6[t]=e}}function e9(t){var e=t.constructor;if(e5.get(e))return e5.get(e);var i={};e5.set(e,i);for(var r=t,n=e;n;){var a=e4.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function e7(t,e){return function(i,r){var n,a=(n=i.constructor,e4.get(n)||e4.set(n,{}),e4.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var it=function(){function t(t){this.engine=t,this.guid=eG(),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 eo(e,t)&&"guid"in e},t}(),ie=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}e$(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.getVisible()&&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&&em(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},e3(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&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}(it);eu([e7(void 0,void 0)],ie.prototype,"_enabled",void 0);var ii=function(t){function e(){return t.apply(this,arguments)}e$(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}(ie),ir=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}e$(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.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&em(this.item.rendererComponents,this),t.prototype.dispose.call(this)},e3(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}(ie);function ia(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 io(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 ia(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 ia(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.")}eu([e7(void 0,void 0)],ir.prototype,"materials",void 0),eu([e7(void 0,void 0)],ir.prototype,"_priority",void 0);var is=Math.PI/180,iu=180/Math.PI;function ic(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ih=function(t,e,i){return(1-i)*t+i*e};function il(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 id=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):eo(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):eo(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):eo(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):eo(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}();id.ONE=new id(1,1),id.ZERO=new id(0,0);var ip=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):eo(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):eo(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):eo(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):eo(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,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,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 id(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}();ip.X=new ip(1,0,0),ip.Y=new ip(0,1,0),ip.Z=new ip(0,0,1),ip.ONE=new ip(1,1,1),ip.ZERO=new ip(0,0,0);var im=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),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.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],a=e[1],o=e[5],s=e[9],u=e[2],c=e[6],h=e[10],l=i+o+h;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>h){var d=2*Math.sqrt(1+i-o-h);this.w=(c-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>h){var p=2*Math.sqrt(1+o-i-h);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+c)/p,this.negate()}else{var m=2*Math.sqrt(1+h-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+c)/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(il(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,a=t.w,o=e.x,s=e.y,u=e.z,c=e.w;return this.x=i*c+a*o+r*u-n*s,this.y=r*c+a*s+n*o-i*u,this.z=n*c+a*u+i*s-r*o,this.w=a*c-i*o-r*s-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,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+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 c=Math.sqrt(s),h=Math.atan2(c,o),l=Math.sin((1-e)*h)/c,f=Math.sin(e*h)/c;return this.w=a*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,a=this.w,o=t.x,s=t.y,u=t.z,c=a*o+r*u-n*s,h=a*s+n*o-i*u,l=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=c*a+-(f*i)+-(h*n)- -(l*r),d.y=h*a+-(f*r)+-(l*i)- -(c*n),d.z=l*a+-(f*n)+-(c*r)- -(h*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(ip.ZERO,this,ip.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}();im.tempVec0=new ip;var iv=function(){function t(t,e,i,r,n,a,o,s,u,c,h,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===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===h&&(h=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,c,h,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,c,h,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]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=c,v[10]=h,v[11]=l,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,c,h,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]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=c,v[10]=h,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),a=Math.sin(i),o=1-n,s=r.x,u=r.y,c=r.z,h=o*s,l=o*u;return this.set(h*s+n,h*u+a*c,h*c-a*u,0,h*u-a*c,l*u+n,l*c+a*s,0,h*c+a*u,l*c-a*s,o*c*c+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(ip.ZERO,t,ip.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,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[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,a=i[0],o=i[4],s=i[8],u=i[12],c=i[1],h=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],S=r[12],C=r[1],A=r[5],w=r[9],O=r[13],R=r[2],I=r[6],M=r[10],L=r[14],P=r[3],V=r[7],F=r[11],D=r[15];return n[0]=a*T+o*C+s*R+u*P,n[4]=a*E+o*A+s*I+u*V,n[8]=a*_+o*w+s*M+u*F,n[12]=a*S+o*O+s*L+u*D,n[1]=c*T+h*C+l*R+f*P,n[5]=c*E+h*A+l*I+f*V,n[9]=c*_+h*w+l*M+f*F,n[13]=c*S+h*O+l*L+f*D,n[2]=d*T+p*C+m*R+v*P,n[6]=d*E+p*A+m*I+v*V,n[10]=d*_+p*w+m*M+v*F,n[14]=d*S+p*O+m*L+v*D,n[3]=y*T+g*C+x*R+b*P,n[7]=y*E+g*A+x*I+b*V,n[11]=y*_+g*w+x*M+b*F,n[15]=y*S+g*O+x*L+b*D,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],a=t[1],o=t[5],s=t[9],u=t[13],c=t[2],h=t[6],l=t[10],f=t[14];return t[3]*(+n*s*h-r*u*h-n*o*l+i*u*l+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*a*l-r*a*f+r*u*c-n*s*c)+t[11]*(+e*u*h-e*o*f-n*a*h+i*a*f+n*o*c-i*u*c)+t[15]*(-r*o*c-e*s*h+e*o*l+r*a*h-i*a*l+i*s*c)},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],a=t[4],o=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=h*m*u-p*l*u+p*s*f-o*m*f-h*s*v+o*l*v,g=d*l*u-c*m*u-d*s*f+a*m*f+c*s*v-a*l*v,x=c*p*u-d*h*u+d*o*f-a*p*f-c*o*v+a*h*v,b=d*h*s-c*p*s-d*o*l+a*p*l+c*o*m-a*h*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-h*m*n-p*r*f+i*m*f+h*r*v-i*l*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(h*s*n-o*l*n-h*r*u+i*l*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(c*m*n-d*l*n+d*r*f-e*m*f-c*r*v+e*l*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*l*n-c*s*n+c*r*u-e*l*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*h*n-c*p*n-d*i*f+e*p*f+c*i*v-e*h*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(c*o*n-a*h*n-c*i*u+e*h*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(c*p*r-d*h*r+d*i*l-e*p*l-c*i*m+e*h*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*h*r-c*o*r+c*i*s-e*h*s-a*i*l+e*o*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=ip.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,c=-r.x,h=-r.y,l=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,E=u*d,_=u*p,S=i.x,C=i.y,A=i.z;return n[0]=(1-(g+b))*S,n[1]=(v+_)*S,n[2]=(y-E)*S,n[3]=0,n[4]=(v-_)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=c*n[0]+h*n[4]+l*n[8]-c+t.x,n[13]=c*n[1]+h*n[5]+l*n[9]-h+t.y,n[14]=c*n[2]+h*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];var c=t.tempMat0;c.copyFrom(this);var h=1/o,l=1/s,f=1/u;return c.elements[0]*=h,c.elements[1]*=h,c.elements[2]*=h,c.elements[4]*=l,c.elements[5]*=l,c.elements[6]*=l,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,i.setFromRotationMatrix(c),r.x=o,r.y=s,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 ip,e=new im,i=new ip;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),c=-(e+t)*o,h=-(i+r)*s,l=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=c,f[13]=h,f[14]=l,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!ic(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,a){return new t().perspective(e,i,r,n,a)},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,a,o,s,u,c,h,l,f,d,p,m,v){return new t(e,a,c,d,i,o,h,p,r,s,l,m,n,u,f,v)},t}();iv.IDENTITY=new iv(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),iv.ZERO=new iv(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),iv.tempVec0=new ip,iv.tempVec1=new ip,iv.tempVec2=new ip,iv.tempMat0=new iv;var iy=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,a;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!=(a=t[e+3])?a: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):eo(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):eo(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):eo(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):eo(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 ip(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}();function ig(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}iy.ONE=new iy(1,1,1,1),iy.ZERO=new iy(0,0,0,0),t.EffectComponent=function(e){function i(t){var i;return(i=e.call(this,t)||this).worldMatrix=iv.fromIdentity(),i.triangles=[],i.destroyed=!1,i.getHitTestParams=function(t){var e=i.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},i.name="EffectComponent",i._priority=0,i}e$(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){var e,i=this.item.time,r=null!=(e=this.material.getVector4("_Time"))?e:new iy;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i))},r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e,i,r=null!=(e=t.getIndexData())?e:[],n=null!=(i=t.getAttributeData("aPos"))?i:[],a=[],o=0;o<r.length;o+=3){var s=3*r[o],u=3*r[o+1],c=3*r[o+2],h={x:n[s],y:n[s+1],z:n[s+2]},l={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[c],y:n[c+1],z:n[c+2]};a.push({p0:h,p1:l,p2:f})}return a}(this.geometry),this.hitTestGeometry=this.geometry);for(var i,r=[],n=io(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}return r.forEach(function(t){t.p0=e.transformPoint(t.p0,new ip),t.p1=e.transformPoint(t.p1,new ip),t.p2=e.transformPoint(t.p2,new ip)}),{type:t.HitTestType.triangle,area:r}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},r.toData=function(){this.taggedProperties.id=this.guid},r.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},i}(ir),eu([e7(void 0,void 0)],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=eu([e8(tH.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.useHDR=!0,e.useBloom=!0,e.threshold=1,e.bloomIntensity=1,e.brightness=1,e.saturation=1,e.contrast=1,e.vignetteIntensity=.2,e.vignetteSmoothness=.4,e.vignetteRoundness=1,e.useToneMapping=!0,e}return e$(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.globalVolume=this,t.createRenderFrame())},e}(ii),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"useHDR",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"useBloom",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"threshold",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"bloomIntensity",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"brightness",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"saturation",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"contrast",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteIntensity",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteSmoothness",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteRoundness",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"useToneMapping",void 0),t.PostProcessVolume=eu([e8("PostProcessVolume")],t.PostProcessVolume),t.ShaderCompileResultStatus=void 0,(G=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[G.noShader=0]="noShader",G[G.success=1]="success",G[G.fail=2]="fail",G[G.compiling=3]="compiling",t.GLSLVersion=void 0,(j=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",j.GLSL3="300 es";var ix=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return e$(e,t),e}(it);t.Shader=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=io(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(it),t.Shader=eu([e8(tH.Shader)],t.Shader);var ib="effects-internal-copy",iT="effects-internal-copy-mesh",iE="\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}",i_="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 iS(e,i){return{name:ib,vertex:iE,fragment:i_,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:iT+ +i}}var iC=[],iA={};function iw(){"function"==typeof WebGL2RenderingContext?iO(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iO(WebGLRenderingContext),iO(WebGLRenderingContext.prototype)):iC.push("iOS16 lockdown mode, WebGL Constants not in global"),iC.length||"HALF_FLOAT"in iA||(iA.HALF_FLOAT=5131)}function iO(t){for(var e in t)/^[A-Z_]/.test(e)&&(iA[e]=t[e])}function iR(t){switch(t){case tm.ALPHA:case tm.ADD:case tm.SUBTRACTION:case tm.STRONG_LIGHT:case tm.WEAK_LIGHT:return 1;case tm.SUPERPOSITION:return 2;case tm.BRIGHTNESS:return 3;case tm.MULTIPLY:return 0;default:return 1}}function iI(t,e){switch(e){case void 0:case tm.ALPHA:t.blendFunction=[iA.ONE,iA.ONE_MINUS_SRC_ALPHA,iA.ONE,iA.ONE_MINUS_SRC_ALPHA];break;case tm.ADD:t.blendFunction=[iA.ONE,iA.ONE,iA.ONE,iA.ONE];break;case tm.SUBTRACTION:t.blendFunction=[iA.ONE,iA.ONE,iA.ZERO,iA.ONE],t.blendEquation=[iA.FUNC_REVERSE_SUBTRACT,iA.FUNC_REVERSE_SUBTRACT];break;case tm.SUPERPOSITION:t.blendFunction=[iA.ONE,iA.ONE,iA.ONE,iA.ONE];break;case tm.MULTIPLY:t.blendFunction=[iA.DST_COLOR,iA.ONE_MINUS_SRC_ALPHA,iA.DST_COLOR,iA.ONE_MINUS_SRC_ALPHA];break;case tm.BRIGHTNESS:t.blendFunction=[iA.ONE,iA.ONE_MINUS_SRC_ALPHA,iA.ONE,iA.ONE_MINUS_SRC_ALPHA];break;case tm.STRONG_LIGHT:t.blendFunction=[iA.DST_COLOR,iA.DST_ALPHA,iA.ZERO,iA.ONE];break;case tm.WEAK_LIGHT:t.blendFunction=[iA.DST_COLOR,iA.ZERO,iA.ZERO,iA.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iM(t,e){e===tv.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iA.CW,t.cullFace=e===tv.BACK?iA.BACK:iA.FRONT)}function iL(t,e){switch(e){case void 0:t.stencilTest=!1;break;case ty.MASK:t.stencilTest=!0,t.stencilFunc=[iA.ALWAYS,iA.ALWAYS],t.stencilOpZPass=[iA.REPLACE,iA.REPLACE];break;case ty.OBSCURED:t.stencilTest=!0,t.stencilFunc=[iA.EQUAL,iA.EQUAL];break;case ty.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[iA.NOTEQUAL,iA.NOTEQUAL];break;case ty.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iP(){return(iP=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)}iC.length||iw(),t.ShaderType=void 0,(X=t.ShaderType||(t.ShaderType={}))[X.vertex=0]="vertex",X[X.fragment=1]="fragment",t.TextureLoadAction=void 0,(H=t.TextureLoadAction||(t.TextureLoadAction={}))[H.whatever=0]="whatever",H[H.clear=2]="clear",t.TextureSourceType=void 0,(W=t.TextureSourceType||(t.TextureSourceType={}))[W.none=0]="none",W[W.data=1]="data",W[W.image=2]="image",W[W.compressed=3]="compressed",W[W.video=4]="video",W[W.canvas=5]="canvas",W[W.framebuffer=6]="framebuffer",W[W.mipmaps=7]="mipmaps";var iV=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 a=new XMLHttpRequest,o=function(){n.finish(t,a.status,a.response)};a.responseType=e,a.addEventListener("load",function(){200==a.status||0==a.status?n.finish(t,200,a.response):o()}),a.addEventListener("error",o),a.open("GET",t,!0),a.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],a=n.length-1,o=r.length;a<o;a+=2)r[a].apply(null,n)},t}(),iF=!1,iD=!1;function iN(t,e){return iz.apply(this,arguments)}function iz(){return(iz=ea(function(t,e){return ec(this,function(i){switch(i.label){case 0:if(!(iF||!e))return[3,2];return[4,iB(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iB(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iF=!0,[4,iB(t)];case 6:return[2]}})})).apply(this,arguments)}function ik(t,e){return iU.apply(this,arguments)}function iU(){return(iU=ea(function(t,e){return ec(this,function(i){switch(i.label){case 0:if(!(iD||!e))return[3,2];return[4,iB(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iB(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iD=!0,[4,iB(t)];case 6:return[2]}})})).apply(this,arguments)}function iB(t){return iG.apply(this,arguments)}function iG(){return(iG=ea(function(t){var e,i;return ec(this,function(r){if(e="",eo(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else eo(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 ij(t){return iX.apply(this,arguments)}function iX(){return(iX=ea(function(t){return ec(this,function(e){return[2,new Promise(function(e,i){new iV().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iH(){return(iH=ea(function(t){return ec(this,function(e){return[2,new Promise(function(e,i){new iV().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iW(t){return iY.apply(this,arguments)}function iY(){return(iY=ea(function(t){var e;return ec(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eE()&&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 iZ(t,e){return iq.apply(this,arguments)}function iq(){return(iq=ea(function(t,e){return ec(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 iQ(t,e,i){return iK.apply(this,arguments)}function iK(){return(iK=ea(function(e,i,r,n){var a,o,s,u,c,h,l;return ec(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:iJ(t,i)}))}))];case 1:return s=f.sent(),[2,iP({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,c=e.target,[4,Promise.all(u.map(function(t){return iJ(t,i)}))];case 3:return h=f.sent(),l=n[u[0][1][0]].url,[2,iP({keepImageSource:!1},e,{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:l,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function iJ(t,e){return i$.apply(this,arguments)}function i$(){return(i$=ea(function(t,e){var i,r,n,a,o;return ec(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,iB(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var i0=1,i1=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+i0++,i}e$(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?iA.TEXTURE_2D:i,n=e.format,a=void 0===n?iA.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),iP({minFilter:iA.NEAREST,magFilter:iA.NEAREST,wrapS:iA.CLAMP_TO_EDGE,wrapT:iA.CLAMP_TO_EDGE,target:r,format:iA.RGBA,internalFormat:a,type:iA.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return ea(function(){var a,o;return ec(this,function(s){switch(s.label){case 0:return[4,iB(e)];case 1:return a=s.sent(),(o=i.create(r,iP({sourceType:t.TextureSourceType.image,image:a,target:iA.TEXTURE_2D,id:eG(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return ea(function(){var a,o;return ec(this,function(s){switch(s.label){case 0:return[4,iW(e)];case 1:return a=s.sent(),(o=i.create(r,iP({sourceType:t.TextureSourceType.video,video:a,id:eG(),flipY:!0},n))).initialize(),[2,o]}})})()},e3(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(it);function i2(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?iA.RGBA:3===o?iA.RGB:2===o?iA.LUMINANCE_ALPHA:iA.LUMINANCE,i1.createWithData(t,{data:e,width:i,height:r},{type:iA.HALF_FLOAT,format:n,internalFormat:a,wrapS:iA.CLAMP_TO_EDGE,wrapT:iA.CLAMP_TO_EDGE})}var i3={type:iA.UNSIGNED_BYTE,format:iA.RGBA,internalFormat:iA.RGBA,wrapS:iA.MIRRORED_REPEAT,wrapT:iA.MIRRORED_REPEAT,minFilter:iA.NEAREST,magFilter:iA.NEAREST};function i4(e){return i1.create(e,iP({id:e0.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i3))}function i5(e){return i1.create(e,iP({id:e0.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i3))}var i6=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,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===a.getUint32(0,!0);if(this.glType=a.getUint32(1*n,o),this.glTypeSize=a.getUint32(2*n,o),this.glFormat=a.getUint32(3*n,o),this.glInternalFormat=a.getUint32(4*n,o),this.glBaseInternalFormat=a.getUint32(5*n,o),this.pixelWidth=a.getUint32(6*n,o),this.pixelHeight=a.getUint32(7*n,o),this.pixelDepth=a.getUint32(8*n,o),this.numberOfArrayElements=a.getUint32(9*n,o),this.numberOfFaces=a.getUint32(10*n,o),this.numberOfMipmapLevels=a.getUint32(11*n,o),this.bytesOfKeyValueData=a.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eP.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eP.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eP.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,a=t?this.numberOfMipmapLevels:1,o=0;o<a;o++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:c,width:r,height:n}),i+=s+4+(3-(s+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function i8(e){var i=new i6(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,a=i.pixelHeight,o=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,c=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:o,target:6===s?iA.TEXTURE_CUBE_MAP:iA.TEXTURE_2D,internalFormat:u,format:c,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var i9=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return ea(function(){var i,r;return ec(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]}})})()},i.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,a=e.url;return r===iA.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eF(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,c=e.maps,h=e.urls;return o?s.length>0:u===iA.TEXTURE_CUBE_MAP?c.every(function(t){return"object"==typeof t&&t}):h.every(function(t){return eF(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return ea(function(){var n,a,o,s,u,c,h,l,f,d,p,m,v,y,g,x,b,T;return ec(this,function(E){switch(E.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,c=e.mipmaps,h=e.urls,l=e.maps,!(a===iA.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=E.sent(),[2,iP({},i,{cube:f,target:iA.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iP({},o),target:iA.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,iB(s)];case 3:return d=E.sent(),[2,iP({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iA.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,iW(s)];case 5:return p=E.sent(),[2,iP({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,ij(s)];case 7:return m=E.sent(),[2,iP({},i8(m),i,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,ij(u)];case 9:if(v=E.sent(),g=(y=null!=a?a:iA.TEXTURE_2D)===iA.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),a!==iA.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(c,v),E.label=12;case 12:return[2,iP({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===iA.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(h.map(function(t){return iB(t)}))];case 14:return b=E.sent(),[2,iP({},i,{mipmaps:b,target:iA.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:h.slice(),target:iA.TEXTURE_2D}})];case 15:if(a!==iA.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return T=E.sent(),[2,iP({},i,{mipmaps:T,target:iA.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iP({},t)}),target:iA.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return ea(function(){return ec(this,function(i){return[2,Promise.all(t.map(function(t){return iB(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return ea(function(){return ec(this,function(e){return[2,Promise.all(t.map(function(t){return iB(t)}))]})})()},e}(),i7=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 rt(t){return"object"==typeof t&&t&&void 0===t.length&&eo(t,i1)}t.MaterialRenderType=void 0,(Y=t.MaterialRenderType||(t.MaterialRenderType={}))[Y.normal=0]="normal",Y[Y.transformFeedback=1]="transformFeedback";var re=1,ri=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,i){var n=i.name,a=void 0===n?"Material"+re++:n,o=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=a,r.renderType=void 0===o?0:o,r.shaderSource=s,r.props=i,r.uniformSemantics=iP({},u)}else r.name="Material"+re++,r.renderType=0;return r}e$(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},e3(e,[{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}(it),rr={format:iA.RGBA,type:iA.UNSIGNED_BYTE,minFilter:iA.LINEAR,magFilter:iA.LINEAR,wrapS:iA.CLAMP_TO_EDGE,wrapT:iA.CLAMP_TO_EDGE},rn=Symbol("dispose"),ra=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,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(rr).forEach(function(t){var i,r=null!=(i=e[t])?i:rr[t];o[t]=r,s.push(t,r)});var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var h=this.engine;eI(h),c=i1.create(h,o),this.textureCache[u]=c,this.textureRef[u]=1,c[rn]=c.dispose,c.dispose=function(){return i.removeTexture(u)}}return c},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[rn](),i.dispose=i[rn]),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[rn](),i.dispose=i[rn]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),ro=function(){function t(t){void 0===t&&(t={}),this.semantics=iP({},t)}var e=t.prototype;return e.toObject=function(){return iP({},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 eN(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}(),rs=((t$={})[iA.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t$[iA.INT]=Int32Array.BYTES_PER_ELEMENT,t$[iA.SHORT]=Int16Array.BYTES_PER_ELEMENT,t$[iA.BYTE]=Int8Array.BYTES_PER_ELEMENT,t$),ru=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(it);function rc(t){return t===iA.INT?new Int32Array(0):t===iA.SHORT?new Int16Array(0):new Float32Array(0)}(Z=t0||(t0={}))[Z.XYZ=0]="XYZ",Z[Z.XZY=1]="XZY",Z[Z.YXZ=2]="YXZ",Z[Z.YZX=3]="YZX",Z[Z.ZXY=4]="ZXY",Z[Z.ZYX=5]="ZYX";var rh=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],a=i[8],o=i[1],s=i[5],u=i[9],c=i[2],h=i[6],l=i[10];switch(e){case t0.XYZ:this.y=Math.asin(il(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(h,s),this.z=0);break;case t0.YXZ:this.x=Math.asin(-il(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,l),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-c,r),this.z=0);break;case t0.ZXY:this.x=Math.asin(il(h,-1,1)),.9999999>Math.abs(h)?(this.y=Math.atan2(-c,l),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case t0.ZYX:this.y=Math.asin(-il(c,-1,1)),.9999999>Math.abs(c)?(this.x=Math.atan2(h,l),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case t0.YZX:this.z=Math.asin(il(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,r)):(this.x=0,this.y=Math.atan2(a,l));break;case t0.XZY:this.z=Math.asin(-il(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(h,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=iu,this.y*=iu,this.z*=iu,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,a,o;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!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o: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 im;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,a=Math.cos(e*is*.5),o=Math.cos(i*is*.5),s=Math.cos(r*is*.5),u=Math.sin(e*is*.5),c=Math.sin(i*is*.5),h=Math.sin(r*is*.5);switch(n){case t0.XYZ:t.set(u*o*s+a*c*h,a*c*s-u*o*h,a*o*h+u*c*s,a*o*s-u*c*h);break;case t0.YXZ:t.set(u*o*s+a*c*h,a*c*s-u*o*h,a*o*h-u*c*s,a*o*s+u*c*h);break;case t0.ZXY:t.set(u*o*s-a*c*h,a*c*s+u*o*h,a*o*h+u*c*s,a*o*s-u*c*h);break;case t0.ZYX:t.set(u*o*s-a*c*h,a*c*s+u*o*h,a*o*h-u*c*s,a*o*s+u*c*h);break;case t0.YZX:t.set(u*o*s+a*c*h,a*c*s+u*o*h,a*o*h-u*c*s,a*o*s-u*c*h);break;case t0.XZY:t.set(u*o*s-a*c*h,a*c*s-u*o*h,a*o*h+u*c*s,a*o*s+u*c*h);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,a=this.order,o=Math.cos(i*is),s=Math.sin(i*is),u=Math.cos(r*is),c=Math.sin(r*is),h=Math.cos(n*is),l=Math.sin(n*is);if(a===t0.XYZ){var f=o*h,d=o*l,p=s*h,m=s*l;e[0]=u*h,e[4]=-u*l,e[8]=c,e[1]=d+p*c,e[5]=f-m*c,e[9]=-s*u,e[2]=m-f*c,e[6]=p+d*c,e[10]=o*u}else if(a===t0.YXZ){var v=u*h,y=u*l,g=c*h,x=c*l;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*c,e[1]=o*l,e[5]=o*h,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===t0.ZXY){var b=u*h,T=u*l,E=c*h,_=c*l;e[0]=b-_*s,e[4]=-o*l,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*h,e[9]=_-b*s,e[2]=-o*c,e[6]=s,e[10]=o*u}else if(a===t0.ZYX){var S=o*h,C=o*l,A=s*h,w=s*l;e[0]=u*h,e[4]=A*c-C,e[8]=S*c+w,e[1]=u*l,e[5]=w*c+S,e[9]=C*c-A,e[2]=-c,e[6]=s*u,e[10]=o*u}else if(a===t0.YZX){var O=o*u,R=o*c,I=s*u,M=s*c;e[0]=u*h,e[4]=M-O*l,e[8]=I*l+R,e[1]=l,e[5]=o*h,e[9]=-s*h,e[2]=-c*h,e[6]=R*l+I,e[10]=O-M*l}else if(a===t0.XZY){var L=o*u,P=o*c,V=s*u,F=s*c;e[0]=u*h,e[4]=-l,e[8]=c*h,e[1]=L*l+F,e[5]=o*h,e[9]=P*l-V,e[2]=V*l-P,e[6]=s*h,e[10]=F*l+L}else console.error("toMatrix4: Invalid order "+a);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}();rh.DEFAULT_ORDER=t0.ZYX,rh.tempQuat0=new im,rh.tempMat0=new iv;var rl=function(){function t(t,e,i,r,n,a,o,s,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===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var c=this.elements;return c[0]=t,c[3]=r,c[6]=o,c[1]=e,c[4]=n,c[7]=s,c[2]=i,c[5]=a,c[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=i,c[1]=r,c[4]=n,c[7]=a,c[2]=o,c[5]=s,c[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,a=e+e,o=i+i,s=r+r,u=e*a,c=e*o,h=e*s,l=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(l+d),y[1]=c+v,y[2]=h-m,y[3]=c-v,y[4]=1-(u+d),y[5]=f+p,y[6]=h+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],a=r[3],o=r[6],s=r[1],u=r[4],c=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*c,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*c,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,a=i[0],o=i[3],s=i[6],u=i[1],c=i[4],h=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]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+c*y+h*b,n[4]=u*m+c*g+h*T,n[7]=u*v+c*x+h*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],a=t[4],o=t[7],s=t[2],u=t[5],c=t[8];return e*(a*c-u*o)+n*(u*r-i*c)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],c=t[8],h=c*a-u*o,l=u*r-c*i,f=o*i-a*r,d=e*h+n*l+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=h*p,t[1]=(s*o-c*n)*p,t[2]=(u*n-s*a)*p,t[3]=l*p,t[4]=(c*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*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,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},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(!ic(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,a,o,s,u,c){return new t(e,n,s,i,a,u,r,o,c)},t}(),rf=function(){function t(t,e){void 0===t&&(t=ip.ZERO),void 0===e&&(e=ip.X),this.origin=new ip,this.direction=new ip,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 ip;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,a,o,s,u=this.origin,c=u.x,h=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,S=1/d,C=1/p,A=1/m;if(S>=0?(i=(y-c)*S,r=(T-c)*S):(i=(T-c)*S,r=(y-c)*S),C>=0?(n=(g-h)*C,a=(E-h)*C):(n=(E-h)*C,a=(g-h)*C),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(o=(x-l)*A,s=(_-l)*A):(o=(_-l)*A,s=(x-l)*A),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(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 ip).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),c=a-u,h=a+u;if(!(h<0))return c>=0?this.at(c,i):this.at(h,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),c=t.tempVec1.subtractVectors(s,a),h=t.tempVec2.subtractVectors(this.origin,a),l=t.tempVec3.crossVectors(u,c),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(h,c);var d=n*this.direction.dot(c);if(!(d<0)){u.cross(h);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*h.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();rf.tempVec0=new ip,rf.tempVec1=new ip,rf.tempVec2=new ip,rf.tempVec3=new ip;var rd=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,a;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!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,c=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,c=o):a>=3&&a<=4?(u=o,c=n):a>=4&&a<=5?(s=o,c=n):a>=5&&a<=6&&(s=n,c=o);var h=i-n;return this.set(s+h,u+h,c+h,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):eo(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):eo(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):eo(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):eo(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 iy(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,c=0;return 0!==a&&(c=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,c,a,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)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+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}();rd.BLACK=new rd(0,0,0,1),rd.BLUE=new rd(0,0,1,1),rd.CLEAR=new rd(0,0,0,0),rd.CYAN=new rd(0,1,1,1),rd.GRAY=new rd(.5,.5,.5,1),rd.GREEN=new rd(0,1,0,1),rd.MAGENTA=new rd(1,0,1,1),rd.RED=new rd(1,0,0,1),rd.WHITE=new rd(1,1,1,1),rd.YELLOW=new rd(1,.92,.016,1);var rp=function(){function t(t,e){void 0===t&&(t=new ip(1/0,1/0,1/0)),void 0===e&&(e=new ip(-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,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],h=t[s+1],l=t[s+2];c<e&&(e=c),h<i&&(i=h),l<r&&(r=l),c>n&&(n=c),h>a&&(a=h),l>o&&(o=l)}return this.min.set(e,i,r),this.max.set(n,a,o),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 ip),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 ip),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,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);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 ip),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 ip;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 ip),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 ip),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 ip),this.isEmpty())return[];var i=[];return i[0]=new ip(this.min.x,this.min.y,this.min.z),i[1]=new ip(this.min.x,this.min.y,this.max.z),i[2]=new ip(this.min.x,this.max.y,this.min.z),i[3]=new ip(this.min.x,this.max.y,this.max.z),i[4]=new ip(this.max.x,this.min.y,this.min.z),i[5]=new ip(this.max.x,this.min.y,this.max.z),i[6]=new ip(this.max.x,this.max.y,this.min.z),i[7]=new ip(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 ip;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=ip.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 a=new rp().setFromPoints(t);a.getCenter(i),this.radius=a.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 ip),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 rp),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 ip().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 ip,i=new ip;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 ip().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}(),rv=Object.freeze({__proto__:null,get EulerOrder(){return t0},Euler:rh,Quaternion:im,Vector2:id,Vector3:ip,Vector4:iy,Matrix3:rl,Matrix4:iv,Ray:rf,PI2:2*Math.PI,DEG2RAD:is,RAD2DEG:iu,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:ic,damp:function(t,e,i,r){return ih(t,e,1-Math.exp(-i*r))},lerp:ih,degToRad:function(t){return t*is},radToDeg:function(t){return t*iu},clamp:il,Color:rd,Box3:rp,Sphere:rm}),ry=1,rg=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,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,c=void 0===u?iv.fromIdentity():u;r.id="Mesh"+ry++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=c}else r.id="Mesh"+ry++,r.name="<unnamed>",r.worldMatrix=iv.fromIdentity(),r._priority=0;return r}e$(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)}},e3(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ir);t.RenderPassAttachmentStorageType=void 0,(q=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[q.none=0]="none",q[q.color=1]="color",q[q.stencil_8_opaque=2]="stencil_8_opaque",q[q.depth_16_opaque=3]="depth_16_opaque",q[q.depth_stencil_opaque=4]="depth_stencil_opaque",q[q.depth_16_texture=5]="depth_16_texture",q[q.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(Q=t.TextureStoreAction||(t.TextureStoreAction={}))[Q.store=0]="store",Q[Q.clear=2]="clear";var rx=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(eo(r,i1))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,c=r.internalFormat,h=r.format,l=void 0===h?iA.RGBA:h,f=r.type,d=void 0===f?iA.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:c||l,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=i1.create(e,iP({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},e3(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,(K=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[K.force=0]="force",K[K.keep=1]="keep",K[K.keepExternal=2]="keepExternal",K[K.destroy=0]="destroy";var rb=1,rT=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+rb++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,c=i.priority,h=i.meshOrder,l=void 0===h?t.OrderType.ascending:h,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===c?0:c,this.meshOrder=l,this.meshes=ew((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iP({},a),this.storeAction=iP({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new ro(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){eO(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){em(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),ew(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],a=e[3];t.setViewport(i,r,n,a)}},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 rx(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 a=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],s=[o[2],o[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var c=n.attachments.map(function(t,e){var r;return new rx(i.renderer.engine,iP({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=c;var h=rQ.create({storeAction:this.storeAction,name:u,viewport:o,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);h.bind(),h.unbind(),this.framebuffer=h}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 a=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===a||1===a||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:o}),s.externalStorage&&2===o||1===o||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eB}},e3(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}(),rE="#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);}",r_="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\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);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",rS="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;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(uSampler0,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;}",rC="#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",rA="#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}}",rw="#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}",rO="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",rR="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);}",rI="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);}",rM="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);}",rL="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);}",rP="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);}",rV={},rF=function(){function e(){}return e.registerInclude=function(t,e){rV[t]&&eP.warn('The "'+t+'" shader include already exist.'),rV[t]=e},e.unRegisterInclude=function(t){delete rV[t]},e.unRegisterAllIncludes=function(){Object.keys(rV).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),c=e.genShaderVersion(r),h=e.parseIncludes(a),l=e.isVersion300(h);return(h=e.removeWebGLVersion(h),2!==r||l||(h=e.convertTo300(h,n===t.ShaderType.fragment)),s)?u+h:c+u+h},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=rV[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 a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[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}(),rD=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=ru.create(a,{mode:iA.TRIANGLE_STRIP,attributes:{aPos:{type:iA.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ri.create(a,{shader:{vertex:rO,fragment:rP,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=rg.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}e$(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=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",i),e.renderMeshes([this.screenMesh])},i}(rT),rN=function(e){function i(i,r,n){(a=e.call(this,i,n)||this).type=r;var a,o=a.renderer.engine,s="PostProcess",u=ru.create(o,{name:s,mode:iA.TRIANGLE_STRIP,attributes:{aPos:{type:iA.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:rO,fragment:"H"==r?rI:rM,glslVersion:t.GLSLVersion.GLSL1},h=ri.create(o,{name:s,shader:c});return h.blending=!1,h.depthTest=!1,h.culling=!1,a.screenMesh=rg.create(o,{name:s,geometry:u,material:h,priority:0}),a.priority=5e3,a}e$(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",rj(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(rT),rz=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=ru.create(a,{name:n,mode:iA.TRIANGLE_STRIP,attributes:{aPos:{type:iA.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ri.create(a,{name:n,shader:{vertex:rO,fragment:rL}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=rg.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}e$(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",rj(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(rT),rk=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new rx(o);var s=ru.create(o,{name:a,mode:iA.TRIANGLE_STRIP,attributes:{aPos:{type:iA.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ri.create(o,{name:a,shader:{vertex:rO,fragment:rR,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=rg.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}e$(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=i.useBloom,n=i.bloomIntensity,a=i.brightness,o=i.saturation,s=i.contrast,u=i.useToneMapping,c=i.vignetteIntensity,h=i.vignetteSmoothness,l=i.vignetteRoundness;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",a),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",s),this.screenMesh.material.setInt("_UseBloom",Number(r)),r&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",n)),c>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",c),this.screenMesh.material.setFloat("_VignetteSmoothness",h),this.screenMesh.material.setFloat("_VignetteRoundness",l),this.screenMesh.material.setVector2("_VignetteCenter",new id(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new ip(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(u)),e.renderMeshes([this.screenMesh])},i}(rT),rU="_effects_default_",rB=1,rG=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,a=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=e.globalVolume,c=e.clearAction,h=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,l=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new rH;var f=[],d={};if(this.renderer=o,this.globalVolume){var p=this.globalVolume.useHDR?iA.HALF_FLOAT:iA.UNSIGNED_BYTE;f=[{texture:{format:iA.RGBA,type:p,magFilter:iA.LINEAR,minFilter:iA.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var m=[new rT(o,{name:rU,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:f,clearAction:d})];if(this.setRenderPasses(m),this.globalVolume){var v=new rx(l),y=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],g=Array(7),x=this.globalVolume.useHDR?iA.HALF_FLOAT:iA.UNSIGNED_BYTE,b=new rD(o,{name:"BloomThresholdPass",attachments:[{texture:{format:iA.RGBA,type:x,minFilter:iA.LINEAR,magFilter:iA.LINEAR}}]});b.sceneTextureHandle=v,this.addRenderPass(b);for(var T=0;T<7;T++){g[T]=new rx(l);var E=new rN(o,"H",{name:"GaussianDownPassH"+T,viewport:y,attachments:[{texture:{format:iA.RGBA,type:x,minFilter:iA.LINEAR,magFilter:iA.LINEAR}}]}),_=new rN(o,"V",{name:"GaussianDownPassV"+T,viewport:y,attachments:[{texture:{format:iA.RGBA,type:x,minFilter:iA.LINEAR,magFilter:iA.LINEAR}}]});_.gaussianResult=g[T],this.addRenderPass(E),this.addRenderPass(_),y[2]/=2,y[3]/=2}y[2]*=4,y[3]*=4;for(var S=0;S<6;S++){var C=new rz(o,{name:"GaussianUpPass"+S,viewport:y,attachments:[{texture:{format:iA.RGBA,type:x,minFilter:iA.LINEAR,magFilter:iA.LINEAR}}]});C.gaussianDownSampleResult=g[5-S],this.addRenderPass(C),y[2]*=2,y[3]*=2}var A=new rk(o,v);this.addRenderPass(A)}this.semantics=new ro(e.semantics),this.clearAction=h,this.name="RenderFrame"+rB++;var w=m[0];this.emptyTexture=i4(l),this.transparentTexture=i5(l),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(w,{listStart:0,listEnd:0,renderPass:w,intermedia:!1}),this.editorTransform=iy.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new ra(l);var O=l.gpuCapability,R=O.detail,I=iS(O.level,R.readableDepthStencilTextures&&R.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(I)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},i.removeMeshFromDefaultRenderPass=function(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,a=e;a<t.length;a++){var o,s,u,c=t[a],h=null==(s=c.attachments[0])?void 0:s.texture;if(h&&o===h){var l=h===r?n:r;c.resetColorAttachments([l])}(h=null==(u=c.attachments[0])?void 0:u.texture)&&(o=h)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(rU)&&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,a=r.persistent,o=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(o===iA.RGBA&&!a){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[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,a=r.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===a?iA.LINEAR:iA.NEAREST,c=i1.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iA.RGBA,name:"frame_a",minFilter:u,magFilter:u}),h=i1.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iA.RGBA,data:{width:o,height:s},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 rT(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:c}]}).initialize(this.renderer),d=new rX(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:h,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=ru.create(i,{name:ib,mode:iA.TRIANGLE_STRIP,attributes:{aPos:{type:iA.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=iS(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=ri.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:ib,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[iA.SRC_ALPHA,iA.ONE_MINUS_SRC_ALPHA,iA.SRC_ALPHA,iA.ONE_MINUS_SRC_ALPHA]),rg.create(i,{name:ib,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){em(this._renderPasses,t)},e3(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function rj(t){return t?new id(t.getWidth(),t.getHeight()):new id}var rX=function(t){function e(){return t.apply(this,arguments)}e$(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",rj(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(rT),rH=function(){this.floats={},this.ints={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},rW=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 e3(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),rY="function"==typeof WebGL2RenderingContext,rZ=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=rY&&eo(t,WebGL2RenderingContext)?2:1,r=2===i,n=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"),s=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"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),r&&!o&&(o=rq(t,t.HALF_FLOAT)),r&&!s&&(s=rq(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=r||t.getExtension("OES_texture_float")?t.FLOAT:0,c=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,h={floatTexture:u,halfFloatTexture:c,maxSample:r?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:r?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!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:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!a,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=h,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,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 rq(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,(J=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[J.NONE=0]="NONE",J[J.PVRTC=1]="PVRTC",J[J.ASTC=2]="ASTC",t.FilterMode=void 0,($=t.FilterMode||(t.FilterMode={}))[$.Nearest=0]="Nearest",$[$.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tt=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tt.RGBA32=0]="RGBA32",tt[tt.RGBAHalf=1]="RGBAHalf";var rQ=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){},e3(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),rK=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=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,a){return null},e.dispose=function(t){},t}(),rJ=(ti=new Int32Array((te=new Float32Array(1)).buffer),function(t){te[0]=t;var e=ti[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)}),r$=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]=rJ(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=rJ(t[i])},t}(),r0=new rh,r1=new iv;function r2(t,e,i,r,n,a,o){var s=r/n,u=r,c=e.speedOverLifetime;c&&(u=c.getIntegrateValue(0,r,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,h);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new ip;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(s):e.getIntegrateValue(0,r,n):0});r0.setFromArray(v).negate(),r1.setFromEuler(r0);var y=r1.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(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var S=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+S}}return t}function r3(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function r4(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function r5(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 a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var r6=((t1={})[tS.PARTICLE_ORIGIN_CENTER]=[0,0],t1[tS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t1[tS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t1[tS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t1[tS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t1[tS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t1[tS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t1[tS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t1[tS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t1);function r8(t,e,i){var r=i.position,n=new ip(t,e,0),a=new ip;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new rf(r,a)}function r9(t,e,i){var r=t.x,n=t.y,a=t.z,o=new ip(r-e,n+i,a),s=new ip(r-e,n-i,a),u=new ip(r+e,n-i,a),c=new ip(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:c}]}function r7(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function nt(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function ne(t,e,i){return(ne=!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&&eJ(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var ni={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new id(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tR.LINE?0:e===tR.EASE_OUT?0:e===tR.EASE_IN?2:e===tR.EASE?2:e===tR.HOLD&&i===tR.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===tR.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tR.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tR.EASE,tR.EASE_IN,tR.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tR.EASE,tR.EASE_OUT,tR.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tR.HOLD&&[tR.HOLD,tR.LINE_OUT,tR.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tR.HOLD&&[tR.HOLD,tR.LINE,tR.EASE_IN].includes(i)}},nr=function(t,e){this.points=t,this.totalLength=e},nn={},na={};function no(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function ns(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var nu=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=nt(e.x-t.x,3)+"_"+nt(e.y-t.y,3)+"_"+nt(e.z-t.z,3)+"&"+(nt(i.x-t.x,3)+"_"+nt(i.y-t.y,3))+"_"+nt(i.z-t.z,3)+"&"+(nt(r.x-t.x,3)+"_"+nt(r.y-t.y,3))+"_"+nt(r.z-t.z,3);if(na[n])return{data:na[n],interval:t};for(var a=[],o=null,s=0,u=0,c=0;c<300;c+=1){var h=new ip,l=c/299;u=0,h.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),h.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),h.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!==o&&(u+=Math.pow(h.x-o.x,2)+Math.pow(h.y-o.y,2)+Math.pow(h.z-o.z,2)),o=h,s+=u=Math.sqrt(u),a[c]={partialLength:u,point:h}}var f=new nr(a,s);return na[n]=f,{data:f,interval:new ip(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(r7(1-t,0))return e.points[299].point.clone().add(this.interval);if(r7(e.totalLength,0))return this.p1.clone();var i=new ip,r=nt(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(r7(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=nt(e.points[a].partialLength,5)):s<0&&a>0?(n-=nt(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),nc=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new im,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):r7(1-t,0)?this.temp.copyFrom(this.p2):(nf.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),nh=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(),no(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=no(.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,a=ns(n,this.mX1,this.mX2);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=ns(e,i,r);if(0===a)break;var o=no(e,i,r)-t;e-=o/a}return e}(t,n,this.mX1,this.mX2):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=no(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.mX1,this.mX2)},t}();function nl(t,e){var i,r,n,a=function(t,e,i){var r=t[1],n=ni.isHoldOutKeyframe(t),a=ni.isHoldInKeyframe(e),o=!a&&ni.isRightSideEase(t),s=!n&&ni.isLeftSideEase(e);if(o&&!s&&!a){var u=new id(r[r.length-4],r[r.length-3]),c=new id(r[r.length-2],r[r.length-1]),h=ni.getPointInCurve(e),l=new id(h.x,h.y),f=new id(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:c,p2:f,p3:l}}if(!o&&s&&!n){var d=e[1],p=ni.getPointInCurve(t),m=new id(p.x,p.y),v=new id(d[0],d[1]),y=new id(d[2],d[3]),g=new id(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new id(r[r.length-4],r[r.length-3]),p1:new id(r[r.length-2],r[r.length-1]),p2:new id(x[0],x[1]),p3:new id(x[2],x[3])}}var b=ni.getPointInCurve(t),T=ni.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var E=new id((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new id((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||a,leftHoldLine:n,rightHoldLine:a}}(t,e,!0),o=a.p0,s=a.p1,u=a.p2,c=a.p3;eI(u),eI(c);var h=c.x-o.x,l=c.y-o.y,f=nt((s.x-o.x)/h,5),d=nt((u.x-o.x)/h,5);r7(l,0)?i=r=NaN:(i=nt((s.y-o.y)/l,5),r=nt((u.y-o.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",o,s,u,c),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",o,s,u,c),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",o,s,u,c),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",o,s,u,c),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return nn[p]?n=nn[p]:(n=new nh(f,i,d,r),nn[p]=n),{points:[o,s,u,c],timeInterval:h,valueInterval:l,curve:n}}var nf=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,c=i.y,h=i.z,l=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=c,t.z=h,t.w=l;return}if(s!==l||n!==u||a!==c||o!==h){var f=1-r,d=n*u+a*c+o*h+s*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,a=a*f+c*g,o=o*f+h*g,s=s*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),nd="editor",np={"Item duration can't be less than 0":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"},nm="not_implement",nv=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(nm)},e.getIntegrateValue=function(t,e,i){throw Error(nm)},e.getIntegrateByTime=function(t,e){throw Error(nm)},e.getValue=function(t){throw Error(nm)},e.getMaxTime=function(){throw Error(nm)},e.toUniform=function(t){throw Error(nm)},e.map=function(t){throw Error(nm)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(nm)},t.getAllData=function(t,e){for(var i=new(e?r$:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),ny=function(t){function e(){return t.apply(this,arguments)}e$(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}(nv),ng=function(t){function e(){return t.apply(this,arguments)}e$(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}(nv),nx=function(t){function e(){return t.apply(this,arguments)}e$(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}(nv),nb=function(t){function e(){return t.apply(this,arguments)}e$(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 a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(nv),nT=function(t){function e(){return t.apply(this,arguments)}e$(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,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return nM(e,0,this.xCoord,this.min,this.max)-nM(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}(nv),nE=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=ex(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],a=e[r+1];if(n.stop<=t&&a.stop>t){var o=(t-n.stop)/(a.stop-n.stop);return eb(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(nv),n_=function(t){function e(){return t.apply(this,arguments)}e$(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],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),c=n[1];return c+u*(a[1]-c)}}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,a=e?nM:nI,o=0;o<n;o++){var s=i[o],u=i[o+1],c=s[0],h=u[0];if(t>c&&t<=h)return r+a(t,c,h,s[1],u[1]);r+=a(h,c,h,s[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}(nv),nS=function(t){function e(){return t.apply(this,arguments)}e$(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=nl(t[e],t[e+1]),r=i.points,n=i.curve,a=i.timeInterval,o=i.valueInterval,s=r[0],u=r[r.length-1];this.keys.push([].concat(s.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[s.x+"&"+u.x]={points:r,timeInterval:a,valueInterval:o,curve:n,timeStart:Number(s.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 a=0;a<i.length;a++){var o=this.curveMap[i[a]].timeStart,s=this.curveMap[i[a]].timeEnd;if(t>=Number(o)&&t<Number(s)){e=this.getCurveValue(i[a],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],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,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var c=u*s/n,h=r.y+a*i.curve.getValue(c);0===u||20===u?o+=h:u%2==1?o+=4*h:o+=2*h}return s/3*o},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=(e-r.x)/n,s=i.curve.getValue(o);return r.y+a*s},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}(nv),nC=function(t){function e(){return t.apply(this,arguments)}e$(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],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}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],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(nv),nA=function(t){function e(){return t.apply(this,arguments)}e$(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 a=e[n],o=e[n+1],s=new ip(i[n][0],i[n][1],i[n][2]),u=new ip(i[n+1][0],i[n+1][1],i[n+1][2]),c=new ip(r[2*n][0],r[2*n][1],r[2*n][2]),h=new ip(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=nl(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new nu(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=nt(t,5),i=0,r=new ip,n=Object.keys(this.curveSegments);if(!n.length)return r;var a=Number(n[0].split("&")[0]),o=Number(n[n.length-1].split("&")[1]);if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=n[s].split("&"),c=u[0],h=u[1];if(e>=Number(c)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=nt((e-r.x)/n,4);return il(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(nv),nw=function(t){function e(){return t.apply(this,arguments)}e$(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 a=e[n],o=e[n+1],s=im.fromArray(i[n]),u=im.fromArray(i[n+1]),c=im.fromArray(r[2*n]),h=im.fromArray(r[2*n+1]),l=nl(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new nc(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=nt(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],c=s[1];if(i>=Number(u)&&i<Number(c)){var h=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),h.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,a=nt((e-r.x)/n,4);return il(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(nv),nO=((t2={})[tO.RANDOM]=function(t){return eo(t[0],Array)?new nb(t):new nx(t)},t2[tO.CONSTANT]=function(t){return new ny(t)},t2[tO.CONSTANT_VEC2]=function(t){return new ny(t)},t2[tO.CONSTANT_VEC3]=function(t){return new ny(t)},t2[tO.CONSTANT_VEC4]=function(t){return new ny(t)},t2[tO.RGBA_COLOR]=function(t){return new ny(t)},t2[tO.COLORS]=function(t){return new ng(t.map(function(t){return ey(t,!1)}))},t2[tO.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new nT([t[0][1],t[1][1]]):new n_(t)},t2[tO.GRADIENT_COLOR]=function(t){return new nE(t)},t2[tO.LINEAR_PATH]=function(t){return new nC(t)},t2[tO.BEZIER_CURVE]=function(t){return 1===t.length?new ny(t[0][1][1]):new nS(t)},t2[tO.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new ny(ne(ip,[].concat(t[1][0]))):new nA(t)},t2[tO.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new ny(ne(im,[].concat(t[1][0]))):new nw(t)},t2);function nR(t){if(!t||!isNaN(+t))return new ny(t||0);if(eo(t,nv))return t;if(eN(nO[t[0]]))return nO[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+np["ValueType: 21/22 is not supported"]+".")}function nI(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function nM(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function nL(t,e){if(e){var i=e[0],r=e[1];if(i===tO.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===tO.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===tO.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function nP(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var nV=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===tv.FRONT}}},i.renderer={renderMode:t_.BILLBOARD,blending:tm.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tv.DOUBLE,mask:0,maskMode:ty.NONE,order:0},i.emptyTexture=i.engine.emptyTexture,i.renderInfo=nF(ig(i));var i,r=i.createMaterial(i.renderInfo,2);return i.worldMatrix=iv.fromIdentity(),i.material=r,i.material.setVector4("_Color",new iy().setFromArray([1,1,1,1])),i.material.setVector4("_TexOffset",new iy().setFromArray([0,0,1,1])),i}e$(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 iy().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",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),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 a=0;a<r;a++)n[a]=0+e[a];return{atlasOffset:i,index:n}},r.setItem=function(){var e=[],i=this.renderer.texture;i&&ep(e,i),i=this.renderer.texture;var r=this.getItemInitData(),n=this.renderer,a=this.material.getVector4("_TexParams");a&&(a.x=n.occlusion?+n.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=n.renderMode);var o={atlasOffset:new Float32Array(r.atlasOffset.length),index:new Uint16Array(r.index.length)};o.atlasOffset.set(r.atlasOffset),o.index.set(r.index);var s=this.material,u=this.geometry,c=o.index;u.setIndexData(c),u.setAttributeData("atlasOffset",o.atlasOffset),u.setDrawCount(r.index.length);for(var h=0;h<e.length;h++){var l=e[h];s.setTexture("uSampler"+h,l)}for(var f=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)s.setTexture("uSampler"+d,f)},r.getItemGeometryData=function(){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]}},r.createGeometry=function(t){return ru.create(this.engine,{attributes:{aPos:{type:iA.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:iA.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,a=t.maskMode,o=t.mask,s={shader:n3(t,e,1)};this.preMultiAlpha=iR(n);var u=ri.create(this.engine,s),c={side:i,blending:!0,blendMode:n,mask:o,maskMode:a,depthTest:!0,depthMask:r};return u.blending=c.blending,u.stencilRef=void 0!==c.mask?[c.mask,c.mask]:void 0,u.depthTest=c.depthTest,u.depthMask=c.depthMask,iI(u,c.blendMode),iL(u,c.maskMode),iM(u,c.side),u.shader.shaderData.properties='uSampler0("uSampler0",2D) = "white" {}',u.hasUniform("_Color")||u.setVector4("_Color",new iy(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new iy),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new iy),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=r9(ip.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}(ir);function nF(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,a=e.mask,o=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:a,maskMode:o,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+s+"+"+o+"."+a}}var nD=function(){},nN="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},nz={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 a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(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 s(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 c(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function h(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=Q(t),t.a.c=t.c,m(t,Q(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=Q(e),e.a.c=e.c,m(e,Q(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,Q(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 S(t,e){t.f+=e.f,t.b.f+=e.b.f}function C(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function A(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 O(t){var e=t.a.a;do t=th(t);while(t.a.a===e);return t.c&&(e=d(tc(t).a.b,t.a.e),w(t,e),t=th(t)),t}function R(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function I(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 M(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,A(t)}function L(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=tc(t),n=r.a;if(n.a!==e.a){if(!r.c){M(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(h(Q(n),n),h(e,n)),M(t),e=r.a,t=r}return e}function P(t,e,i,r,n,a){var o=!0;do R(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=tc(e).a.b.c);(i=(r=tc(e)).a.b).a===n.a;)i.c!==n&&(h(Q(i),i),h(Q(n),i)),r.f=e.f-i.f,r.d=I(t,r.f),e.b=!0,!o&&N(t,e)&&(S(i,n),A(e),l(n)),o=!1,e=r,n=i;e.b=!0,a&&k(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function F(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),h(e,i)}function D(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function N(t,r){var a=tc(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,c=a.d,l=a.e,d=a.c,p=d[u];c[p]=c[a.a],d[c[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(l[c[p>>1]],l[c[p]])?to(a,p):ts(a,p)),l[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;F(t,Q(s),o)}}else f(s.b),h(o,Q(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;th(r).b=r.b=!0,f(o.b),h(Q(s),o)}return!0}function z(t,c){var l=tc(c),d=c.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,S=g,C=v;if(i(E,_)||(b=E,E=_,_=b),i(S,C)||(b=S,S=C,C=b),i(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),i(S,_)?i(_,C)?(0>(b=r(E,S,_))+(T=r(S,_,C))&&(b=-b,T=-T),x.b=u(b,S.b,T,_.b)):(0>(b=n(E,S,_))+(T=-n(E,C,_))&&(b=-b,T=-T),x.b=u(b,S.b,T,C.b)):x.b=(S.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(S,C)||(b=S,S=C,C=b),a(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),a(S,_)?a(_,C)?(0>(b=o(E,S,_))+(T=o(S,_,C))&&(b=-b,T=-T),x.a=u(b,S.a,T,_.a)):(0>(b=s(E,S,_))+(T=-s(E,C,_))&&(b=-b,T=-T),x.a=u(b,S.a,T,C.a)):x.a=(S.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 N(t,c),!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),h(p.b,d),d=tc(c=O(c)).a,L(t,tc(c),l),P(t,c,Q(d),d,d,!0),!0;if(y===t.a){f(p.b),h(d.e,Q(p)),v=(m=l=c).a.b.a;do m=th(m);while(m.a.b.a===v);return m=tc(c=m).a.b.c,l.a=Q(p),p=L(t,l,null),P(t,c,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(th(c).b=c.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(c.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),h(Q(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,D(d,m,y,p,0),D(d,v,g,p,2),V(t,d,x,p,!0),th(c).b=c.b=l.b=!0,!1}function k(t,e){for(var r=tc(e);;){for(;r.b;)e=r,r=tc(r);if(!e.b&&(r=e,null===(e=th(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=tc(a=e),c=a.a,d=u.a,p=void 0;if(i(c.b.a,d.b.a)){if(0>n(c.b.a,d.b.a,c.a)){a=!1;break t}th(a).b=a.b=!0,p=f(c),h(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,c.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),h(c.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(A(r),l(s),s=(r=tc(e)).a):e.c&&(A(e),l(o),o=(e=th(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)N(t,e);else if(z(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(S(s,o),A(e),l(o),e=th(r))}}function U(t,e){var i=new tu,r=c(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 j,this.b=t,this.c=C}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function X(){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 W(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case H:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(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 Q(t){return t.b.e}function K(){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&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(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 ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=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&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var c=r[u];if(u>t.a||i(n[s],n[c])){r[o]=s,a[s]=o;break}r[o]=c,a[c]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,c=r[u];if(0===u||i(n[c],n[s])){r[o]=s,a[s]=o;break}r[o]=c,a[c]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function tc(t){return t.e.c.b}function th(t){return t.e.a.b}(E=X.prototype).x=function(){W(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:Y(this,100900);return}Y(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(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:Y(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];W(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?h(i=c(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){W(this,H),this.d=1,this.b=new K,this.c=t},E.t=function(){W(this,1),this.d=2,this.q=null},E.v=function(){W(this,2),this.d=1},E.w=function(){W(this,1),this.d=H;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,c=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])c[0]=0,c[1]=0,c[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.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])>o&&(o=b,c[0]=v[0],c[1]=v[1],c[2]=v[2]);0>=o&&(c[0]=c[1]=c[2]=0,c[T(p)]=1)}u=!0}for(v=T(c),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<c[v]?1:-1,c=a.e;c!==a;c=c.e)c.b=c.g[o],c.a=v*c.g[s];if(u){for(c=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do c+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>c)for(u=(c=this.b.c).e;u!==c;u=u.e)u.a=-u.a}for(this.n=!1,a=(c=this.b.b).h;a!==c;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(F(this,o,a),l(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),l(o)),(a===u||a===u.b)&&(u=u.h),l(a));for(this.e=c=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(c,a);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)to(t,e);t.h=!0}(t.b)}(c),this.f=new B(this),U(this,-_),U(this,_);null!==(c=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,c))break;u=te(this.e),F(this,c.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var c=o.f,p=c.a;do p=p.a;while(null!==p.b&&!c.c(c.b,u,p.b));var c=p.b,m=tc(c),u=c.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=c.a).a,s)||e(u.b.a,s)||(f(u.b),c.c&&(l(u.c),c.c=!1),h(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?c:m,m=void 0;c.d||v.c?(m=v===c?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?w(v,m):(u=o,(c=R(o,c,m)).f=th(c).f+c.a.f,c.d=I(u,c.f)),t(o,s)):P(o,c,s.c,s.c,null,!0)}return}if(c=(u=tc(o=O(o.i))).a,(u=L(r,u,null)).c===c){var c=u,u=c.c,p=tc(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&z(r,o),e(m.a,r.a)&&(h(Q(u),m),u=tc(o=O(o)).a,L(r,tc(o),p),y=!0),e(v.a,r.a)&&(h(c,Q(v)),c=L(r,p,null),y=!0),y?P(r,o,c.c,u,u,!0):(s=i(v.a,m.a)?Q(v):m,P(r,o,s=d(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,k(r,o))}else P(r,o,u.c,c,c,!0)}(this,c)}for(c=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++c,A(u);for(this.f=null,(c=this.e).b=null,c.d=null,this.e=c.c=null,a=(c=this.b).a.b;a!==c.a;a=u)u=a.b,(a=a.a).e.e===a&&(S(a.c,a),l(a));if(!this.n){if(c=this.b,this.m)for(a=c.b.h;a!==c.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:l(a);else for(a=c.a.b;a!==c.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(c=this.b).a.b;u!==c.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(c=this.b,u=!!this.l,a=!1,o=-1,s=c.a.d;s!==c.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(c=this.b).a.b;a!==c.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,Q(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,Q(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},nN.libtess={GluTesselator:X,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}},X.prototype.gluDeleteTess=X.prototype.x,X.prototype.gluTessProperty=X.prototype.B,X.prototype.gluGetTessProperty=X.prototype.y,X.prototype.gluTessNormal=X.prototype.A,X.prototype.gluTessCallback=X.prototype.z,X.prototype.gluTessVertex=X.prototype.C,X.prototype.gluTessBeginPolygon=X.prototype.u,X.prototype.gluTessBeginContour=X.prototype.t,X.prototype.gluTessEndContour=X.prototype.v,X.prototype.gluTessEndPolygon=X.prototype.w,t.exports=nN.libtess}(nz);var nk=((tr=new nz.exports.GluTesselator).gluTessCallback(nz.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tr.gluTessCallback(nz.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==nz.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tr.gluTessCallback(nz.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tr.gluTessCallback(nz.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tr.gluTessCallback(nz.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tr),nU=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 a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}e$(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,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],c=this.points[2*a+1];s>e!=c>e&&t<(e-s)/(c-s)*(u-o)+o&&(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 a=function(t){nk.gluTessNormal(0,0,1);var e=[];nk.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){nk.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];nk.gluTessVertex(a,a)}nk.gluTessEndContour()}return nk.gluTessEndPolygon(),e}([t]),o=0;o<a.length;o++)e[i+o]=a[o];for(var s=a.length/2,u=0;u<s;u++)r[n+u]=u},e3(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(nD),nB=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}e$(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 a=i/2,o=r-a,s=n-a,u=r+a,c=n+a,h=t-this.x,l=e-this.y;return h*h/(o*o)+l*l/(s*s)>1&&h*h/(u*u)+l*l/(c*c)<=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 a=Math.ceil(5*Math.sqrt(r+n)),o=8*a+0+0;if(0===o)return t;if(0===a)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 s=0,u=4*a+0+2,c=u,h=o,l=0+r,f=0,d=e+l,p=e-l,m=i+0;t[s++]=d,t[s++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[s++]=b,t[s++]=E,t[--u]=E,t[--u]=T,t[c++]=T,t[c++]=_,t[--h]=_,t[--h]=b}l=0,f=0+n,d=e+l,p=e-l,m=i+f;var S=i-f;return t[s++]=d,t[s++]=m,t[--h]=S,t[--h]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var c=u++,h=0;h<t.length;h+=2)e[2*u]=t[h],e[2*u+1]=t[h+1],h>0&&(r[n++]=u,r[n++]=c,r[n++]=u-1),u++;r[n++]=c+1,r[n++]=c,r[n++]=u-1}},e}(nD),nG=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=io(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4])}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o){this.ensurePoly();var s,u,c,h,l=this.currentPoly;return s=l.points,u=l.lastX,c=l.lastY,h=(1-Math.min(.99,Math.max(0,null!=o?o:.5)))/5,function t(e,i,r,n,a,o,s,u,c,h,l){if(!(l>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(o+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 S=s-e,C=u-i,A=Math.abs((r-s)*C-(n-u)*S),w=Math.abs((a-s)*C-(o-u)*S);if(A>11920929e-14&&w>11920929e-14){if((A+w)*(A+w)<=h*(S*S+C*C)){c.push(E,_);return}}else if(A>11920929e-14){if(A*A<=h*(S*S+C*C)){c.push(E,_);return}}else if(w>11920929e-14){if(w*w<=h*(S*S+C*C)){c.push(E,_);return}}else if((S=E-(e+s)/2)*S+(C=_-(i+u)/2)*C<=h){c.push(E,_);return}}t(e,i,f,d,g,x,E,_,c,h,l+1),t(E,_,b,T,v,y,s,u,c,h,l+1)}}(u,c,t,e,i,r,n,a,s,h*=h,0),s.push(n,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 nB(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 nU).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 nU,this.currentPoly.points.push(0,0))},t}(),nj=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,o]}),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.clear=function(){return this.instructions.length=0,this.dirty=!0,this},e3(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new nG(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 nj,r.curveValues=[],r.dirty=!1,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nvarying vec4 vColor;\n\nuniform vec4 _Color;\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vColor = _Color;\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main() {\n vec4 color = vec4(1.0,1.0,1.0,1.0);\n gl_FragColor = color;\n}\n",r.geometry||(r.geometry=ru.create(i,{attributes:{aPos:{type:iA.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:iA.FLOAT,size:2,data:new Float32Array}},mode:iA.TRIANGLES,drawCount:4})),!r.material){var n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}};r.material=ri.create(i,n),r.material.setColor("_Color",new rd(1,1,1,1)),r.material.depthMask=!0,r.material.depthTest=!0,r.material.blending=!0}return r}e$(i,e);var r=i.prototype;return r.onUpdate=function(t){this.dirty&&(this.buildPath(this.data),this.buildGeometryFromPath(this.path.shapePath))},r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},r.buildGeometryFromPath=function(t){for(var e,i=t.shapePrimitives,r=[],n=[],a=io(i);!(e=a()).done;){var o=e.value.shape,s=[],u=n.length,c=r.length/2;o.build(s),o.triangulate(s,r,c,n,u)}var h=r.length/2,l=this.geometry.getAttributeData("aPos"),f=this.geometry.getAttributeData("aUV"),d=this.geometry.getIndexData();(!l||l.length<3*h)&&(l=new Float32Array(3*h)),(!f||f.length<2*h)&&(f=new Float32Array(2*h)),d||(d=new Uint16Array(n.length));for(var p=0;p<h;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 0:var e=t.param.points,i=t.param.easingIn,r=t.param.easingOut;this.curveValues=[];for(var n,a=io(t.param.shapes);!(n=a()).done;){for(var o=n.value.indexes,s=1;s<o.length;s++){var u=o[s],c=o[s-1];this.curveValues.push({point:e[u.point],controlPoint1:r[c.easingOut],controlPoint2:i[u.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 h,l=io(this.curveValues);!(h=l()).done;){var f=h.value,d=f.point,p=f.controlPoint1,m=f.controlPoint2;this.path.bezierCurveTo(p.x,p.y,m.x,m.y,d.x,d.y,1)}break;case 2:var v=t.param;this.path.ellipse(0,0,v.xRadius,v.yRadius)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.data=t,this.dirty=!0},i}(ir),t.ShapeComponent=eu([e8("ShapeComponent")],t.ShapeComponent),t.ComponentShapeType=void 0,(tn=t.ComponentShapeType||(t.ComponentShapeType={}))[tn.CUSTOM=0]="CUSTOM",tn[tn.RECTANGLE=1]="RECTANGLE",tn[tn.ELLIPSE=2]="ELLIPSE",tn[tn.POLYGON=3]="POLYGON",tn[tn.STAR=4]="STAR",t.ShapeConnectType=void 0,t.ShapeConnectType||(t.ShapeConnectType={}),t.ShapePointType=void 0,t.ShapePointType||(t.ShapePointType={}),t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}e$(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}(ii),t.CameraController=eu([e8(tH.CameraController)],t.CameraController);var nX=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK);t.HitTestType=void 0,(ta=t.HitTestType||(t.HitTestType={}))[ta.triangle=1]="triangle",ta[ta.box=2]="box",ta[ta.sphere=3]="sphere",ta[ta.custom=4]="custom";var nH="click",nW="touchstart",nY="touchmove",nZ="touchend",nq=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,a,o=this;n=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",h=function(t,e,i,n,a){void 0===n&&(n=0),void 0===a&&(a=0);var s=0,u=0,c=performance.now();if(!o.target)return eP.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:a,ts:c,width:0,height:0,origin:t};var h=o.target,l=h.width,f=h.height;if(r){var d=c-r.ts;s=(n-r.dx)/d||0,u=(a-r.dy)/d||0,r={dx:n,dy:a,ts:c}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:a,ts:c,width:l,height:f,origin:t}};e_()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=nQ(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(nW,h(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=nQ(n(r));t=a.x,e=a.y,o.dispatchEvent(nY,h(r,t,e,t-i.x,e-i.y))}},a[c]=function(r){if(i&&o.enabled){!o.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var a=n(r),s=nQ(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(nH,h(r,t,e)),o.dispatchEvent(nZ,h(r,t,e,t-i.x,e-i.y))}i=0},a),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.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]=[]),ep(i,e),function(){em(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&em(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 nQ(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var nK=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK),nJ=1,n$=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,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 ip,n=new im,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.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)===nd]],n=nR(this.color).getValue(0),a={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"}},o=ri.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new iy(0,0,0,0)),o.setVector2("uSize",new id(1,1)),o.setVector4("uColor",new iy(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new im(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return ru.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:iA.LINES,maxVertex:4})},i.createMesh=function(t,e){return rg.create(this.engine,{name:"Interact_preview"+nJ++,priority:0,worldMatrix:iv.fromIdentity(),geometry:t,material:e})},e}();function n0(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}function n1(e,i){var r=null!=i?i:{},n=r.env,a=r.wireframe,o=[["ENV_EDITOR",(void 0===n?"":n)===nd]];return{fragment:a?rE:rS,vertex:r_,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:o,shared:!0}}function n2(t,e){return t.cachePrefix+"_effects_sprite_"+e}function n3(t,e,i,r){var n=t.wireframe,a=n1(i,{wireframe:n,env:r});return a.shared=!0,n||(a.cacheId=n2(t,e)),a}function n4(e){t.maxSpriteMeshItemCount=e}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.dragRatio=[1,1],t._interactive=!0,t.hasBeenAddedToComposition=!1,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}e$(i,e);var r=i.prototype;return r.onStart=function(){var t=this,e=this.item.props.content.options,i=this.item.engine.renderer.env,r=this.item.composition,n=this.interactData.options,a=n.type,o=n.showPreview;if(a===tb.CLICK&&(this.clickable=!0,o&&i===nd)){var s=null==r?void 0:r.getRendererOptions();void 0!==s&&(this.previewContent=new n$(this.item.props.content,s,this.transform,this.engine))}e.type===tb.DRAG&&(i!==nd||e.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(e,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams,this.item.onEnd=function(){if(t.item&&t.item.composition){var e;t.item.composition.removeInteractiveItem(t.item,t.item.props.content.options.type),t.clickable=!1,t.hasBeenAddedToComposition=!1,null==(e=t.previewContent)||e.mesh.dispose(),t.endDragTarget()}}},r.onUpdate=function(t){var e;if(this.isActiveAndEnabled){if(null==(e=this.previewContent)||e.updateMesh(),!this.hasBeenAddedToComposition&&this.item.composition){var i=this.item.props.content.options;this.item.composition.addInteractiveItem(this.item,i.type),this.hasBeenAddedToComposition=!0}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,n0(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(){},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i=this.item.props.content.options,r=t.cameraParam,n=r.position,a=r.fov,o=e.dy,s=e.dx*e.width/e.height,u=n[2],c=Math.tan(a*Math.PI/180/2)*Math.abs(u),h=n[0]-this.dragRatio[0]*(s*c),l=n[1]-this.dragRatio[1]*(o*c);if(i.dxRange){var f,d=i.dxRange,p=d[0],m=d[1];(h=il(h,p,m))!==p&&h!==m&&p!==m&&(null==(f=e.origin)||f.preventDefault())}if(i.dyRange){var v,y=i.dyRange,g=y[0],x=y[1];(l=il(l,g,x))!==g&&l!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new ip(h,l,u)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={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;!n0(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iP({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=r9(ip.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){e.prototype.fromData.call(this,t),this.interactData=t},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},e3(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ir),t.InteractComponent=eu([e8(tH.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8;var n5={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},n6=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return e$(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),a=i.engine.gpuCapability,o=a.level,s=a.detail,u=(null!=r?r:{}).env;return(null==n?void 0:n.shaderResults[n2(n5,2)])||(null==n||n.addShader(n3(n5,2,1,u)),null==n||n.addShader(n3(n5,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&(null==n||n.addShader(iS(o,!0)))),Promise.resolve()},i}(eK),n8=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=io(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=io(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var o,s=io(this.playableOutputs);!(o=s()).done;){var u=o.value;this.processFrameWithRoot(u)}for(var c,h=io(this.playables);!(c=h()).done;){var l=c.value;this.updatePlayableTime(l,t)}},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}(),n9=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,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(eo(e,t)){for(var r=0;r<this.inputs.length;r++)if(this.inputs[r]===e){this.inputWeight[r]=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.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}(),n7=function(){function t(){this.sourceOutputPort=0,this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayeble=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}(),at=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(it);(to=t3||(t3={}))[to.Playing=0]="Playing",to[to.Paused=1]="Paused",(ts=t4||(t4={}))[ts.Mix=0]="Mix",ts[ts.Passthrough=1]="Passthrough";var ae=new im,ai=1,ar=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new ip(0,0,0),this.quat=new im(0,0,0,1),this.rotation=new rh(0,0,0),this.scale=new ip(1,1,1),this.anchor=new ip(0,0,0),this.size=new id(1,1),this.children=[],this.worldMatrix=iv.fromIdentity(),this.localMatrix=iv.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new ip(0,0,0),quat:new im(0,0,0,1),scale:new ip(1,1,1)},this.name="transform_"+ai++,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,r=t.rotation,n=t.scale,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(eo(i,ip)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)eo(o,im)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var c=e?-1:1;eo(r,rh)?this.setRotation(r.x*c,r.y*c,r.z*c):this.setRotation(r[0]*c,r[1]*c,r[2]*c)}n&&(eo(n,ip)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(eo(u,id)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){ep(this.children,t)},e.removeChild=function(t){em(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rh)},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 rh)},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 ip().copyFrom(t.position),rotation:new rh(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new ip().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=ae.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},e3(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}(),an=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),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.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 ar,r.time=0,r.duration=0,r.start=0,r.endBehavior=tI.forward,r.ended=!1,r.reusable=!1,r.type=tE.base,r.isDuringPlay=!1,r.components=[],r.rendererComponents=[],r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new an,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}e$(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.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))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,i,r=io(this.components);!(i=r()).done;){var n=i.value;if(eo(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=io(this.components);!(e=r()).done;){var n=e.value;eo(n,t)&&i.push(n)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&em(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())},r.onEnd=function(){},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.getVisible=function(){return this.visible},r.setVisible=function(t){this.visible!==t&&(this.visible=!!t,this.onActiveChanged())},r.getWorldTransform=function(t){var e=null!=t?t:new ar({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var i=this.components[1];if(i.getNodeTransform)return i.getNodeTransform(t)}return this.transform},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new rh(t,e,i),n=im.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/s)*a,i)}},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new ip;return this.transform.assignWorldTRS(t),t},r.isEnded=function(t){return t-this.duration>.001},r.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))}},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.visible&&!this.isEnabled&&this.onEnable();for(var t,e=io(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=io(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=io(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=io(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r=i.id,n=i.name,a=i.delay,o=i.parentId,s=i.endBehavior,u=i.transform,c=i.listIndex,h=i.duration,l=void 0===h?0:h;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,this.start=a||this.start,u&&(u.position=new ip().copyFrom(u.position),u.quat?u.quat=new im(u.quat.x,u.quat.y,u.quat.z,u.quat.w):u.rotation=new rh().copyFrom(null!=(f=u.eulerHint)?f:u.rotation),u.scale=new ip().copyFrom(u.scale),u.size&&(u.size=new id().copyFrom(u.size)),u.anchor&&(u.anchor=new id().copyFrom(u.anchor)),this.transform.setTransform(u)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=l,this.endBehavior=s,i.content||(i.content={options:{}}),l<=0)throw Error("Item duration can't be less than 0, see "+np["Item duration can't be less than 0"]+".");this.rendererComponents.length=0;for(var f,d,p=io(this.components);!(d=p()).done;){var m=d.value;m.item=this,eo(m,ir)&&this.rendererComponents.push(m),eo(m,t.ParticleSystem)&&(this.components.includes(m.renderer)||this.components.push(m.renderer),this.rendererComponents.push(m.renderer))}this.renderOrder=void 0===c?0:c},r.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=tH.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,r,n=io(this.components);!(r=n()).done;){var a=r.value;eo(a,t.EffectComponent)&&this.taggedProperties.components.push(a)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=io(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e,i=io(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&em(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tE.composition},i.isSprite=function(t){return t.type===tE.sprite},i.isParticle=function(t){return t.type===tE.particle},i.isNull=function(t){return t.type===tE.null},i.isTree=function(t){return t.type===tE.tree},i.isCamera=function(t){return t.type===tE.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},e3(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=io(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}}]),i}(it),eu([e7(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=eu([e8(tH.VFXItemData)],t.VFXItem),t.Item=void 0,(tu=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tu.isComposition=function(t){return t.type===tE.composition},tu.isParticle=function(t){return t.type===tE.particle},tu.isNull=function(t){return t.type===tE.null};var aa=[1,1,1,1],ao=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}e$(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(eo(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(s=this.activeComponent)?void 0:s.material;var o,s,u,c=null==(u=this.activeMaterial)?void 0:u.getVector4("_Color");c&&(this.startColor=c.toArray())}null==(o=this.activeComponent)||o.setAnimationTime(this.time);var h=r4(aa,1),l=this.time/a.duration,f=this.opacityOverLifetime,d=this.colorOverLifetime;d&&(h=eg(d,l,!0),i=!0),f&&(h[3]*=f.getValue(l),i=!0),i&&(r5(this.renderColor,h,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getVector4("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=nR(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tO.GRADIENT_COLOR&&(this.colorOverLifetime=ex(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(nV)},i}(n9),as=[[0,0,1,1,void 0]],au=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new ao(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(at),t.SpriteColorPlayableAsset=eu([e8("SpriteColorPlayableAsset")],t.SpriteColorPlayableAsset),t.SpriteComponent=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).splits=as,r.frameAnimationLoop=!1,r.name="MSprite"+au++,r.geometry=r.createGeometry(iA.TRIANGLES),r.setItem(),i&&r.fromData(i),r}e$(e,t);var i=e.prototype;return i.onUpdate=function(t){this.isManualTimeSet||(this.frameAnimationTime+=t/1e3,this.isManualTimeSet=!1);var e=this.frameAnimationTime,i=this.item.duration;e>i&&this.frameAnimationLoop&&(e%=i);var r=Math.min(Math.max(e/i,0),1),n=this.textureSheetAnimation;if(n){var a,o,s,u,c,h=n.total||n.row*n.col,l=0,f=0,d=1,p=1;if(this.splits){var m=this.splits[0];o=m[4],l=m[0],f=m[1],o?(d=m[3],p=m[2]):(d=m[2],p=m[3])}if(o?(s=1/n.row*d,u=1/n.col*p):(s=1/n.col*d,u=1/n.row*p),n.animate){var v=Math.round(r*(h-1)),y=Math.floor(v/n.col),g=v-y*n.col;c=o?[s*y,u*(n.col-g)]:[s*g,u*(1+y)]}else c=[0,u];null==(a=this.material.getVector4("_TexOffset"))||a.setFromArray([l+c[0],p+f-c[1],s,u])}},i.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},i.createGeometry=function(t){var e=12*this.splits.length;return ru.create(this.engine,{attributes:{aPos:{type:iA.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:iA.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},i.getItemGeometryData=function(){var t=this.splits,e=this.textureSheetAnimation,i=this.renderer;if(i.shape){for(var r=i.shape,n=r.index,a=r.aPoint,o=void 0===a?[]:a,s=new Float32Array(o),u=[],c=[],h=0;h<s.length;h+=6)s[h]*=1,s[h+1]*=1,c.push(o[h+2],o[h+3]),u.push(s[h],s[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:void 0===n?[]:n,atlasOffset:c}}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],S=x[1],C=x[4]?x[3]:x[2],A=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]*C+_,b[1]*A+S,b[2]*C+_,b[3]*A+S,b[4]*C+_,b[5]*A+S,b[6]*C+_,b[7]*A+S),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}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,a,o,s,u=e.interaction,c=e.options,h=e.listIndex,l=e.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:t_.BILLBOARD,blending:null!=(r=l.blending)?r:tm.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===ty.MASK,side:null!=(a=l.side)?a:tv.DOUBLE,shape:l.shape,mask:null!=(o=l.mask)?o:0,maskMode:null!=(s=l.maskMode)?s:ty.NONE,order:void 0===h?0:h},this.emptyTexture=this.engine.emptyTexture,this.splits=e.splits||as,this.textureSheetAnimation=e.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nF(this);var f=this.createGeometry(iA.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=iv.fromIdentity(),this.material=d,this.geometry=f;var p=c.startColor||[1,1,1,1];this.material.setVector4("_Color",new iy().setFromArray(p)),this.material.setVector4("_TexOffset",new iy().setFromArray([0,0,1,1])),this.setItem()},e}(nV),t.SpriteComponent=eu([e8(tH.SpriteComponent)],t.SpriteComponent);var ac="lookup_texture",ah="offscreen_canvas",al={},af=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=ad(this.arc,this.arcMode,t)*is,i=new ip(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*is),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eU(0,1)),direction:n.normalize()}},t}();function ad(t,e,i){if(e===tP.RANDOM)t=eU(0,t);else if(e===tP.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tP.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===tP.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var ap=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=ad(this.arc,this.arcMode,t)*is,i=new ip(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),am=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eU(-this._d,this._d),i=eU(-this._h,this._h);return{direction:new ip(0,0,1),position:new ip(e,i,0)}},t}(),av=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=ad(this.arc,this.arcMode,t)*is,i=new ip(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new ip;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),ay=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tP.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eU(0,1);return{direction:new ip(0,1,0),position:new ip(this._d*(e-.5),0,0)}},t}(),ag=new iv,ax=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=eU(0,2*Math.PI),n=ad(this.arc,this.arcMode,t)*is,a=ag.setFromRotationZ(n),o=new ip(Math.cos(r),Math.sin(r),0),s=new ip(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),ab=new iv,aT=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 eU(-90,90)},e.generate=function(t){var e=ad(this.arc,this.arcMode,t)*is,i=this.getHorizontalAngle()*is,r=this.radius,n=new ip(Math.cos(i),0,Math.sin(i)),a=ab.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),aE=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.getHorizontalAngle=function(){return eU(0,90)},e}(aT),a_=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=il(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(ad(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,a=new ip(r,n,0);return{position:new ip(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),aS=function(){function t(){}return t.prototype.generate=function(){return{position:new ip,direction:new ip}},t}(),aC=((t5={})[tg.NONE]=aS,t5[tg.CONE]=af,t5[tg.SPHERE]=aT,t5[tg.HEMISPHERE]=aE,t5[tg.CIRCLE]=ap,t5[tg.DONUT]=ax,t5[tg.RECTANGLE]=am,t5[tg.EDGE]=ay,t5[tg.RECTANGLE_EDGE]=av,t5[tg.TEXTURE]=a_,t5);function aA(t){if(!t)return new aS;var e=iP({radius:1,arc:360,angle:0,arcMode:tP.RANDOM},t),i=t.type,r=aC[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tg.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=ip.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function aw(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=ak(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=ak(a,t[a],t[a+1],o);return o&&aP(o,o.next)&&(aU(o),o=o.next),o}function aO(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(aP(r,r.next)||0===aL(r.prev,r,r.next))){if(aU(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function aR(t,e){return t.x-e.x}function aI(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 aM(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function aL(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function aP(t,e){return t.x===e.x&&t.y===e.y}function aV(t,e,i,r){var n=aD(aL(t,e,i)),a=aD(aL(t,e,r)),o=aD(aL(i,r,t)),s=aD(aL(i,r,e));return!!(n!==a&&o!==s||0===n&&aF(t,i,e)||0===a&&aF(t,r,e)||0===o&&aF(i,t,r)||0===s&&aF(i,e,r))}function aF(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 aD(t){return t>0?1:t<0?-1:0}function aN(t,e){return 0>aL(t.prev,t,t.next)?aL(t,e,t.next)>=0&&aL(t,t.prev,e)>=0:0>aL(t,e,t.prev)||0>aL(t,t.next,e)}function az(t,e){var i=new aB(t.i,t.x,t.y),r=new aB(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function ak(t,e,i,r){var n=new aB(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 aU(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 aB(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 aG=0;function aj(t,e,i,r){i=i||2,aG=r||0;var n,a,o,s,u,c,h,l=e&&e.length,f=l?e[0]*i:t.length,d=aw(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,a,o,s,u,c=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=aw(t,o,s,r,!1))===u.next&&(u.steiner=!0),c.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(c.sort(aR),n=0;n<c.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var c=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(c<=o&&c>u){if(u=c,c===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var h,l=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&aM(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(h=Math.abs(s-a.y)/(o-a.x),aN(a,t)&&(h<p||h===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>aL(i.prev,i,r.prev)&&0>aL(r.next,i,i.next))))&&(n=a,p=h)),a=a.next;while(a!==l);return n}(t,e)){var i=az(e,t);aO(e,e.next),aO(i,i.next)}})(c[n],i),i=aO(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],c=t[m+1],u<n&&(n=u),c<a&&(a=c),u>o&&(o=u),c>s&&(s=c);h=0!==(h=Math.max(o-n,s-a))?1/h:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=aI(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,a,o,s,u,c=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(u=c;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,c*=2}while(o>1)}(n)}(e,n,a,o);for(var u,c,h=e;e.prev!==e.next;){if(u=e.prev,c=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(aL(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,c=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,h=aI(o,s,e,i,r),l=aI(u,c,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&aM(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&aL(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&aM(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&aL(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&aM(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&aL(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&aM(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&aL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(aL(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(aM(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&aL(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+aG),i.push(e.i/r+aG),i.push(c.i/r+aG),aU(e),e=c.next,h=c.next;continue}if((e=c)===h){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!aP(n,a)&&aV(n,r,r.next,a)&&aN(n,a)&&aN(a,n)&&(e.push(n.i/i+aG),e.push(r.i/i+aG),e.push(a.i/i+aG),aU(r),aU(r.next),r=t=a),r=r.next}while(r!==t);return aO(r)}(aO(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,c,h=s.next.next;h!==s.prev;){if(s.i!==h.i&&(u=s,c=h,u.next.i!==c.i&&u.prev.i!==c.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&&aV(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,c)&&(aN(u,c)&&aN(c,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,c)&&(aL(u.prev,u,c.prev)||aL(u,c.prev,c))||aP(u,c)&&aL(u.prev,u,u.next)>0&&aL(c.prev,c,c.next)>0))){var l=az(s,h);s=aO(s,s.next),l=aO(l,l.next),t(s,i,r,n,a,o),t(l,i,r,n,a,o);return}h=h.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(aO(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,h),p}function aX(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,c=0;c<o.length;c++)u+=o[c].length-1;var h,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=(h=d[4])?d[3]:d[2],g=h?d[2]:d[3]);for(var x=[0,0],b=0===h?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],S=s[T+1]||s[0],C=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,a,o,s){var u=1-e,c=u*u*u,h=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=c*i[0]+h*n+l*o+f*r[0],t[1]=c*i[1]+h*a+l*s+f*r[1]})(C,E[A],_,S,_[4],_[5],S[2],S[3]),i=C[0],r=C[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,aW(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=aj(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function aH(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tO.SHAPE_POINTS,t.p],s:[tO.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tO.SHAPE_POINTS,t.g.p],s:[tO.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var c=aX(n[u],{indexBase:a,uvTransform:e});a+=c.aPoint.length/5,r.push(c),o+=c.aPoint.length,s+=c.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(o),l=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];h.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:h,index:l}}function aW(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var aY=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=eo(r,nv)?r:nR(r),this.cycles=+n||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}(),aZ=function(t){this.content=t},aq=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 aZ(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 aZ(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,a=t.next;n.next=a,a&&(a.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}(),aQ=new ip,aK=new ip,aJ=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?nR(1):s,c=i.widthOverTrail,h=i.name,l=i.occlusion,f=i.blending,d=i.maskMode,p=i.textureMap,m=i.texture,v=i.transparentOcclusion,y=i.minimumVertexDistance,g=i.lifetime,x=i.matrix,b=e.gpuCapability,T=b.detail,E=b.level,_=Math.max(i.pointCountPerTrail,2),S=nP(),C=T.maxVertexTextures>0,A=(null!=(r=e.renderer)?r:{}).env,w={},O=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===nd]],R=o>64,I=0;n&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,w.uColorOverLifetime=i1.createWithData(e,eA(n))),a&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,w.uColorOverTrail=i1.createWithData(e,eA(a))),R?(O.push(["ATTR_TRAIL_START",1]),I|=8):w.uTrailStart=new Float32Array(o),w.uOpacityOverLifetimeValue=u.toUniform(S);var M=c.toUniform(S);O.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),w.uVCurveValues=nv.getAllData(S);var L={shader:{vertex:rw,fragment:rC,macros:O,glslVersion:1===E?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+I+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=_*o*2,V=(_-1)*o,F=Float32Array.BYTES_PER_ELEMENT,D=12*F,N={attributes:{aColor:{size:4,stride:D,data:new Float32Array(12*P)},aSeed:{size:1,stride:D,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:D,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:D,offset:8*F,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(P)},aDir:{size:3,data:new Float32Array(3*P)}},indices:{data:new Uint16Array(6*P)},drawCount:6*V,name:"trail#"+h,bufferUsage:iA.DYNAMIC_DRAW};if(R)N.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var z=new Float32Array(P);N.attributes.aTrailStartIndex={size:1,data:z};for(var k=0;k<o;k++)for(var U=2*_,B=k*U,G=0;G<U;G++)z[B+G]=k}var j=iR(f),X=ri.create(e,L);X.blending=!0,X.depthMask=l,X.depthTest=!0,iL(X,d),iI(X,f);var H=this.mesh=rg.create(e,{name:"MTrail_"+h,material:X,geometry:ru.create(e,N)}),W=null!=m?m:i1.createWithData(e);Object.keys(w).map(function(t){var e=w[t];if(eo(e,i1))X.setTexture(t,e);else if("uTrailStart"===t)X.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new iy(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}X.setVector4Array(t,i)}else X.setVector4(t,iy.fromArray(e))}),X.setFloat("uTime",0),X.setVector4("uWidthOverTrail",iy.fromArray(M)),X.setVector2("uTexOffset",new id(0,0)),X.setVector4("uTextureMap",iy.fromArray(void 0===p?[0,0,1,1]:p)),X.setVector4("uParams",new iy(0,_-1,0,0)),X.setTexture("uMaskTex",W),X.setVector4("uColorParams",new iy(m?1:0,+j,0,+(l&&!v))),this.maxTrailCount=o,this.pointCountPerTrail=_,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=R,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=H.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,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,c=(r-2)%n,h=this.getTrailPosition(t,u,aQ);if(!(h&&this.checkVertexDistance&&(null==h?void 0:h.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=a2(h,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),a.setAttributeSubData("aDir",6*l,v),a.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,a.setAttributeSubData("aColor",24*l,g),u>=0){var b=new Float32Array(a2(this.getTrailPosition(t,c,aK),h,e)),T=(t*n+u)*6;a.setAttributeSubData("aDir",T,b),a.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*s+E,2*s+E,2*u+1+E,2*s+1+E]),S=(t*o+(r-1)%o)*6;a.setIndexSubData(S,_)}r=++this.trailCursors[t];var C=this.mesh.material,A=C.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var O=2*n,R=new Float32Array(O),I=0;I<O;I++)R[I]=w;a.setAttributeSubData("aTrailStart",t*R.length,R)}else{var M=C.getFloats("uTrailStart");void 0!=M&&(M[t]=w,C.setFloats("uTrailStart",M))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),C.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.geometry.getAttributeData("aColor");return eI(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();eI(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");eI(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();eI(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){},e3(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}(),a$=new ip,a0=new ip,a1=new ip;function a2(t,e,i){return t||i?(t?i?(a0.subtractVectors(e,t).normalize(),a0.subtractVectors(i,e),a1.copyFrom(a0).normalize(),a$.addVectors(a0,a1)):a$.subtractVectors(e,t):a$.subtractVectors(i,e),a$.normalize().toArray()):[0,0,0]}var a3=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new oo(e,i)),r&&(n.trailMesh=new aJ(e,r));var n,a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}e$(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=io(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 iy;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){for(var e,i=io(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}(ir);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)===tL.removeParticle,ray:t})}}},r&&n.fromData(r),n}e$(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.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]===tO.CONSTANT_VEC3?e.add(r[1]):t=nR(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,a=e.clone();if(t&&a.add(t.getValue(0)),this.transform.setPosition(a.x,a.y,a.z),this.options.particleFollowParent&&n){var o=n.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},r.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var a=this.item.duration;n.add(r.getValue(t/a))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var o=e.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},r.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 a=r.first;r.removeNode(a),i=n[1]=a.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())},r.setVisible=function(t){this.renderer.setVisible(t)},r.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 iy(n[0],n[1],n[2],t));for(var a=r.getAttributeData("aColor")||[],o=0;o<a.length;o+=32)a[8*o+7]=t},r.setColor=function(t,e,i,r){var n,a=this.renderer.particleMesh.mesh.material,o=this.renderer.particleMesh.mesh.geometry,s=(null==(n=a.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];a.setVector4("uOpacityOverLifetimeValue",new iy(s[0],s[1],s[2],r));for(var u=o.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=i,u[8*c+7]=r},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.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 aq(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},r.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,c=!1,h=function(){e.trails&&!c&&(c=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(this.ended){if(this.item.endBehavior!==tI.restart&&tI.destroy===this.item.endBehavior){var l=o.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/a.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=o.first;return e.emissionStopped||o.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=a.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var S=T[E],C=!S.disabled&&S.getGeneratorOptions(u,d);if(C){var A=[0,0,0],w=a.burstOffsets[E],O=w&&w[C.cycleIndex]||A;S.once&&this.removeBurst(E);for(var R=0;R<C.count&&_<y&&!g();R++){var I,M=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:R,burstCount:C.count}));M.delay+=i,_++,(I=M.transform).translate.apply(I,[].concat(O)),this.addParticle(M,y)}}}}else this.item.endBehavior===tI.restart?(h(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,a.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===tI.freeze&&(this.frozen=!0))}h()}},r.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}})}))},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);i.push({center:c,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new ip,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],c=s[1];s[2];var h=s[3];if(u>this.timePassed){var l=this.getPointPosition(h),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(o=!0))}else break}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),c=1,h=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(c*=u[0]),a.sizeAffectsLifetime&&(h*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&o.subtract(l)}n.addTrailPoint(t,o,{color:s,lifetime:h,size:c,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.lastUpdate-n,u=new ip,c=ip.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var h=r2(new ip,this.options,c,s,r,u,i);if(o){var l=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;h.x=h.x*d+l[0]*f,h.y=h.y*d+l[1]*f,h.z=h.z*d+l[2]*f}return h},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),c=a.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),h=t.position,l=new ar({position:c.transformPoint(h,new ip),valid:!0}),f=t.direction;if(f=c.transformNormal(f,a4).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)a7.setElement(d,a.turbulence[d].getValue(o));ot.setFromVector3(a7.negate()),oi.setFromEuler(ot).transformNormal(f).normalize()}s.alignSpeedDirection?(a9.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=ip.Z.clone(),c.transformNormal(this.upDirectionWorld)),a8.crossVectors(a9,this.upDirectionWorld).normalize(),a8.isZero()&&a8.set(1,0,0)):(a8.set(1,0,0),a9.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=oe)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?a6.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?a6.set(0,0,a.startRotation.getValue(o)):a6.set(0,0,0),l.setRotation(a6.x,a6.y,a6.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)a5.x=a.startSizeX.getValue(o),a5.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);a5.x=v,a5.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new ip;this.transform.assignWorldTRS(void 0,void 0,x),a5.x*=x.x,a5.y*=x.y}return l.setScale(a5.x,a5.y,1),{size:a5,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:a9,dirX:a8,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&eo(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.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))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,a,o,s,u,c,h,l,f,d,p,m=t.options,v=t.positionOverLifetime,y=void 0===v?{}:v,g=t.shape,x=null==y?void 0:y.gravityOverLifetime,b=r3(null==y?void 0:y.gravity),T=t.textureSheetAnimation,E=T?{animationDelay:nR(T.animationDelay||0),animationDuration:nR(T.animationDuration||1),cycles:nR(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[nR(null!=(a=g.turbulenceX)?a:0),nR(null!=(o=g.turbulenceY)?o:0),nR(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=aA(g),this.emission={rateOverTime:nR(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=eo(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new aY(t)})},this.textureSheetAnimation=E;var S=t.renderer||{},C={},A=t.rotationOverLifetime;A&&(C.asRotation=!!A.asRotation,C.z=A.z?nR(A.z):nR(0),A.separateAxes&&(C.x=A.x&&nR(A.x),C.y=A.y&&nR(A.y))),(null==y?void 0:y.forceTarget)&&(c={target:y.target||[0,0,0],curve:nR(y.forceCurve||[tO.LINE,[[0,0],[1,1]]])});var w={x:y.linearX&&nR(y.linearX||0),y:y.linearY&&nR(y.linearY||0),z:y.linearZ&&nR(y.linearZ||0),asMovement:y.asMovement},O={x:y.orbitalX&&nR(y.orbitalX),y:y.orbitalY&&nR(y.orbitalY),z:y.orbitalZ&&nR(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},R=t.sizeOverLifetime||{},I=t.colorOverLifetime,M=(null==R?void 0:R.separateAxes)?{separateAxes:!0,x:nR(R.x),y:nR(R.y)}:{separateAxes:!1,x:nR(("size"in R?R.size:R.x)||1)};S.anchor=S.anchor||[0,0];var L=id.fromArray(S.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:nR(m.startLifetime),startDelay:nR(m.startDelay||0),startSpeed:nR(y.startSpeed||0),startColor:nR(m.startColor),looping:!1,maxCount:null!=(h=m.maxCount)?h:0,gravityModifier:nR(x||0),gravity:b,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&nR(y.speedOverLifetime),linearVelOverLifetime:w,orbitalVelOverLifetime:O,forceTarget:c},m.startRotationZ&&(this.options.startRotation=nR(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=nR(m.startRotationX||0),this.options.startRotationY=nR(m.startRotationY||0),this.options.startRotationZ=nR(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=nR(m.startSizeX),this.options.startSizeY=nR(m.startSizeY)):(this.options.startSize=nR(m.startSize),this.options.sizeAspect=nR(m.sizeAspect||1));var P={meshSlots:m.meshSlots,name:this.name,matrix:iv.IDENTITY,shaderCachePrefix:"",renderMode:S.renderMode||t_.BILLBOARD,side:S.side||tv.DOUBLE,gravity:b,blending:S.blending||tm.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!S.occlusion,transparentOcclusion:!!S.transparentOcclusion,maxCount:m.maxCount,mask:S.mask,maskMode:null!=(l=S.maskMode)?l:ty.NONE,forceTarget:c,diffuse:S.texture,sizeOverLifetime:M,anchor:L};if(I){var V=I.color,F=I.opacity;P.colorOverLifetime={},F&&(P.colorOverLifetime.opacity=nR(I.opacity)),V&&(V[0]===tO.GRADIENT_COLOR?P.colorOverLifetime.color=I.color[1]:V[0]===tO.RGBA_COLOR?P.colorOverLifetime.color=i1.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):eo(V,i1)&&(P.colorOverLifetime.color=V))}var D=[],N=[0,0,1,1];if(t.splits){var z=t.splits[0];N=(f=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(E&&!E.animate)for(var k=f?E.row:E.col,U=f?E.col:E.row,B=E.total||k*U,G=0,j=0;j<k;j++)for(var X=0;X<U&&G<B;X++,G++)D.push([j*N[2]/k+N[0],X*N[3]/U+N[1],N[2]/k,N[3]/U]);else D.push(N);this.uvs=D,P.textureFlip=f;var H=t.trails;H&&(this.trails={lifetime:nR(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},d={name:"Trail",matrix:iv.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture,opacityOverLifetime:nR(H.opacityOverLifetime||1),widthOverTrail:nR(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:S.mask,maskMode:S.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tO.GRADIENT_COLOR&&(d.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tO.GRADIENT_COLOR&&(d.colorOverTrail=H.colorOverTrail[1])),this.renderer=new a3(this.engine,P,d),this.renderer.item=this.item,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(p=W.radius)?p:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},e3(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}(ie),t.ParticleSystem=eu([e8(tH.ParticleSystem)],t.ParticleSystem);var a4=new ip,a5=new id,a6=new rh,a8=new ip,a9=new ip,a7=new ip,ot=new rh,oe=[0,0,0],oi=new iv,or=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}e$(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&eo(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.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}(n9),on=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){return new or(t)},e}(at),oa={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"},oo=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new ip,this.cachedRotationMatrix=new rl,this.cachedLinearMove=new ip,this.tempMatrix3=new rl,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a,o,s,u,c,h,l,f=(null!=(c=e.renderer)?c:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,b=i.gravityModifier,T=i.maxCount,E=i.textureFlip,_=i.useSprite,S=i.name,C=i.gravity,A=i.forceTarget,w=i.side,O=i.occlusion,R=i.anchor,I=i.blending,M=i.maskMode,L=i.mask,P=i.transparentOcclusion,V=i.meshSlots,F=i.renderMode,D=void 0===F?0:F,N=i.diffuse,z=void 0===N?i1.createWithData(e):N,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+D],["ENV_EDITOR",f===nd]],j=e.gpuCapability.level,X=nP(),H=nP(),W=B>0,Y={},Z=0,q=0;this.useSprite=_,W&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,Y.uSpeedLifetimeValue=d.toUniform(X)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,Y.uFSprite=Y.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==p?void 0:p.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,Y.uColorOverLifetime=eo(p.color,i1)?p.color:i1.createWithData(e,eA(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(X):Y.uOpacityOverLifetimeValue=nR(1).toUniform(X),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==m?void 0:m[t])&&(Y["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=m[t].toUniform(X),i=1,q|=1<<7+e,m.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==v?void 0:v[t])&&(Y["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(X),r=1,q|=1<<10+e,h=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==m?void 0:m.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),h&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),Y.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),Y.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(X),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,Y.uSizeYByLifetimeValue=null==y?void 0:null==(l=y.y)?void 0:l.toUniform(X)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(X),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(X),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(X),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),Y.uGravityModifierValue=b.toUniform(X),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(X)),U&&H.max?(q|=1048576,Y.uFCurveValueTexture=i2(e,nv.getAllData(H,!0),H.index,1)):Y.uFCurveValues=nv.getAllData(H);var Q=X.max+X.curves.length-32>B;if(2===j&&(X.max=-1,X.index=V?V[0]:ou(X.index),H.index>0&&(H.max=-1,H.index=V?V[1]:ou(H.index))),Q&&U&&W){var K=i2(e,nv.getAllData(X,!0),X.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=nv.getAllData(X);var J=["-p:",D,q,X.index,X.max,H.index,H.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",X.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",X.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]),this.VERT_MAX_KEY_FRAME_COUNT=X.max;var $={fragment:rC,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+rA,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+S},tt=iR(I);Y.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Y.uMaskTex=z,Y.uColorParams=new Float32Array([z?1:0,+tt,0,+(!!O&&!P)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==C?void 0:C[0])||0,(null==C?void 0:C[1])||0,(null==C?void 0:C[2])||0,0];var te=ri.create(e,{shader:$,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});te.blending=!0,te.depthTest=!0,te.depthMask=!!O,te.stencilRef=L?[L,L]:void 0,iL(te,M),iI(te,I),iM(te,w),Object.keys(Y).map(function(t){var e=Y[t];if(eo(e,i1)){te.setTexture(t,e);return}var i=[];switch(oa[t]){case"vec4":te.setVector4(t,iy.fromArray(e));break;case"vec3":te.setVector3(t,ip.fromArray(e));break;case"vec2":te.setVector2(t,id.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new iy(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}te.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),te.setVector3("emissionColor",new ip(0,0,0)),te.setFloat("emissionIntensity",0);var ti=ru.create(e,(r=4*T,n=this.useSprite,a="particle#"+S,u={aPos:{size:3,offset:0,stride:s=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:s,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"}},n&&(u.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:a,maxVertex:r})),tr=rg.create(e,{name:"MParticle_"+S,material:te,geometry:ti});this.anchor=R,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=b,this.rotationOverLifetime=g,this.maxCount=T,this.textureOffsets=E?[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 eI(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],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.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,a=4*n,o=this.geometry,s=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 c={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(c.aSprite=new Float32Array(12));var l=new ip,f=new im,d=new ip(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=ar.getRotation(f,new rh),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();h&&(r=e.sprite);for(var S=0;S<4;S++){var C=2*S,A=3*S,w=4*S,O=12*S,R=8*S;c.aPos.set(m,O),b.fill(c.aPos,O+3),c.aRot.set(v,R),c.aRot[R+3]=_,c.aRot.set(T,R+4),h&&c.aSprite.set(r,A);var I=e.uv||x;if(I){var M=h?1-y[C+1]:y[C+1];g[0]=I[0]+y[C]*I[2],g[1]=I[1]+M*I[3]}c.aOffset.set(g,w);for(var L=S+S,P=(E[L]-this.anchor.x)*d.x,V=(E[L+1]-this.anchor.y)*d.y,F=0;F<3;F++)c.aPos[O+6+F]=e.dirX.getElement(F)*P,c.aPos[O+9+F]=e.dirY.getElement(F)*V}var D=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var N=ev(o.getIndexData(),6*n,6*i,u);N.set(D,6*t),o.setIndexData(N),this.maxParticleBufferCount=N.length/6}else o.setIndexSubData(6*t,D);Object.keys(c).forEach(function(e){var r=c[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var h=o.getAttributeData(e);eI(h);var l=ev(h,a*n,4*i*n,u);l.set(r,r.length*t),o.setAttributeData(e,l)}else o.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),o.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,c=this.mesh.material.getVector4("uAcceleration"),h=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*l+2],p=a[4*l+3];if(c&&h){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=c.x*m,y=c.y*m,g=c.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*l;if(a[4*l+2]<i){var T=e/1e3*o,E=e/1e3*s,_=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"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var c=o-r[4*u+2],h=r[4*u+3],l=il(c/h,0,1),f=8*u,d=this.cachedRotationVector3.set(n[f],n[f+1],n[f+2]),p=a[8*u+3];this.rotationOverLifetime?this.rotationOverLifetime.asRotation?(this.rotationOverLifetime.x&&(eo(this.rotationOverLifetime.x,nx)?d.x+=this.rotationOverLifetime.x.getValue(l,p):d.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(eo(this.rotationOverLifetime.y,nx)?d.y+=this.rotationOverLifetime.y.getValue(l,p):d.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(eo(this.rotationOverLifetime.z,nx)?d.z+=this.rotationOverLifetime.z.getValue(l,p):d.z+=this.rotationOverLifetime.z.getValue(l))):(this.rotationOverLifetime.x&&(eo(this.rotationOverLifetime.x,nx)?d.x+=this.rotationOverLifetime.x.getIntegrateValue(0,l,p)*h:d.x+=this.rotationOverLifetime.x.getIntegrateValue(0,l,h)*h),this.rotationOverLifetime.y&&(eo(this.rotationOverLifetime.y,nx)?d.y+=this.rotationOverLifetime.y.getIntegrateValue(0,l,p)*h:d.y+=this.rotationOverLifetime.y.getIntegrateValue(0,l,h)*h),this.rotationOverLifetime.z&&(eo(this.rotationOverLifetime.z,nx)?d.z+=this.rotationOverLifetime.z.getIntegrateValue(0,l,p)*h:d.z+=this.rotationOverLifetime.z.getIntegrateValue(0,l,h)*h)):s.setZero(),0===d.dot(d)&&s.identity();var m=Math.PI/180,v=d.x*m,y=d.y*m,g=d.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),_=Math.cos(y),S=Math.cos(g);s.set(S,-T,0,T,S,0,0,0,1),s.multiply(this.tempMatrix3.set(_,0,b,0,1,0,-b,0,_)),s.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var C=9*u,A=s.elements;i.set(A,C),u+4<=t&&(i.set(A,C+9),i.set(A,C+18),i.set(A,C+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=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 s=0;s<t;s+=4){var u=a-r[4*s+2],c=r[4*s+3],h=u/c,l=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(eo(this.linearVelOverLifetime.x,nx)?o.x=this.linearVelOverLifetime.x.getValue(h,l):o.x=this.linearVelOverLifetime.x.getValue(h)),this.linearVelOverLifetime.y&&(eo(this.linearVelOverLifetime.y,nx)?o.y=this.linearVelOverLifetime.y.getValue(h,l):o.y=this.linearVelOverLifetime.y.getValue(h)),this.linearVelOverLifetime.z&&(eo(this.linearVelOverLifetime.z,nx)?o.z=this.linearVelOverLifetime.z.getValue(h,l):o.z=this.linearVelOverLifetime.z.getValue(h))):(this.linearVelOverLifetime.x&&(eo(this.linearVelOverLifetime.x,nx)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,l):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c)),this.linearVelOverLifetime.y&&(eo(this.linearVelOverLifetime.y,nx)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,l):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c)),this.linearVelOverLifetime.z&&(eo(this.linearVelOverLifetime.z,nx)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,l):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),os=[10,32,64,160];function ou(t){for(var e=0;e<os.length;e++){var i=os[e];if(i>t)return i}return t||os[0]}function oc(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===nd]],c=e.level,h=e.detail,l=nP(),f=nP(),d=h.maxVertexUniforms>0,p=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,nL(l,p));var y=o.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=o.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&nL(l,x);var b=o.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])&&(nL(l,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(nL(l,b[n]),o=1,v|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),a&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(nL(l,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,nL(l,T.y)):nL(l,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(nL(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(nL(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(nL(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)}nL(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,nL(l,b.forceCurve));var _=h.halfFloatTexture;_&&f.max&&(v|=1048576);var S=h.maxVertexUniforms,C=l.max+l.curves.length-32>S;al[ac]&&(C=!0),2===c&&(l.max=-1,f.index>0&&(f.max=-1)),C&&_&&d&&(m=1);var A={fragment:rC,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+rA,shared:!0,cacheId:["-p:",s,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:A,vertex:l.index,fragment:f.index}}function oh(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 a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}}var ol=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,a=n.level,o=(null!=r?r:{}).env,s=i.getShaderLibrary(),u=[],c=[],h=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=oc(e,n,o),r=i.shader,u=i.fragment,f=i.vertex;if(c.push(r),h=Math.max(h,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=o)&&(v=""),y=0,g=al[ac]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===nd]],b=nP(),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),nL(b,d.opacityOverLifetime),nL(b,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),{vertex:rw,fragment:rC,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+b.index+"+"+b.max});T.glslVersion=2===a?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,null==s||s.addShader(T)}}),c.forEach(function(e){2===a?(oh(e,l,h),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,null==s||s.addShader(e)}),2===a&&u.forEach(function(t){t.content.options.meshSlots=[l,h]}),Promise.resolve()},i}(eK),of=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK),od=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(eo(e,op))return e.animationStream},t}(),op=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new od(ig(i)),i}return e$(e,t),e}(n9),om=new rh,ov=new ip(1,1,1),oy=new ip,og=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.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 ip(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=nR(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&nR(r.linearX),y:r.linearY&&nR(r.linearY),z:r.linearZ&&nR(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&nR(r.orbitalX),y:r.orbitalY&&nR(r.orbitalY),z:r.orbitalZ&&nR(r.orbitalZ),center:r3(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&nR(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=nR(a.x||1),this.sizeYOverLifetime=nR(a.y||1),this.sizeZOverLifetime=nR(a.z||1)):this.sizeXOverLifetime=nR(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:nR(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=nR(n.x||0),u.y=nR(n.y||0)}this.gravity=ip.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=nR(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?ip.fromArray(r.direction).normalize():new ip,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();eo(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.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){ov.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(ov.y=this.sizeYOverLifetime.getValue(r),ov.z=this.sizeZOverLifetime.getValue(r)):ov.z=ov.y=ov.x;var n=this.originalTransform.scale;e.transform.setScale(ov.x*n.x,ov.y*n.y,ov.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;om.x=s?a(this.rotationOverLifetime.x):0,om.y=s?a(this.rotationOverLifetime.y):0,om.z=o;var u=om.addEulers(this.originalTransform.rotation,om);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(r2(oy,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&oy.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(oy.x,oy.y,oy.z))},i}(op);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new og(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(at),t.TransformPlayableAsset=eu([e8(tH.TransformPlayableAsset)],t.TransformPlayableAsset);var ox=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eo(i,t.VFXItem)&&(i.time=this.time)},i}(n9);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){return new ox(t)},e}(at),t.ActivationPlayableAsset=eu([e8(tH.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}e$(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=io(this.positionCurves);!(r=n()).done;){var a=r.value,o=a.keyFrames.getValue(i),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,c=io(this.rotationCurves);!(u=c()).done;){var h=u.value,l=h.keyFrames.getValue(i),f=this.findTarget(t,h.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=io(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=io(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:nR(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var a,o=io(t.rotationCurves);!(a=o()).done;){var s=a.value,u={path:s.path,keyFrames:nR(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var c,h=io(t.scaleCurves);!(c=h()).done;){var l=c.value,f={path:l.path,keyFrames:nR(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=io(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:nR(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=io(e);!(i=n()).done;){for(var a,o=i.value,s=!1,u=io(r.children);!(a=u()).done;){var c=a.value;if(c.name===o){r=c,s=!0;break}}if(!s)return}return r},e}(it),t.AnimationClip=eu([e8(tH.AnimationClip)],t.AnimationClip);var ob=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eo(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(n9),oT=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===tI.restart?e%=i:this.endBehavior===tI.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}e$(e,t);var i=e.prototype;return i.resolveBinding=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new n9(t)},i.createOutput=function(){return new n7},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=io(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=io(e);!(r=a()).done;){var o=r.value,s=this.createClipPlayable(t,o),u=new oE(o,s,n,this);i.push(u),n.addInput(s,0),n.setInputWeight(s,0)}return n},i.createPlayable=function(t){return new n9(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 oT;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=io(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=io(this.children);!(i=r()).done;)i.value.parent=this},e}(at),eu([e7(oT,void 0)],t.TrackAsset.prototype,"clips",void 0),eu([e7(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=eu([e8(tH.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tc=t.TrackType||(t.TrackType={}))[tc.MasterTrack=0]="MasterTrack",tc[tc.ObjectTrack=1]="ObjectTrack";var oE=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,eo(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tI.destroy?eo(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==t3.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,r),n&&(!eo(o,t.VFXItem)||o.ended||(o.ended=!0,o.onEnd(),o.compositionReusable||o.reusable||(o.dispose(),this.playable.dispose())),this.playable.getPlayState()===t3.Playing&&this.playable.pause());var s=i.toLocalTime(e);this.playable.setTime(s)},e3(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}(),o_=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.processFrame=function(e){var i=e.output.getUserData();if(eo(i,t.VFXItem)){for(var r=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),this.showRendererComponents(i)):(i.transform.setValid(!1),this.hideRendererComponents(i))}},r.hideRendererComponents=function(t){for(var e,i=io(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(t){for(var e,i=io(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled||(r.enabled=!0)}},i}(n9);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createTrackMixer=function(t){return new o_(t)},e}(t.TrackAsset),t.ActivationTrack=eu([e8(tH.ActivationTrack)],t.ActivationTrack);var oS=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time)},e}(n9),oC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){for(var i=!1,r=0,n=0;n<this.getInputCount();n++){var a=this.getInputWeight(n);if(a>0){var o=this.getInput(n);if(!eo(o,oS)){console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");continue}r+=o.value*a,i=!0}}i&&(e[this.propertyName]=r)}},e}(n9),oA=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=e9(e);if(r)for(var n,a=io(Object.keys(r));!(n=a()).done;){var o=n.value,s=e.taggedProperties[o];if(void 0===s&&(s=e[o]),it.is(s))t.collectSerializableObject(s,i);else if(eD(s))for(var u,c=io(s);!(u=c()).done;){var h=u.value;it.is(h)&&t.collectSerializableObject(h,i)}else if(ez(s))for(var l,f=io(Object.keys(s));!(l=f()).done;){var d=s[l.value];it.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iP({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var a,o=io(Object.keys(i));!(a=o()).done;){var s=i[a.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serialize(s,n[s.getInstanceId()])}return n},t.serialize=function(e,i){e.toData(),i||(i={});var r=e9(e);if(r)for(var n,a=io(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:eD(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):it.is(s)?i[o]={id:s.getInstanceId()}:ez(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,c=io(Object.keys(e.taggedProperties));!(u=c()).done;){var h=u.value,l=e.taggedProperties[h];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[h]=l:eD(l)?(i[h]||(i[h]=[]),t.serializeArrayProperty(l,i[h],0)):it.is(l)?i[h]={id:l.getInstanceId()}:ez(l)&&(i[h]||(i[h]={}),t.serializeObjectProperty(l,i[h],0))}return i},t.deserialize=function(e,i){for(var r,n=i.taggedProperties,a=e9(i),o=i.engine,s=io(Object.keys(e));!(r=s()).done;){var u=r.value;if(!a||!a[u]){var c=e[u];n[u]=t.deserializeProperty(c,o,0)}}if(a)for(var h,l=io(Object.keys(a));!(h=l()).done;){var f=h.value,d=e[f];if(void 0!==d){var p=a[f].type;i[f]=t.deserializeProperty(d,o,0,p)}}i.fromData(n)},t.deserializeAsync=function(e,i){return ea(function(){var r,n,a,o,s,u,c,h,l,f,d,p;return ec(this,function(m){switch(m.label){case 0:r=i.taggedProperties,n=e9(i),a=i.engine,o=io(Object.keys(e)),m.label=1;case 1:if((s=o()).done)return[3,4];if(u=s.value,n&&n[u])return[3,3];return c=e[u],[4,t.deserializePropertyAsync(c,a,0)];case 2:r[u]=m.sent(),m.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];h=io(Object.keys(n)),m.label=5;case 5:if((l=h()).done)return[3,8];if(void 0===(d=e[f=l.value]))return[3,7];return p=n[f].type,[4,t.deserializePropertyAsync(d,a,0,p)];case 6:i[f]=m.sent(),m.label=7;case 7:return[3,5];case 8:return i.fromData(r),[2]}})})()},t.checkTypedArray=function(t){return eo(t,Int8Array)||eo(t,Uint8Array)||eo(t,Uint8ClampedArray)||eo(t,Int16Array)||eo(t,Uint16Array)||eo(t,Int32Array)||eo(t,Uint32Array)||eo(t,Float32Array)||eo(t,Float64Array)||eo(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(ez(t)&&1===Object.keys(t).length&&"id"in t&&eF(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return ez(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ek(t)||eo(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(eD(e)){for(var a,o=[],s=io(e);!(a=s()).done;){var u=a.value;o.push(t.deserializeProperty(u,i,r+1,n))}return o}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!ez(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,h,l=io(Object.keys(e));!(h=l()).done;){var f=h.value;c[f]=t.deserializeProperty(e[f],i,r+1)}return c},t.deserializePropertyAsync=function(e,i,r,n){return ea(function(){var a,o,s,u,c,h,l,f,d;return ec(this,function(p){switch(p.label){case 0:if(r>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eD(e))return[3,5];a=[],o=io(e),p.label=1;case 1:if((s=o()).done)return[3,4];return u=s.value,c=a.push,[4,t.deserializePropertyAsync(u,i,r+1,n)];case 2:c.apply(a,[p.sent()]),p.label=3;case 3:return[3,1];case 4:return[2,a];case 5:if(!t.checkDataPath(e))return[3,7];return[4,i.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,p.sent()];case 7:if(!(ez(e)&&e.constructor===Object))return[3,12];h=n?new n:{},l=io(Object.keys(e)),p.label=8;case 8:if((f=l()).done)return[3,11];return d=f.value,[4,t.deserializePropertyAsync(e[d],i,r+1)];case 9:h[d]=p.sent(),p.label=10;case 10:return[3,8];case 11:return[2,h];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,a=io(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:eD(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):it.is(s)?i[o]={id:s.getInstanceId()}:ez(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],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 a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:eD(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):it.is(a)?i[n]={id:a.getInstanceId()}:ez(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),ow=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 n8,t}e$(i,e);var r=i.prototype;return r.onStart=function(){this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tI.destroy&&this.setReusable(!0)},r.setReusable=function(e){for(var r,n=io(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value,o=a.boundObject;if(eo(o,t.VFXItem)){eo(a,t.ObjectBindingTrack)&&(o.reusable=e);var s=o.getComponent(i);s&&s.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.onUpdate=function(t){var e=this.time;this.timelinePlayable.setTime(e),this.graph.evaluate(t)},r.createContent=function(){if(this.item.composition)for(var e,r=io(this.items);!(e=r()).done;){var n=e.value;n.composition=this.item.composition;var a=n.props;if(t.Item.isComposition(a)){this.item.composition.refContent.push(n);var o=a.content.options.refId,s=this.item.composition.refCompositionProps.get(o);if(!s)throw Error("Referenced precomposition with Id: "+o+" does not exist.");var u=n.addComponent(i);oA.deserialize(s,u),u.createContent();for(var c,h=io(u.items);!(c=h()).done;){var l=c.value;l.setInstanceId(eG());for(var f,d=io(l.components);!(f=d()).done;)f.value.setInstanceId(eG())}}}},r.showItems=function(){for(var t,e=io(this.items);!(t=e()).done;)t.value.setVisible(!0)},r.hideItems=function(){for(var t,e=io(this.items);!(t=e()).done;)t.value.setVisible(!1)},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},r.hitTest=function(e,i,r,n,a,o){for(var s,u=[],c=(null==o?void 0:o.stop)||eV,h=(null==o?void 0:o.skip)||eV,l=(null==o?void 0:o.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(o){var l=s.items[o];if(l.getVisible()&&l.transform.getValid()&&!l.ended&&!t.VFXItem.isComposition(l)&&!h(l)){var f=l.getHitTestParams(a);if(f){var d=!1,p=new ip;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,u.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,u.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,S=f.radius;e.intersectSphere({center:_,radius:S},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var C=f.collect(e,new id(i,r));C&&C.length>0&&(C.forEach(function(t){u.push(t)}),d=!0)}if(d){var A={compContent:s.item,id:l.id,name:l.name,position:u[u.length-1],parentId:l.parentId,hitPositions:u,behavior:f.behavior};if(l.emit("click",A),n.push(A),c(A))return{v:n}}}}}(f));if("object"===es(d))return d.v}return n},r.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},r.resolveBindings=function(){for(var t,e=io(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=io(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.resolveTrackBindingsWithRoot(a)}},r.resolveTrackBindingsWithRoot=function(t){for(var e,i=io(t.getChildTracks());!(e=i()).done;){var r=e.value;r.resolveBinding(),this.resolveTrackBindingsWithRoot(r)}},i}(ii),oO=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();eo(e,ow)&&(e.time=this.getTime())},e}(n9),oR=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(eo(e,ow)){for(var i=!1,r=0;r<this.getInputCount();r++)if(this.getInputWeight(r)>0){i=!0;break}i?e.showItems():e.hideItems()}},e}(n9);t.FloatPropertyTrack=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.path="",e.propertyName="",e}e$(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new oC(t);return e.propertyName=this.propertyName,e},i.resolveBinding=function(){for(var t=this.path.split("."),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}t.length>0&&(this.propertyName=t[t.length-1]),this.boundObject=e},e}(t.TrackAsset),eu([e7(void 0,void 0)],t.FloatPropertyTrack.prototype,"path",void 0),t.FloatPropertyTrack=eu([e8("FloatPropertyTrack")],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(t.TrackAsset),t.SpriteColorTrack=eu([e8(tH.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.resolveBinding=function(){if(!this.parent||!eo(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(ow)},r.createTrackMixer=function(t){return new oR(t)},i}(t.TrackAsset),t.SubCompositionTrack=eu([e8(tH.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(t.TrackAsset),t.TransformTrack=eu([e8(tH.TransformTrack)],t.TransformTrack),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){var e=new oS(t);return e.curve=nR(this.curveData),e.value=e.curve.getValue(0),e},e}(at),eu([e7(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=eu([e8("FloatPropertyPlayableAsset")],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){return new oO(t)},e}(at),t.SubCompositionPlayableAsset=eu([e8(tH.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t}e$(i,e);var r=i.prototype;return r.createPlayable=function(e){var i=new oI(e);i.setTraversalMode(t4.Passthrough);for(var r,n=io(this.tracks);!(r=n()).done;){var a=r.value;eo(a,t.ObjectBindingTrack)&&a.create(this)}return i.compileTracks(e,this.tracks),i},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),r},r.fromData=function(t){},i}(at),eu([e7(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=eu([e8(tH.TimelineAsset)],t.TimelineAsset);var oI=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e}e$(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=io(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){this.sortTracks(e);for(var i,r=[],n=io(e);!(i=n()).done;){var a=i.value;r.push(a),this.addSubTracksRecursive(a,r)}for(var o,s=io(r);!(o=s()).done;){var u=o.value,c=u.createPlayableGraph(t,this.clips);this.addInput(c,0);var h=u.createOutput();h.setUserData(u.boundObject),t.addOutput(h),h.setSourcePlayeble(this,this.getInputCount()-1)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new oM(t[i],i));e.sort(oL),t.length=0;for(var r,n=io(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},i.addSubTracksRecursive=function(t,e){for(var i,r=io(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=io(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},e}(n9),oM=function(t,e){this.track=t,this.originalIndex=e};function oL(e,i){var r=e.track.boundObject,n=i.track.boundObject;return eo(r,t.VFXItem)&&eo(n,t.VFXItem)?t.VFXItem.isAncestor(r,n)?-1:t.VFXItem.isAncestor(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}function oP(t,e){return e&&("object"===es(e)||"function"==typeof e)?e:ig(t)}t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.prototype.create=function(e){if(eo(this.boundObject,t.VFXItem)){var i=this.boundObject;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(t.TrackAsset,this,"ParticleTrack");r.boundObject=this.boundObject;var n=r.createClip(on);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}}},i}(t.TrackAsset),t.ObjectBindingTrack=eu([e8(tH.ObjectBindingTrack)],t.ObjectBindingTrack);var oV=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tU.display:r,a=t.textBaseline,o=void 0===a?tB.top:a,s=t.textAlign,u=void 0===s?tG.left:s,c=t.text,h=t.letterSpace,l=void 0===h?0:h,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=c.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=o,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,a=t.fontScale,o=(i-r)/3,s=r+n*a,u=i*(e-1),c=0;switch(this.textBaseline){case tB.top:c=s+o;break;case tB.middle:c=(this.height*a-u+s)/2;break;case tB.bottom:c=this.height*a-u-o}return c},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tG.left:i=t.outlineWidth*t.fontScale;break;case tG.middle:i=(this.width*t.fontScale-e)/2;break;case tG.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),oF=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,a,o,s=t.textColor,u=t.fontSize,c=t.outline,h=t.shadow,l=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,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,c&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!=(r=h.shadowBlur)?r:2,this.shadowColor=null!=(n=h.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=h.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=h.shadowOffsetY)?o:0),this.fontStyle!==tX.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},oD=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 eI(t),t}if(al[ah])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?ep(this.elements,t):t.remove()},t}()),oN=["serif","sans-serif","monospace","courier"],oz=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.name="MText"+oz++,r.geometry=r.createGeometry(iA.TRIANGLES),i&&r.fromData(i),r.canvas=oD.getCanvas(),oD.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),r.setItem(),!i)return oP(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e$(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,a,o,s,u=e.interaction,c=e.options,h=e.listIndex,l=e.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:t_.BILLBOARD,blending:null!=(r=l.blending)?r:tm.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===ty.MASK,side:null!=(a=l.side)?a:tv.DOUBLE,mask:null!=(o=l.mask)?o:0,maskMode:null!=(s=l.maskMode)?s:ty.NONE,order:void 0===h?0:h},this.interaction=u,this.updateWithOptions(c),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(nV),t.TextComponent=eu([e8(tH.TextComponent)],t.TextComponent);var ok=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new oF(t),this.textLayout=new oV(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,a=this.textLayout.width+this.textStyle.fontOffset,o=1,s=0,u=0;u<t.length;u++){var c,h,l=t[u],f=(null!=(h=null==i?void 0:null==(c=i.measureText(l))?void 0:c.width)?h:0)*n;((s+=r)+f>a&&u>0||"\n"===l)&&(o++,s=0),"\n"!==l&&(s+=f)}return o},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&&!eM(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,a=(r.width+i.fontOffset)*n,o=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/r.height)):this.canvas.height=r.height*n;var c=this.canvas.height;e.clearRect(0,0,a,c),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,c),e.scale(1,-1)),e.fillRect(0,0,a,c),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 h=[],l=0,f=r.getOffsetY(i,this.lineCount,u,s),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(h.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)}h.push({y:f,width:l,chars:d,charOffsetX:p}),h.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",i1.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:iA.LINEAR,minFilter:iA.LINEAR,wrapS:iA.CLAMP_TO_EDGE,wrapT:iA.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,a=t.fontStyle,o=""+(e*i).toString()+"px ";return oN.includes(r)?o+=r:o+='"'+r+'"',n!==tj.normal&&(o=n+" "+o),a!==tX.normal&&(o=a+" "+o),o},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],o=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*o+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=i[0],s=i[1],u=i[2],c=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*s+", "+255*u+", "+c+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();eX(t.TextComponent,[ok]);var oU=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK),oB=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(it);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.fromData=function(t){},e}(it),eu([e7(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=eu([e8(tH.BinaryAsset)],t.BinaryAsset);var oG=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 tH.Material:i=ri.create(this.engine);break;case tH.Geometry:i=ru.create(this.engine);break;case tH.Texture:i=i1.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),oA.deserialize(r,i),i},e.loadGUIDAsync=function(e){var i=this;return ea(function(){var r,n,a;return ec(this,function(o){switch(o.label){case 0:if(i.engine.objectInstance[e])return[2,i.engine.objectInstance[e]];if(r=i.findData(e))return[3,2];if(!i.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,i.engine.database.loadGUID(e)];case 1:if(!(n=o.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return i.engine.addInstance(n),[2,n];case 2:switch(r.dataType){case tH.Material:n=ri.create(i.engine);break;case tH.Geometry:n=ru.create(i.engine);break;case tH.Texture:n=i1.create(i.engine);break;default:(a=t.getClass(r.dataType))&&(n=new a(i.engine))}if(!n)return console.error("Constructor for DataType: "+r.dataType+" not found."),[2,void 0];return n.setInstanceId(r.id),i.engine.addInstance(n),[4,oA.deserializeAsync(r,n)];case 3:return o.sent(),[2,n]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e6[t]},t}(),oj=function(){function t(){}return t.prototype.loadGUID=function(t){return ea(function(){return ec(this,function(t){return[2,void 0]})})()},t}();function oX(t,e){if(!t.includes(e))return t.push(e),!0}function oH(t){if(Number.isFinite(t))return[tO.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tO.CONSTANT)return[tO.CONSTANT,t[1]];if("lines"===e)return[tO.LINE,t[1]];if(e===tO.LINE){var r=i.map(function(t){return[tR.LINE,t]});return[tO.BEZIER_CURVE,r]}return"curve"===e||e===tO.CURVE?[tO.BEZIER_CURVE,o9(i)]:t}}function oW(t,e){return Array.isArray(t)&&"random"===t[0]?[tO.CONSTANT,t[1][e]]:oH(t)}function oY(t){return t&&"color"===t[0]?oQ(t[1],!0):[1,1,1,1]}function oZ(t){return t&&"random"===t[0]?[tO.RANDOM,t[1]]:oH(t)}function oq(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=oQ(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tO.GRADIENT_COLOR,i]}}function oQ(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}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]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eo(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=oK(i)),i}function oK(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function oJ(t,e){return Array.isArray(t)?t[0]===tO.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&oq(t[1],e):oq(t,e)}function o$(t){if(t){if(3===t.length)return[tO.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tO.BEZIER_PATH||e===tO.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=o9(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[tO.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function o0(t){for(var e,i=io(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function o1(t){for(var e,i=io(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var o2=Math.cos,o3=Math.sin,o4=Math.PI/180,o5=180/Math.PI;function o6(t,e){return t?[t[0]-.5,.5-t[1]]:e?o8[e]:[0,0]}var o8=((t6={})[tS.PARTICLE_ORIGIN_CENTER]=[0,0],t6[tS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t6[tS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t6[tS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t6[tS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t6[tS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t6[tS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t6[tS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t6[tS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t6);function o9(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]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],c=[t[a+1][0],t[a+1][1]];if(u[0]!=c[0]){var h=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,c),l=h[0],f=h[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([f[0],f[1],c[0],c[1]])}else n[n.length-1].push(c[0]),n[n.length-1].push(c[1])}return n.map(function(t,e){return 0===e?[tR.EASE_OUT,t]:e===n.length-1?[tR.EASE_IN,t]:[tR.EASE,t]})}function o7(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tE.null&&t.endBehavior===tI.destroy&&(t.endBehavior=tI.freeze)})}),t.version="2.1",t}function st(t){for(var e,i=iP({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=io(i.images);!(e=r()).done;)e.value.id=eG();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eG(),t.dataType=tH.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:eG(),dataType:tH.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eG()}}));for(var a,o,s={},u={},c=io(t.compositions);!(o=c()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tI.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tE.particle&&t.content.filter&&delete t.content.filter});for(var e,r=io(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eG(),n.oldId=n.id,n.id=s[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],a=e.parentId.split("^")[1];e.parentId=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=iP({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:eG(),dataType:"TimelineAsset"},u=io(t.items);!(r=u()).done;){var c=e[r.value.id],h=[],l={id:eG(),dataType:"ActivationPlayableAsset"};o.push(l);var f={id:eG(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:l.id}}]};if(h.push({id:f.id}),a.push(f),c.type!==tE.particle){var d={id:eG(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};o.push(d);var p={id:eG(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};h.push({id:p.id}),a.push(p)}if(c.type===tE.sprite||c.type===tE.text){var m={id:eG(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};o.push(m);var v={id:eG(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:m.id}}]};h.push({id:v.id}),a.push(v)}if(c.type===tE.composition){var y={id:eG(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:eG(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:y.id}}]};h.push({id:g.id}),a.push(g)}var x={id:eG(),dataType:"ObjectBindingTrack",children:h,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:c.id}})}for(var b,T=[],E=io(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var S,C=io(a);!(S=C()).done;){var A=S.value;i.miscs.push(A)}for(var w,O=io(o);!(w=O()).done;){var R=w.value;i.miscs.push(R)}}(a,u,i)}();for(var h,l=io(i.items);!(h=l()).done;){var f=h.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===tE.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tE.sprite){var g,x,b,T,E,_,S,C=f.content;C.renderer||(C.renderer={});var A=C.renderer,w=o6(A.anchor,A.particleOrigin),O=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(T=null==O?void 0:O.x)?T:1),f.transform.position.y+=-w[1]*(null!=(E=null==O?void 0:O.y)?E:1)),f.transform.anchor={x:w[0]*(null!=(_=null==O?void 0:O.x)?_:1),y:w[1]*(null!=(S=null==O?void 0:O.y)?S:1)}}}if(f.type===tE.particle){var R=f.content;R.renderer||(R.renderer={});var I=R.renderer;R.renderer.anchor=o6(I.anchor,I.particleOrigin)}if(f.type===tE.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var M=f.pn,L=t.plugins,P=void 0===L?[]:L;void 0!==M&&Number.isInteger(M)&&(f.pluginName=P[M])}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=s[f.content.options.target]),f.type===tE.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===tE.sprite||f.type===tE.particle||f.type===tE.mesh||f.type===tE.skybox||f.type===tE.light||"camera"===f.type||f.type===tE.tree||f.type===tE.interact||f.type===tE.camera||f.type===tE.text||f.type===tE.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eG(),f.content.item={id:f.id},f.dataType=tH.VFXItemData,f.components.push({id:f.content.id})),(f.type===tE.null||f.type===tE.composition)&&(f.components=[],f.dataType=tH.VFXItemData),f.type){case tE.sprite:f.content.dataType=tH.SpriteComponent;break;case tE.particle:f.content.dataType=tH.ParticleSystem;break;case tE.mesh:f.content.dataType=tH.MeshComponent;break;case tE.skybox:f.content.dataType=tH.SkyboxComponent;break;case tE.light:f.content.dataType=tH.LightComponent;break;case"camera":f.content.dataType=tH.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tE.tree:f.content.dataType=tH.TreeComponent;break;case tE.interact:f.content.dataType=tH.InteractComponent;break;case tE.camera:f.content.dataType=tH.CameraController;break;case tE.text:f.content.dataType=tH.TextComponent;break;case tE.spine:f.content.dataType=tH.SpineComponent}}return i.version="3.0",i}function se(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:o$(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:oH(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:oH(n.linearX),linearY:oH(n.linearY),linearZ:oH(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:oH(n.orbitalX),orbitalY:oH(n.orbitalY),orbitalZ:oH(n.orbitalZ),speedOverLifetime:oH(n.speedOverLifetime)};o1(a);var o={options:{startColor:oY(r.startColor)},positionOverLifetime:a};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 s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=oH(s.x),u.y=oH(s.y),u.z=oH(s.z)):u.z=oH(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var h=o.colorOverLifetime={opacity:oH(c.opacity)};c.color&&(h.color=oJ(c.color))}var l=t.sizeOverLifetime;return l&&(o.sizeOverLifetime={separateAxes:l.separateAxes,size:oH(l.size),x:oH(l.x),y:oH(l.y),z:oH(l.z)}),o}var si=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,sr=/^(\d+)\.(\d+)$/,sn=!1;function sa(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(h=(c=t).version)?void 0:h.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tE.mesh||t.type===tE.light)&&(t.endBehavior=1===t.endBehavior?tI.destroy:t.endBehavior)})}),si.test(t.version)){var e,i,r,n,a,o,s,u;return sn=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",st(o7((so="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(so="1.3"),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return ss(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:so,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return su(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u)))}sn=!1;var c,h,l,f,d,p=sr.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=io(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=io(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=o$(a):e[n]=oH(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=d),m<3?st(o7(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var so="1.0";function ss(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eG(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eG(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eG(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eG(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function su(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iP({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return sh(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var sc=[0,0,0,1];function sh(t,e){void 0===e&&(e={});var i=tE.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tE.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),h=t.transform||b(l.transform)):t.particle?(i=tE.particle,h=b((l=t.particle).transform,sn,!0),f=function(t){var e=t.options,i=t.transform,r={type:tg.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iP({},t.shape,{type:tg[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],c=o[2];0===s&&0===u&&0===c&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=oZ(e.turbulenceX),r.turbulenceY=oZ(e.turbulenceY),r.turbulenceZ=oZ(e.turbulenceZ));var h=t.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(t){return o0(t)})),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(t){return o0(t)})),h.rateOverTime&&(h.rateOverTime=oZ(h.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:h,options:{startLifetime:oZ(e.startLifetime),start3DSize:!!e.start3DSize,startSize:oZ(e.startSize),startSizeX:oZ(e.startSizeX),startSizeY:oZ(e.startSizeY),sizeAspect:oZ(e.sizeAspect),maxCount:e.maxCount,startDelay:oZ(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tO.COLORS,t[1].map(function(t){return oQ(t,e)})]:"gradient"===t[0]?oq(t[1],e):"color"===t[0]?[tO.RGBA_COLOR,oQ(t[1],e)]:t}(e.startColor,!0),startRotationZ:oZ(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=oZ(e.startRotationX),l.options.startRotationY=oZ(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:o$(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:oZ(f.x),y:oZ(f.y)}:l.sizeOverLifetime={size:oZ(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?oH(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:oH(e.gravityModifier),startSpeed:oZ(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:oZ(d.linearX),linearY:oZ(d.linearY),linearZ:oZ(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:oZ(d.orbitalX),orbitalY:oZ(d.orbitalY),orbitalZ:oZ(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:oH(d.forceCurve)},o1(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:oZ(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=oH(m.y),l.rotationOverLifetime.x=oH(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:oH(v.opacity)};v.color&&(y.color=oJ(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:oH(g.cycles),animationDelay:oW(g.animationDelay,0),animationDuration:oW(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:oZ(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:oH(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&oJ(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&oJ(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:oZ(x.opacityOverLifetime)}),l.trails&&o1(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(l)):t.sprite?(i=tE.sprite,h=b((l=t.sprite).transform,!1,!0),s=se(o=l,h),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tE.null,h=b((l=t.cal).transform,!1,!0),f=se(l,h)):t.ui?(i=tE.interact,h=b((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tb.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&oY(i.previewColor),behavior:i.behavior||tT.NOTIFY};break;case"drag":e={type:tb.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tb.MESSAGE}}return{options:e}}(l),h.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tE.camera,h=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,a,o={path:o$(null==(a=t.transform)?void 0:a.path),linearX:oH(null==r?void 0:r.translateX),linearY:oH(null==r?void 0:r.translateY),linearZ:oH(null==r?void 0:r.translateZ)};o1(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:oH(null==s?void 0:s.rotateX),y:oH(null==s?void 0:s.rotateY),z:s.separateAxes?oH(null==s?void 0:s.rotateZ):oH(s.rotation)};o1(u),i.rotationOverLifetime=u}return i}(l))),null==(c=f.renderer)?void 0:c.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&oX(e.requires,"anchor")}if(l){var o,s,u,c,h,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tI.restart:tI.destroy:tI.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tI.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:h,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(oX(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 a,o,s,u,c,h,l,f,d,p,m,v,y,g,x,b,T,E,_,S,C,A,w,O,R=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=o2(a*o4/2),c=o2(o*o4/2),h=o2(s*o4/2),l=o3(a*o4/2),f=o3(o*o4/2),d=o3(s*o4/2),sc[0]=l*c*h+u*f*d,sc[1]=u*f*h-l*c*d,sc[2]=u*c*d+l*f*h,sc[3]=u*c*h-l*f*d,sc);r.rotation=(p=[],m=R[0],v=R[1],y=R[2],g=R[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,S=v*b,C=y*T,A=g*T,w=y*x-g*b,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*o5,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-S)*o5,p[2]=Math.atan2(_+A,1-S-C)*o5):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-C)*o5),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 sl=((t8={})[tp.S]=[tp.S,tp.BPlus,tp.APlus],t8[tp.A]=[tp.A,tp.BPlus,tp.APlus],t8[tp.B]=[tp.B,tp.BPlus],t8);function sf(t,e){if(!t||!e)return!0;var i=sl[e];return!!i&&i.includes(t)}function sd(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function sp(t,e,i){return sm.apply(this,arguments)}function sm(){return(sm=ea(function(t,e,i){var r,n;return ec(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,iB(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=sd(e,i)){if(eF(n)&&n!==r.src)return[2,iB(n)];if(eo(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(th=t.Scene||(t.Scene={})).isJSONObject=function(t){return ez(t)&&"jsonScene"in t},th.isURL=function(t){return ez(t)&&"url"in t},th.isWithOptions=function(t){return ez(t)&&"options"in t};var sv=1,sy=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iV),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=sv++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.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},i.loadScene=function(e,i,r){var n=this;return ea(function(){var a,o,s,u,c,h,l,f,d,p,m,v;return ec(this,function(y){return o=eF(e)?e:n.id,s=performance.now(),u=[],l=null!=(h=null==(c=null==i?void 0:i.engine.gpuCapability)?void 0:c.detail.compressedTexture)?h:t.COMPRESSED_TEXTURE.NONE,f={},p=!1,m=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,n.removeTimer(d),e(Error("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."))},1e3*n.timeout),n.timers.push(d)}),v=ea(function(t,e){var i,r,n;return ec(this,function(a){switch(a.label){case 0:if(p)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,u.push("["+t+": "+n.toFixed(2)+"]"),f[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([m,ea(function(){var c,h,p,m,y,g,x,b,T,E,_,S,C,A,w,O,R,I,M,L;return ec(this,function(P){switch(P.label){case 0:if(!eF(e))return[3,2];return h=new URL(e,location.href).href,n.baseUrl=h,[4,v("loadJSON",function(){return n.loadJSON(h)})];case 1:return a=P.sent(),[3,3];case 2:a=e,n.baseUrl=location.href,P.label=3;case 3:if(!t.Scene.isJSONObject(a))return[3,5];return p=(c=iP({},a)).jsonScene,m=c.pluginSystem,y=c.images,g=p.compositions,x=p.images,n.assignImagesToAssets(x,y),[4,Promise.all([v("plugin:processAssets",function(){return n.processPluginAssets(p,m,r)}),v("plugin:precompile",function(){return n.precompile(g,m,i,r)})])];case 4:return P.sent(),[3,10];case 5:return[4,v("processJSON",function(){return n.processJSON(a)})];case 6:return T=(b=P.sent()).jsonScene,E=b.pluginSystem,S=void 0===(_=T.bins)?[]:_,C=T.images,A=T.compositions,w=T.fonts,[4,Promise.all([v("processBins",function(){return n.processBins(S)}),v("processImages",function(){return n.processImages(C,l)}),v("plugin:processAssets",function(){return n.processPluginAssets(T,E,r)}),v("plugin:precompile",function(){return n.precompile(A,E,i,r)}),v("processFontURL",function(){return n.processFontURL(w)})])];case 7:return R=(O=P.sent())[0],I=O[1],[4,v("processTextures",function(){return n.processTextures(I,R,T)})];case 8:return M=P.sent(),c={timeInfos:f,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:E,jsonScene:T,bins:R,images:I,textureOptions:M},[4,v("plugin:prepareResource",function(){return E.loadResources(c,n.options)})];case 9:P.sent(),P.label=10;case 10:return[4,v("prepareAssets",function(){return n.prepareAssets(null==i?void 0:i.engine)})];case 11:return P.sent(),L=performance.now()-s,eP.info("Load asset: totalTime: "+L.toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."),window.clearTimeout(d),n.removeTimer(d),c.totalTime=L,c.startTime=s,c.timeInfos=f,[2,c]}})})()])]})})()},i.precompile=function(t,e,i,r){return ea(function(){return ec(this,function(n){switch(n.label){case 0:if(!i||!i.getShaderLibrary())return[2];return[4,e.precompile(t,i,r)];case 1:return n.sent(),[2]}})})()},i.processJSON=function(t){var e=this;return ea(function(){var i,r,n;return ec(this,function(a){switch(a.label){case 0:return[4,(n=new eq(void 0===(r=(i=sa(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},i.processBins=function(t){var e=this;return ea(function(){var i,r;return ec(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(eo(n,ArrayBuffer))return n;if(sf(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return ea(function(){return ec(this,function(r){return t?[2,Promise.all(t.map(ea(function(t){var r,n,a;return ec(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];eM(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),eP.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},i.processImages=function(e,i){void 0===i&&(i=0);var r=this;return ea(function(){var n,a,o,s,u;return ec(this,function(c){switch(c.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=r.baseUrl,[4,Promise.all(e.map(ea(function(e,n){var u,c,h,l,f,d,p,m,v,y,g,x,b,T,E,_,S,C,A,w;return ec(this,function(O){switch(O.label){case 0:if(u=e.url,c=e.webp,h=e.avif,l=new URL(u,s).href,f=c&&new URL(c,s).href,d=h&&new URL(h,s).href,!("template"in e))return[3,8];if(!(m=(p=e.template).background))return[3,7];v=sd(p,o),y=m.type===tQ.video,g=m&&y?iW:iB,O.label=1;case 1:return O.trys.push([1,6,,7]),[4,iZ(v,g)];case 2:if(!eo(x=O.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[n]={url:x.src,type:t.TextureSourceType.video},[2,x];case 3:return m&&Array.isArray(v)&&o&&(o[m.name]=x.src),r.sourceFrom[n]={url:x.src,type:t.TextureSourceType.image},[4,sp(x,p,o)];case 4:return[2,O.sent()];case 5:return[3,7];case 6:throw b=O.sent(),Error("Failed to load. Check the template or if the URL is "+(y?"video":"image")+" type, URL: "+v+", Error: "+(b.message||b)+".");case 7:return[3,9];case 8:if("compressed"in e&&a&&i){if(T=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?E=T.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(E=T.pvrtc),E)return _=new URL(E,s).href,r.sourceFrom[n]={url:_,type:t.TextureSourceType.compressed},[2,r.loadBins(_)]}else if(eo(e,HTMLImageElement)||eo(e,HTMLCanvasElement)||eo(e,HTMLVideoElement)||eo(e,i1))return[2,e];O.label=9;case 9:if(!d)return[3,11];return[4,ik(l,d)];case 10:return w=O.sent(),[3,13];case 11:return[4,iN(l,f)];case 12:w=O.sent(),O.label=13;case 13:return C=(S=w).url,A=S.image,r.sourceFrom[n]={url:C,type:t.TextureSourceType.image},[2,A]}})})))];case 1:return u=c.sent(),r.assignImagesToAssets(e,u),[2,u]}})})()},i.processPluginAssets=function(t,e,i){var r=this;return ea(function(){var n,a,o,s;return ec(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,i)];case 1:for(a=(n=u.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=n.loadedAssets,s=0;s<a.length;s++)r.assets[a[s].id]=o[s];return[2]}})})()},i.prepareAssets=function(t){var e=this;return ea(function(){var i,r,n,a,o;return ec(this,function(s){if(!t)return[2];for(i=io(Object.keys(e.assets));!(r=i()).done;)n=r.value,a=e.assets[n],(o=new oB(t)).data=a,o.setInstanceId(n),t.addInstance(o);return[2]})})()},i.processTextures=function(e,i,r){var n=this;return ea(function(){var a;return ec(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(ea(function(e,a){var o,s,u,c;return ec(this,function(h){switch(h.label){case 0:if(eo(e,i1))return[2,e];if(!("mipmaps"in e))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,iQ(e,i,n.assets,r.bins)];case 2:return[2,h.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+h.sent()+".");case 4:if(o=e.source,s=e.id,!ez(o))return[3,5];return u=n.assets[o.id],[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,iB(ej(o))];case 6:u=h.sent(),h.label=7;case 7:if(u)return[2,(c=function(e,i,r){var n={id:r,dataType:tH.Texture};if(eo(e,i1))return iP({},e.source,n);if(eo(e,HTMLImageElement)||ek(e))return iP({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iA.LINEAR,magFilter:iA.LINEAR},n);if(eo(e,HTMLVideoElement))return iP({sourceType:t.TextureSourceType.video,video:e,minFilter:iA.LINEAR,magFilter:iA.LINEAR},n);if(eo(e,ArrayBuffer))return iP({},i8(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return iP({sourceType:t.TextureSourceType.data,data:e,wrapS:iA.CLAMP_TO_EDGE,wrapT:iA.CLAMP_TO_EDGE,minFilter:iA.NEAREST,magFilter:iA.NEAREST},n);throw Error("Invalid texture options.")}(u,n.sourceFrom[a],s)).sourceType===t.TextureSourceType.compressed?c:iP({},c,e)];throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return ea(function(){return ec(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)})})]})})()},i.loadBins=function(t){var e=this;return ea(function(){return ec(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)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();sy.fontCache=new Set;var sg=new ip(1,1,1),sx=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=iv.fromIdentity(),this.viewMatrix=iv.fromIdentity(),this.projectionMatrix=iv.fromIdentity(),this.viewProjectionMatrix=iv.fromIdentity(),this.inverseViewMatrix=iv.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tw.portrait:o,u=e.position,c=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===a?1:a,clipMode:s,position:ip.fromArray(void 0===u?[0,0,8]:u),rotation:rh.fromArray(void 0===c?[0,0,0]:c)},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 ip(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 a=i.projectPoint(e).z,o=r.projectPoint(new ip(1,1,a)),s=o.x,u=o.y,c=r.projectPoint(new ip(-1,-1,a));return new ip((s-c.x)/2,(u-c.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 im;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,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,a=t.clipMode,o=t.position;this.projectionMatrix.perspective(e*is,i,r,n,a===tw.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(o,this.getQuat(),sg),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){ar.getRotation(t,this.options.rotation)},e3(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}(),sb=0,sT=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,a=t.pluginSystem,o=t.totalTime,s=i.compositions,u=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var c,h=io(s);!(c=h()).done;){var l=c.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=a,this.totalTime=null!=o?o:0,this.textures=n,sb=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=iP({},t);return this.assembleItems(e),isNaN(e.endBehavior)&&(e.endBehavior=tI.freeze),e.startTime||(e.startTime=0),e},e.assembleItems=function(t){this.mask++;var e={},i=[];if(this.jsonScene){for(var r,n=io(this.jsonScene.components);!(r=n()).done;){var a=r.value;e[a.id]=a}for(var o,s=io(t.items);!(o=s()).done;){var u=o.value,c=this.engine.jsonSceneData[u.id];if(sf(c.renderLevel,this.renderLevel)){if(c.listIndex=sb++,c.type===tE.sprite||c.type===tE.particle)for(var h,l=io(c.components);!(h=l()).done;){var f=e[h.value.id];this.preProcessItemContent(f)}if(c.type===tE.composition){var d=c.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;void 0!==(e=Number.isInteger(n)?null==(i=this.jsonScene)?void 0:i.shapes[n]:n)&&(t.renderer.shape=aH(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!==ty.NONE&&(t.mask||(e===ty.MASK?t.mask=++this.mask:e!==ty.OBSCURED&&e!==ty.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}(),sE=function(){function t(){this.update=new sS,this.lateUpdate=new sC}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==ie.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==ie.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==ie.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==ie.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),s_=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}(),sS=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=io(t);!(i=r()).done;)i.value.onUpdate(e)},e}(s_),sC=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=io(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(s_),sA=function(e){function i(i,r){(n=e.call(this)||this).sceneTicking=new sE,n.speed=1,n.loaderData={},n.refContent=[],n.refCompositionProps=new Map,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.lastVideoUpdateTime=0;var n,a,o=i.reusable,s=void 0!==o&&o,u=i.speed,c=i.baseRenderOrder,h=i.renderer,l=i.event,f=i.width,d=i.height,p=i.handleItemMessage;n.compositionSourceManager=new sT(r,h.engine),s&&(n.keepResource=!0,r.textures=void 0,r.consumed=!0);var m=n.compositionSourceManager,v=m.sourceContent,y=m.pluginSystem,g=m.imgUsage,x=m.totalTime,b=m.refCompositionProps;return eI(v),n.renderer=h,n.refCompositionProps=b,n.rootItem=new t.VFXItem(n.getEngine(),v),n.rootItem.name="rootItem",n.rootItem.composition=ig(n),n.rootComposition=n.rootItem.addComponent(ow),n.width=f,n.height=d,n.renderOrder=void 0===c?0:c,n.id=v.id,n.renderer=h,n.texInfo=s?{}:g,n.event=l,n.statistic={loadStart:null!=(a=r.startTime)?a:0,loadTime:null!=x?x:0,compileTime:0,firstFrameTime:0},n.reusable=s,n.speed=void 0===u?1:u,n.autoRefTex=!n.keepResource&&n.texInfo&&n.rootItem.endBehavior!==tI.restart,n.name=v.name,n.pluginSystem=y,n.pluginSystem.initializeComposition(ig(n),r),n.camera=new sx(n.name,iP({},null==v?void 0:v.camera,{aspect:f/d})),n.url=r.url,n.assigned=!0,n.interactive=!0,n.handleItemMessage=p,n.createRenderFrame(),n.rendererOptions=null,oA.deserialize(v,n.rootComposition),n.rootComposition.createContent(),n.buildItemTree(n.rootItem),n.rootItem.onEnd=function(){window.setTimeout(function(){n.emit("end",{composition:ig(n)})},0)},n.pluginSystem.resetComposition(ig(n),n.renderFrame),n}e$(i,e);var r=i.prototype;return r.initializeSceneTicking=function(t){for(var e,i=io(t.components);!(e=i()).done;){var r=e.value;this.sceneTicking.addComponent(r)}for(var n,a=io(t.children);!(n=a()).done;){var o=n.value;this.initializeSceneTicking(o)}},r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.items.forEach(function(e){e.setVisible(t)})},r.getSpeed=function(){return this.speed},r.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new rG({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.speed,i=this.paused;i&&this.resume(),this.rootComposition.isStartCalled||(this.rootComposition.onStart(),this.rootComposition.isStartCalled=!0),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&this.pause()},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.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)},r.reset=function(){this.rendererOptions=null,this.rootItem.ended=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;e._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.gatherRendererComponent(this.rootItem,e),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},r.gatherRendererComponent=function(t,e){for(var i,r=io(t.rendererComponents);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var a,o=io(t.children);!(a=o()).done;){var s=a.value;this.gatherRendererComponent(s,e)}},r.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.shouldDispose()&&this.dispose()}},r.toLocalTime=function(t){var e=t-this.rootItem.start,i=this.rootItem.duration;if(e-i>.001)switch(this.rootItem.ended||(this.rootItem.ended=!0,this.emit("end",{composition:this})),this.rootItem.endBehavior){case tI.restart:e%=i,this.restart();break;case tI.freeze:e=Math.min(i,e);case tI.forward:case tI.destroy:}return e},r.shouldDispose=function(){return this.rootItem.ended&&this.rootItem.endBehavior===tI.destroy&&!this.reusable},r.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},r.callAwake=function(t){for(var e,i=io(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=io(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},r.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(ow).items,a=io(n);!(i=a()).done;){var o=i.value;r.set(o.id,o)}for(var s,u=io(n);!(s=u()).done;){var c=s.value;if(void 0===c.parentId)c.setParent(e);else{var h=r.get(c.parentId);if(h)c.parent=h,c.transform.parentTransform=h.transform,h.children.push(c);else throw Error("The element references a non-existent element, please check the data.")}}for(var l,f=io(n);!(l=f()).done;){var d=l.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},r.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)},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},r.updateRootComposition=function(t){if(this.rootComposition.isActiveAndEnabled){var e=this.toLocalTime(this.time+t);this.rootComposition.time=e}},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return r8((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,a=[],o=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(ow))||n.hitTest(o,t,e,a,i,r),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(ow))||s.hitTest(o,t,e,a,i,r)}),a},r.addInteractiveItem=function(t,e){if(e===tb.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},r.removeInteractiveItem=function(t,e){e===tb.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}))},r.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()}}},r.destroyItem=function(t){var e=this;t.type==tE.composition?t.endBehavior!==tI.freeze&&t.getComponent(ow).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(em(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},r.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()},r.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},a=this.textures;a&&this.keepResource&&a.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eV)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eP.error("Update disposed composition: "+r.name+".")},this.dispose=eV,a&&this.keepResource&&a.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==nd&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.rootItem.translate(t,e,i)},r.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},r.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},r.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},r.scale=function(t,e,i){this.rootItem.scale(t,e,i)},r.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return ea(function(){return ec(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]}})})()},e3(i,[{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)}}]),i}(an),sw=new Int32Array(2),sO=new Float32Array(sw.buffer),sR=new Float64Array(sw.buffer),sI=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tl=t9||(t9={}))[tl.UTF8_BYTES=1]="UTF8_BYTES",tl[tl.UTF16_STRING=2]="UTF16_STRING";var sM=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 sw[0]=this.readInt32(t),sO[0]},e.readFloat64=function(t){return sw[sI?0:1]=this.readInt32(t),sw[sI?1:0]=this.readInt32(t+4),sR[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){sO[0]=e,this.writeInt32(t,sw[0])},e.writeFloat64=function(t,e){sR[0]=e,this.writeInt32(t,sw[sI?0:1]),this.writeInt32(t+4,sw[sI?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===t9.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}(),sL=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=sM.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,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))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:(eo(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=sM.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),sP=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 sV(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}(),sV=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=sP.createDataVector(t,this.data);return sP.createFBEffectsObjectData(t,e,i)},t}(),sF=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 sP).__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 sD(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}(),sD=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sF.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sF.createFBEffectsPackageData(t,e)},t}(),sN=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 sz(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}(),sz=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 sN.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),sk=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 sU(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,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),sU=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 sk.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sB=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 sk).__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 sG(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}(),sG=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=sB.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sB.createFBVertexData(t,this.vertexCount,e)},t}(),sj=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 sB).__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 sN).__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 sX(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}(),sX=function(){function t(t,e,i,r,n,a,o,s,u,c,h,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===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===c&&(c=[]),void 0===h&&(h=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=c,this.rootBoneName=h,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=sj.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=sj.createBinaryDataVector(t,this.binaryData),s=sj.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,c=sj.createInverseBindMatricesVector(t,this.inverseBindMatrices);return sj.startFBGeometryData(t),sj.addId(t,e),sj.addName(t,i),sj.addVertexData(t,r),sj.addIndexFormat(t,this.indexFormat),sj.addIndexOffset(t,this.indexOffset),sj.addSubMeshes(t,n),sj.addMode(t,this.mode),sj.addBuffer(t,a),sj.addBinaryData(t,o),sj.addBoneNames(t,s),sj.addRootBoneName(t,u),sj.addInverseBindMatrices(t,c),sj.endFBGeometryData(t)},t}(),sH=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 sL(1),i=new sD,r=[],n=io(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===tH.Geometry&&(o=new sV("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,sF.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new sM(t),i=sF.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===tH.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new sL(1),i=new sX,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,c=t.rootBoneName,h=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===c?"":c,i.inverseBindMatrices=void 0===h?[]:h,i.binaryData=void 0===l?[]:l;var f=new sG;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=io(s.channels);!(d=p()).done;){var m=d.value,v=new sU(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=io(t.subMeshes);!(y=x()).done;){var b=y.value,T=new sz(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,sF.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new sM(t),o=sj.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var c=0;c<u.channelsLength();c++){var h,l=u.channels(c);if(l){var f={semantic:null!=(h=l.semantic())?h:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:tH.Geometry}},t}(),sW=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 oG(this),this.emptyTexture=i4(this),this.transparentTexture=i5(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,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,c=i.animations,h=i.bins,l=void 0===h?[]:h,f=i.miscs,d=io(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=io(void 0===a?[]:a);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=io(void 0===o?[]:o);!(g=x()).done;){var b=g.value;this.addEffectsObjectData(b)}for(var T,E=io(void 0===s?[]:s);!(T=E()).done;){var _=T.value;this.addEffectsObjectData(_)}for(var S,C=io(void 0===u?[]:u);!(S=C()).done;){var A=S.value;this.addEffectsObjectData(A)}for(var w,O=io(void 0===c?[]:c);!(w=O()).done;){var R=w.value;this.addEffectsObjectData(R)}for(var I,M=io(void 0===f?[]:f);!(I=M()).done;){var L=I.value;this.addEffectsObjectData(L)}for(var P=0;P<l.length;P++){var V=l[P],F=t.bins[P];if(V.dataType===tH.BinaryAsset)V.buffer=F,V.id&&this.addEffectsObjectData(V);else{var D=new sH;D.deserializeFromBinary(new Uint8Array(F));for(var N,z=io(D.exportObjectDatas);!(N=z()).done;){var k=N.value;this.addEffectsObjectData(k)}}}for(var U,B=io(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return ea(function(){var i,r,n,a;return ec(this,function(o){switch(o.label){case 0:i=io(t.jsonScene.items),o.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(a=(n=r.value).type)||"camera"===a||a===tE.sprite||a===tE.particle||a===tE.mesh||a===tE.skybox||a===tE.light||a===tE.tree||a===tE.interact||a===tE.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:o.sent(),o.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||ep(this.textures,t)},e.removeTexture=function(t){this.destroyed||em(this.textures,t)},e.addMaterial=function(t){this.destroyed||ep(this.materials,t)},e.removeMaterial=function(t){this.destroyed||em(this.materials,t)},e.addGeometry=function(t){this.destroyed||ep(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||em(this.geometries,t)},e.addMesh=function(t){this.destroyed||ep(this.meshes,t)},e.removeMesh=function(t){this.destroyed||em(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||ep(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||em(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&&eP.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}},e3(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),sY=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=il(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)},e3(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();eZ("camera",nX,t.VFXItem,!0),eZ("text",oU,t.VFXItem,!0),eZ("sprite",n6,t.VFXItem,!0),eZ("particle",ol,t.VFXItem,!0),eZ("cal",of,t.VFXItem,!0),eZ("interact",nK,t.VFXItem,!0),eP.info("Core version: 2.1.0-alpha.7.");var sZ=((t7={})[iA.ONE]=er.OneFactor,t7[iA.ZERO]=er.ZeroFactor,t7[iA.SRC_COLOR]=er.SrcColorFactor,t7[iA.SRC_ALPHA]=er.SrcAlphaFactor,t7[iA.ONE_MINUS_SRC_COLOR]=er.OneMinusSrcColorFactor,t7[iA.ONE_MINUS_SRC_ALPHA]=er.OneMinusSrcAlphaFactor,t7[iA.DST_COLOR]=er.DstColorFactor,t7[iA.DST_ALPHA]=er.DstAlphaFactor,t7[iA.ONE_MINUS_DST_COLOR]=er.OneMinusDstColorFactor,t7[iA.ONE_MINUS_DST_ALPHA]=er.OneMinusDstAlphaFactor,t7),sq=((et={})[iA.NEVER]=er.NeverStencilFunc,et[iA.EQUAL]=er.EqualStencilFunc,et[iA.LESS]=er.LessStencilFunc,et[iA.LEQUAL]=er.LessEqualStencilFunc,et[iA.ALWAYS]=er.AlwaysStencilFunc,et[iA.NOTEQUAL]=er.NotEqualStencilFunc,et[iA.GREATER]=er.GreaterStencilFunc,et[iA.GEQUAL]=er.GreaterEqualStencilFunc,et),sQ=((ee={})[iA.KEEP]=er.KeepStencilOp,ee[iA.ZERO]=er.ZeroStencilOp,ee[iA.REPLACE]=er.ReplaceStencilOp,ee[iA.INCR]=er.IncrementStencilOp,ee[iA.DECR]=er.DecrementStencilOp,ee[iA.INCR_WRAP]=er.IncrementWrapStencilOp,ee[iA.DECR_WRAP]=er.IncrementWrapStencilOp,ee[iA.INVERT]=er.InvertStencilOp,ee),sK=((ei={})[iA.NEVER]=er.NeverDepth,ei[iA.ALWAYS]=er.AlwaysDepth,ei[iA.EQUAL]=er.EqualDepth,ei[iA.LESS]=er.LessDepth,ei[iA.LEQUAL]=er.LessEqualDepth,ei[iA.GREATER]=er.GreaterDepth,ei[iA.GEQUAL]=er.GreaterEqualDepth,ei[iA.NOTEQUAL]=er.NotEqualDepth,ei),sJ=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],s$=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new er.RawShaderMaterial,n.uniforms={};var n,a,o,s,u,c=null==r?void 0:r.shader,h=i.gpuCapability.level;n.shader=new t.Shader(i),n.shader.shaderData=iP({},c,{id:eG(),dataType:tH.Shader,vertex:null!=(a=null==c?void 0:c.vertex)?a:"",fragment:null!=(o=null==c?void 0:c.fragment)?o:""});for(var l=0;l<t.maxSpriteMeshItemCount;l++)n.uniforms["uSampler"+l]=new er.Uniform(null);return n.uniforms.uEditorTransform=new er.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new er.Uniform(new er.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new er.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new er.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new er.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new er.RawShaderMaterial({vertexShader:rF.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==c?void 0:c.vertex)?s:"",macros:null==c?void 0:c.macros,removeVersion:!0}),fragmentShader:rF.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==c?void 0:c.fragment)?u:"",macros:null==c?void 0:c.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:er.LessDepth,polygonOffsetFactor:er.ZeroFactor,polygonOffsetUnits:er.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===h?n.material.glslVersion=er.GLSL1:n.material.glslVersion=er.GLSL3,n}e$(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;sJ.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new er.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new er.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.uniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=io(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=io(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.uniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.uniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.uniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.uniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){return this.uniforms[t].value},r.setColor=function(t,e){this.setUniform(t,e)},r.getQuaternion=function(t){return this.uniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.uniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.uniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.uniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.uniforms[t]},r.setUniform=function(t,e){var i=new er.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t){throw Error("Method not implemented.")},r.disableMacro=function(t){throw Error("Method not implemented.")},r.isMacroEnabled=function(t){throw Error("Method not implemented.")},r.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},e3(i,[{key:"blending",get:function(){return this.material.blending!==er.NoBlending},set:function(t){this.material.blending=t?er.CustomBlending:er.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=sZ[e],this.material.blendDst=sZ[i],this.material.blendSrcAlpha=sZ[r],this.material.blendDstAlpha=sZ[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=sK[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=sq[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=sQ[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=sQ[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=sQ[t[0]])}},{key:"culling",get:function(){return this.material.side!==er.DoubleSide},set:function(t){this.material.side=t?er.FrontSide:er.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tv.FRONT?this.material.side=er.FrontSide:t===tv.BACK&&(this.material.side=er.BackSide)}}]),i}(ri),s0=1,s1=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return oP(r);var r,n=i.drawStart,a=i.drawCount,o=i.indices,s=i.mode,u=i.name,c=void 0===u?"effectsGeometry:"+s0++:u;r.name=c,r.mode=null!=s?s:iA.TRIANGLES;var h=[],l={},f=new er.BufferGeometry;return Object.keys(i.attributes).forEach(function(t){var e=i.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===l[n]&&r.setAttributeType(n,e,f,l,i.maxVertex);var a=e.size,o=e.offset,s=e.normalize,u=l[n],c=u.buffer,d=u.dataLength,p=new er.InterleavedBufferAttribute(c,a,(null!=o?o:0)/d,s);f.setAttribute(t,p),l[t]={buffer:c,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,l,i.maxVertex);h.push(t)}),o&&o.data&&f.setIndex(new er.BufferAttribute(o.data,1)),r.geometry=f,r.attributes=l,r.attributesName=h,r.drawStart=void 0===n?0:n,r.drawCount=null!=a?a:0,r}e$(e,t);var i=e.prototype;return i.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},i.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var i=this.attributes[t].buffer;if(e.length>i.array.length){var r=new er.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=r,this.geometry.setAttribute(t,this.attributes[t].attribute)}else i.set(e,0),i.updateRange.count=e.length,i.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},i.setAttributeSubData=function(t,e,i){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(i,e),this.geometry.attributes[t].needsUpdate=!0)},i.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*rs[e.type]},i.getAttributeNames=function(){return this.attributesName},i.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},i.setIndexData=function(t){t&&(this.geometry.setIndex(new er.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},i.setIndexSubData=function(t,e){var i=this.geometry.getIndex();if(null!==i){var r=t+e.length;if(i.count<r){var n=new e.constructor(end);n.set(i.array),i.array=n}i.array.set(e,t),this.geometry.index.needsUpdate=!0}},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{}},i.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},i.setAttributeType=function(t,e,i,r,n){var a=e.stride,o=e.size,s=e.offset,u=e.normalize,c=e.type,h=void 0===c?iA.FLOAT:c,l=e.data;if(h&&!l&&(l=rc(h)),l){var f=eo(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===a?0:a)/f,p=(n=(null!=n?n:0)*d)||o*f;p&&0===l.length&&(l=eo(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new er.InterleavedBuffer(l,d),v=new er.InterleavedBufferAttribute(m,o,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:h,dataLength:f}}},e3(e,[{key:"drawCount",get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t}},{key:"drawStart",get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t}}]),e}(ru),s2=function(e){function i(t,i){if(!i)return oP(r);var r,n=i.material,a=i.geometry,o=i.priority;return(r=e.call(this,t,i)||this).geometry=a,r.material=n,a.mode===iA.LINES?r.mesh=new er.LineSegments(a.geometry,n.material):r.mesh=new er.Mesh(a.geometry,n.material),r.priority=void 0===o?0:o,r}e$(i,e);var r=i.prototype;return r.setVisible=function(t){this.mesh.visible=t},r.getVisible=function(){return this.mesh.visible},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e,this.mesh.material=e.material},r.onStart=function(){e.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},r.restore=function(){},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},e3(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(rg),s3=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(iP({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a}e$(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.startVideo=function(){var e=this;return ea(function(){var i;return ec(this,function(r){switch(r.label){case 0:if(e.sourceType!==t.TextureSourceType.video||!(i=e.texture.source.data).paused)return[3,2];return[4,i.play()];case 1:r.sent(),r.label=2;case 2:return[2]}})})()},r.assembleOptions=function(e){var r=e.target,n=void 0===r?iA.TEXTURE_2D:r;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=t.TextureSourceType.none),iP({},e,{target:n,format:er.RGBAFormat,type:er.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose()},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,c=i.sourceType,h=er.UVMapping,l=i.format,f=void 0;if(this.sourceType=c,c===t.TextureSourceType.data){var d=e.data;f=new er.DataTexture(d.data,d.width,d.height,l,n,h,a,o,u,s),this.width=d.width,this.height=d.height}else if(c===t.TextureSourceType.image){var p=e.image;f=new er.Texture(p,h,a,o,u,s,l,n),this.width=p.width,this.height=p.height}else if(c===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});l=er.RGBA_ASTC_4x4_Format,f=new er.CompressedTexture(y,m,v,l,n,h,a,o,u,s),this.width=m,this.height=v}else if(c===t.TextureSourceType.video)f=new er.VideoTexture(e.video,h,a,o,u,s,l,n);else if(c===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,E=null!=(b=g.height)?b:0;f=new er.FramebufferTexture(T,E,l),this.width=T,this.height=E}}else c===t.TextureSourceType.none&&((f=new er.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=er.MirroredRepeatWrapping,f.wrapT=er.MirroredRepeatWrapping,this.width=this.height=1);if(f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===iA.LINEAR?er.LinearFilter:er.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iA.MIRRORED_REPEAT:return er.MirroredRepeatWrapping;case iA.REPEAT:return er.RepeatWrapping;default:return er.ClampToEdgeWrapping}},i}(i1),s4=function(t){function e(e,i){return t.call(this,e,i)}e$(e,t);var i=e.prototype;return i.updateVideo=function(){this.textures.map(function(t){return t.startVideo()})},i.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,i=io(this.rootComposition.items);!(e=i()).done;)for(var r,n=e.value.getComponents(ir),a=io(n);!(r=a()).done;){var o=r.value;o.isActiveAndEnabled&&o.render(t)}for(var s,u=io(this.refContent);!(s=u()).done;)for(var c,h=s.value,l=io(h.getComponent(ow).items);!(c=l()).done;)for(var f,d=c.value.getComponents(ir),p=io(d);!(f=p()).done;){var m=f.value;m.isActiveAndEnabled&&m.render(t)}},i.getRendererOptions=function(){var t=s3.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},e}(sA);s4.shape={};var s5=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new rZ(e),i}return e$(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},e}(sW),s6=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new s5(e),i.engine.renderer=ig(i),i.env="",i.renderingData={currentFrame:{}},i}return e$(e,t),e}(rK),s8=function(e){function i(t,i){(r=e.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.renderer=new s6(t),r.width=n,r.height=a,r.camera=o,r}e$(i,e);var r=i.prototype;return r.loadScene=function(t,e){var i=this;return ea(function(){var r,n;return ec(this,function(a){switch(a.label){case 0:if(n=i.baseCompositionIndex,!eD(t))return[3,2];return i.baseCompositionIndex+=t.length,[4,Promise.all(t.map(ea(function(t,r){var a;return ec(this,function(o){switch(o.label){case 0:return[4,i.createComposition(t,e)];case 1:return(a=o.sent()).setIndex(n+r),[2,a]}})})))];case 1:return r=a.sent(),[3,4];case 2:return i.baseCompositionIndex+=1,[4,i.createComposition(t,e)];case 3:(r=a.sent()).setIndex(n),a.label=4;case 4:return[2,r]}})})()},r.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},r.resume=function(){this.compositions.forEach(function(t){t.resume()})},r.createComposition=function(e,i){void 0===i&&(i={});var r=this;return ea(function(){var n,a,o,s,u,c,h,l;return ec(this,function(f){switch(f.label){case 0:return n=performance.now(),a=iP({autoplay:!0},i),o=e,t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(o=e.url),t.Scene.isWithOptions(e)&&(a=iP({},a,e.options||{}))),r.assetManager?r.assetManager.updateOptions(a):r.assetManager=new sy(a),[4,r.assetManager.loadScene(o,r.renderer,{env:r.env})];case 1:for(s=f.sent(),(u=r.renderer.engine).clearResources(),u.addPackageDatas(s),c=0;c<s.textureOptions.length;c++)s.textureOptions[c]=u.assetLoader.loadGUID(s.textureOptions[c].id),s.textureOptions[c].initialize();if(!u.database)return[3,3];return[4,u.createVFXItems(s)];case 2:f.sent(),f.label=3;case 3:return(h=new s4(iP({},a,{width:r.width,height:r.height,renderer:r.renderer,handleItemMessage:function(t){r.dispatchEvent({type:"message",message:t})}}),s)).on("end",function(){r.dispatchEvent({type:"end",composition:h})}),r.renderer.engine.setOptions({threeCamera:r.camera,threeGroup:r,composition:h}),a.autoplay?h.play():h.pause(),l=performance.now()-n+h.statistic.loadTime,h.statistic.firstFrameTime=l,eP.info("First frame: ["+h.name+"]"+l.toFixed(4)+"ms."),r.compositions.push(h),[2,h]}})})()},r.update=function(t){this.compositions.forEach(function(e){e.update(t)})},e3(i,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),i}(er.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===iA.LINES?this.threeMesh=new er.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new er.Mesh(this.geometry.geometry,this.material.material))},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},e3(e,[{key:"priority",get:function(){return this.threeMesh.renderOrder},set:function(t){this.threeMesh&&(this.threeMesh.renderOrder=t)}},{key:"enabled",get:function(){return this.threeMesh.visible},set:function(t){this.threeMesh.visible=t,t&&this.onEnable()}}]),e}(t.SpriteComponent),t.ThreeSpriteComponent=eu([e8(tH.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=oD.getCanvas(),oD.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return oP(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(!1),r}e$(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture(!1)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(!1)},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=eu([e8(tH.TextComponent)],t.ThreeTextComponent),eX(t.ThreeTextComponent,[ok]),n4(8),i1.create=function(t,e){return new s3(t,void 0,e)},i1.createWithData=function(t,e,i){return new s3(t,e,i)},ri.create=function(t,e){return new s$(t,e)},ru.create=function(t,e){return new s1(t,e)},rg.create=function(t,e){return new s2(t,e)};var s9="2.1.0-alpha.7";eP.info("THREEJS plugin version: "+s9+"."),t.AbstractPlugin=eK,t.ActivationPlayable=ox,t.AnimationClipPlayable=ob,t.Asset=oB,t.AssetLoader=oG,t.AssetManager=sy,t.BYTES_TYPE_MAP=rs,t.BaseRenderComponent=nV,t.Behaviour=ii,t.BezierCurve=nS,t.BezierCurvePath=nA,t.BezierCurveQuat=nw,t.CONSTANT_MAP_BLEND=sZ,t.CONSTANT_MAP_DEPTH=sK,t.CONSTANT_MAP_STENCIL_FUNC=sq,t.CONSTANT_MAP_STENCIL_OP=sQ,t.COPY_FRAGMENT_SHADER=i_,t.COPY_MESH_SHADER_ID=iT,t.COPY_VERTEX_SHADER=iE,t.CalculateLoader=of,t.Camera=sx,t.CameraVFXItemLoader=nX,t.Component=ie,t.Composition=sA,t.CompositionComponent=ow,t.CompositionSourceManager=sT,t.DEFAULT_FONTS=oN,t.DEFAULT_FPS=60,t.Database=oj,t.Downloader=iV,t.EFFECTS_COPY_MESH_NAME=ib,t.EVENT_TYPE_CLICK=nH,t.EVENT_TYPE_TOUCH_END=nZ,t.EVENT_TYPE_TOUCH_MOVE=nY,t.EVENT_TYPE_TOUCH_START=nW,t.EffectsObject=it,t.EffectsPackage=sH,t.Engine=sW,t.EventEmitter=an,t.EventSystem=nq,t.Float16ArrayWrapper=r$,t.Framebuffer=rQ,t.GPUCapability=rZ,t.Geometry=ru,t.GlobalUniforms=rH,t.GradientValue=nE,t.HELP_LINK=np,t.InteractLoader=nK,t.InteractMesh=n$,t.KTXTexture=i6,t.LineSegments=n_,t.LinearValue=nT,t.Material=ri,t.MaterialDataBlock=i7,t.Mesh=rg,t.PLAYER_OPTIONS_ENV_EDITOR=nd,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=or,t.ParticleBehaviourPlayableAsset=on,t.ParticleLoader=ol,t.ParticleMesh=oo,t.ParticleSystemRenderer=a3,t.PassTextureCache=ra,t.PathSegments=nC,t.PluginSystem=eq,t.RENDER_PASS_NAME_PREFIX=rU,t.RENDER_PREFER_LOOKUP_TEXTURE=ac,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=ng,t.RandomValue=nx,t.RandomVectorValue=nb,t.RenderFrame=rG,t.RenderPass=rT,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=rx,t.Renderbuffer=rW,t.Renderer=rK,t.RendererComponent=ir,t.RuntimeClip=oE,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=ro,t.SerializationHelper=oA,t.ShaderFactory=rF,t.ShaderVariant=ix,t.SpriteLoader=n6,t.StaticValue=ny,t.TEMPLATE_USE_OFFSCREEN_CANVAS=ah,t.TEXTURE_UNIFORM_MAP=sJ,t.TextComponentBase=ok,t.TextLayout=oV,t.TextLoader=oU,t.TextStyle=oF,t.Texture=i1,t.TextureFactory=i9,t.ThreeComposition=s4,t.ThreeDisplayObject=s8,t.ThreeEngine=s5,t.ThreeMaterial=s$,t.ThreeTexture=s3,t.Ticker=sY,t.TimelineClip=oT,t.TimelinePlayable=oI,t.TrackSortWrapper=oM,t.Transform=ar,t.TransformAnimationPlayable=og,t.ValueGetter=nv,t.addByOrder=eO,t.addItem=ep,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 a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=eX,t.assertExist=eI,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=r2,t.canvasPool=oD,t.colorGradingFrag=rR,t.colorStopsFromGradient=ex,t.colorToArr=ey,t.combineImageTemplate=sp,t.createCopyShader=iS,t.createGLContext=function(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},t.createKeyFrameMeta=nP,t.createShape=aA,t.createValueGetter=nR,t.decimalEqual=r7,t.defaultGlobalVolume={useHDR:!1,useBloom:!0,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:!0},t.defaultPlugins=eW,t.deserializeMipmapTexture=iQ,t.earcut=aj,t.effectsClass=e8,t.effectsClassStore=e6,t.enlargeBuffer=ev,t.ensureFixedNumber=oH,t.ensureVec3=r3,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=rI,t.gaussianDownVFrag=rM,t.gaussianUpFrag=rL,t.generateEmptyTypedArray=rc,t.generateGUID=eG,t.generateHalfFloatTexture=i2,t.generateTransparentTexture=i5,t.generateWhiteTexture=i4,t.getBackgroundImage=sd,t.getColorFromGradientStops=eg,t.getConfig=function(t){return al[t]},t.getDefaultTextureFactory=function(){return tJ||(tJ=new i9),tJ},t.getGeometryByShape=aH,t.getGeometryTriangles=aX,t.getImageItemRenderInfo=nF,t.getKTXTextureOptions=i8,t.getKeyFrameMetaByRawValue=nL,t.getMergedStore=e9,t.getParticleMeshShader=oc,t.getPixelRatio=function(){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},t.getPreMultiAlpha=iR,t.getStandardComposition=su,t.getStandardImage=ss,t.getStandardItem=sh,t.getStandardJSON=sa,t.getTextureSize=rj,t.glContext=iA,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tY.Float32;case WebGLRenderingContext.SHORT:return tY.Int16;case WebGLRenderingContext.BYTE:return tY.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tY.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tY.UInt8;default:return tY.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=ea(function(){return ec(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){eF(t)&&(t=ey(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},t.imageDataFromGradient=eA,t.initErrors=iC,t.initGLContext=iw,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=eb,t.isAlipayMiniApp=eS,t.isAndroid=eE,t.isArray=eD,t.isCanvas=ek,t.isFunction=eN,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},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 eS()||eC()},t.isObject=ez,t.isSimulatorCellPhone=e_,t.isString=eF,t.isUniformStruct=rt,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&rt(t[0])},t.isValidFontFamily=eM,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eC,t.itemFrag=rS,t.itemFrameFrag=rE,t.itemVert=r_,t.loadAVIFOptional=ik,t.loadBinary=ij,t.loadBlob=function(t){return iH.apply(this,arguments)},t.loadImage=iB,t.loadMedia=iZ,t.loadVideo=iW,t.loadWebPOptional=iN,t.logger=eP,t.math=rv,t.modifyMaxKeyframeShader=oh,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=eV,t.normalizeColor=oK,t.numberToFix=nt,t.parsePercent=eT,t.particleFrag=rC,t.particleOriginTranslateMap=r6,t.particleUniformTypeMap=oa,t.particleVert=rA,t.passRenderLevel=sf,t.pluginLoaderMap=eH,t.randomInRange=eU,t.registerPlugin=eZ,t.removeItem=em,t.rotateVec2=aW,t.screenMeshVert=rO,t.serialize=function(t,e){return e7(t,e)},t.setBlendMode=iI,t.setConfig=function(t,e){return al[t]=e},t.setDefaultTextureFactory=function(t){tJ=t},t.setMaskMode=iL,t.setMaxSpriteMeshItemCount=n4,t.setRayFromCamera=r8,t.setSideMode=iM,t.setSpriteMeshMaxItemCountByGPU=function(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0},t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new er.Uniform(i)},t.sortByOrder=ew,t.spec=e1,t.spriteMeshShaderFromFilter=n1,t.spriteMeshShaderFromRenderInfo=n3,t.spriteMeshShaderIdFromRenderInfo=n2,t.thresholdFrag=rP,t.throwDestroyedError=eB,t.trailVert=rw,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=r9,t.unregisterPlugin=function(t){delete eY[t],delete eH[t],em(eW,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=r4,t.vecMulCombine=r5,t.version=s9,t.vertexFormatType2GLType=function(t){switch(t){case tY.Float32:return WebGLRenderingContext.FLOAT;case tY.Int16:return WebGLRenderingContext.SHORT;case tY.Int8:return WebGLRenderingContext.BYTE;case tY.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tY.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
6
+ * Version: v2.1.0-alpha.9
7
+ */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,c,h,l,f,d,p,m,v,y,g,x,b,T,E,_,S,C,A,O,w,R,I,M,L,P,V,F,D,N,z,k,U,B,G,j,X,H,W,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,tc,th,tl,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tS,tC,tA,tO,tw,tR,tI,tM,tL,tP,tV,tF,tD,tN,tz,tk,tU,tB,tG,tj,tX,tH,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function en(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function ea(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){en(a,r,n,o,s,"next",t)}function s(t){en(a,r,n,o,s,"throw",t)}o(void 0)})}}function eo(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):eo(t,e)}function es(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function eu(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function ec(t,e){var i,r,n,a,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var eh=new Uint8Array(16),el=[],ef=0;ef<256;++ef)el.push((ef+256).toString(16).slice(1));var ed={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ep(t,e){return t.includes(e)||t.push(e),t}function em(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ev(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 a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}function ey(t,e){var i=[0,0,0,0];if(eF(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}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]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eo(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 eg(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.stop<=e&&e<=o.stop){r=eb(a.color,o.color,(e-a.stop)/(o.stop-a.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 ex(t){var e=[];if(eo(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({stop:eT(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=ey(t[i]);e.push({stop:eT(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 eb(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function eT(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eE(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function e_(){return eE()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eS(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eC(){return"miniprogram"===window.__wxjs_environment}function eA(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=ex(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var a=n/128,o=void 0,s=void 0,u=0;u<r.length&&(o=r[u],s=r[u+1],!(o.stop<=a)||!(s.stop>a));u++);var c=eb(o.color,s.color,(a-o.stop)/(s.stop-o.stop));i.set(c,4*n)}i.set(r[r.length-1].color,508)}return e}function eO(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 a,o,s=e[r],u=r,c=n;u<c;){if(2===i){for(;e[c].priority>s.priority&&c>=u;)c--;for(;e[u].priority<=s.priority&&u<c;)u++}else{for(;e[c].priority<s.priority&&c>=u;)c--;for(;e[u].priority>=s.priority&&u<c;)u++}a=[e[c],e[u]],e[u]=a[0],e[c]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,c+1,n),e}(t,e);for(var r=1;r<i;r++)eR(t,r,e);return t}function ew(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&eR(t,t.length-1,i)),t}function eR(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 eI(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eM(t){return/^[^\d.][\w-]*$/.test(t)}function eL(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var eP={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(eL(t),[r])),null==td||td("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(eL(t))),null==td||td("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(eL(t))),null==td||td("warn",t,r)},register:function(t){t&&eN(t)&&(td=t)}};function eV(){}function eF(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var eD=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eN(t){return"[object Function]"===Object.prototype.toString.call(t)}function ez(t){return"[object Object]"===Object.prototype.toString.call(t)}function ek(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eU(t,e){return t+Math.random()*(e-t)}function eB(){throw Error("Destroyed item cannot be used again.")}function eG(){return(function(t,e,i){if(ed.randomUUID&&!t)return ed.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tf&&!(tf="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 tf(eh)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),el[n[r+0]]+el[n[r+1]]+el[n[r+2]]+el[n[r+3]]+"-"+el[n[r+4]]+el[n[r+5]]+"-"+el[n[r+6]]+el[n[r+7]]+"-"+el[n[r+8]]+el[n[r+9]]+"-"+el[n[r+10]]+el[n[r+11]]+el[n[r+12]]+el[n[r+13]]+el[n[r+14]]+el[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=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var c=new Uint8Array(s);n.push(c)}return new File([new Blob(n,{type:i})],e,{type:i})}function eX(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 eH={},eW=[],eY={};function eZ(t,e,i,r){eY[t]&&eP.error("Duplicate registration for plugin "+t+"."),eY[t]=i,eH[t]=e,r&&ep(eW,t)}var eq=function(){function t(t){var e={},i=[],r=function(t){var r=eH[t];i.includes(r)||(i.push(r),e[t]=r)};eW.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=eH[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=eQ[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 i=this;return ea(function(){return ec(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var i=this;return ea(function(){return ec(this,function(r){return[2,i.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e,i){var r=this;return ea(function(){return ec(this,function(n){return[2,r.callStatic("precompile",t,e,i)]})})()},e.loadResources=function(t,e){var i=this;return ea(function(){return ec(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return ea(function(){var e,r,a,o,s,u;return ec(this,function(c){for(a=0,e=[],r=n.plugins;a<r.length;a++)t in(o=eH[r[a].name])&&e.push(Promise.resolve(null==(u=o[t])?void 0:(s=u).call.apply(s,[].concat([o],i))));return[2,Promise.all(e)]})})()},t}(),eQ={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"},eK=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 eJ(t,e){return(eJ=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function e$(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&&eJ(t,e)}(n=tp||(tp={})).S="S",n.APlus="A+",n.A="A",n.BPlus="B+",n.B="B",(a=tm||(tm={}))[a.ALPHA=0]="ALPHA",a[a.ADD=1]="ADD",a[a.MULTIPLY=2]="MULTIPLY",a[a.BRIGHTNESS=3]="BRIGHTNESS",a[a.SUBTRACTION=4]="SUBTRACTION",a[a.STRONG_LIGHT=5]="STRONG_LIGHT",a[a.WEAK_LIGHT=6]="WEAK_LIGHT",a[a.SUPERPOSITION=7]="SUPERPOSITION",(o=tv||(tv={}))[o.DOUBLE=1032]="DOUBLE",o[o.FRONT=1028]="FRONT",o[o.BACK=1029]="BACK",(s=ty||(ty={}))[s.NONE=0]="NONE",s[s.MASK=1]="MASK",s[s.OBSCURED=2]="OBSCURED",s[s.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(u=tg||(tg={}))[u.NONE=0]="NONE",u[u.SPHERE=1]="SPHERE",u[u.CONE=2]="CONE",u[u.HEMISPHERE=3]="HEMISPHERE",u[u.CIRCLE=4]="CIRCLE",u[u.DONUT=5]="DONUT",u[u.RECTANGLE=6]="RECTANGLE",u[u.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",u[u.EDGE=8]="EDGE",u[u.TEXTURE=9]="TEXTURE",(c=tx||(tx={}))[c.GYROSCOPE=0]="GYROSCOPE",c[c.SPINE=1]="SPINE",(h=tb||(tb={}))[h.CLICK=0]="CLICK",h[h.MESSAGE=1]="MESSAGE",h[h.DRAG=2]="DRAG",(l=tT||(tT={}))[l.NONE=0]="NONE",l[l.NOTIFY=1]="NOTIFY",l[l.RESUME_PLAYER=2]="RESUME_PLAYER",l[l.REMOVE=3]="REMOVE",l[l.PAUSE=4]="PAUSE",(f=tE||(tE={})).base="0",f.sprite="1",f.particle="2",f.null="3",f.interact="4",f.plugin="5",f.camera="6",f.composition="7",f.spine="spine",f.mesh="mesh",f.tree="tree",f.text="text",f.light="light",f.skybox="skybox",f.effect="effect",f.node="node",f.video="video",f.audio="audio",(d=t_||(t_={}))[d.BILLBOARD=0]="BILLBOARD",d[d.MESH=1]="MESH",d[d.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",d[d.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(p=tS||(tS={}))[p.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",p[p.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",p[p.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",p[p.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",p[p.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",p[p.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",p[p.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",p[p.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",p[p.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(m=tC||(tC={})).Opaque="Opaque",m.Transparent="Transparent",(v=tA||(tA={})).Both="Both",v.Back="Back",v.Front="Front",(y=tO||(tO={}))[y.portrait=1]="portrait",y[y.landscape=0]="landscape",(g=tw||(tw={}))[g.CONSTANT=0]="CONSTANT",g[g.CONSTANT_VEC2=1]="CONSTANT_VEC2",g[g.CONSTANT_VEC3=2]="CONSTANT_VEC3",g[g.CONSTANT_VEC4=3]="CONSTANT_VEC4",g[g.RANDOM=4]="RANDOM",g[g.LINE=5]="LINE",g[g.CURVE=6]="CURVE",g[g.BEZIER_PATH=7]="BEZIER_PATH",g[g.RGBA_COLOR=8]="RGBA_COLOR",g[g.GRADIENT_COLOR=9]="GRADIENT_COLOR",g[g.SHAPE_POINTS=10]="SHAPE_POINTS",g[g.SHAPE_SPLITS=11]="SHAPE_SPLITS",g[g.LINEAR_PATH=12]="LINEAR_PATH",g[g.COLORS=13]="COLORS",g[g.BINARY=20]="BINARY",g[g.BEZIER_CURVE=21]="BEZIER_CURVE",g[g.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",g[g.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",g[g.COLOR_CURVE=24]="COLOR_CURVE",g[g.VECTOR4_CURVE=25]="VECTOR4_CURVE",(x=tR||(tR={}))[x.AUTO=0]="AUTO",x[x.EASE=1]="EASE",x[x.EASE_IN=2]="EASE_IN",x[x.EASE_OUT=3]="EASE_OUT",x[x.LINE=4]="LINE",x[x.HOLD=5]="HOLD",x[x.LINE_OUT=6]="LINE_OUT",(b=tI||(tI={}))[b.destroy=0]="destroy",b[b.restart=5]="restart",b[b.forward=2]="forward",b[b.freeze=4]="freeze",(T=tM||(tM={}))[T.destroyChildren=6]="destroyChildren",(E=tL||(tL={}))[E.none=0]="none",E[E.removeParticle=1]="removeParticle",(_=tP||(tP={}))[_.RANDOM=0]="RANDOM",_[_.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",_[_.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",_[_.UNIFORM_BURST=3]="UNIFORM_BURST",(S=tV||(tV={})).point="point",S.spot="spot",S.directional="directional",S.ambient="ambient",(C=tF||(tF={}))[C.box=2]="box",C[C.sphere=3]="sphere",(A=tD||(tD={})).orthographic="orthographic",A.perspective="perspective",(O=tN||(tN={})).unlit="unlit",O.pbr="pbr",O.hair="hair",(w=tz||(tz={}))[w.opaque=100]="opaque",w[w.masked=101]="masked",w[w.translucent=102]="translucent",w[w.additive=103]="additive",(R=tk||(tk={})).none="none",R.uv="uv",R.normal="normal",R.basecolor="basecolor",R.alpha="alpha",R.metallic="metallic",R.roughness="roughness",R.ao="ao",R.emissive="emissive",R.diffuse="diffuse",(I=tU||(tU={}))[I.display=0]="display",I[I.clip=1]="clip",I[I.ellipsis=2]="ellipsis",(M=tB||(tB={}))[M.top=0]="top",M[M.middle=1]="middle",M[M.bottom=2]="bottom",(L=tG||(tG={}))[L.left=0]="left",L[L.middle=1]="middle",L[L.right=2]="right",(P=tj||(tj={})).normal="normal",P.bold="bold",P.lighter="lighter",(V=tX||(tX={})).normal="normal",V.italic="italic",V.oblique="oblique",(F=tH||(tH={})).VFXItemData="VFXItemData",F.EffectComponent="EffectComponent",F.Material="Material",F.Shader="Shader",F.SpriteComponent="SpriteComponent",F.ParticleSystem="ParticleSystem",F.InteractComponent="InteractComponent",F.CameraController="CameraController",F.Geometry="Geometry",F.Texture="Texture",F.AnimationClip="AnimationClip",F.TextComponent="TextComponent",F.BinaryAsset="BinaryAsset",F.TrackAsset="TrackAsset",F.TimelineAsset="TimelineAsset",F.ObjectBindingTrack="ObjectBindingTrack",F.TransformTrack="TransformTrack",F.SpriteColorTrack="SpriteColorTrack",F.ActivationTrack="ActivationTrack",F.SubCompositionTrack="SubCompositionTrack",F.FloatPropertyTrack="FloatPropertyTrack",F.ColorPropertyTrack="ColorPropertyTrack",F.Vector4PropertyTrack="Vector4PropertyTrack",F.TransformPlayableAsset="TransformPlayableAsset",F.SpriteColorPlayableAsset="SpriteColorPlayableAsset",F.ActivationPlayableAsset="ActivationPlayableAsset",F.SubCompositionPlayableAsset="SubCompositionPlayableAsset",F.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",F.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",F.MeshComponent="MeshComponent",F.SkyboxComponent="SkyboxComponent",F.LightComponent="LightComponent",F.CameraComponent="CameraComponent",F.ModelPluginComponent="ModelPluginComponent",F.TreeComponent="TreeComponent",F.AnimationComponent="AnimationComponent",F.SpineComponent="SpineComponent",F.VideoComponent="VideoComponent",F.AudioComponent="AudioComponent",F.TimelineClip="TimelineClip",(D=tW||(tW={}))[D.POINTS=0]="POINTS",D[D.LINES=1]="LINES",D[D.LINE_LOOP=2]="LINE_LOOP",D[D.LINE_STRIP=3]="LINE_STRIP",D[D.TRIANGLES=4]="TRIANGLES",D[D.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",D[D.TRIANGLE_FAN=6]="TRIANGLE_FAN",(N=tY||(tY={}))[N.Float16=0]="Float16",N[N.Float32=1]="Float32",N[N.Int8=2]="Int8",N[N.Int16=3]="Int16",N[N.Int32=4]="Int32",N[N.UInt8=5]="UInt8",N[N.UInt16=6]="UInt16",N[N.UInt32=7]="UInt32",(z=tZ||(tZ={}))[z.None=-1]="None",z[z.UInt8=0]="UInt8",z[z.UInt16=1]="UInt16",z[z.UInt32=2]="UInt32",(k=tq||(tq={})).Position="POSITION",k.Uv="TEXCOORD0",k.Uv2="TEXCOORD1",k.Normal="NORMAL",k.Tangent="TANGENT",k.Color="COLOR",k.Joints="JOINTS",k.Weights="WEIGHTS",k.PositionBS0="POSITION_BS0",k.PositionBS1="POSITION_BS1",k.PositionBS2="POSITION_BS2",k.PositionBS3="POSITION_BS3",k.PositionBS4="POSITION_BS4",k.PositionBS5="POSITION_BS5",k.PositionBS6="POSITION_BS6",k.PositionBS7="POSITION_BS7",k.NormalBS0="NORMAL_BS0",k.NormalBS1="NORMAL_BS1",k.NormalBS2="NORMAL_BS2",k.NormalBS3="NORMAL_BS3",k.TangentBS0="TANGENT_BS0",k.TangentBS1="TANGENT_BS1",k.TangentBS2="TANGENT_BS2",k.TangentBS3="TANGENT_BS3";var e0={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(U=tQ||(tQ={})).video="video",U.image="image",(B=tK||(tK={})).video="video",B.audio="audio";var e1=Object.freeze({__proto__:null,get RenderLevel(){return tp},get BlendingMode(){return tm},get SideMode(){return tv},get MaskMode(){return ty},get ShapeType(){return tg},get PluginType(){return tx},get InteractType(){return tb},get InteractBehavior(){return tT},get ItemType(){return tE},get RenderMode(){return t_},get ParticleOrigin(){return tS},get RenderType(){return tC},get RenderFace(){return tA},get CameraClipMode(){return tO},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 tw},get BezierKeyframeType(){return tR},get EndBehavior(){return tI},get ParentItemEndBehavior(){return tM},get ParticleInteractionBehavior(){return tL},get ShapeArcMode(){return tP},get LightType(){return tV},get ModelBoundingType(){return tF},get CameraType(){return tD},get MaterialType(){return tN},get MaterialBlending(){return tz},get RenderMode3D(){return tk},get TextOverflow(){return tU},get TextBaseline(){return tB},get TextAlignment(){return tG},get TextWeight(){return tj},get FontStyle(){return tX},get DataType(){return tH},get GeometryType(){return tW},get VertexFormatType(){return tY},get IndexFormatType(){return tZ},get VertexBufferSemantic(){return tq},BuiltinObjectGUID:e0,get BackgroundType(){return tQ},get MultimediaType(){return tK}});function e2(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 e3(t,e,i){return e&&e2(t.prototype,e),i&&e2(t,i),t}var e4=new Map,e5=new Map,e6={};function e8(t){return function(e,i){e6[t]&&console.warn("Class "+t+" is already registered."),e6[t]=e}}function e9(t){var e=t.constructor;if(e5.get(e))return e5.get(e);var i={};e5.set(e,i);for(var r=t,n=e;n;){var a=e4.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function e7(t,e){return function(i,r){var n,a=(n=i.constructor,e4.get(n)||e4.set(n,{}),e4.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var it=function(){function t(t){this.engine=t,this.guid=eG(),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 eo(e,t)&&"guid"in e},t}(),ie=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}e$(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.getVisible()&&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&&em(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},e3(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&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}(it);eu([e7(void 0,void 0)],ie.prototype,"_enabled",void 0);var ii=function(t){function e(){return t.apply(this,arguments)}e$(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}(ie),ir=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}e$(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.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&em(this.item.rendererComponents,this),t.prototype.dispose.call(this)},e3(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}(ie);eu([e7(void 0,void 0)],ir.prototype,"materials",void 0),eu([e7(void 0,void 0)],ir.prototype,"_priority",void 0);var ia=Math.PI/180,io=180/Math.PI;function is(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var iu=function(t,e,i){return(1-i)*t+i*e};function ic(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 ih=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):eo(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):eo(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):eo(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):eo(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}();ih.ONE=new ih(1,1),ih.ZERO=new ih(0,0);var il=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):eo(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):eo(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):eo(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):eo(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,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,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 ih(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}();il.X=new il(1,0,0),il.Y=new il(0,1,0),il.Z=new il(0,0,1),il.ONE=new il(1,1,1),il.ZERO=new il(0,0,0);var id=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,a;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!=(a=t[e+3])?a: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):eo(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):eo(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):eo(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):eo(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 il(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}();id.ONE=new id(1,1,1,1),id.ZERO=new id(0,0,0,0);var ip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new n4,e.getHitTestParams=function(t){var i=e.getBoundingBox();if(i)return{type:i.type,triangles:i.area}},e}e$(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.getBoundingBoxData()},e}(ir);function im(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}eu([e7(void 0,void 0)],ip.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="EffectComponent",i}e$(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 id;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}(ip),t.EffectComponent=eu([e8(tH.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.bloomEnabled=!0,e.threshold=1,e.bloomIntensity=1,e.brightness=1,e.saturation=1,e.contrast=1,e.vignetteIntensity=.2,e.vignetteSmoothness=.4,e.vignetteRoundness=1,e.toneMappingEnabled=!0,e}return e$(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(ii),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"bloomEnabled",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"threshold",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"bloomIntensity",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"brightness",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"saturation",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"contrast",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteIntensity",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteSmoothness",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteRoundness",void 0),eu([e7(void 0,void 0)],t.PostProcessVolume.prototype,"toneMappingEnabled",void 0),t.PostProcessVolume=eu([e8("PostProcessVolume")],t.PostProcessVolume);var iv=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),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.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],a=e[1],o=e[5],s=e[9],u=e[2],c=e[6],h=e[10],l=i+o+h;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>h){var d=2*Math.sqrt(1+i-o-h);this.w=(c-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>h){var p=2*Math.sqrt(1+o-i-h);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+c)/p,this.negate()}else{var m=2*Math.sqrt(1+h-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+c)/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(ic(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,a=t.w,o=e.x,s=e.y,u=e.z,c=e.w;return this.x=i*c+a*o+r*u-n*s,this.y=r*c+a*s+n*o-i*u,this.z=n*c+a*u+i*s-r*o,this.w=a*c-i*o-r*s-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,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+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 c=Math.sqrt(s),h=Math.atan2(c,o),l=Math.sin((1-e)*h)/c,f=Math.sin(e*h)/c;return this.w=a*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,a=this.w,o=t.x,s=t.y,u=t.z,c=a*o+r*u-n*s,h=a*s+n*o-i*u,l=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=c*a+-(f*i)+-(h*n)- -(l*r),d.y=h*a+-(f*r)+-(l*i)- -(c*n),d.z=l*a+-(f*n)+-(c*r)- -(h*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(il.ZERO,this,il.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}();iv.tempVec0=new il;var iy=function(){function t(t,e,i,r,n,a,o,s,u,c,h,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===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===h&&(h=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,c,h,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,c,h,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]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=c,v[10]=h,v[11]=l,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,c,h,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]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=c,v[10]=h,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),a=Math.sin(i),o=1-n,s=r.x,u=r.y,c=r.z,h=o*s,l=o*u;return this.set(h*s+n,h*u+a*c,h*c-a*u,0,h*u-a*c,l*u+n,l*c+a*s,0,h*c+a*u,l*c-a*s,o*c*c+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(il.ZERO,t,il.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,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[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,a=i[0],o=i[4],s=i[8],u=i[12],c=i[1],h=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],S=r[12],C=r[1],A=r[5],O=r[9],w=r[13],R=r[2],I=r[6],M=r[10],L=r[14],P=r[3],V=r[7],F=r[11],D=r[15];return n[0]=a*T+o*C+s*R+u*P,n[4]=a*E+o*A+s*I+u*V,n[8]=a*_+o*O+s*M+u*F,n[12]=a*S+o*w+s*L+u*D,n[1]=c*T+h*C+l*R+f*P,n[5]=c*E+h*A+l*I+f*V,n[9]=c*_+h*O+l*M+f*F,n[13]=c*S+h*w+l*L+f*D,n[2]=d*T+p*C+m*R+v*P,n[6]=d*E+p*A+m*I+v*V,n[10]=d*_+p*O+m*M+v*F,n[14]=d*S+p*w+m*L+v*D,n[3]=y*T+g*C+x*R+b*P,n[7]=y*E+g*A+x*I+b*V,n[11]=y*_+g*O+x*M+b*F,n[15]=y*S+g*w+x*L+b*D,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],a=t[1],o=t[5],s=t[9],u=t[13],c=t[2],h=t[6],l=t[10],f=t[14];return t[3]*(+n*s*h-r*u*h-n*o*l+i*u*l+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*a*l-r*a*f+r*u*c-n*s*c)+t[11]*(+e*u*h-e*o*f-n*a*h+i*a*f+n*o*c-i*u*c)+t[15]*(-r*o*c-e*s*h+e*o*l+r*a*h-i*a*l+i*s*c)},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],a=t[4],o=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=h*m*u-p*l*u+p*s*f-o*m*f-h*s*v+o*l*v,g=d*l*u-c*m*u-d*s*f+a*m*f+c*s*v-a*l*v,x=c*p*u-d*h*u+d*o*f-a*p*f-c*o*v+a*h*v,b=d*h*s-c*p*s-d*o*l+a*p*l+c*o*m-a*h*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-h*m*n-p*r*f+i*m*f+h*r*v-i*l*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(h*s*n-o*l*n-h*r*u+i*l*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(c*m*n-d*l*n+d*r*f-e*m*f-c*r*v+e*l*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*l*n-c*s*n+c*r*u-e*l*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*h*n-c*p*n-d*i*f+e*p*f+c*i*v-e*h*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(c*o*n-a*h*n-c*i*u+e*h*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(c*p*r-d*h*r+d*i*l-e*p*l-c*i*m+e*h*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*h*r-c*o*r+c*i*s-e*h*s-a*i*l+e*o*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=il.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,c=-r.x,h=-r.y,l=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,E=u*d,_=u*p,S=i.x,C=i.y,A=i.z;return n[0]=(1-(g+b))*S,n[1]=(v+_)*S,n[2]=(y-E)*S,n[3]=0,n[4]=(v-_)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=c*n[0]+h*n[4]+l*n[8]-c+t.x,n[13]=c*n[1]+h*n[5]+l*n[9]-h+t.y,n[14]=c*n[2]+h*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];var c=t.tempMat0;c.copyFrom(this);var h=1/o,l=1/s,f=1/u;return c.elements[0]*=h,c.elements[1]*=h,c.elements[2]*=h,c.elements[4]*=l,c.elements[5]*=l,c.elements[6]*=l,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,i.setFromRotationMatrix(c),r.x=o,r.y=s,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 il,e=new iv,i=new il;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),c=-(e+t)*o,h=-(i+r)*s,l=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=c,f[13]=h,f[14]=l,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!is(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,a){return new t().perspective(e,i,r,n,a)},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,a,o,s,u,c,h,l,f,d,p,m,v){return new t(e,a,c,d,i,o,h,p,r,s,l,m,n,u,f,v)},t}();function ig(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 ix(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 ig(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 ig(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.")}iy.IDENTITY=new iy(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),iy.ZERO=new iy(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),iy.tempVec0=new il,iy.tempVec1=new il,iy.tempVec2=new il,iy.tempMat0=new iy,t.ShaderCompileResultStatus=void 0,(G=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[G.noShader=0]="noShader",G[G.success=1]="success",G[G.fail=2]="fail",G[G.compiling=3]="compiling",t.GLSLVersion=void 0,(j=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",j.GLSL3="300 es";var ib=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return e$(e,t),e}(it);t.Shader=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=ix(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(it),t.Shader=eu([e8(tH.Shader)],t.Shader);var iT="effects-internal-copy",iE="effects-internal-copy-mesh",i_="\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}",iS="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 iC(e,i){return{name:iT,vertex:i_,fragment:iS,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:iE+ +i}}var iA=[],iO={};function iw(){"function"==typeof WebGL2RenderingContext?iR(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iR(WebGLRenderingContext),iR(WebGLRenderingContext.prototype)):iA.push("iOS16 lockdown mode, WebGL Constants not in global"),iA.length||"HALF_FLOAT"in iO||(iO.HALF_FLOAT=5131)}function iR(t){for(var e in t)/^[A-Z_]/.test(e)&&(iO[e]=t[e])}function iI(t){switch(t){case tm.ALPHA:case tm.ADD:case tm.SUBTRACTION:case tm.STRONG_LIGHT:case tm.WEAK_LIGHT:return 1;case tm.SUPERPOSITION:return 2;case tm.BRIGHTNESS:return 3;case tm.MULTIPLY:return 0;default:return 1}}function iM(t,e){switch(e){case void 0:case tm.ALPHA:t.blendFunction=[iO.ONE,iO.ONE_MINUS_SRC_ALPHA,iO.ONE,iO.ONE_MINUS_SRC_ALPHA];break;case tm.ADD:t.blendFunction=[iO.ONE,iO.ONE,iO.ONE,iO.ONE];break;case tm.SUBTRACTION:t.blendFunction=[iO.ONE,iO.ONE,iO.ZERO,iO.ONE],t.blendEquation=[iO.FUNC_REVERSE_SUBTRACT,iO.FUNC_REVERSE_SUBTRACT];break;case tm.SUPERPOSITION:t.blendFunction=[iO.ONE,iO.ONE,iO.ONE,iO.ONE];break;case tm.MULTIPLY:t.blendFunction=[iO.DST_COLOR,iO.ONE_MINUS_SRC_ALPHA,iO.DST_COLOR,iO.ONE_MINUS_SRC_ALPHA];break;case tm.BRIGHTNESS:t.blendFunction=[iO.ONE,iO.ONE_MINUS_SRC_ALPHA,iO.ONE,iO.ONE_MINUS_SRC_ALPHA];break;case tm.STRONG_LIGHT:t.blendFunction=[iO.DST_COLOR,iO.DST_ALPHA,iO.ZERO,iO.ONE];break;case tm.WEAK_LIGHT:t.blendFunction=[iO.DST_COLOR,iO.ZERO,iO.ZERO,iO.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iL(t,e){e===tv.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iO.CW,t.cullFace=e===tv.BACK?iO.BACK:iO.FRONT)}function iP(t,e){switch(e){case void 0:t.stencilTest=!1;break;case ty.MASK:t.stencilTest=!0,t.stencilFunc=[iO.ALWAYS,iO.ALWAYS],t.stencilOpZPass=[iO.REPLACE,iO.REPLACE];break;case ty.OBSCURED:t.stencilTest=!0,t.stencilFunc=[iO.EQUAL,iO.EQUAL];break;case ty.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[iO.NOTEQUAL,iO.NOTEQUAL];break;case ty.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iV(){return(iV=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)}iA.length||iw(),t.ShaderType=void 0,(X=t.ShaderType||(t.ShaderType={}))[X.vertex=0]="vertex",X[X.fragment=1]="fragment",t.TextureLoadAction=void 0,(H=t.TextureLoadAction||(t.TextureLoadAction={}))[H.whatever=0]="whatever",H[H.clear=2]="clear",t.TextureSourceType=void 0,(W=t.TextureSourceType||(t.TextureSourceType={}))[W.none=0]="none",W[W.data=1]="data",W[W.image=2]="image",W[W.compressed=3]="compressed",W[W.video=4]="video",W[W.canvas=5]="canvas",W[W.framebuffer=6]="framebuffer",W[W.mipmaps=7]="mipmaps";var iF=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 a=new XMLHttpRequest,o=function(){n.finish(t,a.status,a.response)};a.responseType=e,a.addEventListener("load",function(){200==a.status||0==a.status?n.finish(t,200,a.response):o()}),a.addEventListener("error",o),a.open("GET",t,!0),a.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],a=n.length-1,o=r.length;a<o;a+=2)r[a].apply(null,n)},t}(),iD=!1,iN=!1;function iz(t,e){return ik.apply(this,arguments)}function ik(){return(ik=ea(function(t,e){return ec(this,function(i){switch(i.label){case 0:if(!(iD||!e))return[3,2];return[4,iG(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iG(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iD=!0,[4,iG(t)];case 6:return[2]}})})).apply(this,arguments)}function iU(t,e){return iB.apply(this,arguments)}function iB(){return(iB=ea(function(t,e){return ec(this,function(i){switch(i.label){case 0:if(!(iN||!e))return[3,2];return[4,iG(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iG(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iN=!0,[4,iG(t)];case 6:return[2]}})})).apply(this,arguments)}function iG(t){return ij.apply(this,arguments)}function ij(){return(ij=ea(function(t){var e,i;return ec(this,function(r){if(e="",eo(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else eo(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 iX(t){return iH.apply(this,arguments)}function iH(){return(iH=ea(function(t){return ec(this,function(e){return[2,new Promise(function(e,i){new iF().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iW(){return(iW=ea(function(t){return ec(this,function(e){return[2,new Promise(function(e,i){new iF().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iY(t){return iZ.apply(this,arguments)}function iZ(){return(iZ=ea(function(t){var e;return ec(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eE()&&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 iq(t,e){return iQ.apply(this,arguments)}function iQ(){return(iQ=ea(function(t,e){return ec(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 iK(t,e,i){return iJ.apply(this,arguments)}function iJ(){return(iJ=ea(function(e,i,r,n){var a,o,s,u,c,h,l;return ec(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:i$(t,i)}))}))];case 1:return s=f.sent(),[2,iV({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,c=e.target,[4,Promise.all(u.map(function(t){return i$(t,i)}))];case 3:return h=f.sent(),l=n[u[0][1][0]].url,[2,iV({keepImageSource:!1},e,{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:l,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function i$(t,e){return i0.apply(this,arguments)}function i0(){return(i0=ea(function(t,e){var i,r,n,a,o;return ec(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,iG(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var i1=1,i2=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+i1++,i}e$(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?iO.TEXTURE_2D:i,n=e.format,a=void 0===n?iO.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),iV({minFilter:iO.NEAREST,magFilter:iO.NEAREST,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE,target:r,format:iO.RGBA,internalFormat:a,type:iO.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return ea(function(){var a,o;return ec(this,function(s){switch(s.label){case 0:return[4,iG(e)];case 1:return a=s.sent(),(o=i.create(r,iV({sourceType:t.TextureSourceType.image,image:a,target:iO.TEXTURE_2D,id:eG(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return ea(function(){var a,o;return ec(this,function(s){switch(s.label){case 0:return[4,iY(e)];case 1:return a=s.sent(),(o=i.create(r,iV({sourceType:t.TextureSourceType.video,video:a,id:eG(),flipY:!0},n))).initialize(),[2,o]}})})()},e3(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(it);function i3(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?iO.RGBA:3===o?iO.RGB:2===o?iO.LUMINANCE_ALPHA:iO.LUMINANCE,i2.createWithData(t,{data:e,width:i,height:r},{type:iO.HALF_FLOAT,format:n,internalFormat:a,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE})}var i4={type:iO.UNSIGNED_BYTE,format:iO.RGBA,internalFormat:iO.RGBA,wrapS:iO.MIRRORED_REPEAT,wrapT:iO.MIRRORED_REPEAT,minFilter:iO.NEAREST,magFilter:iO.NEAREST};function i5(e){return i2.create(e,iV({id:e0.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i4))}function i6(e){return i2.create(e,iV({id:e0.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i4))}var i8=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,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===a.getUint32(0,!0);if(this.glType=a.getUint32(1*n,o),this.glTypeSize=a.getUint32(2*n,o),this.glFormat=a.getUint32(3*n,o),this.glInternalFormat=a.getUint32(4*n,o),this.glBaseInternalFormat=a.getUint32(5*n,o),this.pixelWidth=a.getUint32(6*n,o),this.pixelHeight=a.getUint32(7*n,o),this.pixelDepth=a.getUint32(8*n,o),this.numberOfArrayElements=a.getUint32(9*n,o),this.numberOfFaces=a.getUint32(10*n,o),this.numberOfMipmapLevels=a.getUint32(11*n,o),this.bytesOfKeyValueData=a.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eP.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eP.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eP.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,a=t?this.numberOfMipmapLevels:1,o=0;o<a;o++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:c,width:r,height:n}),i+=s+4+(3-(s+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function i9(e){var i=new i8(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,a=i.pixelHeight,o=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,c=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:o,target:6===s?iO.TEXTURE_CUBE_MAP:iO.TEXTURE_2D,internalFormat:u,format:c,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var i7=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return ea(function(){var i,r;return ec(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]}})})()},i.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,a=e.url;return r===iO.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eF(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,c=e.maps,h=e.urls;return o?s.length>0:u===iO.TEXTURE_CUBE_MAP?c.every(function(t){return"object"==typeof t&&t}):h.every(function(t){return eF(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return ea(function(){var n,a,o,s,u,c,h,l,f,d,p,m,v,y,g,x,b,T;return ec(this,function(E){switch(E.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,c=e.mipmaps,h=e.urls,l=e.maps,!(a===iO.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=E.sent(),[2,iV({},i,{cube:f,target:iO.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iV({},o),target:iO.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,iG(s)];case 3:return d=E.sent(),[2,iV({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iO.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,iY(s)];case 5:return p=E.sent(),[2,iV({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,iX(s)];case 7:return m=E.sent(),[2,iV({},i9(m),i,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,iX(u)];case 9:if(v=E.sent(),g=(y=null!=a?a:iO.TEXTURE_2D)===iO.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),a!==iO.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(c,v),E.label=12;case 12:return[2,iV({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===iO.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(h.map(function(t){return iG(t)}))];case 14:return b=E.sent(),[2,iV({},i,{mipmaps:b,target:iO.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:h.slice(),target:iO.TEXTURE_2D}})];case 15:if(a!==iO.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return T=E.sent(),[2,iV({},i,{mipmaps:T,target:iO.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iV({},t)}),target:iO.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return ea(function(){return ec(this,function(i){return[2,Promise.all(t.map(function(t){return iG(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return ea(function(){return ec(this,function(e){return[2,Promise.all(t.map(function(t){return iG(t)}))]})})()},e}(),rt=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 re(t){return"object"==typeof t&&t&&void 0===t.length&&eo(t,i2)}t.MaterialRenderType=void 0,(Y=t.MaterialRenderType||(t.MaterialRenderType={}))[Y.normal=0]="normal",Y[Y.transformFeedback=1]="transformFeedback";var ri=1,rr=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,i){var n=i.name,a=void 0===n?"Material"+ri++:n,o=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=a,r.renderType=void 0===o?0:o,r.shaderSource=s,r.props=i,r.uniformSemantics=iV({},u)}else r.name="Material"+ri++,r.renderType=0;return r}e$(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},e3(e,[{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}(it),rn={format:iO.RGBA,type:iO.UNSIGNED_BYTE,minFilter:iO.LINEAR,magFilter:iO.LINEAR,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE},ra=Symbol("dispose"),ro=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,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(rn).forEach(function(t){var i,r=null!=(i=e[t])?i:rn[t];o[t]=r,s.push(t,r)});var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var h=this.engine;eI(h),c=i2.create(h,o),this.textureCache[u]=c,this.textureRef[u]=1,c[ra]=c.dispose,c.dispose=function(){return i.removeTexture(u)}}return c},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[ra](),i.dispose=i[ra]),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[ra](),i.dispose=i[ra]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),rs=function(){function t(t){void 0===t&&(t={}),this.semantics=iV({},t)}var e=t.prototype;return e.toObject=function(){return iV({},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 eN(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}(),ru=((t$={})[iO.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t$[iO.INT]=Int32Array.BYTES_PER_ELEMENT,t$[iO.SHORT]=Int16Array.BYTES_PER_ELEMENT,t$[iO.BYTE]=Int8Array.BYTES_PER_ELEMENT,t$),rc=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(it);function rh(t){return t===iO.INT?new Int32Array(0):t===iO.SHORT?new Int16Array(0):new Float32Array(0)}(Z=t0||(t0={}))[Z.XYZ=0]="XYZ",Z[Z.XZY=1]="XZY",Z[Z.YXZ=2]="YXZ",Z[Z.YZX=3]="YZX",Z[Z.ZXY=4]="ZXY",Z[Z.ZYX=5]="ZYX";var rl=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],a=i[8],o=i[1],s=i[5],u=i[9],c=i[2],h=i[6],l=i[10];switch(e){case t0.XYZ:this.y=Math.asin(ic(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(h,s),this.z=0);break;case t0.YXZ:this.x=Math.asin(-ic(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,l),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-c,r),this.z=0);break;case t0.ZXY:this.x=Math.asin(ic(h,-1,1)),.9999999>Math.abs(h)?(this.y=Math.atan2(-c,l),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case t0.ZYX:this.y=Math.asin(-ic(c,-1,1)),.9999999>Math.abs(c)?(this.x=Math.atan2(h,l),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case t0.YZX:this.z=Math.asin(ic(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,r)):(this.x=0,this.y=Math.atan2(a,l));break;case t0.XZY:this.z=Math.asin(-ic(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(h,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=io,this.y*=io,this.z*=io,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,a,o;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!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o: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 iv;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,a=Math.cos(e*ia*.5),o=Math.cos(i*ia*.5),s=Math.cos(r*ia*.5),u=Math.sin(e*ia*.5),c=Math.sin(i*ia*.5),h=Math.sin(r*ia*.5);switch(n){case t0.XYZ:t.set(u*o*s+a*c*h,a*c*s-u*o*h,a*o*h+u*c*s,a*o*s-u*c*h);break;case t0.YXZ:t.set(u*o*s+a*c*h,a*c*s-u*o*h,a*o*h-u*c*s,a*o*s+u*c*h);break;case t0.ZXY:t.set(u*o*s-a*c*h,a*c*s+u*o*h,a*o*h+u*c*s,a*o*s-u*c*h);break;case t0.ZYX:t.set(u*o*s-a*c*h,a*c*s+u*o*h,a*o*h-u*c*s,a*o*s+u*c*h);break;case t0.YZX:t.set(u*o*s+a*c*h,a*c*s+u*o*h,a*o*h-u*c*s,a*o*s-u*c*h);break;case t0.XZY:t.set(u*o*s-a*c*h,a*c*s-u*o*h,a*o*h+u*c*s,a*o*s+u*c*h);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,a=this.order,o=Math.cos(i*ia),s=Math.sin(i*ia),u=Math.cos(r*ia),c=Math.sin(r*ia),h=Math.cos(n*ia),l=Math.sin(n*ia);if(a===t0.XYZ){var f=o*h,d=o*l,p=s*h,m=s*l;e[0]=u*h,e[4]=-u*l,e[8]=c,e[1]=d+p*c,e[5]=f-m*c,e[9]=-s*u,e[2]=m-f*c,e[6]=p+d*c,e[10]=o*u}else if(a===t0.YXZ){var v=u*h,y=u*l,g=c*h,x=c*l;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*c,e[1]=o*l,e[5]=o*h,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===t0.ZXY){var b=u*h,T=u*l,E=c*h,_=c*l;e[0]=b-_*s,e[4]=-o*l,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*h,e[9]=_-b*s,e[2]=-o*c,e[6]=s,e[10]=o*u}else if(a===t0.ZYX){var S=o*h,C=o*l,A=s*h,O=s*l;e[0]=u*h,e[4]=A*c-C,e[8]=S*c+O,e[1]=u*l,e[5]=O*c+S,e[9]=C*c-A,e[2]=-c,e[6]=s*u,e[10]=o*u}else if(a===t0.YZX){var w=o*u,R=o*c,I=s*u,M=s*c;e[0]=u*h,e[4]=M-w*l,e[8]=I*l+R,e[1]=l,e[5]=o*h,e[9]=-s*h,e[2]=-c*h,e[6]=R*l+I,e[10]=w-M*l}else if(a===t0.XZY){var L=o*u,P=o*c,V=s*u,F=s*c;e[0]=u*h,e[4]=-l,e[8]=c*h,e[1]=L*l+F,e[5]=o*h,e[9]=P*l-V,e[2]=V*l-P,e[6]=s*h,e[10]=F*l+L}else console.error("toMatrix4: Invalid order "+a);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}();rl.DEFAULT_ORDER=t0.ZYX,rl.tempQuat0=new iv,rl.tempMat0=new iy;var rf=function(){function t(t,e,i,r,n,a,o,s,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===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var c=this.elements;return c[0]=t,c[3]=r,c[6]=o,c[1]=e,c[4]=n,c[7]=s,c[2]=i,c[5]=a,c[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=i,c[1]=r,c[4]=n,c[7]=a,c[2]=o,c[5]=s,c[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,a=e+e,o=i+i,s=r+r,u=e*a,c=e*o,h=e*s,l=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(l+d),y[1]=c+v,y[2]=h-m,y[3]=c-v,y[4]=1-(u+d),y[5]=f+p,y[6]=h+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],a=r[3],o=r[6],s=r[1],u=r[4],c=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*c,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*c,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,a=i[0],o=i[3],s=i[6],u=i[1],c=i[4],h=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]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+c*y+h*b,n[4]=u*m+c*g+h*T,n[7]=u*v+c*x+h*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],a=t[4],o=t[7],s=t[2],u=t[5],c=t[8];return e*(a*c-u*o)+n*(u*r-i*c)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],c=t[8],h=c*a-u*o,l=u*r-c*i,f=o*i-a*r,d=e*h+n*l+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=h*p,t[1]=(s*o-c*n)*p,t[2]=(u*n-s*a)*p,t[3]=l*p,t[4]=(c*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*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,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},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(!is(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,a,o,s,u,c){return new t(e,n,s,i,a,u,r,o,c)},t}(),rd=function(){function t(t,e){void 0===t&&(t=il.ZERO),void 0===e&&(e=il.X),this.origin=new il,this.direction=new il,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 il;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,a,o,s,u=this.origin,c=u.x,h=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,S=1/d,C=1/p,A=1/m;if(S>=0?(i=(y-c)*S,r=(T-c)*S):(i=(T-c)*S,r=(y-c)*S),C>=0?(n=(g-h)*C,a=(E-h)*C):(n=(E-h)*C,a=(g-h)*C),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(o=(x-l)*A,s=(_-l)*A):(o=(_-l)*A,s=(x-l)*A),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(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 il).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),c=a-u,h=a+u;if(!(h<0))return c>=0?this.at(c,i):this.at(h,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),c=t.tempVec1.subtractVectors(s,a),h=t.tempVec2.subtractVectors(this.origin,a),l=t.tempVec3.crossVectors(u,c),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(h,c);var d=n*this.direction.dot(c);if(!(d<0)){u.cross(h);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*h.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();rd.tempVec0=new il,rd.tempVec1=new il,rd.tempVec2=new il,rd.tempVec3=new il;var rp=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,a;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!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,c=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,c=o):a>=3&&a<=4?(u=o,c=n):a>=4&&a<=5?(s=o,c=n):a>=5&&a<=6&&(s=n,c=o);var h=i-n;return this.set(s+h,u+h,c+h,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):eo(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):eo(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):eo(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):eo(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 id(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,c=0;return 0!==a&&(c=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,c,a,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)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+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}();rp.BLACK=new rp(0,0,0,1),rp.BLUE=new rp(0,0,1,1),rp.CLEAR=new rp(0,0,0,0),rp.CYAN=new rp(0,1,1,1),rp.GRAY=new rp(.5,.5,.5,1),rp.GREEN=new rp(0,1,0,1),rp.MAGENTA=new rp(1,0,1,1),rp.RED=new rp(1,0,0,1),rp.WHITE=new rp(1,1,1,1),rp.YELLOW=new rp(1,.92,.016,1);var rm=function(){function t(t,e){void 0===t&&(t=new il(1/0,1/0,1/0)),void 0===e&&(e=new il(-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,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],h=t[s+1],l=t[s+2];c<e&&(e=c),h<i&&(i=h),l<r&&(r=l),c>n&&(n=c),h>a&&(a=h),l>o&&(o=l)}return this.min.set(e,i,r),this.max.set(n,a,o),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 il),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 il),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,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);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 il),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 il;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 il),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 il),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 il),this.isEmpty())return[];var i=[];return i[0]=new il(this.min.x,this.min.y,this.min.z),i[1]=new il(this.min.x,this.min.y,this.max.z),i[2]=new il(this.min.x,this.max.y,this.min.z),i[3]=new il(this.min.x,this.max.y,this.max.z),i[4]=new il(this.max.x,this.min.y,this.min.z),i[5]=new il(this.max.x,this.min.y,this.max.z),i[6]=new il(this.max.x,this.max.y,this.min.z),i[7]=new il(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 il;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}(),rv=function(){function t(t,e){void 0===t&&(t=il.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 a=new rm().setFromPoints(t);a.getCenter(i),this.radius=a.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 il),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 rm),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 il().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 il,i=new il;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 il().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}(),ry=Object.freeze({__proto__:null,get EulerOrder(){return t0},Euler:rl,Quaternion:iv,Vector2:ih,Vector3:il,Vector4:id,Matrix3:rf,Matrix4:iy,Ray:rd,PI2:2*Math.PI,DEG2RAD:ia,RAD2DEG:io,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:is,damp:function(t,e,i,r){return iu(t,e,1-Math.exp(-i*r))},lerp:iu,degToRad:function(t){return t*ia},radToDeg:function(t){return t*io},clamp:ic,Color:rp,Box3:rm,Sphere:rv}),rg=1,rx=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,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,c=void 0===u?iy.fromIdentity():u;r.id="Mesh"+rg++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=c}else r.id="Mesh"+rg++,r.name="<unnamed>",r.worldMatrix=iy.fromIdentity(),r._priority=0;return r}e$(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)}},e3(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ir);t.RenderPassAttachmentStorageType=void 0,(q=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[q.none=0]="none",q[q.color=1]="color",q[q.stencil_8_opaque=2]="stencil_8_opaque",q[q.depth_16_opaque=3]="depth_16_opaque",q[q.depth_stencil_opaque=4]="depth_stencil_opaque",q[q.depth_16_texture=5]="depth_16_texture",q[q.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(Q=t.TextureStoreAction||(t.TextureStoreAction={}))[Q.store=0]="store",Q[Q.clear=2]="clear";var rb=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(eo(r,i2))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,c=r.internalFormat,h=r.format,l=void 0===h?iO.RGBA:h,f=r.type,d=void 0===f?iO.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:c||l,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=i2.create(e,iV({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},e3(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,(K=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[K.force=0]="force",K[K.keep=1]="keep",K[K.keepExternal=2]="keepExternal",K[K.destroy=0]="destroy";var rT=1,rE=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+rT++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,c=i.priority,h=i.meshOrder,l=void 0===h?t.OrderType.ascending:h,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===c?0:c,this.meshOrder=l,this.meshes=eO((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iV({},a),this.storeAction=iV({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new rs(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){ew(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){em(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eO(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],a=e[3];t.setViewport(i,r,n,a)}},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 rb(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 a=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],s=[o[2],o[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var c=n.attachments.map(function(t,e){var r;return new rb(i.renderer.engine,iV({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=c;var h=rK.create({storeAction:this.storeAction,name:u,viewport:o,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);h.bind(),h.unbind(),this.framebuffer=h}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 a=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===a||1===a||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:o}),s.externalStorage&&2===o||1===o||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eB}},e3(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}(),r_="#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);}",rS="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\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);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",rC="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;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(uSampler0,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;}",rA="#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",rO="#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}}",rw="#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}",rR="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",rI="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);}",rM="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);}",rL="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);}",rP="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);}",rV="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);}",rF={},rD=function(){function e(){}return e.registerInclude=function(t,e){rF[t]&&eP.warn('The "'+t+'" shader include already exist.'),rF[t]=e},e.unRegisterInclude=function(t){delete rF[t]},e.unRegisterAllIncludes=function(){Object.keys(rF).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),c=e.genShaderVersion(r),h=e.parseIncludes(a),l=e.isVersion300(h);return(h=e.removeWebGLVersion(h),2!==r||l||(h=e.convertTo300(h,n===t.ShaderType.fragment)),s)?u+h:c+u+h},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=rF[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 a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[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}(),rN=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=rc.create(a,{mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rr.create(a,{shader:{vertex:rR,fragment:rV,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=rx.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}e$(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=null!=(r=null==(i=e.renderingData.currentFrame.globalVolume)?void 0:i.threshold)?r:1;this.screenMesh.material.setFloat("_Threshold",n),e.renderMeshes([this.screenMesh])},i}(rE),rz=function(e){function i(i,r,n){(a=e.call(this,i,n)||this).type=r;var a,o=a.renderer.engine,s="PostProcess",u=rc.create(o,{name:s,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:rR,fragment:"H"==r?rM:rL,glslVersion:t.GLSLVersion.GLSL1},h=rr.create(o,{name:s,shader:c});return h.blending=!1,h.depthTest=!1,h.culling=!1,a.screenMesh=rx.create(o,{name:s,geometry:u,material:h,priority:0}),a.priority=5e3,a}e$(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",rX(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(rE),rk=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=rc.create(a,{name:n,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rr.create(a,{name:n,shader:{vertex:rR,fragment:rP}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=rx.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}e$(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",rX(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(rE),rU=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new rb(o);var s=rc.create(o,{name:a,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=rr.create(o,{name:a,shader:{vertex:rR,fragment:rI,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=rx.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}e$(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,r=null!=(i=e.renderingData.currentFrame.globalVolume)?i:{},n=r.bloomEnabled,a=void 0!==n&&n,o=r.bloomIntensity,s=r.brightness,u=r.saturation,c=r.contrast,h=r.toneMappingEnabled,l=r.vignetteIntensity,f=void 0===l?.2:l,d=r.vignetteSmoothness,p=r.vignetteRoundness;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",void 0===s?1:s),this.screenMesh.material.setFloat("_Saturation",void 0===u?1:u),this.screenMesh.material.setFloat("_Contrast",void 0===c?1:c),this.screenMesh.material.setInt("_UseBloom",Number(a)),a&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",void 0===o?1:o)),f>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",f),this.screenMesh.material.setFloat("_VignetteSmoothness",void 0===d?.4:d),this.screenMesh.material.setFloat("_VignetteRoundness",void 0===p?1:p),this.screenMesh.material.setVector2("_VignetteCenter",new ih(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new il(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(void 0===h||h)),e.renderMeshes([this.screenMesh])},i}(rE),rB="_effects_default_",rG=1,rj=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,a=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=e.globalVolume,c=e.postProcessingEnabled,h=void 0!==c&&c,l=e.clearAction,f=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,d=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new rW;var p=[],m={};if(this.renderer=o,h){var v=iO.HALF_FLOAT;p=[{texture:{format:iO.RGBA,type:v,magFilter:iO.LINEAR,minFilter:iO.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var y=[new rE(o,{name:rB,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m})];if(this.setRenderPasses(y),h){var g=new rb(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=iO.HALF_FLOAT,E=new rN(o,{name:"BloomThresholdPass",attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new rb(d);var S=new rz(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]}),C=new rz(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(S),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var O=new rk(o,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]});O.gaussianDownSampleResult=b[5-A],this.addRenderPass(O),x[2]*=2,x[3]*=2}var w=new rU(o,g);this.addRenderPass(w)}this.semantics=new rs(e.semantics),this.clearAction=f,this.name="RenderFrame"+rG++;var R=y[0];this.emptyTexture=i5(d),this.transparentTexture=i6(d),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(R,{listStart:0,listEnd:0,renderPass:R,intermedia:!1}),this.editorTransform=id.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new ro(d);var I=d.gpuCapability,M=I.detail,L=iC(I.level,M.readableDepthStencilTextures&&M.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(L)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},i.removeMeshFromDefaultRenderPass=function(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,a=e;a<t.length;a++){var o,s,u,c=t[a],h=null==(s=c.attachments[0])?void 0:s.texture;if(h&&o===h){var l=h===r?n:r;c.resetColorAttachments([l])}(h=null==(u=c.attachments[0])?void 0:u.texture)&&(o=h)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(rB)&&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,a=r.persistent,o=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(o===iO.RGBA&&!a){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[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,a=r.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===a?iO.LINEAR:iO.NEAREST,c=i2.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iO.RGBA,name:"frame_a",minFilter:u,magFilter:u}),h=i2.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iO.RGBA,data:{width:o,height:s},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 rE(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:c}]}).initialize(this.renderer),d=new rH(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:h,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=rc.create(i,{name:iT,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=iC(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=rr.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:iT,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[iO.SRC_ALPHA,iO.ONE_MINUS_SRC_ALPHA,iO.SRC_ALPHA,iO.ONE_MINUS_SRC_ALPHA]),rx.create(i,{name:iT,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){em(this._renderPasses,t)},e3(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function rX(t){return t?new ih(t.getWidth(),t.getHeight()):new ih}var rH=function(t){function e(){return t.apply(this,arguments)}e$(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",rX(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(rE),rW=function(){this.floats={},this.ints={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},rY=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 e3(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),rZ="function"==typeof WebGL2RenderingContext,rq=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=rZ&&eo(t,WebGL2RenderingContext)?2:1,r=2===i,n=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"),s=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"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),r&&!o&&(o=rQ(t,t.HALF_FLOAT)),r&&!s&&(s=rQ(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=r||t.getExtension("OES_texture_float")?t.FLOAT:0,c=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,h={floatTexture:u,halfFloatTexture:c,maxSample:r?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:r?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!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:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!a,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=h,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,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 rQ(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,(J=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[J.NONE=0]="NONE",J[J.PVRTC=1]="PVRTC",J[J.ASTC=2]="ASTC",t.FilterMode=void 0,($=t.FilterMode||(t.FilterMode={}))[$.Nearest=0]="Nearest",$[$.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tt=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tt.RGBA32=0]="RGBA32",tt[tt.RGBAHalf=1]="RGBAHalf";var rK=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){},e3(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),rJ=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=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,a){return null},e.dispose=function(t){},t}(),r$=(ti=new Int32Array((te=new Float32Array(1)).buffer),function(t){te[0]=t;var e=ti[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)}),r0=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]=r$(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=r$(t[i])},t}(),r1=new rl,r2=new iy;function r3(t,e,i,r,n,a,o){var s=r/n,u=r,c=e.speedOverLifetime;c&&(u=c.getIntegrateValue(0,r,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,h);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new il;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(s):e.getIntegrateValue(0,r,n):0});r1.setFromArray(v).negate(),r2.setFromEuler(r1);var y=r2.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(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var S=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+S}}return t}function r4(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function r5(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function r6(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 a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var r8=((t1={})[tS.PARTICLE_ORIGIN_CENTER]=[0,0],t1[tS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t1[tS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t1[tS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t1[tS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t1[tS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t1[tS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t1[tS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t1[tS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t1);function r9(t,e,i){var r=i.position,n=new il(t,e,0),a=new il;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new rd(r,a)}function r7(t,e,i){var r=t.x,n=t.y,a=t.z,o=new il(r-e,n+i,a),s=new il(r-e,n-i,a),u=new il(r+e,n-i,a),c=new il(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:c}]}function nt(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function ne(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var ni={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new ih(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tR.LINE?0:e===tR.EASE_OUT?0:e===tR.EASE_IN?2:e===tR.EASE?2:e===tR.HOLD&&i===tR.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===tR.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tR.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tR.EASE,tR.EASE_IN,tR.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tR.EASE,tR.EASE_OUT,tR.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tR.HOLD&&[tR.HOLD,tR.LINE_OUT,tR.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tR.HOLD&&[tR.HOLD,tR.LINE,tR.EASE_IN].includes(i)}},nr=function(t,e){this.points=t,this.totalLength=e},nn={},na={};function no(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function ns(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var nu=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=ne(e.x-t.x,3)+"_"+ne(e.y-t.y,3)+"_"+ne(e.z-t.z,3)+"&"+(ne(i.x-t.x,3)+"_"+ne(i.y-t.y,3))+"_"+ne(i.z-t.z,3)+"&"+(ne(r.x-t.x,3)+"_"+ne(r.y-t.y,3))+"_"+ne(r.z-t.z,3);if(na[n])return{data:na[n],interval:t};for(var a=[],o=null,s=0,u=0,c=0;c<300;c+=1){var h=new il,l=c/299;u=0,h.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),h.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),h.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!==o&&(u+=Math.pow(h.x-o.x,2)+Math.pow(h.y-o.y,2)+Math.pow(h.z-o.z,2)),o=h,s+=u=Math.sqrt(u),a[c]={partialLength:u,point:h}}var f=new nr(a,s);return na[n]=f,{data:f,interval:new il(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(nt(1-t,0))return e.points[299].point.clone().add(this.interval);if(nt(e.totalLength,0))return this.p1.clone();var i=new il,r=ne(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(nt(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=ne(e.points[a].partialLength,5)):s<0&&a>0?(n-=ne(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),nc=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iv,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):nt(1-t,0)?this.temp.copyFrom(this.p2):(nf.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),nh=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(),no(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=no(.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,a=ns(n,this.mX1,this.mX2);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=ns(e,i,r);if(0===a)break;var o=no(e,i,r)-t;e-=o/a}return e}(t,n,this.mX1,this.mX2):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=no(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.mX1,this.mX2)},t}();function nl(t,e){var i,r,n,a=function(t,e,i){var r=t[1],n=ni.isHoldOutKeyframe(t),a=ni.isHoldInKeyframe(e),o=!a&&ni.isRightSideEase(t),s=!n&&ni.isLeftSideEase(e);if(o&&!s&&!a){var u=new ih(r[r.length-4],r[r.length-3]),c=new ih(r[r.length-2],r[r.length-1]),h=ni.getPointInCurve(e),l=new ih(h.x,h.y),f=new ih(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:c,p2:f,p3:l}}if(!o&&s&&!n){var d=e[1],p=ni.getPointInCurve(t),m=new ih(p.x,p.y),v=new ih(d[0],d[1]),y=new ih(d[2],d[3]),g=new ih(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new ih(r[r.length-4],r[r.length-3]),p1:new ih(r[r.length-2],r[r.length-1]),p2:new ih(x[0],x[1]),p3:new ih(x[2],x[3])}}var b=ni.getPointInCurve(t),T=ni.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var E=new ih((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new ih((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||a,leftHoldLine:n,rightHoldLine:a}}(t,e,!0),o=a.p0,s=a.p1,u=a.p2,c=a.p3;eI(u),eI(c);var h=c.x-o.x,l=c.y-o.y,f=ne((s.x-o.x)/h,5),d=ne((u.x-o.x)/h,5);nt(l,0)?i=r=NaN:(i=ne((s.y-o.y)/l,5),r=ne((u.y-o.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",o,s,u,c),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",o,s,u,c),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",o,s,u,c),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",o,s,u,c),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return nn[p]?n=nn[p]:(n=new nh(f,i,d,r),nn[p]=n),{points:[o,s,u,c],timeInterval:h,valueInterval:l,curve:n}}var nf=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,c=i.y,h=i.z,l=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=c,t.z=h,t.w=l;return}if(s!==l||n!==u||a!==c||o!==h){var f=1-r,d=n*u+a*c+o*h+s*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,a=a*f+c*g,o=o*f+h*g,s=s*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),nd="not_implement",np=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(nd)},e.getIntegrateValue=function(t,e,i){throw Error(nd)},e.getIntegrateByTime=function(t,e){throw Error(nd)},e.getValue=function(t){throw Error(nd)},e.getMaxTime=function(){throw Error(nd)},e.toUniform=function(t){throw Error(nd)},e.map=function(t){throw Error(nd)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(nd)},t.getAllData=function(t,e){for(var i=new(e?r0:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),nm=function(t){function e(){return t.apply(this,arguments)}e$(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}(np),nv=function(t){function e(){return t.apply(this,arguments)}e$(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}(np),ny=function(t){function e(){return t.apply(this,arguments)}e$(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}(np),ng=function(t){function e(){return t.apply(this,arguments)}e$(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 a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(np),nx=function(t){function e(){return t.apply(this,arguments)}e$(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,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return nO(e,0,this.xCoord,this.min,this.max)-nO(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}(np),nb=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=ex(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],a=e[r+1];if(n.stop<=t&&a.stop>t){var o=(t-n.stop)/(a.stop-n.stop);return eb(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(np),nT=function(t){function e(){return t.apply(this,arguments)}e$(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],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),c=n[1];return c+u*(a[1]-c)}}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,a=e?nO:nA,o=0;o<n;o++){var s=i[o],u=i[o+1],c=s[0],h=u[0];if(t>c&&t<=h)return r+a(t,c,h,s[1],u[1]);r+=a(h,c,h,s[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}(np),nE=function(t){function e(){return t.apply(this,arguments)}e$(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=nl(t[e],t[e+1]),r=i.points,n=i.curve,a=i.timeInterval,o=i.valueInterval,s=r[0],u=r[r.length-1];this.keys.push([].concat(s.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[s.x+"&"+u.x]={points:r,timeInterval:a,valueInterval:o,curve:n,timeStart:Number(s.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 a=0;a<i.length;a++){var o=this.curveMap[i[a]].timeStart,s=this.curveMap[i[a]].timeEnd;if(t>=Number(o)&&t<Number(s)){e=this.getCurveValue(i[a],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],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,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var c=u*s/n,h=r.y+a*i.curve.getValue(c);0===u||20===u?o+=h:u%2==1?o+=4*h:o+=2*h}return s/3*o},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=(e-r.x)/n,s=i.curve.getValue(o);return r.y+a*s},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}(np),n_=function(t){function e(){return t.apply(this,arguments)}e$(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],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}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],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(np),nS=function(t){function e(){return t.apply(this,arguments)}e$(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 a=e[n],o=e[n+1],s=new il(i[n][0],i[n][1],i[n][2]),u=new il(i[n+1][0],i[n+1][1],i[n+1][2]),c=new il(r[2*n][0],r[2*n][1],r[2*n][2]),h=new il(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=nl(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new nu(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=ne(t,5),i=0,r=new il,n=Object.keys(this.curveSegments);if(!n.length)return r;var a=Number(n[0].split("&")[0]),o=Number(n[n.length-1].split("&")[1]);if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=n[s].split("&"),c=u[0],h=u[1];if(e>=Number(c)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=ne((e-r.x)/n,4);return ic(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(np),nC=function(t){function e(){return t.apply(this,arguments)}e$(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 a=e[n],o=e[n+1],s=iv.fromArray(i[n]),u=iv.fromArray(i[n+1]),c=iv.fromArray(r[2*n]),h=iv.fromArray(r[2*n+1]),l=nl(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new nc(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=ne(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],c=s[1];if(i>=Number(u)&&i<Number(c)){var h=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),h.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,a=ne((e-r.x)/n,4);return ic(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(np);function nA(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function nO(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function nw(t,e){if(e){var i=e[0],r=e[1];if(i===tw.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===tw.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===tw.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function nR(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function nI(t,e,i){return(nI=!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&&eJ(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var nM=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new id,e}e$(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=nF(t.x),this.yCurve=nF(t.y),this.zCurve=nF(t.z),this.wCurve=nF(t.w)},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}(np),nL="editor",nP={"Item duration can't be less than 0":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"},nV=((t2={})[tw.RANDOM]=function(t){return eo(t[0],Array)?new ng(t):new ny(t)},t2[tw.CONSTANT]=function(t){return new nm(t)},t2[tw.CONSTANT_VEC2]=function(t){return new nm(t)},t2[tw.CONSTANT_VEC3]=function(t){return new nm(t)},t2[tw.CONSTANT_VEC4]=function(t){return new nm(t)},t2[tw.RGBA_COLOR]=function(t){return new nm(t)},t2[tw.COLORS]=function(t){return new nv(t.map(function(t){return ey(t,!1)}))},t2[tw.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new nx([t[0][1],t[1][1]]):new nT(t)},t2[tw.GRADIENT_COLOR]=function(t){return new nb(t)},t2[tw.LINEAR_PATH]=function(t){return new n_(t)},t2[tw.BEZIER_CURVE]=function(t){return 1===t.length?new nm(t[0][1][1]):new nE(t)},t2[tw.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new nm(nI(il,[].concat(t[1][0]))):new nS(t)},t2[tw.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new nm(nI(iv,[].concat(t[1][0]))):new nC(t)},t2[tw.COLOR_CURVE]=function(t){return new nD(t)},t2[tw.VECTOR4_CURVE]=function(t){return new nM(t)},t2);function nF(t){if(!t||!isNaN(+t))return new nm(t||0);if(eo(t,np))return t;if(eN(nV[t[0]]))return nV[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nP["ValueType: 21/22 is not supported"]+".")}var nD=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rp,e}e$(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=nF(t.r),this.gCurve=nF(t.g),this.bCurve=nF(t.b),this.aCurve=nF(t.a)},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}(np),nN=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===tv.FRONT}}},i.renderer={renderMode:t_.BILLBOARD,blending:tm.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tv.DOUBLE,mask:0,maskMode:ty.NONE,order:0},i.emptyTexture=i.engine.emptyTexture,i.renderInfo=nz(im(i));var i,r=i.createMaterial(i.renderInfo,2);return i.worldMatrix=iy.fromIdentity(),i.material=r,i.material.setVector4("_Color",new id().setFromArray([1,1,1,1])),i.material.setVector4("_TexOffset",new id().setFromArray([0,0,1,1])),i}e$(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 id().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",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),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 a=0;a<r;a++)n[a]=0+e[a];return{atlasOffset:i,index:n}},r.setItem=function(){var e=[],i=this.renderer.texture;i&&ep(e,i),i=this.renderer.texture;var r=this.getItemInitData(),n=this.renderer,a=this.material.getVector4("_TexParams");a&&(a.x=n.occlusion?+n.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=n.renderMode);var o={atlasOffset:new Float32Array(r.atlasOffset.length),index:new Uint16Array(r.index.length)};o.atlasOffset.set(r.atlasOffset),o.index.set(r.index);var s=this.material,u=this.geometry,c=o.index;u.setIndexData(c),u.setAttributeData("atlasOffset",o.atlasOffset),u.setDrawCount(r.index.length);for(var h=0;h<e.length;h++){var l=e[h];s.setTexture("uSampler"+h,l)}for(var f=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)s.setTexture("uSampler"+d,f)},r.getItemGeometryData=function(){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]}},r.createGeometry=function(t){return rc.create(this.engine,{attributes:{aPos:{type:iO.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:iO.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,a=t.maskMode,o=t.mask,s={shader:n8(t,e,1)};this.preMultiAlpha=iI(n);var u=rr.create(this.engine,s),c={side:i,blending:!0,blendMode:n,mask:o,maskMode:a,depthTest:!0,depthMask:r};return u.blending=c.blending,u.stencilRef=void 0!==c.mask?[c.mask,c.mask]:void 0,u.depthTest=c.depthTest,u.depthMask=c.depthMask,iM(u,c.blendMode),iP(u,c.maskMode),iL(u,c.side),u.shader.shaderData.properties='uSampler0("uSampler0",2D) = "white" {}',u.hasUniform("_Color")||u.setVector4("_Color",new id(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new id),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new id),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=r7(il.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}(ir);function nz(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,a=e.mask,o=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:a,maskMode:o,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+s+"+"+o+"."+a}}var nk=function(){},nU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},nB={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 a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(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 s(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 c(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function h(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=Q(t),t.a.c=t.c,m(t,Q(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=Q(e),e.a.c=e.c,m(e,Q(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,Q(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 S(t,e){t.f+=e.f,t.b.f+=e.b.f}function C(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function A(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function O(t,e){l(t.a),t.c=!1,t.a=e,e.i=t}function w(t){var e=t.a.a;do t=th(t);while(t.a.a===e);return t.c&&(e=d(tc(t).a.b,t.a.e),O(t,e),t=th(t)),t}function R(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function I(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 M(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,A(t)}function L(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=tc(t),n=r.a;if(n.a!==e.a){if(!r.c){M(t);break}O(r,n=d(e.c.b,n.b))}e.c!==n&&(h(Q(n),n),h(e,n)),M(t),e=r.a,t=r}return e}function P(t,e,i,r,n,a){var o=!0;do R(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=tc(e).a.b.c);(i=(r=tc(e)).a.b).a===n.a;)i.c!==n&&(h(Q(i),i),h(Q(n),i)),r.f=e.f-i.f,r.d=I(t,r.f),e.b=!0,!o&&N(t,e)&&(S(i,n),A(e),l(n)),o=!1,e=r,n=i;e.b=!0,a&&k(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function F(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),h(e,i)}function D(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function N(t,r){var a=tc(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,c=a.d,l=a.e,d=a.c,p=d[u];c[p]=c[a.a],d[c[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(l[c[p>>1]],l[c[p]])?to(a,p):ts(a,p)),l[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;F(t,Q(s),o)}}else f(s.b),h(o,Q(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;th(r).b=r.b=!0,f(o.b),h(Q(s),o)}return!0}function z(t,c){var l=tc(c),d=c.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,S=g,C=v;if(i(E,_)||(b=E,E=_,_=b),i(S,C)||(b=S,S=C,C=b),i(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),i(S,_)?i(_,C)?(0>(b=r(E,S,_))+(T=r(S,_,C))&&(b=-b,T=-T),x.b=u(b,S.b,T,_.b)):(0>(b=n(E,S,_))+(T=-n(E,C,_))&&(b=-b,T=-T),x.b=u(b,S.b,T,C.b)):x.b=(S.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(S,C)||(b=S,S=C,C=b),a(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),a(S,_)?a(_,C)?(0>(b=o(E,S,_))+(T=o(S,_,C))&&(b=-b,T=-T),x.a=u(b,S.a,T,_.a)):(0>(b=s(E,S,_))+(T=-s(E,C,_))&&(b=-b,T=-T),x.a=u(b,S.a,T,C.a)):x.a=(S.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 N(t,c),!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),h(p.b,d),d=tc(c=w(c)).a,L(t,tc(c),l),P(t,c,Q(d),d,d,!0),!0;if(y===t.a){f(p.b),h(d.e,Q(p)),v=(m=l=c).a.b.a;do m=th(m);while(m.a.b.a===v);return m=tc(c=m).a.b.c,l.a=Q(p),p=L(t,l,null),P(t,c,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(th(c).b=c.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(c.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),h(Q(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,D(d,m,y,p,0),D(d,v,g,p,2),V(t,d,x,p,!0),th(c).b=c.b=l.b=!0,!1}function k(t,e){for(var r=tc(e);;){for(;r.b;)e=r,r=tc(r);if(!e.b&&(r=e,null===(e=th(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=tc(a=e),c=a.a,d=u.a,p=void 0;if(i(c.b.a,d.b.a)){if(0>n(c.b.a,d.b.a,c.a)){a=!1;break t}th(a).b=a.b=!0,p=f(c),h(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,c.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),h(c.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(A(r),l(s),s=(r=tc(e)).a):e.c&&(A(e),l(o),o=(e=th(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)N(t,e);else if(z(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(S(s,o),A(e),l(o),e=th(r))}}function U(t,e){var i=new tu,r=c(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 j,this.b=t,this.c=C}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function X(){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 W(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case H:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(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 Q(t){return t.b.e}function K(){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&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(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 ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=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&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var c=r[u];if(u>t.a||i(n[s],n[c])){r[o]=s,a[s]=o;break}r[o]=c,a[c]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,c=r[u];if(0===u||i(n[c],n[s])){r[o]=s,a[s]=o;break}r[o]=c,a[c]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function tc(t){return t.e.c.b}function th(t){return t.e.a.b}(E=X.prototype).x=function(){W(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:Y(this,100900);return}Y(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(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:Y(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];W(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?h(i=c(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){W(this,H),this.d=1,this.b=new K,this.c=t},E.t=function(){W(this,1),this.d=2,this.q=null},E.v=function(){W(this,2),this.d=1},E.w=function(){W(this,1),this.d=H;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,c=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])c[0]=0,c[1]=0,c[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.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])>o&&(o=b,c[0]=v[0],c[1]=v[1],c[2]=v[2]);0>=o&&(c[0]=c[1]=c[2]=0,c[T(p)]=1)}u=!0}for(v=T(c),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<c[v]?1:-1,c=a.e;c!==a;c=c.e)c.b=c.g[o],c.a=v*c.g[s];if(u){for(c=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do c+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>c)for(u=(c=this.b.c).e;u!==c;u=u.e)u.a=-u.a}for(this.n=!1,a=(c=this.b.b).h;a!==c;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(F(this,o,a),l(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),l(o)),(a===u||a===u.b)&&(u=u.h),l(a));for(this.e=c=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(c,a);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)to(t,e);t.h=!0}(t.b)}(c),this.f=new B(this),U(this,-_),U(this,_);null!==(c=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,c))break;u=te(this.e),F(this,c.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var c=o.f,p=c.a;do p=p.a;while(null!==p.b&&!c.c(c.b,u,p.b));var c=p.b,m=tc(c),u=c.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=c.a).a,s)||e(u.b.a,s)||(f(u.b),c.c&&(l(u.c),c.c=!1),h(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?c:m,m=void 0;c.d||v.c?(m=v===c?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?O(v,m):(u=o,(c=R(o,c,m)).f=th(c).f+c.a.f,c.d=I(u,c.f)),t(o,s)):P(o,c,s.c,s.c,null,!0)}return}if(c=(u=tc(o=w(o.i))).a,(u=L(r,u,null)).c===c){var c=u,u=c.c,p=tc(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&z(r,o),e(m.a,r.a)&&(h(Q(u),m),u=tc(o=w(o)).a,L(r,tc(o),p),y=!0),e(v.a,r.a)&&(h(c,Q(v)),c=L(r,p,null),y=!0),y?P(r,o,c.c,u,u,!0):(s=i(v.a,m.a)?Q(v):m,P(r,o,s=d(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,k(r,o))}else P(r,o,u.c,c,c,!0)}(this,c)}for(c=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++c,A(u);for(this.f=null,(c=this.e).b=null,c.d=null,this.e=c.c=null,a=(c=this.b).a.b;a!==c.a;a=u)u=a.b,(a=a.a).e.e===a&&(S(a.c,a),l(a));if(!this.n){if(c=this.b,this.m)for(a=c.b.h;a!==c.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:l(a);else for(a=c.a.b;a!==c.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(c=this.b).a.b;u!==c.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(c=this.b,u=!!this.l,a=!1,o=-1,s=c.a.d;s!==c.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(c=this.b).a.b;a!==c.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,Q(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,Q(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},nU.libtess={GluTesselator:X,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}},X.prototype.gluDeleteTess=X.prototype.x,X.prototype.gluTessProperty=X.prototype.B,X.prototype.gluGetTessProperty=X.prototype.y,X.prototype.gluTessNormal=X.prototype.A,X.prototype.gluTessCallback=X.prototype.z,X.prototype.gluTessVertex=X.prototype.C,X.prototype.gluTessBeginPolygon=X.prototype.u,X.prototype.gluTessBeginContour=X.prototype.t,X.prototype.gluTessEndContour=X.prototype.v,X.prototype.gluTessEndPolygon=X.prototype.w,t.exports=nU.libtess}(nB);var nG=((tr=new nB.exports.GluTesselator).gluTessCallback(nB.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tr.gluTessCallback(nB.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==nB.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tr.gluTessCallback(nB.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tr.gluTessCallback(nB.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tr.gluTessCallback(nB.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tr),nj=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 a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}e$(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,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],c=this.points[2*a+1];s>e!=c>e&&t<(e-s)/(c-s)*(u-o)+o&&(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 a=function(t){nG.gluTessNormal(0,0,1);var e=[];nG.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){nG.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];nG.gluTessVertex(a,a)}nG.gluTessEndContour()}return nG.gluTessEndPolygon(),e}([t]),o=0;o<a.length;o++)e[i+o]=a[o];for(var s=a.length/2,u=0;u<s;u++)r[n+u]=u},e3(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(nk),nX=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}e$(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 a=i/2,o=r-a,s=n-a,u=r+a,c=n+a,h=t-this.x,l=e-this.y;return h*h/(o*o)+l*l/(s*s)>1&&h*h/(u*u)+l*l/(c*c)<=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 a=Math.ceil(5*Math.sqrt(r+n)),o=8*a+0+0;if(0===o)return t;if(0===a)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 s=0,u=4*a+0+2,c=u,h=o,l=0+r,f=0,d=e+l,p=e-l,m=i+0;t[s++]=d,t[s++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[s++]=b,t[s++]=E,t[--u]=E,t[--u]=T,t[c++]=T,t[c++]=_,t[--h]=_,t[--h]=b}l=0,f=0+n,d=e+l,p=e-l,m=i+f;var S=i-f;return t[s++]=d,t[s++]=m,t[--h]=S,t[--h]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var c=u++,h=0;h<t.length;h+=2)e[2*u]=t[h],e[2*u+1]=t[h+1],h>0&&(r[n++]=u,r[n++]=c,r[n++]=u-1),u++;r[n++]=c+1,r[n++]=c,r[n++]=u-1}},e}(nk),nH=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=ix(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4])}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o){this.ensurePoly();var s,u,c,h,l=this.currentPoly;return s=l.points,u=l.lastX,c=l.lastY,h=(1-Math.min(.99,Math.max(0,null!=o?o:.5)))/5,function t(e,i,r,n,a,o,s,u,c,h,l){if(!(l>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(o+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 S=s-e,C=u-i,A=Math.abs((r-s)*C-(n-u)*S),O=Math.abs((a-s)*C-(o-u)*S);if(A>11920929e-14&&O>11920929e-14){if((A+O)*(A+O)<=h*(S*S+C*C)){c.push(E,_);return}}else if(A>11920929e-14){if(A*A<=h*(S*S+C*C)){c.push(E,_);return}}else if(O>11920929e-14){if(O*O<=h*(S*S+C*C)){c.push(E,_);return}}else if((S=E-(e+s)/2)*S+(C=_-(i+u)/2)*C<=h){c.push(E,_);return}}t(e,i,f,d,g,x,E,_,c,h,l+1),t(E,_,b,T,v,y,s,u,c,h,l+1)}}(u,c,t,e,i,r,n,a,s,h*=h,0),s.push(n,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 nX(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 nj).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 nj,this.currentPoly.points.push(0,0))},t}(),nW=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,o]}),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.clear=function(){return this.instructions.length=0,this.dirty=!0,this},e3(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new nH(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 nW,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 gl_FragColor = color;\n}\n",r.geometry||(r.geometry=rc.create(i,{attributes:{aPos:{type:iO.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:iO.FLOAT,size:2,data:new Float32Array}},mode:iO.TRIANGLES,drawCount:4})),!r.material){var n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}};r.material=rr.create(i,n),r.material.setColor("_Color",new rp(1,1,1,1)),r.material.depthMask=!0,r.material.depthTest=!0,r.material.blending=!0}return r}e$(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=[],a=ix(i);!(e=a()).done;){var o=e.value.shape,s=[],u=n.length,c=r.length/2;o.build(s),o.triangulate(s,r,c,n,u)}var h=r.length/2,l=this.geometry.getAttributeData("aPos"),f=this.geometry.getAttributeData("aUV"),d=this.geometry.getIndexData();(!l||l.length<3*h)&&(l=new Float32Array(3*h)),(!f||f.length<2*h)&&(f=new Float32Array(2*h)),d||(d=new Uint16Array(n.length));for(var p=0;p<h;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 0:var e=t.param.points,i=t.param.easingIn,r=t.param.easingOut;this.curveValues=[];for(var n,a=ix(t.param.shapes);!(n=a()).done;){for(var o=n.value.indexes,s=1;s<o.length;s++){var u=o[s],c=o[s-1];this.curveValues.push({point:e[u.point],controlPoint1:r[c.easingOut],controlPoint2:i[u.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 h,l=ix(this.curveValues);!(h=l()).done;){var f=h.value,d=f.point,p=f.controlPoint1,m=f.controlPoint2;this.path.bezierCurveTo(p.x,p.y,m.x,m.y,d.x,d.y,1)}break;case 2:var v=t.param;this.path.ellipse(0,0,v.xRadius,v.yRadius)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.data=t},i}(ip),t.ShapeComponent=eu([e8("ShapeComponent")],t.ShapeComponent),t.ComponentShapeType=void 0,(tn=t.ComponentShapeType||(t.ComponentShapeType={}))[tn.CUSTOM=0]="CUSTOM",tn[tn.RECTANGLE=1]="RECTANGLE",tn[tn.ELLIPSE=2]="ELLIPSE",tn[tn.POLYGON=3]="POLYGON",tn[tn.STAR=4]="STAR",t.ShapeConnectType=void 0,t.ShapeConnectType||(t.ShapeConnectType={}),t.ShapePointType=void 0,t.ShapePointType||(t.ShapePointType={}),t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}e$(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}(ii),t.CameraController=eu([e8(tH.CameraController)],t.CameraController);var nY=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK);t.HitTestType=void 0,(ta=t.HitTestType||(t.HitTestType={}))[ta.triangle=1]="triangle",ta[ta.box=2]="box",ta[ta.sphere=3]="sphere",ta[ta.custom=4]="custom";var nZ="click",nq="touchstart",nQ="touchmove",nK="touchend",nJ=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,a,o=this;n=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",h=function(t,e,i,n,a){void 0===n&&(n=0),void 0===a&&(a=0);var s=0,u=0,c=performance.now();if(!o.target)return eP.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:a,ts:c,width:0,height:0,origin:t};var h=o.target,l=h.width,f=h.height;if(r){var d=c-r.ts;s=(n-r.dx)/d||0,u=(a-r.dy)/d||0,r={dx:n,dy:a,ts:c}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:a,ts:c,width:l,height:f,origin:t}};e_()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=n$(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(nq,h(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=n$(n(r));t=a.x,e=a.y,o.dispatchEvent(nQ,h(r,t,e,t-i.x,e-i.y))}},a[c]=function(r){if(i&&o.enabled){!o.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var a=n(r),s=n$(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(nZ,h(r,t,e)),o.dispatchEvent(nK,h(r,t,e,t-i.x,e-i.y))}i=0},a),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.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]=[]),ep(i,e),function(){em(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&em(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 n$(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var n0=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK),n1=1,n2=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,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 il,n=new iv,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.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)===nL]],n=nF(this.color).getValue(0),a={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"}},o=rr.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new id(0,0,0,0)),o.setVector2("uSize",new ih(1,1)),o.setVector4("uColor",new id(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new iv(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return rc.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:iO.LINES,maxVertex:4})},i.createMesh=function(t,e){return rx.create(this.engine,{name:"Interact_preview"+n1++,priority:0,worldMatrix:iy.fromIdentity(),geometry:t,material:e})},e}();function n3(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._interactive=!0,t.hasBeenAddedToComposition=!1,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}e$(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,e=this.item.props.content.options,i=this.item.engine.renderer.env,r=this.item.composition,n=this.interactData.options,a=n.type,o=n.showPreview;if(a===tb.CLICK&&(this.clickable=!0,o&&i===nL)){var s=null==r?void 0:r.getRendererOptions();void 0!==s&&(this.previewContent=new n2(this.item.props.content,s,this.transform,this.engine))}e.type===tb.DRAG&&(i!==nL||e.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(e,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams,this.item.onEnd=function(){if(t.item&&t.item.composition){var e;t.item.composition.removeInteractiveItem(t.item,t.item.props.content.options.type),t.clickable=!1,t.hasBeenAddedToComposition=!1,null==(e=t.previewContent)||e.mesh.dispose(),t.endDragTarget()}}},r.onUpdate=function(t){var e;if(this.isActiveAndEnabled){if(null==(e=this.previewContent)||e.updateMesh(),!this.hasBeenAddedToComposition&&this.item.composition){this.interactData.options.type===tb.CLICK&&(this.clickable=!0);var i=this.item.props.content.options;this.item.composition.addInteractiveItem(this.item,i.type),this.hasBeenAddedToComposition=!0}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,n3(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(){},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,a=n.position,o=n.fov,s=e.dy,u=e.dx*e.width/e.height,c=a[2],h=Math.tan(o*Math.PI/180/2)*Math.abs(c),l=this.dragRange,f=l.dxRange,d=l.dyRange,p=a[0]-this.dragRatio[0]*(u*h),m=a[1]-this.dragRatio[1]*(s*h),v=f[0],y=f[1],g=d[0],x=d[1];p=ic(p,v,y),m=ic(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 il(p,m,c)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={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;!n3(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iV({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=r7(il.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===tb.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},e3(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ir),t.InteractComponent=eu([e8(tH.InteractComponent)],t.InteractComponent);var n4=function(){function e(){this.triangles=[]}var i=e.prototype;return i.getBoundingBoxData=function(){return this.boundingBoxData},i.setGeometry=function(e,i){this.geometry!==e&&(this.triangles=this.geometryToTriangles(e),this.geometry=e);for(var r,n=[],a=ix(this.triangles);!(r=a()).done;){var o=r.value;n.push({p0:o.p0,p1:o.p1,p2:o.p2})}i&&n.forEach(function(t){t.p0=i.transformPoint(t.p0,new il),t.p1=i.transformPoint(t.p1,new il),t.p2=i.transformPoint(t.p2,new il)}),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:[],a=[],o=0;o<r.length;o+=3){var s=3*r[o],u=3*r[o+1],c=3*r[o+2],h={x:n[s],y:n[s+1],z:n[s+2]},l={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[c],y:n[c+1],z:n[c+2]};a.push({p0:h,p1:l,p2:f})}return a},e}();function n5(e,i){var r=null!=i?i:{},n=r.env,a=r.wireframe,o=[["ENV_EDITOR",(void 0===n?"":n)===nL]];return{fragment:a?r_:rC,vertex:rS,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:o,shared:!0}}function n6(t,e){return t.cachePrefix+"_effects_sprite_"+e}function n8(t,e,i,r){var n=t.wireframe,a=n5(i,{wireframe:n,env:r});return a.shared=!0,n||(a.cacheId=n6(t,e)),a}function n9(e){t.maxSpriteMeshItemCount=e}t.maxSpriteMeshItemCount=8;var n7={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},at=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return e$(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),a=i.engine.gpuCapability,o=a.level,s=a.detail,u=(null!=r?r:{}).env;return(null==n?void 0:n.shaderResults[n6(n7,2)])||(null==n||n.addShader(n8(n7,2,1,u)),null==n||n.addShader(n8(n7,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&(null==n||n.addShader(iC(o,!0)))),Promise.resolve()},i}(eK),ae=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=ix(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=ix(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var o,s=ix(this.playableOutputs);!(o=s()).done;){var u=o.value;this.processFrameWithRoot(u)}for(var c,h=ix(this.playables);!(c=h()).done;){var l=c.value;this.updatePlayableTime(l,t)}},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}(),ai=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,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(eo(e,t)){for(var r=0;r<this.inputs.length;r++)if(this.inputs[r]===e){this.inputWeight[r]=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.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}(),ar=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}(),an=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(it);(to=t3||(t3={}))[to.Playing=0]="Playing",to[to.Paused=1]="Paused",(ts=t4||(t4={}))[ts.Mix=0]="Mix",ts[ts.Passthrough=1]="Passthrough";var aa=new iv,ao=1,as=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new il(0,0,0),this.quat=new iv(0,0,0,1),this.rotation=new rl(0,0,0),this.scale=new il(1,1,1),this.anchor=new il(0,0,0),this.size=new ih(1,1),this.children=[],this.worldMatrix=iy.fromIdentity(),this.localMatrix=iy.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new il(0,0,0),quat:new iv(0,0,0,1),scale:new il(1,1,1)},this.name="transform_"+ao++,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,r=t.rotation,n=t.scale,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(eo(i,il)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)eo(o,iv)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var c=e?-1:1;eo(r,rl)?this.setRotation(r.x*c,r.y*c,r.z*c):this.setRotation(r[0]*c,r[1]*c,r[2]*c)}n&&(eo(n,il)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(eo(u,ih)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){ep(this.children,t)},e.removeChild=function(t){em(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rl)},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 rl)},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 il().copyFrom(t.position),rotation:new rl(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new il().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=aa.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},e3(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}(),au=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),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.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 as,r.time=0,r.duration=0,r.start=0,r.endBehavior=tI.forward,r.ended=!1,r.reusable=!1,r.type=tE.base,r.isDuringPlay=!1,r.components=[],r.rendererComponents=[],r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new au,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}e$(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.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))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,i,r=ix(this.components);!(i=r()).done;){var n=i.value;if(eo(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=ix(this.components);!(e=r()).done;){var n=e.value;eo(n,t)&&i.push(n)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&em(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())},r.onEnd=function(){},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.getVisible=function(){return this.visible},r.setVisible=function(t){this.visible!==t&&(this.visible=!!t,this.onActiveChanged())},r.getWorldTransform=function(t){var e=null!=t?t:new as({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new rl(t,e,i),n=iv.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/s)*a,i)}},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new il;return this.transform.assignWorldTRS(t),t},r.isEnded=function(t){return t-this.duration>.001},r.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))}},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.visible&&!this.isEnabled&&this.onEnable();for(var t,e=ix(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=ix(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=ix(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=ix(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r=i.id,n=i.name,a=i.delay,o=i.parentId,s=i.endBehavior,u=i.transform,c=i.listIndex,h=i.duration,l=void 0===h?0:h;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,this.start=a||this.start,u&&(u.position=new il().copyFrom(u.position),u.quat?u.quat=new iv(u.quat.x,u.quat.y,u.quat.z,u.quat.w):u.rotation=new rl().copyFrom(null!=(f=u.eulerHint)?f:u.rotation),u.scale=new il().copyFrom(u.scale),u.size&&(u.size=new ih().copyFrom(u.size)),u.anchor&&(u.anchor=new ih().copyFrom(u.anchor)),this.transform.setTransform(u)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=l,this.endBehavior=s,i.content||(i.content={options:{}}),l<=0)throw Error("Item duration can't be less than 0, see "+nP["Item duration can't be less than 0"]+".");this.rendererComponents.length=0;for(var f,d,p=ix(this.components);!(d=p()).done;){var m=d.value;m.item=this,eo(m,ir)&&this.rendererComponents.push(m),eo(m,t.ParticleSystem)&&(this.components.includes(m.renderer)||this.components.push(m.renderer),this.rendererComponents.push(m.renderer))}this.renderOrder=void 0===c?0:c},r.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=tH.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,r,n=ix(this.components);!(r=n()).done;){var a=r.value;eo(a,t.EffectComponent)&&this.taggedProperties.components.push(a)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=ix(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e,i=ix(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&em(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tE.composition},i.isSprite=function(t){return t.type===tE.sprite},i.isParticle=function(t){return t.type===tE.particle},i.isNull=function(t){return t.type===tE.null},i.isTree=function(t){return t.type===tE.tree},i.isCamera=function(t){return t.type===tE.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},e3(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=ix(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}}]),i}(it),eu([e7(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=eu([e8(tH.VFXItemData)],t.VFXItem),t.Item=void 0,(tu=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tu.isComposition=function(t){return t.type===tE.composition},tu.isParticle=function(t){return t.type===tE.particle},tu.isNull=function(t){return t.type===tE.null};var ac=[1,1,1,1],ah=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}e$(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(eo(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(s=this.activeComponent)?void 0:s.material;var o,s,u,c=null==(u=this.activeMaterial)?void 0:u.getVector4("_Color");c&&(this.startColor=c.toArray())}null==(o=this.activeComponent)||o.setAnimationTime(this.time);var h=r5(ac,1),l=this.time/a.duration,f=this.opacityOverLifetime,d=this.colorOverLifetime;d&&(h=eg(d,l,!0),i=!0),f&&(h[3]*=f.getValue(l),i=!0),i&&(r6(this.renderColor,h,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getVector4("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=nF(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tw.GRADIENT_COLOR&&(this.colorOverLifetime=ex(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(nN)},i}(ai),al=[[0,0,1,1,void 0]],af=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new ah(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(an),t.SpriteColorPlayableAsset=eu([e8(tH.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset),t.SpriteComponent=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).splits=al,r.frameAnimationLoop=!1,r.name="MSprite"+af++,r.geometry=r.createGeometry(iO.TRIANGLES),r.setItem(),i&&r.fromData(i),r}e$(e,t);var i=e.prototype;return i.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),a=this.textureSheetAnimation;if(a){var o,s,u,c,h,l=a.total||a.row*a.col,f=0,d=0,p=1,m=1;if(this.splits){var v=this.splits[0];s=v[4],f=v[0],d=v[1],s?(p=v[3],m=v[2]):(p=v[2],m=v[3])}if(s?(u=1/a.row*p,c=1/a.col*m):(u=1/a.col*p,c=1/a.row*m),a.animate){var y=Math.round(n*(l-1)),g=Math.floor(y/a.col),x=y-g*a.col;h=s?[u*g,c*(a.col-x)]:[u*x,c*(1+g)]}else h=[0,c];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([f+h[0],m+d-h[1],u,c])}var b=this.renderer.texture.source.video;b&&(0===i||i===this.item.duration?b.pause():b.play().catch(function(t){e.engine.renderErrors.add(t)}))},i.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},i.createGeometry=function(t){var e=12*this.splits.length;return rc.create(this.engine,{attributes:{aPos:{type:iO.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:iO.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},i.getItemGeometryData=function(){var t=this.splits,e=this.textureSheetAnimation,i=this.renderer;if(i.shape){for(var r=i.shape,n=r.index,a=r.aPoint,o=void 0===a?[]:a,s=new Float32Array(o),u=[],c=[],h=0;h<s.length;h+=6)s[h]*=1,s[h+1]*=1,c.push(o[h+2],o[h+3]),u.push(s[h],s[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:void 0===n?[]:n,atlasOffset:c}}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],S=x[1],C=x[4]?x[3]:x[2],A=x[4]?x[2]:x[3],O=[-.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]*C+_,b[1]*A+S,b[2]*C+_,b[3]*A+S,b[4]*C+_,b[5]*A+S,b[6]*C+_,b[7]*A+S),m.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[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}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,a,o,s,u=e.interaction,c=e.options,h=e.listIndex,l=e.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:t_.BILLBOARD,blending:null!=(r=l.blending)?r:tm.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===ty.MASK,side:null!=(a=l.side)?a:tv.DOUBLE,shape:l.shape,mask:null!=(o=l.mask)?o:0,maskMode:null!=(s=l.maskMode)?s:ty.NONE,order:void 0===h?0:h},this.emptyTexture=this.engine.emptyTexture,this.splits=e.splits||al,this.textureSheetAnimation=e.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nz(this);var f=this.createGeometry(iO.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=iy.fromIdentity(),this.material=d,this.geometry=f;var p=c.startColor||[1,1,1,1];this.material.setVector4("_Color",new id().setFromArray(p)),this.material.setVector4("_TexOffset",new id().setFromArray([0,0,1,1])),this.setItem()},e}(nN),t.SpriteComponent=eu([e8(tH.SpriteComponent)],t.SpriteComponent);var ad="lookup_texture",ap="offscreen_canvas",am={},av=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=ay(this.arc,this.arcMode,t)*ia,i=new il(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*ia),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eU(0,1)),direction:n.normalize()}},t}();function ay(t,e,i){if(e===tP.RANDOM)t=eU(0,t);else if(e===tP.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tP.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===tP.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var ag=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=ay(this.arc,this.arcMode,t)*ia,i=new il(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),ax=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eU(-this._d,this._d),i=eU(-this._h,this._h);return{direction:new il(0,0,1),position:new il(e,i,0)}},t}(),ab=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=ay(this.arc,this.arcMode,t)*ia,i=new il(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new il;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),aT=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tP.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eU(0,1);return{direction:new il(0,1,0),position:new il(this._d*(e-.5),0,0)}},t}(),aE=new iy,a_=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=eU(0,2*Math.PI),n=ay(this.arc,this.arcMode,t)*ia,a=aE.setFromRotationZ(n),o=new il(Math.cos(r),Math.sin(r),0),s=new il(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),aS=new iy,aC=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 eU(-90,90)},e.generate=function(t){var e=ay(this.arc,this.arcMode,t)*ia,i=this.getHorizontalAngle()*ia,r=this.radius,n=new il(Math.cos(i),0,Math.sin(i)),a=aS.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),aA=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.getHorizontalAngle=function(){return eU(0,90)},e}(aC),aO=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=ic(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(ay(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,a=new il(r,n,0);return{position:new il(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),aw=function(){function t(){}return t.prototype.generate=function(){return{position:new il,direction:new il}},t}(),aR=((t5={})[tg.NONE]=aw,t5[tg.CONE]=av,t5[tg.SPHERE]=aC,t5[tg.HEMISPHERE]=aA,t5[tg.CIRCLE]=ag,t5[tg.DONUT]=a_,t5[tg.RECTANGLE]=ax,t5[tg.EDGE]=aT,t5[tg.RECTANGLE_EDGE]=ab,t5[tg.TEXTURE]=aO,t5);function aI(t){if(!t)return new aw;var e=iV({radius:1,arc:360,angle:0,arcMode:tP.RANDOM},t),i=t.type,r=aR[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tg.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=il.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function aM(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=aj(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=aj(a,t[a],t[a+1],o);return o&&aN(o,o.next)&&(aX(o),o=o.next),o}function aL(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(aN(r,r.next)||0===aD(r.prev,r,r.next))){if(aX(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function aP(t,e){return t.x-e.x}function aV(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 aF(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function aD(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function aN(t,e){return t.x===e.x&&t.y===e.y}function az(t,e,i,r){var n=aU(aD(t,e,i)),a=aU(aD(t,e,r)),o=aU(aD(i,r,t)),s=aU(aD(i,r,e));return!!(n!==a&&o!==s||0===n&&ak(t,i,e)||0===a&&ak(t,r,e)||0===o&&ak(i,t,r)||0===s&&ak(i,e,r))}function ak(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 aU(t){return t>0?1:t<0?-1:0}function aB(t,e){return 0>aD(t.prev,t,t.next)?aD(t,e,t.next)>=0&&aD(t,t.prev,e)>=0:0>aD(t,e,t.prev)||0>aD(t,t.next,e)}function aG(t,e){var i=new aH(t.i,t.x,t.y),r=new aH(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function aj(t,e,i,r){var n=new aH(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 aX(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 aH(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 aW=0;function aY(t,e,i,r){i=i||2,aW=r||0;var n,a,o,s,u,c,h,l=e&&e.length,f=l?e[0]*i:t.length,d=aM(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,a,o,s,u,c=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=aM(t,o,s,r,!1))===u.next&&(u.steiner=!0),c.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(c.sort(aP),n=0;n<c.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var c=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(c<=o&&c>u){if(u=c,c===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var h,l=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&aF(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(h=Math.abs(s-a.y)/(o-a.x),aB(a,t)&&(h<p||h===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>aD(i.prev,i,r.prev)&&0>aD(r.next,i,i.next))))&&(n=a,p=h)),a=a.next;while(a!==l);return n}(t,e)){var i=aG(e,t);aL(e,e.next),aL(i,i.next)}})(c[n],i),i=aL(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],c=t[m+1],u<n&&(n=u),c<a&&(a=c),u>o&&(o=u),c>s&&(s=c);h=0!==(h=Math.max(o-n,s-a))?1/h:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=aV(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,a,o,s,u,c=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(u=c;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,c*=2}while(o>1)}(n)}(e,n,a,o);for(var u,c,h=e;e.prev!==e.next;){if(u=e.prev,c=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(aD(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,c=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,h=aV(o,s,e,i,r),l=aV(u,c,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&aF(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&aD(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&aF(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&aD(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&aF(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&aD(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&aF(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&aD(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(aD(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(aF(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&aD(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+aW),i.push(e.i/r+aW),i.push(c.i/r+aW),aX(e),e=c.next,h=c.next;continue}if((e=c)===h){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!aN(n,a)&&az(n,r,r.next,a)&&aB(n,a)&&aB(a,n)&&(e.push(n.i/i+aW),e.push(r.i/i+aW),e.push(a.i/i+aW),aX(r),aX(r.next),r=t=a),r=r.next}while(r!==t);return aL(r)}(aL(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,c,h=s.next.next;h!==s.prev;){if(s.i!==h.i&&(u=s,c=h,u.next.i!==c.i&&u.prev.i!==c.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&&az(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,c)&&(aB(u,c)&&aB(c,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,c)&&(aD(u.prev,u,c.prev)||aD(u,c.prev,c))||aN(u,c)&&aD(u.prev,u,u.next)>0&&aD(c.prev,c,c.next)>0))){var l=aG(s,h);s=aL(s,s.next),l=aL(l,l.next),t(s,i,r,n,a,o),t(l,i,r,n,a,o);return}h=h.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(aL(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,h),p}function aZ(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,c=0;c<o.length;c++)u+=o[c].length-1;var h,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=(h=d[4])?d[3]:d[2],g=h?d[2]:d[3]);for(var x=[0,0],b=0===h?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],S=s[T+1]||s[0],C=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,a,o,s){var u=1-e,c=u*u*u,h=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=c*i[0]+h*n+l*o+f*r[0],t[1]=c*i[1]+h*a+l*s+f*r[1]})(C,E[A],_,S,_[4],_[5],S[2],S[3]),i=C[0],r=C[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,aQ(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 O=aY(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(O)}}function aq(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tw.SHAPE_POINTS,t.p],s:[tw.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tw.SHAPE_POINTS,t.g.p],s:[tw.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var c=aZ(n[u],{indexBase:a,uvTransform:e});a+=c.aPoint.length/5,r.push(c),o+=c.aPoint.length,s+=c.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(o),l=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];h.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:h,index:l}}function aQ(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var aK=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=eo(r,np)?r:nF(r),this.cycles=+n||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}(),aJ=function(t){this.content=t},a$=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 aJ(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 aJ(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,a=t.next;n.next=a,a&&(a.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}(),a0=new il,a1=new il,a2=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?nF(1):s,c=i.widthOverTrail,h=i.name,l=i.occlusion,f=i.blending,d=i.maskMode,p=i.textureMap,m=i.texture,v=i.transparentOcclusion,y=i.minimumVertexDistance,g=i.lifetime,x=i.matrix,b=e.gpuCapability,T=b.detail,E=b.level,_=Math.max(i.pointCountPerTrail,2),S=nR(),C=T.maxVertexTextures>0,A=(null!=(r=e.renderer)?r:{}).env,O={},w=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===nL]],R=o>64,I=0;n&&(w.push(["COLOR_OVER_LIFETIME",!0]),I|=1,O.uColorOverLifetime=i2.createWithData(e,eA(n))),a&&(w.push(["COLOR_OVER_TRAIL",!0]),I|=4,O.uColorOverTrail=i2.createWithData(e,eA(a))),R?(w.push(["ATTR_TRAIL_START",1]),I|=8):O.uTrailStart=new Float32Array(o),O.uOpacityOverLifetimeValue=u.toUniform(S);var M=c.toUniform(S);w.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),O.uVCurveValues=np.getAllData(S);var L={shader:{vertex:rw,fragment:rA,macros:w,glslVersion:1===E?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+I+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=_*o*2,V=(_-1)*o,F=Float32Array.BYTES_PER_ELEMENT,D=12*F,N={attributes:{aColor:{size:4,stride:D,data:new Float32Array(12*P)},aSeed:{size:1,stride:D,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:D,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:D,offset:8*F,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(P)},aDir:{size:3,data:new Float32Array(3*P)}},indices:{data:new Uint16Array(6*P)},drawCount:6*V,name:"trail#"+h,bufferUsage:iO.DYNAMIC_DRAW};if(R)N.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var z=new Float32Array(P);N.attributes.aTrailStartIndex={size:1,data:z};for(var k=0;k<o;k++)for(var U=2*_,B=k*U,G=0;G<U;G++)z[B+G]=k}var j=iI(f),X=rr.create(e,L);X.blending=!0,X.depthMask=l,X.depthTest=!0,iP(X,d),iM(X,f);var H=this.mesh=rx.create(e,{name:"MTrail_"+h,material:X,geometry:rc.create(e,N)}),W=null!=m?m:i2.createWithData(e);Object.keys(O).map(function(t){var e=O[t];if(eo(e,i2))X.setTexture(t,e);else if("uTrailStart"===t)X.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new id(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}X.setVector4Array(t,i)}else X.setVector4(t,id.fromArray(e))}),X.setFloat("uTime",0),X.setVector4("uWidthOverTrail",id.fromArray(M)),X.setVector2("uTexOffset",new ih(0,0)),X.setVector4("uTextureMap",id.fromArray(void 0===p?[0,0,1,1]:p)),X.setVector4("uParams",new id(0,_-1,0,0)),X.setTexture("uMaskTex",W),X.setVector4("uColorParams",new id(m?1:0,+j,0,+(l&&!v))),this.maxTrailCount=o,this.pointCountPerTrail=_,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=R,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=H.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,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,c=(r-2)%n,h=this.getTrailPosition(t,u,a0);if(!(h&&this.checkVertexDistance&&(null==h?void 0:h.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=a6(h,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),a.setAttributeSubData("aDir",6*l,v),a.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,a.setAttributeSubData("aColor",24*l,g),u>=0){var b=new Float32Array(a6(this.getTrailPosition(t,c,a1),h,e)),T=(t*n+u)*6;a.setAttributeSubData("aDir",T,b),a.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*s+E,2*s+E,2*u+1+E,2*s+1+E]),S=(t*o+(r-1)%o)*6;a.setIndexSubData(S,_)}r=++this.trailCursors[t];var C=this.mesh.material,A=C.getVector4("uParams"),O=p[2];if(this.useAttributeTrailStart){for(var w=2*n,R=new Float32Array(w),I=0;I<w;I++)R[I]=O;a.setAttributeSubData("aTrailStart",t*R.length,R)}else{var M=C.getFloats("uTrailStart");void 0!=M&&(M[t]=O,C.setFloats("uTrailStart",M))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),C.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.geometry.getAttributeData("aColor");return eI(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();eI(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");eI(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();eI(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){},e3(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}(),a3=new il,a4=new il,a5=new il;function a6(t,e,i){return t||i?(t?i?(a4.subtractVectors(e,t).normalize(),a4.subtractVectors(i,e),a5.copyFrom(a4).normalize(),a3.addVectors(a4,a5)):a3.subtractVectors(e,t):a3.subtractVectors(i,e),a3.normalize().toArray()):[0,0,0]}var a8=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new oh(e,i)),r&&(n.trailMesh=new a2(e,r));var n,a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}e$(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=ix(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 id;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){for(var e,i=ix(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}(ir);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)===tL.removeParticle,ray:t})}}},r&&n.fromData(r),n}e$(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.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]===tw.CONSTANT_VEC3?e.add(r[1]):t=nF(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,a=e.clone();if(t&&a.add(t.getValue(0)),this.transform.setPosition(a.x,a.y,a.z),this.options.particleFollowParent&&n){var o=n.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},r.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var a=this.item.duration;n.add(r.getValue(t/a))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var o=e.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},r.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 a=r.first;r.removeNode(a),i=n[1]=a.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())},r.setVisible=function(t){this.renderer.setVisible(t)},r.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 id(n[0],n[1],n[2],t));for(var a=r.getAttributeData("aColor")||[],o=0;o<a.length;o+=32)a[8*o+7]=t},r.setColor=function(t,e,i,r){var n,a=this.renderer.particleMesh.mesh.material,o=this.renderer.particleMesh.mesh.geometry,s=(null==(n=a.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];a.setVector4("uOpacityOverLifetimeValue",new id(s[0],s[1],s[2],r));for(var u=o.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=i,u[8*c+7]=r},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.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 a$(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},r.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,c=!1,h=function(){e.trails&&!c&&(c=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(this.ended){if(this.item.endBehavior!==tI.restart&&tI.destroy===this.item.endBehavior){var l=o.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/a.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=o.first;return e.emissionStopped||o.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=a.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var S=T[E],C=!S.disabled&&S.getGeneratorOptions(u,d);if(C){var A=[0,0,0],O=a.burstOffsets[E],w=O&&O[C.cycleIndex]||A;S.once&&this.removeBurst(E);for(var R=0;R<C.count&&_<y&&!g();R++){var I,M=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:R,burstCount:C.count}));M.delay+=i,_++,(I=M.transform).translate.apply(I,[].concat(w)),this.addParticle(M,y)}}}}else this.item.endBehavior===tI.restart?(h(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,a.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===tI.freeze&&(this.frozen=!0))}h()}},r.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}})}))},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);i.push({center:c,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new il,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],c=s[1];s[2];var h=s[3];if(u>this.timePassed){var l=this.getPointPosition(h),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(o=!0))}else break}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),c=1,h=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(c*=u[0]),a.sizeAffectsLifetime&&(h*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&o.subtract(l)}n.addTrailPoint(t,o,{color:s,lifetime:h,size:c,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.lastUpdate-n,u=new il,c=il.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var h=r3(new il,this.options,c,s,r,u,i);if(o){var l=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;h.x=h.x*d+l[0]*f,h.y=h.y*d+l[1]*f,h.z=h.z*d+l[2]*f}return h},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),c=a.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),h=t.position,l=new as({position:c.transformPoint(h,new il),valid:!0}),f=t.direction;if(f=c.transformNormal(f,a9).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)or.setElement(d,a.turbulence[d].getValue(o));on.setFromVector3(or.negate()),oo.setFromEuler(on).transformNormal(f).normalize()}s.alignSpeedDirection?(oi.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=il.Z.clone(),c.transformNormal(this.upDirectionWorld)),oe.crossVectors(oi,this.upDirectionWorld).normalize(),oe.isZero()&&oe.set(1,0,0)):(oe.set(1,0,0),oi.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=oa)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?ot.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?ot.set(0,0,a.startRotation.getValue(o)):ot.set(0,0,0),l.setRotation(ot.x,ot.y,ot.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)a7.x=a.startSizeX.getValue(o),a7.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);a7.x=v,a7.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new il;this.transform.assignWorldTRS(void 0,void 0,x),a7.x*=x.x,a7.y*=x.y}return l.setScale(a7.x,a7.y,1),{size:a7,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:oi,dirX:oe,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&eo(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.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))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,a,o,s,u,c,h,l,f,d,p,m=t.options,v=t.positionOverLifetime,y=void 0===v?{}:v,g=t.shape,x=null==y?void 0:y.gravityOverLifetime,b=r4(null==y?void 0:y.gravity),T=t.textureSheetAnimation,E=T?{animationDelay:nF(T.animationDelay||0),animationDuration:nF(T.animationDuration||1),cycles:nF(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[nF(null!=(a=g.turbulenceX)?a:0),nF(null!=(o=g.turbulenceY)?o:0),nF(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=aI(g),this.emission={rateOverTime:nF(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=eo(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new aK(t)})},this.textureSheetAnimation=E;var S=t.renderer||{},C={},A=t.rotationOverLifetime;A&&(C.asRotation=!!A.asRotation,C.z=A.z?nF(A.z):nF(0),A.separateAxes&&(C.x=A.x&&nF(A.x),C.y=A.y&&nF(A.y))),(null==y?void 0:y.forceTarget)&&(c={target:y.target||[0,0,0],curve:nF(y.forceCurve||[tw.LINE,[[0,0],[1,1]]])});var O={x:y.linearX&&nF(y.linearX||0),y:y.linearY&&nF(y.linearY||0),z:y.linearZ&&nF(y.linearZ||0),asMovement:y.asMovement},w={x:y.orbitalX&&nF(y.orbitalX),y:y.orbitalY&&nF(y.orbitalY),z:y.orbitalZ&&nF(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},R=t.sizeOverLifetime||{},I=t.colorOverLifetime,M=(null==R?void 0:R.separateAxes)?{separateAxes:!0,x:nF(R.x),y:nF(R.y)}:{separateAxes:!1,x:nF(("size"in R?R.size:R.x)||1)};S.anchor=S.anchor||[0,0];var L=ih.fromArray(S.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:nF(m.startLifetime),startDelay:nF(m.startDelay||0),startSpeed:nF(y.startSpeed||0),startColor:nF(m.startColor),looping:!1,maxCount:null!=(h=m.maxCount)?h:0,gravityModifier:nF(x||0),gravity:b,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&nF(y.speedOverLifetime),linearVelOverLifetime:O,orbitalVelOverLifetime:w,forceTarget:c},m.startRotationZ&&(this.options.startRotation=nF(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=nF(m.startRotationX||0),this.options.startRotationY=nF(m.startRotationY||0),this.options.startRotationZ=nF(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=nF(m.startSizeX),this.options.startSizeY=nF(m.startSizeY)):(this.options.startSize=nF(m.startSize),this.options.sizeAspect=nF(m.sizeAspect||1));var P={meshSlots:m.meshSlots,name:this.name,matrix:iy.IDENTITY,shaderCachePrefix:"",renderMode:S.renderMode||t_.BILLBOARD,side:S.side||tv.DOUBLE,gravity:b,blending:S.blending||tm.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!S.occlusion,transparentOcclusion:!!S.transparentOcclusion,maxCount:m.maxCount,mask:S.mask,maskMode:null!=(l=S.maskMode)?l:ty.NONE,forceTarget:c,diffuse:S.texture,sizeOverLifetime:M,anchor:L};if(I){var V=I.color,F=I.opacity;P.colorOverLifetime={},F&&(P.colorOverLifetime.opacity=nF(I.opacity)),V&&(V[0]===tw.GRADIENT_COLOR?P.colorOverLifetime.color=I.color[1]:V[0]===tw.RGBA_COLOR?P.colorOverLifetime.color=i2.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):eo(V,i2)&&(P.colorOverLifetime.color=V))}var D=[],N=[0,0,1,1];if(t.splits){var z=t.splits[0];N=(f=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(E&&!E.animate)for(var k=f?E.row:E.col,U=f?E.col:E.row,B=E.total||k*U,G=0,j=0;j<k;j++)for(var X=0;X<U&&G<B;X++,G++)D.push([j*N[2]/k+N[0],X*N[3]/U+N[1],N[2]/k,N[3]/U]);else D.push(N);this.uvs=D,P.textureFlip=f;var H=t.trails;H&&(this.trails={lifetime:nF(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},d={name:"Trail",matrix:iy.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture,opacityOverLifetime:nF(H.opacityOverLifetime||1),widthOverTrail:nF(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:S.mask,maskMode:S.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tw.GRADIENT_COLOR&&(d.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tw.GRADIENT_COLOR&&(d.colorOverTrail=H.colorOverTrail[1])),this.renderer=new a8(this.engine,P,d),this.renderer.item=this.item,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(p=W.radius)?p:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},e3(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}(ie),t.ParticleSystem=eu([e8(tH.ParticleSystem)],t.ParticleSystem);var a9=new il,a7=new ih,ot=new rl,oe=new il,oi=new il,or=new il,on=new rl,oa=[0,0,0],oo=new iy,os=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}e$(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&eo(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.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}(ai),ou=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){return new os(t)},e}(an),oc={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"},oh=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new il,this.cachedRotationMatrix=new rf,this.cachedLinearMove=new il,this.tempMatrix3=new rf,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a,o,s,u,c,h,l,f=(null!=(c=e.renderer)?c:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,b=i.gravityModifier,T=i.maxCount,E=i.textureFlip,_=i.useSprite,S=i.name,C=i.gravity,A=i.forceTarget,O=i.side,w=i.occlusion,R=i.anchor,I=i.blending,M=i.maskMode,L=i.mask,P=i.transparentOcclusion,V=i.meshSlots,F=i.renderMode,D=void 0===F?0:F,N=i.diffuse,z=void 0===N?i2.createWithData(e):N,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+D],["ENV_EDITOR",f===nL]],j=e.gpuCapability.level,X=nR(),H=nR(),W=B>0,Y={},Z=0,q=0;this.useSprite=_,W&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,Y.uSpeedLifetimeValue=d.toUniform(X)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,Y.uFSprite=Y.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==p?void 0:p.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,Y.uColorOverLifetime=eo(p.color,i2)?p.color:i2.createWithData(e,eA(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(X):Y.uOpacityOverLifetimeValue=nF(1).toUniform(X),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==m?void 0:m[t])&&(Y["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=m[t].toUniform(X),i=1,q|=1<<7+e,m.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==v?void 0:v[t])&&(Y["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(X),r=1,q|=1<<10+e,h=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==m?void 0:m.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),h&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),Y.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),Y.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(X),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,Y.uSizeYByLifetimeValue=null==y?void 0:null==(l=y.y)?void 0:l.toUniform(X)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(X),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(X),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(X),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),Y.uGravityModifierValue=b.toUniform(X),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(X)),U&&H.max?(q|=1048576,Y.uFCurveValueTexture=i3(e,np.getAllData(H,!0),H.index,1)):Y.uFCurveValues=np.getAllData(H);var Q=X.max+X.curves.length-32>B;if(2===j&&(X.max=-1,X.index=V?V[0]:of(X.index),H.index>0&&(H.max=-1,H.index=V?V[1]:of(H.index))),Q&&U&&W){var K=i3(e,np.getAllData(X,!0),X.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=np.getAllData(X);var J=["-p:",D,q,X.index,X.max,H.index,H.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",X.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",X.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]),this.VERT_MAX_KEY_FRAME_COUNT=X.max;var $={fragment:rA,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+rO,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+S},tt=iI(I);Y.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Y.uMaskTex=z,Y.uColorParams=new Float32Array([z?1:0,+tt,0,+(!!w&&!P)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==C?void 0:C[0])||0,(null==C?void 0:C[1])||0,(null==C?void 0:C[2])||0,0];var te=rr.create(e,{shader:$,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});te.blending=!0,te.depthTest=!0,te.depthMask=!!w,te.stencilRef=L?[L,L]:void 0,iP(te,M),iM(te,I),iL(te,O),Object.keys(Y).map(function(t){var e=Y[t];if(eo(e,i2)){te.setTexture(t,e);return}var i=[];switch(oc[t]){case"vec4":te.setVector4(t,id.fromArray(e));break;case"vec3":te.setVector3(t,il.fromArray(e));break;case"vec2":te.setVector2(t,ih.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new id(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}te.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),te.setVector3("emissionColor",new il(0,0,0)),te.setFloat("emissionIntensity",0);var ti=rc.create(e,(r=4*T,n=this.useSprite,a="particle#"+S,u={aPos:{size:3,offset:0,stride:s=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:s,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"}},n&&(u.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:a,maxVertex:r})),tr=rx.create(e,{name:"MParticle_"+S,material:te,geometry:ti});this.anchor=R,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=b,this.rotationOverLifetime=g,this.maxCount=T,this.textureOffsets=E?[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 eI(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],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.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,a=4*n,o=this.geometry,s=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 c={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(c.aSprite=new Float32Array(12));var l=new il,f=new iv,d=new il(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=as.getRotation(f,new rl),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();h&&(r=e.sprite);for(var S=0;S<4;S++){var C=2*S,A=3*S,O=4*S,w=12*S,R=8*S;c.aPos.set(m,w),b.fill(c.aPos,w+3),c.aRot.set(v,R),c.aRot[R+3]=_,c.aRot.set(T,R+4),h&&c.aSprite.set(r,A);var I=e.uv||x;if(I){var M=h?1-y[C+1]:y[C+1];g[0]=I[0]+y[C]*I[2],g[1]=I[1]+M*I[3]}c.aOffset.set(g,O);for(var L=S+S,P=(E[L]-this.anchor.x)*d.x,V=(E[L+1]-this.anchor.y)*d.y,F=0;F<3;F++)c.aPos[w+6+F]=e.dirX.getElement(F)*P,c.aPos[w+9+F]=e.dirY.getElement(F)*V}var D=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var N=ev(o.getIndexData(),6*n,6*i,u);N.set(D,6*t),o.setIndexData(N),this.maxParticleBufferCount=N.length/6}else o.setIndexSubData(6*t,D);Object.keys(c).forEach(function(e){var r=c[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var h=o.getAttributeData(e);eI(h);var l=ev(h,a*n,4*i*n,u);l.set(r,r.length*t),o.setAttributeData(e,l)}else o.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),o.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,c=this.mesh.material.getVector4("uAcceleration"),h=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*l+2],p=a[4*l+3];if(c&&h){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=c.x*m,y=c.y*m,g=c.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*l;if(a[4*l+2]<i){var T=e/1e3*o,E=e/1e3*s,_=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"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var c=o-r[4*u+2],h=r[4*u+3],l=ic(c/h,0,1),f=8*u,d=this.cachedRotationVector3.set(n[f],n[f+1],n[f+2]),p=a[8*u+3];this.rotationOverLifetime?this.rotationOverLifetime.asRotation?(this.rotationOverLifetime.x&&(eo(this.rotationOverLifetime.x,ny)?d.x+=this.rotationOverLifetime.x.getValue(l,p):d.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(eo(this.rotationOverLifetime.y,ny)?d.y+=this.rotationOverLifetime.y.getValue(l,p):d.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(eo(this.rotationOverLifetime.z,ny)?d.z+=this.rotationOverLifetime.z.getValue(l,p):d.z+=this.rotationOverLifetime.z.getValue(l))):(this.rotationOverLifetime.x&&(eo(this.rotationOverLifetime.x,ny)?d.x+=this.rotationOverLifetime.x.getIntegrateValue(0,l,p)*h:d.x+=this.rotationOverLifetime.x.getIntegrateValue(0,l,h)*h),this.rotationOverLifetime.y&&(eo(this.rotationOverLifetime.y,ny)?d.y+=this.rotationOverLifetime.y.getIntegrateValue(0,l,p)*h:d.y+=this.rotationOverLifetime.y.getIntegrateValue(0,l,h)*h),this.rotationOverLifetime.z&&(eo(this.rotationOverLifetime.z,ny)?d.z+=this.rotationOverLifetime.z.getIntegrateValue(0,l,p)*h:d.z+=this.rotationOverLifetime.z.getIntegrateValue(0,l,h)*h)):s.setZero(),0===d.dot(d)&&s.identity();var m=Math.PI/180,v=d.x*m,y=d.y*m,g=d.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),_=Math.cos(y),S=Math.cos(g);s.set(S,-T,0,T,S,0,0,0,1),s.multiply(this.tempMatrix3.set(_,0,b,0,1,0,-b,0,_)),s.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var C=9*u,A=s.elements;i.set(A,C),u+4<=t&&(i.set(A,C+9),i.set(A,C+18),i.set(A,C+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=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 s=0;s<t;s+=4){var u=a-r[4*s+2],c=r[4*s+3],h=u/c,l=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(eo(this.linearVelOverLifetime.x,ny)?o.x=this.linearVelOverLifetime.x.getValue(h,l):o.x=this.linearVelOverLifetime.x.getValue(h)),this.linearVelOverLifetime.y&&(eo(this.linearVelOverLifetime.y,ny)?o.y=this.linearVelOverLifetime.y.getValue(h,l):o.y=this.linearVelOverLifetime.y.getValue(h)),this.linearVelOverLifetime.z&&(eo(this.linearVelOverLifetime.z,ny)?o.z=this.linearVelOverLifetime.z.getValue(h,l):o.z=this.linearVelOverLifetime.z.getValue(h))):(this.linearVelOverLifetime.x&&(eo(this.linearVelOverLifetime.x,ny)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,l):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c)),this.linearVelOverLifetime.y&&(eo(this.linearVelOverLifetime.y,ny)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,l):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c)),this.linearVelOverLifetime.z&&(eo(this.linearVelOverLifetime.z,ny)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,l):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),ol=[10,32,64,160];function of(t){for(var e=0;e<ol.length;e++){var i=ol[e];if(i>t)return i}return t||ol[0]}function od(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===nL]],c=e.level,h=e.detail,l=nR(),f=nR(),d=h.maxVertexUniforms>0,p=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,nw(l,p));var y=o.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=o.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&nw(l,x);var b=o.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])&&(nw(l,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(nw(l,b[n]),o=1,v|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),a&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(nw(l,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,nw(l,T.y)):nw(l,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(nw(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(nw(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(nw(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)}nw(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,nw(l,b.forceCurve));var _=h.halfFloatTexture;_&&f.max&&(v|=1048576);var S=h.maxVertexUniforms,C=l.max+l.curves.length-32>S;am[ad]&&(C=!0),2===c&&(l.max=-1,f.index>0&&(f.max=-1)),C&&_&&d&&(m=1);var A={fragment:rA,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+rO,shared:!0,cacheId:["-p:",s,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:A,vertex:l.index,fragment:f.index}}function op(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 a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}}var om=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,a=n.level,o=(null!=r?r:{}).env,s=i.getShaderLibrary(),u=[],c=[],h=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=od(e,n,o),r=i.shader,u=i.fragment,f=i.vertex;if(c.push(r),h=Math.max(h,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=o)&&(v=""),y=0,g=am[ad]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===nL]],b=nR(),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),nw(b,d.opacityOverLifetime),nw(b,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),{vertex:rw,fragment:rA,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+b.index+"+"+b.max});T.glslVersion=2===a?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,null==s||s.addShader(T)}}),c.forEach(function(e){2===a?(op(e,l,h),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,null==s||s.addShader(e)}),2===a&&u.forEach(function(t){t.content.options.meshSlots=[l,h]}),Promise.resolve()},i}(eK),ov=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK),oy=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(eo(e,og))return e.animationStream},t}(),og=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new oy(im(i)),i}return e$(e,t),e}(ai),ox=new rl,ob=new il(1,1,1),oT=new il,oE=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.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 il(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=nF(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&nF(r.linearX),y:r.linearY&&nF(r.linearY),z:r.linearZ&&nF(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&nF(r.orbitalX),y:r.orbitalY&&nF(r.orbitalY),z:r.orbitalZ&&nF(r.orbitalZ),center:r4(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&nF(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=nF(a.x||1),this.sizeYOverLifetime=nF(a.y||1),this.sizeZOverLifetime=nF(a.z||1)):this.sizeXOverLifetime=nF(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:nF(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=nF(n.x||0),u.y=nF(n.y||0)}this.gravity=il.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=nF(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?il.fromArray(r.direction).normalize():new il,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();eo(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.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){ob.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(ob.y=this.sizeYOverLifetime.getValue(r),ob.z=this.sizeZOverLifetime.getValue(r)):ob.z=ob.y=ob.x;var n=this.originalTransform.scale;e.transform.setScale(ob.x*n.x,ob.y*n.y,ob.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;ox.x=s?a(this.rotationOverLifetime.x):0,ox.y=s?a(this.rotationOverLifetime.y):0,ox.z=o;var u=ox.addEulers(this.originalTransform.rotation,ox);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(r3(oT,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&oT.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(oT.x,oT.y,oT.z))},i}(og);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new oE(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(an),t.TransformPlayableAsset=eu([e8(tH.TransformPlayableAsset)],t.TransformPlayableAsset);var o_=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eo(i,t.VFXItem)&&(i.time=this.time)},i}(ai);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){return new o_(t)},e}(an),t.ActivationPlayableAsset=eu([e8(tH.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}e$(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=ix(this.positionCurves);!(r=n()).done;){var a=r.value,o=a.keyFrames.getValue(i),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,c=ix(this.rotationCurves);!(u=c()).done;){var h=u.value,l=h.keyFrames.getValue(i),f=this.findTarget(t,h.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=ix(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=ix(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:nF(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var a,o=ix(t.rotationCurves);!(a=o()).done;){var s=a.value,u={path:s.path,keyFrames:nF(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var c,h=ix(t.scaleCurves);!(c=h()).done;){var l=c.value,f={path:l.path,keyFrames:nF(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=ix(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:nF(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=ix(e);!(i=n()).done;){for(var a,o=i.value,s=!1,u=ix(r.children);!(a=u()).done;){var c=a.value;if(c.name===o){r=c,s=!0;break}}if(!s)return}return r},e}(it),t.AnimationClip=eu([e8(tH.AnimationClip)],t.AnimationClip);var oS=function(e){function i(){return e.apply(this,arguments)}return e$(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eo(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(ai),oC=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===tI.restart?e%=i:this.endBehavior===tI.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}e$(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new ai(t)},i.createOutput=function(){return new ar},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=ix(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=ix(e);!(r=a()).done;){var o=r.value,s=this.createClipPlayable(t,o),u=new oA(o,s,n,this);i.push(u),n.addInput(s,0),n.setInputWeight(s,0)}return n},i.createPlayable=function(t){return new ai(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 oC;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=ix(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=ix(this.children);!(i=r()).done;)i.value.parent=this},e}(an),eu([e7(oC,void 0)],t.TrackAsset.prototype,"clips",void 0),eu([e7(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=eu([e8(tH.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tc=t.TrackType||(t.TrackType={}))[tc.MasterTrack=0]="MasterTrack",tc[tc.ObjectTrack=1]="ObjectTrack";var oA=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,eo(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tI.destroy?eo(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==t3.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,r);var s=i.toLocalTime(e);this.playable.setTime(s),n&&(!eo(o,t.VFXItem)||o.ended||(o.ended=!0,o.onEnd(),o.compositionReusable||o.reusable||(o.dispose(),this.playable.dispose())),this.playable.getPlayState()===t3.Playing&&this.playable.pause())},e3(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}(),oO=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.processFrame=function(e){var i=e.output.getUserData();if(eo(i,t.VFXItem)){for(var r=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),this.showRendererComponents(i)):(i.transform.setValid(!1),this.hideRendererComponents(i))}},r.hideRendererComponents=function(t){for(var e,i=ix(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(t){for(var e,i=ix(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled||(r.enabled=!0)}},i}(ai);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createTrackMixer=function(t){return new oO(t)},e}(t.TrackAsset),t.ActivationTrack=eu([e8(tH.ActivationTrack)],t.ActivationTrack);var ow=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time)},e}(ai),oR=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){for(var i=!1,r=0,n=0;n<this.getInputCount();n++){var a=this.getInputWeight(n);if(a>0){var o=this.getInput(n);if(!eo(o,ow)){console.error("FloatPropertyTrack added non-FloatPropertyPlayableAsset");continue}r+=o.value*a,i=!0}}i&&(e[this.propertyName]=r)}},e}(ai),oI=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=e9(e);if(r)for(var n,a=ix(Object.keys(r));!(n=a()).done;){var o=n.value,s=e.taggedProperties[o];if(void 0===s&&(s=e[o]),it.is(s))t.collectSerializableObject(s,i);else if(eD(s))for(var u,c=ix(s);!(u=c()).done;){var h=u.value;it.is(h)&&t.collectSerializableObject(h,i)}else if(ez(s))for(var l,f=ix(Object.keys(s));!(l=f()).done;){var d=s[l.value];it.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iV({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var a,o=ix(Object.keys(i));!(a=o()).done;){var s=i[a.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serialize(s,n[s.getInstanceId()])}return n},t.serialize=function(e,i){e.toData(),i||(i={});var r=e9(e);if(r)for(var n,a=ix(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:eD(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):it.is(s)?i[o]={id:s.getInstanceId()}:ez(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,c=ix(Object.keys(e.taggedProperties));!(u=c()).done;){var h=u.value,l=e.taggedProperties[h];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[h]=l:eD(l)?(i[h]||(i[h]=[]),t.serializeArrayProperty(l,i[h],0)):it.is(l)?i[h]={id:l.getInstanceId()}:ez(l)&&(i[h]||(i[h]={}),t.serializeObjectProperty(l,i[h],0))}return i},t.deserialize=function(e,i){for(var r,n=i.taggedProperties,a=e9(i),o=i.engine,s=ix(Object.keys(e));!(r=s()).done;){var u=r.value;if(!a||!a[u]){var c=e[u];n[u]=t.deserializeProperty(c,o,0)}}if(a)for(var h,l=ix(Object.keys(a));!(h=l()).done;){var f=h.value,d=e[f];if(void 0!==d){var p=a[f].type;i[f]=t.deserializeProperty(d,o,0,p)}}i.fromData(n)},t.deserializeAsync=function(e,i){return ea(function(){var r,n,a,o,s,u,c,h,l,f,d,p;return ec(this,function(m){switch(m.label){case 0:r=i.taggedProperties,n=e9(i),a=i.engine,o=ix(Object.keys(e)),m.label=1;case 1:if((s=o()).done)return[3,4];if(u=s.value,n&&n[u])return[3,3];return c=e[u],[4,t.deserializePropertyAsync(c,a,0)];case 2:r[u]=m.sent(),m.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];h=ix(Object.keys(n)),m.label=5;case 5:if((l=h()).done)return[3,8];if(void 0===(d=e[f=l.value]))return[3,7];return p=n[f].type,[4,t.deserializePropertyAsync(d,a,0,p)];case 6:i[f]=m.sent(),m.label=7;case 7:return[3,5];case 8:return i.fromData(r),[2]}})})()},t.checkTypedArray=function(t){return eo(t,Int8Array)||eo(t,Uint8Array)||eo(t,Uint8ClampedArray)||eo(t,Int16Array)||eo(t,Uint16Array)||eo(t,Int32Array)||eo(t,Uint32Array)||eo(t,Float32Array)||eo(t,Float64Array)||eo(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(ez(t)&&1===Object.keys(t).length&&"id"in t&&eF(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return ez(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ek(t)||eo(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(eD(e)){for(var a,o=[],s=ix(e);!(a=s()).done;){var u=a.value;o.push(t.deserializeProperty(u,i,r+1,n))}return o}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!ez(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,h,l=ix(Object.keys(e));!(h=l()).done;){var f=h.value;c[f]=t.deserializeProperty(e[f],i,r+1)}return c},t.deserializePropertyAsync=function(e,i,r,n){return ea(function(){var a,o,s,u,c,h,l,f,d;return ec(this,function(p){switch(p.label){case 0:if(r>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eD(e))return[3,5];a=[],o=ix(e),p.label=1;case 1:if((s=o()).done)return[3,4];return u=s.value,c=a.push,[4,t.deserializePropertyAsync(u,i,r+1,n)];case 2:c.apply(a,[p.sent()]),p.label=3;case 3:return[3,1];case 4:return[2,a];case 5:if(!t.checkDataPath(e))return[3,7];return[4,i.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,p.sent()];case 7:if(!(ez(e)&&e.constructor===Object))return[3,12];h=n?new n:{},l=ix(Object.keys(e)),p.label=8;case 8:if((f=l()).done)return[3,11];return d=f.value,[4,t.deserializePropertyAsync(e[d],i,r+1)];case 9:h[d]=p.sent(),p.label=10;case 10:return[3,8];case 11:return[2,h];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,a=ix(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:eD(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):it.is(s)?i[o]={id:s.getInstanceId()}:ez(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],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 a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:eD(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):it.is(a)?i[n]={id:a.getInstanceId()}:ez(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),oM=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 ae,t}e$(i,e);var r=i.prototype;return r.onStart=function(){this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tI.destroy&&this.setReusable(!0)},r.setReusable=function(e){for(var r,n=ix(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value,o=a.boundObject;if(eo(o,t.VFXItem)){eo(a,t.ObjectBindingTrack)&&(o.reusable=e);var s=o.getComponent(i);s&&s.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.onUpdate=function(t){var e=this.time;this.timelinePlayable.setTime(e),this.graph.evaluate(t)},r.createContent=function(){if(this.item.composition)for(var e,r=ix(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 a=n.props.content.options.refId,o=this.item.composition.refCompositionProps.get(a);if(!o)throw Error("Referenced precomposition with Id: "+a+" does not exist.");var s=n.addComponent(i);oI.deserialize(o,s),s.createContent();for(var u,c=ix(s.items);!(u=c()).done;){var h=u.value;h.setInstanceId(eG());for(var l,f=ix(h.components);!(l=f()).done;)l.value.setInstanceId(eG())}}}},r.showItems=function(){for(var t,e=ix(this.items);!(t=e()).done;)t.value.setVisible(!0)},r.hideItems=function(){for(var t,e=ix(this.items);!(t=e()).done;)t.value.setVisible(!1)},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},r.hitTest=function(e,i,r,n,a,o){for(var s,u=[],c=(null==o?void 0:o.stop)||eV,h=(null==o?void 0:o.skip)||eV,l=(null==o?void 0:o.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(o){var l=s.items[o];if(l.getVisible()&&l.transform.getValid()&&!t.VFXItem.isComposition(l)&&!h(l)){var f=l.getHitTestParams(a);if(f){var d=!1,p=new il;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,u.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,u.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,S=f.radius;e.intersectSphere({center:_,radius:S},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var C=f.collect(e,new ih(i,r));C&&C.length>0&&(C.forEach(function(t){u.push(t)}),d=!0)}if(d){var A={compContent:s.item,id:l.id,name:l.name,position:u[u.length-1],parentId:l.parentId,hitPositions:u,behavior:f.behavior};if(l.emit("click",A),n.push(A),c(A))return{v:n}}}}}(f));if("object"===es(d))return d.v}return n},r.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},r.resolveBindings=function(){for(var t,e=ix(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=ix(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.updateTrackAnimatedObject(a)}},r.updateTrackAnimatedObject=function(t){for(var e,i=ix(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(ii),oL=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();eo(e,oM)&&(e.time=this.getTime())},e}(ai),oP=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(eo(e,oM)){for(var i=!1,r=0;r<this.getInputCount();r++)if(this.getInputWeight(r)>0){i=!0;break}i?e.showItems():e.hideItems()}},e}(ai),oV=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e$(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();if(e){var i=!1,r=e[this.propertyName];if(eo(r,id)){r.setZero();for(var n=0;n<this.getInputCount();n++){var a=this.getInputWeight(n);if(a>0){var o=this.getInput(n);if(!eo(o,ow)){console.error("Vector4PropertyTrack added non-Vector4PropertyPlayableAsset");continue}var s=o.value;r.x+=s.x*a,r.y+=s.y*a,r.z+=s.z*a,r.w+=s.w*a,i=!0}}i&&(e[this.propertyName]=r)}}},e}(ai),oF=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}e$(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);eu([e7(void 0,void 0)],oF.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new oR(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}(oF),t.FloatPropertyTrack=eu([e8(tH.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(t.TrackAsset),t.SpriteColorTrack=eu([e8(tH.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!eo(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(oM)},r.createTrackMixer=function(t){return new oP(t)},i}(t.TrackAsset),t.SubCompositionTrack=eu([e8(tH.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(t.TrackAsset),t.TransformTrack=eu([e8(tH.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.updateAnimatedObject=function(){eo(this.parent.boundObject,ir)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),eu([e7(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=eu([e8("MaterialTrack")],t.MaterialTrack),t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createTrackMixer=function(t){var e=new oV(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(oF),t.Vector4PropertyTrack=eu([e8(tH.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createTrackMixer=function(t){var e=new oR(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(oF),t.ColorPropertyTrack=eu([e8(tH.ColorPropertyTrack)],t.ColorPropertyTrack),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){var e=new ow(t);return e.curve=nF(this.curveData),e.value=e.curve.getValue(0),e},e}(an),eu([e7(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=eu([e8(tH.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.createPlayable=function(t){return new oL(t)},e}(an),t.SubCompositionPlayableAsset=eu([e8(tH.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset);var oD=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}e$(i,e);var r=i.prototype;return r.createPlayable=function(e){var i=new oN(e);i.setTraversalMode(t4.Passthrough);for(var r,n=ix(this.tracks);!(r=n()).done;){var a=r.value;eo(a,t.ObjectBindingTrack)&&a.create(this)}return i.compileTracks(e,this.tracks),i},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),r},r.fromData=function(t){},i}(an),eu([e7(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=eu([e8(tH.TimelineAsset)],t.TimelineAsset);var oN=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}e$(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){var t=this.getTime();this.updateTrackAnimatedObject(this.masterTrackInstances);for(var e,i=ix(this.clips);!(e=i()).done;)e.value.evaluateAt(t)},i.compileTracks=function(t,e){this.sortTracks(e);for(var i,r=[],n=ix(e);!(i=n()).done;){var a=i.value;r.push(a),this.addSubTracksRecursive(a,r)}for(var o,s={},u=ix(r);!(o=u()).done;){var c=o.value,h=c.createPlayableGraph(t,this.clips);this.addInput(h,0);var l=c.createOutput();l.setUserData(c.boundObject),t.addOutput(l),l.setSourcePlayable(this,this.getInputCount()-1);var f=new oD(c,h,l);s[c.getInstanceId()]=f,c.parent||this.masterTrackInstances.push(f)}for(var d,p=ix(r);!(d=p()).done;)for(var m,v=d.value,y=s[v.getInstanceId()],g=ix(v.getChildTracks());!(m=g()).done;){var x=s[m.value.getInstanceId()];y.addChild(x)}},i.updateTrackAnimatedObject=function(t){for(var e,i=ix(t);!(e=i()).done;){var r=e.value,n=r.trackAsset;n.updateAnimatedObject(),r.output.setUserData(n.boundObject),this.updateTrackAnimatedObject(r.children)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new oz(t[i],i));e.sort(ok),t.length=0;for(var r,n=ix(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},i.addSubTracksRecursive=function(t,e){for(var i,r=ix(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=ix(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},e}(ai),oz=function(t,e){this.track=t,this.originalIndex=e};function ok(e,i){var r=e.track.boundObject,n=i.track.boundObject;return eo(r,t.VFXItem)&&eo(n,t.VFXItem)?t.VFXItem.isAncestor(r,n)?-1:t.VFXItem.isAncestor(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}function oU(t,e){return e&&("object"===es(e)||"function"==typeof e)?e:im(t)}t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}e$(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){},r.create=function(e){if(eo(this.boundObject,t.VFXItem)){var i=this.boundObject;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(t.TrackAsset,this,"ParticleTrack");r.boundObject=this.boundObject;var n=r.createClip(ou);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}}},i}(t.TrackAsset),t.ObjectBindingTrack=eu([e8(tH.ObjectBindingTrack)],t.ObjectBindingTrack);var oB=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tU.display:r,a=t.textBaseline,o=void 0===a?tB.top:a,s=t.textAlign,u=void 0===s?tG.left:s,c=t.text,h=t.letterSpace,l=void 0===h?0:h,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=c.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=o,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,a=t.fontScale,o=(i-r)/3,s=r+n*a,u=i*(e-1),c=0;switch(this.textBaseline){case tB.top:c=s+o;break;case tB.middle:c=(this.height*a-u+s)/2;break;case tB.bottom:c=this.height*a-u-o}return c},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tG.left:i=t.outlineWidth*t.fontScale;break;case tG.middle:i=(this.width*t.fontScale-e)/2;break;case tG.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),oG=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,a,o,s=t.textColor,u=t.fontSize,c=t.outline,h=t.shadow,l=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,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,c&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!=(r=h.shadowBlur)?r:2,this.shadowColor=null!=(n=h.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=h.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=h.shadowOffsetY)?o:0),this.fontStyle!==tX.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},oj=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 eI(t),t}if(am[ap])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?ep(this.elements,t):t.remove()},t}()),oX=["serif","sans-serif","monospace","courier"],oH=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.name="MText"+oH++,r.geometry=r.createGeometry(iO.TRIANGLES),i&&r.fromData(i),r.canvas=oj.getCanvas(),oj.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),r.setItem(),!i)return oU(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e$(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,a,o,s,u=e.interaction,c=e.options,h=e.listIndex,l=e.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:t_.BILLBOARD,blending:null!=(r=l.blending)?r:tm.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===ty.MASK,side:null!=(a=l.side)?a:tv.DOUBLE,mask:null!=(o=l.mask)?o:0,maskMode:null!=(s=l.maskMode)?s:ty.NONE,order:void 0===h?0:h},this.interaction=u,this.updateWithOptions(c),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(nN),t.TextComponent=eu([e8(tH.TextComponent)],t.TextComponent);var oW=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new oG(t),this.textLayout=new oB(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,a=this.textLayout.width+this.textStyle.fontOffset,o=1,s=0,u=0;u<t.length;u++){var c,h,l=t[u],f=(null!=(h=null==i?void 0:null==(c=i.measureText(l))?void 0:c.width)?h:0)*n;((s+=r)+f>a&&u>0||"\n"===l)&&(o++,s=0),"\n"!==l&&(s+=f)}return o},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&&!eM(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,a=(r.width+i.fontOffset)*n,o=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/r.height)):this.canvas.height=r.height*n;var c=this.canvas.height;e.clearRect(0,0,a,c),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,c),e.scale(1,-1)),e.fillRect(0,0,a,c),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 h=[],l=0,f=r.getOffsetY(i,this.lineCount,u,s),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(h.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)}h.push({y:f,width:l,chars:d,charOffsetX:p}),h.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",i2.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:iO.LINEAR,minFilter:iO.LINEAR,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.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,a=t.fontStyle,o=""+(e*i).toString()+"px ";return oX.includes(r)?o+=r:o+='"'+r+'"',n!==tj.normal&&(o=n+" "+o),a!==tX.normal&&(o=a+" "+o),o},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],o=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*o+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=i[0],s=i[1],u=i[2],c=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*s+", "+255*u+", "+c+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();eX(t.TextComponent,[oW]);var oY=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(eK),oZ=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e}(it);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.fromData=function(t){},e}(it),eu([e7(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=eu([e8(tH.BinaryAsset)],t.BinaryAsset);var oq=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 tH.Material:i=rr.create(this.engine);break;case tH.Geometry:i=rc.create(this.engine);break;case tH.Texture:i=i2.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),oI.deserialize(r,i),i},e.loadGUIDAsync=function(e){var i=this;return ea(function(){var r,n,a;return ec(this,function(o){switch(o.label){case 0:if(i.engine.objectInstance[e])return[2,i.engine.objectInstance[e]];if(r=i.findData(e))return[3,2];if(!i.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,i.engine.database.loadGUID(e)];case 1:if(!(n=o.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return i.engine.addInstance(n),[2,n];case 2:switch(r.dataType){case tH.Material:n=rr.create(i.engine);break;case tH.Geometry:n=rc.create(i.engine);break;case tH.Texture:n=i2.create(i.engine);break;default:(a=t.getClass(r.dataType))&&(n=new a(i.engine))}if(!n)return console.error("Constructor for DataType: "+r.dataType+" not found."),[2,void 0];return n.setInstanceId(r.id),i.engine.addInstance(n),[4,oI.deserializeAsync(r,n)];case 3:return o.sent(),[2,n]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e6[t]},t}(),oQ=function(){function t(){}return t.prototype.loadGUID=function(t){return ea(function(){return ec(this,function(t){return[2,void 0]})})()},t}();function oK(t,e){if(!t.includes(e))return t.push(e),!0}function oJ(t){if(Number.isFinite(t))return[tw.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tw.CONSTANT)return[tw.CONSTANT,t[1]];if("lines"===e)return[tw.LINE,t[1]];if(e===tw.LINE){var r=i.map(function(t){return[tR.LINE,t]});return[tw.BEZIER_CURVE,r]}return"curve"===e||e===tw.CURVE?[tw.BEZIER_CURVE,sa(i)]:t}}function o$(t,e){return Array.isArray(t)&&"random"===t[0]?[tw.CONSTANT,t[1][e]]:oJ(t)}function o0(t){return t&&"color"===t[0]?o3(t[1],!0):[1,1,1,1]}function o1(t){return t&&"random"===t[0]?[tw.RANDOM,t[1]]:oJ(t)}function o2(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=o3(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tw.GRADIENT_COLOR,i]}}function o3(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}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]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eo(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=o4(i)),i}function o4(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function o5(t,e){return Array.isArray(t)?t[0]===tw.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&o2(t[1],e):o2(t,e)}function o6(t){if(t){if(3===t.length)return[tw.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tw.BEZIER_PATH||e===tw.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=sa(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[tw.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function o8(t){for(var e,i=ix(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function o9(t){for(var e,i=ix(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var o7=Math.cos,st=Math.sin,se=Math.PI/180,si=180/Math.PI;function sr(t,e){return t?[t[0]-.5,.5-t[1]]:e?sn[e]:[0,0]}var sn=((t6={})[tS.PARTICLE_ORIGIN_CENTER]=[0,0],t6[tS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t6[tS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t6[tS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t6[tS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t6[tS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t6[tS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t6[tS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t6[tS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t6);function sa(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]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],c=[t[a+1][0],t[a+1][1]];if(u[0]!=c[0]){var h=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,c),l=h[0],f=h[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([f[0],f[1],c[0],c[1]])}else n[n.length-1].push(c[0]),n[n.length-1].push(c[1])}return n.map(function(t,e){return 0===e?[tR.EASE_OUT,t]:e===n.length-1?[tR.EASE_IN,t]:[tR.EASE,t]})}function so(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tE.null&&t.endBehavior===tI.destroy&&(t.endBehavior=tI.freeze)})}),t.version="2.1",t}function ss(t){for(var e,i=iV({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=ix(i.images);!(e=r()).done;)e.value.id=eG();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eG(),t.dataType=tH.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:eG(),dataType:tH.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eG()}}));for(var a,o,s={},u={},c=ix(t.compositions);!(o=c()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tI.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tE.particle&&t.content.filter&&delete t.content.filter});for(var e,r=ix(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eG(),n.oldId=n.id,n.id=s[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],a=e.parentId.split("^")[1];e.parentId=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=iV({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:eG(),dataType:"TimelineAsset"},u=ix(t.items);!(r=u()).done;){var c=e[r.value.id],h=[],l={id:eG(),dataType:"ActivationPlayableAsset"};o.push(l);var f={id:eG(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:l.id}}]};if(h.push({id:f.id}),a.push(f),c.type!==tE.particle){var d={id:eG(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};o.push(d);var p={id:eG(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};h.push({id:p.id}),a.push(p)}if(c.type===tE.sprite||c.type===tE.text){var m={id:eG(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};o.push(m);var v={id:eG(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:m.id}}]};h.push({id:v.id}),a.push(v)}if(c.type===tE.composition){var y={id:eG(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:eG(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:y.id}}]};h.push({id:g.id}),a.push(g)}var x={id:eG(),dataType:"ObjectBindingTrack",children:h,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:c.id}})}for(var b,T=[],E=ix(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var S,C=ix(a);!(S=C()).done;){var A=S.value;i.miscs.push(A)}for(var O,w=ix(o);!(O=w()).done;){var R=O.value;i.miscs.push(R)}}(a,u,i)}();for(var h,l=ix(i.items);!(h=l()).done;){var f=h.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===tE.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tE.sprite){var g,x,b,T,E,_,S,C=f.content;C.renderer||(C.renderer={});var A=C.renderer,O=sr(A.anchor,A.particleOrigin),w=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-O[0]*(null!=(T=null==w?void 0:w.x)?T:1),f.transform.position.y+=-O[1]*(null!=(E=null==w?void 0:w.y)?E:1)),f.transform.anchor={x:O[0]*(null!=(_=null==w?void 0:w.x)?_:1),y:O[1]*(null!=(S=null==w?void 0:w.y)?S:1)}}}if(f.type===tE.particle){var R=f.content;R.renderer||(R.renderer={});var I=R.renderer;R.renderer.anchor=sr(I.anchor,I.particleOrigin)}if(f.type===tE.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var M=f.pn,L=t.plugins,P=void 0===L?[]:L;void 0!==M&&Number.isInteger(M)&&(f.pluginName=P[M])}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=s[f.content.options.target]),f.type===tE.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===tE.sprite||f.type===tE.particle||f.type===tE.mesh||f.type===tE.skybox||f.type===tE.light||"camera"===f.type||f.type===tE.tree||f.type===tE.interact||f.type===tE.camera||f.type===tE.text||f.type===tE.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eG(),f.content.item={id:f.id},f.dataType=tH.VFXItemData,f.components.push({id:f.content.id})),(f.type===tE.null||f.type===tE.composition)&&(f.components=[],f.dataType=tH.VFXItemData),f.type){case tE.sprite:f.content.dataType=tH.SpriteComponent;break;case tE.particle:f.content.dataType=tH.ParticleSystem;break;case tE.mesh:f.content.dataType=tH.MeshComponent;break;case tE.skybox:f.content.dataType=tH.SkyboxComponent;break;case tE.light:f.content.dataType=tH.LightComponent;break;case"camera":f.content.dataType=tH.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tE.tree:f.content.dataType=tH.TreeComponent;break;case tE.interact:f.content.dataType=tH.InteractComponent;break;case tE.camera:f.content.dataType=tH.CameraController;break;case tE.text:f.content.dataType=tH.TextComponent;break;case tE.spine:f.content.dataType=tH.SpineComponent}}return i.version="3.0",i}function su(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:o6(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:oJ(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:oJ(n.linearX),linearY:oJ(n.linearY),linearZ:oJ(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:oJ(n.orbitalX),orbitalY:oJ(n.orbitalY),orbitalZ:oJ(n.orbitalZ),speedOverLifetime:oJ(n.speedOverLifetime)};o9(a);var o={options:{startColor:o0(r.startColor)},positionOverLifetime:a};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 s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=oJ(s.x),u.y=oJ(s.y),u.z=oJ(s.z)):u.z=oJ(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var h=o.colorOverLifetime={opacity:oJ(c.opacity)};c.color&&(h.color=o5(c.color))}var l=t.sizeOverLifetime;return l&&(o.sizeOverLifetime={separateAxes:l.separateAxes,size:oJ(l.size),x:oJ(l.x),y:oJ(l.y),z:oJ(l.z)}),o}var sc=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,sh=/^(\d+)\.(\d+)$/,sl=!1;function sf(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(h=(c=t).version)?void 0:h.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tE.mesh||t.type===tE.light)&&(t.endBehavior=1===t.endBehavior?tI.destroy:t.endBehavior)})}),sc.test(t.version)){var e,i,r,n,a,o,s,u;return sl=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",ss(so((sd="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(sd="1.3"),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return sp(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:sd,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return sm(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u)))}sl=!1;var c,h,l,f,d,p=sh.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=ix(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=ix(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=o6(a):e[n]=oJ(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=d),m<3?ss(so(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var sd="1.0";function sp(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eG(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eG(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eG(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eG(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function sm(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iV({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return sy(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var sv=[0,0,0,1];function sy(t,e){void 0===e&&(e={});var i=tE.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tE.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),h=t.transform||b(l.transform)):t.particle?(i=tE.particle,h=b((l=t.particle).transform,sl,!0),f=function(t){var e=t.options,i=t.transform,r={type:tg.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iV({},t.shape,{type:tg[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],c=o[2];0===s&&0===u&&0===c&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=o1(e.turbulenceX),r.turbulenceY=o1(e.turbulenceY),r.turbulenceZ=o1(e.turbulenceZ));var h=t.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(t){return o8(t)})),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(t){return o8(t)})),h.rateOverTime&&(h.rateOverTime=o1(h.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:h,options:{startLifetime:o1(e.startLifetime),start3DSize:!!e.start3DSize,startSize:o1(e.startSize),startSizeX:o1(e.startSizeX),startSizeY:o1(e.startSizeY),sizeAspect:o1(e.sizeAspect),maxCount:e.maxCount,startDelay:o1(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tw.COLORS,t[1].map(function(t){return o3(t,e)})]:"gradient"===t[0]?o2(t[1],e):"color"===t[0]?[tw.RGBA_COLOR,o3(t[1],e)]:t}(e.startColor,!0),startRotationZ:o1(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=o1(e.startRotationX),l.options.startRotationY=o1(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:o6(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:o1(f.x),y:o1(f.y)}:l.sizeOverLifetime={size:o1(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?oJ(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:oJ(e.gravityModifier),startSpeed:o1(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:o1(d.linearX),linearY:o1(d.linearY),linearZ:o1(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:o1(d.orbitalX),orbitalY:o1(d.orbitalY),orbitalZ:o1(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:oJ(d.forceCurve)},o9(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:o1(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=oJ(m.y),l.rotationOverLifetime.x=oJ(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:oJ(v.opacity)};v.color&&(y.color=o5(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:oJ(g.cycles),animationDelay:o$(g.animationDelay,0),animationDuration:o$(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:o1(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:oJ(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&o5(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&o5(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:o1(x.opacityOverLifetime)}),l.trails&&o9(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(l)):t.sprite?(i=tE.sprite,h=b((l=t.sprite).transform,!1,!0),s=su(o=l,h),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tE.null,h=b((l=t.cal).transform,!1,!0),f=su(l,h)):t.ui?(i=tE.interact,h=b((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tb.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&o0(i.previewColor),behavior:i.behavior||tT.NOTIFY};break;case"drag":e={type:tb.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tb.MESSAGE}}return{options:e}}(l),h.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tE.camera,h=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,a,o={path:o6(null==(a=t.transform)?void 0:a.path),linearX:oJ(null==r?void 0:r.translateX),linearY:oJ(null==r?void 0:r.translateY),linearZ:oJ(null==r?void 0:r.translateZ)};o9(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:oJ(null==s?void 0:s.rotateX),y:oJ(null==s?void 0:s.rotateY),z:s.separateAxes?oJ(null==s?void 0:s.rotateZ):oJ(s.rotation)};o9(u),i.rotationOverLifetime=u}return i}(l))),null==(c=f.renderer)?void 0:c.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&oK(e.requires,"anchor")}if(l){var o,s,u,c,h,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tI.restart:tI.destroy:tI.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tI.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:h,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(oK(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 a,o,s,u,c,h,l,f,d,p,m,v,y,g,x,b,T,E,_,S,C,A,O,w,R=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=o7(a*se/2),c=o7(o*se/2),h=o7(s*se/2),l=st(a*se/2),f=st(o*se/2),d=st(s*se/2),sv[0]=l*c*h+u*f*d,sv[1]=u*f*h-l*c*d,sv[2]=u*c*d+l*f*h,sv[3]=u*c*h-l*f*d,sv);r.rotation=(p=[],m=R[0],v=R[1],y=R[2],g=R[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,S=v*b,C=y*T,A=g*T,O=y*x-g*b,p[1]=Math.asin((w=-O)>1?1:w<-1?-1:w)*si,.9999999>Math.abs(O)?(p[0]=Math.atan2(y*b+g*x,1-E-S)*si,p[2]=Math.atan2(_+A,1-S-C)*si):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-C)*si),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 sg=((t8={})[tp.S]=[tp.S,tp.BPlus,tp.APlus],t8[tp.A]=[tp.A,tp.BPlus,tp.APlus],t8[tp.B]=[tp.B,tp.BPlus],t8);function sx(t,e){if(!t||!e)return!0;var i=sg[e];return!!i&&i.includes(t)}function sb(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function sT(t,e,i){return sE.apply(this,arguments)}function sE(){return(sE=ea(function(t,e,i){var r,n;return ec(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,iG(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=sb(e,i)){if(eF(n)&&n!==r.src)return[2,iG(n)];if(eo(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(th=t.Scene||(t.Scene={})).isJSONObject=function(t){return ez(t)&&"jsonScene"in t},th.isURL=function(t){return ez(t)&&"url"in t},th.isWithOptions=function(t){return ez(t)&&"options"in t};var s_=1,sS=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iF),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=s_++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.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},i.loadScene=function(e,i,r){var n=this;return ea(function(){var a,o,s,u,c,h,l,f,d,p,m,v;return ec(this,function(y){return o=eF(e)?e:n.id,s=performance.now(),u=[],l=null!=(h=null==(c=null==i?void 0:i.engine.gpuCapability)?void 0:c.detail.compressedTexture)?h:t.COMPRESSED_TEXTURE.NONE,f={},p=!1,m=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,n.removeTimer(d),e(Error("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."))},1e3*n.timeout),n.timers.push(d)}),v=ea(function(t,e){var i,r,n;return ec(this,function(a){switch(a.label){case 0:if(p)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,u.push("["+t+": "+n.toFixed(2)+"]"),f[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([m,ea(function(){var c,h,p,m,y,g,x,b,T,E,_,S,C,A,O,w,R,I,M,L;return ec(this,function(P){switch(P.label){case 0:if(!eF(e))return[3,2];return h=new URL(e,location.href).href,n.baseUrl=h,[4,v("loadJSON",function(){return n.loadJSON(h)})];case 1:return a=P.sent(),[3,3];case 2:a=e,n.baseUrl=location.href,P.label=3;case 3:if(!t.Scene.isJSONObject(a))return[3,5];return p=(c=iV({},a)).jsonScene,m=c.pluginSystem,y=c.images,g=p.compositions,x=p.images,n.assignImagesToAssets(x,y),[4,Promise.all([v("plugin:processAssets",function(){return n.processPluginAssets(p,m,r)}),v("plugin:precompile",function(){return n.precompile(g,m,i,r)})])];case 4:return P.sent(),[3,10];case 5:return[4,v("processJSON",function(){return n.processJSON(a)})];case 6:return T=(b=P.sent()).jsonScene,E=b.pluginSystem,S=void 0===(_=T.bins)?[]:_,C=T.images,A=T.compositions,O=T.fonts,[4,Promise.all([v("processBins",function(){return n.processBins(S)}),v("processImages",function(){return n.processImages(C,l)}),v("plugin:processAssets",function(){return n.processPluginAssets(T,E,r)}),v("plugin:precompile",function(){return n.precompile(A,E,i,r)}),v("processFontURL",function(){return n.processFontURL(O)})])];case 7:return R=(w=P.sent())[0],I=w[1],[4,v("processTextures",function(){return n.processTextures(I,R,T)})];case 8:return M=P.sent(),c={timeInfos:f,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:E,jsonScene:T,bins:R,images:I,textureOptions:M},[4,v("plugin:prepareResource",function(){return E.loadResources(c,n.options)})];case 9:P.sent(),P.label=10;case 10:return[4,v("prepareAssets",function(){return n.prepareAssets(null==i?void 0:i.engine)})];case 11:return P.sent(),L=performance.now()-s,eP.info("Load asset: totalTime: "+L.toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."),window.clearTimeout(d),n.removeTimer(d),c.totalTime=L,c.startTime=s,c.timeInfos=f,[2,c]}})})()])]})})()},i.precompile=function(t,e,i,r){return ea(function(){return ec(this,function(n){switch(n.label){case 0:if(!i||!i.getShaderLibrary())return[2];return[4,e.precompile(t,i,r)];case 1:return n.sent(),[2]}})})()},i.processJSON=function(t){var e=this;return ea(function(){var i,r,n;return ec(this,function(a){switch(a.label){case 0:return[4,(n=new eq(void 0===(r=(i=sf(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},i.processBins=function(t){var e=this;return ea(function(){var i,r;return ec(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(eo(n,ArrayBuffer))return n;if(sx(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return ea(function(){return ec(this,function(r){return t?[2,Promise.all(t.map(ea(function(t){var r,n,a;return ec(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];eM(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),eP.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},i.processImages=function(e,i){void 0===i&&(i=0);var r=this;return ea(function(){var n,a,o,s,u;return ec(this,function(c){switch(c.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=r.baseUrl,[4,Promise.all(e.map(ea(function(e,n){var u,c,h,l,f,d,p,m,v,y,g,x,b,T,E,_,S,C,A,O;return ec(this,function(w){switch(w.label){case 0:if(u=e.url,c=e.webp,h=e.avif,l=new URL(u,s).href,f=c&&new URL(c,s).href,d=h&&new URL(h,s).href,!("template"in e))return[3,8];if(!(m=(p=e.template).background))return[3,7];v=sb(p,o),y=m.type===tQ.video,g=m&&y?iY:iG,w.label=1;case 1:return w.trys.push([1,6,,7]),[4,iq(v,g)];case 2:if(!eo(x=w.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[n]={url:x.src,type:t.TextureSourceType.video},[2,x];case 3:return m&&Array.isArray(v)&&o&&(o[m.name]=x.src),r.sourceFrom[n]={url:x.src,type:t.TextureSourceType.image},[4,sT(x,p,o)];case 4:return[2,w.sent()];case 5:return[3,7];case 6:throw b=w.sent(),Error("Failed to load. Check the template or if the URL is "+(y?"video":"image")+" type, URL: "+v+", Error: "+(b.message||b)+".");case 7:return[3,9];case 8:if("compressed"in e&&a&&i){if(T=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?E=T.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(E=T.pvrtc),E)return _=new URL(E,s).href,r.sourceFrom[n]={url:_,type:t.TextureSourceType.compressed},[2,r.loadBins(_)]}else if(eo(e,HTMLImageElement)||eo(e,HTMLCanvasElement)||eo(e,HTMLVideoElement)||eo(e,i2))return[2,e];w.label=9;case 9:if(!d)return[3,11];return[4,iU(l,d)];case 10:return O=w.sent(),[3,13];case 11:return[4,iz(l,f)];case 12:O=w.sent(),w.label=13;case 13:return C=(S=O).url,A=S.image,r.sourceFrom[n]={url:C,type:t.TextureSourceType.image},[2,A]}})})))];case 1:return u=c.sent(),r.assignImagesToAssets(e,u),[2,u]}})})()},i.processPluginAssets=function(t,e,i){var r=this;return ea(function(){var n,a,o,s;return ec(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,i)];case 1:for(a=(n=u.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=n.loadedAssets,s=0;s<a.length;s++)r.assets[a[s].id]=o[s];return[2]}})})()},i.prepareAssets=function(t){var e=this;return ea(function(){var i,r,n,a,o;return ec(this,function(s){if(!t)return[2];for(i=ix(Object.keys(e.assets));!(r=i()).done;)n=r.value,a=e.assets[n],(o=new oZ(t)).data=a,o.setInstanceId(n),t.addInstance(o);return[2]})})()},i.processTextures=function(e,i,r){var n=this;return ea(function(){var a;return ec(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(ea(function(e,a){var o,s,u,c;return ec(this,function(h){switch(h.label){case 0:if(eo(e,i2))return[2,e];if(!("mipmaps"in e))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,iK(e,i,n.assets,r.bins)];case 2:return[2,h.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+h.sent()+".");case 4:if(o=e.source,s=e.id,!ez(o))return[3,5];return u=n.assets[o.id],[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,iG(ej(o))];case 6:u=h.sent(),h.label=7;case 7:if(u)return[2,(c=function(e,i,r){var n={id:r,dataType:tH.Texture};if(eo(e,i2))return iV({},e.source,n);if(eo(e,HTMLImageElement)||ek(e))return iV({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iO.LINEAR,magFilter:iO.LINEAR},n);if(eo(e,HTMLVideoElement))return iV({sourceType:t.TextureSourceType.video,video:e,minFilter:iO.LINEAR,magFilter:iO.LINEAR},n);if(eo(e,ArrayBuffer))return iV({},i9(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return iV({sourceType:t.TextureSourceType.data,data:e,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE,minFilter:iO.NEAREST,magFilter:iO.NEAREST},n);throw Error("Invalid texture options.")}(u,n.sourceFrom[a],s)).sourceType===t.TextureSourceType.compressed?c:iV({},c,e)];throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return ea(function(){return ec(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)})})]})})()},i.loadBins=function(t){var e=this;return ea(function(){return ec(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)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();sS.fontCache=new Set;var sC=new il(1,1,1),sA=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=iy.fromIdentity(),this.viewMatrix=iy.fromIdentity(),this.projectionMatrix=iy.fromIdentity(),this.viewProjectionMatrix=iy.fromIdentity(),this.inverseViewMatrix=iy.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tO.portrait:o,u=e.position,c=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===a?1:a,clipMode:s,position:il.fromArray(void 0===u?[0,0,8]:u),rotation:rl.fromArray(void 0===c?[0,0,0]:c)},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 il(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 a=i.projectPoint(e).z,o=r.projectPoint(new il(1,1,a)),s=o.x,u=o.y,c=r.projectPoint(new il(-1,-1,a));return new il((s-c.x)/2,(u-c.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 iv;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,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,a=t.clipMode,o=t.position;this.projectionMatrix.perspective(e*ia,i,r,n,a===tO.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(o,this.getQuat(),sC),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){as.getRotation(t,this.options.rotation)},e3(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}(),sO=0,sw=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,a=t.pluginSystem,o=t.totalTime,s=i.compositions,u=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var c,h=ix(s);!(c=h()).done;){var l=c.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=a,this.totalTime=null!=o?o:0,this.textures=n,sO=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=iV({},t);return this.assembleItems(e),isNaN(e.endBehavior)&&(e.endBehavior=tI.freeze),e.startTime||(e.startTime=0),e},e.assembleItems=function(t){this.mask++;var e={},i=[];if(this.jsonScene){for(var r,n=ix(this.jsonScene.components);!(r=n()).done;){var a=r.value;e[a.id]=a}for(var o,s=ix(t.items);!(o=s()).done;){var u=o.value,c=this.engine.jsonSceneData[u.id];if(sx(c.renderLevel,this.renderLevel)){if(c.listIndex=sO++,c.type===tE.sprite||c.type===tE.particle)for(var h,l=ix(c.components);!(h=l()).done;){var f=e[h.value.id];this.preProcessItemContent(f)}if(c.type===tE.composition){var d=c.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;void 0!==(e=Number.isInteger(n)?null==(i=this.jsonScene)?void 0:i.shapes[n]:n)&&(t.renderer.shape=aq(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!==ty.NONE&&(t.mask||(e===ty.MASK?t.mask=++this.mask:e!==ty.OBSCURED&&e!==ty.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}(),sR=function(){function t(){this.update=new sM,this.lateUpdate=new sL}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==ie.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==ie.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==ie.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==ie.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),sI=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}(),sM=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=ix(t);!(i=r()).done;)i.value.onUpdate(e)},e}(sI),sL=function(t){function e(){return t.apply(this,arguments)}return e$(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=ix(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(sI),sP=function(e){function i(i,r){(n=e.call(this)||this).sceneTicking=new sR,n.speed=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;var n,a,o,s,u=i.reusable,c=void 0!==u&&u,h=i.speed,l=i.baseRenderOrder,f=i.renderer,d=i.event,p=i.width,m=i.height,v=i.handleItemMessage;n.compositionSourceManager=new sw(r,f.engine),c&&(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!=(o=null==(a=r.jsonScene.renderSettings)?void 0:a.postProcessingEnabled)&&o,eI(g),n.renderer=f,n.refCompositionProps=E,n.rootItem=new t.VFXItem(n.getEngine(),g),n.rootItem.name="rootItem",n.rootItem.composition=im(n),n.rootComposition=n.rootItem.addComponent(oM),n.width=p,n.height=m,n.renderOrder=void 0===l?0:l,n.id=g.id,n.renderer=f,n.texInfo=c?{}:b,n.event=d,n.statistic={loadStart:null!=(s=r.startTime)?s:0,loadTime:null!=T?T:0,compileTime:0,firstFrameTime:0},n.reusable=c,n.speed=void 0===h?1:h,n.autoRefTex=!n.keepResource&&n.texInfo&&n.rootItem.endBehavior!==tI.restart,n.name=g.name,n.pluginSystem=x,n.pluginSystem.initializeComposition(im(n),r),n.camera=new sA(n.name,iV({},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,oI.deserialize(g,n.rootComposition),n.rootComposition.createContent(),n.buildItemTree(n.rootItem),n.pluginSystem.resetComposition(im(n),n.renderFrame),n}e$(i,e);var r=i.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.items.forEach(function(e){e.setVisible(t)})},r.getSpeed=function(){return this.speed},r.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new rj({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.speed,i=this.paused;i&&this.resume(),this.rootComposition.isStartCalled||(this.rootComposition.onStart(),this.rootComposition.isStartCalled=!0),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&this.pause()},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.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)},r.reset=function(){this.rendererOptions=null,this.rootItem.ended=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;e._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.gatherRendererComponent(this.rootItem,e),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},r.gatherRendererComponent=function(t,e){for(var i,r=ix(t.rendererComponents);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var a,o=ix(t.children);!(a=o()).done;){var s=a.value;this.gatherRendererComponent(s,e)}},r.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.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.rootItem.ended&&this.rootItem.endBehavior===tI.destroy&&!this.reusable},r.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},r.callAwake=function(t){for(var e,i=ix(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=ix(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},r.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(oM).items,a=ix(n);!(i=a()).done;){var o=i.value;r.set(o.id,o)}for(var s,u=ix(n);!(s=u()).done;){var c=s.value;if(void 0===c.parentId)c.setParent(e);else{var h=r.get(c.parentId);if(h)c.parent=h,c.transform.parentTransform=h.transform,h.children.push(c);else throw Error("The element references a non-existent element, please check the data.")}}for(var l,f=ix(n);!(l=f()).done;){var d=l.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},r.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)},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},r.updateRootComposition=function(t){if(this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.rootItem.start,i=!1,r=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-r>.001)switch(i=!0,n){case tI.restart:e%=r,this.restart();break;case tI.freeze:e=Math.min(r,e);case tI.forward:case tI.destroy:}this.rootComposition.time=e,i&&!this.rootItem.ended&&(this.rootItem.ended=!0,this.emit("end",{composition:this}))}},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return r9((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,a=[],o=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(oM))||n.hitTest(o,t,e,a,i,r),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(oM))||s.hitTest(o,t,e,a,i,r)}),a},r.addInteractiveItem=function(t,e){if(e===tb.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},r.removeInteractiveItem=function(t,e){e===tb.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}))},r.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()}}},r.destroyItem=function(t){var e=this;t.type==tE.composition?t.endBehavior!==tI.freeze&&t.getComponent(oM).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(em(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},r.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()},r.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},a=this.textures;a&&this.keepResource&&a.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eV)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eP.error("Update disposed composition: "+r.name+".")},this.dispose=eV,a&&this.keepResource&&a.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==nL&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.rootItem.translate(t,e,i)},r.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},r.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},r.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},r.scale=function(t,e,i){this.rootItem.scale(t,e,i)},r.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return ea(function(){return ec(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]}})})()},e3(i,[{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)}}]),i}(au),sV=new Int32Array(2),sF=new Float32Array(sV.buffer),sD=new Float64Array(sV.buffer),sN=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tl=t9||(t9={}))[tl.UTF8_BYTES=1]="UTF8_BYTES",tl[tl.UTF16_STRING=2]="UTF16_STRING";var sz=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 sV[0]=this.readInt32(t),sF[0]},e.readFloat64=function(t){return sV[sN?0:1]=this.readInt32(t),sV[sN?1:0]=this.readInt32(t+4),sD[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){sF[0]=e,this.writeInt32(t,sV[0])},e.writeFloat64=function(t,e){sD[0]=e,this.writeInt32(t,sV[sN?0:1]),this.writeInt32(t+4,sV[sN?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===t9.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}(),sk=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=sz.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,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))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:(eo(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=sz.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),sU=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 sB(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}(),sB=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=sU.createDataVector(t,this.data);return sU.createFBEffectsObjectData(t,e,i)},t}(),sG=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 sU).__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 sj(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}(),sj=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sG.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sG.createFBEffectsPackageData(t,e)},t}(),sX=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 sH(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}(),sH=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 sX.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),sW=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 sY(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,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),sY=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 sW.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sZ=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 sW).__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 sq(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}(),sq=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=sZ.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sZ.createFBVertexData(t,this.vertexCount,e)},t}(),sQ=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 sZ).__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 sX).__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 sK(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}(),sK=function(){function t(t,e,i,r,n,a,o,s,u,c,h,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===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===c&&(c=[]),void 0===h&&(h=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=c,this.rootBoneName=h,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=sQ.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=sQ.createBinaryDataVector(t,this.binaryData),s=sQ.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,c=sQ.createInverseBindMatricesVector(t,this.inverseBindMatrices);return sQ.startFBGeometryData(t),sQ.addId(t,e),sQ.addName(t,i),sQ.addVertexData(t,r),sQ.addIndexFormat(t,this.indexFormat),sQ.addIndexOffset(t,this.indexOffset),sQ.addSubMeshes(t,n),sQ.addMode(t,this.mode),sQ.addBuffer(t,a),sQ.addBinaryData(t,o),sQ.addBoneNames(t,s),sQ.addRootBoneName(t,u),sQ.addInverseBindMatrices(t,c),sQ.endFBGeometryData(t)},t}(),sJ=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 sk(1),i=new sj,r=[],n=ix(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===tH.Geometry&&(o=new sB("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,sG.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new sz(t),i=sG.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===tH.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new sk(1),i=new sK,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,c=t.rootBoneName,h=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===c?"":c,i.inverseBindMatrices=void 0===h?[]:h,i.binaryData=void 0===l?[]:l;var f=new sq;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=ix(s.channels);!(d=p()).done;){var m=d.value,v=new sY(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=ix(t.subMeshes);!(y=x()).done;){var b=y.value,T=new sH(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,sG.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new sz(t),o=sQ.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var c=0;c<u.channelsLength();c++){var h,l=u.channels(c);if(l){var f={semantic:null!=(h=l.semantic())?h:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:tH.Geometry}},t}(),s$=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 oq(this),this.emptyTexture=i5(this),this.transparentTexture=i6(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,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,c=i.animations,h=i.bins,l=void 0===h?[]:h,f=i.miscs,d=ix(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=ix(void 0===a?[]:a);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=ix(void 0===o?[]:o);!(g=x()).done;){var b=g.value;this.addEffectsObjectData(b)}for(var T,E=ix(void 0===s?[]:s);!(T=E()).done;){var _=T.value;this.addEffectsObjectData(_)}for(var S,C=ix(void 0===u?[]:u);!(S=C()).done;){var A=S.value;this.addEffectsObjectData(A)}for(var O,w=ix(void 0===c?[]:c);!(O=w()).done;){var R=O.value;this.addEffectsObjectData(R)}for(var I,M=ix(void 0===f?[]:f);!(I=M()).done;){var L=I.value;this.addEffectsObjectData(L)}for(var P=0;P<l.length;P++){var V=l[P],F=t.bins[P];if(V.dataType===tH.BinaryAsset)V.buffer=F,V.id&&this.addEffectsObjectData(V);else{var D=new sJ;D.deserializeFromBinary(new Uint8Array(F));for(var N,z=ix(D.exportObjectDatas);!(N=z()).done;){var k=N.value;this.addEffectsObjectData(k)}}}for(var U,B=ix(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return ea(function(){var i,r,n,a;return ec(this,function(o){switch(o.label){case 0:i=ix(t.jsonScene.items),o.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(a=(n=r.value).type)||"camera"===a||a===tE.sprite||a===tE.particle||a===tE.mesh||a===tE.skybox||a===tE.light||a===tE.tree||a===tE.interact||a===tE.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:o.sent(),o.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||ep(this.textures,t)},e.removeTexture=function(t){this.destroyed||em(this.textures,t)},e.addMaterial=function(t){this.destroyed||ep(this.materials,t)},e.removeMaterial=function(t){this.destroyed||em(this.materials,t)},e.addGeometry=function(t){this.destroyed||ep(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||em(this.geometries,t)},e.addMesh=function(t){this.destroyed||ep(this.meshes,t)},e.removeMesh=function(t){this.destroyed||em(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||ep(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||em(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&&eP.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}},e3(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),s0=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=ic(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)},e3(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();eZ("camera",nY,t.VFXItem,!0),eZ("text",oY,t.VFXItem,!0),eZ("sprite",at,t.VFXItem,!0),eZ("particle",om,t.VFXItem,!0),eZ("cal",ov,t.VFXItem,!0),eZ("interact",n0,t.VFXItem,!0),eP.info("Core version: 2.1.0-alpha.9.");var s1=((t7={})[iO.ONE]=er.OneFactor,t7[iO.ZERO]=er.ZeroFactor,t7[iO.SRC_COLOR]=er.SrcColorFactor,t7[iO.SRC_ALPHA]=er.SrcAlphaFactor,t7[iO.ONE_MINUS_SRC_COLOR]=er.OneMinusSrcColorFactor,t7[iO.ONE_MINUS_SRC_ALPHA]=er.OneMinusSrcAlphaFactor,t7[iO.DST_COLOR]=er.DstColorFactor,t7[iO.DST_ALPHA]=er.DstAlphaFactor,t7[iO.ONE_MINUS_DST_COLOR]=er.OneMinusDstColorFactor,t7[iO.ONE_MINUS_DST_ALPHA]=er.OneMinusDstAlphaFactor,t7),s2=((et={})[iO.NEVER]=er.NeverStencilFunc,et[iO.EQUAL]=er.EqualStencilFunc,et[iO.LESS]=er.LessStencilFunc,et[iO.LEQUAL]=er.LessEqualStencilFunc,et[iO.ALWAYS]=er.AlwaysStencilFunc,et[iO.NOTEQUAL]=er.NotEqualStencilFunc,et[iO.GREATER]=er.GreaterStencilFunc,et[iO.GEQUAL]=er.GreaterEqualStencilFunc,et),s3=((ee={})[iO.KEEP]=er.KeepStencilOp,ee[iO.ZERO]=er.ZeroStencilOp,ee[iO.REPLACE]=er.ReplaceStencilOp,ee[iO.INCR]=er.IncrementStencilOp,ee[iO.DECR]=er.DecrementStencilOp,ee[iO.INCR_WRAP]=er.IncrementWrapStencilOp,ee[iO.DECR_WRAP]=er.IncrementWrapStencilOp,ee[iO.INVERT]=er.InvertStencilOp,ee),s4=((ei={})[iO.NEVER]=er.NeverDepth,ei[iO.ALWAYS]=er.AlwaysDepth,ei[iO.EQUAL]=er.EqualDepth,ei[iO.LESS]=er.LessDepth,ei[iO.LEQUAL]=er.LessEqualDepth,ei[iO.GREATER]=er.GreaterDepth,ei[iO.GEQUAL]=er.GreaterEqualDepth,ei[iO.NOTEQUAL]=er.NotEqualDepth,ei),s5=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],s6=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new er.RawShaderMaterial,n.uniforms={};var n,a,o,s,u,c=null==r?void 0:r.shader,h=i.gpuCapability.level;n.shader=new t.Shader(i),n.shader.shaderData=iV({},c,{id:eG(),dataType:tH.Shader,vertex:null!=(a=null==c?void 0:c.vertex)?a:"",fragment:null!=(o=null==c?void 0:c.fragment)?o:""});for(var l=0;l<t.maxSpriteMeshItemCount;l++)n.uniforms["uSampler"+l]=new er.Uniform(null);return n.uniforms.uEditorTransform=new er.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new er.Uniform(new er.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new er.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new er.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new er.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new er.RawShaderMaterial({vertexShader:rD.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==c?void 0:c.vertex)?s:"",macros:null==c?void 0:c.macros,removeVersion:!0}),fragmentShader:rD.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==c?void 0:c.fragment)?u:"",macros:null==c?void 0:c.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:er.LessDepth,polygonOffsetFactor:er.ZeroFactor,polygonOffsetUnits:er.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===h?n.material.glslVersion=er.GLSL1:n.material.glslVersion=er.GLSL3,n}e$(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;s5.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new er.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new er.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.uniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=ix(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=ix(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.uniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.uniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.uniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.uniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){return this.uniforms[t].value},r.setColor=function(t,e){this.setUniform(t,e)},r.getQuaternion=function(t){return this.uniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.uniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.uniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.uniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.uniforms[t]},r.setUniform=function(t,e){var i=new er.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t){throw Error("Method not implemented.")},r.disableMacro=function(t){throw Error("Method not implemented.")},r.isMacroEnabled=function(t){throw Error("Method not implemented.")},r.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},e3(i,[{key:"blending",get:function(){return this.material.blending!==er.NoBlending},set:function(t){this.material.blending=t?er.CustomBlending:er.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=s1[e],this.material.blendDst=s1[i],this.material.blendSrcAlpha=s1[r],this.material.blendDstAlpha=s1[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=s4[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=s2[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=s3[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=s3[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=s3[t[0]])}},{key:"culling",get:function(){return this.material.side!==er.DoubleSide},set:function(t){this.material.side=t?er.FrontSide:er.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tv.FRONT?this.material.side=er.FrontSide:t===tv.BACK&&(this.material.side=er.BackSide)}}]),i}(rr),s8=1,s9=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return oU(r);var r,n=i.drawStart,a=i.drawCount,o=i.indices,s=i.mode,u=i.name,c=void 0===u?"effectsGeometry:"+s8++:u;r.name=c,r.mode=null!=s?s:iO.TRIANGLES;var h=[],l={},f=new er.BufferGeometry;return Object.keys(i.attributes).forEach(function(t){var e=i.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===l[n]&&r.setAttributeType(n,e,f,l,i.maxVertex);var a=e.size,o=e.offset,s=e.normalize,u=l[n],c=u.buffer,d=u.dataLength,p=new er.InterleavedBufferAttribute(c,a,(null!=o?o:0)/d,s);f.setAttribute(t,p),l[t]={buffer:c,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,l,i.maxVertex);h.push(t)}),o&&o.data&&f.setIndex(new er.BufferAttribute(o.data,1)),r.geometry=f,r.attributes=l,r.attributesName=h,r.drawStart=void 0===n?0:n,r.drawCount=null!=a?a:0,r}e$(e,t);var i=e.prototype;return i.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},i.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var i=this.attributes[t].buffer;if(e.length>i.array.length){var r=new er.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=r,this.attributes[t].buffer=r,this.geometry.setAttribute(t,this.attributes[t].attribute)}else i.set(e,0),i.updateRange.count=e.length,i.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},i.setAttributeSubData=function(t,e,i){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(i,e),this.geometry.attributes[t].needsUpdate=!0)},i.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*ru[e.type]},i.getAttributeNames=function(){return this.attributesName},i.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},i.setIndexData=function(t){t&&(this.geometry.setIndex(new er.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},i.setIndexSubData=function(t,e){var i=this.geometry.getIndex();if(null!==i){var r=t+e.length;if(i.count<r){var n=new e.constructor(end);n.set(i.array),i.array=n}i.array.set(e,t),this.geometry.index.needsUpdate=!0}},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{}},i.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},i.setAttributeType=function(t,e,i,r,n){var a=e.stride,o=e.size,s=e.offset,u=e.normalize,c=e.type,h=void 0===c?iO.FLOAT:c,l=e.data;if(h&&!l&&(l=rh(h)),l){var f=eo(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===a?0:a)/f,p=(n=(null!=n?n:0)*d)||o*f;p&&0===l.length&&(l=eo(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new er.InterleavedBuffer(l,d),v=new er.InterleavedBufferAttribute(m,o,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:h,dataLength:f}}},e3(e,[{key:"drawCount",get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t}},{key:"drawStart",get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t}}]),e}(rc),s7=function(e){function i(t,i){if(!i)return oU(r);var r,n=i.material,a=i.geometry,o=i.priority;return(r=e.call(this,t,i)||this).geometry=a,r.material=n,a.mode===iO.LINES?r.mesh=new er.LineSegments(a.geometry,n.material):r.mesh=new er.Mesh(a.geometry,n.material),r.priority=void 0===o?0:o,r}e$(i,e);var r=i.prototype;return r.setVisible=function(t){this.mesh.visible=t},r.getVisible=function(){return this.mesh.visible},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e,this.mesh.material=e.material},r.onStart=function(){e.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},r.restore=function(){},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},e3(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(rx),ut=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(iV({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a.source={},a}e$(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.assembleOptions=function(e){var r=e.target,n=void 0===r?iO.TEXTURE_2D:r;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=t.TextureSourceType.none),iV({},e,{target:n,format:er.RGBAFormat,type:er.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose()},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,c=i.sourceType,h=er.UVMapping,l=i.format,f=void 0;if(this.sourceType=c,c===t.TextureSourceType.data){var d=e.data;f=new er.DataTexture(d.data,d.width,d.height,l,n,h,a,o,u,s),this.width=d.width,this.height=d.height}else if(c===t.TextureSourceType.image){var p=e.image;f=new er.Texture(p,h,a,o,u,s,l,n),this.width=p.width,this.height=p.height}else if(c===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});l=er.RGBA_ASTC_4x4_Format,f=new er.CompressedTexture(y,m,v,l,n,h,a,o,u,s),this.width=m,this.height=v}else if(c===t.TextureSourceType.video)f=new er.VideoTexture(e.video,h,a,o,u,s,l,n);else if(c===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,E=null!=(b=g.height)?b:0;f=new er.FramebufferTexture(T,E,l),this.width=T,this.height=E}}else c===t.TextureSourceType.none&&((f=new er.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=er.MirroredRepeatWrapping,f.wrapT=er.MirroredRepeatWrapping,this.width=this.height=1);if(this.source=e,f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===iO.LINEAR?er.LinearFilter:er.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iO.MIRRORED_REPEAT:return er.MirroredRepeatWrapping;case iO.REPEAT:return er.RepeatWrapping;default:return er.ClampToEdgeWrapping}},i}(i2),ue=function(t){function e(e,i){return t.call(this,e,i)}e$(e,t);var i=e.prototype;return i.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,i=ix(this.rootComposition.items);!(e=i()).done;)for(var r,n=e.value.getComponents(ir),a=ix(n);!(r=a()).done;){var o=r.value;o.isActiveAndEnabled&&o.render(t)}for(var s,u=ix(this.refContent);!(s=u()).done;)for(var c,h=s.value,l=ix(h.getComponent(oM).items);!(c=l()).done;)for(var f,d=c.value.getComponents(ir),p=ix(d);!(f=p()).done;){var m=f.value;m.isActiveAndEnabled&&m.render(t)}},i.getRendererOptions=function(){var t=ut.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},e}(sP);ue.shape={};var ui=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new rq(e),i}return e$(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},e}(s$),ur=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new ui(e),i.engine.renderer=im(i),i.env="",i.renderingData={currentFrame:{}},i}return e$(e,t),e}(rJ),un=function(e){function i(t,i){(r=e.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.renderer=new ur(t),r.width=n,r.height=a,r.camera=o,r}e$(i,e);var r=i.prototype;return r.loadScene=function(t,e){var i=this;return ea(function(){var r,n;return ec(this,function(a){switch(a.label){case 0:if(n=i.baseCompositionIndex,!eD(t))return[3,2];return i.baseCompositionIndex+=t.length,[4,Promise.all(t.map(ea(function(t,r){var a;return ec(this,function(o){switch(o.label){case 0:return[4,i.createComposition(t,e)];case 1:return(a=o.sent()).setIndex(n+r),[2,a]}})})))];case 1:return r=a.sent(),[3,4];case 2:return i.baseCompositionIndex+=1,[4,i.createComposition(t,e)];case 3:(r=a.sent()).setIndex(n),a.label=4;case 4:return[2,r]}})})()},r.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},r.resume=function(){this.compositions.forEach(function(t){t.resume()})},r.createComposition=function(e,i){void 0===i&&(i={});var r=this;return ea(function(){var n,a,o,s,u,c,h,l;return ec(this,function(f){switch(f.label){case 0:return n=performance.now(),a=iV({autoplay:!0},i),o=e,t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(o=e.url),t.Scene.isWithOptions(e)&&(a=iV({},a,e.options||{}))),r.assetManager?r.assetManager.updateOptions(a):r.assetManager=new sS(a),[4,r.assetManager.loadScene(o,r.renderer,{env:r.env})];case 1:for(s=f.sent(),(u=r.renderer.engine).clearResources(),u.addPackageDatas(s),c=0;c<s.textureOptions.length;c++)s.textureOptions[c]=u.assetLoader.loadGUID(s.textureOptions[c].id),s.textureOptions[c].initialize();if(!u.database)return[3,3];return[4,u.createVFXItems(s)];case 2:f.sent(),f.label=3;case 3:return(h=new ue(iV({},a,{width:r.width,height:r.height,renderer:r.renderer,handleItemMessage:function(t){r.dispatchEvent({type:"message",message:t})}}),s)).on("end",function(){r.dispatchEvent({type:"end",composition:h})}),r.renderer.engine.setOptions({threeCamera:r.camera,threeGroup:r,composition:h}),a.autoplay?h.play():h.pause(),l=performance.now()-n+h.statistic.loadTime,h.statistic.firstFrameTime=l,eP.info("First frame: ["+h.name+"]"+l.toFixed(4)+"ms."),r.compositions.push(h),[2,h]}})})()},r.update=function(t){this.compositions.forEach(function(e){e.update(t)})},e3(i,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),i}(er.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}e$(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===iO.LINES?this.threeMesh=new er.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new er.Mesh(this.geometry.geometry,this.material.material))},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},e3(e,[{key:"priority",get:function(){return this.threeMesh.renderOrder},set:function(t){this.threeMesh&&(this.threeMesh.renderOrder=t)}},{key:"enabled",get:function(){return this.threeMesh.visible},set:function(t){this.threeMesh.visible=t,t&&this.onEnable()}}]),e}(t.SpriteComponent),t.ThreeSpriteComponent=eu([e8(tH.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=oj.getCanvas(),oj.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return oU(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(!1),r}e$(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture(!1)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(!1)},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=eu([e8(tH.TextComponent)],t.ThreeTextComponent),eX(t.ThreeTextComponent,[oW]),n9(8),i2.create=function(t,e){return new ut(t,void 0,e)},i2.createWithData=function(t,e,i){return new ut(t,e,i)},rr.create=function(t,e){return new s6(t,e)},rc.create=function(t,e){return new s9(t,e)},rx.create=function(t,e){return new s7(t,e)};var ua="2.1.0-alpha.9";eP.info("THREEJS plugin version: "+ua+"."),t.AbstractPlugin=eK,t.ActivationPlayable=o_,t.AnimationClipPlayable=oS,t.Asset=oZ,t.AssetLoader=oq,t.AssetManager=sS,t.BYTES_TYPE_MAP=ru,t.BaseRenderComponent=nN,t.Behaviour=ii,t.BezierCurve=nE,t.BezierCurvePath=nS,t.BezierCurveQuat=nC,t.CONSTANT_MAP_BLEND=s1,t.CONSTANT_MAP_DEPTH=s4,t.CONSTANT_MAP_STENCIL_FUNC=s2,t.CONSTANT_MAP_STENCIL_OP=s3,t.COPY_FRAGMENT_SHADER=iS,t.COPY_MESH_SHADER_ID=iE,t.COPY_VERTEX_SHADER=i_,t.CalculateLoader=ov,t.Camera=sA,t.CameraVFXItemLoader=nY,t.ColorCurve=nD,t.Component=ie,t.Composition=sP,t.CompositionComponent=oM,t.CompositionSourceManager=sw,t.DEFAULT_FONTS=oX,t.DEFAULT_FPS=60,t.Database=oQ,t.Downloader=iF,t.EFFECTS_COPY_MESH_NAME=iT,t.EVENT_TYPE_CLICK=nZ,t.EVENT_TYPE_TOUCH_END=nK,t.EVENT_TYPE_TOUCH_MOVE=nQ,t.EVENT_TYPE_TOUCH_START=nq,t.EffectsObject=it,t.EffectsPackage=sJ,t.Engine=s$,t.EventEmitter=au,t.EventSystem=nJ,t.Float16ArrayWrapper=r0,t.Framebuffer=rK,t.GPUCapability=rq,t.Geometry=rc,t.GlobalUniforms=rW,t.GradientValue=nb,t.HELP_LINK=nP,t.InteractLoader=n0,t.InteractMesh=n2,t.KTXTexture=i8,t.LineSegments=nT,t.LinearValue=nx,t.Material=rr,t.MaterialDataBlock=rt,t.Mesh=rx,t.MeshCollider=n4,t.PLAYER_OPTIONS_ENV_EDITOR=nL,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=os,t.ParticleBehaviourPlayableAsset=ou,t.ParticleLoader=om,t.ParticleMesh=oh,t.ParticleSystemRenderer=a8,t.PassTextureCache=ro,t.PathSegments=n_,t.PluginSystem=eq,t.PropertyTrack=oF,t.RENDER_PASS_NAME_PREFIX=rB,t.RENDER_PREFER_LOOKUP_TEXTURE=ad,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=nv,t.RandomValue=ny,t.RandomVectorValue=ng,t.RenderFrame=rj,t.RenderPass=rE,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=rb,t.Renderbuffer=rY,t.Renderer=rJ,t.RendererComponent=ir,t.RuntimeClip=oA,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=rs,t.SerializationHelper=oI,t.ShaderFactory=rD,t.ShaderVariant=ib,t.SpriteLoader=at,t.StaticValue=nm,t.TEMPLATE_USE_OFFSCREEN_CANVAS=ap,t.TEXTURE_UNIFORM_MAP=s5,t.TextComponentBase=oW,t.TextLayout=oB,t.TextLoader=oY,t.TextStyle=oG,t.Texture=i2,t.TextureFactory=i7,t.ThreeComposition=ue,t.ThreeDisplayObject=un,t.ThreeEngine=ui,t.ThreeMaterial=s6,t.ThreeTexture=ut,t.Ticker=s0,t.TimelineClip=oC,t.TimelinePlayable=oN,t.TrackSortWrapper=oz,t.Transform=as,t.TransformAnimationPlayable=oE,t.ValueGetter=np,t.Vector4Curve=nM,t.addByOrder=ew,t.addItem=ep,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 a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=eX,t.assertExist=eI,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=r3,t.canvasPool=oj,t.colorGradingFrag=rI,t.colorStopsFromGradient=ex,t.colorToArr=ey,t.combineImageTemplate=sT,t.createCopyShader=iC,t.createGLContext=function(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},t.createKeyFrameMeta=nR,t.createShape=aI,t.createValueGetter=nF,t.decimalEqual=nt,t.defaultPlugins=eW,t.deserializeMipmapTexture=iK,t.earcut=aY,t.effectsClass=e8,t.effectsClassStore=e6,t.enlargeBuffer=ev,t.ensureFixedNumber=oJ,t.ensureVec3=r4,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=rM,t.gaussianDownVFrag=rL,t.gaussianUpFrag=rP,t.generateEmptyTypedArray=rh,t.generateGUID=eG,t.generateHalfFloatTexture=i3,t.generateTransparentTexture=i6,t.generateWhiteTexture=i5,t.getBackgroundImage=sb,t.getColorFromGradientStops=eg,t.getConfig=function(t){return am[t]},t.getDefaultTextureFactory=function(){return tJ||(tJ=new i7),tJ},t.getGeometryByShape=aq,t.getGeometryTriangles=aZ,t.getImageItemRenderInfo=nz,t.getKTXTextureOptions=i9,t.getKeyFrameMetaByRawValue=nw,t.getMergedStore=e9,t.getParticleMeshShader=od,t.getPixelRatio=function(){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},t.getPreMultiAlpha=iI,t.getStandardComposition=sm,t.getStandardImage=sp,t.getStandardItem=sy,t.getStandardJSON=sf,t.getTextureSize=rX,t.glContext=iO,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tY.Float32;case WebGLRenderingContext.SHORT:return tY.Int16;case WebGLRenderingContext.BYTE:return tY.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tY.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tY.UInt8;default:return tY.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=ea(function(){return ec(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){eF(t)&&(t=ey(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},t.imageDataFromGradient=eA,t.initErrors=iA,t.initGLContext=iw,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=eb,t.isAlipayMiniApp=eS,t.isAndroid=eE,t.isArray=eD,t.isCanvas=ek,t.isFunction=eN,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},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 eS()||eC()},t.isObject=ez,t.isSimulatorCellPhone=e_,t.isString=eF,t.isUniformStruct=re,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&re(t[0])},t.isValidFontFamily=eM,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eC,t.itemFrag=rC,t.itemFrameFrag=r_,t.itemVert=rS,t.loadAVIFOptional=iU,t.loadBinary=iX,t.loadBlob=function(t){return iW.apply(this,arguments)},t.loadImage=iG,t.loadMedia=iq,t.loadVideo=iY,t.loadWebPOptional=iz,t.logger=eP,t.math=ry,t.modifyMaxKeyframeShader=op,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=eV,t.normalizeColor=o4,t.numberToFix=ne,t.parsePercent=eT,t.particleFrag=rA,t.particleOriginTranslateMap=r8,t.particleUniformTypeMap=oc,t.particleVert=rO,t.passRenderLevel=sx,t.pluginLoaderMap=eH,t.randomInRange=eU,t.registerPlugin=eZ,t.removeItem=em,t.rotateVec2=aQ,t.screenMeshVert=rR,t.serialize=function(t,e){return e7(t,e)},t.setBlendMode=iM,t.setConfig=function(t,e){return am[t]=e},t.setDefaultTextureFactory=function(t){tJ=t},t.setMaskMode=iP,t.setMaxSpriteMeshItemCount=n9,t.setRayFromCamera=r9,t.setSideMode=iL,t.setSpriteMeshMaxItemCountByGPU=function(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0},t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new er.Uniform(i)},t.sortByOrder=eO,t.spec=e1,t.spriteMeshShaderFromFilter=n5,t.spriteMeshShaderFromRenderInfo=n8,t.spriteMeshShaderIdFromRenderInfo=n6,t.thresholdFrag=rV,t.throwDestroyedError=eB,t.trailVert=rw,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=r7,t.unregisterPlugin=function(t){delete eY[t],delete eH[t],em(eW,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=r5,t.vecMulCombine=r6,t.version=ua,t.vertexFormatType2GLType=function(t){switch(t){case tY.Float32:return WebGLRenderingContext.FLOAT;case tY.Int16:return WebGLRenderingContext.SHORT;case tY.Int8:return WebGLRenderingContext.BYTE;case tY.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tY.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
8
8
  //# sourceMappingURL=index.min.js.map