@galacean/effects-threejs 2.0.0-alpha.25 → 2.0.0-alpha.27
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.js +1734 -142
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +1734 -143
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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.0.0-alpha.
|
|
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 r,i,n,o,a,s,u,c,l,h,f,m,d,p,v,y,g,x,T,E,b,_,C,S,A,R,w,O,M,I,L,P,V,F,z,N,D,k,U,B,G,X,H,j,W,Y,Z,q,Q,K,J,$,tt,te,tr,ti,tn,to,ta,ts,tu,tc,tl,th,tf,tm,td,tp,tv,ty,tg,tx,tT,tE,tb,t_,tC,tS,tA,tR,tw,tO,tM,tI,tL,tP,tV,tF,tz,tN,tD,tk,tU,tB,tG,tX,tH,tj,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}(e);function et(t,e,r,i,n,o,a){try{var s=t[o](a),u=s.value}catch(t){r(t);return}s.done?e(u):Promise.resolve(u).then(i,n)}function ee(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(t){et(o,i,n,a,s,"next",t)}function s(t){et(o,i,n,a,s,"throw",t)}a(void 0)})}}function er(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):er(t,e)}function ei(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function en(t,e,r,i){var n,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,r,a):n(e,r))||a);return o>3&&a&&Object.defineProperty(e,r,a),a}function eo(t,e){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],i=0}finally{r=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 ea=new Uint8Array(16),es=[],eu=0;eu<256;++eu)es.push((eu+256).toString(16).slice(1));var ec={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function el(t,e){return t.includes(e)||t.push(e),t}function eh(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function ef(t,e,r,i){if(void 0===i&&(i=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*i);Number.isNaN(r)||(n=Math.min(n,r));var o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function em(t,e){var r=[0,0,0,0];if(eO(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else er(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)r[o]/=255;return r}function ed(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=ev(o.color,a.color,(e-o.stop)/(a.stop-o.stop));break}}return i||(i=t[t.length-1].color),r?i.map(function(t){return t/255}):i}return[0,0,0,0]}function ep(t){var e=[];if(er(t,Array)?t.forEach(function(t){var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4];e.push({stop:ey(r),color:[i,n,o,a]})}):Object.keys(t).forEach(function(r){var i=em(t[r]);e.push({stop:ey(r),color:i})}),(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 r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function ev(t,e,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*r;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function ey(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eg(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ex(){return eg()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eT(t){var e={width:128,height:1,data:new Uint8Array(512)},r=e.data,i=ep(t);if(i.length){r.set(i[0].color,0);for(var n=1;n<127;n++){for(var o=n/128,a=void 0,s=void 0,u=0;u<i.length&&(a=i[u],s=i[u+1],!(a.stop<=o)||!(s.stop>o));u++);var c=ev(a.color,s.color,(o-a.stop)/(s.stop-a.stop));r.set(c,4*n)}r.set(i[i.length-1].color,508)}return e}function eE(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(!(r<=30))return function t(e,r,i,n){if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var o,a,s=e[i],u=i,c=n;u<c;){if(2===r){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++}o=[e[c],e[u]],e[u]=o[0],e[c]=o[1]}return a=[e[u],e[i]],e[i]=a[0],e[u]=a[1],t(e,r,i,u-1),t(e,r,c+1,n),e}(t,e);for(var i=1;i<r;i++)e_(t,i,e);return t}function eb(t,e,r){return void 0===r&&(r=2),t.includes(e)||(t.push(e),1===t.length||1!==r&&e_(t,t.length-1,r)),t}function e_(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function eC(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eS(t){return/^[^\d.][\w-]*$/.test(t)}function eA(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(r=t.OrderType||(t.OrderType={}))[r.none=1]="none",r[r.ascending=2]="ascending",r[r.descending=3]="descending";var eR={error:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).error.apply(e,[].concat(eA(t),[i])),null==tc||tc("error",t,i)},info:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(eA(t))),null==tc||tc("info",t,i)},warn:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(eA(t))),null==tc||tc("warn",t,i)},register:function(t){t&&eI(t)&&(tc=t)}};function ew(){}function eO(t){return"string"==typeof t}t.DestroyOptions=void 0,(i=t.DestroyOptions||(t.DestroyOptions={}))[i.destroy=0]="destroy",i[i.keep=1]="keep",i[i.force=0]="force";var eM=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eI(t){return"[object Function]"===Object.prototype.toString.call(t)}function eL(t){return"[object Object]"===Object.prototype.toString.call(t)}function eP(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eV(t,e){return t+Math.random()*(e-t)}function eF(){throw Error("Destroyed item cannot be used again.")}function ez(){return(function(t,e,r){if(ec.randomUUID&&!t)return ec.randomUUID();var i,n=(t=t||{}).random||(t.rng||function(){if(!tu&&!(tu="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 tu(ea)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===i&&(i=0),es[n[i+0]]+es[n[i+1]]+es[n[i+2]]+es[n[i+3]]+"-"+es[n[i+4]]+es[n[i+5]]+"-"+es[n[i+6]]+es[n[i+7]]+"-"+es[n[i+8]]+es[n[i+9]]+"-"+es[n[i+10]]+es[n[i+11]]+es[n[i+12]]+es[n[i+13]]+es[n[i+14]]+es[n[i+15]]})().replace(/-/g,"")}function eN(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=atob(t.split(",")[1]||t),n=[],o=0;o<i.length;o+=512){for(var a=i.slice(o,o+512),s=Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var c=new Uint8Array(s);n.push(c)}return new File([new Blob(n,{type:r})],e,{type:r})}function eD(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e.prototype,r);if(!i)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,r,i)})})}function ek(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function eU(t,e,r){return e&&ek(t.prototype,e),r&&ek(t,r),t}function eB(t,e){return(eB=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function eG(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&&eB(t,e)}function eX(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function eH(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return eX(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eX(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ej=Math.PI/180,eW=180/Math.PI;function eY(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var eZ=function(t,e,r){return(1-r)*t+r*e};function eq(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r;return Math.min(Math.max(t,Math.min(i,n)),Math.max(i,n))}var eQ=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 r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):er(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):er(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):er(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):er(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,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,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();eQ.ONE=new eQ(1,1),eQ.ZERO=new eQ(0,0);var eK=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,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 r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):er(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):er(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):er(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):er(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,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 r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,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,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},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,r=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new eQ(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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();eK.X=new eK(1,0,0),eK.Y=new eK(0,1,0),eK.Z=new eK(0,0,1),eK.ONE=new eK(1,1,1),eK.ZERO=new eK(0,0,0);var eJ=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.z*n,this.w=Math.cos(i),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,r=e[0],i=e[4],n=e[8],o=e[1],a=e[5],s=e[9],u=e[2],c=e[6],l=e[10],h=r+a+l;if(h>0){var f=.5/Math.sqrt(h+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(o-i)*f}else if(r>a&&r>l){var m=2*Math.sqrt(1+r-a-l);this.w=(c-s)/m,this.x=.25*m,this.y=(i+o)/m,this.z=(n+u)/m,this.negate()}else if(a>l){var d=2*Math.sqrt(1+a-r-l);this.w=(n-u)/d,this.x=(i+o)/d,this.y=.25*d,this.z=(s+c)/d,this.negate()}else{var p=2*Math.sqrt(1+l-r-a);this.w=(o-i)/p,this.x=(n+u)/p,this.y=(s+c)/p,this.z=.25*p,this.negate()}return this},e.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=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=r,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(eq(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var r=this.angleTo(t);return 0===r||this.slerp(t,Math.min(1,e/r)),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 r=t.x,i=t.y,n=t.z,o=t.w,a=e.x,s=e.y,u=e.z,c=e.w;return this.x=r*c+o*a+i*u-n*s,this.y=i*c+o*s+n*a-r*u,this.z=n*c+o*u+r*s-i*a,this.w=o*c-r*a-i*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this.x,i=this.y,n=this.z,o=this.w,a=o*t.w+r*t.x+i*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=r,this.y=i,this.z=n,this;var s=1-a*a;if(s<=Number.EPSILON){var u=1-e;return this.w=u*o+e*this.w,this.x=u*r+e*this.x,this.y=u*i+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var c=Math.sqrt(s),l=Math.atan2(c,a),h=Math.sin((1-e)*l)/c,f=Math.sin(e*l)/c;return this.w=o*h+this.w*f,this.x=r*h+this.x*f,this.y=i*h+this.y*f,this.z=n*h+this.z*f,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this.x,i=this.y,n=this.z,o=this.w,a=t.x,s=t.y,u=t.z,c=o*a+i*u-n*s,l=o*s+n*a-r*u,h=o*u+r*s-i*a,f=-r*a-i*s-n*u,m=null!=e?e:t;return m.x=c*o+-(f*r)+-(l*n)- -(h*i),m.y=l*o+-(f*i)+-(h*r)- -(c*n),m.z=h*o+-(f*n)+-(c*i)- -(l*r),m},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(eK.ZERO,this,eK.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,r){return new t().setFromAxisAngle(e,r)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return new t().setFromUnitVectors(e,r)},t}();eJ.tempVec0=new eK;var e$=function(){function t(t,e,r,i,n,o,a,s,u,c,l,h,f,m,d,p){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===l&&(l=1),void 0===h&&(h=0),void 0===f&&(f=0),void 0===m&&(m=0),void 0===d&&(d=0),void 0===p&&(p=1),this.elements=[t,e,r,i,n,o,a,s,u,c,l,h,f,m,d,p]}var e=t.prototype;return e.set=function(t,e,r,i,n,o,a,s,u,c,l,h,f,m,d,p){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=l,v[11]=h,v[12]=f,v[13]=m,v[14]=d,v[15]=p,this},e.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,c,l,h,f,m,d,p){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=l,v[14]=h,v[3]=f,v[7]=m,v[11]=d,v[15]=p,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.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 r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),o=Math.sin(r),a=1-n,s=i.x,u=i.y,c=i.z,l=a*s,h=a*u;return this.set(l*s+n,l*u+o*c,l*c-o*u,0,l*u-o*c,h*u+n,h*c+o*s,0,l*c+o*u,h*c-o*s,a*c*c+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(eK.ZERO,t,eK.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.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,r,i){var n=t.tempVec0,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.dot(e),s[15]=1,this},e.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[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 r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],u=r[12],c=r[1],l=r[5],h=r[9],f=r[13],m=r[2],d=r[6],p=r[10],v=r[14],y=r[3],g=r[7],x=r[11],T=r[15],E=i[0],b=i[4],_=i[8],C=i[12],S=i[1],A=i[5],R=i[9],w=i[13],O=i[2],M=i[6],I=i[10],L=i[14],P=i[3],V=i[7],F=i[11],z=i[15];return n[0]=o*E+a*S+s*O+u*P,n[4]=o*b+a*A+s*M+u*V,n[8]=o*_+a*R+s*I+u*F,n[12]=o*C+a*w+s*L+u*z,n[1]=c*E+l*S+h*O+f*P,n[5]=c*b+l*A+h*M+f*V,n[9]=c*_+l*R+h*I+f*F,n[13]=c*C+l*w+h*L+f*z,n[2]=m*E+d*S+p*O+v*P,n[6]=m*b+d*A+p*M+v*V,n[10]=m*_+d*R+p*I+v*F,n[14]=m*C+d*w+p*L+v*z,n[3]=y*E+g*S+x*O+T*P,n[7]=y*b+g*A+x*M+T*V,n[11]=y*_+g*R+x*I+T*F,n[15]=y*C+g*w+x*L+T*z,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],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],l=t[6],h=t[10],f=t[14];return t[3]*(+n*s*l-i*u*l-n*a*h+r*u*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*u*h+n*o*h-i*o*f+i*u*c-n*s*c)+t[11]*(+e*u*l-e*a*f-n*o*l+r*o*f+n*a*c-r*u*c)+t[15]*(-i*a*c-e*s*l+e*a*h+i*o*l-r*o*h+r*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],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],h=t[10],f=t[11],m=t[12],d=t[13],p=t[14],v=t[15],y=l*p*u-d*h*u+d*s*f-a*p*f-l*s*v+a*h*v,g=m*h*u-c*p*u-m*s*f+o*p*f+c*s*v-o*h*v,x=c*d*u-m*l*u+m*a*f-o*d*f-c*a*v+o*l*v,T=m*l*s-c*d*s-m*a*h+o*d*h+c*a*p-o*l*p,E=e*y+r*g+i*x+n*T;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var b=1/E;return t[0]=y*b,t[1]=(d*h*n-l*p*n-d*i*f+r*p*f+l*i*v-r*h*v)*b,t[2]=(a*p*n-d*s*n+d*i*u-r*p*u-a*i*v+r*s*v)*b,t[3]=(l*s*n-a*h*n-l*i*u+r*h*u+a*i*f-r*s*f)*b,t[4]=g*b,t[5]=(c*p*n-m*h*n+m*i*f-e*p*f-c*i*v+e*h*v)*b,t[6]=(m*s*n-o*p*n-m*i*u+e*p*u+o*i*v-e*s*v)*b,t[7]=(o*h*n-c*s*n+c*i*u-e*h*u-o*i*f+e*s*f)*b,t[8]=x*b,t[9]=(m*l*n-c*d*n-m*r*f+e*d*f+c*r*v-e*l*v)*b,t[10]=(o*d*n-m*a*n+m*r*u-e*d*u-o*r*v+e*a*v)*b,t[11]=(c*a*n-o*l*n-c*r*u+e*l*u+o*r*f-e*a*f)*b,t[12]=T*b,t[13]=(c*d*i-m*l*i+m*r*h-e*d*h-c*r*p+e*l*p)*b,t[14]=(m*a*i-o*d*i-m*r*s+e*d*s+o*r*p-e*a*p)*b,t[15]=(o*l*i-c*a*i+c*r*s-e*l*s-o*r*h+e*a*h)*b,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=eK.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,c=-i.x,l=-i.y,h=-i.z,f=o+o,m=a+a,d=s+s,p=o*f,v=o*m,y=o*d,g=a*m,x=a*d,T=s*d,E=u*f,b=u*m,_=u*d,C=r.x,S=r.y,A=r.z;return n[0]=(1-(g+T))*C,n[1]=(v+_)*C,n[2]=(y-b)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(p+T))*S,n[6]=(x+E)*S,n[7]=0,n[8]=(y+b)*A,n[9]=(x-E)*A,n[10]=(1-(p+g))*A,n[11]=0,n[12]=c*n[0]+l*n[4]+h*n[8]-c+t.x,n[13]=c*n[1]+l*n[5]+h*n[9]-l+t.y,n[14]=c*n[2]+l*n[6]+h*n[10]-h+t.z,this},e.decompose=function(e,r,i){var n=t.tempVec0,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var c=t.tempMat0;c.copyFrom(this);var l=1/a,h=1/s,f=1/u;return c.elements[0]*=l,c.elements[1]*=l,c.elements[2]*=l,c.elements[4]*=h,c.elements[5]*=h,c.elements[6]*=h,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,r.setFromRotationMatrix(c),i.x=a,i.y=s,i.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 eK,e=new eJ,r=new eK;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,o){var a=1/(e-t),s=1/(r-i),u=1/(o-n),c=-(e+t)*a,l=-(r+i)*s,h=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=c,f[13]=l,f[14]=h,f[15]=1,this},e.perspective=function(t,e,r,i,n){var o=1/Math.tan(.5*t),a=1/(r-i),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(i+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*i*r*a,s[15]=0,(null===i||i===1/0)&&(s[10]=-1,s[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14];var s=o[3]*r+o[7]*i+o[11]*n+o[15];return a.multiply(1/s)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14],a},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n,a.y=o[1]*r+o[5]*i+o[9]*n,a.z=o[2]*r+o[6]*i+o[10]*n,a.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*r+a[4]*i+a[8]*n+a[12]*o,s.y=a[1]*r+a[5]*i+a[9]*n+a[13]*o,s.z=a[2]*r+a[6]*i+a[10]*n+a[14]*o,s.w=a[3]*r+a[7]*i+a[11]*n+a[15]*o,s},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!eY(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[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,r,i){return new t().lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,o){return new t().perspective(e,r,i,n,o)},t.fromColumnVectors=function(e,r,i,n){return new t().setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromScale=function(e,r,i){return new t().setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return new t().setFromTranslation(e,r,i)},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,r){return new t().setFromRotationAxis(e,r)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,r,i){return new t().setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return new t().setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,c,l,h,f,m,d,p,v){return new t(e,o,c,m,r,a,l,d,i,s,h,p,n,u,f,v)},t}();e$.IDENTITY=new e$(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),e$.ZERO=new e$(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),e$.tempVec0=new eK,e$.tempVec1=new eK,e$.tempVec2=new eK,e$.tempMat0=new e$,(n=tl||(tl={}))[n.XYZ=0]="XYZ",n[n.XZY=1]="XZY",n[n.YXZ=2]="YXZ",n[n.YZX=3]="YZX",n[n.ZXY=4]="ZXY",n[n.ZYX=5]="ZYX";var e0=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,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 r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],u=r[9],c=r[2],l=r[6],h=r[10];switch(e){case tl.XYZ:this.y=Math.asin(eq(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(l,s),this.z=0);break;case tl.YXZ:this.x=Math.asin(-eq(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,i),this.z=0);break;case tl.ZXY:this.x=Math.asin(eq(l,-1,1)),.9999999>Math.abs(l)?(this.y=Math.atan2(-c,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case tl.ZYX:this.y=Math.asin(-eq(c,-1,1)),.9999999>Math.abs(c)?(this.x=Math.atan2(l,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case tl.YZX:this.z=Math.asin(eq(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,i)):(this.x=0,this.y=Math.atan2(o,h));break;case tl.XZY:this.z=Math.asin(-eq(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(l,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-u,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=eW,this.y*=eW,this.z*=eW,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},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,r){var i,n,o,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(o=t[e+2])?o:0,this.order=null!=(a=t[e+3])?a:r,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 eJ;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},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,r=this.y,i=this.z,n=this.order,o=Math.cos(e*ej*.5),a=Math.cos(r*ej*.5),s=Math.cos(i*ej*.5),u=Math.sin(e*ej*.5),c=Math.sin(r*ej*.5),l=Math.sin(i*ej*.5);switch(n){case tl.XYZ:t.set(u*a*s+o*c*l,o*c*s-u*a*l,o*a*l+u*c*s,o*a*s-u*c*l);break;case tl.YXZ:t.set(u*a*s+o*c*l,o*c*s-u*a*l,o*a*l-u*c*s,o*a*s+u*c*l);break;case tl.ZXY:t.set(u*a*s-o*c*l,o*c*s+u*a*l,o*a*l+u*c*s,o*a*s-u*c*l);break;case tl.ZYX:t.set(u*a*s-o*c*l,o*c*s+u*a*l,o*a*l-u*c*s,o*a*s+u*c*l);break;case tl.YZX:t.set(u*a*s+o*c*l,o*c*s+u*a*l,o*a*l-u*c*s,o*a*s-u*c*l);break;case tl.XZY:t.set(u*a*s-o*c*l,o*c*s-u*a*l,o*a*l+u*c*s,o*a*s+u*c*l);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,r=this.x,i=this.y,n=this.z,o=this.order,a=Math.cos(r*ej),s=Math.sin(r*ej),u=Math.cos(i*ej),c=Math.sin(i*ej),l=Math.cos(n*ej),h=Math.sin(n*ej);if(o===tl.XYZ){var f=a*l,m=a*h,d=s*l,p=s*h;e[0]=u*l,e[4]=-u*h,e[8]=c,e[1]=m+d*c,e[5]=f-p*c,e[9]=-s*u,e[2]=p-f*c,e[6]=d+m*c,e[10]=a*u}else if(o===tl.YXZ){var v=u*l,y=u*h,g=c*l,x=c*h;e[0]=v+x*s,e[4]=g*s-y,e[8]=a*c,e[1]=a*h,e[5]=a*l,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=a*u}else if(o===tl.ZXY){var T=u*l,E=u*h,b=c*l,_=c*h;e[0]=T-_*s,e[4]=-a*h,e[8]=b+E*s,e[1]=E+b*s,e[5]=a*l,e[9]=_-T*s,e[2]=-a*c,e[6]=s,e[10]=a*u}else if(o===tl.ZYX){var C=a*l,S=a*h,A=s*l,R=s*h;e[0]=u*l,e[4]=A*c-S,e[8]=C*c+R,e[1]=u*h,e[5]=R*c+C,e[9]=S*c-A,e[2]=-c,e[6]=s*u,e[10]=a*u}else if(o===tl.YZX){var w=a*u,O=a*c,M=s*u,I=s*c;e[0]=u*l,e[4]=I-w*h,e[8]=M*h+O,e[1]=h,e[5]=a*l,e[9]=-s*l,e[2]=-c*l,e[6]=O*h+M,e[10]=w-I*h}else if(o===tl.XZY){var L=a*u,P=a*c,V=s*u,F=s*c;e[0]=u*l,e[4]=-h,e[8]=c*l,e[1]=L*h+F,e[5]=a*l,e[9]=P*h-V,e[2]=V*h-P,e[6]=s*l,e[10]=F*h+L}else console.error("toMatrix4: Invalid order "+o);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,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromArray(e,r,i)},t}();e0.DEFAULT_ORDER=tl.ZYX,e0.tempQuat0=new eJ,e0.tempMat0=new e$,(o=th||(th={})).S="S",o.APlus="A+",o.A="A",o.BPlus="B+",o.B="B",(a=tf||(tf={}))[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",(s=tm||(tm={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=td||(td={}))[u.NONE=0]="NONE",u[u.MASK=1]="MASK",u[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(c=tp||(tp={}))[c.NONE=0]="NONE",c[c.SPHERE=1]="SPHERE",c[c.CONE=2]="CONE",c[c.HEMISPHERE=3]="HEMISPHERE",c[c.CIRCLE=4]="CIRCLE",c[c.DONUT=5]="DONUT",c[c.RECTANGLE=6]="RECTANGLE",c[c.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",c[c.EDGE=8]="EDGE",c[c.TEXTURE=9]="TEXTURE",(l=tv||(tv={}))[l.GYROSCOPE=0]="GYROSCOPE",l[l.SPINE=1]="SPINE",(h=ty||(ty={}))[h.CLICK=0]="CLICK",h[h.MESSAGE=1]="MESSAGE",h[h.DRAG=2]="DRAG",(f=tg||(tg={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(m=tx||(tx={})).base="0",m.sprite="1",m.particle="2",m.null="3",m.interact="4",m.plugin="5",m.camera="6",m.composition="7",m.spine="spine",m.mesh="mesh",m.tree="tree",m.text="text",m.light="light",m.skybox="skybox",m.effect="effect",m.node="node",(d=tT||(tT={}))[d.BILLBOARD=0]="BILLBOARD",d[d.MESH=1]="MESH",d[d.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",d[d.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(p=tE||(tE={}))[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",(v=tb||(tb={})).Opaque="Opaque",v.Transparent="Transparent",(y=t_||(t_={})).Both="Both",y.Back="Back",y.Front="Front",(g=tC||(tC={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tS||(tS={}))[x.destroy=0]="destroy",x[x.pause=1]="pause",x[x.restart=5]="restart",x[x.forward=2]="forward",x[x.pause_destroy=3]="pause_destroy",x[x.freeze=4]="freeze",(T=tA||(tA={})).video="video",T.image="image",(E=tR||(tR={}))[E.CONSTANT=0]="CONSTANT",E[E.CONSTANT_VEC2=1]="CONSTANT_VEC2",E[E.CONSTANT_VEC3=2]="CONSTANT_VEC3",E[E.CONSTANT_VEC4=3]="CONSTANT_VEC4",E[E.RANDOM=4]="RANDOM",E[E.LINE=5]="LINE",E[E.CURVE=6]="CURVE",E[E.BEZIER_PATH=7]="BEZIER_PATH",E[E.RGBA_COLOR=8]="RGBA_COLOR",E[E.GRADIENT_COLOR=9]="GRADIENT_COLOR",E[E.SHAPE_POINTS=10]="SHAPE_POINTS",E[E.SHAPE_SPLITS=11]="SHAPE_SPLITS",E[E.LINEAR_PATH=12]="LINEAR_PATH",E[E.COLORS=13]="COLORS",E[E.BINARY=20]="BINARY",E[E.BEZIER_CURVE=21]="BEZIER_CURVE",E[E.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",E[E.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",(b=tw||(tw={}))[b.AUTO=0]="AUTO",b[b.EASE=1]="EASE",b[b.EASE_IN=2]="EASE_IN",b[b.EASE_OUT=3]="EASE_OUT",b[b.LINE=4]="LINE",b[b.HOLD=5]="HOLD",b[b.LINE_OUT=6]="LINE_OUT",(_=tO||(tO={}))[_.destroy=0]="destroy",_[_.loop=5]="loop",_[_.freeze=4]="freeze",(C=tM||(tM={}))[C.destroyChildren=6]="destroyChildren",(S=tI||(tI={}))[S.none=0]="none",S[S.removeParticle=1]="removeParticle",(A=tL||(tL={}))[A.RANDOM=0]="RANDOM",A[A.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",A[A.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",A[A.UNIFORM_BURST=3]="UNIFORM_BURST",(R=tP||(tP={})).point="point",R.spot="spot",R.directional="directional",R.ambient="ambient",(w=tV||(tV={}))[w.box=2]="box",w[w.sphere=3]="sphere",(O=tF||(tF={})).orthographic="orthographic",O.perspective="perspective",(M=tz||(tz={})).unlit="unlit",M.pbr="pbr",M.hair="hair",(I=tN||(tN={}))[I.opaque=100]="opaque",I[I.masked=101]="masked",I[I.translucent=102]="translucent",I[I.additive=103]="additive",(L=tD||(tD={})).none="none",L.uv="uv",L.normal="normal",L.basecolor="basecolor",L.alpha="alpha",L.metallic="metallic",L.roughness="roughness",L.ao="ao",L.emissive="emissive",(P=tk||(tk={}))[P.display=0]="display",P[P.clip=1]="clip",P[P.ellipsis=2]="ellipsis",(V=tU||(tU={}))[V.top=0]="top",V[V.middle=1]="middle",V[V.bottom=2]="bottom",(F=tB||(tB={}))[F.left=0]="left",F[F.middle=1]="middle",F[F.right=2]="right",(z=tG||(tG={})).normal="normal",z.bold="bold",z.lighter="lighter",(N=tX||(tX={})).normal="normal",N.italic="italic",N.oblique="oblique",(D=tH||(tH={})).VFXItemData="VFXItemData",D.EffectComponent="EffectComponent",D.Material="Material",D.Shader="Shader",D.SpriteComponent="SpriteComponent",D.ParticleSystem="ParticleSystem",D.InteractComponent="InteractComponent",D.CameraController="CameraController",D.Geometry="Geometry",D.Texture="Texture",D.AnimationClip="AnimationClip",D.TextComponent="TextComponent",D.BinaryAsset="BinaryAsset",D.TrackAsset="TrackAsset",D.TimelineAsset="TimelineAsset",D.ObjectBindingTrack="ObjectBindingTrack",D.TransformTrack="TransformTrack",D.SpriteColorTrack="SpriteColorTrack",D.ActivationTrack="ActivationTrack",D.SubCompositionTrack="SubCompositionTrack",D.TransformPlayableAsset="TransformPlayableAsset",D.SpriteColorPlayableAsset="SpriteColorPlayableAsset",D.ActivationPlayableAsset="ActivationPlayableAsset",D.SubCompositionPlayableAsset="SubCompositionPlayableAsset",D.MeshComponent="MeshComponent",D.SkyboxComponent="SkyboxComponent",D.LightComponent="LightComponent",D.CameraComponent="CameraComponent",D.ModelPluginComponent="ModelPluginComponent",D.TreeComponent="TreeComponent",D.AnimationComponent="AnimationComponent",D.SpineComponent="SpineComponent",D.TimelineClip="TimelineClip",(k=tj||(tj={}))[k.POINTS=0]="POINTS",k[k.LINES=1]="LINES",k[k.LINE_LOOP=2]="LINE_LOOP",k[k.LINE_STRIP=3]="LINE_STRIP",k[k.TRIANGLES=4]="TRIANGLES",k[k.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",k[k.TRIANGLE_FAN=6]="TRIANGLE_FAN",(U=tW||(tW={}))[U.Float16=0]="Float16",U[U.Float32=1]="Float32",U[U.Int8=2]="Int8",U[U.Int16=3]="Int16",U[U.Int32=4]="Int32",U[U.UInt8=5]="UInt8",U[U.UInt16=6]="UInt16",U[U.UInt32=7]="UInt32",(B=tY||(tY={}))[B.None=-1]="None",B[B.UInt8=0]="UInt8",B[B.UInt16=1]="UInt16",B[B.UInt32=2]="UInt32",(G=tZ||(tZ={})).Position="POSITION",G.Uv="TEXCOORD0",G.Uv2="TEXCOORD1",G.Normal="NORMAL",G.Tangent="TANGENT",G.Color="COLOR",G.Joints="JOINTS",G.Weights="WEIGHTS",G.PositionBS0="POSITION_BS0",G.PositionBS1="POSITION_BS1",G.PositionBS2="POSITION_BS2",G.PositionBS3="POSITION_BS3",G.PositionBS4="POSITION_BS4",G.PositionBS5="POSITION_BS5",G.PositionBS6="POSITION_BS6",G.PositionBS7="POSITION_BS7",G.NormalBS0="NORMAL_BS0",G.NormalBS1="NORMAL_BS1",G.NormalBS2="NORMAL_BS2",G.NormalBS3="NORMAL_BS3",G.TangentBS0="TANGENT_BS0",G.TangentBS1="TANGENT_BS1",G.TangentBS2="TANGENT_BS2",G.TangentBS3="TANGENT_BS3";var e1=Object.freeze({__proto__:null,get RenderLevel(){return th},get BlendingMode(){return tf},get SideMode(){return tm},get MaskMode(){return td},get ShapeType(){return tp},get PluginType(){return tv},get InteractType(){return ty},get InteractBehavior(){return tg},get ItemType(){return tx},get RenderMode(){return tT},get ParticleOrigin(){return tE},get RenderType(){return tb},get RenderFace(){return t_},get CameraClipMode(){return tC},get CompositionEndBehavior(){return tS},get BackgroundType(){return tA},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 tR},get BezierKeyframeType(){return tw},get ItemEndBehavior(){return tO},get ParentItemEndBehavior(){return tM},get ParticleInteractionBehavior(){return tI},get ShapeArcMode(){return tL},get LightType(){return tP},get ModelBoundingType(){return tV},get CameraType(){return tF},get MaterialType(){return tz},get MaterialBlending(){return tN},get RenderMode3D(){return tD},get TextOverflow(){return tk},get TextBaseline(){return tU},get TextAlignment(){return tB},get TextWeight(){return tG},get FontStyle(){return tX},get DataType(){return tH},get GeometryType(){return tj},get VertexFormatType(){return tW},get IndexFormatType(){return tY},get VertexBufferSemantic(){return tZ},BuiltinObjectGUID:{WhiteTexture:"whitetexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"}}),e2={},e3={},e4={};function e5(t){return function(e,r){e4[t]&&console.warn("Class "+t+" is already registered."),e4[t]=e}}function e6(t){var e=t.constructor.name;if(e3[e])return e3[e];e3[e]={};for(var r=e3[e],i=t,n=e;n;){var o=e2[n];for(var a in o)r[a]=o[a];var s=Object.getPrototypeOf(i);if("Object"===(n=Object.getPrototypeOf(s).constructor.name))break;i=s}return r}function e8(t,e){return function(r,i){var n,o=(e2[n=r.constructor.name]||(e2[n]={}),e2[n]);o[i]||(o[i]={type:t,sourceName:e})}}var e9=function(){function t(t){this.engine=t,this.guid=ez(),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 er(e,t)&&"guid"in e},t}();en([e8(void 0,void 0)],e9.prototype,"guid",void 0);var e7=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onAttached=function(){},r.onDestroy=function(){},r.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},r.dispose=function(){this.onDestroy(),this.item&&eh(this.item.components,this)},eU(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(e9),rt=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e._enabled=!0,e}eG(e,t);var r=e.prototype;return r.onBehaviourEnable=function(){},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},eU(e,[{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onBehaviourEnable()}}]),e}(e7);en([e8(void 0,void 0)],rt.prototype,"_enabled",void 0);var re=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e}eG(e,t);var r=e.prototype;return r.onEnable=function(){},r.start=function(){},r.update=function(t){},r.lateUpdate=function(t){},r.onAttached=function(){this.item.itemBehaviours.push(this)},r.dispose=function(){this.item&&eh(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},r.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(rt),rr=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e.materials=[],e._priority=0,e._enabled=!0,e}eG(e,t);var r=e.prototype;return r.onEnable=function(){},r.start=function(){},r.update=function(t){},r.lateUpdate=function(t){},r.render=function(t){},r.onAttached=function(){this.item.rendererComponents.push(this)},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},r.dispose=function(){this.item&&eh(this.item.rendererComponents,this),t.prototype.dispose.call(this)},eU(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(e7);en([e8(void 0,void 0)],rr.prototype,"materials",void 0),en([e8(void 0,void 0)],rr.prototype,"_priority",void 0),en([e8(void 0,void 0)],rr.prototype,"_enabled",void 0);var ri=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}();t.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}eG(e,t);var r=e.prototype;return r.update=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.position,t.rotation=this.transform.rotation}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(re),t.CameraController=en([e5(tH.CameraController)],t.CameraController);var rn=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ri);t.HitTestType=void 0,(X=t.HitTestType||(t.HitTestType={}))[X.triangle=1]="triangle",X[X.box=2]="box",X[X.sphere=3]="sphere",X[X.custom=4]="custom";var ro="click",ra="touchstart",rs="touchmove",ru="touchend",rc=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,r,i,n,o,a=this;n=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",l=function(t,e,r,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var s=0,u=0,c=performance.now();if(!a.target)return eR.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:r,vx:0,vy:u,dx:n,dy:o,ts:c,width:0,height:0,origin:t};var l=a.target,h=l.width,f=l.height;if(i){var m=c-i.ts;s=(n-i.dx)/m||0,u=(o-i.dy)/m||0,i={dx:n,dy:o,ts:c}}return{x:e,y:r,vx:s,vy:u,dx:n,dy:o,ts:c,width:h,height:f,origin:t}};ex()&&(n=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((o={})[s]=function(o){if(a.enabled){var s=n(o),u=rl(s);t=u.x,e=u.y,i=r={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(ra,l(o,t,e))}},o[u]=function(i){if(r&&a.enabled){var o=rl(n(i));t=o.x,e=o.y,a.dispatchEvent(rs,l(i,t,e,t-r.x,e-r.y))}},o[c]=function(i){if(r&&a.enabled){!a.allowPropagation&&i.cancelable&&(i.preventDefault(),i.stopPropagation());var o=n(i),s=rl(o),u=Math.abs(r.clientX-o.clientX)+Math.abs(r.clientY-o.clientY);t=s.x,e=s.y,u<4&&a.dispatchEvent(ro,l(i,t,e)),a.dispatchEvent(ru,l(i,t,e,t-r.x,e-r.y))}r=0},o),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),el(r,e),function(){eh(r,e)}},e.removeEventListener=function(t,e){var r=this.handlers[t];r&&eh(r,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function rl(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}var rh=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ri),rf=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 r,i,n,o;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(o=t[e+3])?o: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):er(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):er(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):er(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):er(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,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,r=this.z,i=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(r)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new eK(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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();rf.ONE=new rf(1,1,1,1),rf.ZERO=new rf(0,0,0,0);var rm=function(){function t(t,e,r,i,n,o,a,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,o,a,s,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=i,c[6]=a,c[1]=e,c[4]=n,c[7]=s,c[2]=r,c[5]=o,c[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.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 r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,o=e+e,a=r+r,s=i+i,u=e*o,c=e*a,l=e*s,h=r*a,f=r*s,m=i*s,d=n*o,p=n*a,v=n*s,y=this.elements;return y[0]=1-(h+m),y[1]=c+v,y[2]=l-p,y[3]=c-v,y[4]=1-(u+m),y[5]=f+d,y[6]=l+p,y[7]=f-d,y[8]=1-(u+h),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 r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],o=i[3],a=i[6],s=i[1],u=i[4],c=i[7];return i[0]=e*n+r*s,i[3]=e*o+r*u,i[6]=e*a+r*c,i[1]=-r*n+e*s,i[4]=-r*o+e*u,i[7]=-r*a+e*c,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[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 r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[3],s=r[6],u=r[1],c=r[4],l=r[7],h=r[2],f=r[5],m=r[8],d=i[0],p=i[3],v=i[6],y=i[1],g=i[4],x=i[7],T=i[2],E=i[5],b=i[8];return n[0]=o*d+a*y+s*T,n[3]=o*p+a*g+s*E,n[6]=o*v+a*x+s*b,n[1]=u*d+c*y+l*T,n[4]=u*p+c*g+l*E,n[7]=u*v+c*x+l*b,n[2]=h*d+f*y+m*T,n[5]=h*p+f*g+m*E,n[8]=h*v+f*x+m*b,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8];return e*(o*c-u*a)+n*(u*i-r*c)+s*(r*a-o*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8],l=c*o-u*a,h=u*i-c*r,f=a*r-o*i,m=e*l+n*h+s*f;if(0===m)return this.set(0,0,0,0,0,0,0,0,0);var d=1/m;return t[0]=l*d,t[1]=(s*a-c*n)*d,t[2]=(u*n-s*o)*d,t[3]=h*d,t[4]=(c*e-s*i)*d,t[5]=(s*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(o*e-n*r)*d,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 r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[3]*i+o[6]*n,a.y=o[1]*r+o[4]*i+o[7]*n,a.z=o[2]*r+o[5]*i+o[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!eY(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return new t().setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,c){return new t(e,n,s,r,o,u,i,a,c)},t}(),rd=function(){function t(t,e){void 0===t&&(t=eK.ZERO),void 0===e&&(e=eK.X),this.origin=new eK,this.direction=new eK,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 r=e||new eK;return r.copyFrom(this.origin),r.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 r,i,n,o,a,s,u=this.origin,c=u.x,l=u.y,h=u.z,f=this.direction,m=f.x,d=f.y,p=f.z,v=t.min,y=v.x,g=v.y,x=v.z,T=t.max,E=T.x,b=T.y,_=T.z,C=1/m,S=1/d,A=1/p;if(C>=0?(r=(y-c)*C,i=(E-c)*C):(r=(E-c)*C,i=(y-c)*C),S>=0?(n=(g-l)*S,o=(b-l)*S):(n=(b-l)*S,o=(g-l)*S),!(r>o)&&!(n>i)&&((n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),(n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),A>=0?(a=(x-h)*A,s=(_-h)*A):(a=(_-h)*A,s=(x-h)*A),!(r>s)&&!(a>i))&&((a>r||r!=r)&&(r=a),(s<i||i!=i)&&(i=s),!(i<0)))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new eK).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var u=Math.sqrt(s-a),c=o-u,l=o+u;if(!(l<0))return c>=0?this.at(c,r):this.at(l,r)}},e.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),c=t.tempVec1.subtractVectors(s,o),l=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(u,c),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(l,c);var m=n*this.direction.dot(c);if(!(m<0)){u.cross(l);var d=n*this.direction.dot(u);if(!(d<0)&&!(m+d>f)){var p=-n*l.dot(h);if(!(p<0))return this.at(p/f,r)}}},t}();rd.tempVec0=new eK,rd.tempVec1=new eK,rd.tempVec2=new eK,rd.tempVec3=new eK;var rp=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,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 r,i,n,o;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(o=t[e+3])?o:0,this},e.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,c=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,c=a):o>=3&&o<=4?(u=a,c=n):o>=4&&o<=5?(s=a,c=n):o>=5&&o<=6&&(s=n,c=a);var l=r-n;return this.set(s+l,u+l,c+l,i)},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,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,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):er(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):er(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):er(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):er(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 rf(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,r=this.g,i=this.b,n=this.a,o=Math.max(e,r,i),a=Math.min(e,r,i),s=o-a,u=0,c=0;return 0!==o&&(c=s/o),o!=a&&(o==e?(u=(r-i)/s,r<i&&(u+=6)):o==r?u=(i-e)/s+2:o==i&&(u=(e-r)/s+4),u*=60),new t(u,c,o,n)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),o=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+o:"#"+r+i+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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),new t().setFromHSV(e,r,i,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 rv=function(){function t(t,e){void 0===t&&(t=new eK(1/0,1/0,1/0)),void 0===e&&(e=new eK(-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),r=Number(1/0),i=Number(1/0),n=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],l=t[s+1],h=t[s+2];c<e&&(e=c),l<r&&(r=l),h<i&&(i=h),c>n&&(n=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,r,i),this.max.set(n,o,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),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 eK),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 eK),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 r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);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 eK),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 eK;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 eK),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 eK),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new eK),this.isEmpty())return[];var r=[];return r[0]=new eK(this.min.x,this.min.y,this.min.z),r[1]=new eK(this.min.x,this.min.y,this.max.z),r[2]=new eK(this.min.x,this.max.y,this.min.z),r[3]=new eK(this.min.x,this.max.y,this.max.z),r[4]=new eK(this.max.x,this.min.y,this.min.z),r[5]=new eK(this.max.x,this.min.y,this.max.z),r[6]=new eK(this.max.x,this.max.y,this.min.z),r[7]=new eK(this.max.x,this.max.y,this.max.z),r.forEach(function(r){r.subtract(e),r.applyMatrix(t),r.add(e)}),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new eK;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}(),ry=function(){function t(t,e){void 0===t&&(t=eK.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 r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var o=new rv().setFromPoints(t);o.getCenter(r),this.radius=o.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 r=this.center.distanceSquared(t);return void 0===e&&(e=new eK),e.copyFrom(t),r>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 rv),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=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(r,i,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new eK().subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=(i-this.radius)*.5;this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new eK,r=new eK;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=new eK().subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),rg=Object.freeze({__proto__:null,get EulerOrder(){return tl},Euler:e0,Quaternion:eJ,Vector2:eQ,Vector3:eK,Vector4:rf,Matrix3:rm,Matrix4:e$,Ray:rd,PI2:2*Math.PI,DEG2RAD:ej,RAD2DEG:eW,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:eY,damp:function(t,e,r,i){return eZ(t,e,1-Math.exp(-r*i))},lerp:eZ,degToRad:function(t){return t*ej},radToDeg:function(t){return t*eW},clamp:eq,Color:rp,Box3:rv,Sphere:ry}),rx="editor",rT={"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"},rE=[],rb={};function r_(){"function"==typeof WebGL2RenderingContext?rC(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(rC(WebGLRenderingContext),rC(WebGLRenderingContext.prototype)):rE.push("iOS16 lockdown mode, WebGL Constants not in global"),rE.length||"HALF_FLOAT"in rb||(rb.HALF_FLOAT=5131)}function rC(t){for(var e in t)/^[A-Z_]/.test(e)&&(rb[e]=t[e])}function rS(t){switch(t){case tf.ALPHA:case tf.ADD:case tf.SUBTRACTION:case tf.STRONG_LIGHT:case tf.WEAK_LIGHT:return 1;case tf.SUPERPOSITION:return 2;case tf.BRIGHTNESS:return 3;case tf.MULTIPLY:return 0;default:return 1}}rE.length||r_(),t.ShaderType=void 0,(H=t.ShaderType||(t.ShaderType={}))[H.vertex=0]="vertex",H[H.fragment=1]="fragment";var rA=((tq={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},tq[t.ShaderType.fragment]={in:"varying"},tq);function rR(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach(function(t){var e=t[0],r=t[1];!0===r?n.push("#define "+e):Number.isFinite(r)&&n.push("#define "+e+" "+r)}),o=n.length?n.join("\n")+"\n":"");var a="WEBGL"+i,s=(o=o+("\n#ifndef "+a)+"\n#define "+a+"\n#endif")+"\n"+e,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=u?u[0]:"";if(c&&c.includes("300")){var l=RegExp(""+c,"g");1===i&&(s=s.replace(/\b(in|out)\b/g,function(t){var e;return null!=(e=rA[r][t])?e:t})),s=s.replace(l,"\n")}return s}function rw(t,e){switch(e){case void 0:case tf.ALPHA:t.blendFunction=[rb.ONE,rb.ONE_MINUS_SRC_ALPHA,rb.ONE,rb.ONE_MINUS_SRC_ALPHA];break;case tf.ADD:t.blendFunction=[rb.ONE,rb.ONE,rb.ONE,rb.ONE];break;case tf.SUBTRACTION:t.blendFunction=[rb.ONE,rb.ONE,rb.ZERO,rb.ONE],t.blendEquation=[rb.FUNC_REVERSE_SUBTRACT,rb.FUNC_REVERSE_SUBTRACT];break;case tf.SUPERPOSITION:t.blendFunction=[rb.ONE,rb.ONE,rb.ONE,rb.ONE];break;case tf.MULTIPLY:t.blendFunction=[rb.DST_COLOR,rb.ONE_MINUS_SRC_ALPHA,rb.DST_COLOR,rb.ONE_MINUS_SRC_ALPHA];break;case tf.BRIGHTNESS:t.blendFunction=[rb.ONE,rb.ONE_MINUS_SRC_ALPHA,rb.ONE,rb.ONE_MINUS_SRC_ALPHA];break;case tf.STRONG_LIGHT:t.blendFunction=[rb.DST_COLOR,rb.DST_ALPHA,rb.ZERO,rb.ONE];break;case tf.WEAK_LIGHT:t.blendFunction=[rb.DST_COLOR,rb.ZERO,rb.ZERO,rb.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function rO(t,e){e===tm.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rb.CW,t.cullFace=e===tm.BACK?rb.BACK:rb.FRONT)}function rM(t,e){switch(e){case void 0:t.stencilTest=!1;break;case td.MASK:t.stencilTest=!0,t.stencilFunc=[rb.ALWAYS,rb.ALWAYS],t.stencilOpZPass=[rb.REPLACE,rb.REPLACE];break;case td.OBSCURED:t.stencilTest=!0,t.stencilFunc=[rb.EQUAL,rb.EQUAL];break;case td.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[rb.NOTEQUAL,rb.NOTEQUAL];break;case td.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function rI(){return(rI=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}t.TextureLoadAction=void 0,(j=t.TextureLoadAction||(t.TextureLoadAction={}))[j.whatever=0]="whatever",j[j.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 rL=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},e.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},e.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},e.download=function(t,e,r,i){var n=this;if(void 0===e&&(e="json"),!this.start(t,r,i)){var o=new XMLHttpRequest,a=function(){n.finish(t,o.status,o.response)};o.responseType=e,o.addEventListener("load",function(){200==o.status||0==o.status?n.finish(t,200,o.response):a()}),o.addEventListener("error",a),o.open("GET",t,!0),o.send()}},e.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},e.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[r]:[e,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},t}(),rP=!1;function rV(t,e){return rF.apply(this,arguments)}function rF(){return(rF=ee(function(t,e){return eo(this,function(r){switch(r.label){case 0:if(!(rP||!e))return[3,2];return[4,rz(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,rz(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),rP=!0,[4,rz(t)];case 6:return[2]}})})).apply(this,arguments)}function rz(t){return rN.apply(this,arguments)}function rN(){return(rN=ee(function(t){var e,r;return eo(this,function(i){if(e="",er(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else er(t,Blob)?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,i){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,r&&URL.revokeObjectURL(e),i("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function rD(t){return rk.apply(this,arguments)}function rk(){return(rk=ee(function(t){return eo(this,function(e){return[2,new Promise(function(e,r){new rL().downloadBinary(t,e,function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)})})]})})).apply(this,arguments)}function rU(){return(rU=ee(function(t){return eo(this,function(e){return[2,new Promise(function(e,r){new rL().downloadBlob(t,e,function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)})})]})})).apply(this,arguments)}function rB(t){return rG.apply(this,arguments)}function rG(){return(rG=ee(function(t){var e;return eo(this,function(r){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eg()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,r){var i=e.play();i?i.then(function(){return t(e)}):e.addEventListener("loadeddata",function r(){t(e),e.removeEventListener("loadeddata",r)},!0),e.addEventListener("error",function(t){r(t)})})]})})).apply(this,arguments)}function rX(t,e){return rH.apply(this,arguments)}function rH(){return(rH=ee(function(t,e){return eo(this,function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function rj(t,e,r){return rW.apply(this,arguments)}function rW(){return(rW=ee(function(e,r,i,n){var o,a,s,u,c,l,h,f,m,d,p,v,y,g,x;return eo(this,function(T){switch(T.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,1];for(o=e.mipmaps,a=e.target,s=[],u=eH(o);!(c=u()).done;){for(l=c.value,h=[],f=eH(l);!(m=f()).done;)d=m.value,p=i.assetLoader.loadGUID(d.id),h.push(p.data);s.push(h)}return[2,rI({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:a,type:t.TextureSourceType.mipmaps}})];case 1:return v=e.mipmaps,y=e.target,[4,Promise.all(v.map(function(t){return function(t,e){return rY.apply(this,arguments)}(t,r)}))];case 2:return g=T.sent(),x=n[v[0][1][0]].url,[2,rI({keepImageSource:!1},e,{mipmaps:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:y,bin:x,type:t.TextureSourceType.mipmaps,mipmaps:v.map(function(t){return[t[1][1],t[1][2]]})}})];case 3:return[2]}})})).apply(this,arguments)}function rY(){return(rY=ee(function(t,e){var r,i,n,o,a;return eo(this,function(s){if(i=(r=t[1])[0],n=r[1],o=r[2],!(a=e[i]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,rz(new Blob([new Uint8Array(a,n,o)]))]})})).apply(this,arguments)}var rZ=1,rq=function(e){function r(t){var r;return(r=e.call(this,t)||this).destroyed=!1,r.id="Tex"+rZ++,r}eG(r,e);var i=r.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(e){var r=e.target,i=void 0===r?rb.TEXTURE_2D:r,n=e.format,o=void 0===n?rb.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),rI({minFilter:rb.NEAREST,magFilter:rb.NEAREST,wrapS:rb.CLAMP_TO_EDGE,wrapT:rb.CLAMP_TO_EDGE,target:i,format:rb.RGBA,internalFormat:o,type:rb.UNSIGNED_BYTE},e)},r.fromImage=function(e,i){return ee(function(){var n,o;return eo(this,function(a){switch(a.label){case 0:return[4,rz(e)];case 1:return n=a.sent(),(o=r.create(i,{sourceType:t.TextureSourceType.image,image:n,id:ez()})).initialize(),[2,o]}})})()},eU(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(e9);function rQ(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?rb.RGBA:3===a?rb.RGB:2===a?rb.LUMINANCE_ALPHA:rb.LUMINANCE,rq.createWithData(t,{data:e,width:r,height:i},{type:rb.HALF_FLOAT,format:n,internalFormat:o,wrapS:rb.CLAMP_TO_EDGE,wrapT:rb.CLAMP_TO_EDGE})}var rK={type:rb.UNSIGNED_BYTE,format:rb.RGBA,internalFormat:rb.RGBA,wrapS:rb.MIRRORED_REPEAT,wrapT:rb.MIRRORED_REPEAT,minFilter:rb.NEAREST,magFilter:rb.NEAREST};function rJ(e){return rq.create(e,rI({id:"whitetexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},rK))}function r$(e){return rq.create(e,rI({id:"transparenttexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},rK))}var r0=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);if(this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eR.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eR.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eR.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=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);e.push({data:c,width:i,height:n}),r+=s+4+(3-(s+3)%4)}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function r1(e){var r=new r0(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,c=r.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?rb.TEXTURE_CUBE_MAP:rb.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(i>=Math.floor(Math.log2(Math.max(n,o))+1))}}var r2=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return ee(function(){var r,i;return eo(this,function(n){switch(n.label){case 0:if(r=t.id,e.reloadPending[r])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e.target,n=e.map,o=e.url;return i===rb.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eO(o)&&o.length>0}if(r===t.TextureSourceType.mipmaps){var a=e.bin,s=e.mipmaps,u=e.target,c=e.maps,l=e.urls;return a?s.length>0:u===rb.TEXTURE_CUBE_MAP?c.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return eO(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var i=this;return ee(function(){var n,o,a,s,u,c,l,h,f,m,d,p,v,y,g,x,T,E;return eo(this,function(b){switch(b.label){case 0:if(n=e.type,o=e.target,a=e.map,s=e.url,u=e.bin,c=e.mipmaps,l=e.urls,h=e.maps,!(o===rb.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,i.loadCubeMap(a)];case 1:return f=b.sent(),[2,rI({},r,{cube:f,target:rb.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:rI({},a),target:rb.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,rz(s)];case 3:return m=b.sent(),[2,rI({},r,{image:m,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:rb.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,rB(s)];case 5:return d=b.sent(),[2,rI({},r,{video:d,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,rD(s)];case 7:return p=b.sent(),[2,rI({},r1(p),r,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,rD(u)];case 9:if(v=b.sent(),g=(y=null!=o?o:rb.TEXTURE_2D)===rb.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),o!==rb.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return i.loadMipmapImages(t,v)}))];case 10:return x=b.sent(),[3,12];case 11:x=i.loadMipmapImages(c,v),b.label=12;case 12:return[2,rI({},r,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(o===rb.TEXTURE_2D||!o))return[3,15];return[4,Promise.all(l.map(function(t){return rz(t)}))];case 14:return T=b.sent(),[2,rI({},r,{mipmaps:T,target:rb.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:l.slice(),target:rb.TEXTURE_2D}})];case 15:if(o!==rb.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(h.map(function(t){return i.loadCubeMap(t)}))];case 16:return E=b.sent(),[2,rI({},r,{mipmaps:E,target:rb.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:h.map(function(t){return rI({},t)}),target:rb.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},r.loadMipmapImages=function(t,e){return ee(function(){return eo(this,function(r){return[2,Promise.all(t.map(function(t){return rz(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return ee(function(){return eo(this,function(e){return[2,Promise.all(t.map(function(t){return rz(t)}))]})})()},e}(),r3=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(r){e.setUniformValue(r,t[r])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function r4(t){return"object"==typeof t&&t&&void 0===t.length&&er(t,rq)}t.MaterialRenderType=void 0,(Y=t.MaterialRenderType||(t.MaterialRenderType={}))[Y.normal=0]="normal",Y[Y.transformFeedback=1]="transformFeedback";var r5=1,r6=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).stringTags={},i.enabledMacros={},i.destroyed=!1,i.initialized=!1,r){var n=r.name,o=void 0===n?"Material"+r5++:n,a=r.renderType,s=r.shader,u=r.uniformSemantics;i.name=o,i.renderType=void 0===a?0:a,i.shaderSource=s,i.props=r,i.uniformSemantics=rI({},u)}else i.name="Material"+r5++,i.renderType=0;return i}eG(e,t);var r=e.prototype;return r.initialize=function(){},r.use=function(t,e){},eU(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}(e9),r8=(q=new Int32Array((Z=new Float32Array(1)).buffer),function(t){Z[0]=t;var e=q[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?(i|=2048,r|=(i>>114-n)+(i>>113-n&1)):(r|=n-112<<10|i>>1,r+=1&i)}),r9=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),r=0;r<e.length;r++)e[r]=r8(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=r8(t[r])},t}(),r7=new e0,it=new e$;function ie(t,e,r,i,n,o,a){var s=i/n,u=i,c=e.speedOverLifetime;c&&(u=c.getIntegrateValue(0,i,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;t.copyFrom(o),t.addScaledVector(a,u),t.addScaledVector(r,l);var h=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var m=new eK;f.center&&m.setFromArray(f.center);var d=t.clone().subtract(m),p=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?p?e.getValue(s):e.getIntegrateValue(0,i,n):0});r7.setFromArray(v).negate(),it.setFromEuler(r7);var y=it.transformPoint(d);t.addVectors(m,y)}if(h.enabled){var g=h.asMovement,x=h.x,T=h.y,E=h.z;if(x){var b=g?x.getValue(s):x.getIntegrateValue(0,i,n);t.x=t.x+b}if(T){var _=g?T.getValue(s):T.getIntegrateValue(0,i,n);t.y=t.y+_}if(E){var C=g?E.getValue(s):E.getIntegrateValue(0,i,n);t.z=t.z+C}}return t}function ir(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ii(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function io(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function ia(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var o=0;o<e.length;o++)t[o]=e[o]}else if(r&&t!==r)for(var a=0;a<r.length;a++)t[a]=r[a];return t}var is=((tK={})[tE.PARTICLE_ORIGIN_CENTER]=[0,0],tK[tE.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],tK[tE.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],tK[tE.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],tK[tE.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],tK[tE.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],tK[tE.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],tK[tE.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],tK[tE.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],tK);function iu(t,e,r){var i=r.position,n=new eK(t,e,0),o=new eK;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new rd(i,o)}function ic(t,e,r){var i=t.x,n=t.y,o=t.z,a=new eK(i-e,n+r,o),s=new eK(i-e,n-r,o),u=new eK(i+e,n-r,o),c=new eK(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}function il(t,e,r){return void 0===r&&(r=1e-6),Math.abs(t-e)<r}function ih(t,e){void 0===e&&(e=2);var r=Math.pow(10,e);return Math.floor(t*r)/r}function im(t,e,r){return(im=!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,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&eB(n,r.prototype),n}:Reflect.construct).apply(null,arguments)}var id={getPointInCurve:function(t){t[0];var e=t[1],r=this.getPointIndexInCurve(t),i=r.xIndex,n=r.yIndex;return new eQ(e[i],e[n])},getPointIndexInCurve:function(t){var e=t[0],r=t[2],i=e===tw.LINE?0:e===tw.EASE_OUT?0:e===tw.EASE_IN?2:e===tw.EASE?2:e===tw.HOLD&&r===tw.EASE_IN?2:0;return{xIndex:i,yIndex:i+1}},isLeftSideEase:function(t){var e=t[0];t[1];var r=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeLeftSideEase(r))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var r=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeRightSideEase(r))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tw.EASE,tw.EASE_IN,tw.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tw.EASE,tw.EASE_OUT,tw.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE_OUT,tw.EASE_OUT].includes(r)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE,tw.EASE_IN].includes(r)}},ip=function(t,e){this.points=t,this.totalLength=e},iv={},iy={};function ig(t,e,r){return(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t}function ix(t,e,r){return 3*(1-3*r+3*e)*t*t+2*(3*r-6*e)*t+3*e}var iT=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,r,i){var n=ih(e.x-t.x,3)+"_"+ih(e.y-t.y,3)+"_"+ih(e.z-t.z,3)+"&"+(ih(r.x-t.x,3)+"_"+ih(r.y-t.y,3))+"_"+ih(r.z-t.z,3)+"&"+(ih(i.x-t.x,3)+"_"+ih(i.y-t.y,3))+"_"+ih(i.z-t.z,3);if(iy[n])return{data:iy[n],interval:t};for(var o=[],a=null,s=0,u=0,c=0;c<300;c+=1){var l=new eK,h=c/299;u=0,l.x=3*Math.pow(1-h,2)*h*(r.x-t.x)+3*(1-h)*Math.pow(h,2)*(i.x-t.x)+Math.pow(h,3)*(e.x-t.x),l.y=3*Math.pow(1-h,2)*h*(r.y-t.y)+3*(1-h)*Math.pow(h,2)*(i.y-t.y)+Math.pow(h,3)*(e.y-t.y),l.z=3*Math.pow(1-h,2)*h*(r.z-t.z)+3*(1-h)*Math.pow(h,2)*(i.z-t.z)+Math.pow(h,3)*(e.z-t.z),null!==a&&(u+=Math.pow(l.x-a.x,2)+Math.pow(l.y-a.y,2)+Math.pow(l.z-a.z,2)),a=l,s+=u=Math.sqrt(u),o[c]={partialLength:u,point:l}}var f=new ip(o,s);return iy[n]=f,{data:f,interval:new eK(t.x,t.y,t.z)}}(t,e,r,i),o=n.data,a=n.interval;this.lengthData=o,this.interval=a,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(il(1-t,0))return e.points[299].point.clone().add(this.interval);if(il(e.totalLength,0))return this.p1.clone();var r=new eK,i=ih(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(il(n,i))return e.points[o].point.clone().add(this.interval);var a=!0,s=1;for(i<n&&(s=-1);a;){if(i>=n){if(299===o){r.x=e.points[o].point.x,r.y=e.points[o].point.y,r.z=e.points[o].point.z;break}if(i<n+e.points[o+1].partialLength){var u=(i-n)/e.points[o+1].partialLength;r.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,r.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,r.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}s>0&&o<299?(o+=s,n+=ih(e.points[o].partialLength,5)):s<0&&o>0?(n-=ih(e.points[o].partialLength,5),o+=s):a=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,r.add(this.interval),r},t}(),iE=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.temp=new eJ,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):il(1-t,0)?this.temp.copyFrom(this.p2):(iC.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),ib=function(){function t(t,e,r,i){this.mX1=t,this.mY1=e,this.mX2=r,this.mY2=i,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(),ig(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=ig(.1*t,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,r=0,i=1;10!==i&&e[i]<=t;++i)r+=.1;var n=r+(t-e[--i])/(e[i+1]-e[i])*.1,o=ix(n,this.mX1,this.mX2);return o>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var o=ix(e,r,i);if(0===o)break;var a=ig(e,r,i)-t;e-=a/o}return e}(t,n,this.mX1,this.mX2):0===o?n:function(t,e,r,i,n){var o,a,s=0;do(o=ig(a=e+(r-e)/2,i,n)-t)>0?r=a:e=a;while(Math.abs(o)>1e-7&&++s<10);return a}(t,r,r+.1,this.mX1,this.mX2)},t}();function i_(t,e){var r,i,n,o=function(t,e,r){var i=t[1],n=id.isHoldOutKeyframe(t),o=id.isHoldInKeyframe(e),a=!o&&id.isRightSideEase(t),s=!n&&id.isLeftSideEase(e);if(a&&!s&&!o){var u=new eQ(i[i.length-4],i[i.length-3]),c=new eQ(i[i.length-2],i[i.length-1]),l=id.getPointInCurve(e),h=new eQ(l.x,l.y),f=new eQ(h.x-(h.x-u.x)/10,h.y);return{type:"ease",p0:u,p1:c,p2:f,p3:h}}if(!a&&s&&!n){var m=e[1],d=id.getPointInCurve(t),p=new eQ(d.x,d.y),v=new eQ(m[0],m[1]),y=new eQ(m[2],m[3]),g=new eQ(p.x+(y.x-p.x)/10,p.y);return{type:"ease",p0:p,p1:g,p2:v,p3:y}}if(a&&s){var x=e[1];return{type:"ease",p0:new eQ(i[i.length-4],i[i.length-3]),p1:new eQ(i[i.length-2],i[i.length-1]),p2:new eQ(x[0],x[1]),p3:new eQ(x[2],x[3])}}var T=id.getPointInCurve(t),E=id.getPointInCurve(e);if(n?E.y=T.y:o&&(T.y=E.y),!r)return{type:"line",p0:T,p1:E,isHold:n||o,leftHoldLine:n,rightHoldLine:o};var b=new eQ((E.x-T.x)/3+T.x,(E.y-T.y)/3+T.y),_=new eQ((E.x-T.x)/3*2+T.x,(E.y-T.y)/3*2+T.y);return{type:"ease",p0:T,p1:b,p2:_,p3:E,isHold:n||o,leftHoldLine:n,rightHoldLine:o}}(t,e,!0),a=o.p0,s=o.p1,u=o.p2,c=o.p3;eC(u),eC(c);var l=c.x-a.x,h=c.y-a.y,f=ih((s.x-a.x)/l,5),m=ih((u.x-a.x)/l,5);il(h,0)?r=i=NaN:(r=ih((s.y-a.y)/h,5),i=ih((u.y-a.y)/h,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,s,u,c),f=0),m<0&&(console.error("Invalid bezier points, x2 < 0",a,s,u,c),m=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,s,u,c),f=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",a,s,u,c),m=1);var d=("bez_"+f+"_"+r+"_"+m+"_"+i).replace(/\./g,"p");return iv[d]?n=iv[d]:(n=new ib(f,r,m,i),iv[d]=n),{points:[a,s,u,c],timeInterval:l,valueInterval:h,curve:n}}var iC=function(){function t(){}return t.slerpFlat=function(t,e,r,i){var n=e.x,o=e.y,a=e.z,s=e.w,u=r.x,c=r.y,l=r.z,h=r.w;if(0===i){t.x=n,t.y=o,t.z=a,t.w=s;return}if(1===i){t.x=u,t.y=c,t.z=l,t.w=h;return}if(s!==h||n!==u||o!==c||a!==l){var f=1-i,m=n*u+o*c+a*l+s*h,d=m>=0?1:-1,p=1-m*m;if(p>Number.EPSILON){var v=Math.sqrt(p),y=Math.atan2(v,m*d);f=Math.sin(f*y)/v,i=Math.sin(i*y)/v}var g=i*d;if(n=n*f+u*g,o=o*f+c*g,a=a*f+l*g,s=s*f+h*g,f===1-i){var x=1/Math.sqrt(n*n+o*o+a*a+s*s);n*=x,o*=x,a*=x,s*=x}}t.x=n,t.y=o,t.z=a,t.w=s},t}(),iS="not_implement",iA=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(iS)},e.getIntegrateValue=function(t,e,r){throw Error(iS)},e.getIntegrateByTime=function(t,e){throw Error(iS)},e.getValue=function(t){throw Error(iS)},e.getMaxTime=function(){throw Error(iS)},e.toUniform=function(t){throw Error(iS)},e.map=function(t){throw Error(iS)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(iS)},t.getAllData=function(t,e){for(var r=new(e?r9:Float32Array)(4*t.index),i=0,n=0,o=t.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},t}(),iR=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},r.getMaxTime=function(){return 0},e}(iA),iw=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(iA),iO=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){return eV(this.min,this.max)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(iA),iM=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var o=Math.random();i[n]=e[n]*(1-o)+r[n]*o}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(iA),iI=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+e/o*(n-i)+i)*e-(i+t/o*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return iB(e,0,this.xCoord,this.min,this.max)-iB(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(iA),iL=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=ep(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return ev(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(iA),iP=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.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 r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?iB:iU,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(t>c&&t<=l)return i+o(t,c,l,s[1],u[1]);i+=o(l,c,l,s[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=Math.ceil(this.keys.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},r.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},r.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(iA),iV=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.curveMap={},this.keys=[];for(var e=0;e<t.length-1;e++){var r=i_(t[e],t[e+1]),i=r.points,n=r.curve,o=r.timeInterval,a=r.valueInterval,s=i[0],u=i[i.length-1];this.keys.push([].concat(s.toArray(),i[1].toArray())),this.keys.push([].concat(u.toArray(),i[2].toArray())),this.curveMap[s.x+"&"+u.x]={points:i,timeInterval:o,valueInterval:a,curve:n}}},r.getValue=function(t){var e=0,r=Object.keys(this.curveMap),i=Number(r[0].split("&")[0]),n=Number(r[r.length-1].split("&")[1]);if(t<=i)return this.getCurveValue(r[0],i);if(t>=n)return this.getCurveValue(r[r.length-1],n);for(var o=0;o<r.length;o++){var a=r[o].split("&"),s=a[0],u=a[1];if(t>=Number(s)&&t<Number(u)){e=this.getCurveValue(r[o],t);break}}return e},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=(e-t)/r,n=0,o=Object.keys(this.curveMap);if(i<=Number(o[0].split("&")[0]))return 0;for(var a=0;a<o.length;a++){var s=o[a].split("&"),u=s[0],c=s[1];if(i>=Number(c)&&(n+=r*this.getCurveIntegrateValue(o[a],Number(c))),i>=Number(u)&&i<Number(c)){n+=r*this.getCurveIntegrateValue(o[a],i);break}}return n},r.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},r.getCurveIntegrateValue=function(t,e){for(var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,o=r.valueInterval,a=0,s=(e-i.x)/20,u=0;u<=20;u++){var c=u*s/n,l=i.y+o*r.curve.getValue(c);0===u||20===u?a+=l:u%2==1?a+=4*l:a+=2*l}return s/3*a},r.getCurveValue=function(t,e){var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,o=r.valueInterval,a=(e-i.x)/n,s=r.curve.getValue(a);return i.y+o*s},r.toUniform=function(t){var e=t.index,r=this.keys.length;return t.curves.push(this),t.index=e+r,t.max=Math.max(t.max,r),t.curveCount+=r,new Float32Array([5,e+1/r,e,r])},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.getMaxTime=function(){var t=Object.keys(this.curveMap);return Number(t[t.length-1].split("&")[1])},e}(iA),iF=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],o=e[i+1];if(n[0]<=t&&o[0]>=t){var a=o[1]-n[1],s=void 0;return s=0===a?(t-n[0])/(o[0]-n[0]):(function(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=(t-e[0])/i,s=a*a,u=s*a;return(2*u-3*s+1)*e[1]+(u-2*s+a)*n+(u-s)*o+(-2*u+3*s)*r[1]}(t,n,o)-n[1])/a,this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-e)+i[o]*e;return n},e}(iA),iz=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length)for(var n=0;n<e.length-1;n++){var o=e[n],a=e[n+1],s=new eK(r[n][0],r[n][1],r[n][2]),u=new eK(r[n+1][0],r[n+1][1],r[n+1][2]),c=new eK(i[2*n][0],i[2*n][1],i[2*n][2]),l=new eK(i[2*n+1][0],i[2*n+1][1],i[2*n+1][2]),h=i_(o,a),f=h.points,m=h.curve,d=h.timeInterval,p=h.valueInterval,v=f[0],y=f[f.length-1],g=new iT(s,u,c,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:p,easingCurve:m,pathCurve:g}}},r.getValue=function(t){var e=ih(t,5),r=0,i=new eK,n=Object.keys(this.curveSegments);if(!n.length)return i;var o=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=o)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)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],l=u[1];if(e>=Number(c)&&e<Number(l)){var h=this.curveSegments[n[s]].pathCurve;r=this.getPercValue(n[s],e),i=h.getPointInPercent(r)}}return i},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,o=ih((e-i.x)/n,4);return eq(r.easingCurve.getValue(o),0,1)},r.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(iA),iN=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length)for(var n=0;n<e.length-1;n++){var o=e[n],a=e[n+1],s=eJ.fromArray(r[n]),u=eJ.fromArray(r[n+1]),c=eJ.fromArray(i[2*n]),l=eJ.fromArray(i[2*n+1]),h=i_(o,a),f=h.points,m=h.curve,d=h.timeInterval,p=h.valueInterval,v=f[0],y=f[f.length-1],g=new iE(s,u,c,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:p,easingCurve:m,pathCurve:g}}},r.getValue=function(t){var e=0,r=ih(t,5),i=Object.keys(this.curveSegments),n=Number(i[0].split("&")[0]),o=Number(i[i.length-1].split("&")[1]);if(r<=n)return this.curveSegments[i[0]].pathCurve.getPointInPercent(0);if(r>=o)return this.curveSegments[i[i.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<i.length;a++){var s=i[a].split("&"),u=s[0],c=s[1];if(r>=Number(u)&&r<Number(c)){var l=this.curveSegments[i[a]].pathCurve;return e=this.getPercValue(i[a],r),l.getPointInPercent(e)}}return this.curveSegments[i[0]].pathCurve.getPointInPercent(0)},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,o=ih((e-i.x)/n,4);return eq(r.easingCurve.getValue(o),0,1)},r.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(iA),iD=((tJ={})[tR.RANDOM]=function(t){return er(t[0],Array)?new iM(t):new iO(t)},tJ[tR.CONSTANT]=function(t){return new iR(t)},tJ[tR.CONSTANT_VEC2]=function(t){return new iR(t)},tJ[tR.CONSTANT_VEC3]=function(t){return new iR(t)},tJ[tR.CONSTANT_VEC4]=function(t){return new iR(t)},tJ[tR.RGBA_COLOR]=function(t){return new iR(t)},tJ[tR.COLORS]=function(t){return new iw(t.map(function(t){return em(t,!1)}))},tJ[tR.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new iI([t[0][1],t[1][1]]):new iP(t)},tJ[tR.GRADIENT_COLOR]=function(t){return new iL(t)},tJ[tR.LINEAR_PATH]=function(t){return new iF(t)},tJ[tR.BEZIER_CURVE]=function(t){return 1===t.length?new iR(t[0][1][1]):new iV(t)},tJ[tR.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new iR(im(eK,[].concat(t[1][0]))):new iz(t)},tJ[tR.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new iR(im(eJ,[].concat(t[1][0]))):new iN(t)},tJ);function ik(t){if(!t||!isNaN(+t))return new iR(t||0);if(er(t,iA))return t;if(eI(iD[t[0]]))return iD[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+rT["ValueType: 21/22 is not supported"]+".")}function iU(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function iB(t,e,r,i,n){var o=t*t,a=e*e;return(o*t*2*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function iG(t,e){if(e){var r=e[0],i=e[1];if(r===tR.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===tR.LINE){var o=i.length;if(2===o&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&o++,i[i.length-1][0]<1&&o++;var a=Math.ceil(o/2);t.lineSegCount+=a,t.curves.push(i),t.index+=a,t.max=Math.max(t.max,a)}else if(r===tR.BEZIER_CURVE){var s=i.length-1;t.index+=2*s,t.curves.push(i),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function iX(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}t.ShaderCompileResultStatus=void 0,(Q=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Q.noShader=0]="noShader",Q[Q.success=1]="success",Q[Q.fail=2]="fail",Q[Q.compiling=3]="compiling",t.GLSLVersion=void 0,(K=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",K.GLSL3="300 es";var iH=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return eG(e,t),e}(e9);t.Shader=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=eH(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(e9),t.Shader=en([e5("Shader")],t.Shader);var ij="effects-internal-copy",iW="effects-internal-copy-mesh",iY="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",iZ="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";function iq(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:ij,vertex:n+"\n"+iY,fragment:n+"\n"+iZ,glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:iW+ +r}}var iQ={format:rb.RGBA,type:rb.UNSIGNED_BYTE,minFilter:rb.LINEAR,magFilter:rb.LINEAR,wrapS:rb.CLAMP_TO_EDGE,wrapT:rb.CLAMP_TO_EDGE},iK=Symbol("dispose"),iJ=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var r=e.prototype;return r.requestColorAttachmentTexture=function(e){var r=this,i=e.width,n=e.height,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(iQ).forEach(function(t){var r,i=null!=(r=e[t])?r:iQ[t];a[t]=i,s.push(t,i)});var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var l=this.engine;eC(l),c=rq.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[iK]=c.dispose,c.dispose=function(){return r.removeTexture(u)}}return c},r.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var r=this.textureCache[t];r&&(r[iK](),r.dispose=r[iK]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},r.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var r=t.textureCache[e];r[iK](),r.dispose=r[iK]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),i$=function(){function t(t){void 0===t&&(t={}),this.semantics=rI({},t)}var e=t.prototype;return e.toObject=function(){return rI({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return eI(r)?r(e):r},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}(),i0=((t$={})[rb.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t$[rb.INT]=Int32Array.BYTES_PER_ELEMENT,t$[rb.SHORT]=Int16Array.BYTES_PER_ELEMENT,t$[rb.BYTE]=Int8Array.BYTES_PER_ELEMENT,t$),i1=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(e9);function i2(t){return t===rb.INT?new Int32Array(0):t===rb.SHORT?new Int16Array(0):new Float32Array(0)}var i3=1,i4=function(e){function r(t,r){var i;if((i=e.call(this,t)||this).destroyed=!1,i.visible=!0,r){var n=r.material,o=r.geometry,a=r.name,s=r.priority,u=r.worldMatrix,c=void 0===u?e$.fromIdentity():u;i.id="Mesh"+i3++,i.name=void 0===a?"<unnamed>":a,i.geometry=o,i.material=n,i.priority=void 0===s?0:s,i.worldMatrix=c}else i.id="Mesh"+i3++,i.name="<unnamed>",i.worldMatrix=e$.fromIdentity(),i._priority=0;return i}eG(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.restore=function(){},i.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var r=null==e?void 0:e.material;r!==t.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},eU(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(rr);t.RenderPassAttachmentStorageType=void 0,(J=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[J.none=0]="none",J[J.color=1]="color",J[J.stencil_8_opaque=2]="stencil_8_opaque",J[J.depth_16_opaque=3]="depth_16_opaque",J[J.depth_stencil_opaque=4]="depth_stencil_opaque",J[J.depth_16_texture=5]="depth_16_texture",J[J.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,($=t.TextureStoreAction||(t.TextureStoreAction={}))[$.store=0]="store",$[$.clear=2]="clear";var i5=function(){function e(e,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(er(i,rq))this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,a=i.wrapS,s=i.minFilter,u=i.magFilter,c=i.internalFormat,l=i.format,h=void 0===l?rb.RGBA:l,f=i.type,m=void 0===f?rb.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:h,type:m,internalFormat:c||h,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:r.name},this.texture=rq.create(e,rI({},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)},eU(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,(tt=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tt.force=0]="force",tt[tt.keep=1]="keep",tt[tt.keepExternal=2]="keepExternal",tt[tt.destroy=0]="destroy";var i6=1,i8=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+i6++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,c=r.priority,l=r.meshOrder,h=void 0===l?t.OrderType.ascending:l,f=r.meshes,m=r.delegate;this.name=n,this.renderer=e,this.priority=void 0===c?0:c,this.meshOrder=h,this.meshes=eE((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=rI({},o),this.storeAction=rI({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new i$(a),this.options=r,this.delegate=void 0===m?{}:m,this.setViewportOptions(r)}var r=e.prototype;return r.addMesh=function(t){eb(this.meshes,t,this.meshOrder)},r.removeMesh=function(t){eh(this.meshes,t)},r.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eE(this.meshes,this.meshOrder),this.meshes},r.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},r.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},r.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},r.frameCleanup=function(t){},r.resetColorAttachments=function(e){var r=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new i5(r.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=i,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}})})},r.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},r.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)},r._resetAttachments=function(){var t,e,r=this,i=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 o=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,i.getWidth()*o,i.getHeight()*o],s=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var c=n.attachments.map(function(t,e){var i;return new i5(r.renderer.engine,rI({size:s,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))});this.attachments=c;var l=nS.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},r.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},r.getDepthAttachment=function(){var t=this.framebuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},r.getStencilAttachment=function(){var t=this.framebuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},r.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},r.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},r.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},r.dispose=function(e){if(!this.destroyed){var r,i,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 o=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===o||1===o||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:a}),s.externalStorage&&2===a||1===a||(null==(r=this.stencilTexture)||r.dispose(),null==(i=this.depthTexture)||i.dispose())),this.options=this.renderer=null,this.initialize=eF}},eU(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}(),i9="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 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;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",i7="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}",nt="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;}",ne="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 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\nin float vLife;in vec2 vTexCoord;in 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\nin vec4 vTexCoordBlend;\n#endif\nin 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(){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);fragColor=color;}\n#endif\n",nr="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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\nin float aSeed;out 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.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out 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 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out 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;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}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\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void 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\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\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}}",ni="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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\nin float aSeed;out 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.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in 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\nout float vLife;out vec2 vTexCoord;out 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}",nn="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",no="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));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",na="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);}",ns="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);}",nu="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);}",nc="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",nl=function(e){function r(r,i){var n,o=(n=e.call(this,r,i)||this).renderer.engine,a=i1.create(o,{mode:rb.TRIANGLE_STRIP,attributes:{aPos:{type:rb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r6.create(o,{shader:{vertex:nn,fragment:nc,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=i4.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}eG(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},i.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 r=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),e.renderMeshes([this.screenMesh])},r}(i8),nh=function(e){function r(r,i,n){(o=e.call(this,r,n)||this).type=i;var o,a=o.renderer.engine,s="PostProcess",u=i1.create(a,{name:s,mode:rb.TRIANGLE_STRIP,attributes:{aPos:{type:rb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:nn,fragment:"H"==i?na:ns,glslVersion:t.GLSLVersion.GLSL1},l=r6.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=i4.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}eG(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.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",ng(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},r}(i8),nf=function(e){function r(t,r){i=e.call(this,t,r)||this;var i,n="PostProcess",o=i.renderer.engine,a=i1.create(o,{name:n,mode:rb.TRIANGLE_STRIP,attributes:{aPos:{type:rb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r6.create(o,{name:n,shader:{vertex:nn,fragment:nu}});return s.blending=!1,s.depthTest=!1,s.culling=!1,i.screenMesh=i4.create(o,{name:n,geometry:a,material:s,priority:0}),i.priority=5e3,i}eG(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.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",ng(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},r}(i8),nm=function(e){function r(r,i){n=e.call(this,r,{})||this;var n,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new i5(a);var s=i1.create(a,{name:o,mode:rb.TRIANGLE_STRIP,attributes:{aPos:{type:rb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=r6.create(a,{name:o,shader:{vertex:nn,fragment:no,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=i4.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}eG(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var r=e.renderingData.currentFrame.globalVolume,i=r.useBloom,n=r.bloomIntensity,o=r.brightness,a=r.saturation,s=r.contrast,u=r.useToneMapping,c=r.vignetteIntensity,l=r.vignetteSmoothness,h=r.vignetteRoundness;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",o),this.screenMesh.material.setFloat("_Saturation",a),this.screenMesh.material.setFloat("_Contrast",s),this.screenMesh.material.setInt("_UseBloom",i),i&&(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",l),this.screenMesh.material.setFloat("_VignetteRoundness",h),this.screenMesh.material.setVector2("_VignetteCenter",new eQ(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new eK(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},r}(i8),nd={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:1},np="_effects_default_",nv=1,ny=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=e.camera,i=e.keepColorBuffer,n=e.renderer,o=e.editorTransform,a=e.globalVolume,s=e.clearAction,u=void 0===s?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:s,c=n.engine;a&&(this.globalVolume=rI({},nd,a)),this.globalUniforms=new nT;var l=[],h={};if(this.renderer=n,this.globalVolume){var f=this.globalVolume.useHDR?rb.HALF_FLOAT:rb.UNSIGNED_BYTE;l=[{texture:{format:rb.RGBA,type:f,magFilter:rb.LINEAR,minFilter:rb.LINEAR}}],p={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},h={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var m=[new i8(n,{name:np,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:p,attachments:l,clearAction:h})];if(this.setRenderPasses(m),this.globalVolume){var d,p,v,y=this.globalVolume.useBloom,g=new i5(c);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=Array(7),E=this.globalVolume.useHDR?rb.HALF_FLOAT:rb.UNSIGNED_BYTE,b=new nl(n,{name:"BloomThresholdPass",attachments:[{texture:{format:rb.RGBA,type:E,minFilter:rb.LINEAR,magFilter:rb.LINEAR}}]});b.sceneTextureHandle=g,this.addRenderPass(b);for(var _=0;_<7;_++){T[_]=new i5(c);var C=new nh(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:rb.RGBA,type:E,minFilter:rb.LINEAR,magFilter:rb.LINEAR}}]}),S=new nh(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:rb.RGBA,type:E,minFilter:rb.LINEAR,magFilter:rb.LINEAR}}]});S.gaussianResult=T[_],this.addRenderPass(C),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var R=new nf(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:rb.RGBA,type:E,minFilter:rb.LINEAR,magFilter:rb.LINEAR}}]});R.gaussianDownSampleResult=T[5-A],this.addRenderPass(R),x[2]*=2,x[3]*=2}}v=y?new nm(n,g):new nm(n),this.addRenderPass(v)}this.semantics=new i$(e.semantics),this.clearAction=u,this.name="RenderFrame"+nv++;var w=m[0];this.emptyTexture=rJ(c),this.transparentTexture=r$(c),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(w,{listStart:0,listEnd:0,renderPass:w,intermedia:!1}),this.editorTransform=rf.fromArray(void 0===o?[1,1,0,0]:o),e.clearAction||this.resetClearActions(),this.passTextureCache=new iJ(c);var O=c.gpuCapability,M=O.detail,I=iq(O.level,M.readableDepthStencilTextures&&M.writableFragDepth);null==(d=this.renderer.getShaderLibrary())||d.addShader(I)}var r=e.prototype;return r.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},r.removeMeshFromDefaultRenderPass=function(t){},r.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var r,i,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==(i=this.resource.depthStencil)||null==(r=i.texture)||r.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},r.resetRenderPassDefaultAttachment=function(t,e){for(var r=this.resource,i=r.color_a,n=r.color_b,o=e;o<t.length;o++){var a,s,u,c=t[o],l=null==(s=c.attachments[0])?void 0:s.texture;if(l&&a===l){var h=l===i?n:i;c.resetColorAttachments([h])}(l=null==(u=c.attachments[0])?void 0:u.texture)&&(a=l)}},r.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(r,i){return!(r.name.startsWith(np)&&r.meshes.includes(t))||(e=i,!1)}),e},r.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e)},r.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var r,i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(a===rb.RGBA&&!o){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return t},r.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)},r.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},r.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},r.createResource=function(){var e=this.renderer.engine;if(!this.resource){var r,i=e.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?rb.LINEAR:rb.NEAREST,c=rq.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rb.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=rq.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rb.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),h=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new i8(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:c}]}).initialize(this.renderer),m=new nx(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==(r=f.getDepthAttachment())?void 0:r.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:m,depthStencil:f.depthAttachment,resRP:f}}},r.createCopyMesh=function(t){var e=this.renderer.engine,r=i1.create(e,{name:ij,mode:rb.TRIANGLE_STRIP,attributes:{aPos:{type:rb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),i=iq(e.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(i);var n=r6.create(e,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:ij,shader:i});return n.blending=!1,n.depthTest=!1,n.culling=!1,(null==t?void 0:t.blend)&&(n.blending=!0,n.blendFunction=[rb.SRC_ALPHA,rb.ONE_MINUS_SRC_ALPHA,rb.SRC_ALPHA,rb.ONE_MINUS_SRC_ALPHA]),i4.create(e,{name:ij,geometry:r,material:n,priority:0})},r.removeRenderPass=function(t){eh(this._renderPasses,t)},eU(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function ng(t){return t?new eQ(t.getWidth(),t.getHeight()):new eQ}var nx=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.configure=function(t){this.prePassTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",ng(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(i8),nT=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},nE=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return eU(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nb="function"==typeof WebGL2RenderingContext,n_=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,r=nb&&er(t,WebGL2RenderingContext)?2:1,i=2===r,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),a=!!t.getExtension("OES_texture_half_float_linear"),s=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=i?"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"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),i&&!a&&(a=nC(t,t.HALF_FLOAT)),i&&!s&&(s=nC(t,t.FLOAT)),this.internalFormatDepth16=i?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=i||t.getExtension("OES_texture_float")?t.FLOAT:0,c=i?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,l={floatTexture:u,halfFloatTexture:c,maxSample:i?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:i?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!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:a,floatLinear:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:i||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!t.getExtension("EXT_frag_depth")};this.detail=l,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw Error("Draw multiple color buffers not available.");var a=o?o["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];a?t.framebufferTexture2D(e,a,i,n,0):console.error("Invalid color attachment index: "+r+".")},e.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1===this.level&&!r){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var i=e.map(function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE});r?r.drawBuffersWEBGL(i):t.drawBuffers(i)},e.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function nC(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),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()||(i=!0),t.deleteTexture(r),i}t.COMPRESSED_TEXTURE=void 0,(te=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[te.NONE=0]="NONE",te[te.PVRTC=1]="PVRTC",te[te.ASTC=2]="ASTC",t.FilterMode=void 0,(tr=t.FilterMode||(t.FilterMode={}))[tr.Nearest=0]="Nearest",tr[tr.Linear=1]="Linear",t.RenderTextureFormat=void 0,(ti=t.RenderTextureFormat||(t.RenderTextureFormat={}))[ti.RGBA32=0]="RGBA32",ti[ti.RGBAHalf=1]="RGBAHalf";var nS=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},eU(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nA=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,r,i){},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,r){},e.getTemporaryRT=function(t,e,r,i,n,o){return null},e.dispose=function(t){},t}(),nR=1,nw=function(){function e(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}var r=e.prototype;return r.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new eK,n=new eJ,o=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,o),e.x=o.x,e.y=o.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},r.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null==(r=this.engine.renderer)?void 0:r.env)===rx]],n=ik(this.color).getValue(0),o={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;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:i},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=r6.create(this.engine,o);return a.depthTest=!1,a.setVector4("uPos",new rf(0,0,0,0)),a.setVector2("uSize",new eQ(1,1)),a.setVector4("uColor",new rf(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new eJ(0,0,0,0)),a},r.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return i1.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:rb.LINES,maxVertex:4})},r.createMesh=function(t,e){return i4.create(this.engine,{name:"Interact_preview"+nR++,priority:0,worldMatrix:e$.fromIdentity(),geometry:t,material:e})},e}();function nO(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}function nM(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:o,maskMode:a,cachePrefix:u,cacheId:u+"."+ +i+"+"+ +n+"+"+ +r+"+"+s+"+"+a+"."+o}}function nI(e,r){var i=null!=r?r:{},n=i.env,o=i.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===rx]];return{fragment:o?i9:nt,vertex:i7,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function nL(t,e){return t.cachePrefix+"_effects_sprite_"+e}function nP(t,e,r,i){var n=t.wireframe,o=nI(r,{wireframe:n,env:i});return o.shared=!0,n||(o.cacheId=nL(t,e)),o}function nV(e){t.maxSpriteMeshItemCount=e}t.InteractComponent=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.dragRatio=[1,1],t._interactive=!0,t.getHitTestParams=function(e){if(t.clickable){var r=t.item.props.content.options.behavior,i=t.getBoundingBox();if(i)return{type:i.type,triangles:i.area,behavior:r}}},t}eG(r,e);var i=r.prototype;return i.start=function(){var t=this,e=this.item.props.content.options,r=this.item.engine.renderer.env,i=this.item.composition,n=this.interactData.options,o=n.type,a=n.showPreview;if(o===ty.CLICK&&(this.clickable=!0,a&&r===rx)){var s=this.item.composition.getRendererOptions();this.previewContent=new nw(this.item.props.content,s,this.transform,this.engine)}i.addInteractiveItem(this.item,e.type),this.item.onEnd=function(){return i.removeInteractiveItem(t.item,e.type)},e.type===ty.DRAG&&(r!==rx||e.enableInEditor)&&i.event&&this.beginDragTarget(e,i.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.update=function(t){var e;null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,nO(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){if(this.item&&this.item.composition){var t;this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null==(t=this.previewContent)||t.mesh.dispose(),this.endDragTarget()}},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var r=this.item.props.content.options,i=t.cameraParam,n=i.position,o=i.fov,a=e.dy,s=e.dx*e.width/e.height,u=n[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(u),l=n[0]-this.dragRatio[0]*(s*c),h=n[1]-this.dragRatio[1]*(a*c);if(r.dxRange){var f,m=r.dxRange,d=m[0],p=m[1];(l=eq(l,d,p))!==d&&l!==p&&d!==p&&(null==(f=e.origin)||f.preventDefault())}if(r.dyRange){var v,y=r.dyRange,g=y[0],x=y[1];(h=eq(h,g,x))!==g&&h!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new eK(l,h,u)}},i.beginDragTarget=function(t,e){var i,n=this;if("camera"===t.target){var o={touchstart:function(t){if(n.canInteract()){n.dragEvent=null,n.bouncingArg=null;var e,r=null==(e=n.item.composition)?void 0:e.camera;i={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}}},touchmove:function(t){n.handleDragMove(i,t),n.bouncingArg=t},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!nO(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=rI({},i)),i=null}}};Object.keys(o).forEach(function(t){e.addEventListener(t,o[t])}),o.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(r).endDragTarget=function(){Object.keys(o).forEach(function(t){e.removeEventListener(t,o[t])})}}},i.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=ic(eK.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return r.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:r}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.interactData=t},i.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},eU(r,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),r}(rr),t.InteractComponent=en([e5(tH.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8;var nF={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},nz=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return eG(r,e),r.precompile=function(e,r,i){var n=r.getShaderLibrary(),o=r.engine.gpuCapability,a=o.level,s=o.detail,u=(null!=i?i:{}).env;return!n.shaderResults[nL(nF,2)]&&(n.addShader(nP(nF,2,1,u)),n.addShader(nP(nF,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&n.addShader(iq(a,!0))),Promise.resolve()},r}(ri),nN=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=eH(this.playables);!(e=r()).done;){var i=e.value;this.updatePlayableTime(i,t)}for(var n,o=eH(this.playableOutputs);!(n=o()).done;)n.value.context.deltaTime=t;for(var a,s=eH(this.playableOutputs);!(a=s()).done;){var u=a.value;this.prepareFrameWithRoot(u)}for(var c,l=eH(this.playableOutputs);!(c=l()).done;){var h=c.value;this.processFrameWithRoot(h)}},e.connect=function(t,e,r,i){r.connectInput(i,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.overrideTimeNextEvaluation?t.overrideTimeNextEvaluation=!1:t.setTime(t.getTime()+e))},t}(),nD=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.overrideTimeNextEvaluation=!1,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=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,r,i){void 0===i&&(i=1),this.setInput(e,t),this.setInputWeight(t,i),e.setOutput(this,r),this.inputOuputPorts.length<t+1&&(this.inputOuputPorts.length=t+1),this.inputOuputPorts[t]=r},e.addInput=function(t,e,r){void 0===r&&(r=1),this.connectInput(this.getInputCount(),t,e,r)},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,r){if(er(e,t)){for(var i=0;i<this.inputs.length;i++)if(this.inputs[i]===e){this.inputWeight[i]=r;return}}else this.inputWeight.length<e+1&&(this.inputWeight.length=e+1),this.inputWeight[e]=r},e.setTime=function(t){this.time=t,this.overrideTimeNextEvaluation=!0},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 r=0;r<this.getInputCount();r++)this.getInput(r).prepareFrameRecursive(t,this.inputOuputPorts[r]);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 r=0;r<this.getInputCount();r++)this.getInput(r).processFrameRecursive(t,this.inputOuputPorts[r]);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}(),nk=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}(),nU=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(e9);(tn=t0||(t0={}))[tn.Playing=0]="Playing",tn[tn.Paused=1]="Paused",(to=t1||(t1={}))[to.Mix=0]="Mix",to[to.Passthrough=1]="Passthrough";var nB=[[0,0,1,1,void 0]],nG=[1,1,1,1],nX=0,nH=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}eG(r,e);var i=r.prototype;return i.processFrame=function(e){var r,i=e.output.getUserData();if(er(i,t.VFXItem)){this.spriteMaterial||(this.spriteMaterial=i.getComponent(t.SpriteComponent).material);var n=ii(nG,1),o=this.time/i.duration,a=this.opacityOverLifetime,s=this.colorOverLifetime;s&&(n=ed(s,o,!0),r=!0),a&&(n[3]*=a.getValue(o),r=!0),r&&(ia(this.renderColor,n,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))}},i.create=function(t){this.clipData=t;var e,r=t.colorOverLifetime;return r&&(this.opacityOverLifetime=ik(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===tR.GRADIENT_COLOR&&(this.colorOverLifetime=ep(r.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},r}(nD);t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new nH(t);return e.create(this.data),e},r.fromData=function(t){this.data=t},e}(nU),t.SpriteColorPlayableAsset=en([e5("SpriteColorPlayableAsset")],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function r(t,r){var i;return(i=e.call(this,t)||this).frameAnimationTime=0,i.color=[1,1,1,1],i.visible=!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===tm.FRONT}}},r&&i.fromData(r),i}eG(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){this.color=t,this.material.setVector4("_Color",new rf().setFromArray(t))},i.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",t)},i.render=function(t){if(this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),t.drawGeometry(r,e)}},i.start=function(){this.item.getHitTestParams=this.getHitTestParams},i.update=function(t){this.frameAnimationTime+=t/1e3;var e=this.frameAnimationTime,r=this.item.duration,i=this.textureSheetAnimation;if(i){var n,o,a,s,u=i.total||i.row*i.col,c=0,l=0,h=1,f=1;if(this.splits){var m=this.splits[0];n=m[4],c=m[0],l=m[1],n?(h=m[3],f=m[2]):(h=m[2],f=m[3])}if(n?(o=1/i.row*h,a=1/i.col*f):(o=1/i.col*h,a=1/i.row*f),i.animate){var d=Math.round(Math.min(Math.max(e/r,0),1)*(u-1)),p=Math.floor(d/i.col),v=d-p*i.col;s=n?[o*p,a*(i.col-v)]:[o*v,a*(1+p)]}else s=[0,a];this.material.getVector4("_TexOffset").setFromArray([c+s[0],f+l-s[1],o,a])}},i.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},i.getItemInitData=function(t,e,r,i){var n=t.geoData;n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.index,a=o.length,s=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new o.constructor(a);if(!this.wireframe)for(var u=0;u<a;u++)s[u]=r+o[u];return{atlasOffset:n.atlasOffset,index:s}},i.setItem=function(){var e=[],r=this.renderer.texture;r&&el(e,r);var i=(r=this.renderer.texture)?e.indexOf(r):-1,n=this.getItemInitData(this,0,0,i),o=this.renderer,a=this.material.getVector4("_TexParams");a.x=o.occlusion?+o.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=o.renderMode;var s={atlasOffset:new Float32Array(n.atlasOffset.length),index:new Uint16Array(n.index.length)};s.atlasOffset.set(n.atlasOffset),s.index.set(n.index);var u=this.material,c=this.geometry,l=s.index;c.setIndexData(l),c.setAttributeData("atlasOffset",s.atlasOffset),c.setDrawCount(n.index.length);for(var h=0;h<e.length;h++){var f=e[h];u.setTexture("uSampler"+h,f)}for(var m=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)u.setTexture("uSampler"+d,m)},i.createGeometry=function(t){var e=12*this.splits.length;return i1.create(this.engine,{attributes:{aPos:{type:rb.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:rb.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},i.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:nP(t,e,1)};this.preMultiAlpha=rS(n);var u=r6.create(this.engine,s),c={side:r,blending:!0,blendMode:n,mask:a,maskMode:o,depthTest:!0,depthMask:i};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,rw(u,c.blendMode),rM(u,c.maskMode),rO(u,c.side),u.hasUniform("_Color")||u.setVector4("_Color",new rf(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new rf),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new rf),u},i.getItemGeometryData=function(t,e){var r=t.splits,i=t.renderer,n=t.textureSheetAnimation;if(i.shape){for(var o=i.shape,a=o.index,s=o.aPoint,u=new Float32Array(s),c=[],l=[],h=0;h<u.length;h+=6)u[h]*=1,u[h+1]*=1,l.push(s[h+2],s[h+3]),c.push(u[h],u[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(c)),{index:a,atlasOffset:l}}var f=[],m=[],d=2,p=2;1===r.length&&(d=1,p=1);for(var v=[],y=0;y<d;y++)for(var g=0;g<p;g++){var x=(2*g+y)*4,T=n?[0,0,1,1,r[0][4]]:r[2*g+y],E=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((y+y+1)/d-1)/2,_=((g+g+1)/p-1)/2,C=T[0],S=T[1],A=T[4]?T[3]:T[2],R=T[4]?T[2]:T[3],w=[-.5/d+b,.5/p+_,-.5/d+b,-.5/p+_,.5/d+b,.5/p+_,.5/d+b,-.5/p+_];f.push(E[0]*A+C,E[1]*R+S,E[2]*A+C,E[3]*R+S,E[4]*A+C,E[5]*R+S,E[6]*A+C,E[7]*R+S),v.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),m.push(x,1+x,2+x,2+x,1+x,3+x)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:m,atlasOffset:f}},i.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},i.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),r=ic(eK.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return r.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:r}}},i.fromData=function(t){e.prototype.fromData.call(this,t);var r,i,n,o,a,s,u=t.interaction,c=t.options,l=t.listIndex,h=t.renderer;h||(h={}),this.interaction=u,this.renderer={renderMode:null!=(r=h.renderMode)?r:tT.BILLBOARD,blending:null!=(i=h.blending)?i:tf.ALPHA,texture:null!=(n=h.texture)?n:this.engine.emptyTexture,occlusion:!!h.occlusion,transparentOcclusion:!!h.transparentOcclusion||h.maskMode===td.MASK,side:null!=(o=h.side)?o:tm.DOUBLE,shape:h.shape,mask:null!=(a=h.mask)?a:0,maskMode:null!=(s=h.maskMode)?s:td.NONE,order:void 0===l?0:l},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||nB,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nM(this);var f=this.createGeometry(rb.TRIANGLES),m=this.createMaterial(this.renderInfo,2);this.worldMatrix=e$.fromIdentity(),this.material=m,this.geometry=f,this.name="MSprite"+nX++;var d=c.startColor||[1,1,1,1];this.material.setVector4("_Color",new rf().setFromArray(d)),this.material.setVector4("_TexOffset",new rf().setFromArray([0,0,1,1])),this.setItem()},i.toData=function(){e.prototype.toData.call(this)},r}(rr),t.SpriteComponent=en([e5(tH.SpriteComponent)],t.SpriteComponent);var nj="lookup_texture",nW="offscreen_canvas",nY={},nZ=new eJ,nq=1,nQ=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new eK(0,0,0),this.quat=new eJ(0,0,0,1),this.rotation=new e0(0,0,0),this.scale=new eK(1,1,1),this.anchor=new eK(0,0,0),this.size=new eQ(1,1),this.children=[],this.worldMatrix=e$.fromIdentity(),this.localMatrix=e$.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new eK(0,0,0),quat:new eJ(0,0,0,1),scale:new eK(1,1,1)},this.name="transform_"+nq++,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,r){(this.position.x!==t||this.position.y!==e||this.position.z!==r)&&(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){(0!==t||0!==e||0!==r)&&(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==r)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==r||this.quat.w!==i)&&(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==r)&&(this.scale.x=t,this.scale.y=e,this.scale.z=r,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,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,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 r=t.position,i=t.rotation,n=t.scale,o=t.size,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),r&&(er(r,eK)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)er(a,eJ)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(i){var c=e?-1:1;er(i,e0)?this.setRotation(i.x*c,i.y*c,i.z*c):this.setRotation(i[0]*c,i[1]*c,i[2]*c)}n&&(er(n,eK)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(er(u,eQ)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){el(this.children,t)},e.removeChild=function(t){eh(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new e0)},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 e0)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.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 eK().copyFrom(t.position),rotation:new e0(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new eK().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 r=nZ.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},eU(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}(),nK=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=nJ(this.arc,this.arcMode,t)*ej,r=new eK(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),i=Math.tan(this.angle*ej),n=r.clone().multiply(i);return n.z+=1,{position:r.multiply(eV(0,1)),direction:n.normalize()}},t}();function nJ(t,e,r){if(e===tL.RANDOM)t=eV(0,t);else if(e===tL.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===tL.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===tL.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var n$=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=nJ(this.arc,this.arcMode,t)*ej,r=new eK(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),n0=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eV(-this._d,this._d),r=eV(-this._h,this._h);return{direction:new eK(0,0,1),position:new eK(e,r,0)}},t}(),n1=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=nJ(this.arc,this.arcMode,t)*ej,r=new eK(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new eK;return e<o?s.set(i,i*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-i,-i*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(i,i*a,0),{direction:r,position:s}},t}(),n2=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tL.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eV(0,1);return{direction:new eK(0,1,0),position:new eK(this._d*(e-.5),0,0)}},t}(),n3=new e$,n4=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=eV(0,2*Math.PI),n=nJ(this.arc,this.arcMode,t)*ej,o=n3.setFromRotationZ(n),a=new eK(Math.cos(i),Math.sin(i),0),s=new eK(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),n5=new e$,n6=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}var e=t.prototype;return e.getHorizontalAngle=function(){return eV(-90,90)},e.generate=function(t){var e=nJ(this.arc,this.arcMode,t)*ej,r=this.getHorizontalAngle()*ej,i=this.radius,n=new eK(Math.cos(r),0,Math.sin(r)),o=n5.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),n8=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.getHorizontalAngle=function(){return eV(0,90)},e}(n6),n9=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=eq(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=Math.floor(nJ(e.length/2-1,this.arcMode,t)),i=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,o=new eK(i,n,0);return{position:new eK(i*this.width,n*this.height,0),direction:o.normalize()}},t}(),n7=function(){function t(){}return t.prototype.generate=function(){return{position:new eK,direction:new eK}},t}(),ot=((t2={})[tp.NONE]=n7,t2[tp.CONE]=nK,t2[tp.SPHERE]=n6,t2[tp.HEMISPHERE]=n8,t2[tp.CIRCLE]=n$,t2[tp.DONUT]=n4,t2[tp.RECTANGLE]=n0,t2[tp.EDGE]=n2,t2[tp.RECTANGLE_EDGE]=n1,t2[tp.TEXTURE]=n9,t2);function oe(t){if(!t)return new n7;var e=rI({radius:1,arc:360,angle:0,arcMode:tL.RANDOM},t),r=t.type,i=ot[r];if(!i)throw Error("Invalid shape: "+r+".");var n=new i(e);if(r!==tp.NONE){var o=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=o,n.upDirection=eK.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function or(t,e,r,i,n){var o,a;if(n===function(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(o=e;o<r;o+=i)a=od(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=od(o,t[o],t[o+1],a);return a&&ou(a,a.next)&&(op(a),a=a.next),a}function oi(t,e){if(!t)return t;e||(e=t);var r,i=t;do if(r=!1,!i.steiner&&(ou(i,i.next)||0===os(i.prev,i,i.next))){if(op(i),(i=e=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==e);return e}function on(t,e){return t.x-e.x}function oo(t,e,r,i,n){return(t=((t=((t=((t=((t=32767*(t-r)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-i)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function oa(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function os(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ou(t,e){return t.x===e.x&&t.y===e.y}function oc(t,e,r,i){var n=oh(os(t,e,r)),o=oh(os(t,e,i)),a=oh(os(r,i,t)),s=oh(os(r,i,e));return!!(n!==o&&a!==s||0===n&&ol(t,r,e)||0===o&&ol(t,i,e)||0===a&&ol(r,t,i)||0===s&&ol(r,e,i))}function ol(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function oh(t){return t>0?1:t<0?-1:0}function of(t,e){return 0>os(t.prev,t,t.next)?os(t,e,t.next)>=0&&os(t,t.prev,e)>=0:0>os(t,e,t.prev)||0>os(t,t.next,e)}function om(t,e){var r=new ov(t.i,t.x,t.y),i=new ov(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function od(t,e,r,i){var n=new ov(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function op(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 ov(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var oy=0;function og(t,e,r,i){r=r||2,oy=i||0;var n,o,a,s,u,c,l,h=e&&e.length,f=h?e[0]*r:t.length,m=or(t,0,f,r,!0),d=[];if(!m||m.next===m.prev)return d;if(h&&(m=function(t,e,r,i){var n,o,a,s,u,c=[];for(n=0,o=e.length;n<o;n++)a=e[n]*i,s=n<o-1?e[n+1]*i:t.length,(u=or(t,a,s,i,!1))===u.next&&(u.steiner=!0),c.push(function(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}(u));for(c.sort(on),n=0;n<c.length;n++)(function(t,e){if(e=function(t,e){var r,i,n,o=e,a=t.x,s=t.y,u=-1/0;do{if(s<=o.y&&s>=o.next.y&&o.next.y!==o.y){var c=o.x+(s-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(c<=a&&c>u){if(u=c,c===a){if(s===o.y)return o;if(s===o.next.y)return o.next}n=o.x<o.next.x?o:o.next}}o=o.next}while(o!==e);if(!n)return null;if(a===u)return n;var l,h=n,f=n.x,m=n.y,d=1/0;o=n;do a>=o.x&&o.x>=f&&a!==o.x&&oa(s<m?a:u,s,f,m,s<m?u:a,s,o.x,o.y)&&(l=Math.abs(s-o.y)/(a-o.x),of(o,t)&&(l<d||l===d&&(o.x>n.x||o.x===n.x&&(r=n,i=o,0>os(r.prev,r,i.prev)&&0>os(i.next,r,r.next))))&&(n=o,d=l)),o=o.next;while(o!==h);return n}(t,e)){var r=om(e,t);oi(e,e.next),oi(r,r.next)}})(c[n],r),r=oi(r,r.next);return r}(t,e,m,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var p=r;p<f;p+=r)u=t[p],c=t[p+1],u<n&&(n=u),c<o&&(o=c),u>a&&(a=u),c>s&&(s=c);l=0!==(l=Math.max(a-n,s-o))?1/l:0}return function t(e,r,i,n,o,a,s){if(e){!s&&a&&function(t,e,r,i){var n=t;do null===n.z&&(n.z=oo(n.x,n.y,e,r,i)),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,r,i,n,o,a,s,u,c=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<c&&(s++,i=i.nextZ);e++);for(u=c;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,c*=2}while(a>1)}(n)}(e,n,o,a);for(var u,c,l=e;e.prev!==e.next;){if(u=e.prev,c=e.next,a?function(t,e,r,i){var n=t.prev,o=t.next;if(os(n,t,o)>=0)return!1;for(var a=n.x<t.x?n.x<o.x?n.x:o.x:t.x<o.x?t.x:o.x,s=n.y<t.y?n.y<o.y?n.y:o.y:t.y<o.y?t.y:o.y,u=n.x>t.x?n.x>o.x?n.x:o.x:t.x>o.x?t.x:o.x,c=n.y>t.y?n.y>o.y?n.y:o.y:t.y>o.y?t.y:o.y,l=oo(a,s,e,r,i),h=oo(u,c,e,r,i),f=t.prevZ,m=t.nextZ;f&&f.z>=l&&m&&m.z<=h;){if(f!==t.prev&&f!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&os(f.prev,f,f.next)>=0||(f=f.prevZ,m!==t.prev&&m!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,m.x,m.y)&&os(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&os(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;m&&m.z<=h;){if(m!==t.prev&&m!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,m.x,m.y)&&os(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}(e,n,o,a):function(t){var e=t.prev,r=t.next;if(os(e,t,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(oa(e.x,e.y,t.x,t.y,r.x,r.y,i.x,i.y)&&os(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e)){r.push(u.i/i+oy),r.push(e.i/i+oy),r.push(c.i/i+oy),op(e),e=c.next,l=c.next;continue}if((e=c)===l){s?1===s?t(e=function(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!ou(n,o)&&oc(n,i,i.next,o)&&of(n,o)&&of(o,n)&&(e.push(n.i/r+oy),e.push(i.i/r+oy),e.push(o.i/r+oy),op(i),op(i.next),i=t=o),i=i.next}while(i!==t);return oi(i)}(oi(e),r,i),r,i,n,o,a,2):2===s&&function(e,r,i,n,o,a){var s=e;do{for(var u,c,l=s.next.next;l!==s.prev;){if(s.i!==l.i&&(u=s,c=l,u.next.i!==c.i&&u.prev.i!==c.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&oc(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(u,c)&&(of(u,c)&&of(c,u)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}(u,c)&&(os(u.prev,u,c.prev)||os(u,c.prev,c))||ou(u,c)&&os(u.prev,u,u.next)>0&&os(c.prev,c,c.next)>0))){var h=om(s,l);s=oi(s,s.next),h=oi(h,h.next),t(s,r,i,n,o,a),t(h,r,i,n,o,a);return}l=l.next}s=s.next}while(s!==e)}(e,r,i,n,o,a):t(oi(e),r,i,n,o,a,1);break}}}}(m,d,r,n,o,l),d}function ox(t,e){for(var r,i,n=t.s,o=t.p,a=n[1],s=o[1],u=0,c=0;c<a.length;c++)u+=a[c].length-1;var l,h=new Float32Array(6*u),f=e.indexBase,m=e.uvTransform,d=0,p=0,v=0,y=1,g=1;m&&(p=m[0],v=m[1],y=(l=m[4])?m[3]:m[2],g=l?m[2]:m[3]);for(var x=[0,0],T=0===l?0:-Math.PI/2,E=0;E<a.length;E++)for(var b=a[E],_=s[E],C=s[E+1]||s[0],S=[0,0],A=0;A<b.length-1;A++)(function(t,e,r,i,n,o,a,s){var u=1-e,c=u*u*u,l=3*e*u*u,h=3*e*e*u,f=e*e*e;t[0]=c*r[0]+l*n+h*a+f*i[0],t[1]=c*r[1]+l*o+h*s+f*i[1]})(S,b[A],_,C,_[4],_[5],C[2],C[3]),r=S[0],i=S[1],h[d++]=r/2,h[d++]=i/2,m?(x[0]=r,x[1]=i,oE(x,x,T),h[d++]=p+(x[0]+1)/2*y,h[d++]=v+(x[1]+1)/2*g):(h[d++]=(r+1)/2,h[d++]=(i+1)/2),d+=2;var R=og(Array.from(h),null,6,void 0===f?0:f);return{aPoint:h,index:new Uint16Array(R)}}function oT(t,e){for(var r,i=[],n=(r=[],t.gs?t.gs.forEach(function(t){r.push({p:[tR.SHAPE_POINTS,t.p],s:[tR.SHAPE_SPLITS,t.s]})}):t.g?r.push({p:[tR.SHAPE_POINTS,t.g.p],s:[tR.SHAPE_SPLITS,t.g.s]}):r.push(t),r),o=0,a=0,s=0,u=0;u<n.length;u++){var c=ox(n[u],{indexBase:o,uvTransform:e});o+=c.aPoint.length/5,i.push(c),a+=c.aPoint.length,s+=c.index.length}if(1===i.length)return i[0];for(var l=new Float32Array(a),h=new Uint16Array(s),f=0,m=0,d=0;f<i[f];f++){var p=i[f];l.set(p.aPoint,m),m+=p.aPoint.length,h.set(p.index,d),d+=p.index.length}return{aPoint:l,index:h}}function oE(t,e,r){var i=Math.cos(r),n=Math.sin(r),o=e[0],a=e[1];return t[0]=i*o+n*a,t[1]=-n*o+i*a,t}var ob=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+r||1,this.count=er(i,iA)?i:ik(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,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(this)},t}(),o_=function(t){this.content=t},oC=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 r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new o_(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(0>=this.sort(r.content,e.content)))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new o_(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(0>=this.sort(e.content,r.content)))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.next=null)}else if(t){var n=t.pre,o=t.next;n.next=o,o&&(o.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var r=this.first,i=0;if(r)do t.call(e||this,r.content,i++);while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do t.call(e||this,r.content,i--);while(r=r.pre)},t}(),oS=new eK,oA=new eK,oR=function(){function e(e,r){this.pointStart=[];var i,n=r.colorOverLifetime,o=r.colorOverTrail,a=r.maxTrailCount,s=r.opacityOverLifetime,u=void 0===s?ik(1):s,c=r.widthOverTrail,l=r.name,h=r.occlusion,f=r.blending,m=r.maskMode,d=r.textureMap,p=r.texture,v=r.transparentOcclusion,y=r.minimumVertexDistance,g=r.lifetime,x=r.matrix,T=e.gpuCapability,E=T.detail,b=T.level,_=Math.max(r.pointCountPerTrail,2),C=iX(),S=E.maxVertexTextures>0,A=(null!=(i=e.renderer)?i:{}).env,R={},w=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===rx]],O=a>64,M=0;n&&(w.push(["COLOR_OVER_LIFETIME",!0]),M|=1,R.uColorOverLifetime=rq.createWithData(e,eT(n))),o&&(w.push(["COLOR_OVER_TRAIL",!0]),M|=4,R.uColorOverTrail=rq.createWithData(e,eT(o))),O?(w.push(["ATTR_TRAIL_START",1]),M|=8):R.uTrailStart=new Float32Array(a),R.uOpacityOverLifetimeValue=u.toUniform(C);var I=c.toUniform(C);w.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),R.uVCurveValues=iA.getAllData(C);var L={shader:{vertex:ni,fragment:ne,macros:w,glslVersion:1===b?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+l,cacheId:"-t:+"+M+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=_*a*2,V=(_-1)*a,F=Float32Array.BYTES_PER_ELEMENT,z=12*F,N={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*P)},aSeed:{size:1,stride:z,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:z,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#"+l,bufferUsage:rb.DYNAMIC_DRAW};if(O)N.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var D=new Float32Array(P);N.attributes.aTrailStartIndex={size:1,data:D};for(var k=0;k<a;k++)for(var U=2*_,B=k*U,G=0;G<U;G++)D[B+G]=k}var X=rS(f),H=r6.create(e,L);H.blending=!0,H.depthMask=h,H.depthTest=!0,rM(H,m),rw(H,f);var j=this.mesh=i4.create(e,{name:"MTrail_"+l,material:H,geometry:i1.create(e,N)}),W=null!=p?p:rq.createWithData(e);Object.keys(R).map(function(t){var e=R[t];if(er(e,rq))H.setTexture(t,e);else if("uTrailStart"===t)H.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var r=[],i=0;i<e.length;i+=4){var n=new rf(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}H.setVector4Array(t,r)}else H.setVector4(t,rf.fromArray(e))}),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",rf.fromArray(I)),H.setVector2("uTexOffset",new eQ(0,0)),H.setVector4("uTextureMap",rf.fromArray(void 0===d?[0,0,1,1]:d)),H.setVector4("uParams",new rf(0,_-1,0,0)),H.setTexture("uMaskTex",W),H.setVector4("uColorParams",new rf(p?1:0,+X,0,+(h&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=O,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=j.firstGeometry(),this.trailCursors=new Uint16Array(a)}var r=e.prototype;return r.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,c=(i-2)%n,l=this.getTrailPosition(t,u,oS);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=oI(l,e),m=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],p=r.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),o.setAttributeSubData("aDir",6*h,v),o.setAttributeSubData("aTime",2*h,new Float32Array([m,m]));var y=r.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(d,4),g[7]=0,g.set(x,8),g[11]=.5*p,g.set(y,12),g.set(d,16),g[19]=1,g.set(x,20),g[23]=-.5*p,o.setAttributeSubData("aColor",24*h,g),u>=0){var T=new Float32Array(oI(this.getTrailPosition(t,c,oA),l,e)),E=(t*n+u)*6;o.setAttributeSubData("aDir",E,T),o.setAttributeSubData("aDir",E+3,T);var b=t*n*2,_=new Uint16Array([2*u+b,2*u+1+b,2*s+b,2*s+b,2*u+1+b,2*s+1+b]),C=(t*a+(i-1)%a)*6;o.setIndexSubData(C,_)}i=++this.trailCursors[t];var S=this.mesh.material,A=S.getVector4("uParams"),R=d[2];if(this.useAttributeTrailStart){for(var w=2*n,O=new Float32Array(w),M=0;M<w;M++)O[M]=R;o.setAttributeSubData("aTrailStart",t*O.length,O)}else{var I=S.getFloats("uTrailStart");void 0!=I&&(I[t]=R,S.setFloats("uTrailStart",I))}A&&(A.y=Math.max(A.y,i-1)-Math.max(0,i-n),S.setVector4("uParams",A))}},r.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=(t*i+e)*24+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},r.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},r.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},r.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,r=this.geometry.getIndexData();r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},r.getPointStartPos=function(t){return this.pointStart[t]},r.setPointStartPos=function(t,e){this.pointStart[t]=e},r.onUpdate=function(t){},eU(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}(),ow=new eK,oO=new eK,oM=new eK;function oI(t,e,r){return t||r?(t?r?(oO.subtractVectors(e,t).normalize(),oO.subtractVectors(r,e),oM.copyFrom(oO).normalize(),ow.addVectors(oO,oM)):ow.subtractVectors(e,t):ow.subtractVectors(r,e),ow.normalize().toArray()):[0,0,0]}var oL=function(t){function e(e,r,i){(n=t.call(this,e)||this).name="ParticleSystemRenderer",r&&(n.particleMesh=new oj(e,r)),i&&(n.trailMesh=new oR(e,i));var n,o=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(o.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=o,n}eG(e,t);var r=e.prototype;return r.start=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=eH(this.meshes);!(t=e()).done;)t.value.start()},r.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new rf(e,this.item.duration,0,0))},r.render=function(t){for(var e,r=eH(this.meshes);!(e=r()).done;)e.value.render(t)},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(r){t.push(e[r])}),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach(function(e){t.push(r[e])})}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(rr);t.ParticleSystem=function(e){function r(r,i){var n;return(n=e.call(this,r)||this).destroyed=!1,n.getHitTestParams=function(e){var r=n.interaction;if(e||r)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==r?void 0:r.radius)||.4,multiple:!!(null==r?void 0:r.multiple),removeParticle:(null==r?void 0:r.behavior)===tI.removeParticle,ray:t})}}},i&&n.fromData(i),n}eG(r,e);var i=r.prototype;return i.isFrozen=function(){return this.frozen},i.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===tR.CONSTANT_VEC3?e.add(i[1]):t=ik(i)),this.basicTransform={position:e,rotation:r,path:t};var n=this.transform.parentTransform,o=e.clone();if(t&&o.add(t.getValue(0)),this.transform.setPosition(o.x,o.y,o.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},i.updateEmitterTransform=function(t){var e=this.transform.parentTransform,r=this.basicTransform,i=r.path,n=r.position.clone();if(i){var o=this.item.duration;n.add(i.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},i.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new rf(n[0],n[1],n[2],t));for(var o=i.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},i.setColor=function(t,e,r,i){var n,o=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,s=(null==(n=o.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new rf(s[0],s[1],s[2],i));for(var u=a.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=r,u[8*c+7]=i},i.setParentTransform=function(t){},i.getTextures=function(){return this.renderer.getTextures()},i.start=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.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 oC(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1},i.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,o=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var a=this.particleLink,s=(r-n)/this.item.duration,u=this.timePassed,c=!1,l=function(){e.trails&&!c&&(c=!0,a.forEach(function(t){var r=t[0],i=t[1],n=t[2],o=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,s,o,n)}))};if(this.ended){if(this.item.endBehavior!==tO.loop&&tO.destroy===this.item.endBehavior){var h=a.last;h&&h.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,m=this.lifetime;if(u<f){var d=1/o.rateOverTime.getValue(m),p=Math.floor((u-this.lastEmitTime)/d),v=d/p,y=i.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<p&&x<y&&!g();x++){var T=this.createPoint(m);T.delay+=r+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var E=o.bursts,b=(null==E?void 0:E.length)-1,_=0;b>=0&&_<y&&!g();b--){var C=E[b],S=!C.disabled&&C.getGeneratorOptions(u,m);if(S){var A=[0,0,0],R=o.burstOffsets[b],w=R&&R[S.cycleIndex]||A;C.once&&this.removeBurst(b);for(var O=0;O<S.count&&_<y&&!g();O++){var M,I=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:O,burstCount:S.count}));I.delay+=r,_++,(M=I.transform).translate.apply(M,[].concat(w)),this.addParticle(I,y)}}}}else this.item.endBehavior===tO.loop?(l(),this.loopStartTime=r-f,this.lastEmitTime-=f,this.lastUpdate-=f,o.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.onIterate(this)):(this.ended=!0,this.onEnd(this),this.item.endBehavior===tO.freeze&&(this.frozen=!0))}l()}},i.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}})}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!(t&&e))return r;for(var o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);r.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},i.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],o=new eK,a=!1;if(i&&i.content)do{var s=i.content,u=s[0],c=s[1];s[2];var l=s[3];if(u>this.timePassed){var h=this.getPointPosition(l),f=t.ray,m=!1;f&&(m=!!f.intersectSphere({center:h,radius:t.radius},o)),m&&(t.removeParticle&&(r.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(i),i.content=[0]),n.push(h),t.multiple||(a=!0))}else break}while((i=i.pre)&&!a);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var o=this.trails,a=this.getPointPosition(r),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),c=1,l=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(c*=u[0]),o.sizeAffectsLifetime&&(l*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var h=n.getTrailStartPosition(t);h&&a.subtract(h)}n.addTrailPoint(t,a,{color:s,lifetime:l,size:c,time:i})}},i.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=this.options.forceTarget,s=this.lastUpdate-n,u=new eK,c=eK.fromArray(void 0===o?[]:o);e.assignWorldTRS(u);var l=ie(new eK,this.options,c,s,i,u,r);if(a){var h=a.target||[0,0,0],f=a.curve.getValue(s/i),m=1-f;l.x=l.x*m+h[0]*f,l.y=l.y*m+h[1]*f,l.z=l.z*m+h[2]*f}return l},i.onEnd=function(t){},i.onIterate=function(t){},i.initPoint=function(t){var e,r,i,n,o=this.options,a=this.lifetime,s=this.shape,u=o.startSpeed.getValue(a),c=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),l=t.position,h=new nQ({position:c.transformPoint(l,new eK),valid:!0}),f=t.direction;if(f=c.transformNormal(f,oP).normalize(),o.startTurbulence&&o.turbulence){for(var m=0;m<3;m++)oD.setElement(m,o.turbulence[m].getValue(a));ok.setFromVector3(oD.negate()),oB.setFromEuler(ok).transformNormal(f).normalize()}s.alignSpeedDirection?(oN.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=eK.Z.clone(),c.transformNormal(this.upDirectionWorld)),oz.crossVectors(oN,this.upDirectionWorld).normalize(),oz.isZero()&&oz.set(1,0,0)):(oz.set(1,0,0),oN.set(0,1,0));var d=this.textureSheetAnimation;d&&d.animate&&((n=oU)[0]=d.animationDelay.getValue(a),n[1]=d.animationDuration.getValue(a),n[2]=d.cycles.getValue(a)),o.start3DRotation?oF.set(o.startRotationX.getValue(a),o.startRotationY.getValue(a),o.startRotationZ.getValue(a)):o.startRotation?oF.set(0,0,o.startRotation.getValue(a)):oF.set(0,0,0),h.setRotation(oF.x,oF.y,oF.z);var p=o.startColor.getValue(a);if(3===p.length&&(p[3]=1),o.start3DSize)oV.x=o.startSizeX.getValue(a),oV.y=o.startSizeY.getValue(a);else{var v=o.startSize.getValue(a),y=o.sizeAspect.getValue(a);oV.x=v,oV.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!o.particleFollowParent){var x=new eK;this.transform.assignWorldTRS(void 0,void 0,x),oV.x*=x.x,oV.y*=x.y}return h.setScale(oV.x,oV.y,1),{size:oV,vel:g,color:p,delay:o.startDelay.getValue(a),lifetime:o.startLifetime.getValue(a),uv:(r=Math.floor(Math.random()*(e=this.uvs).length),i=e[r],i),gravity:o.gravity,sprite:n,dirY:oN,dirX:oz,transform:h}},i.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&er(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return -1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.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))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var r,i,n,o,a,s,u,c,l,h,f,m,d=t.options,p=t.positionOverLifetime,v=void 0===p?{}:p,y=t.shape,g=null==v?void 0:v.gravityOverLifetime,x=ir(null==v?void 0:v.gravity),T=t.textureSheetAnimation,E=T?{animationDelay:ik(T.animationDelay||0),animationDuration:ik(T.animationDuration||1),cycles:ik(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,b=!!(y&&y.turbulenceX||(null==y?void 0:y.turbulenceY)||(null==y?void 0:y.turbulenceZ));b&&(n=[ik(null!=(o=y.turbulenceX)?o:0),ik(null!=(a=y.turbulenceY)?a:0),ik(null!=(s=y.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=oe(y),this.emission={rateOverTime:ik(t.emission.rateOverTime),burstOffsets:(r=null!=(u=t.emission.burstOffsets)?u:[],i={},Array.isArray(r)&&r.forEach(function(t){var e=er(t,Array),r=e?t[0]:t.index,n=i[r];n||(n=i[r]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),i),bursts:(t.emission.bursts||[]).map(function(t){return new ob(t)})},this.textureSheetAnimation=E;var _=t.renderer||{},C={},S=t.rotationOverLifetime;S&&(C.asRotation=!!S.asRotation,C.z=S.z?ik(S.z):ik(0),S.separateAxes&&(C.x=S.x&&ik(S.x),C.y=S.y&&ik(S.y))),(null==v?void 0:v.forceTarget)&&(c={target:v.target||[0,0,0],curve:ik(v.forceCurve||[tR.LINE,[[0,0],[1,1]]])});var A={x:v.linearX&&ik(v.linearX||0),y:v.linearY&&ik(v.linearY||0),z:v.linearZ&&ik(v.linearZ||0),asMovement:v.asMovement},R={x:v.orbitalX&&ik(v.orbitalX),y:v.orbitalY&&ik(v.orbitalY),z:v.orbitalZ&&ik(v.orbitalZ),center:v.orbCenter,asRotation:v.asRotation},w=t.sizeOverLifetime||{},O=t.colorOverLifetime,M=(null==w?void 0:w.separateAxes)?{separateAxes:!0,x:ik(w.x),y:ik(w.y)}:{separateAxes:!1,x:ik(("size"in w?w.size:w.x)||1)};_.anchor=_.anchor||[0,0];var I=eQ.fromArray(_.anchor);this.options={particleFollowParent:!!d.particleFollowParent,startLifetime:ik(d.startLifetime),startDelay:ik(d.startDelay||0),startSpeed:ik(v.startSpeed||0),startColor:ik(d.startColor),looping:!1,maxCount:null!=(l=d.maxCount)?l:0,gravityModifier:ik(g||0),gravity:x,start3DSize:!!d.start3DSize,startTurbulence:b,turbulence:n,speedOverLifetime:v.speedOverLifetime&&ik(v.speedOverLifetime),linearVelOverLifetime:A,orbitalVelOverLifetime:R,forceTarget:c},d.startRotationZ&&(this.options.startRotation=ik(d.startRotationZ||0)),(d.startRotationX||d.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=ik(d.startRotationX||0),this.options.startRotationY=ik(d.startRotationY||0),this.options.startRotationZ=ik(d.startRotationZ||0)),d.start3DSize?(this.options.startSizeX=ik(d.startSizeX),this.options.startSizeY=ik(d.startSizeY)):(this.options.startSize=ik(d.startSize),this.options.sizeAspect=ik(d.sizeAspect||1));var L={meshSlots:d.meshSlots,name:this.name,matrix:e$.IDENTITY,shaderCachePrefix:"",renderMode:_.renderMode||tT.BILLBOARD,side:_.side||tm.DOUBLE,gravity:x,blending:_.blending||tf.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!_.occlusion,transparentOcclusion:!!_.transparentOcclusion,maxCount:d.maxCount,mask:_.mask,maskMode:null!=(h=_.maskMode)?h:td.NONE,forceTarget:c,diffuse:_.texture,sizeOverLifetime:M,anchor:I};if(O){var P=O.color,V=O.opacity;L.colorOverLifetime={},V&&(L.colorOverLifetime.opacity=ik(O.opacity)),P&&(P[0]===tR.GRADIENT_COLOR?L.colorOverLifetime.color=O.color[1]:P[0]===tR.RGBA_COLOR?L.colorOverLifetime.color=rq.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):er(P,rq)&&(L.colorOverLifetime.color=P))}var F=[],z=[0,0,1,1];if(t.splits){var N=t.splits[0];z=(f=N[4])?[N[0],N[1],N[3],N[2]]:[N[0],N[1],N[2],N[3]]}if(E&&!E.animate)for(var D=f?E.row:E.col,k=f?E.col:E.row,U=E.total||D*k,B=0,G=0;G<D;G++)for(var X=0;X<k&&B<U;X++,B++)F.push([G*z[2]/D+z[0],X*z[3]/k+z[1],z[2]/D,z[3]/k]);else F.push(z);this.uvs=F,L.textureFlip=f;var H=t.trails;H&&(this.trails={lifetime:ik(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},m={name:"Trail",matrix:e$.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:d.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture,opacityOverLifetime:ik(H.opacityOverLifetime||1),widthOverTrail:ik(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:_.mask,maskMode:_.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tR.GRADIENT_COLOR&&(m.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tR.GRADIENT_COLOR&&(m.colorOverTrail=H.colorOverTrail[1])),this.renderer=new oL(this.engine,L,m),this.meshes=this.renderer.meshes;var j=t.interaction;j&&(this.interaction={multiple:j.multiple,radius:j.radius,behavior:j.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this,this.renderer.item=this.item,this.item.components.push(this.renderer),this.item.rendererComponents.push(this.renderer)},eU(r,[{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}}]),r}(e7),t.ParticleSystem=en([e5(tH.ParticleSystem)],t.ParticleSystem);var oP=new eK,oV=new eQ,oF=new e0,oz=new eK,oN=new eK,oD=new eK,ok=new e0,oU=[0,0,0],oB=new e$,oG=function(e){function r(){return e.apply(this,arguments)}eG(r,e);var i=r.prototype;return i.start=function(e){var r=e.output.getUserData();!this.particleSystem&&er(r,t.VFXItem)&&(this.particleSystem=r.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=r.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform()))},i.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){e.setVisible(!0);var r=t.deltaTime;this.time<e.item.duration&&e.isFrozen()&&e.reset(),e.onUpdate(r)}},r}(nD),oX=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createPlayable=function(t){return new oG(t)},e}(nU),oH={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"},oj=function(){function e(e,r){this.particleCount=0;var i,n,o,a,s,u,c,l,h,f=(null!=(c=e.renderer)?c:{}).env,m=r.speedOverLifetime,d=r.colorOverLifetime,p=r.linearVelOverLifetime,v=r.orbitalVelOverLifetime,y=r.sizeOverLifetime,g=r.rotationOverLifetime,x=r.sprite,T=r.gravityModifier,E=r.maxCount,b=r.textureFlip,_=r.useSprite,C=r.name,S=r.gravity,A=r.forceTarget,R=r.side,w=r.occlusion,O=r.anchor,M=r.blending,I=r.maskMode,L=r.mask,P=r.transparentOcclusion,V=r.meshSlots,F=r.renderMode,z=void 0===F?0:F,N=r.diffuse,D=void 0===N?rq.createWithData(e):N,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+z],["ENV_EDITOR",f===rx]],X=e.gpuCapability.level,H=iX(),j=iX(),W=B>0,Y={},Z=0,q=0;this.useSprite=_,W&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),m&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,Y.uSpeedLifetimeValue=m.toUniform(H)),(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==d?void 0:d.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,Y.uColorOverLifetime=er(d.color,rq)?d.color:rq.createWithData(e,eT(d.color))),(null==d?void 0:d.opacity)?Y.uOpacityOverLifetimeValue=d.opacity.toUniform(H):Y.uOpacityOverLifetimeValue=ik(1).toUniform(H),["x","y","z"].forEach(function(t,e){var r=0,i=0;(null==p?void 0:p[t])&&(Y["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=p[t].toUniform(H),r=1,q|=1<<7+e,p.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==v?void 0:v[t])&&(Y["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,q|=1<<10+e,l=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),i])}),(null==p?void 0:p.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),l&&((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(H),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,Y.uSizeYByLifetimeValue=null==y?void 0:null==(h=y.y)?void 0:h.toUniform(H)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(H),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(H),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(H),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=T.toUniform(H),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(H)),U&&j.max?(q|=1048576,Y.uFCurveValueTexture=rQ(e,iA.getAllData(j,!0),j.index,1)):Y.uFCurveValues=iA.getAllData(j);var Q=H.max+H.curves.length-32>B;if(2===X&&(H.max=-1,H.index=V?V[0]:oY(H.index),j.index>0&&(j.max=-1,j.index=V?V[1]:oY(j.index))),Q&&U&&W){var K=rQ(e,iA.getAllData(H,!0),H.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=iA.getAllData(H);var J=["-p:",z,q,H.index,H.max,j.index,j.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",j.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",j.max]);var $={fragment:ne,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+nr,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=rS(M);Y.uTexOffset=new Float32Array(D?[1/D.getWidth(),1/D.getHeight()]:[0,0]),Y.uMaskTex=D,Y.uColorParams=new Float32Array([D?1:0,+tt,0,+(!!w&&!P)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var te=r6.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,rM(te,I),rw(te,M),rO(te,R),Object.keys(Y).map(function(t){var e=Y[t];if(er(e,rq)){te.setTexture(t,e);return}var r=[];switch(oH[t]){case"vec4":te.setVector4(t,rf.fromArray(e));break;case"vec3":te.setVector3(t,eK.fromArray(e));break;case"vec2":te.setVector2(t,eQ.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new rf(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}te.setVector4Array(t,r),r.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),te.setVector3("emissionColor",new eK(0,0,0)),te.setFloat("emissionIntensity",0);var tr=i1.create(e,(i=4*E,n=this.useSprite,o="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(a=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*a,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*a,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*a,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*a,data:new Float32Array(0)},aSeed:{size:1,offset:3*a,stride:8*a,dataSource:"aRot"},aColor:{size:4,offset:4*a,stride:8*a,dataSource:"aRot"},aOffset:{size:4,stride:4*a,data:new Float32Array(0)}},n&&(u.aSprite={size:3,stride:3*a,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:o,maxVertex:i})),ti=i4.create(e,{name:"MParticle_"+C,material:te,geometry:tr});this.anchor=O,this.mesh=ti,this.geometry=ti.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=m,this.linearVelOverLifetime=p,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=T,this.maxCount=E,this.textureOffsets=b?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var r=e.prototype;return r.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return[e[r],e[r+1],e[r+2],e[r+3]]},r.getPointPosition=function(t){var e=this.geometry,r=48*t,i=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,u=s.getVector4("uAcceleration").toVector3(),c=eK.fromArray(i,r),l=eK.fromArray(i,r+3),h=ie(new eK,this,u,o,a,c,l);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),m=this.forceTarget.curve.getValue(o/a),d=1-m;h.x=h.x*d+f.x*m,h.y=h.y*d+f.y*m,h.z=h.z*d+f.z*m}return h},r.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},r.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new r.constructor(0))},r.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},r.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},r.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i,n=t+1,o=4*n,a=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)},l=this.useSprite;l&&(c.aSprite=new Float32Array(12));var h=new eK,f=new eJ,m=new eK(1,1,1);e.transform.assignWorldTRS(h,f,m);var d=nQ.getRotation(f,new e0),p=h.toArray(),v=d.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,E=e.color,b=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();l&&(i=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,R=4*C,w=12*C,O=8*C;c.aPos.set(p,w),T.fill(c.aPos,w+3),c.aRot.set(v,O),c.aRot[O+3]=_,c.aRot.set(E,O+4),l&&c.aSprite.set(i,A);var M=e.uv||x;if(M){var I=l?1-y[S+1]:y[S+1];g[0]=M[0]+y[S]*M[2],g[1]=M[1]+I*M[3]}c.aOffset.set(g,R);for(var L=C+C,P=(b[L]-this.anchor.x)*m.x,V=(b[L+1]-this.anchor.y)*m.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 z=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var N=ef(a.getIndexData(),6*n,6*r,u);N.set(z,6*t),a.setIndexData(N),this.maxParticleBufferCount=N.length/6}else a.setIndexSubData(6*t,z);Object.keys(c).forEach(function(e){var i=c[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=ef(a.getAttributeData(e),o*n,4*r*n,u);l.set(i,i.length*t),a.setAttributeData(e,l)}else a.setAttributeSubData(e,i.length*t,i)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),oW=[10,32,64,160];function oY(t){for(var e=0;e<oW.length;e++){var r=oW[e];if(r>t)return r}return t||oW[0]}function oZ(t,e,r){void 0===r&&(r="");var i,n,o,a=t.content,s=+((null==(i=a.renderer)?void 0:i.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",r===rx]],c=e.level,l=e.detail,h=iX(),f=iX(),m=l.maxVertexUniforms>0,d=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,p=0,v=0;m&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,iG(h,d));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&iG(h,x);var T=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[i])&&(iG(h,T[i]),r=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var a=0;(null==T?void 0:T[n])&&(iG(h,T[n]),a=1,v|=1<<10+e,o=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==T?void 0:T.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),o&&(null==T?void 0:T.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var E=a.sizeOverLifetime;E.separateAxes?(iG(h,E.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,iG(h,E.y)):iG(h,E.size)}if(a.rotationOverLifetime){var b=a.rotationOverLifetime;b.z&&(iG(h,null==b?void 0:b.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),b.separateAxes&&(b.x&&(iG(h,b.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),b.y&&(iG(h,b.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==b?void 0:b.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}iG(h,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,iG(h,T.forceCurve));var _=l.halfFloatTexture;_&&f.max&&(v|=1048576);var C=l.maxVertexUniforms,S=h.max+h.curves.length-32>C;nY[nj]&&(S=!0),2===c&&(h.max=-1,f.index>0&&(f.max=-1)),S&&_&&m&&(p=1);var A={fragment:ne,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+nr,shared:!0,cacheId:["-p:",s,v,h.index,h.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:A,vertex:h.index,fragment:f.index}}function oq(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.macros)for(var o=0;o<t.macros.length;o++){var a=t.macros[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var oQ=function(e){function r(){return e.apply(this,arguments)}return eG(r,e),r.precompile=function(e,r,i){var n=r.engine.gpuCapability,o=n.level,a=(null!=i?i:{}).env,s=r.getShaderLibrary(),u=[],c=[],l=0,h=0;return e.forEach(function(e){e.items.forEach(function(e){t.Item.isParticle(e)&&u.push(e)})}),u.forEach(function(e){var r=oZ(e,n,a),i=r.shader,u=r.fragment,f=r.vertex;if(c.push(i),l=Math.max(l,u),h=Math.max(h,f),e.content.trails){var m,d,p,v,y,g,x,T,E,b,_=(m=e.content.trails,d=e.content.options.maxCount,p=e.name,void 0===(v=a)&&(v=""),y=0,g=nY[nj]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===rx]],T=iX(),m.colorOverLifetime&&(x.push(["COLOR_OVER_LIFETIME",!0]),y|=1),m.colorOverTrail&&(x.push(["COLOR_OVER_TRAIL",!0]),y|=4),d>64&&(x.push(["ATTR_TRAIL_START",1]),y|=8),iG(T,m.opacityOverLifetime),iG(T,m.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),{vertex:ni,fragment:ne,macros:x,shared:!0,name:"trail#"+p,cacheId:"-t:+"+y+"+"+T.index+"+"+T.max});_.vertex=rR(null!=(E=_.macros)?E:[],_.vertex,t.ShaderType.vertex,o),_.fragment=rR(null!=(b=_.macros)?b:[],_.fragment,t.ShaderType.fragment,o),_.glslVersion=2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,s.addShader(_)}}),c.forEach(function(e){var r,i;2===o?(oq(e,h,l),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=rR(null!=(r=e.macros)?r:[],e.vertex,t.ShaderType.vertex,o),e.fragment=rR(null!=(i=e.macros)?i:[],e.fragment,t.ShaderType.fragment,o),s.addShader(e)}),2===o&&u.forEach(function(t){t.content.options.meshSlots=[h,l]}),Promise.resolve()},r}(ri),oK=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ri);function oJ(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o$=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},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(er(e,o0))return e.animationStream},t}(),o0=function(t){function e(e){var r;return(r=t.call(this,e)||this).animationStream=new o$(oJ(r)),r}return eG(e,t),e}(nD),o1=new e0,o2=new eK(1,1,1),o3=new eK,o4=function(e){function r(){return e.apply(this,arguments)}eG(r,e);var i=r.prototype;return i.start=function(){var t,e=this.binding,r=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new eK(r.x,r.y,r.x)};var i=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,o=this.data.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=ik(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&ik(i.linearX),y:i.linearY&&ik(i.linearY),z:i.linearZ&&ik(i.linearZ),asMovement:i.asMovement,enabled:!!a});var s=i.orbitalX||i.orbitalY||i.orbitalZ;s&&(this.orbitalVelOverLifetime={x:i.orbitalX&&ik(i.orbitalX),y:i.orbitalY&&ik(i.orbitalY),z:i.orbitalZ&&ik(i.orbitalZ),center:ir(i.orbCenter),asRotation:i.asRotation,enabled:!!s}),this.speedOverLifetime=i.speedOverLifetime&&ik(i.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=ik(o.x||1),this.sizeYOverLifetime=ik(o.y||1),this.sizeZOverLifetime=ik(o.z||1)):this.sizeXOverLifetime=ik(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:ik(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=ik(n.x||0),u.y=ik(n.y||0)}this.gravity=eK.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=ik(null!=(t=null==i?void 0:i.gravityOverLifetime)?t:0),this.direction=(null==i?void 0:i.direction)?eK.fromArray(i.direction).normalize():new eK,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(e){if(!this.binding){var r=e.output.getUserData();er(r,t.VFXItem)&&(this.binding=r,this.start())}this.binding&&this.binding.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.binding,r=e.duration,i=this.time/r;if(i=i<0?0:i>1?1:i,this.sizeXOverLifetime){o2.x=this.sizeXOverLifetime.getValue(i),this.sizeSeparateAxes?(o2.y=this.sizeYOverLifetime.getValue(i),o2.z=this.sizeZOverLifetime.getValue(i)):o2.z=o2.y=o2.x;var n=this.originalTransform.scale;e.transform.setScale(o2.x*n.x,o2.y*n.y,o2.z*n.z)}if(this.rotationOverLifetime){var o=function(e){return t.rotationOverLifetime.asRotation?e.getValue(i):e.getIntegrateValue(0,i,r)},a=o(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;o1.x=s?o(this.rotationOverLifetime.x):0,o1.y=s?o(this.rotationOverLifetime.y):0,o1.z=a;var u=o1.addEulers(this.originalTransform.rotation,o1);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(ie(o3,this,this.gravity,this.time,r,this.originalTransform.position,this.velocity),this.originalTransform.path&&o3.add(this.originalTransform.path.getValue(i)),e.transform.setPosition(o3.x,o3.y,o3.z))},r}(o0);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new o4(t);return e.data=this.transformAnimationData,e},r.fromData=function(t){this.transformAnimationData=t},e}(nU),t.TransformPlayableAsset=en([e5("TransformPlayableAsset")],t.TransformPlayableAsset);var o5=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.processFrame=function(t){},e}(nD);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createPlayable=function(t){return new o5(t)},e}(nU),t.ActivationPlayableAsset=en([e5("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}eG(e,t);var r=e.prototype;return r.sampleAnimation=function(t,e){var r=e/t.duration;r=r<0?0:r>1?1:r;for(var i,n=eH(this.positionCurves);!(i=n()).done;){var o=i.value,a=o.keyFrames.getValue(r),s=this.findTarget(t,o.path);null==s||s.transform.setPosition(a.x,a.y,a.z)}for(var u,c=eH(this.rotationCurves);!(u=c()).done;){var l=u.value,h=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(h.x,h.y,h.z,h.w)}for(var m,d=eH(this.scaleCurves);!(m=d()).done;){var p=m.value,v=p.keyFrames.getValue(r),y=this.findTarget(t,p.path);null==y||y.transform.setScale(v.x,v.y,v.z)}},r.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,r=eH(t.positionCurves);!(e=r()).done;){var i=e.value,n={path:i.path,keyFrames:ik(i.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var o,a=eH(t.rotationCurves);!(o=a()).done;){var s=o.value,u={path:s.path,keyFrames:ik(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var c,l=eH(t.scaleCurves);!(c=l()).done;){var h=c.value,f={path:h.path,keyFrames:ik(h.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var m,d=eH(t.floatCurves);!(m=d()).done;){var p=m.value,v={path:p.path,keyFrames:ik(p.keyFrames),property:p.property,className:p.className};this.duration=Math.max(this.duration,v.keyFrames.getMaxTime()),this.floatCurves.push(v)}},r.findTarget=function(t,e){for(var r,i=t,n=eH(e);!(r=n()).done;){for(var o,a=r.value,s=!1,u=eH(i.children);!(o=u()).done;){var c=o.value;if(c.name===a){i=c,s=!0;break}}if(!s)return}return i},e}(e9),t.AnimationClip=en([e5(tH.AnimationClip)],t.AnimationClip);var o6=function(e){function r(){return e.apply(this,arguments)}return eG(r,e),r.prototype.processFrame=function(e){var r=e.output.getUserData();er(r,t.VFXItem)&&r.composition&&this.clip.sampleAnimation(r,this.time)},r}(nD),o8=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,r=this.duration;return e-r>.001&&(this.endBehavior===tO.loop?e%=r:this.endBehavior===tO.freeze&&(e=Math.min(r,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}eG(e,t);var r=e.prototype;return r.resolveBinding=function(t){return t},r.createTrackMixer=function(t){return new nD(t)},r.createOutput=function(){return new nk},r.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},r.createMixerPlayableGraph=function(t,e){for(var r,i=[],n=eH(this.clips);!(r=n()).done;){var o=r.value;i.push(o)}return this.compileClips(t,i,e)},r.compileClips=function(t,e,r){for(var i,n=this.createTrackMixer(t),o=eH(e);!(i=o()).done;){var a=i.value,s=this.createClipPlayable(t,a),u=new o9(a,s,n,this);r.push(u),n.addInput(s,0),n.setInputWeight(s,0)}return n},r.createPlayable=function(t){return new nD(t)},r.getChildTracks=function(){return this.children},r.addChild=function(t){this.children.push(t)},r.createClip=function(t,e){var r=new o8;return r.asset=new t(this.engine),r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=eH(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},r.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},e}(nU),en([e8(o8,void 0)],t.TrackAsset.prototype,"clips",void 0),en([e8(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=en([e5("TrackAsset")],t.TrackAsset),t.TrackType=void 0,(ta=t.TrackType||(t.TrackType={}))[ta.MasterTrack=0]="MasterTrack",ta[ta.ObjectTrack=1]="ObjectTrack";var o9=function(){function e(e,r,i,n){this.clip=e,this.playable=r,this.parentMixer=i,this.track=n,er(this.track.binding,t.VFXItem)&&(this.particleSystem=this.track.binding.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var r=this.clip,i=1,n=!1,o=!1,a=this.track.binding;e>r.start+r.duration+.001&&r.endBehavior===tO.destroy?er(a,t.VFXItem)&&t.VFXItem.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?i=1:(i=0,n=!0):e-this.clip.start>=0?(i=1,o=!0):e<r.start&&(i=0),o&&this.playable.getPlayState()!==t0.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,i),n&&(!er(a,t.VFXItem)||a.ended||(a.ended=!0,a.onEnd(),a.compositionReusable||a.reusable||(a.dispose(),this.playable.dispose())),this.playable.getPlayState()===t0.Playing&&this.playable.pause());var s=r.toLocalTime(e);this.playable.setTime(s)},eU(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}();t.ObjectBindingTrack=function(e){function r(){return e.apply(this,arguments)}return eG(r,e),r.prototype.create=function(e){var r=this.binding;if(r.getComponent(t.ParticleSystem)){var i=e.createTrack(t.TrackAsset,this,"ParticleTrack");i.binding=this.binding;var n=i.createClip(oX);n.start=r.start,n.duration=r.duration,n.endBehavior=r.endBehavior}},r}(t.TrackAsset),t.ObjectBindingTrack=en([e5("ObjectBindingTrack")],t.ObjectBindingTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(t.TrackAsset),t.TransformTrack=en([e5("TransformTrack")],t.TransformTrack);var o7=function(e){function r(){return e.apply(this,arguments)}eG(r,e);var i=r.prototype;return i.processFrame=function(e){var r=e.output.getUserData();if(er(r,t.VFXItem)){for(var i=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){i=!0;break}i?(r.transform.setValid(!0),this.showRendererComponents(r)):(r.transform.setValid(!1),this.hideRendererComponents(r))}},i.hideRendererComponents=function(t){for(var e,r=eH(t.rendererComponents);!(e=r()).done;){var i=e.value;i.enabled&&(i.enabled=!1)}},i.showRendererComponents=function(t){for(var e,r=eH(t.rendererComponents);!(e=r()).done;){var i=e.value;i.enabled||(i.enabled=!0)}},r}(nD);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createTrackMixer=function(t){return new o7(t)},e}(t.TrackAsset),t.ActivationTrack=en([e5("ActivationTrack")],t.ActivationTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(t.TrackAsset),t.SpriteColorTrack=en([e5("SpriteColorTrack")],t.SpriteColorTrack),t.TimelineAsset=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t}eG(r,e);var i=r.prototype;return i.createPlayable=function(e){var r=new at(e);r.setTraversalMode(t1.Passthrough);for(var i,n=eH(this.tracks);!(i=n()).done;){var o=i.value;er(o,t.ObjectBindingTrack)&&o.create(this)}return r.compileTracks(e,this.tracks),r},i.createTrack=function(t,e,r){var i=new t(this.engine);return i.name=r||t.name,e.addChild(i),i},i.fromData=function(t){},r}(nU),en([e8(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=en([e5("TimelineAsset")],t.TimelineAsset);var at=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e}eG(e,t);var r=e.prototype;return r.prepareFrame=function(t){this.evaluate()},r.evaluate=function(){for(var t,e=this.getTime(),r=eH(this.clips);!(t=r()).done;)t.value.evaluateAt(e)},r.compileTracks=function(t,e){this.sortTracks(e);for(var r,i=[],n=eH(e);!(r=n()).done;){var o=r.value;i.push(o),this.addSubTracksRecursive(o,i)}for(var a,s=eH(i);!(a=s()).done;){var u=a.value,c=u.createPlayableGraph(t,this.clips);this.addInput(c,0);var l=u.createOutput();l.setUserData(u.binding),t.addOutput(l),l.setSourcePlayeble(this,this.getInputCount()-1)}},r.sortTracks=function(t){for(var e=[],r=0;r<t.length;r++)e.push(new ae(t[r],r));e.sort(ai),t.length=0;for(var i,n=eH(e);!(i=n()).done;){var o=i.value;t.push(o.track)}},r.addSubTracksRecursive=function(t,e){for(var r,i=eH(t.getChildTracks());!(r=i()).done;){var n=r.value;e.push(n)}for(var o,a=eH(t.getChildTracks());!(o=a()).done;){var s=o.value;this.addSubTracksRecursive(s,e)}},e}(nD),ae=function(t,e){this.track=t,this.originalIndex=e};function ar(t,e){for(var r=e.parent;r;){if(r===t)return!0;r=r.parent}return!1}function ai(e,r){var i=e.track.binding,n=r.track.binding;return er(i,t.VFXItem)&&er(n,t.VFXItem)?ar(i,n)?-1:ar(n,i)?1:e.originalIndex-r.originalIndex:e.originalIndex-r.originalIndex}var an=function(e){function r(){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 nN,t}eG(r,e);var i=r.prototype;return i.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tO.destroy&&this.setReusable(!0)},i.setReusable=function(e){for(var i,n=eH(this.timelineAsset.tracks);!(i=n()).done;){var o=i.value,a=o.binding;if(er(a,t.VFXItem)){er(o,t.ObjectBindingTrack)&&(a.reusable=e);var s=a.getComponent(r);s&&s.setReusable(e)}}},i.getReusable=function(){return this.reusable},i.update=function(t){var e=this.time;this.item.isEnded(this.time)&&!this.item.parent&&(this.item.ended=!0),this.timelinePlayable.setTime(e),this.graph.evaluate(t)},i.createContent=function(){for(var e,i=[],n=eH(this.data.sceneBindings);!(e=n()).done;){var o=e.value;i.push({key:this.engine.assetLoader.loadGUID(o.key.id),value:this.engine.assetLoader.loadGUID(o.value.id)})}this.sceneBindings=i;var a=this.data.timelineAsset?this.engine.assetLoader.loadGUID(this.data.timelineAsset.id):new t.TimelineAsset(this.engine);this.timelineAsset=a;var s=this.items;if(this.items.length=0,this.item.composition)for(var u=this.item.engine.assetLoader,c=this.item.props.items?this.item.props.items:[],l=0;l<c.length;l++){var h=void 0,f=c[l];if(t.Item.isComposition(f)){var m=f.content.options.refId,d=this.item.composition.refCompositionProps.get(m);if(!d)throw Error("Referenced precomposition with Id: "+m+" does not exist.");d.content=f.content,(h=u.loadGUID(f.id)).composition=this.item.composition;var p=h.addComponent(r);p.data=d,p.refId=m,h.transform.parentTransform=this.transform,this.item.composition.refContent.push(h),h.endBehavior===tO.loop&&(this.item.composition.autoRefTex=!1),p.createContent();for(var v,y=eH(p.items);!(v=y()).done;){var g=v.value;g.setInstanceId(ez());for(var x,T=eH(g.components);!(x=T()).done;)x.value.setInstanceId(ez())}}else(h=u.loadGUID(f.id)).composition=this.item.composition;h.parent=this.item,h.transform.parentTransform=f.type===tx.camera?new nQ:this.transform,t.VFXItem.isExtraCamera(h)&&(this.item.composition.extraCamera=h),s.push(h)}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},i.hitTest=function(e,r,i,n,o,a){for(var s,u=[],c=(null==a?void 0:a.stop)||ew,l=(null==a?void 0:a.skip)||ew,h=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<h;f++){var m=(s=this,function(a){var h=s.items[a];if(h.getVisible()&&!h.ended&&!t.VFXItem.isComposition(h)&&!l(h)){var f=h.getHitTestParams(o);if(f){var m=!1,d=new eK;if(f.type===t.HitTestType.triangle)for(var p=f.triangles,v=f.backfaceCulling,y=0;y<p.length;y++){var g=p[y];if(e.intersectTriangle(g,d,v)){m=!0,u.push(d);break}}else if(f.type===t.HitTestType.box){var x=f.center,T=f.size,E=x.clone().addScaledVector(T,.5),b=x.clone().addScaledVector(T,-.5);e.intersectBox({min:E,max:b},d)&&(m=!0,u.push(d))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},d)&&(m=!0,u.push(d))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new eQ(r,i));S&&S.length>0&&(S.forEach(function(t){u.push(t)}),m=!0)}if(m){var A={compContent:s.item,id:h.id,name:h.name,position:u[u.length-1],parentId:h.parentId,hitPositions:u,behavior:f.behavior};if(n.push(A),c(A))return{v:n}}}}}(f));if("object"===ei(m))return m.v}return n},i.fromData=function(t){},i.resolveBindings=function(){for(var t,e=eH(this.sceneBindings);!(t=e()).done;){var r=t.value;r.key.binding=r.value}for(var i,n=eH(this.timelineAsset.tracks);!(i=n()).done;){var o=i.value;this.resolveTrackBindingsWithRoot(o)}},i.resolveTrackBindingsWithRoot=function(t){for(var e,r=eH(t.getChildTracks());!(e=r()).done;){var i=e.value;i.binding=i.resolveBinding(t.binding),this.resolveTrackBindingsWithRoot(i)}},r}(re);t.SubCompositionTrack=function(e){function r(){return e.apply(this,arguments)}return eG(r,e),r.prototype.resolveBinding=function(e){if(!er(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(an)},r}(t.TrackAsset),t.SubCompositionTrack=en([e5("SubCompositionTrack")],t.SubCompositionTrack);var ao=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();er(e,an)&&(e.time=this.getTime())},e}(nD);function aa(t,e){return e&&("object"===ei(e)||"function"==typeof e)?e:oJ(t)}t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createPlayable=function(t){return new ao(t)},e}(nU),t.SubCompositionPlayableAsset=en([e5("SubCompositionPlayableAsset")],t.SubCompositionPlayableAsset);var as=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=t.textWidth,i=t.textOverflow,n=void 0===i?tk.display:i,o=t.textBaseline,a=void 0===o?tU.top:o,s=t.textAlign,u=void 0===s?tB.left:s,c=t.text,l=t.letterSpace,h=void 0===l?0:l,f=t.autoWidth,m=t.fontSize,d=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=c.length*(m+h),this.width=void 0===r?100:r,this.height=void 0===e?100:e,this.letterSpace=h,this.overFlow=n,this.textBaseline=a,this.textAlign=u,this.lineHeight=void 0===d?m:d}var e=t.prototype;return e.getOffsetY=function(t,e,r,i){var n=t.outlineWidth,o=t.fontScale,a=(r-i)/3,s=i+n*o,u=r*(e-1),c=0;switch(this.textBaseline){case tU.top:c=s+a;break;case tU.middle:c=(this.height*o-u+s)/2;break;case tU.bottom:c=this.height*o-u-a}return c},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case tB.left:r=t.outlineWidth*t.fontScale;break;case tB.middle:r=(this.width*t.fontScale-e)/2;break;case tB.right:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),au=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,r,i,n,o,a,s=t.textColor,u=t.fontSize,c=t.outline,l=t.shadow,h=t.fontWeight,f=t.fontStyle,m=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===h?"normal":h,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===m?"sans-serif":m,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!=(r=c.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth),l&&(this.hasShadow=!0,this.shadowBlur=null!=(i=l.shadowBlur)?i:2,this.shadowColor=null!=(n=l.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=l.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=l.shadowOffsetY)?a:0),this.fontStyle!==tX.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},ac=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)return this.elements.shift();if(nY[nW])return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?el(this.elements,t):t.remove()},t}()),al=["serif","sans-serif","monospace","courier"];t.TextComponent=function(t){function e(e,r){if((i=t.call(this,e,r)||this).isDirty=!0,i.lineCount=0,i.canvas=ac.getCanvas(),ac.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return aa(i);var i,n=r.options;return i.updateWithOptions(n),i.updateTexture(),i}eG(e,t);var r=e.prototype;return r.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options;this.updateWithOptions(r),this.updateTexture()},r.updateWithOptions=function(t){},r.updateTexture=function(t){},e}(t.SpriteComponent),t.TextComponent=en([e5(tH.TextComponent)],t.TextComponent);var ah=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new au(t),this.textLayout=new as(t),this.text=t.text,this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var r=this.context,i=this.textLayout.letterSpace,n=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,a=1,s=0,u=0;u<t.length;u++){var c,l,h=t[u],f=(null!=(l=null==r?void 0:null==(c=r.measureText(h))?void 0:c.width)?l:0)*n;((s+=i)+f>o&&u>0||"\n"===h)&&(a++,s=0),"\n"!==h&&(s+=f)}return a},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t,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&&!eS(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.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,o=(i.width+r.fontOffset)*n,a=i.height*n,s=r.fontSize*n,u=i.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=o,this.canvas.height=a,e.clearRect(0,0,o,this.canvas.height),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,a),e.scale(1,-1)),e.fillRect(0,0,o,this.canvas.height),r.fontDesc=this.getFontDesc(),e.font=r.fontDesc,r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+r.textColor[0]+", "+r.textColor[1]+", "+r.textColor[2]+", "+r.textColor[3]+")";for(var c=[],l=0,h=i.getOffsetY(r,this.lineCount,u,s),f=[],m=[],d=0;d<this.char.length;d++){var p=this.char[d],v=e.measureText(p);((l+=i.letterSpace*n)+v.width>o&&d>0||"\n"===p)&&(c.push({y:h,width:l,chars:f,charOffsetX:m}),l=0,h+=u,f=[],m=[]),"\n"!==p&&(f.push(p),m.push(l),l+=v.width)}c.push({y:h,width:l,chars:f,charOffsetX:m}),c.forEach(function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach(function(i,o){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[o],t.y),e.fillText(i,n+t.charOffsetX[o],t.y)})}),r.hasShadow&&(e.shadowColor="transparent");var y=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",rq.createWithData(this.engine,{data:new Uint8Array(y.data),width:y.width,height:y.height},{flipY:t,magFilter:rb.LINEAR,minFilter:rb.LINEAR,wrapS:rb.CLAMP_TO_EDGE,wrapT:rb.CLAMP_TO_EDGE})),this.isDirty=!1}},e.getFontDesc=function(){var t=this.textStyle,e=t.fontSize,r=t.fontScale,i=t.fontFamily,n=t.textWeight,o=t.fontStyle,a=""+(e*r).toString()+"px ";return al.includes(i)?a+=i:a+='"'+i+'"',n!==tG.normal&&(a=n+" "+a),o!==tX.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.outlineWidth,n=r[0],o=r[1],a=r[2],s=r[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*o+", "+255*a+", "+s+")",t.lineWidth=2*i)},e.setupShadow=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.shadowBlur,n=e.shadowOffsetX,o=e.shadowOffsetY,a=r[0],s=r[1],u=r[2],c=r[3];t&&(t.shadowColor="rgba("+255*a+", "+255*s+", "+255*u+", "+c+")",t.shadowBlur=i,t.shadowOffsetX=n,t.shadowOffsetY=-o)},t}();eD(t.TextComponent,[ah]);var af=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ri),am=1;t.EffectComponent=function(e){function r(t){var r;return(r=e.call(this,t)||this).worldMatrix=e$.fromIdentity(),r.triangles=[],r.destroyed=!1,r.visible=!1,r.getHitTestParams=function(t){var e=r.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},r.id="Mesh"+am++,r.name="<unnamed>",r._priority=0,r}eG(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.start=function(){this.item.getHitTestParams=this.getHitTestParams},i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},i.getVisible=function(){return this.visible},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[],n=0;n<e.length;n+=3){var o=3*e[n],a=3*e[n+1],s=3*e[n+2],u={x:r[o],y:r[o+1],z:r[o+2]},c={x:r[a],y:r[a+1],z:r[a+2]},l={x:r[s],y:r[s+1],z:r[s+2]};i.push({p0:u,p1:c,p2:l})}return i}(this.geometry),this.hitTestGeometry=this.geometry);for(var r,i=[],n=eH(this.triangles);!(r=n()).done;){var o=r.value;i.push({p0:o.p0,p1:o.p1,p2:o.p2})}return i.forEach(function(t){t.p0=e.transformPoint(t.p0,new eK),t.p1=e.transformPoint(t.p1,new eK),t.p2=e.transformPoint(t.p2,new eK)}),{type:t.HitTestType.triangle,area:i}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},i.toData=function(){this.taggedProperties.id=this.guid},i.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},eU(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(rr),en([e8(void 0,void 0)],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=en([e5(tH.EffectComponent)],t.EffectComponent),t.VFXItem=function(e){function r(t,r){var i;return(i=e.call(this,t)||this).children=[],i.transform=new nQ,i.duration=0,i.start=0,i.ended=!1,i.reusable=!1,i.type=tx.base,i.components=[],i.itemBehaviours=[],i.rendererComponents=[],i.visible=!0,i.speed=1,i.listIndex=0,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=t,r&&i.fromData(r),i}eG(r,e);var i=r.prototype;return i.setSpeed=function(t){this.speed=t},i.getSpeed=function(){return this.speed},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.item=this,e.onAttached(),e},i.getComponent=function(t){for(var e,r,i=eH(this.components);!(r=i()).done;){var n=r.value;if(er(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,r=[],i=eH(this.components);!(e=i()).done;){var n=e.value;er(n,t)&&r.push(n)}return r},i.setParent=function(t){t!==this&&(this.parent&&eh(this.parent.children,this),this.parent=t,t&&(r.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},i.onEnd=function(){},i.setColor=function(t,e,r,i){},i.setOpacity=function(t){},i.getVisible=function(){return this.visible},i.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},i.getWorldTransform=function(t){var e=null!=t?t:new nQ({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var r=this.components[1];if(r.getNodeTransform)return r.getNodeTransform(t)}return this.transform},i.translate=function(t,e,r){this.transform.translate(t,e,r)},i.rotate=function(t,e,r){var i=new e0(t,e,r),n=eJ.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},i.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/s)*o,r)}},i.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},i.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},i.setScale=function(t,e,r){this.transform.setScale(t,e,r)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new eK;return this.transform.assignWorldTRS(t),t},i.isEnded=function(t){return t-this.duration>.001},i.find=function(t){if(this.name===t)return this;for(var e,r=eH(this.children);!(e=r()).done;){var i=e.value;if(i.name===t)return i}for(var n,o=eH(this.children);!(n=o()).done;){var a=n.value.find(t);if(a)return a}},i.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.id,i=t.name,n=t.delay,o=t.parentId,a=t.endBehavior,s=t.transform,u=t.listIndex,c=t.duration,l=void 0===c?0:c;if(this.props=t,this.type=t.type,this.id=r.toString(),this.name=i,this.start=n||this.start,s&&(s.position=new eK().copyFrom(s.position),s.quat?s.quat=new eJ(s.quat.x,s.quat.y,s.quat.z,s.quat.w):s.rotation=new e0().copyFrom(null!=(h=s.eulerHint)?h:s.rotation),s.scale=new eK().copyFrom(s.scale),s.size&&(s.size=new eQ().copyFrom(s.size)),s.anchor&&(s.anchor=new eQ().copyFrom(s.anchor)),this.transform.setTransform(s)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=l,this.endBehavior=a,this.oldId=t.oldId,t.content||(t.content={options:{}}),l<=0)throw Error("Item duration can't be less than 0, see "+rT["Item duration can't be less than 0"]+".");for(var h,f,m=eH(this.components);!(f=m()).done;){var d=f.value;d.item=this,d.onAttached()}this.renderOrder=void 0===u?0:u},i.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==(r=this.parent)?void 0:r.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,r,i,n=eH(this.components);!(i=n()).done;){var o=i.value;er(o,t.EffectComponent)&&this.taggedProperties.components.push(o)}}this.taggedProperties.content={}},i.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.y;this.transform.translate(2*t*s/i,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=eH(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this.transform.setValid(!1)}},i.resetChildrenParent=function(){for(var t,e,r=eH(this.children);!(e=r()).done;){var i=e.value;this.parent&&i.setParent(this.parent)}this.parent&&eh(null==(t=this.parent)?void 0:t.children,this)},r.isComposition=function(t){return t.type===tx.composition},r.isSprite=function(t){return t.type===tx.sprite},r.isParticle=function(t){return t.type===tx.particle},r.isNull=function(t){return t.type===tx.null},r.isTree=function(t){return t.type===tx.tree},r.isCamera=function(t){return t.type===tx.camera},r.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},eU(r,[{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,r=eH(this.rendererComponents);!(e=r()).done;)e.value.priority=t}}}]),r}(e9),en([e8(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=en([e5(tH.VFXItemData)],t.VFXItem),t.Item=void 0,(ts=t.Item||(t.Item={})).is=function(t,e){return t.type===e},ts.isComposition=function(t){return t.type===tx.composition},ts.isParticle=function(t){return t.type===tx.particle},ts.isNull=function(t){return t.type===tx.null};var ad={},ap=[],av={};function ay(t,e,r,i){av[t]=r,ad[t]=e,i&&el(ap,t)}var ag=function(){function e(t){var e={},r=[],i=function(t){var i=ad[t];r.includes(i)||(r.push(i),e[t]=i)};ap.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map(function(t){var e,r=ad[t];if(!r)throw Error("The plugin '"+t+"' not found."+((e=ax[t])?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""));var i=new r;return i.name=t,i}).sort(function(t,e){return t.order-e.order})}var r=e.prototype;return r.initializeComposition=function(t,e){this.plugins.forEach(function(r){return r.onCompositionConstructed(t,e)})},r.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},r.resetComposition=function(t,e){this.plugins.forEach(function(r){return r.onCompositionReset(t,e)})},r.createPluginItem=function(e,r,i){var n=av[e];if(!n)throw Error("The plugin '"+e+"' does not have a registered constructor.");var o=new n(i.getEngine(),r,i);if(o.composition=i,!er(o,t.VFXItem))throw Error("The plugin '"+e+"' invalid constructor type.");return o},r.processRawJSON=function(t,e){var r=this;return ee(function(){return eo(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},r.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n=this;return ee(function(){var e,i,o,a,s,u;return eo(this,function(c){for(o=0,e=[],i=n.plugins;o<i.length;o++)t in(a=ad[i[o].name])&&e.push(Promise.resolve(null==(u=a[t])?void 0:(s=u).call.apply(s,[].concat([a],r))));return[2,Promise.all(e)]})})()},r.precompile=function(t,e,r){var i=this;return ee(function(){return eo(this,function(n){return[2,i.callStatic("precompile",t,e,r)]})})()},r.loadResources=function(t,e){var r=this;return ee(function(){return eo(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e}(),ax={"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"},aT=function(){function t(){}return t.collectSerializableObject=function(e,r){if(!r[e.getInstanceId()]){e.toData(),r[e.getInstanceId()]=e;for(var i,n=e6(e),o=eH(Object.keys(n));!(i=o()).done;){var a=i.value,s=e.taggedProperties[a];if(void 0===s&&(s=e[a]),e9.is(s))t.collectSerializableObject(s,r);else if(eM(s))for(var u,c=eH(s);!(u=c()).done;){var l=u.value;e9.is(l)&&t.collectSerializableObject(l,r)}else if(eL(s))for(var h,f=eH(Object.keys(s));!(h=f()).done;){var m=s[h.value];e9.is(m)&&t.collectSerializableObject(m,r)}}}},t.serializeEffectObject=function(e){var r={},i=e.engine,n=rI({},i.jsonSceneData);t.collectSerializableObject(e,r);for(var o,a=eH(Object.keys(r));!(o=a()).done;){var s=r[o.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serializeTaggedProperties(s,n[s.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,r){e.toData(),r||(r={});for(var i,n=e6(e),o=eH(Object.keys(n));!(i=o()).done;){var a=i.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?r[a]=s:eM(s)?(r[a]||(r[a]=[]),t.serializeArrayProperty(s,r[a],0)):e9.is(s)?r[a]={id:s.getInstanceId()}:eL(s)&&(r[a]||(r[a]={}),t.serializeObjectProperty(s,r[a],0))}for(var u,c=eH(Object.keys(e.taggedProperties));!(u=c()).done;){var l=u.value,h=e.taggedProperties[l];"number"==typeof h||"string"==typeof h||"boolean"==typeof h||t.checkTypedArray(h)?r[l]=h:eM(h)?(r[l]||(r[l]=[]),t.serializeArrayProperty(h,r[l],0)):e9.is(h)?r[l]={id:h.getInstanceId()}:eL(h)&&(r[l]||(r[l]={}),t.serializeObjectProperty(h,r[l],0))}return r},t.deserializeTaggedProperties=function(e,r){for(var i,n=r.taggedProperties,o=e6(r),a=r.engine,s=eH(Object.keys(e));!(i=s()).done;){var u=i.value;if(!o[u]){var c=e[u];n[u]=t.deserializeProperty(c,a,0)}}for(var l,h=eH(Object.keys(o));!(l=h()).done;){var f=l.value,m=e[f];if(void 0!==m){var d=o[f].type;r[f]=t.deserializeProperty(m,a,0,d)}}r.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,r){return ee(function(){var i,n,o,a,s,u,c,l,h,f,m,d;return eo(this,function(p){switch(p.label){case 0:i=r.taggedProperties,n=e6(r),o=r.engine,a=eH(Object.keys(e)),p.label=1;case 1:if((s=a()).done)return[3,4];if(n[u=s.value])return[3,3];return c=e[u],[4,t.deserializePropertyAsync(c,o,0)];case 2:i[u]=p.sent(),p.label=3;case 3:return[3,1];case 4:l=eH(Object.keys(n)),p.label=5;case 5:if((h=l()).done)return[3,8];if(void 0===(m=e[f=h.value]))return[3,7];return d=n[f].type,[4,t.deserializePropertyAsync(m,o,0,d)];case 6:r[f]=p.sent(),p.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}})})()},t.checkTypedArray=function(t){return er(t,Int8Array)||er(t,Uint8Array)||er(t,Uint8ClampedArray)||er(t,Int16Array)||er(t,Uint16Array)||er(t,Int32Array)||er(t,Uint32Array)||er(t,Float32Array)||er(t,Float64Array)||er(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eL(t)&&1===Object.keys(t).length&&"id"in t&&eO(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eL(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eP(t)||er(t,HTMLImageElement)},t.deserializeProperty=function(e,r,i,n){if(i>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eM(e)){for(var o,a=[],s=eH(e);!(o=s()).done;){var u=o.value;a.push(t.deserializeProperty(u,r,i+1,n))}return a}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(!eL(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,l,h=eH(Object.keys(e));!(l=h()).done;){var f=l.value;c[f]=t.deserializeProperty(e[f],r,i+1)}return c},t.deserializePropertyAsync=function(e,r,i,n){return ee(function(){var o,a,s,u,c,l,h,f,m;return eo(this,function(d){switch(d.label){case 0:if(i>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eM(e))return[3,5];o=[],a=eH(e),d.label=1;case 1:if((s=a()).done)return[3,4];return u=s.value,c=o.push,[4,t.deserializePropertyAsync(u,r,i+1,n)];case 2:c.apply(o,[d.sent()]),d.label=3;case 3:return[3,1];case 4:return[2,o];case 5:if(!t.checkDataPath(e))return[3,7];return[4,r.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,d.sent()];case 7:if(!eL(e)||e.constructor!==Object)return[2,e];for(l=n?new n:{},h=eH(Object.keys(e));!(f=h()).done;)l[m=f.value]=t.deserializeProperty(e[m],r,i+1);return[2,l];case 8:return[2]}})})()},t.serializeObjectProperty=function(e,r,i){if(i>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}r||(r={});for(var n,o=eH(Object.keys(e));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?r[a]=s:eM(s)?(r[a]||(r[a]=[]),t.serializeArrayProperty(s,r[a],i+1)):e9.is(s)?r[a]={id:s.getInstanceId()}:eL(s)&&(r[a]||(r[a]={}),t.serializeObjectProperty(s,r[a],i+1))}},t.serializeArrayProperty=function(e,r,i){if(i>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}r||(r=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?r[n]=o:eM(o)?(r[n]||(r[n]=[]),t.serializeArrayProperty(o,r[n],i+1)):e9.is(o)?r[n]={id:o.getInstanceId()}:eL(o)&&(r[n]||(r[n]={}),t.serializeObjectProperty(o,r[n],i+1))}},t}(),aE=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 r,i=this.findData(e);if(!i){console.error("Object data with uuid: "+e+" not found.");return}switch(i.dataType){case tH.Material:r=r6.create(this.engine);break;case tH.Geometry:r=i1.create(this.engine);break;case tH.Texture:r=rq.create(this.engine);break;default:var n=t.getClass(i.dataType);n&&(r=new n(this.engine))}if(!r){console.error("Constructor for DataType: "+i.dataType+" not found.");return}return r.setInstanceId(i.id),this.engine.addInstance(r),aT.deserializeTaggedProperties(i,r),r},e.loadGUIDAsync=function(e){var r=this;return ee(function(){var i,n,o;return eo(this,function(a){switch(a.label){case 0:if(r.engine.objectInstance[e])return[2,r.engine.objectInstance[e]];if(n=r.findData(e))return[3,2];if(!r.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,r.engine.database.loadGUID(e)];case 1:if(!(i=a.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return r.engine.addInstance(i),[2,i];case 2:switch(n.dataType){case tH.Material:i=r6.create(r.engine);break;case tH.Geometry:i=i1.create(r.engine);break;case tH.Texture:i=rq.create(r.engine);break;default:(o=t.getClass(n.dataType))&&(i=new o(r.engine))}if(!i)return console.error("Constructor for DataType: "+n.dataType+" not found."),[2,void 0];return i.setInstanceId(n.id),r.engine.addInstance(i),[4,aT.deserializeTaggedPropertiesAsync(n,i)];case 3:return a.sent(),[2,i]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e4[t]},t}(),ab=function(){function t(){}return t.prototype.loadGUID=function(t){return ee(function(){return eo(this,function(t){return[2,void 0]})})()},t}();function a_(t,e){if(!t.includes(e))return t.push(e),!0}function aC(t){if(Number.isFinite(t))return[tR.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===tR.CONSTANT)return[tR.CONSTANT,t[1]];if("lines"===e)return[tR.LINE,t[1]];if(e===tR.LINE){var i=r.map(function(t){return[tw.LINE,t]});return[tR.BEZIER_CURVE,i]}return"curve"===e||e===tR.CURVE?[tR.BEZIER_CURVE,aB(r)]:t}}function aS(t,e){return Array.isArray(t)&&"random"===t[0]?[tR.CONSTANT,t[1][e]]:aC(t)}function aA(t){return t&&"color"===t[0]?aO(t[1],!0):[1,1,1,1]}function aR(t){return t&&"random"===t[0]?[tR.RANDOM,t[1]]:aC(t)}function aw(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach(function(i){var n,o=(n=/^(-)?([\d+.]+)%$/.exec(i))?+n[2]/100*(n[1]?-1:1):+i,a=aO(t[i],e);r.push([o,a[0],a[1],a[2],a[3]])}),r=r.sort(function(t,e){return t[0]-e[0]}),[tR.GRADIENT_COLOR,r]}}function aO(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else er(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=aM(r)),r}function aM(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function aI(t,e){return Array.isArray(t)?t[0]===tR.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&aw(t[1],e):aw(t,e)}function aL(t){if(t){if(3===t.length)return[tR.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tR.BEZIER_PATH||e===tR.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],o=r[2],a=aB(i);if(!o){o=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&o.push(u),o.push(u)}}return[tR.BEZIER_CURVE_PATH,[a,n,o]]}return t}}function aP(t){for(var e,r=eH(Object.keys(t));!(e=r()).done;){var i=e.value;t[i]=Number(t[i])}return t}function aV(t){for(var e,r=eH(Object.keys(t));!(e=r()).done;){var i=e.value;void 0===t[i]&&delete t[i]}return t}var aF=Math.cos,az=Math.sin,aN=Math.PI/180,aD=180/Math.PI;function ak(t,e){return t?[t[0]-.5,.5-t[1]]:e?aU[e]:[0,0]}var aU=((t3={})[tE.PARTICLE_ORIGIN_CENTER]=[0,0],t3[tE.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t3[tE.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t3[tE.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t3[tE.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t3[tE.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t3[tE.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t3[tE.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t3[tE.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t3);function aB(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);for(var n=[[t[0][0],t[0][1]]],o=0;o<t.length-1;o++){var a=t[o][3]*(e-r),s=t[o+1][2]*(e-r),u=[t[o][0],t[o][1]],c=[t[o+1][0],t[o+1][1]];if(u[0]!=c[0]){var l=function(t,e,r,i){var n=r[0],o=r[1],a=i[0],s=i[1],u=a-n;return[[n+(a-n)/3,o+(t*=u)/3],[a-(a-n)/3,s-(e*=u)/3]]}(a,s,u,c),h=l[0],f=l[1];n[n.length-1].push(h[0]),n[n.length-1].push(h[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?[tw.EASE_OUT,t]:e===n.length-1?[tw.EASE_IN,t]:[tw.EASE,t]})}function aG(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:aL(null==(r=t.transform)?void 0:r.path),gravity:i.gravity,gravityOverLifetime:aC(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:aC(n.linearX),linearY:aC(n.linearY),linearZ:aC(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:aC(n.orbitalX),orbitalY:aC(n.orbitalY),orbitalZ:aC(n.orbitalZ),speedOverLifetime:aC(n.speedOverLifetime)};aV(o);var a={options:{startColor:aA(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=aC(s.x),u.y=aC(s.y),u.z=aC(s.z)):u.z=aC(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:aC(c.opacity)};c.color&&(l.color=aI(c.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:aC(h.size),x:aC(h.x),y:aC(h.y),z:aC(h.z)}),a}function aX(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tx.null&&t.endBehavior===tO.destroy&&(t.endBehavior=tO.freeze)})}),t.version="2.1",t}function aH(t){for(var e,r=rI({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),i=eH(r.images);!(e=i()).done;)e.value.id=ez();if(null!=r.textures||(r.textures=[]),r.textures.forEach(function(t){t.id=ez(),t.dataType=tH.Texture,t.source={id:r.images[t.source].id}}),r.textures.length<r.images.length)for(var n=r.textures.length;n<r.images.length;n++)r.textures.push({id:ez(),dataType:tH.Texture,source:{id:r.images[n].id},flipY:!0});t.bins&&(o=t.bins,r.bins=o.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:ez()}}));for(var o,a,s={},u={},c=eH(t.compositions);!(a=c()).done;)!function(){var t=a.value;(t.endBehavior===tS.pause_destroy||t.endBehavior===tS.pause)&&(t.endBehavior=4),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tx.particle&&t.content.filter&&delete t.content.filter});for(var e,i=eH(t.items);!(e=i()).done;){var n=e.value;s[n.id]=ez(),n.oldId=n.id,n.id=s[n.id],u[n.id]=n}t.items.forEach(function(e,i){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],o=e.parentId.split("^")[1];e.parentId=s[n]+"^"+o}else e.parentId=s[e.parentId]}r.items.push(e),t.items[i]={id:e.id}});var o=rI({},t,{timelineAsset:{id:""},sceneBindings:[]});r.compositions.push(o),function(t,e,r){for(var i,n=[],o=[],a=[],s={tracks:[],id:ez(),dataType:"TimelineAsset"},u=eH(t.items);!(i=u()).done;){var c=e[i.value.id],l=[],h={id:ez(),dataType:"ActivationPlayableAsset"};a.push(h);var f={id:ez(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:h.id}}]};if(l.push({id:f.id}),o.push(f),c.type!==tx.particle){var m={id:ez(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(m);var d={id:ez(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:m.id}}]};l.push({id:d.id}),o.push(d)}if(c.type===tx.sprite){var p={id:ez(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime,startColor:c.content.options.startColor};a.push(p);var v={id:ez(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:p.id}}]};l.push({id:v.id}),o.push(v)}if(c.type===tx.composition){var y={id:ez(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:ez(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),o.push(g)}var x={id:ez(),dataType:"ObjectBindingTrack",children:l,clips:[]};o.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:c.id}})}for(var T,E=[],b=eH(o);!(T=b()).done;){var _=T.value;E.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,r.miscs.push(s);for(var C,S=eH(o);!(C=S()).done;){var A=C.value;r.miscs.push(A)}for(var R,w=eH(a);!(R=w()).done;){var O=R.value;r.miscs.push(O)}}(o,u,r)}();for(var l,h=eH(r.items);!(l=h()).done;){var f=l.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var m=f.content.renderer.texture;f.content.renderer.texture={id:r.textures[m].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var d=f.content.trails.texture;f.content.trails.texture={id:r.textures[d].id}}}if(f.transform){var p=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(T=f.transform.scale)?T:[1,1,1]);if(Object.assign(f,{transform:{position:{x:p[0],y:p[1],z:p[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tx.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tx.sprite){var g,x,T,E,b,_,C,S=f.content;S.renderer||(S.renderer={});var A=S.renderer,R=ak(A.anchor,A.particleOrigin),w=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-R[0]*(null!=(E=null==w?void 0:w.x)?E:1),f.transform.position.y+=-R[1]*(null!=(b=null==w?void 0:w.y)?b:1)),f.transform.anchor={x:R[0]*(null!=(_=null==w?void 0:w.x)?_:1),y:R[1]*(null!=(C=null==w?void 0:w.y)?C:1)}}}if(f.type===tx.particle){var O=f.content;O.renderer||(O.renderer={});var M=O.renderer;O.renderer.anchor=ak(M.anchor,M.particleOrigin)}f.type===tx.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),f.content.tracks=[];var I=f.content.tracks;if(f.type!==tx.particle&&I.push({clips:[{id:ez(),dataType:"TransformPlayableAsset",sizeOverLifetime:f.content.sizeOverLifetime,rotationOverLifetime:f.content.rotationOverLifetime,positionOverLifetime:f.content.positionOverLifetime}]}),f.type===tx.sprite&&I.push({clips:[{id:ez(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:f.content.colorOverLifetime,startColor:f.content.options.startColor}]}),void 0!==f.pn){var L=f.pn,P=t.plugins,V=void 0===P?[]:P;void 0!==L&&Number.isInteger(L)&&(f.pluginName=V[L])}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===tx.spine&&t.spines&&0!==t.spines.length&&function(t,e,r){e.resource={atlas:{bins:{id:r.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:r.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:r.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,r),(f.type===tx.sprite||f.type===tx.particle||f.type===tx.mesh||f.type===tx.skybox||f.type===tx.light||"camera"===f.type||f.type===tx.tree||f.type===tx.interact||f.type===tx.camera||f.type===tx.text||f.type===tx.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],r.components.push(f.content),f.content.id=ez(),f.content.item={id:f.id},f.dataType=tH.VFXItemData,f.components.push({id:f.content.id})),(f.type===tx.null||f.type===tx.composition)&&(f.components=[],f.dataType=tH.VFXItemData),f.type){case tx.sprite:f.content.dataType=tH.SpriteComponent;break;case tx.particle:f.content.dataType=tH.ParticleSystem;break;case tx.mesh:f.content.dataType=tH.MeshComponent;break;case tx.skybox:f.content.dataType=tH.SkyboxComponent;break;case tx.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 tx.tree:f.content.dataType=tH.TreeComponent;break;case tx.interact:f.content.dataType=tH.InteractComponent;break;case tx.camera:f.content.dataType=tH.CameraController;break;case tx.text:f.content.dataType=tH.TextComponent;break;case tx.spine:f.content.dataType="SpineComponent"}}return r.version="3.0",r}var aj=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,aW=/^(\d+)\.(\d+)$/,aY=!1;function aZ(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(h=null==(l=(c=t).version)?void 0:l.split("."))||Number(h[0])>2||2===Number(h[0])&&Number(h[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tx.mesh||t.type===tx.light)&&(t.endBehavior=1===t.endBehavior?tO.destroy:t.endBehavior)})}),aj.test(t.version)){var e,r,i,n,o,a,s,u;return aY=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",aH(aX((aq="1.0",n=(e=t).plugins||[],(null==(r=e.bins)?void 0:r.length)&&(aq="1.3"),o=(e.requires||[]).slice(),a=e.images.map(function(t,r){return aQ(t,r,e.imageTags||[])}),s=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:aq,playerVersion:null!=(i=e.playerVersion)?i:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return aK(t,{plugins:n,requires:o})}),images:a,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)))}var c,l,h,f,m,d=aW.exec(t.version)||[],p=Number(d[1]),v=Number(d[2]);if(p)return(p<2||2===p&&v<4)&&((m=t).compositions.map(function(t){for(var e,r=eH(t.items);!(e=r()).done;)(function t(e){if(e)for(var r,i=eH(Object.keys(e));!(r=i()).done;){var n=r.value,o=e[n],a=Array.isArray(o);a&&2===o.length&&Array.isArray(o[1])?"path"===n?e[n]=aL(o):e[n]=aC(o):a||"object"!=typeof o||t(o)}})(e.value.content)}),t=m),p<3?aH(aX(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var aq="1.0";function aQ(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{id:ez(),renderLevel:i,url:t,oriY:n};if(t.template)return{id:ez(),url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{id:ez(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{id:ez(),url:t.url,webp:t.webp,renderLevel:i,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function aK(t,e){void 0===e&&(e={});var r,i={id:t.id+"",camera:rI({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return a$(t,e)}),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null==(r=t.meta)?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var aJ=[0,0,0,1];function a$(t,e){void 0===e&&(e={});var r=tx.base,i=t.endBehavior,n=NaN;if(t.content?(r=t.type||tx.plugin,p=t.pn,d=t.pluginName,f=t.content,h=t.content,isNaN(p)&&!d&&(d=f.options.type),t.duration&&(n=t.duration),l=t.transform||T(h.transform)):t.particle?(r=tx.particle,l=T((h=t.particle).transform,aY,!0),f=function(t){var e=t.options,r=t.transform,i={type:tp.NONE};if(t.shape){var n,o=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(i=rI({},t.shape,{type:tp[o]}),t.shape.upDirection){var a=t.shape.upDirection,s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete i.upDirection}}e.startTurbulence&&(i.turbulenceX=aR(e.turbulenceX),i.turbulenceY=aR(e.turbulenceY),i.turbulenceZ=aR(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map(function(t){return aP(t)})),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map(function(t){return aP(t)})),l.rateOverTime&&(l.rateOverTime=aR(l.rateOverTime));var h={renderer:t.renderer,shape:i,splits:t.splits,emission:l,options:{startLifetime:aR(e.startLifetime),start3DSize:!!e.start3DSize,startSize:aR(e.startSize),startSizeX:aR(e.startSizeX),startSizeY:aR(e.startSizeY),sizeAspect:aR(e.sizeAspect),maxCount:e.maxCount,startDelay:aR(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tR.COLORS,t[1].map(function(t){return aO(t,e)})]:"gradient"===t[0]?aw(t[1],e):"color"===t[0]?[tR.RGBA_COLOR,aO(t[1],e)]:t}(e.startColor,!0),startRotationZ:aR(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(h.options.startRotationX=aR(e.startRotationX),h.options.startRotationY=aR(e.startRotationY)),r&&r.path&&(h.emitterTransform={path:aL(r.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:aR(f.x),y:aR(f.y)}:h.sizeOverLifetime={size:aR(f.size)});var m=t.velocityOverLifetime||{},d=m.speedOverLifetime;d=d?aC(d):void 0,h.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:aC(e.gravityModifier),startSpeed:aR(e.startSpeed),speedOverLifetime:d,asMovement:m.asMovement,linearX:aR(m.linearX),linearY:aR(m.linearY),linearZ:aR(m.linearZ),asRotation:m.asRotation,orbCenter:m.orbCenter,orbitalX:aR(m.orbitalX),orbitalY:aR(m.orbitalY),orbitalZ:aR(m.orbitalZ),forceTarget:m.forceTarget,target:m.target,forceCurve:aC(m.forceCurve)},aV(h.positionOverLifetime);var p=t.rotationOverLifetime;p&&(h.rotationOverLifetime={separateAxes:p.separateAxes,asRotation:p.asRotation,z:aR(p.separateAxes?p.z:p.angularVelocity)},p.separateAxes&&(h.rotationOverLifetime.y=aC(p.y),h.rotationOverLifetime.x=aC(p.x)));var v=t.colorOverLifetime;if(v){var y=h.colorOverLifetime={opacity:aC(v.opacity)};v.color&&(y.color=aI(v.color))}var g=t.textureSheetAnimation;g&&(h.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:aC(g.cycles),animationDelay:aS(g.animationDelay,0),animationDuration:aS(g.animationDuration,0)});var x=t.trails;x&&(h.trails={lifetime:aR(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:aC(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&aI(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&aI(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:aR(x.opacityOverLifetime)}),h.trails&&aV(h.trails);var T=t.interaction;return T&&(h.interaction={behavior:T.behavior,radius:T.radius,multiple:T.multiple}),h}(h)):t.sprite?(r=tx.sprite,l=T((h=t.sprite).transform,!1,!0),s=aG(a=h,l),(u=a.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=a.renderer,a.splits&&(s.splits=a.splits),a.interaction&&(s.interaction=a.interaction),f=s):t.cal?(r=tx.null,l=T((h=t.cal).transform,!1,!0),f=aG(h,l)):t.ui?(r=tx.interact,l=T((h=t.ui).transform),f=function(t){var e,r=t.options;switch(r.type){case"click":e={type:ty.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&aA(r.previewColor),behavior:r.behavior||tg.NOTIFY};break;case"drag":e={type:ty.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:ty.MESSAGE}}return{options:e}}(h),l.scale=[h.options.width||1,h.options.height||1,1]):t.model&&(h=t.model,1===t.model.options.type&&(r=tx.camera,l=T(h.transform),f=function(t){var e=t.options,r={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},i=t.velocityOverLifetime;if(i||(null==(n=t.transform)?void 0:n.path)){var n,o,a={path:aL(null==(o=t.transform)?void 0:o.path),linearX:aC(null==i?void 0:i.translateX),linearY:aC(null==i?void 0:i.translateY),linearZ:aC(null==i?void 0:i.translateZ)};aV(a),r.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:aC(null==s?void 0:s.rotateX),y:aC(null==s?void 0:s.rotateY),z:s.separateAxes?aC(null==s?void 0:s.rotateZ):aC(s.rotation)};aV(u),r.rotationOverLifetime=u}return r}(h))),null==(c=f.renderer)?void 0:c.anchor){var o=new Float32Array(f.renderer.anchor);.5==o[0]&&.5==o[1]?delete f.renderer.anchor:e.requires&&a_(e.requires,"anchor")}if(h){var a,s,u,c,l,h,f,m,d,p,v,y,g=null==(v=h.options)?void 0:v.looping;i=g?Array.isArray(g)?g[1]?tO.loop:tO.destroy:tO.loop:i||(null==h?void 0:null==(y=h.options)?void 0:y.endBehavior)||tO.destroy,h.options.renderLevel&&(m=h.options.renderLevel),isNaN(n)&&(n=h.options.duration)}var x={type:r,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:l,endBehavior:i,renderLevel:m,content:f};return d?e.plugins?(a_(e.plugins,d),x.pn=e.plugins.indexOf(d)):x.pluginName=d:Number.isInteger(p)&&(x.pn=p),t.parentId&&(x.parentId=t.parentId+""),x;function T(t,e,r){if(t){var i={},n=t.rotation;if(n&&(e?i.rotation=[-n[0],-n[1],-n[2]]:i.rotation=[n[0],n[1],n[2]],r)){var o,a,s,u,c,l,h,f,m,d,p,v,y,g,x,T,E,b,_,C,S,A,R,w,O=(o=i.rotation[0],a=i.rotation[1],s=i.rotation[2],u=aF(o*aN/2),c=aF(a*aN/2),l=aF(s*aN/2),h=az(o*aN/2),f=az(a*aN/2),m=az(s*aN/2),aJ[0]=h*c*l+u*f*m,aJ[1]=u*f*l-h*c*m,aJ[2]=u*c*m+h*f*l,aJ[3]=u*c*l-h*f*m,aJ);i.rotation=(d=[],p=O[0],v=O[1],y=O[2],g=O[3],x=p+p,T=v+v,E=y+y,b=p*x,_=v*x,C=v*T,S=y*E,A=g*E,R=y*x-g*T,d[1]=Math.asin((w=-R)>1?1:w<-1?-1:w)*aD,.9999999>Math.abs(R)?(d[0]=Math.atan2(y*T+g*x,1-b-C)*aD,d[2]=Math.atan2(_+A,1-C-S)*aD):(d[0]=0,d[2]=Math.atan2(-(_-A),1-b-S)*aD),d)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}return{}}}var a0=((t4={})[th.S]=[th.S,th.BPlus,th.APlus],t4[th.A]=[th.A,th.BPlus,th.APlus],t4[th.B]=[th.B,th.BPlus],t4);function a1(t,e){if(!t||!e)return!0;var r=a0[e];return!!r&&r.includes(t)}function a2(t){return eL(t)&&"jsonScene"in t}function a3(t){return eL(t)&&"url"in t}function a4(t){return eL(t)&&"options"in t}function a5(t,e){var r,i,n=null!=(i=null==t?void 0:t.background)?i:{},o=n.name,a=n.url;return o&&(e&&e[o]?r=e[o]:a&&(r=a)),r}function a6(t,e,r){return a8.apply(this,arguments)}function a8(){return(a8=ee(function(t,e,r){var i,n,o,a;return eo(this,function(s){switch(s.label){case 0:if("string"!=typeof t)return[3,2];return[4,rz(t)];case 1:return i=s.sent(),[3,3];case 2:i=t,s.label=3;case 3:if(!i)throw Error("Image not provided.");if(!e)return[2,i];if(n=i,!((o=a5(e,r))&&eO(o)&&o!==i.src))return[3,7];if(!eO(o))return[3,5];return[4,rz(o)];case 4:return a=s.sent(),[3,6];case 5:a=o,s.label=6;case 6:n=a,s.label=7;case 7:return[2,n]}})})).apply(this,arguments)}var a9=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(e9),a7=1,st=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new rL),this.options=t,this.downloader=e,this.assets={},this.id=a7++,this.timers=[],this.updateOptions(t)}var r=e.prototype;return r.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},r.updateSceneData=function(t){var e=this.options.variables;e&&0!==Object.keys(e).length&&t.forEach(function(t){if(t.type===tx.text){var r=e[t.name];r&&(t.content.options.text=r)}})},r.loadScene=function(e,r,i){var n=this;return ee(function(){var o,a,s,u,c,l,h,f,m,d,p,v,y,g,x;return eo(this,function(T){return s=eO(e)?e:n.id,u=performance.now(),c=[],f=null!=(h=null==(l=null==r?void 0:r.engine.gpuCapability)?void 0:null==(o=l.detail)?void 0:o.asyncShaderCompile)&&h,d=null!=(m=null==l?void 0:l.detail.compressedTexture)?m:t.COMPRESSED_TEXTURE.NONE,p={},y=!1,g=new Promise(function(t,e){v=window.setTimeout(function(){y=!0,n.removeTimer(v),e(Error("Load time out: totalTime: "+(performance.now()-u).toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."))},1e3*n.timeout),n.timers.push(v)}),x=ee(function(t,e){var r,i,n;return eo(this,function(o){switch(o.label){case 0:if(y)return[3,4];r=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return i=o.sent(),n=performance.now()-r,c.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,i];case 3:throw Error("Load error in "+t+", "+o.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([g,ee(function(){var t,o,l,h,m,y,g,T,E,b,_,C,S,A,R,w,O,M,I,L,P;return eo(this,function(V){switch(V.label){case 0:if(!eL(e))return[3,1];return a=e,n.baseUrl=location.href,[3,3];case 1:return e=new URL(e,location.href).href,n.baseUrl=e,[4,x("loadJSON",function(){return n.loadJSON(e)})];case 2:a=V.sent(),V.label=3;case 3:if(!a2(a))return[3,6];if(t=rI({},a),!(n.options&&n.options.variables&&0!==Object.keys(n.options.variables).length))return[3,5];for(h=0,o=a.jsonScene.images,l=t.images;h<o.length;h++)er(l[h],HTMLCanvasElement)&&(l[h]=o[h]);return[4,x("processImages",function(){return n.processImages(l,d)})];case 4:for(m=0,t.images=V.sent();m<t.images.length;m++)t.textureOptions[m].image=t.images[m];n.updateSceneData(t.jsonScene.items),V.label=5;case 5:return[3,12];case 6:return[4,x("processJSON",function(){return n.processJSON(a)})];case 7:return g=(y=V.sent()).usedImages,T=y.jsonScene,E=y.pluginSystem,_=void 0===(b=T.bins)?[]:b,C=T.images,S=T.compositions,A=T.fonts,[4,Promise.all([x("processBins",function(){return n.processBins(_)}),x("processImages",function(){return n.processImages(C,d)}),x((f?"async":"sync")+"Compile",function(){return n.precompile(S,E,r,i)})])];case 8:if(w=(R=V.sent())[0],O=R[1],r)for(M=0;M<C.length;M++)(I=new a9(r.engine)).data=O[M],I.setInstanceId(C[M].id),r.engine.addInstance(I);return[4,x("processFontURL",function(){return n.processFontURL(A)})];case 9:return V.sent(),[4,x("processTextures",function(){return n.processTextures(O,w,T,r.engine)})];case 10:return L=V.sent(),n.updateSceneData(T.items),t={timeInfos:p,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:E,jsonScene:T,usedImages:g,images:O,textureOptions:L,bins:w},[4,x("processPlugins",function(){return E.loadResources(t,n.options)})];case 11:V.sent(),V.label=12;case 12:return P=performance.now()-u,eR.info("Load asset: totalTime: "+P.toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."),window.clearTimeout(v),n.removeTimer(v),t.totalTime=P,t.startTime=u,t.timeInfos=p,[2,t]}})})()])]})})()},r.precompile=function(t,e,r,i){return ee(function(){var n;return eo(this,function(o){switch(o.label){case 0:if(!r||!r.getShaderLibrary())return[2];return n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)];case 1:return o.sent(),[4,new Promise(function(t){null==n||n.compileAllShaders(function(){t(null)})})];case 2:return o.sent(),[2]}})})()},r.processJSON=function(t){var e=this;return ee(function(){var r,i,n,o,a,s,u,c,l;return eo(this,function(h){switch(h.label){case 0:return r=aZ(t),t.compositions.forEach(function(t,e){t.globalVolume&&(r.compositions[e].globalVolume=t.globalVolume)}),n=void 0===(i=r.plugins)?[]:i,o=r.compositions,a=r.imgUsage,s=r.images,[4,(u=new ag(n)).processRawJSON(r,e.options)];case 1:return h.sent(),c=e.options.renderLevel,l={},a?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];a1(i[u].renderLevel,n)&&(t[u]=!0)}}}(l,o,a,s,c):null==s||s.forEach(function(t,e){l[e]=!0}),[2,{usedImages:l,jsonScene:r,pluginSystem:u}]}})})()},r.processBins=function(t){var e=this;return ee(function(){var r,i;return eo(this,function(n){return r=e.options.renderLevel,i=e.baseUrl,[2,Promise.all(t.map(function(n){if(er(n,ArrayBuffer))return n;if(a1(n.renderLevel,r))return e.loadBins(new URL(n.url,i).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},r.processFontURL=function(t){var r=this;return ee(function(){return eo(this,function(i){return t?[2,Promise.all(t.map(ee(function(t){var i,n,o;return eo(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];eS(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),i=new URL(t.fontURL,r.baseUrl).href,[4,(o=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")")).load()];case 2:return a.sent(),document.fonts.add(o),e.fonts.add(t.fontFamily),[3,4];case 3:return a.sent(),eR.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},r.processImages=function(e,r){void 0===r&&(r=0);var i=this;return ee(function(){var n,o,a,s;return eo(this,function(u){return o=(n=i.options).useCompressedTexture,a=n.variables,s=i.baseUrl,[2,Promise.all(e.map(ee(function(e,n){var u,c,l,h,f,m,d,p,v,y,g,x,T,E,b,_,C;return eo(this,function(S){switch(S.label){case 0:if(u=e.url,c=e.webp,l=new URL(u,s).href,h=c&&new URL(c,s).href,!("template"in e))return[3,8];if(!(m=(f=e.template).background))return[3,7];d=a5(f,a),p=m.type===tA.video,v=m&&p?rB:rz,S.label=1;case 1:return S.trys.push([1,6,,7]),[4,rX(d,v)];case 2:if(!er(y=S.sent(),HTMLVideoElement))return[3,3];return[2,y];case 3:return m&&Array.isArray(d)&&a&&(a[m.name]=y.src),[4,a6(y,f,a)];case 4:return[2,S.sent()];case 5:return[3,7];case 6:throw g=S.sent(),Error("Failed to load. Check the template or if the URL is "+(p?"video":"image")+" type, URL: "+d+", Error: "+g.message+".");case 7:return[3,9];case 8:if("compressed"in e&&o&&r){if(x=e.compressed,r===t.COMPRESSED_TEXTURE.ASTC?T=x.astc:r===t.COMPRESSED_TEXTURE.PVRTC&&(T=x.pvrtc),T)return E=new URL(T,s).href,i.assets[n]={url:E,type:t.TextureSourceType.compressed},[2,i.loadBins(E)]}else if("sourceType"in e)return[2,e];else if(er(e,HTMLImageElement)||er(e,HTMLCanvasElement)||er(e,HTMLVideoElement)||er(e,rq))return[2,e];S.label=9;case 9:return[4,rV(l,h)];case 10:return _=(b=S.sent()).url,C=b.image,i.assets[n]={url:_,type:t.TextureSourceType.image},[2,C]}})})))]})})()},r.processTextures=function(e,r,i,n){var o=this;return ee(function(){var a;return eo(this,function(s){return[2,Promise.all((null!=(a=i.textures)?a:e.map(function(t,e){return{source:e}})).map(ee(function(e,a){var s,u,c;return eo(this,function(l){switch(l.label){case 0:if(er(e,rq))return[2,e];if(!("mipmaps"in e))return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,rj(e,r,n,i.bins)];case 2:return[2,l.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+l.sent()+".");case 4:if(!eL(s=e.source))return[3,5];return u=n.assetLoader.loadGUID(s.id).data,[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,rz(eN(s))];case 6:u=l.sent(),l.label=7;case 7:if(u)return(c=function(e,r){if(er(e,rq))return e.source;if(er(e,HTMLImageElement)||eP(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:rb.LINEAR,magFilter:rb.LINEAR};if(er(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:rb.LINEAR,magFilter:rb.LINEAR};if(er(e,ArrayBuffer))return rI({},r1(e),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:rb.CLAMP_TO_EDGE,wrapT:rb.CLAMP_TO_EDGE,minFilter:rb.NEAREST,magFilter:rb.NEAREST};throw Error("Invalid texture options.")}(u,o.assets[a])).id=e.id,c.dataType=tH.Texture,[2,c.sourceType===t.TextureSourceType.compressed?c:rI({},c,e)];throw Error("Invalid texture source: "+s+".")}})})))]})})()},r.loadJSON=function(t){var e=this;return ee(function(){return eo(this,function(r){return[2,new Promise(function(r,i){e.downloader.downloadJSON(t,r,function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)})})]})})()},r.loadBins=function(t){var e=this;return ee(function(){return eo(this,function(r){return[2,new Promise(function(r,i){e.downloader.downloadBinary(t,r,function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)})})]})})()},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,r=this.assets[t];null==r||null==(e=r.dispose)||e.call(r)}this.assets={},this.timers=[]},e}();st.fonts=new Set;var se=new eK(1,1,1),sr=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=e$.fromIdentity(),this.viewMatrix=e$.fromIdentity(),this.projectionMatrix=e$.fromIdentity(),this.viewProjectionMatrix=e$.fromIdentity(),this.inverseViewMatrix=e$.fromIdentity(),this.dirty=!0;var r=e.near,i=e.far,n=e.fov,o=e.aspect,a=e.clipMode,s=void 0===a?tC.portrait:a,u=e.position,c=e.rotation;this.options={near:void 0===r?.1:r,far:void 0===i?20:i,fov:void 0===n?60:n,aspect:void 0===o?1:o,clipMode:s,position:eK.fromArray(void 0===u?[0,0,8]:u),rotation:e0.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 eK(0,0,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix(),n=r.projectPoint(e).z;return i.projectPoint(new eK(1,1,n))},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 eJ;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,r=t.far,i=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,r=t.aspect,i=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*ej,r,i,n,o===tC.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(a,this.getQuat(),se),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){nQ.getRotation(t,this.options.rotation)},eU(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}(),si=0,sn=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var r=t.jsonScene,i=t.renderLevel,n=t.textureOptions,o=t.pluginSystem,a=t.totalTime,s=r.compositions,u=r.imgUsage,c=r.compositionId;if(!n)throw Error("scene.textures expected.");for(var l,h=eH(s);!(l=h()).done;){var f=l.value;f.id===c?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+c+".");this.jsonScene=r,this.renderLevel=i,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,si=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,r=t.duration,i=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=this.assembleItems(t);return rI({},t,{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:u,camera:o,startTime:void 0===s?0:s,globalVolume:a})},e.assembleItems=function(t){var e=[];this.mask++;for(var r,i={},n=eH(this.jsonScene.components);!(r=n()).done;){var o=r.value;i[o.id]=o}for(var a,s=eH(t.items);!(a=s()).done;){var u=a.value,c=this.engine.jsonSceneData[u.id];if(a1(c.renderLevel,this.renderLevel)){if(c.listIndex=si++,c.type===tx.sprite||c.type===tx.particle)for(var l,h=eH(c.components);!(l=h()).done;){var f=i[l.value.id];this.preProcessItemContent(f)}if(c.type===tx.composition){var m=c.content.options.refId;if(!this.refCompositions.get(m))throw Error("Invalid ref composition id: "+m+".");var d=this.getContent(this.refCompositions.get(m));this.refCompositionProps.has(m)||this.refCompositionProps.set(m,d),c.items=d.items}e.push(c)}}return e},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=oT(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&eL(t.renderer.shape)&&(t.renderer.shape=oT(t.renderer.shape,r))}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,r=null!=(e=this.imgUsage)?e:{};t&&r&&(r.hasOwnProperty(t)||(r[t]=0),r[t]++)},e.processMask=function(t){var e=t.maskMode;e!==td.NONE&&(t.mask||(e===td.MASK?t.mask=++this.mask:e!==td.OBSCURED&&e!==td.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}(),so=function(){function e(e,r){var i,n,o=this;this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.postLoaders=[],this.paused=!1,this.lastVideoUpdateTime=0;var a=e.reusable,s=void 0!==a&&a,u=e.speed,c=e.baseRenderOrder,l=e.renderer,h=e.onPlayerPause,f=e.onMessageItem,m=e.onEnd,d=e.event,p=e.width,v=e.height;this.compositionSourceManager=new sn(r,l.engine),r.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,r.textures=void 0,r.consumed=!0);var y=this.compositionSourceManager,g=y.sourceContent,x=y.pluginSystem,T=y.imgUsage,E=y.totalTime,b=y.refCompositionProps;eC(g),this.renderer=l,this.refCompositionProps=b,this.rootItem=new t.VFXItem(this.getEngine(),g),this.rootItem.name="rootItem",this.rootItem.composition=this,this.rootComposition=this.rootItem.addComponent(an),this.rootComposition.data=g;var _=!s&&T;this.globalVolume=g.globalVolume,this.width=p,this.height=v,this.renderOrder=void 0===c?0:c,this.id=g.id,this.renderer=l,this.texInfo=null!=_?_:{},this.event=d,this.statistic={loadTime:null!=E?E:0,loadStart:null!=(i=r.startTime)?i:0,firstFrameTime:0,precompileTime:null!=(n=r.timeInfos.asyncCompile)?n:r.timeInfos.syncCompile},this.reusable=s,this.speed=void 0===u?1:u,this.autoRefTex=!this.keepResource&&_&&this.rootItem.endBehavior!==tO.loop,this.name=g.name,this.pluginSystem=x,this.pluginSystem.initializeComposition(this,r),this.camera=new sr(this.name,rI({},null==g?void 0:g.camera,{aspect:p/v})),this.url=r.url,this.assigned=!0,this.globalTime=0,this.interactive=!0,this.onPlayerPause=h,this.onMessageItem=f,this.onEnd=m,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==o.onEnd||o.onEnd.call(o,o)},0)},this.pluginSystem.resetComposition(this,this.renderFrame)}var r=e.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.started?this.gotoAndPlay(0):this.gotoAndPlay(this.time-this.startTime)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.resume(),this.rootComposition.started||(this.rootComposition.start(),this.rootComposition.started=!0),this.forwardTime(t+this.startTime)},r.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new ny({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootComposition.started||(this.rootComposition.start(),this.rootComposition.started=!0),this.forwardTime(t+this.startTime,!0),e&&this.pause()},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-1e3*this.rootComposition.time,i=r<0,n=Math.abs(r),o=i?-15:15;n>15;n-=15)this.update(o,e);this.update(i?-n:n,e)},r.reset=function(){this.rendererOptions=null,this.globalTime=0,this.rootItem.ended=!1,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(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)}),this.gatherRendererComponent(this.rootItem,e),this.postLoaders.forEach(function(r){return r.postProcessFrame(t,e)})},r.gatherRendererComponent=function(t,e){for(var r,i=eH(t.rendererComponents);!(r=i()).done;){var n=r.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var o,a=eH(t.children);!(o=a()).done;){var s=o.value;this.gatherRendererComponent(s,e)}},r.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&r===tO.loop},r.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},r.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r=this.getUpdateTime(t*this.speed);if(this.globalTime+=r,this.rootComposition.isActiveAndEnabled){var i=this.toLocalTime(this.globalTime/1e3);this.rootComposition.time=i}this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,r),this.callLateUpdate(this.rootItem,r),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},r.toLocalTime=function(t){var e=t-this.rootItem.start,r=this.rootItem.duration;return e-r>.001&&(this.rootItem.endBehavior===tO.loop?e%=r:this.rootItem.endBehavior===tO.freeze&&(e=Math.min(r,e))),e},r.getUpdateTime=function(t){var e=1e3*this.startTime,r=1e3*this.rootComposition.time;return t<0&&r+t<e?e-r:t},r.callStart=function(t){for(var e,r=eH(t.itemBehaviours);!(e=r()).done;){var i=e.value;i.isActiveAndEnabled&&!i.started&&(i.start(),i.started=!0)}for(var n,o=eH(t.rendererComponents);!(n=o()).done;){var a=n.value;a.isActiveAndEnabled&&!a.started&&(a.start(),a.started=!0)}for(var s,u=eH(t.children);!(s=u()).done;){var c=s.value;this.callStart(c)}},r.callUpdate=function(e,r){for(var i,n=eH(e.itemBehaviours);!(i=n()).done;){var o=i.value;o.isActiveAndEnabled&&o.started&&o.update(r)}for(var a,s=eH(e.rendererComponents);!(a=s()).done;){var u=a.value;u.isActiveAndEnabled&&u.started&&u.update(r)}for(var c,l=eH(e.children);!(c=l()).done;){var h=c.value;t.VFXItem.isComposition(h)&&h.ended&&h.endBehavior===tO.loop?(h.ended=!1,this.callUpdate(h,0)):this.callUpdate(h,r)}},r.callLateUpdate=function(t,e){for(var r,i=eH(t.itemBehaviours);!(r=i()).done;){var n=r.value;n.isActiveAndEnabled&&n.started&&n.lateUpdate(e)}for(var o,a=eH(t.rendererComponents);!(o=a()).done;){var s=o.value;s.isActiveAndEnabled&&s.started&&s.lateUpdate(e)}for(var u,c=eH(t.children);!(u=c()).done;){var l=u.value;this.callLateUpdate(l,e)}},r.buildItemTree=function(e){if(e.composition){for(var r,i=new Map,n=e.getComponent(an).items,o=eH(n);!(r=o()).done;){var a=r.value;i.set(a.id,a)}for(var s,u=eH(n);!(s=u()).done;){var c=s.value;if(void 0===c.parentId)c.setParent(e);else{var l=this.getParentIdWithoutSuffix(c.parentId),h=i.get(l);if(h)t.VFXItem.isTree(h)&&c.parentId.includes("^")?(c.parent=h,c.transform.parentTransform=h.getNodeTransform(c.parentId)):(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 f,m=eH(n);!(f=m()).done;){var d=f.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},r.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},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(r){return r.onCompositionUpdate(e,t)})},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return iu((t-r.z)/i,(e-r.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,r,i){if(this.isDestroyed||!this.interactive)return[];var n,o=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(an))||n.hitTest(a,t,e,o,r,i),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(an))||s.hitTest(a,t,e,o,r,i)}),o},r.addInteractiveItem=function(t,e){if(e===ty.MESSAGE)return null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},r.removeInteractiveItem=function(t,e){e===ty.MESSAGE&&(null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},r.destroyTextures=function(e){for(var r=0;r<e.length;r++){var i,n=e[r];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(i=this.rendererOptions)?void 0:i.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==tx.composition?t.endBehavior!==tO.freeze&&t.getComponent(an).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(r){return r.onCompositionItemRemoved(e,t)})}):(eh(this.items,t),this.pluginSystem.plugins.forEach(function(r){return r.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,r,i=this;if(!this.destroyed){this.destroyed=!0;var n={},o=this.textures;o&&this.keepResource&&o.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=ew)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(r=this.pluginSystem)||r.destroyComposition(this),this.update=function(){eR.error("Update disposed composition: "+i.name+".")},this.onPlayerPause=ew,this.dispose=ew,o&&this.keepResource&&o.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==rx&&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,r){this.renderFrame.editorTransform.set(t,t,e,r)},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,r){this.rootItem.translate(t,e,r)},r.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},r.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},r.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},r.scale=function(t,e,r){this.rootItem.scale(t,e,r)},r.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},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 ee(function(){return eo(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]}})})()},eU(e,[{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(){var t;return null!=(t=this.rootComposition.startTime)?t:0}},{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)}}]),e}(),sa=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 aE(this),this.emptyTexture=rJ(this),this.transparentTexture=r$(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,r=t.jsonScene,i=t.textureOptions,n=r.items,o=r.materials,a=r.shaders,s=r.geometries,u=r.components,c=r.animations,l=r.bins,h=void 0===l?[]:l,f=r.miscs,m=eH(void 0===n?[]:n);!(e=m()).done;){var d=e.value;this.addEffectsObjectData(d)}for(var p,v=eH(void 0===o?[]:o);!(p=v()).done;){var y=p.value;this.addEffectsObjectData(y)}for(var g,x=eH(void 0===a?[]:a);!(g=x()).done;){var T=g.value;this.addEffectsObjectData(T)}for(var E,b=eH(void 0===s?[]:s);!(E=b()).done;){var _=E.value;this.addEffectsObjectData(_)}for(var C,S=eH(void 0===u?[]:u);!(C=S()).done;){var A=C.value;this.addEffectsObjectData(A)}for(var R,w=eH(void 0===c?[]:c);!(R=w()).done;){var O=R.value;this.addEffectsObjectData(O)}for(var M,I=eH(void 0===f?[]:f);!(M=I()).done;){var L=M.value;this.addEffectsObjectData(L)}for(var P=0;P<h.length;P++){var V=h[P],F=t.bins[P];V.buffer=F,V.id&&this.addEffectsObjectData(V)}for(var z,N=eH(void 0===i?[]:i);!(z=N()).done;){var D=z.value;this.addEffectsObjectData(D)}},e.createVFXItems=function(t){var e=this;return ee(function(){var r,i,n,o;return eo(this,function(a){switch(a.label){case 0:r=eH(t.jsonScene.items),a.label=1;case 1:if((i=r()).done)return[3,4];if(!("ECS"===(o=(n=i.value).type)||"camera"===o||o===tx.sprite||o===tx.particle||o===tx.mesh||o===tx.skybox||o===tx.light||o===tx.tree||o===tx.interact||o===tx.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:a.sent(),a.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||el(this.textures,t)},e.removeTexture=function(t){this.destroyed||eh(this.textures,t)},e.addMaterial=function(t){this.destroyed||el(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eh(this.materials,t)},e.addGeometry=function(t){this.destroyed||el(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eh(this.geometries,t)},e.addMesh=function(t){this.destroyed||el(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eh(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||el(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eh(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&&eR.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}},eU(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ss=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=eq(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)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},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,r=this.tickers.length;e<r;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)},eU(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.fromData=function(t){},e}(e9),en([e8(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=en([e5("BinaryAsset")],t.BinaryAsset),ay("camera",rn,t.VFXItem,!0),ay("text",af,t.VFXItem,!0),ay("sprite",nz,t.VFXItem,!0),ay("particle",oQ,t.VFXItem,!0),ay("cal",oK,t.VFXItem,!0),ay("interact",rh,t.VFXItem,!0),eR.info("Core version: 2.0.0-alpha.25.");var su=((t5={})[rb.ONE]=t7.OneFactor,t5[rb.ZERO]=t7.ZeroFactor,t5[rb.SRC_COLOR]=t7.SrcColorFactor,t5[rb.SRC_ALPHA]=t7.SrcAlphaFactor,t5[rb.ONE_MINUS_SRC_COLOR]=t7.OneMinusSrcColorFactor,t5[rb.ONE_MINUS_SRC_ALPHA]=t7.OneMinusSrcAlphaFactor,t5[rb.DST_COLOR]=t7.DstColorFactor,t5[rb.DST_ALPHA]=t7.DstAlphaFactor,t5[rb.ONE_MINUS_DST_COLOR]=t7.OneMinusDstColorFactor,t5[rb.ONE_MINUS_DST_ALPHA]=t7.OneMinusDstAlphaFactor,t5),sc=((t6={})[rb.NEVER]=t7.NeverStencilFunc,t6[rb.EQUAL]=t7.EqualStencilFunc,t6[rb.LESS]=t7.LessStencilFunc,t6[rb.LEQUAL]=t7.LessEqualStencilFunc,t6[rb.ALWAYS]=t7.AlwaysStencilFunc,t6[rb.NOTEQUAL]=t7.NotEqualStencilFunc,t6[rb.GREATER]=t7.GreaterStencilFunc,t6[rb.GEQUAL]=t7.GreaterEqualStencilFunc,t6),sl=((t8={})[rb.KEEP]=t7.KeepStencilOp,t8[rb.ZERO]=t7.ZeroStencilOp,t8[rb.REPLACE]=t7.ReplaceStencilOp,t8[rb.INCR]=t7.IncrementStencilOp,t8[rb.DECR]=t7.DecrementStencilOp,t8[rb.INCR_WRAP]=t7.IncrementWrapStencilOp,t8[rb.DECR_WRAP]=t7.IncrementWrapStencilOp,t8[rb.INVERT]=t7.InvertStencilOp,t8),sh=((t9={})[rb.NEVER]=t7.NeverDepth,t9[rb.ALWAYS]=t7.AlwaysDepth,t9[rb.EQUAL]=t7.EqualDepth,t9[rb.LESS]=t7.LessDepth,t9[rb.LEQUAL]=t7.LessEqualDepth,t9[rb.GREATER]=t7.GreaterDepth,t9[rb.GEQUAL]=t7.GreaterEqualDepth,t9[rb.NOTEQUAL]=t7.NotEqualDepth,t9),sf=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],sm=function(e){function r(r,i){(n=e.call(this,r,i)||this).textures={},n.material=new t7.RawShaderMaterial,n.uniforms={};for(var n,o=null==i?void 0:i.shader,a=r.gpuCapability.level,s=0;s<t.maxSpriteMeshItemCount;s++)n.uniforms["uSampler"+s]=new t7.Uniform(null);return n.uniforms.uEditorTransform=new t7.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new t7.Uniform(new t7.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new t7.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new t7.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new t7.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new t7.RawShaderMaterial({vertexShader:rR(o.macros,o.vertex,t.ShaderType.vertex,n.engine.gpuCapability.level),fragmentShader:rR(o.macros,o.fragment,t.ShaderType.fragment,n.engine.gpuCapability.level),alphaToCoverage:!1,depthFunc:t7.LessDepth,polygonOffsetFactor:t7.ZeroFactor,polygonOffsetUnits:t7.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===a?n.material.glslVersion=t7.GLSL1:n.material.glslVersion=t7.GLSL3,n}eG(r,e);var i=r.prototype;return i.onSetUniformValue=function(t,e){var r;sf.includes(t)&&(r=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=r||e:this.material.uniforms[t]=new t7.Uniform(r||e)},i.use=function(t,e){var r=this.engine,i=r.composition,n=r.threeCamera;if(n){var o=new t7.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",o)}else{var a=i.camera;this.setMatrix("effects_MatrixVP",a.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",a.getViewMatrix())}},i.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},i.getVector4Array=function(t){return this.uniforms[t].value},i.setVector4Array=function(t,e){for(var r,i=[],n=eH(e);!(r=n()).done;){var o=r.value;i=i.concat(o.toArray())}this.setUniform(t,i)},i.getMatrixArray=function(t){return this.uniforms[t].value},i.setMatrixArray=function(t,e){for(var r,i=[],n=eH(e);!(r=n()).done;){var o=r.value;i=i.concat(o.elements)}this.setUniform(t,i)},i.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},i.getMatrix=function(t){return this.uniforms[t].value},i.setMatrix=function(t,e){this.setUniform(t,e)},i.setMatrix3=function(t,e){this.setUniform(t,e)},i.getVector2=function(t){return this.uniforms[t].value},i.setVector2=function(t,e){this.setUniform(t,e)},i.getVector3=function(t){return this.uniforms[t].value},i.setVector3=function(t,e){this.setUniform(t,e)},i.getVector4=function(t){return this.uniforms[t].value},i.setVector4=function(t,e){this.setUniform(t,e)},i.getColor=function(t){return this.uniforms[t].value},i.setColor=function(t,e){this.setUniform(t,e)},i.getQuaternion=function(t){return this.uniforms[t].value},i.setQuaternion=function(t,e){this.setUniform(t,e)},i.getFloat=function(t){return this.uniforms[t].value},i.setFloat=function(t,e){this.setUniform(t,e)},i.getFloats=function(t){return this.uniforms[t].value},i.setFloats=function(t,e){this.setUniform(t,e)},i.getInt=function(t){return this.uniforms[t].value},i.setInt=function(t,e){this.setUniform(t,e)},i.hasUniform=function(t){return!!this.uniforms[t]},i.setUniform=function(t,e){var r=new t7.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=r},i.enableMacro=function(t){throw Error("Method not implemented.")},i.disableMacro=function(t){throw Error("Method not implemented.")},i.isMacroEnabled=function(t){throw Error("Method not implemented.")},i.clone=function(t){throw Error("Method not implemented.")},i.cloneUniforms=function(t){throw Error("Method not implemented.")},i.fromData=function(t){throw Error("Method not implemented.")},i.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},eU(r,[{key:"blending",get:function(){return this.material.blending!==t7.NoBlending},set:function(t){this.material.blending=t?t7.CustomBlending:t7.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,r=t.blendDst;return[e,r,t.blendSrcAlpha||e,t.blendDstAlpha||r]},set:function(t){if(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.material.blendSrc=su[e],this.material.blendDst=su[r],this.material.blendSrcAlpha=su[i],this.material.blendDstAlpha=su[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],r=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=r}}},{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=sh[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],r=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=r}}},{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=sc[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=sl[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=sl[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=sl[t[0]])}},{key:"culling",get:function(){return this.material.side!==t7.DoubleSide},set:function(t){this.material.side=t?t7.FrontSide:t7.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tm.FRONT?this.material.side=t7.FrontSide:t===tm.BACK&&(this.material.side=t7.BackSide)}}]),r}(r6),sd=1,sp=function(t){function e(e,r){if((i=t.call(this,e)||this).attributes={},i.destroyed=!1,i.attributesName=[],!r)return aa(i);var i,n=r.drawStart,o=r.drawCount,a=r.indices,s=r.mode,u=r.name,c=void 0===u?"effectsGeometry:"+sd++:u;i.name=c,i.mode=null!=s?s:rb.TRIANGLES;var l=[],h={},f=new t7.BufferGeometry;return Object.keys(r.attributes).forEach(function(t){var e=r.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===h[n]&&i.setAttributeType(n,e,f,h,r.maxVertex);var o=e.size,a=e.offset,s=e.normalize,u=h[n],c=u.buffer,m=u.dataLength,d=new t7.InterleavedBufferAttribute(c,o,(null!=a?a:0)/m,s);f.setAttribute(t,d),h[t]={buffer:c,attribute:d,type:u.type,dataLength:m}}}else i.setAttributeType(t,e,f,h,r.maxVertex);l.push(t)}),a&&a.data&&f.setIndex(new t7.BufferAttribute(a.data,1)),i.geometry=f,i.attributes=h,i.attributesName=l,i.drawStart=void 0===n?0:n,i.drawCount=null!=o?o:0,i}eG(e,t);var r=e.prototype;return r.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},r.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var r=this.attributes[t].buffer;if(e.length>r.array.length){var i=new t7.InterleavedBuffer(e,r.stride);r=this.attributes[t].attribute.data=i,this.geometry.setAttribute(t,this.attributes[t].attribute)}else r.set(e,0),r.updateRange.count=e.length,r.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},r.setAttributeSubData=function(t,e,r){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(r,e),this.geometry.attributes[t].needsUpdate=!0)},r.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*i0[e.type]},r.getAttributeNames=function(){return this.attributesName},r.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},r.setIndexData=function(t){t&&(this.geometry.setIndex(new t7.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},r.setIndexSubData=function(t,e){var r=this.geometry.getIndex();if(null!==r){var i=t+e.length;if(r.count<i){var n=new e.constructor(end);n.set(r.array),r.array=n}r.array.set(e,t),this.geometry.index.needsUpdate=!0}},r.setDrawStart=function(t){this.drawStart=t},r.getDrawStart=function(){return this.drawStart},r.setDrawCount=function(t){this.drawCount=t},r.getDrawCount=function(){return this.drawCount},r.getSkinProps=function(){return{}},r.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},r.setAttributeType=function(t,e,r,i,n){var o=e.stride,a=e.size,s=e.offset,u=e.normalize,c=e.type,l=void 0===c?rb.FLOAT:c,h=e.data;if(l&&!h&&(h=i2(l)),h){var f=er(h,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,m=(void 0===o?0:o)/f,d=(n=(null!=n?n:0)*m)||a*f;d&&0===h.length&&(h=er(h,Float32Array)?new Float32Array(d):new Uint16Array(d));var p=new t7.InterleavedBuffer(h,m),v=new t7.InterleavedBufferAttribute(p,a,(null!=s?s:0)/f,u);r.setAttribute(t,v),i[t]={buffer:p,attribute:v,type:l,dataLength:f}}},eU(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}(i1),sv=function(e){function r(t,r){if(!r)return aa(i);var i,n=r.material,o=r.geometry,a=r.priority;return(i=e.call(this,t,r)||this).geometry=o,i.material=n,o.mode===rb.LINES?i.mesh=new t7.LineSegments(o.geometry,n.material):i.mesh=new t7.Mesh(o.geometry,n.material),i.priority=void 0===a?0:a,i}eG(r,e);var i=r.prototype;return i.setVisible=function(t){this.mesh.visible=t},i.getVisible=function(){return this.mesh.visible},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e,this.mesh.material=e.material},i.start=function(){e.prototype.start.call(this),this.engine.threeGroup.add(this.mesh)},i.restore=function(){},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},eU(r,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),r}(i4),sy=function(e){function r(r,i,n){if(void 0===n&&(n={}),o=e.call(this,r)||this,i){var o,a=i.width,s=i.height;o.texture=o.createTextureByType(rI({},n,{sourceType:t.TextureSourceType.data,data:i})),o.width=void 0===a?1:a,o.height=void 0===s?1:s}else o.texture=o.createTextureByType(n);return o.texture.needsUpdate=!0,o}eG(r,e);var i=r.prototype;return i.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},i.startVideo=function(){var e=this;return ee(function(){var r;return eo(this,function(i){switch(i.label){case 0:if(e.sourceType!==t.TextureSourceType.video||!(r=e.texture.source.data).paused)return[3,2];return[4,r.play()];case 1:i.sent(),i.label=2;case 2:return[2]}})})()},i.assembleOptions=function(e){var i=e.target,n=void 0===i?rb.TEXTURE_2D:i;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),rI({},e,{target:n,format:t7.RGBAFormat,type:t7.UnsignedByteType,minFilter:r.toThreeJsTextureFilter(e.minFilter),magFilter:r.toThreeJsTextureFilter(e.magFilter),wrapS:r.toThreeJsTextureWrap(e.wrapS),wrapT:r.toThreeJsTextureWrap(e.wrapT)})},i.dispose=function(){this.texture.dispose()},i.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},i.createTextureByType=function(e){var r=this.assembleOptions(e),i=r.flipY,n=r.type,o=r.wrapS,a=r.wrapT,s=r.minFilter,u=r.magFilter,c=r.sourceType,l=t7.UVMapping,h=r.format,f=void 0;if(this.sourceType=c,c===t.TextureSourceType.data){var m=e.data;f=new t7.DataTexture(m.data,m.width,m.height,h,n,l,o,a,u,s),this.width=m.width,this.height=m.height}else if(c===t.TextureSourceType.image){var d=e.image;f=new t7.Texture(d,l,o,a,u,s,h,n),this.width=d.width,this.height=d.height}else if(c===t.TextureSourceType.compressed){var p=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,r=t.width,i=t.height;return p=p<r?r:p,v=v<i?i:v,{data:e,width:r,height:i,colorSpace:"srgb"}});h=t7.RGBA_ASTC_4x4_Format,f=new t7.CompressedTexture(y,p,v,h,n,l,o,a,u,s),this.width=p,this.height=v}else if(c===t.TextureSourceType.video)f=new t7.VideoTexture(e.video,l,o,a,u,s,h,n);else if(c===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,T,E=null!=(x=g.width)?x:0,b=null!=(T=g.height)?T:0;f=new t7.FramebufferTexture(E,b,h),this.width=E,this.height=b}}else c===t.TextureSourceType.none&&((f=new t7.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=t7.MirroredRepeatWrapping,f.wrapT=t7.MirroredRepeatWrapping,this.width=this.height=1);if(f)return f.flipY=!!i,f;throw Error("Create a texture using an unknown data type.")},r.toThreeJsTextureFilter=function(t){return t===rb.LINEAR?t7.LinearFilter:t7.NearestFilter},r.toThreeJsTextureWrap=function(t){switch(t){case rb.MIRRORED_REPEAT:return t7.MirroredRepeatWrapping;case rb.REPEAT:return t7.RepeatWrapping;default:return t7.ClampToEdgeWrapping}},r}(rq),sg=function(t){function e(e,r){return t.call(this,e,r)}eG(e,t);var r=e.prototype;return r.updateVideo=function(){this.textures.map(function(t){return t.startVideo()})},r.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,r=eH(this.rootComposition.items);!(e=r()).done;)for(var i,n=e.value.getComponents(rr),o=eH(n);!(i=o()).done;){var a=i.value;a.isActiveAndEnabled&&a.render(t)}for(var s,u=eH(this.refContent);!(s=u()).done;)for(var c,l=s.value,h=eH(l.getComponent(an).items);!(c=h()).done;)for(var f,m=c.value.getComponents(rr),d=eH(m);!(f=d()).done;){var p=f.value;p.isActiveAndEnabled&&p.render(t)}},r.getRendererOptions=function(){var t=sy.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}(so);sg.shape={};var sx=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new n_(e),r}return eG(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,r=t.threeGroup,i=t.composition;this.threeCamera=e,this.threeGroup=r,this.composition=i},e}(sa),sT=function(t){function e(e){var r;return(r=t.call(this)||this).engine=new sx(e),r.renderingData={currentFrame:{}},r}return eG(e,t),e}(nA),sE=function(t){function e(e,r){(i=t.call(this)||this).compositions=[],i.baseCompositionIndex=0,i.env="";var i,n=r.width,o=r.height,a=r.camera;return i.renderer=new sT(e),i.width=n,i.height=o,i.camera=a,i}eG(e,t);var r=e.prototype;return r.loadScene=function(t,e){var r=this;return ee(function(){var i,n;return eo(this,function(o){switch(o.label){case 0:if(n=r.baseCompositionIndex,!eM(t))return[3,2];return r.baseCompositionIndex+=t.length,[4,Promise.all(t.map(ee(function(t,i){var o;return eo(this,function(a){switch(a.label){case 0:return[4,r.createComposition(t,e)];case 1:return(o=a.sent()).setIndex(n+i),[2,o]}})})))];case 1:return i=o.sent(),[3,4];case 2:return r.baseCompositionIndex+=1,[4,r.createComposition(t,e)];case 3:(i=o.sent()).setIndex(n),o.label=4;case 4:return[2,i]}})})()},r.createComposition=function(t,e){void 0===e&&(e={});var r=this;return ee(function(){var i,n,o,a,s,u,c,l;return eo(this,function(h){switch(h.label){case 0:return i=performance.now(),n=rI({autoplay:!0},e),a3(t)?(o=t.url,a4(t)&&(n=rI({},n,t.options||{}))):o=t,r.assetManager?r.assetManager.updateOptions(n):r.assetManager=new st(n),[4,r.assetManager.loadScene(o,r.renderer,{env:r.env})];case 1:for(a=h.sent(),(s=r.renderer.engine).clearResources(),s.addPackageDatas(a),u=0;u<a.textureOptions.length;u++)a.textureOptions[u]=s.assetLoader.loadGUID(a.textureOptions[u].id),a.textureOptions[u].initialize();if(!s.database)return[3,3];return[4,s.createVFXItems(a)];case 2:h.sent(),h.label=3;case 3:return c=new sg(rI({},n,{width:r.width,height:r.height,renderer:r.renderer}),a),r.renderer.engine.setOptions({threeCamera:r.camera,threeGroup:r,composition:c}),n.autoplay?c.play():c.pause(),l=performance.now()-i+c.statistic.loadTime,c.statistic.firstFrameTime=l,eR.info("First frame: ["+c.name+"]"+l.toFixed(4)+"ms."),r.compositions.push(c),[2,c]}})})()},r.update=function(t){this.compositions.forEach(function(e){e.update(t)})},eU(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(t7.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var r=e.prototype;return r.setVisible=function(t){this.threeMesh.visible=t},r.getVisible=function(){return this.threeMesh.visible},r.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},r.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===rb.LINES?this.threeMesh=new t7.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new t7.Mesh(this.geometry.geometry,this.material.material))},r.start=function(){t.prototype.start.call(this),this.engine.threeGroup.add(this.threeMesh)},r.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))},r.onDestroy=function(){this.threeMesh.clear()},eU(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=en([e5(tH.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,r){if((i=t.call(this,e,r)||this).isDirty=!0,i.canvas=ac.getCanvas(),ac.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return aa(i);var i,n=r.options;return i.updateWithOptions(n),i.updateTexture(!1),i}eG(e,t);var r=e.prototype;return r.update=function(e){t.prototype.update.call(this,e),this.updateTexture(!1)},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options;this.updateWithOptions(r),this.updateTexture(!1)},r.updateWithOptions=function(t){},r.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=en([e5(tH.TextComponent)],t.ThreeTextComponent),eD(t.ThreeTextComponent,[ah]),nV(8),rq.create=function(t,e){return new sy(t,void 0,e)},rq.createWithData=function(t,e,r){return new sy(t,e,r)},r6.create=function(t,e){return new sm(t,e)},i1.create=function(t,e){return new sp(t,e)},i4.create=function(t,e){return new sv(t,e)};var sb="2.0.0-alpha.25";eR.info("THREEJS plugin version: "+sb+"."),t.AbstractPlugin=ri,t.ActivationPlayable=o5,t.AnimationClipPlayable=o6,t.AssetLoader=aE,t.AssetManager=st,t.BYTES_TYPE_MAP=i0,t.Behaviour=rt,t.BezierCurve=iV,t.BezierCurvePath=iz,t.BezierCurveQuat=iN,t.CONSTANT_MAP_BLEND=su,t.CONSTANT_MAP_DEPTH=sh,t.CONSTANT_MAP_STENCIL_FUNC=sc,t.CONSTANT_MAP_STENCIL_OP=sl,t.COPY_FRAGMENT_SHADER=iZ,t.COPY_MESH_SHADER_ID=iW,t.COPY_VERTEX_SHADER=iY,t.CalculateLoader=oK,t.Camera=sr,t.CameraVFXItemLoader=rn,t.Component=e7,t.Composition=so,t.CompositionComponent=an,t.CompositionSourceManager=sn,t.DEFAULT_FONTS=al,t.Database=ab,t.Downloader=rL,t.EFFECTS_COPY_MESH_NAME=ij,t.EVENT_TYPE_CLICK=ro,t.EVENT_TYPE_TOUCH_END=ru,t.EVENT_TYPE_TOUCH_MOVE=rs,t.EVENT_TYPE_TOUCH_START=ra,t.EffectsObject=e9,t.Engine=sa,t.EventSystem=rc,t.Float16ArrayWrapper=r9,t.Framebuffer=nS,t.GPUCapability=n_,t.Geometry=i1,t.GlobalUniforms=nT,t.GradientValue=iL,t.HELP_LINK=rT,t.InteractLoader=rh,t.InteractMesh=nw,t.ItemBehaviour=re,t.KTXTexture=r0,t.LineSegments=iP,t.LinearValue=iI,t.Material=r6,t.MaterialDataBlock=r3,t.Mesh=i4,t.PLAYER_OPTIONS_ENV_EDITOR=rx,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=oG,t.ParticleBehaviourPlayableAsset=oX,t.ParticleLoader=oQ,t.ParticleMesh=oj,t.ParticleSystemRenderer=oL,t.PassTextureCache=iJ,t.PathSegments=iF,t.PluginSystem=ag,t.RENDER_PASS_NAME_PREFIX=np,t.RENDER_PREFER_LOOKUP_TEXTURE=nj,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=iw,t.RandomValue=iO,t.RandomVectorValue=iM,t.RenderFrame=ny,t.RenderPass=i8,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=i5,t.Renderbuffer=nE,t.Renderer=nA,t.RendererComponent=rr,t.RuntimeClip=o9,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=i$,t.SerializationHelper=aT,t.ShaderVariant=iH,t.SpriteColorPlayable=nH,t.SpriteLoader=nz,t.StaticValue=iR,t.TEMPLATE_USE_OFFSCREEN_CANVAS=nW,t.TEXTURE_UNIFORM_MAP=sf,t.TextComponentBase=ah,t.TextLayout=as,t.TextLoader=af,t.TextStyle=au,t.Texture=rq,t.TextureFactory=r2,t.ThreeComposition=sg,t.ThreeDisplayObject=sE,t.ThreeEngine=sx,t.ThreeMaterial=sm,t.ThreeTexture=sy,t.Ticker=ss,t.TimelineClip=o8,t.TimelinePlayable=at,t.TrackSortWrapper=ae,t.Transform=nQ,t.TransformAnimationPlayable=o4,t.ValueGetter=iA,t.addByOrder=eb,t.addItem=el,t.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(i)for(;t[n-1][r]<o[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>o[r]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.applyMixins=eD,t.assertExist=eC,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=eN,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=ie,t.canvasPool=ac,t.colorGradingFrag=no,t.colorStopsFromGradient=ep,t.colorToArr=em,t.combineImageTemplate=a6,t.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.createCopyShader=iq,t.createGLContext=function(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"!==e||(i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i},t.createKeyFrameMeta=iX,t.createShaderWithMacros=rR,t.createShape=oe,t.createVFXItem=function(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case tx.null:i="cal";break;case tx.sprite:i="sprite";break;case tx.particle:i="particle";break;case tx.interact:i="interact";break;case tx.camera:i="camera";break;case tx.text:i="text";break;case tx.tree:i="tree";break;default:throw Error("Invalid vfx item type.")}return e.pluginSystem.createPluginItem(i,t,e)},t.createValueGetter=ik,t.decimalEqual=il,t.defaultGlobalVolume=nd,t.defaultPlugins=ap,t.deserializeMipmapTexture=rj,t.earcut=og,t.effectsClass=e5,t.effectsClassStore=e4,t.enlargeBuffer=ef,t.ensureFixedNumber=aC,t.ensureVec3=ir,t.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-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=na,t.gaussianDownVFrag=ns,t.gaussianUpFrag=nu,t.generateEmptyTypedArray=i2,t.generateGUID=ez,t.generateHalfFloatTexture=rQ,t.generateTransparentTexture=r$,t.generateWhiteTexture=rJ,t.getBackgroundImage=a5,t.getColorFromGradientStops=ed,t.getConfig=function(t){return nY[t]},t.getDefaultTemplateCanvasPool=function(){return ac},t.getDefaultTextureFactory=function(){return tQ||(tQ=new r2),tQ},t.getGeometryByShape=oT,t.getGeometryTriangles=ox,t.getImageItemRenderInfo=nM,t.getKTXTextureOptions=r1,t.getKeyFrameMetaByRawValue=iG,t.getMergedStore=e6,t.getParticleMeshShader=oZ,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=rS,t.getStandardComposition=aK,t.getStandardImage=aQ,t.getStandardItem=a$,t.getStandardJSON=aZ,t.getTextureSize=ng,t.glContext=rb,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tW.Float32;case WebGLRenderingContext.SHORT:return tW.Int16;case WebGLRenderingContext.BYTE:return tW.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tW.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tW.UInt8;default:return tW.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),i=ee(function(){return eo(this,function(n){return[2,new Promise(function(n,o){if(r){var a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);a&&!s&&n(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(a||s)&&(t.deleteQuery(r),r=null),null!==a&&r&&window.setTimeout(function(){i().then(n).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:i}}},t.imageDataFromColor=function(t){eO(t)&&(t=em(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r},t.imageDataFromGradient=eT,t.initErrors=rE,t.initGLContext=r_,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=ev,t.isAlipayMiniApp=function(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"},t.isAndroid=eg,t.isArray=eM,t.isCanvas=eP,t.isFunction=eI,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=eL,t.isSceneJSON=a2,t.isSceneURL=a3,t.isSceneWithOptions=a4,t.isSimulatorCellPhone=ex,t.isString=eO,t.isUniformStruct=r4,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&r4(t[0])},t.isValidFontFamily=eS,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemFrag=nt,t.itemFrameFrag=i9,t.itemVert=i7,t.loadBinary=rD,t.loadBlob=function(t){return rU.apply(this,arguments)},t.loadImage=rz,t.loadMedia=rX,t.loadVideo=rB,t.loadWebPOptional=rV,t.logger=eR,t.math=rg,t.modifyMaxKeyframeShader=oq,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=ew,t.normalizeColor=aM,t.numberToFix=ih,t.parsePercent=ey,t.particleFrag=ne,t.particleOriginTranslateMap=is,t.particleUniformTypeMap=oH,t.particleVert=nr,t.pluginLoaderMap=ad,t.pointOnLine=function(t,e,r,i,n,o){var a=t*i+e*n+r*o-n*i-o*t-r*e;return a>-.001&&a<.001},t.randomInRange=eV,t.registerPlugin=ay,t.removeItem=eh,t.rotateVec2=oE,t.screenMeshVert=nn,t.serialize=function(t,e){return e8(t,e)},t.setBlendMode=rw,t.setConfig=function(t,e){return nY[t]=e},t.setDefaultTextureFactory=function(t){tQ=t},t.setMaskMode=rM,t.setMaxSpriteMeshItemCount=nV,t.setRayFromCamera=iu,t.setSideMode=rO,t.setSpriteMeshMaxItemCountByGPU=function(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0},t.setUniformValue=function(t,e,r){t[e]?t[e].value=r:t[e]=new t7.Uniform(r)},t.sortByOrder=eE,t.spec=e1,t.spriteMeshShaderFromFilter=nI,t.spriteMeshShaderFromRenderInfo=nP,t.spriteMeshShaderIdFromRenderInfo=nL,t.thresholdFrag=nc,t.throwDestroyedError=eF,t.trailVert=ni,t.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},t.trianglesFromRect=ic,t.unregisterPlugin=function(t){delete av[t],delete ad[t],eh(ap,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\nin float aSeed;out 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.vecAssign=io,t.vecFill=ii,t.vecMulCombine=ia,t.vecNormalize=function(t,e){1==arguments.length&&(e=t,t=[]);var r,i=e,n=(r=Math).hypot.apply(r,[].concat(i));if(0===n)return io(t,i,i.length);for(var o=0;o<i.length;o++)t[o]=i[o]/n;return t},t.version=sb,t.vertexFormatType2GLType=function(t){switch(t){case tW.Float32:return WebGLRenderingContext.FLOAT;case tW.Int16:return WebGLRenderingContext.SHORT;case tW.Int8:return WebGLRenderingContext.BYTE;case tW.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tW.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
6
|
+
* Version: v2.0.0-alpha.27
|
|
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,o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w,O,R,I,M,L,P,V,F,N,D,z,k,U,B,G,X,j,H,W,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,to,ta,ts,tu,tc,th,tl,tf,td,tp,tm,tv,ty,tg,tx,tT,tb,tE,t_,tC,tS,tA,tw,tO,tR,tI,tM,tL,tP,tV,tF,tN,tD,tz,tk,tU,tB,tG,tX,tj,tH,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7=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 et(t,e,i,r,n,o,a){try{var s=t[o](a),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function ee(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var o=t.apply(e,i);function a(t){et(o,r,n,a,s,"next",t)}function s(t){et(o,r,n,a,s,"throw",t)}a(void 0)})}}function ei(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):ei(t,e)}function er(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function en(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a}function eo(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)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 a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}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 ea=new Uint8Array(16),es=[],eu=0;eu<256;++eu)es.push((eu+256).toString(16).slice(1));var ec={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function eh(t,e){return t.includes(e)||t.push(e),t}function el(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ef(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 o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function ed(t,e){var i=[0,0,0,0];if(eR(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 ei(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function ep(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){r=ev(o.color,a.color,(e-o.stop)/(a.stop-o.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 em(t){var e=[];if(ei(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4];e.push({stop:ey(i),color:[r,n,o,a]})}):Object.keys(t).forEach(function(i){var r=ed(t[i]);e.push({stop:ey(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 ev(t,e,i,r){var n=[],o=1-i;if(r)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*i));n[3]=Math.round(t[3]*o+e[3]*i)}return n}function ey(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eg(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ex(){return eg()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eT(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=em(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var o=n/128,a=void 0,s=void 0,u=0;u<r.length&&(a=r[u],s=r[u+1],!(a.stop<=o)||!(s.stop>o));u++);var c=ev(a.color,s.color,(o-a.stop)/(s.stop-a.stop));i.set(c,4*n)}i.set(r[r.length-1].color,508)}return e}function eb(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 o,a,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++}o=[e[c],e[u]],e[u]=o[0],e[c]=o[1]}return a=[e[u],e[r]],e[r]=a[0],e[u]=a[1],t(e,i,r,u-1),t(e,i,c+1,n),e}(t,e);for(var r=1;r<i;r++)e_(t,r,e);return t}function eE(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&e_(t,t.length-1,i)),t}function e_(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 eC(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eS(t){return/^[^\d.][\w-]*$/.test(t)}function eA(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 ew={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(eA(t),[r])),null==tc||tc("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(eA(t))),null==tc||tc("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(eA(t))),null==tc||tc("warn",t,r)},register:function(t){t&&eM(t)&&(tc=t)}};function eO(){}function eR(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 eI=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eM(t){return"[object Function]"===Object.prototype.toString.call(t)}function eL(t){return"[object Object]"===Object.prototype.toString.call(t)}function eP(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eV(t,e){return t+Math.random()*(e-t)}function eF(){throw Error("Destroyed item cannot be used again.")}function eN(){return(function(t,e,i){if(ec.randomUUID&&!t)return ec.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tu&&!(tu="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 tu(ea)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),es[n[r+0]]+es[n[r+1]]+es[n[r+2]]+es[n[r+3]]+"-"+es[n[r+4]]+es[n[r+5]]+"-"+es[n[r+6]]+es[n[r+7]]+"-"+es[n[r+8]]+es[n[r+9]]+"-"+es[n[r+10]]+es[n[r+11]]+es[n[r+12]]+es[n[r+13]]+es[n[r+14]]+es[n[r+15]]})().replace(/-/g,"")}function eD(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],o=0;o<r.length;o+=512){for(var a=r.slice(o,o+512),s=Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var c=new Uint8Array(s);n.push(c)}return new File([new Blob(n,{type:i})],e,{type:i})}function ez(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)})})}function ek(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 eU(t,e,i){return e&&ek(t.prototype,e),i&&ek(t,i),t}function eB(t,e){return(eB=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function eG(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&&eB(t,e)}function eX(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 ej(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 eX(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 eX(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.")}var eH=Math.PI/180,eW=180/Math.PI;function eY(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var eZ=function(t,e,i){return(1-i)*t+i*e};function eq(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 eQ=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):ei(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):ei(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):ei(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):ei(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}();eQ.ONE=new eQ(1,1),eQ.ZERO=new eQ(0,0);var eK=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):ei(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):ei(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):ei(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):ei(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,o=e.x,a=e.y,s=e.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,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 eQ(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}();eK.X=new eK(1,0,0),eK.Y=new eK(0,1,0),eK.Z=new eK(0,0,1),eK.ONE=new eK(1,1,1),eK.ZERO=new eK(0,0,0);var eJ=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),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.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],o=e[1],a=e[5],s=e[9],u=e[2],c=e[6],h=e[10],l=i+a+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=(o-r)*f}else if(i>a&&i>h){var d=2*Math.sqrt(1+i-a-h);this.w=(c-s)/d,this.x=.25*d,this.y=(r+o)/d,this.z=(n+u)/d,this.negate()}else if(a>h){var p=2*Math.sqrt(1+a-i-h);this.w=(n-u)/p,this.x=(r+o)/p,this.y=.25*p,this.z=(s+c)/p,this.negate()}else{var m=2*Math.sqrt(1+h-i-a);this.w=(o-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(eq(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,o=t.w,a=e.x,s=e.y,u=e.z,c=e.w;return this.x=i*c+o*a+r*u-n*s,this.y=r*c+o*s+n*a-i*u,this.z=n*c+o*u+i*s-r*a,this.w=o*c-i*a-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,o=this.w,a=o*t.w+i*t.x+r*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=i,this.y=r,this.z=n,this;var s=1-a*a;if(s<=Number.EPSILON){var u=1-e;return this.w=u*o+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,a),l=Math.sin((1-e)*h)/c,f=Math.sin(e*h)/c;return this.w=o*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,o=this.w,a=t.x,s=t.y,u=t.z,c=o*a+r*u-n*s,h=o*s+n*a-i*u,l=o*u+i*s-r*a,f=-i*a-r*s-n*u,d=null!=e?e:t;return d.x=c*o+-(f*i)+-(h*n)- -(l*r),d.y=h*o+-(f*r)+-(l*i)- -(c*n),d.z=l*o+-(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(eK.ZERO,this,eK.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}();eJ.tempVec0=new eK;var e$=function(){function t(t,e,i,r,n,o,a,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===o&&(o=1),void 0===a&&(a=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,o,a,s,u,c,h,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,a,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]=o,v[6]=a,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,o,a,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]=o,v[9]=a,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),o=Math.sin(i),a=1-n,s=r.x,u=r.y,c=r.z,h=a*s,l=a*u;return this.set(h*s+n,h*u+o*c,h*c-o*u,0,h*u-o*c,l*u+n,l*c+o*s,0,h*c+o*u,l*c-o*s,a*c*c+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(eK.ZERO,t,eK.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,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,i),a.normalize(),n.crossVectors(r,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.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,o=i[0],a=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],T=i[15],b=r[0],E=r[4],_=r[8],C=r[12],S=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],N=r[15];return n[0]=o*b+a*S+s*R+u*P,n[4]=o*E+a*A+s*I+u*V,n[8]=o*_+a*w+s*M+u*F,n[12]=o*C+a*O+s*L+u*N,n[1]=c*b+h*S+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*C+h*O+l*L+f*N,n[2]=d*b+p*S+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*C+p*O+m*L+v*N,n[3]=y*b+g*S+x*R+T*P,n[7]=y*E+g*A+x*I+T*V,n[11]=y*_+g*w+x*M+T*F,n[15]=y*C+g*O+x*L+T*N,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],o=t[1],a=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*a*l+i*u*l+r*a*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*o*l-r*o*f+r*u*c-n*s*c)+t[11]*(+e*u*h-e*a*f-n*o*h+i*o*f+n*a*c-i*u*c)+t[15]*(-r*a*c-e*s*h+e*a*l+r*o*h-i*o*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],o=t[4],a=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-a*m*f-h*s*v+a*l*v,g=d*l*u-c*m*u-d*s*f+o*m*f+c*s*v-o*l*v,x=c*p*u-d*h*u+d*a*f-o*p*f-c*a*v+o*h*v,T=d*h*s-c*p*s-d*a*l+o*p*l+c*a*m-o*h*m,b=e*y+i*g+r*x+n*T;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/b;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]=(a*m*n-p*s*n+p*r*u-i*m*u-a*r*v+i*s*v)*E,t[3]=(h*s*n-a*l*n-h*r*u+i*l*u+a*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-o*m*n-d*r*u+e*m*u+o*r*v-e*s*v)*E,t[7]=(o*l*n-c*s*n+c*r*u-e*l*u-o*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]=(o*p*n-d*a*n+d*i*u-e*p*u-o*i*v+e*a*v)*E,t[11]=(c*a*n-o*h*n-c*i*u+e*h*u+o*i*f-e*a*f)*E,t[12]=T*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*a*r-o*p*r-d*i*s+e*p*s+o*i*m-e*a*m)*E,t[15]=(o*h*r-c*a*r+c*i*s-e*h*s-o*i*l+e*a*l)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=eK.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,c=-r.x,h=-r.y,l=-r.z,f=o+o,d=a+a,p=s+s,m=o*f,v=o*d,y=o*p,g=a*d,x=a*p,T=s*p,b=u*f,E=u*d,_=u*p,C=i.x,S=i.y,A=i.z;return n[0]=(1-(g+T))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+T))*S,n[6]=(x+b)*S,n[7]=0,n[8]=(y+E)*A,n[9]=(x-b)*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,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var c=t.tempMat0;c.copyFrom(this);var h=1/a,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=a,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 eK,e=new eJ,i=new eK;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,o){var a=1/(e-t),s=1/(i-r),u=1/(o-n),c=-(e+t)*a,h=-(i+r)*s,l=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=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 o=1/Math.tan(.5*t),a=1/(i-r),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*a,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,o=this.elements,a=null!=e?e:t;a.x=o[0]*i+o[4]*r+o[8]*n+o[12],a.y=o[1]*i+o[5]*r+o[9]*n+o[13],a.z=o[2]*i+o[6]*r+o[10]*n+o[14];var s=o[3]*i+o[7]*r+o[11]*n+o[15];return a.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n+o[12],a.y=o[1]*i+o[5]*r+o[9]*n+o[13],a.z=o[2]*i+o[6]*r+o[10]*n+o[14],a},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n,a.y=o[1]*i+o[5]*r+o[9]*n,a.z=o[2]*i+o[6]*r+o[10]*n,a.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12]*o,s.y=a[1]*i+a[5]*r+a[9]*n+a[13]*o,s.z=a[2]*i+a[6]*r+a[10]*n+a[14]*o,s.w=a[3]*i+a[7]*r+a[11]*n+a[15]*o,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!eY(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,o){return new t().perspective(e,i,r,n,o)},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,o,a,s,u,c,h,l,f,d,p,m,v){return new t(e,o,c,d,i,a,h,p,r,s,l,m,n,u,f,v)},t}();e$.IDENTITY=new e$(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),e$.ZERO=new e$(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),e$.tempVec0=new eK,e$.tempVec1=new eK,e$.tempVec2=new eK,e$.tempMat0=new e$,(n=th||(th={}))[n.XYZ=0]="XYZ",n[n.XZY=1]="XZY",n[n.YXZ=2]="YXZ",n[n.YZX=3]="YZX",n[n.ZXY=4]="ZXY",n[n.ZYX=5]="ZYX";var e0=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],o=i[8],a=i[1],s=i[5],u=i[9],c=i[2],h=i[6],l=i[10];switch(e){case th.XYZ:this.y=Math.asin(eq(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(h,s),this.z=0);break;case th.YXZ:this.x=Math.asin(-eq(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(o,l),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,r),this.z=0);break;case th.ZXY:this.x=Math.asin(eq(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(a,r));break;case th.ZYX:this.y=Math.asin(-eq(c,-1,1)),.9999999>Math.abs(c)?(this.x=Math.atan2(h,l),this.z=Math.atan2(a,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case th.YZX:this.z=Math.asin(eq(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,r)):(this.x=0,this.y=Math.atan2(o,l));break;case th.XZY:this.z=Math.asin(-eq(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(h,s),this.y=Math.atan2(o,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=eW,this.y*=eW,this.z*=eW,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,o,a;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(o=t[e+2])?o:0,this.order=null!=(a=t[e+3])?a:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new eJ;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,o=Math.cos(e*eH*.5),a=Math.cos(i*eH*.5),s=Math.cos(r*eH*.5),u=Math.sin(e*eH*.5),c=Math.sin(i*eH*.5),h=Math.sin(r*eH*.5);switch(n){case th.XYZ:t.set(u*a*s+o*c*h,o*c*s-u*a*h,o*a*h+u*c*s,o*a*s-u*c*h);break;case th.YXZ:t.set(u*a*s+o*c*h,o*c*s-u*a*h,o*a*h-u*c*s,o*a*s+u*c*h);break;case th.ZXY:t.set(u*a*s-o*c*h,o*c*s+u*a*h,o*a*h+u*c*s,o*a*s-u*c*h);break;case th.ZYX:t.set(u*a*s-o*c*h,o*c*s+u*a*h,o*a*h-u*c*s,o*a*s+u*c*h);break;case th.YZX:t.set(u*a*s+o*c*h,o*c*s+u*a*h,o*a*h-u*c*s,o*a*s-u*c*h);break;case th.XZY:t.set(u*a*s-o*c*h,o*c*s-u*a*h,o*a*h+u*c*s,o*a*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,o=this.order,a=Math.cos(i*eH),s=Math.sin(i*eH),u=Math.cos(r*eH),c=Math.sin(r*eH),h=Math.cos(n*eH),l=Math.sin(n*eH);if(o===th.XYZ){var f=a*h,d=a*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]=a*u}else if(o===th.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]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=a*u}else if(o===th.ZXY){var T=u*h,b=u*l,E=c*h,_=c*l;e[0]=T-_*s,e[4]=-a*l,e[8]=E+b*s,e[1]=b+E*s,e[5]=a*h,e[9]=_-T*s,e[2]=-a*c,e[6]=s,e[10]=a*u}else if(o===th.ZYX){var C=a*h,S=a*l,A=s*h,w=s*l;e[0]=u*h,e[4]=A*c-S,e[8]=C*c+w,e[1]=u*l,e[5]=w*c+C,e[9]=S*c-A,e[2]=-c,e[6]=s*u,e[10]=a*u}else if(o===th.YZX){var O=a*u,R=a*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]=a*h,e[9]=-s*h,e[2]=-c*h,e[6]=R*l+I,e[10]=O-M*l}else if(o===th.XZY){var L=a*u,P=a*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]=a*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 "+o);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}();e0.DEFAULT_ORDER=th.ZYX,e0.tempQuat0=new eJ,e0.tempMat0=new e$,(o=tl||(tl={})).S="S",o.APlus="A+",o.A="A",o.BPlus="B+",o.B="B",(a=tf||(tf={}))[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",(s=td||(td={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tp||(tp={}))[u.NONE=0]="NONE",u[u.MASK=1]="MASK",u[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(c=tm||(tm={}))[c.NONE=0]="NONE",c[c.SPHERE=1]="SPHERE",c[c.CONE=2]="CONE",c[c.HEMISPHERE=3]="HEMISPHERE",c[c.CIRCLE=4]="CIRCLE",c[c.DONUT=5]="DONUT",c[c.RECTANGLE=6]="RECTANGLE",c[c.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",c[c.EDGE=8]="EDGE",c[c.TEXTURE=9]="TEXTURE",(h=tv||(tv={}))[h.GYROSCOPE=0]="GYROSCOPE",h[h.SPINE=1]="SPINE",(l=ty||(ty={}))[l.CLICK=0]="CLICK",l[l.MESSAGE=1]="MESSAGE",l[l.DRAG=2]="DRAG",(f=tg||(tg={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(d=tx||(tx={})).base="0",d.sprite="1",d.particle="2",d.null="3",d.interact="4",d.plugin="5",d.camera="6",d.composition="7",d.spine="spine",d.mesh="mesh",d.tree="tree",d.text="text",d.light="light",d.skybox="skybox",d.effect="effect",d.node="node",(p=tT||(tT={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=tb||(tb={}))[m.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",m[m.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",m[m.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",m[m.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",m[m.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",m[m.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",m[m.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",m[m.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",m[m.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=tE||(tE={})).Opaque="Opaque",v.Transparent="Transparent",(y=t_||(t_={})).Both="Both",y.Back="Back",y.Front="Front",(g=tC||(tC={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tS||(tS={})).video="video",x.image="image",(T=tA||(tA={}))[T.CONSTANT=0]="CONSTANT",T[T.CONSTANT_VEC2=1]="CONSTANT_VEC2",T[T.CONSTANT_VEC3=2]="CONSTANT_VEC3",T[T.CONSTANT_VEC4=3]="CONSTANT_VEC4",T[T.RANDOM=4]="RANDOM",T[T.LINE=5]="LINE",T[T.CURVE=6]="CURVE",T[T.BEZIER_PATH=7]="BEZIER_PATH",T[T.RGBA_COLOR=8]="RGBA_COLOR",T[T.GRADIENT_COLOR=9]="GRADIENT_COLOR",T[T.SHAPE_POINTS=10]="SHAPE_POINTS",T[T.SHAPE_SPLITS=11]="SHAPE_SPLITS",T[T.LINEAR_PATH=12]="LINEAR_PATH",T[T.COLORS=13]="COLORS",T[T.BINARY=20]="BINARY",T[T.BEZIER_CURVE=21]="BEZIER_CURVE",T[T.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",T[T.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",(b=tw||(tw={}))[b.AUTO=0]="AUTO",b[b.EASE=1]="EASE",b[b.EASE_IN=2]="EASE_IN",b[b.EASE_OUT=3]="EASE_OUT",b[b.LINE=4]="LINE",b[b.HOLD=5]="HOLD",b[b.LINE_OUT=6]="LINE_OUT",(E=tO||(tO={}))[E.destroy=0]="destroy",E[E.restart=5]="restart",E[E.forward=2]="forward",E[E.freeze=4]="freeze",(_=tR||(tR={}))[_.destroyChildren=6]="destroyChildren",(C=tI||(tI={}))[C.none=0]="none",C[C.removeParticle=1]="removeParticle",(S=tM||(tM={}))[S.RANDOM=0]="RANDOM",S[S.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",S[S.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",S[S.UNIFORM_BURST=3]="UNIFORM_BURST",(A=tL||(tL={})).point="point",A.spot="spot",A.directional="directional",A.ambient="ambient",(w=tP||(tP={}))[w.box=2]="box",w[w.sphere=3]="sphere",(O=tV||(tV={})).orthographic="orthographic",O.perspective="perspective",(R=tF||(tF={})).unlit="unlit",R.pbr="pbr",R.hair="hair",(I=tN||(tN={}))[I.opaque=100]="opaque",I[I.masked=101]="masked",I[I.translucent=102]="translucent",I[I.additive=103]="additive",(M=tD||(tD={})).none="none",M.uv="uv",M.normal="normal",M.basecolor="basecolor",M.alpha="alpha",M.metallic="metallic",M.roughness="roughness",M.ao="ao",M.emissive="emissive",(L=tz||(tz={}))[L.display=0]="display",L[L.clip=1]="clip",L[L.ellipsis=2]="ellipsis",(P=tk||(tk={}))[P.top=0]="top",P[P.middle=1]="middle",P[P.bottom=2]="bottom",(V=tU||(tU={}))[V.left=0]="left",V[V.middle=1]="middle",V[V.right=2]="right",(F=tB||(tB={})).normal="normal",F.bold="bold",F.lighter="lighter",(N=tG||(tG={})).normal="normal",N.italic="italic",N.oblique="oblique",(D=tX||(tX={})).VFXItemData="VFXItemData",D.EffectComponent="EffectComponent",D.Material="Material",D.Shader="Shader",D.SpriteComponent="SpriteComponent",D.ParticleSystem="ParticleSystem",D.InteractComponent="InteractComponent",D.CameraController="CameraController",D.Geometry="Geometry",D.Texture="Texture",D.AnimationClip="AnimationClip",D.TextComponent="TextComponent",D.BinaryAsset="BinaryAsset",D.TrackAsset="TrackAsset",D.TimelineAsset="TimelineAsset",D.ObjectBindingTrack="ObjectBindingTrack",D.TransformTrack="TransformTrack",D.SpriteColorTrack="SpriteColorTrack",D.ActivationTrack="ActivationTrack",D.SubCompositionTrack="SubCompositionTrack",D.TransformPlayableAsset="TransformPlayableAsset",D.SpriteColorPlayableAsset="SpriteColorPlayableAsset",D.ActivationPlayableAsset="ActivationPlayableAsset",D.SubCompositionPlayableAsset="SubCompositionPlayableAsset",D.MeshComponent="MeshComponent",D.SkyboxComponent="SkyboxComponent",D.LightComponent="LightComponent",D.CameraComponent="CameraComponent",D.ModelPluginComponent="ModelPluginComponent",D.TreeComponent="TreeComponent",D.AnimationComponent="AnimationComponent",D.SpineComponent="SpineComponent",D.TimelineClip="TimelineClip",(z=tj||(tj={}))[z.POINTS=0]="POINTS",z[z.LINES=1]="LINES",z[z.LINE_LOOP=2]="LINE_LOOP",z[z.LINE_STRIP=3]="LINE_STRIP",z[z.TRIANGLES=4]="TRIANGLES",z[z.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",z[z.TRIANGLE_FAN=6]="TRIANGLE_FAN",(k=tH||(tH={}))[k.Float16=0]="Float16",k[k.Float32=1]="Float32",k[k.Int8=2]="Int8",k[k.Int16=3]="Int16",k[k.Int32=4]="Int32",k[k.UInt8=5]="UInt8",k[k.UInt16=6]="UInt16",k[k.UInt32=7]="UInt32",(U=tW||(tW={}))[U.None=-1]="None",U[U.UInt8=0]="UInt8",U[U.UInt16=1]="UInt16",U[U.UInt32=2]="UInt32",(B=tY||(tY={})).Position="POSITION",B.Uv="TEXCOORD0",B.Uv2="TEXCOORD1",B.Normal="NORMAL",B.Tangent="TANGENT",B.Color="COLOR",B.Joints="JOINTS",B.Weights="WEIGHTS",B.PositionBS0="POSITION_BS0",B.PositionBS1="POSITION_BS1",B.PositionBS2="POSITION_BS2",B.PositionBS3="POSITION_BS3",B.PositionBS4="POSITION_BS4",B.PositionBS5="POSITION_BS5",B.PositionBS6="POSITION_BS6",B.PositionBS7="POSITION_BS7",B.NormalBS0="NORMAL_BS0",B.NormalBS1="NORMAL_BS1",B.NormalBS2="NORMAL_BS2",B.NormalBS3="NORMAL_BS3",B.TangentBS0="TANGENT_BS0",B.TangentBS1="TANGENT_BS1",B.TangentBS2="TANGENT_BS2",B.TangentBS3="TANGENT_BS3";var e1=Object.freeze({__proto__:null,get RenderLevel(){return tl},get BlendingMode(){return tf},get SideMode(){return td},get MaskMode(){return tp},get ShapeType(){return tm},get PluginType(){return tv},get InteractType(){return ty},get InteractBehavior(){return tg},get ItemType(){return tx},get RenderMode(){return tT},get ParticleOrigin(){return tb},get RenderType(){return tE},get RenderFace(){return t_},get CameraClipMode(){return tC},get BackgroundType(){return tS},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 tA},get BezierKeyframeType(){return tw},get EndBehavior(){return tO},get ParentItemEndBehavior(){return tR},get ParticleInteractionBehavior(){return tI},get ShapeArcMode(){return tM},get LightType(){return tL},get ModelBoundingType(){return tP},get CameraType(){return tV},get MaterialType(){return tF},get MaterialBlending(){return tN},get RenderMode3D(){return tD},get TextOverflow(){return tz},get TextBaseline(){return tk},get TextAlignment(){return tU},get TextWeight(){return tB},get FontStyle(){return tG},get DataType(){return tX},get GeometryType(){return tj},get VertexFormatType(){return tH},get IndexFormatType(){return tW},get VertexBufferSemantic(){return tY},BuiltinObjectGUID:{WhiteTexture:"whitetexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"}}),e2=new Map,e3=new Map,e4={};function e5(t){return function(e,i){e4[t]&&console.warn("Class "+t+" is already registered."),e4[t]=e}}function e6(t){var e=t.constructor;if(e3.get(e))return e3.get(e);var i={};e3.set(e,i);for(var r=t,n=e;n;){var o=e2.get(n);for(var a in o)i[a]=o[a];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function e8(t,e){return function(i,r){var n,o=(n=i.constructor,e2.get(n)||e2.set(n,{}),e2.get(n));o&&(o[r]||(o[r]={type:t,sourceName:e}))}}var e9=function(){function t(t){this.engine=t,this.guid=eN(),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 ei(e,t)&&"guid"in e},t}();en([e8(void 0,void 0)],e9.prototype,"guid",void 0);var e7=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.onAttached=function(){},i.onDestroy=function(){},i.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},i.dispose=function(){this.onDestroy(),this.item&&el(this.item.components,this)},eU(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(e9),it=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e._enabled=!0,e}eG(e,t);var i=e.prototype;return i.onBehaviourEnable=function(){},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},eU(e,[{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onBehaviourEnable()}}]),e}(e7);en([e8(void 0,void 0)],it.prototype,"_enabled",void 0);var ie=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e}eG(e,t);var i=e.prototype;return i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.onAttached=function(){this.item.itemBehaviours.push(this)},i.dispose=function(){this.item&&el(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},i.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(it),ii=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e.materials=[],e._priority=0,e._enabled=!0,e}eG(e,t);var i=e.prototype;return i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.render=function(t){},i.onAttached=function(){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&&el(this.item.rendererComponents,this),t.prototype.dispose.call(this)},eU(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(e7);en([e8(void 0,void 0)],ii.prototype,"materials",void 0),en([e8(void 0,void 0)],ii.prototype,"_priority",void 0),en([e8(void 0,void 0)],ii.prototype,"_enabled",void 0);var ir=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}();t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}eG(e,t);var i=e.prototype;return i.update=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.position,t.rotation=this.transform.rotation}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(ie),t.CameraController=en([e5(tX.CameraController)],t.CameraController);var io=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ir);t.HitTestType=void 0,(G=t.HitTestType||(t.HitTestType={}))[G.triangle=1]="triangle",G[G.box=2]="box",G[G.sphere=3]="sphere",G[G.custom=4]="custom";var ia="click",is="touchstart",iu="touchmove",ic="touchend",ih=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,o,a=this;n=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",h=function(t,e,i,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var s=0,u=0,c=performance.now();if(!a.target)return ew.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:o,ts:c,width:0,height:0,origin:t};var h=a.target,l=h.width,f=h.height;if(r){var d=c-r.ts;s=(n-r.dx)/d||0,u=(o-r.dy)/d||0,r={dx:n,dy:o,ts:c}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:o,ts:c,width:l,height:f,origin:t}};ex()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((o={})[s]=function(o){if(a.enabled){var s=n(o),u=il(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(is,h(o,t,e))}},o[u]=function(r){if(i&&a.enabled){var o=il(n(r));t=o.x,e=o.y,a.dispatchEvent(iu,h(r,t,e,t-i.x,e-i.y))}},o[c]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var o=n(r),s=il(o),u=Math.abs(i.clientX-o.clientX)+Math.abs(i.clientY-o.clientY);t=s.x,e=s.y,u<4&&a.dispatchEvent(ia,h(r,t,e)),a.dispatchEvent(ic,h(r,t,e,t-i.x,e-i.y))}i=0},o),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),eh(i,e),function(){el(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&el(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 il(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(i-o)/n.width*2-1,y:1-(r-a)/n.height*2}}var id=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ir),ip=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,o;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!=(o=t[e+3])?o: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):ei(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):ei(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):ei(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):ei(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 eK(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}();ip.ONE=new ip(1,1,1,1),ip.ZERO=new ip(0,0,0,0);var im=function(){function t(t,e,i,r,n,o,a,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===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,o,a,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=r,c[6]=a,c[1]=e,c[4]=n,c[7]=s,c[2]=i,c[5]=o,c[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=i,c[1]=r,c[4]=n,c[7]=o,c[2]=a,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,o=e+e,a=i+i,s=r+r,u=e*o,c=e*a,h=e*s,l=i*a,f=i*s,d=r*s,p=n*o,m=n*a,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],o=r[3],a=r[6],s=r[1],u=r[4],c=r[7];return r[0]=e*n+i*s,r[3]=e*o+i*u,r[6]=e*a+i*c,r[1]=-i*n+e*s,r[4]=-i*o+e*u,r[7]=-i*a+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,o=i[0],a=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],T=r[2],b=r[5],E=r[8];return n[0]=o*p+a*y+s*T,n[3]=o*m+a*g+s*b,n[6]=o*v+a*x+s*E,n[1]=u*p+c*y+h*T,n[4]=u*m+c*g+h*b,n[7]=u*v+c*x+h*E,n[2]=l*p+f*y+d*T,n[5]=l*m+f*g+d*b,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],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8];return e*(o*c-u*a)+n*(u*r-i*c)+s*(i*a-o*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8],h=c*o-u*a,l=u*r-c*i,f=a*i-o*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*a-c*n)*p,t[2]=(u*n-s*o)*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-a*e)*p,t[8]=(o*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,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[3]*r+o[6]*n,a.y=o[1]*i+o[4]*r+o[7]*n,a.z=o[2]*i+o[5]*r+o[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!eY(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,o,a,s,u,c){return new t(e,n,s,i,o,u,r,a,c)},t}(),iv=function(){function t(t,e){void 0===t&&(t=eK.ZERO),void 0===e&&(e=eK.X),this.origin=new eK,this.direction=new eK,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 eK;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,o,a,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,T=t.max,b=T.x,E=T.y,_=T.z,C=1/d,S=1/p,A=1/m;if(C>=0?(i=(y-c)*C,r=(b-c)*C):(i=(b-c)*C,r=(y-c)*C),S>=0?(n=(g-h)*S,o=(E-h)*S):(n=(E-h)*S,o=(g-h)*S),!(i>o)&&!(n>r)&&((n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),(n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),A>=0?(a=(x-l)*A,s=(_-l)*A):(a=(_-l)*A,s=(x-l)*A),!(i>s)&&!(a>r))&&((a>i||i!=i)&&(i=a),(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 eK).copyFrom(this.origin):void 0;var o=-(this.origin.dot(i)+r)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var u=Math.sqrt(s-a),c=o-u,h=o+u;if(!(h<0))return c>=0?this.at(c,i):this.at(h,i)}},e.intersectTriangle=function(e,i,r){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),c=t.tempVec1.subtractVectors(s,o),h=t.tempVec2.subtractVectors(this.origin,o),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}();iv.tempVec0=new eK,iv.tempVec1=new eK,iv.tempVec2=new eK,iv.tempVec3=new eK;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.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,o;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!=(o=t[e+3])?o:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,c=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,c=a):o>=3&&o<=4?(u=a,c=n):o>=4&&o<=5?(s=a,c=n):o>=5&&o<=6&&(s=n,c=a);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):ei(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):ei(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):ei(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):ei(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 ip(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,o=Math.max(e,i,r),a=Math.min(e,i,r),s=o-a,u=0,c=0;return 0!==o&&(c=s/o),o!=a&&(o==e?(u=(i-r)/s,i<r&&(u+=6)):o==i?u=(r-e)/s+2:o==r&&(u=(e-i)/s+4),u*=60),new t(u,c,o,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)),o=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+o:"#"+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}();iy.BLACK=new iy(0,0,0,1),iy.BLUE=new iy(0,0,1,1),iy.CLEAR=new iy(0,0,0,0),iy.CYAN=new iy(0,1,1,1),iy.GRAY=new iy(.5,.5,.5,1),iy.GREEN=new iy(0,1,0,1),iy.MAGENTA=new iy(1,0,1,1),iy.RED=new iy(1,0,0,1),iy.WHITE=new iy(1,1,1,1),iy.YELLOW=new iy(1,.92,.016,1);var ig=function(){function t(t,e){void 0===t&&(t=new eK(1/0,1/0,1/0)),void 0===e&&(e=new eK(-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,o=-1/0,a=-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>o&&(o=h),l>a&&(a=l)}return this.min.set(e,i,r),this.max.set(n,o,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new eK),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 eK),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,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);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 eK),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 eK;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 eK),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 eK),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 eK),this.isEmpty())return[];var i=[];return i[0]=new eK(this.min.x,this.min.y,this.min.z),i[1]=new eK(this.min.x,this.min.y,this.max.z),i[2]=new eK(this.min.x,this.max.y,this.min.z),i[3]=new eK(this.min.x,this.max.y,this.max.z),i[4]=new eK(this.max.x,this.min.y,this.min.z),i[5]=new eK(this.max.x,this.min.y,this.max.z),i[6]=new eK(this.max.x,this.max.y,this.min.z),i[7]=new eK(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 eK;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}(),ix=function(){function t(t,e){void 0===t&&(t=eK.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 o=new ig().setFromPoints(t);o.getCenter(i),this.radius=o.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 eK),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 ig),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 eK().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 eK,i=new eK;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 eK().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}(),iT=Object.freeze({__proto__:null,get EulerOrder(){return th},Euler:e0,Quaternion:eJ,Vector2:eQ,Vector3:eK,Vector4:ip,Matrix3:im,Matrix4:e$,Ray:iv,PI2:2*Math.PI,DEG2RAD:eH,RAD2DEG:eW,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:eY,damp:function(t,e,i,r){return eZ(t,e,1-Math.exp(-i*r))},lerp:eZ,degToRad:function(t){return t*eH},radToDeg:function(t){return t*eW},clamp:eq,Color:iy,Box3:ig,Sphere:ix}),ib="editor",iE={"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"},i_=[],iC={};function iS(){"function"==typeof WebGL2RenderingContext?iA(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iA(WebGLRenderingContext),iA(WebGLRenderingContext.prototype)):i_.push("iOS16 lockdown mode, WebGL Constants not in global"),i_.length||"HALF_FLOAT"in iC||(iC.HALF_FLOAT=5131)}function iA(t){for(var e in t)/^[A-Z_]/.test(e)&&(iC[e]=t[e])}function iw(t){switch(t){case tf.ALPHA:case tf.ADD:case tf.SUBTRACTION:case tf.STRONG_LIGHT:case tf.WEAK_LIGHT:return 1;case tf.SUPERPOSITION:return 2;case tf.BRIGHTNESS:return 3;case tf.MULTIPLY:return 0;default:return 1}}i_.length||iS(),t.ShaderType=void 0,(X=t.ShaderType||(t.ShaderType={}))[X.vertex=0]="vertex",X[X.fragment=1]="fragment";var iO=((tZ={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},tZ[t.ShaderType.fragment]={in:"varying"},tZ);function iR(t,e,i,r){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach(function(t){var e=t[0],i=t[1];!0===i?n.push("#define "+e):Number.isFinite(i)&&n.push("#define "+e+" "+i)}),o=n.length?n.join("\n")+"\n":"");var a="WEBGL"+r,s=(o=o+("\n#ifndef "+a)+"\n#define "+a+"\n#endif")+"\n"+e,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=u?u[0]:"";if(c&&c.includes("300")){var h=RegExp(""+c,"g");1===r&&(s=s.replace(/\b(in|out)\b/g,function(t){var e;return null!=(e=iO[i][t])?e:t})),s=s.replace(h,"\n")}return s}function iI(t,e){switch(e){case void 0:case tf.ALPHA:t.blendFunction=[iC.ONE,iC.ONE_MINUS_SRC_ALPHA,iC.ONE,iC.ONE_MINUS_SRC_ALPHA];break;case tf.ADD:t.blendFunction=[iC.ONE,iC.ONE,iC.ONE,iC.ONE];break;case tf.SUBTRACTION:t.blendFunction=[iC.ONE,iC.ONE,iC.ZERO,iC.ONE],t.blendEquation=[iC.FUNC_REVERSE_SUBTRACT,iC.FUNC_REVERSE_SUBTRACT];break;case tf.SUPERPOSITION:t.blendFunction=[iC.ONE,iC.ONE,iC.ONE,iC.ONE];break;case tf.MULTIPLY:t.blendFunction=[iC.DST_COLOR,iC.ONE_MINUS_SRC_ALPHA,iC.DST_COLOR,iC.ONE_MINUS_SRC_ALPHA];break;case tf.BRIGHTNESS:t.blendFunction=[iC.ONE,iC.ONE_MINUS_SRC_ALPHA,iC.ONE,iC.ONE_MINUS_SRC_ALPHA];break;case tf.STRONG_LIGHT:t.blendFunction=[iC.DST_COLOR,iC.DST_ALPHA,iC.ZERO,iC.ONE];break;case tf.WEAK_LIGHT:t.blendFunction=[iC.DST_COLOR,iC.ZERO,iC.ZERO,iC.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iM(t,e){e===td.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iC.CW,t.cullFace=e===td.BACK?iC.BACK:iC.FRONT)}function iL(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tp.MASK:t.stencilTest=!0,t.stencilFunc=[iC.ALWAYS,iC.ALWAYS],t.stencilOpZPass=[iC.REPLACE,iC.REPLACE];break;case tp.OBSCURED:t.stencilTest=!0,t.stencilFunc=[iC.EQUAL,iC.EQUAL];break;case tp.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[iC.NOTEQUAL,iC.NOTEQUAL];break;case tp.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)}t.TextureLoadAction=void 0,(j=t.TextureLoadAction||(t.TextureLoadAction={}))[j.whatever=0]="whatever",j[j.clear=2]="clear",t.TextureSourceType=void 0,(H=t.TextureSourceType||(t.TextureSourceType={}))[H.none=0]="none",H[H.data=1]="data",H[H.image=2]="image",H[H.compressed=3]="compressed",H[H.video=4]="video",H[H.canvas=5]="canvas",H[H.framebuffer=6]="framebuffer",H[H.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 o=new XMLHttpRequest,a=function(){n.finish(t,o.status,o.response)};o.responseType=e,o.addEventListener("load",function(){200==o.status||0==o.status?n.finish(t,200,o.response):a()}),o.addEventListener("error",a),o.open("GET",t,!0),o.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],o=n.length-1,a=r.length;o<a;o+=2)r[o].apply(null,n)},t}(),iF=!1;function iN(t,e){return iD.apply(this,arguments)}function iD(){return(iD=ee(function(t,e){return eo(this,function(i){switch(i.label){case 0:if(!(iF||!e))return[3,2];return[4,iz(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iz(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iF=!0,[4,iz(t)];case 6:return[2]}})})).apply(this,arguments)}function iz(t){return ik.apply(this,arguments)}function ik(){return(ik=ee(function(t){var e,i;return eo(this,function(r){if(e="",ei(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else ei(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 iU(t){return iB.apply(this,arguments)}function iB(){return(iB=ee(function(t){return eo(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 iG(){return(iG=ee(function(t){return eo(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 iX(t){return ij.apply(this,arguments)}function ij(){return(ij=ee(function(t){var e;return eo(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eg()&&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(t)})})]})})).apply(this,arguments)}function iH(t,e){return iW.apply(this,arguments)}function iW(){return(iW=ee(function(t,e){return eo(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 iY(t,e,i){return iZ.apply(this,arguments)}function iZ(){return(iZ=ee(function(e,i,r,n){var o,a,s,u,c,h,l,f,d,p,m,v,y,g,x;return eo(this,function(T){switch(T.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,1];for(o=e.mipmaps,a=e.target,s=[],u=ej(o);!(c=u()).done;){for(h=c.value,l=[],f=ej(h);!(d=f()).done;)p=d.value,m=r.assetLoader.loadGUID(p.id),l.push(m.data);s.push(l)}return[2,iP({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:a,type:t.TextureSourceType.mipmaps}})];case 1:return v=e.mipmaps,y=e.target,[4,Promise.all(v.map(function(t){return function(t,e){return iq.apply(this,arguments)}(t,i)}))];case 2:return g=T.sent(),x=n[v[0][1][0]].url,[2,iP({keepImageSource:!1},e,{mipmaps:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:y,bin:x,type:t.TextureSourceType.mipmaps,mipmaps:v.map(function(t){return[t[1][1],t[1][2]]})}})];case 3:return[2]}})})).apply(this,arguments)}function iq(){return(iq=ee(function(t,e){var i,r,n,o,a;return eo(this,function(s){if(r=(i=t[1])[0],n=i[1],o=i[2],!(a=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,iz(new Blob([new Uint8Array(a,n,o)]))]})})).apply(this,arguments)}var iQ=1,iK=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+iQ++,i}eG(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?iC.TEXTURE_2D:i,n=e.format,o=void 0===n?iC.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:iC.NEAREST,magFilter:iC.NEAREST,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE,target:r,format:iC.RGBA,internalFormat:o,type:iC.UNSIGNED_BYTE},e)},i.fromImage=function(e,r){return ee(function(){var n,o;return eo(this,function(a){switch(a.label){case 0:return[4,iz(e)];case 1:return n=a.sent(),(o=i.create(r,{sourceType:t.TextureSourceType.image,image:n,id:eN()})).initialize(),[2,o]}})})()},eU(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(e9);function iJ(t,e,i,r){var n,o,a=e.length/i/r;return o=n=4===a||0===a?iC.RGBA:3===a?iC.RGB:2===a?iC.LUMINANCE_ALPHA:iC.LUMINANCE,iK.createWithData(t,{data:e,width:i,height:r},{type:iC.HALF_FLOAT,format:n,internalFormat:o,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE})}var i$={type:iC.UNSIGNED_BYTE,format:iC.RGBA,internalFormat:iC.RGBA,wrapS:iC.MIRRORED_REPEAT,wrapT:iC.MIRRORED_REPEAT,minFilter:iC.NEAREST,magFilter:iC.NEAREST};function i0(e){return iK.create(e,iP({id:"whitetexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i$))}function i1(e){return iK.create(e,iP({id:"transparenttexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i$))}var i2=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,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);if(this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){ew.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){ew.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){ew.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,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){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 i3(e){var i=new i2(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,o=i.pixelHeight,a=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,c=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?iC.TEXTURE_CUBE_MAP:iC.TEXTURE_2D,internalFormat:u,format:c,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,o))+1))}}var i4=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return ee(function(){var i,r;return eo(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,o=e.url;return r===iC.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eR(o)&&o.length>0}if(i===t.TextureSourceType.mipmaps){var a=e.bin,s=e.mipmaps,u=e.target,c=e.maps,h=e.urls;return a?s.length>0:u===iC.TEXTURE_CUBE_MAP?c.every(function(t){return"object"==typeof t&&t}):h.every(function(t){return eR(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return ee(function(){var n,o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b;return eo(this,function(E){switch(E.label){case 0:if(n=e.type,o=e.target,a=e.map,s=e.url,u=e.bin,c=e.mipmaps,h=e.urls,l=e.maps,!(o===iC.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(a)];case 1:return f=E.sent(),[2,iP({},i,{cube:f,target:iC.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iP({},a),target:iC.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,iz(s)];case 3:return d=E.sent(),[2,iP({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iC.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,iX(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,iU(s)];case 7:return m=E.sent(),[2,iP({},i3(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,iU(u)];case 9:if(v=E.sent(),g=(y=null!=o?o:iC.TEXTURE_2D)===iC.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),o!==iC.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(!(o===iC.TEXTURE_2D||!o))return[3,15];return[4,Promise.all(h.map(function(t){return iz(t)}))];case 14:return T=E.sent(),[2,iP({},i,{mipmaps:T,target:iC.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:h.slice(),target:iC.TEXTURE_2D}})];case 15:if(o!==iC.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return b=E.sent(),[2,iP({},i,{mipmaps:b,target:iC.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iP({},t)}),target:iC.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return ee(function(){return eo(this,function(i){return[2,Promise.all(t.map(function(t){return iz(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return ee(function(){return eo(this,function(e){return[2,Promise.all(t.map(function(t){return iz(t)}))]})})()},e}(),i5=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 i6(t){return"object"==typeof t&&t&&void 0===t.length&&ei(t,iK)}t.MaterialRenderType=void 0,(W=t.MaterialRenderType||(t.MaterialRenderType={}))[W.normal=0]="normal",W[W.transformFeedback=1]="transformFeedback";var i8=1,i9=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,o=void 0===n?"Material"+i8++:n,a=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=o,r.renderType=void 0===a?0:a,r.shaderSource=s,r.props=i,r.uniformSemantics=iP({},u)}else r.name="Material"+i8++,r.renderType=0;return r}eG(e,t);var i=e.prototype;return i.initialize=function(){},i.use=function(t,e){},eU(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}(e9),i7=(Z=new Int32Array((Y=new Float32Array(1)).buffer),function(t){Y[0]=t;var e=Z[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)}),rt=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]=i7(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=i7(t[i])},t}(),re=new e0,ri=new e$;function rr(t,e,i,r,n,o,a){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(o),t.addScaledVector(a,u),t.addScaledVector(i,h);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new eK;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});re.setFromArray(v).negate(),ri.setFromEuler(re);var y=ri.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,T=l.y,b=l.z;if(x){var E=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(T){var _=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.y=t.y+_}if(b){var C=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function rn(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ro(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function ra(t,e,i,r){void 0===r&&(r=0);for(var n=0;n<i;n++)t[n]=e[n+r];return t}function rs(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 o=0;o<e.length;o++)t[o]=e[o]}else if(i&&t!==i)for(var a=0;a<i.length;a++)t[a]=i[a];return t}var ru=((tQ={})[tb.PARTICLE_ORIGIN_CENTER]=[0,0],tQ[tb.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],tQ[tb.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],tQ[tb.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],tQ[tb.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],tQ[tb.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],tQ[tb.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],tQ[tb.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],tQ[tb.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],tQ);function rc(t,e,i){var r=i.position,n=new eK(t,e,0),o=new eK;return i.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(r),new iv(r,o)}function rh(t,e,i){var r=t.x,n=t.y,o=t.z,a=new eK(r-e,n+i,o),s=new eK(r-e,n-i,o),u=new eK(r+e,n-i,o),c=new eK(r+e,n+i,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}function rl(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function rf(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function rd(t,e,i){return(rd=!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&&eB(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var rp={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new eQ(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tw.LINE?0:e===tw.EASE_OUT?0:e===tw.EASE_IN?2:e===tw.EASE?2:e===tw.HOLD&&i===tw.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===tw.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tw.EASE,tw.EASE_IN,tw.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tw.EASE,tw.EASE_OUT,tw.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE_OUT,tw.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE,tw.EASE_IN].includes(i)}},rm=function(t,e){this.points=t,this.totalLength=e},rv={},ry={};function rg(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function rx(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var rT=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=rf(e.x-t.x,3)+"_"+rf(e.y-t.y,3)+"_"+rf(e.z-t.z,3)+"&"+(rf(i.x-t.x,3)+"_"+rf(i.y-t.y,3))+"_"+rf(i.z-t.z,3)+"&"+(rf(r.x-t.x,3)+"_"+rf(r.y-t.y,3))+"_"+rf(r.z-t.z,3);if(ry[n])return{data:ry[n],interval:t};for(var o=[],a=null,s=0,u=0,c=0;c<300;c+=1){var h=new eK,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!==a&&(u+=Math.pow(h.x-a.x,2)+Math.pow(h.y-a.y,2)+Math.pow(h.z-a.z,2)),a=h,s+=u=Math.sqrt(u),o[c]={partialLength:u,point:h}}var f=new rm(o,s);return ry[n]=f,{data:f,interval:new eK(t.x,t.y,t.z)}}(t,e,i,r),o=n.data,a=n.interval;this.lengthData=o,this.interval=a,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(rl(1-t,0))return e.points[299].point.clone().add(this.interval);if(rl(e.totalLength,0))return this.p1.clone();var i=new eK,r=rf(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(rl(n,r))return e.points[o].point.clone().add(this.interval);var a=!0,s=1;for(r<n&&(s=-1);a;){if(r>=n){if(299===o){i.x=e.points[o].point.x,i.y=e.points[o].point.y,i.z=e.points[o].point.z;break}if(r<n+e.points[o+1].partialLength){var u=(r-n)/e.points[o+1].partialLength;i.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,i.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,i.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}s>0&&o<299?(o+=s,n+=rf(e.points[o].partialLength,5)):s<0&&o>0?(n-=rf(e.points[o].partialLength,5),o+=s):a=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),rb=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new eJ,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):rl(1-t,0)?this.temp.copyFrom(this.p2):(rC.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),rE=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(),rg(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=rg(.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,o=rx(n,this.mX1,this.mX2);return o>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var o=rx(e,i,r);if(0===o)break;var a=rg(e,i,r)-t;e-=a/o}return e}(t,n,this.mX1,this.mX2):0===o?n:function(t,e,i,r,n){var o,a,s=0;do(o=rg(a=e+(i-e)/2,r,n)-t)>0?i=a:e=a;while(Math.abs(o)>1e-7&&++s<10);return a}(t,i,i+.1,this.mX1,this.mX2)},t}();function r_(t,e){var i,r,n,o=function(t,e,i){var r=t[1],n=rp.isHoldOutKeyframe(t),o=rp.isHoldInKeyframe(e),a=!o&&rp.isRightSideEase(t),s=!n&&rp.isLeftSideEase(e);if(a&&!s&&!o){var u=new eQ(r[r.length-4],r[r.length-3]),c=new eQ(r[r.length-2],r[r.length-1]),h=rp.getPointInCurve(e),l=new eQ(h.x,h.y),f=new eQ(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:c,p2:f,p3:l}}if(!a&&s&&!n){var d=e[1],p=rp.getPointInCurve(t),m=new eQ(p.x,p.y),v=new eQ(d[0],d[1]),y=new eQ(d[2],d[3]),g=new eQ(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(a&&s){var x=e[1];return{type:"ease",p0:new eQ(r[r.length-4],r[r.length-3]),p1:new eQ(r[r.length-2],r[r.length-1]),p2:new eQ(x[0],x[1]),p3:new eQ(x[2],x[3])}}var T=rp.getPointInCurve(t),b=rp.getPointInCurve(e);if(n?b.y=T.y:o&&(T.y=b.y),!i)return{type:"line",p0:T,p1:b,isHold:n||o,leftHoldLine:n,rightHoldLine:o};var E=new eQ((b.x-T.x)/3+T.x,(b.y-T.y)/3+T.y),_=new eQ((b.x-T.x)/3*2+T.x,(b.y-T.y)/3*2+T.y);return{type:"ease",p0:T,p1:E,p2:_,p3:b,isHold:n||o,leftHoldLine:n,rightHoldLine:o}}(t,e,!0),a=o.p0,s=o.p1,u=o.p2,c=o.p3;eC(u),eC(c);var h=c.x-a.x,l=c.y-a.y,f=rf((s.x-a.x)/h,5),d=rf((u.x-a.x)/h,5);rl(l,0)?i=r=NaN:(i=rf((s.y-a.y)/l,5),r=rf((u.y-a.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,s,u,c),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",a,s,u,c),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,s,u,c),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",a,s,u,c),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return rv[p]?n=rv[p]:(n=new rE(f,i,d,r),rv[p]=n),{points:[a,s,u,c],timeInterval:h,valueInterval:l,curve:n}}var rC=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,o=e.y,a=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=o,t.z=a,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||o!==c||a!==h){var f=1-r,d=n*u+o*c+a*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,o=o*f+c*g,a=a*f+h*g,s=s*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+o*o+a*a+s*s);n*=x,o*=x,a*=x,s*=x}}t.x=n,t.y=o,t.z=a,t.w=s},t}(),rS="not_implement",rA=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(rS)},e.getIntegrateValue=function(t,e,i){throw Error(rS)},e.getIntegrateByTime=function(t,e){throw Error(rS)},e.getValue=function(t){throw Error(rS)},e.getMaxTime=function(){throw Error(rS)},e.toUniform=function(t){throw Error(rS)},e.map=function(t){throw Error(rS)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(rS)},t.getAllData=function(t,e){for(var i=new(e?rt:Float32Array)(4*t.index),r=0,n=0,o=t.curves;r<o.length;r++){var a=o[r].toData();i.set(a,n),n+=a.length}return e?i.data:i},t}(),rw=function(t){function e(){return t.apply(this,arguments)}eG(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}(rA),rO=function(t){function e(){return t.apply(this,arguments)}eG(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}(rA),rR=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){return eV(this.min,this.max)},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}(rA),rI=function(t){function e(){return t.apply(this,arguments)}eG(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 o=Math.random();r[n]=e[n]*(1-o)+i[n]*o}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(rA),rM=function(t){function e(){return t.apply(this,arguments)}eG(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,o=this.xCoord*i;return((r+e/o*(n-r)+r)*e-(r+t/o*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return rB(e,0,this.xCoord,this.min,this.max)-rB(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}(rA),rL=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=em(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],o=e[r+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return ev(n.color,o.color,a,!0)}}return e[i].color.slice()},e}(rA),rP=function(t){function e(){return t.apply(this,arguments)}eG(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],o=e[r+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),c=n[1];return c+u*(o[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,o=e?rB:rU,a=0;a<n;a++){var s=i[a],u=i[a+1],c=s[0],h=u[0];if(t>c&&t<=h)return r+o(t,c,h,s[1],u[1]);r+=o(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}(rA),rV=function(t){function e(){return t.apply(this,arguments)}eG(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=r_(t[e],t[e+1]),r=i.points,n=i.curve,o=i.timeInterval,a=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:o,valueInterval:a,curve:n}}},i.getValue=function(t){var e=0,i=Object.keys(this.curveMap),r=Number(i[0].split("&")[0]),n=Number(i[i.length-1].split("&")[1]);if(t<=r)return this.getCurveValue(i[0],r);if(t>=n)return this.getCurveValue(i[i.length-1],n);for(var o=0;o<i.length;o++){var a=i[o].split("&"),s=a[0],u=a[1];if(t>=Number(s)&&t<Number(u)){e=this.getCurveValue(i[o],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,o=Object.keys(this.curveMap);if(r<=Number(o[0].split("&")[0]))return 0;for(var a=0;a<o.length;a++){var s=o[a].split("&"),u=s[0],c=s[1];if(r>=Number(c)&&(n+=i*this.getCurveIntegrateValue(o[a],Number(c))),r>=Number(u)&&r<Number(c)){n+=i*this.getCurveIntegrateValue(o[a],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,o=i.valueInterval,a=0,s=(e-r.x)/20,u=0;u<=20;u++){var c=u*s/n,h=r.y+o*i.curve.getValue(c);0===u||20===u?a+=h:u%2==1?a+=4*h:a+=2*h}return s/3*a},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,o=i.valueInterval,a=(e-r.x)/n,s=i.curve.getValue(a);return r.y+o*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}(rA),rF=function(t){function e(){return t.apply(this,arguments)}eG(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],o=e[r+1];if(n[0]<=t&&o[0]>=t){var a=o[1]-n[1],s=void 0;return s=0===a?(t-n[0])/(o[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,o=i[2]*r,a=(t-e[0])/r,s=a*a,u=s*a;return(2*u-3*s+1)*e[1]+(u-2*s+a)*n+(u-s)*o+(-2*u+3*s)*i[1]}(t,n,o)-n[1])/a,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],o=0;o<i.length;o++)n[o]=i[o]*(1-e)+r[o]*e;return n},e}(rA),rN=function(t){function e(){return t.apply(this,arguments)}eG(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 o=e[n],a=e[n+1],s=new eK(i[n][0],i[n][1],i[n][2]),u=new eK(i[n+1][0],i[n+1][1],i[n+1][2]),c=new eK(r[2*n][0],r[2*n][1],r[2*n][2]),h=new eK(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=r_(o,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new rT(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=rf(t,5),i=0,r=new eK,n=Object.keys(this.curveSegments);if(!n.length)return r;var o=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=o)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)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,o=rf((e-r.x)/n,4);return eq(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rA),rD=function(t){function e(){return t.apply(this,arguments)}eG(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 o=e[n],a=e[n+1],s=eJ.fromArray(i[n]),u=eJ.fromArray(i[n+1]),c=eJ.fromArray(r[2*n]),h=eJ.fromArray(r[2*n+1]),l=r_(o,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new rb(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=rf(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),o=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=o)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<r.length;a++){var s=r[a].split("&"),u=s[0],c=s[1];if(i>=Number(u)&&i<Number(c)){var h=this.curveSegments[r[a]].pathCurve;return e=this.getPercValue(r[a],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,o=rf((e-r.x)/n,4);return eq(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rA),rz=((tK={})[tA.RANDOM]=function(t){return ei(t[0],Array)?new rI(t):new rR(t)},tK[tA.CONSTANT]=function(t){return new rw(t)},tK[tA.CONSTANT_VEC2]=function(t){return new rw(t)},tK[tA.CONSTANT_VEC3]=function(t){return new rw(t)},tK[tA.CONSTANT_VEC4]=function(t){return new rw(t)},tK[tA.RGBA_COLOR]=function(t){return new rw(t)},tK[tA.COLORS]=function(t){return new rO(t.map(function(t){return ed(t,!1)}))},tK[tA.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new rM([t[0][1],t[1][1]]):new rP(t)},tK[tA.GRADIENT_COLOR]=function(t){return new rL(t)},tK[tA.LINEAR_PATH]=function(t){return new rF(t)},tK[tA.BEZIER_CURVE]=function(t){return 1===t.length?new rw(t[0][1][1]):new rV(t)},tK[tA.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new rw(rd(eK,[].concat(t[1][0]))):new rN(t)},tK[tA.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new rw(rd(eJ,[].concat(t[1][0]))):new rD(t)},tK);function rk(t){if(!t||!isNaN(+t))return new rw(t||0);if(ei(t,rA))return t;if(eM(rz[t[0]]))return rz[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+iE["ValueType: 21/22 is not supported"]+".")}function rU(t,e,i,r,n){var o=t-e;return(r+r+(n-r)*o/(i-e))*o/2}function rB(t,e,i,r,n){var o=t*t,a=e*e;return(o*t*2*(r-n)+3*o*(e*n-i*r)-a*e*(2*r+n)+3*a*i*r)/(6*(e-i))}function rG(t,e){if(e){var i=e[0],r=e[1];if(i===tA.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===tA.LINE){var o=r.length;if(2===o&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&o++,r[r.length-1][0]<1&&o++;var a=Math.ceil(o/2);t.lineSegCount+=a,t.curves.push(r),t.index+=a,t.max=Math.max(t.max,a)}else if(i===tA.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 rX(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}t.ShaderCompileResultStatus=void 0,(q=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[q.noShader=0]="noShader",q[q.success=1]="success",q[q.fail=2]="fail",q[q.compiling=3]="compiling",t.GLSLVersion=void 0,(Q=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",Q.GLSL3="300 es";var rj=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return eG(e,t),e}(e9);t.Shader=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=ej(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(e9),t.Shader=en([e5("Shader")],t.Shader);var rH="effects-internal-copy",rW="effects-internal-copy-mesh",rY="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",rZ="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";function rq(e,i){var r=2===e,n=r?"#version 300 es":"";return{name:rH,vertex:n+"\n"+rY,fragment:n+"\n"+rZ,glslVersion:r?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["WEBGL2",!!r],["DEPTH_TEXTURE",!!i]],cacheId:rW+ +i}}var rQ={format:iC.RGBA,type:iC.UNSIGNED_BYTE,minFilter:iC.LINEAR,magFilter:iC.LINEAR,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE},rK=Symbol("dispose"),rJ=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,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:o},s=[o];Object.getOwnPropertyNames(rQ).forEach(function(t){var i,r=null!=(i=e[t])?i:rQ[t];a[t]=r,s.push(t,r)});var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var h=this.engine;eC(h),c=iK.create(h,a),this.textureCache[u]=c,this.textureRef[u]=1,c[rK]=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[rK](),i.dispose=i[rK]),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[rK](),i.dispose=i[rK]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),r$=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 eM(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}(),r0=((tJ={})[iC.FLOAT]=Float32Array.BYTES_PER_ELEMENT,tJ[iC.INT]=Int32Array.BYTES_PER_ELEMENT,tJ[iC.SHORT]=Int16Array.BYTES_PER_ELEMENT,tJ[iC.BYTE]=Int8Array.BYTES_PER_ELEMENT,tJ),r1=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(e9);function r2(t){return t===iC.INT?new Int32Array(0):t===iC.SHORT?new Int16Array(0):new Float32Array(0)}var r3=1,r4=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,o=i.geometry,a=i.name,s=i.priority,u=i.worldMatrix,c=void 0===u?e$.fromIdentity():u;r.id="Mesh"+r3++,r.name=void 0===a?"<unnamed>":a,r.geometry=o,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=c}else r.id="Mesh"+r3++,r.name="<unnamed>",r.worldMatrix=e$.fromIdentity(),r._priority=0;return r}eG(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)}},eU(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ii);t.RenderPassAttachmentStorageType=void 0,(K=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[K.none=0]="none",K[K.color=1]="color",K[K.stencil_8_opaque=2]="stencil_8_opaque",K[K.depth_16_opaque=3]="depth_16_opaque",K[K.depth_stencil_opaque=4]="depth_stencil_opaque",K[K.depth_16_texture=5]="depth_16_texture",K[K.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(J=t.TextureStoreAction||(t.TextureStoreAction={}))[J.store=0]="store",J[J.clear=2]="clear";var r5=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(ei(r,iK))this.texture=r,this.externalTexture=!0;else if(r){var o=r.wrapT,a=r.wrapS,s=r.minFilter,u=r.magFilter,c=r.internalFormat,h=r.format,l=void 0===h?iC.RGBA:h,f=r.type,d=void 0===f?iC.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:c||l,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:i.name},this.texture=iK.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)},eU(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,($=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[$.force=0]="force",$[$.keep=1]="keep",$[$.keepExternal=2]="keepExternal",$[$.destroy=0]="destroy";var r6=1,r8=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+r6++:r,o=i.clearAction,a=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=eb((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iP({},o),this.storeAction=iP({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new r$(a),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){eE(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){el(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eb(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],o=e[3];t.setViewport(i,r,n,o)}},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 r5(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 o=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*o,r.getHeight()*o],s=[a[2],a[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 r5(i.renderer.engine,iP({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=c;var h=nS.create({storeAction:this.storeAction,name:u,viewport:a,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)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},i.getStencilAttachment=function(){var t=this.framebuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},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 o=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===o||1===o||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:a}),s.externalStorage&&2===a||1===a||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eF}},eU(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}(),r9="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 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;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",r7="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}",nt="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;}",ne="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 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\nin float vLife;in vec2 vTexCoord;in 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\nin vec4 vTexCoordBlend;\n#endif\nin 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(){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);fragColor=color;}\n#endif\n",ni="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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\nin float aSeed;out 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.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out 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 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out 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;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}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\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void 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\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\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}}",nr="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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\nin float aSeed;out 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.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in 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\nout float vLife;out vec2 vTexCoord;out 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}",nn="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",no="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));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",na="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);}",ns="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);}",nu="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);}",nc="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",nh=function(e){function i(i,r){var n,o=(n=e.call(this,i,r)||this).renderer.engine,a=r1.create(o,{mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=i9.create(o,{shader:{vertex:nn,fragment:nc,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=r4.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}eG(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}(r8),nl=function(e){function i(i,r,n){(o=e.call(this,i,n)||this).type=r;var o,a=o.renderer.engine,s="PostProcess",u=r1.create(a,{name:s,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:nn,fragment:"H"==r?na:ns,glslVersion:t.GLSLVersion.GLSL1},h=i9.create(a,{name:s,shader:c});return h.blending=!1,h.depthTest=!1,h.culling=!1,o.screenMesh=r4.create(a,{name:s,geometry:u,material:h,priority:0}),o.priority=5e3,o}eG(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",ng(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(r8),nf=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",o=r.renderer.engine,a=r1.create(o,{name:n,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=i9.create(o,{name:n,shader:{vertex:nn,fragment:nu}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=r4.create(o,{name:n,geometry:a,material:s,priority:0}),r.priority=5e3,r}eG(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",ng(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(r8),nd=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=r||new r5(a);var s=r1.create(a,{name:o,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=i9.create(a,{name:o,shader:{vertex:nn,fragment:no,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=r4.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}eG(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,o=i.brightness,a=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",o),this.screenMesh.material.setFloat("_Saturation",a),this.screenMesh.material.setFloat("_Contrast",s),this.screenMesh.material.setInt("_UseBloom",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 eQ(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new eK(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},i}(r8),np={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:1},nm="_effects_default_",nv=1,ny=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=e.camera,r=e.keepColorBuffer,n=e.renderer,o=e.editorTransform,a=e.globalVolume,s=e.clearAction,u=void 0===s?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:s,c=n.engine;a&&(this.globalVolume=iP({},np,a)),this.globalUniforms=new nT;var h=[],l={};if(this.renderer=n,this.globalVolume){var f=this.globalVolume.useHDR?iC.HALF_FLOAT:iC.UNSIGNED_BYTE;h=[{texture:{format:iC.RGBA,type:f,magFilter:iC.LINEAR,minFilter:iC.LINEAR}}],m={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},l={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var d=[new r8(n,{name:nm,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:m,attachments:h,clearAction:l})];if(this.setRenderPasses(d),this.globalVolume){var p,m,v,y=this.globalVolume.useBloom,g=new r5(c);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=Array(7),b=this.globalVolume.useHDR?iC.HALF_FLOAT:iC.UNSIGNED_BYTE,E=new nh(n,{name:"BloomThresholdPass",attachments:[{texture:{format:iC.RGBA,type:b,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){T[_]=new r5(c);var C=new nl(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:iC.RGBA,type:b,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]}),S=new nl(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:iC.RGBA,type:b,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});S.gaussianResult=T[_],this.addRenderPass(C),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var w=new nf(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:iC.RGBA,type:b,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});w.gaussianDownSampleResult=T[5-A],this.addRenderPass(w),x[2]*=2,x[3]*=2}}v=y?new nd(n,g):new nd(n),this.addRenderPass(v)}this.semantics=new r$(e.semantics),this.clearAction=u,this.name="RenderFrame"+nv++;var O=d[0];this.emptyTexture=i0(c),this.transparentTexture=i1(c),this.camera=i,this.keepColorBuffer=r,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=ip.fromArray(void 0===o?[1,1,0,0]:o),e.clearAction||this.resetClearActions(),this.passTextureCache=new rJ(c);var R=c.gpuCapability,I=R.detail,M=rq(R.level,I.readableDepthStencilTextures&&I.writableFragDepth);null==(p=this.renderer.getShaderLibrary())||p.addShader(M)}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,o=e;o<t.length;o++){var a,s,u,c=t[o],h=null==(s=c.attachments[0])?void 0:s.texture;if(h&&a===h){var l=h===r?n:r;c.resetColorAttachments([l])}(h=null==(u=c.attachments[0])?void 0:u.texture)&&(a=h)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(nm)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;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,o=r.persistent,a=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(a===iC.RGBA&&!o){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,o=r.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?iC.LINEAR:iC.NEAREST,c=iK.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iC.RGBA,name:"frame_a",minFilter:u,magFilter:u}),h=iK.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iC.RGBA,data:{width:a,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 r8(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:c}]}).initialize(this.renderer),d=new nx(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=this.renderer.engine,i=r1.create(e,{name:rH,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),r=rq(e.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(r);var n=i9.create(e,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:rH,shader:r});return n.blending=!1,n.depthTest=!1,n.culling=!1,(null==t?void 0:t.blend)&&(n.blending=!0,n.blendFunction=[iC.SRC_ALPHA,iC.ONE_MINUS_SRC_ALPHA,iC.SRC_ALPHA,iC.ONE_MINUS_SRC_ALPHA]),r4.create(e,{name:rH,geometry:i,material:n,priority:0})},i.removeRenderPass=function(t){el(this._renderPasses,t)},eU(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function ng(t){return t?new eQ(t.getWidth(),t.getHeight()):new eQ}var nx=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.configure=function(t){this.prePassTexture=t.getFramebuffer().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",ng(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(r8),nT=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},nb=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 eU(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nE="function"==typeof WebGL2RenderingContext,n_=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=nE&&ei(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),a=!!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"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),r&&!a&&(a=nC(t,t.HALF_FLOAT)),r&&!s&&(s=nC(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:a,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:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!o,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 o=this.drawBufferExtension;if(1===this.level&&!o&&i>0)throw Error("Draw multiple color buffers not available.");var a=o?o["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];a?t.framebufferTexture2D(e,a,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function nC(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,(tt=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tt.NONE=0]="NONE",tt[tt.PVRTC=1]="PVRTC",tt[tt.ASTC=2]="ASTC",t.FilterMode=void 0,(te=t.FilterMode||(t.FilterMode={}))[te.Nearest=0]="Nearest",te[te.Linear=1]="Linear",t.RenderTextureFormat=void 0,(ti=t.RenderTextureFormat||(t.RenderTextureFormat={}))[ti.RGBA32=0]="RGBA32",ti[ti.RGBAHalf=1]="RGBAHalf";var nS=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){},eU(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nA=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=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,o){return null},e.dispose=function(t){},t}(),nw=1,nO=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,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 eK,n=new eJ,o=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,o),e.x=o.x,e.y=o.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)===ib]],n=rk(this.color).getValue(0),o={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;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=i9.create(this.engine,o);return a.depthTest=!1,a.setVector4("uPos",new ip(0,0,0,0)),a.setVector2("uSize",new eQ(1,1)),a.setVector4("uColor",new ip(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new eJ(0,0,0,0)),a},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return r1.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:iC.LINES,maxVertex:4})},i.createMesh=function(t,e){return r4.create(this.engine,{name:"Interact_preview"+nw++,priority:0,worldMatrix:e$.fromIdentity(),geometry:t,material:e})},e}();function nR(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}function nI(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:o,maskMode:a,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+s+"+"+a+"."+o}}function nM(e,i){var r=null!=i?i:{},n=r.env,o=r.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===ib]];return{fragment:o?r9:nt,vertex:r7,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function nL(t,e){return t.cachePrefix+"_effects_sprite_"+e}function nP(t,e,i,r){var n=t.wireframe,o=nM(i,{wireframe:n,env:r});return o.shared=!0,n||(o.cacheId=nL(t,e)),o}function nV(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.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}eG(i,e);var r=i.prototype;return r.start=function(){var t=this,e=this.item.props.content.options,i=this.item.engine.renderer.env,r=this.item.composition,n=this.interactData.options,o=n.type,a=n.showPreview;if(o===ty.CLICK&&(this.clickable=!0,a&&i===ib)){var s=this.item.composition.getRendererOptions();this.previewContent=new nO(this.item.props.content,s,this.transform,this.engine)}r.addInteractiveItem(this.item,e.type),this.item.onEnd=function(){return r.removeInteractiveItem(t.item,e.type)},e.type===ty.DRAG&&(i!==ib||e.enableInEditor)&&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},r.update=function(t){var e;null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,nR(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(){if(this.item&&this.item.composition){var t;this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null==(t=this.previewContent)||t.mesh.dispose(),this.endDragTarget()}},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,o=r.fov,a=e.dy,s=e.dx*e.width/e.height,u=n[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(u),h=n[0]-this.dragRatio[0]*(s*c),l=n[1]-this.dragRatio[1]*(a*c);if(i.dxRange){var f,d=i.dxRange,p=d[0],m=d[1];(h=eq(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=eq(l,g,x))!==g&&l!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new eK(h,l,u)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var o={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;!nR(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iP({},r)),r=null}}};Object.keys(o).forEach(function(t){e.addEventListener(t,o[t])}),o.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(o).forEach(function(t){e.removeEventListener(t,o[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=rh(eK.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},eU(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ii),t.InteractComponent=en([e5(tX.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8;var nF={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},nN=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return eG(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),o=i.engine.gpuCapability,a=o.level,s=o.detail,u=(null!=r?r:{}).env;return!n.shaderResults[nL(nF,2)]&&(n.addShader(nP(nF,2,1,u)),n.addShader(nP(nF,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&n.addShader(rq(a,!0))),Promise.resolve()},i}(ir),nD=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=ej(this.playables);!(e=i()).done;){var r=e.value;this.updatePlayableTime(r,t)}for(var n,o=ej(this.playableOutputs);!(n=o()).done;)n.value.context.deltaTime=t;for(var a,s=ej(this.playableOutputs);!(a=s()).done;){var u=a.value;this.prepareFrameWithRoot(u)}for(var c,h=ej(this.playableOutputs);!(c=h()).done;){var l=c.value;this.processFrameWithRoot(l)}},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.overrideTimeNextEvaluation?t.overrideTimeNextEvaluation=!1:t.setTime(t.getTime()+e))},t}(),nz=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.overrideTimeNextEvaluation=!1,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=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(ei(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,this.overrideTimeNextEvaluation=!0},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}(),nk=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}(),nU=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(e9);(tr=t$||(t$={}))[tr.Playing=0]="Playing",tr[tr.Paused=1]="Paused",(tn=t0||(t0={}))[tn.Mix=0]="Mix",tn[tn.Passthrough=1]="Passthrough";var nB=[[0,0,1,1,void 0]],nG=[1,1,1,1],nX=0,nj=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}eG(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r=e.output.getUserData();if(ei(r,t.VFXItem)){this.spriteMaterial||(this.spriteMaterial=r.getComponent(t.SpriteComponent).material);var n=ro(nG,1),o=this.time/r.duration,a=this.opacityOverLifetime,s=this.colorOverLifetime;s&&(n=ep(s,o,!0),i=!0),a&&(n[3]*=a.getValue(o),i=!0),i&&(rs(this.renderColor,n,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=rk(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tA.GRADIENT_COLOR&&(this.colorOverLifetime=em(i.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},i}(nz);t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new nj(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(nU),t.SpriteColorPlayableAsset=en([e5("SpriteColorPlayableAsset")],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).frameAnimationTime=0,r.color=[1,1,1,1],r.visible=!0,r.getHitTestParams=function(t){var e=r.interaction;if(t||e){var i,n=r.getBoundingBox();if(n)return{behavior:(null==(i=r.interaction)?void 0:i.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:r.renderer.side===td.FRONT}}},i&&r.fromData(i),r}eG(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 ip().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",t)},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.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.update=function(t){this.frameAnimationTime+=t/1e3;var e=this.frameAnimationTime,i=this.item.duration,r=this.textureSheetAnimation;if(r){var n,o,a,s,u=r.total||r.row*r.col,c=0,h=0,l=1,f=1;if(this.splits){var d=this.splits[0];n=d[4],c=d[0],h=d[1],n?(l=d[3],f=d[2]):(l=d[2],f=d[3])}if(n?(o=1/r.row*l,a=1/r.col*f):(o=1/r.col*l,a=1/r.row*f),r.animate){var p=Math.round(Math.min(Math.max(e/i,0),1)*(u-1)),m=Math.floor(p/r.col),v=p-m*r.col;s=n?[o*m,a*(r.col-v)]:[o*v,a*(1+m)]}else s=[0,a];this.material.getVector4("_TexOffset").setFromArray([c+s[0],f+h-s[1],o,a])}},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(t,e,i,r){var n=t.geoData;n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.index,a=o.length,s=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new o.constructor(a);if(!this.wireframe)for(var u=0;u<a;u++)s[u]=i+o[u];return{atlasOffset:n.atlasOffset,index:s}},r.setItem=function(){var e=[],i=this.renderer.texture;i&&eh(e,i);var r=(i=this.renderer.texture)?e.indexOf(i):-1,n=this.getItemInitData(this,0,0,r),o=this.renderer,a=this.material.getVector4("_TexParams");a.x=o.occlusion?+o.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=o.renderMode;var s={atlasOffset:new Float32Array(n.atlasOffset.length),index:new Uint16Array(n.index.length)};s.atlasOffset.set(n.atlasOffset),s.index.set(n.index);var u=this.material,c=this.geometry,h=s.index;c.setIndexData(h),c.setAttributeData("atlasOffset",s.atlasOffset),c.setDrawCount(n.index.length);for(var l=0;l<e.length;l++){var f=e[l];u.setTexture("uSampler"+l,f)}for(var d=this.emptyTexture,p=e.length;p<t.maxSpriteMeshItemCount;p++)u.setTexture("uSampler"+p,d)},r.createGeometry=function(t){var e=12*this.splits.length;return r1.create(this.engine,{attributes:{aPos:{type:iC.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:iC.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.createMaterial=function(t,e){var i=t.side,r=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:nP(t,e,1)};this.preMultiAlpha=iw(n);var u=i9.create(this.engine,s),c={side:i,blending:!0,blendMode:n,mask:a,maskMode:o,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.hasUniform("_Color")||u.setVector4("_Color",new ip(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new ip),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new ip),u},r.getItemGeometryData=function(t,e){var i=t.splits,r=t.renderer,n=t.textureSheetAnimation;if(r.shape){for(var o=r.shape,a=o.index,s=o.aPoint,u=new Float32Array(s),c=[],h=[],l=0;l<u.length;l+=6)u[l]*=1,u[l+1]*=1,h.push(s[l+2],s[l+3]),c.push(u[l],u[l+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(c)),{index:a,atlasOffset:h}}var f=[],d=[],p=2,m=2;1===i.length&&(p=1,m=1);for(var v=[],y=0;y<p;y++)for(var g=0;g<m;g++){var x=(2*g+y)*4,T=n?[0,0,1,1,i[0][4]]:i[2*g+y],b=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],E=((y+y+1)/p-1)/2,_=((g+g+1)/m-1)/2,C=T[0],S=T[1],A=T[4]?T[3]:T[2],w=T[4]?T[2]:T[3],O=[-.5/p+E,.5/m+_,-.5/p+E,-.5/m+_,.5/p+E,.5/m+_,.5/p+E,-.5/m+_];f.push(b[0]*A+C,b[1]*w+S,b[2]*A+C,b[3]*w+S,b[4]*A+C,b[5]*w+S,b[6]*A+C,b[7]*w+S),v.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),d.push(x,1+x,2+x,2+x,1+x,3+x)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:f}},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=rh(eK.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);var i,r,n,o,a,s,u=t.interaction,c=t.options,h=t.listIndex,l=t.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tT.BILLBOARD,blending:null!=(r=l.blending)?r:tf.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tp.MASK,side:null!=(o=l.side)?o:td.DOUBLE,shape:l.shape,mask:null!=(a=l.mask)?a:0,maskMode:null!=(s=l.maskMode)?s:tp.NONE,order:void 0===h?0:h},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||nB,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nI(this);var f=this.createGeometry(iC.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=e$.fromIdentity(),this.material=d,this.geometry=f,this.name="MSprite"+nX++;var p=c.startColor||[1,1,1,1];this.material.setVector4("_Color",new ip().setFromArray(p)),this.material.setVector4("_TexOffset",new ip().setFromArray([0,0,1,1])),this.setItem()},r.toData=function(){e.prototype.toData.call(this)},i}(ii),t.SpriteComponent=en([e5(tX.SpriteComponent)],t.SpriteComponent);var nH="lookup_texture",nW="offscreen_canvas",nY={},nZ=new eJ,nq=1,nQ=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new eK(0,0,0),this.quat=new eJ(0,0,0,1),this.rotation=new e0(0,0,0),this.scale=new eK(1,1,1),this.anchor=new eK(0,0,0),this.size=new eQ(1,1),this.children=[],this.worldMatrix=e$.fromIdentity(),this.localMatrix=e$.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new eK(0,0,0),quat:new eJ(0,0,0,1),scale:new eK(1,1,1)},this.name="transform_"+nq++,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,o=t.size,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(ei(i,eK)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)ei(a,eJ)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(r){var c=e?-1:1;ei(r,e0)?this.setRotation(r.x*c,r.y*c,r.z*c):this.setRotation(r[0]*c,r[1]*c,r[2]*c)}n&&(ei(n,eK)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(ei(u,eQ)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){eh(this.children,t)},e.removeChild=function(t){el(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new e0)},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 e0)},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 eK().copyFrom(t.position),rotation:new e0(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new eK().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=nZ.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},eU(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}(),nK=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=nJ(this.arc,this.arcMode,t)*eH,i=new eK(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*eH),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eV(0,1)),direction:n.normalize()}},t}();function nJ(t,e,i){if(e===tM.RANDOM)t=eV(0,t);else if(e===tM.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tM.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===tM.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n$=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=nJ(this.arc,this.arcMode,t)*eH,i=new eK(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),n0=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eV(-this._d,this._d),i=eV(-this._h,this._h);return{direction:new eK(0,0,1),position:new eK(e,i,0)}},t}(),n1=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=nJ(this.arc,this.arcMode,t)*eH,i=new eK(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,o=Math.atan2(n,r),a=Math.tan(e),s=new eK;return e<o?s.set(r,r*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-r,-r*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(r,r*a,0),{direction:i,position:s}},t}(),n2=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tM.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eV(0,1);return{direction:new eK(0,1,0),position:new eK(this._d*(e-.5),0,0)}},t}(),n3=new e$,n4=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=eV(0,2*Math.PI),n=nJ(this.arc,this.arcMode,t)*eH,o=n3.setFromRotationZ(n),a=new eK(Math.cos(r),Math.sin(r),0),s=new eK(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),n5=new e$,n6=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 eV(-90,90)},e.generate=function(t){var e=nJ(this.arc,this.arcMode,t)*eH,i=this.getHorizontalAngle()*eH,r=this.radius,n=new eK(Math.cos(i),0,Math.sin(i)),o=n5.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(r),direction:o}},t}(),n8=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.getHorizontalAngle=function(){return eV(0,90)},e}(n6),n9=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=eq(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(nJ(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,o=new eK(r,n,0);return{position:new eK(r*this.width,n*this.height,0),direction:o.normalize()}},t}(),n7=function(){function t(){}return t.prototype.generate=function(){return{position:new eK,direction:new eK}},t}(),ot=((t1={})[tm.NONE]=n7,t1[tm.CONE]=nK,t1[tm.SPHERE]=n6,t1[tm.HEMISPHERE]=n8,t1[tm.CIRCLE]=n$,t1[tm.DONUT]=n4,t1[tm.RECTANGLE]=n0,t1[tm.EDGE]=n2,t1[tm.RECTANGLE_EDGE]=n1,t1[tm.TEXTURE]=n9,t1);function oe(t){if(!t)return new n7;var e=iP({radius:1,arc:360,angle:0,arcMode:tM.RANDOM},t),i=t.type,r=ot[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tm.NONE){var o=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=o,n.upDirection=eK.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function oi(t,e,i,r,n){var o,a;if(n===function(t,e,i,r){for(var n=0,o=e,a=i-r;o<i;o+=r)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,i,r)>0)for(o=e;o<i;o+=r)a=op(o,t[o],t[o+1],a);else for(o=i-r;o>=e;o-=r)a=op(o,t[o],t[o+1],a);return a&&ou(a,a.next)&&(om(a),a=a.next),a}function or(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ou(r,r.next)||0===os(r.prev,r,r.next))){if(om(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function on(t,e){return t.x-e.x}function oo(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 oa(t,e,i,r,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(n-a)*(r-s)>=0}function os(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ou(t,e){return t.x===e.x&&t.y===e.y}function oc(t,e,i,r){var n=ol(os(t,e,i)),o=ol(os(t,e,r)),a=ol(os(i,r,t)),s=ol(os(i,r,e));return!!(n!==o&&a!==s||0===n&&oh(t,i,e)||0===o&&oh(t,r,e)||0===a&&oh(i,t,r)||0===s&&oh(i,e,r))}function oh(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 ol(t){return t>0?1:t<0?-1:0}function of(t,e){return 0>os(t.prev,t,t.next)?os(t,e,t.next)>=0&&os(t,t.prev,e)>=0:0>os(t,e,t.prev)||0>os(t,t.next,e)}function od(t,e){var i=new ov(t.i,t.x,t.y),r=new ov(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function op(t,e,i,r){var n=new ov(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 om(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 ov(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 oy=0;function og(t,e,i,r){i=i||2,oy=r||0;var n,o,a,s,u,c,h,l=e&&e.length,f=l?e[0]*i:t.length,d=oi(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,o,a,s,u,c=[];for(n=0,o=e.length;n<o;n++)a=e[n]*r,s=n<o-1?e[n+1]*r:t.length,(u=oi(t,a,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(on),n=0;n<c.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,o=e,a=t.x,s=t.y,u=-1/0;do{if(s<=o.y&&s>=o.next.y&&o.next.y!==o.y){var c=o.x+(s-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(c<=a&&c>u){if(u=c,c===a){if(s===o.y)return o;if(s===o.next.y)return o.next}n=o.x<o.next.x?o:o.next}}o=o.next}while(o!==e);if(!n)return null;if(a===u)return n;var h,l=n,f=n.x,d=n.y,p=1/0;o=n;do a>=o.x&&o.x>=f&&a!==o.x&&oa(s<d?a:u,s,f,d,s<d?u:a,s,o.x,o.y)&&(h=Math.abs(s-o.y)/(a-o.x),of(o,t)&&(h<p||h===p&&(o.x>n.x||o.x===n.x&&(i=n,r=o,0>os(i.prev,i,r.prev)&&0>os(r.next,i,i.next))))&&(n=o,p=h)),o=o.next;while(o!==l);return n}(t,e)){var i=od(e,t);or(e,e.next),or(i,i.next)}})(c[n],i),i=or(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],o=s=t[1];for(var m=i;m<f;m+=i)u=t[m],c=t[m+1],u<n&&(n=u),c<o&&(o=c),u>a&&(a=u),c>s&&(s=c);h=0!==(h=Math.max(a-n,s-o))?1/h:0}return function t(e,i,r,n,o,a,s){if(e){!s&&a&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=oo(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,o,a,s,u,c=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,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--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,c*=2}while(a>1)}(n)}(e,n,o,a);for(var u,c,h=e;e.prev!==e.next;){if(u=e.prev,c=e.next,a?function(t,e,i,r){var n=t.prev,o=t.next;if(os(n,t,o)>=0)return!1;for(var a=n.x<t.x?n.x<o.x?n.x:o.x:t.x<o.x?t.x:o.x,s=n.y<t.y?n.y<o.y?n.y:o.y:t.y<o.y?t.y:o.y,u=n.x>t.x?n.x>o.x?n.x:o.x:t.x>o.x?t.x:o.x,c=n.y>t.y?n.y>o.y?n.y:o.y:t.y>o.y?t.y:o.y,h=oo(a,s,e,i,r),l=oo(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&&oa(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&os(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,d.x,d.y)&&os(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&os(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&oa(n.x,n.y,t.x,t.y,o.x,o.y,d.x,d.y)&&os(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,o,a):function(t){var e=t.prev,i=t.next;if(os(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(oa(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&os(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+oy),i.push(e.i/r+oy),i.push(c.i/r+oy),om(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,o=r.next.next;!ou(n,o)&&oc(n,r,r.next,o)&&of(n,o)&&of(o,n)&&(e.push(n.i/i+oy),e.push(r.i/i+oy),e.push(o.i/i+oy),om(r),om(r.next),r=t=o),r=r.next}while(r!==t);return or(r)}(or(e),i,r),i,r,n,o,a,2):2===s&&function(e,i,r,n,o,a){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&&oc(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,c)&&(of(u,c)&&of(c,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,c)&&(os(u.prev,u,c.prev)||os(u,c.prev,c))||ou(u,c)&&os(u.prev,u,u.next)>0&&os(c.prev,c,c.next)>0))){var l=od(s,h);s=or(s,s.next),l=or(l,l.next),t(s,i,r,n,o,a),t(l,i,r,n,o,a);return}h=h.next}s=s.next}while(s!==e)}(e,i,r,n,o,a):t(or(e),i,r,n,o,a,1);break}}}}(d,p,i,n,o,h),p}function ox(t,e){for(var i,r,n=t.s,o=t.p,a=n[1],s=o[1],u=0,c=0;c<a.length;c++)u+=a[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],T=0===h?0:-Math.PI/2,b=0;b<a.length;b++)for(var E=a[b],_=s[b],C=s[b+1]||s[0],S=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,o,a,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*a+f*r[0],t[1]=c*i[1]+h*o+l*s+f*r[1]})(S,E[A],_,C,_[4],_[5],C[2],C[3]),i=S[0],r=S[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,ob(x,x,T),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=og(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function oT(t,e){for(var i,r=[],n=(i=[],t.gs?t.gs.forEach(function(t){i.push({p:[tA.SHAPE_POINTS,t.p],s:[tA.SHAPE_SPLITS,t.s]})}):t.g?i.push({p:[tA.SHAPE_POINTS,t.g.p],s:[tA.SHAPE_SPLITS,t.g.s]}):i.push(t),i),o=0,a=0,s=0,u=0;u<n.length;u++){var c=ox(n[u],{indexBase:o,uvTransform:e});o+=c.aPoint.length/5,r.push(c),a+=c.aPoint.length,s+=c.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(a),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 ob(t,e,i){var r=Math.cos(i),n=Math.sin(i),o=e[0],a=e[1];return t[0]=r*o+n*a,t[1]=-n*o+r*a,t}var oE=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=ei(r,rA)?r:rk(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,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(this)},t}(),o_=function(t){this.content=t},oC=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 o_(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 o_(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,o=t.next;n.next=o,o&&(o.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)},t}(),oS=new eK,oA=new eK,ow=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,o=i.colorOverTrail,a=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?rk(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,T=e.gpuCapability,b=T.detail,E=T.level,_=Math.max(i.pointCountPerTrail,2),C=rX(),S=b.maxVertexTextures>0,A=(null!=(r=e.renderer)?r:{}).env,w={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===ib]],R=a>64,I=0;n&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,w.uColorOverLifetime=iK.createWithData(e,eT(n))),o&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,w.uColorOverTrail=iK.createWithData(e,eT(o))),R?(O.push(["ATTR_TRAIL_START",1]),I|=8):w.uTrailStart=new Float32Array(a),w.uOpacityOverLifetimeValue=u.toUniform(C);var M=c.toUniform(C);O.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),w.uVCurveValues=rA.getAllData(C);var L={shader:{vertex:nr,fragment:ne,macros:O,glslVersion:1===E?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+I+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=_*a*2,V=(_-1)*a,F=Float32Array.BYTES_PER_ELEMENT,N=12*F,D={attributes:{aColor:{size:4,stride:N,data:new Float32Array(12*P)},aSeed:{size:1,stride:N,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:N,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:N,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:iC.DYNAMIC_DRAW};if(R)D.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var z=new Float32Array(P);D.attributes.aTrailStartIndex={size:1,data:z};for(var k=0;k<a;k++)for(var U=2*_,B=k*U,G=0;G<U;G++)z[B+G]=k}var X=iw(f),j=i9.create(e,L);j.blending=!0,j.depthMask=l,j.depthTest=!0,iL(j,d),iI(j,f);var H=this.mesh=r4.create(e,{name:"MTrail_"+h,material:j,geometry:r1.create(e,D)}),W=null!=m?m:iK.createWithData(e);Object.keys(w).map(function(t){var e=w[t];if(ei(e,iK))j.setTexture(t,e);else if("uTrailStart"===t)j.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new ip(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}j.setVector4Array(t,i)}else j.setVector4(t,ip.fromArray(e))}),j.setFloat("uTime",0),j.setVector4("uWidthOverTrail",ip.fromArray(M)),j.setVector2("uTexOffset",new eQ(0,0)),j.setVector4("uTextureMap",ip.fromArray(void 0===p?[0,0,1,1]:p)),j.setVector4("uParams",new ip(0,_-1,0,0)),j.setTexture("uMaskTex",W),j.setVector4("uColorParams",new ip(m?1:0,+X,0,+(l&&!v))),this.maxTrailCount=a,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(a)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=r%n,u=(r-1)%n,c=(r-2)%n,h=this.getTrailPosition(t,u,oS);if(!(h&&this.checkVertexDistance&&(null==h?void 0:h.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=oM(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),o.setAttributeSubData("aDir",6*l,v),o.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,o.setAttributeSubData("aColor",24*l,g),u>=0){var T=new Float32Array(oM(this.getTrailPosition(t,c,oA),h,e)),b=(t*n+u)*6;o.setAttributeSubData("aDir",b,T),o.setAttributeSubData("aDir",b+3,T);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]),C=(t*a+(r-1)%a)*6;o.setIndexSubData(C,_)}r=++this.trailCursors[t];var S=this.mesh.material,A=S.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;o.setAttributeSubData("aTrailStart",t*R.length,R)}else{var M=S.getFloats("uTrailStart");void 0!=M&&(M[t]=w,S.setFloats("uTrailStart",M))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),S.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,o=this.geometry.getAttributeData("aColor");return i.x=o[n],i.y=o[1+n],i.z=o[2+n],i}},i.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),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();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){},eU(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}(),oO=new eK,oR=new eK,oI=new eK;function oM(t,e,i){return t||i?(t?i?(oR.subtractVectors(e,t).normalize(),oR.subtractVectors(i,e),oI.copyFrom(oR).normalize(),oO.addVectors(oR,oI)):oO.subtractVectors(e,t):oO.subtractVectors(i,e),oO.normalize().toArray()):[0,0,0]}var oL=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 ow(e,r));var n,o=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(o.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=o,n}eG(e,t);var i=e.prototype;return i.start=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=ej(this.meshes);!(t=e()).done;)t.value.start()},i.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new ip(e,this.item.duration,0,0))},i.render=function(t){for(var e,i=ej(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.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}(ii);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)===tI.removeParticle,ray:t})}}},r&&n.fromData(r),n}eG(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},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]===tA.CONSTANT_VEC3?e.add(r[1]):t=rk(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,o=e.clone();if(t&&o.add(t.getValue(0)),this.transform.setPosition(o.x,o.y,o.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var o=this.item.duration;n.add(r.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},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 o=r.first;r.removeNode(o),i=n[1]=o.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 ip(n[0],n[1],n[2],t));for(var o=r.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},r.setColor=function(t,e,i,r){var n,o=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,s=(null==(n=o.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new ip(s[0],s[1],s[2],r));for(var u=a.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.start=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 oC(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1},r.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,o=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var a=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,c=!1,h=function(){e.trails&&!c&&(c=!0,a.forEach(function(t){var i=t[0],r=t[1],n=t[2],o=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,o,n)}))};if(this.ended){if(this.item.endBehavior!==tO.restart&&tO.destroy===this.item.endBehavior){var l=a.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/o.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var T=this.createPoint(d);T.delay+=i+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var b=o.bursts,E=(null==b?void 0:b.length)-1,_=0;E>=0&&_<y&&!g();E--){var C=b[E],S=!C.disabled&&C.getGeneratorOptions(u,d);if(S){var A=[0,0,0],w=o.burstOffsets[E],O=w&&w[S.cycleIndex]||A;C.once&&this.removeBurst(E);for(var R=0;R<S.count&&_<y&&!g();R++){var I,M=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:R,burstCount:S.count}));M.delay+=i,_++,(I=M.transform).translate.apply(I,[].concat(O)),this.addParticle(M,y)}}}}else this.item.endBehavior===tO.restart?(h(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,o.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.onIterate(this)):(this.ended=!0,this.onEnd(this),this.item.endBehavior===tO.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 o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);i.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>r&&(a=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],o=new eK,a=!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},o)),d&&(t.removeParticle&&(i.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(a=!0))}else break}while((r=r.pre)&&!a);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 o=this.trails,a=this.getPointPosition(i),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),c=1,h=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(c*=u[0]),o.sizeAffectsLifetime&&(h*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:s,lifetime:h,size:c,time:r})}},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,o=t.gravity,a=this.options.forceTarget,s=this.lastUpdate-n,u=new eK,c=eK.fromArray(void 0===o?[]:o);e.assignWorldTRS(u);var h=rr(new eK,this.options,c,s,r,u,i);if(a){var l=a.target||[0,0,0],f=a.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.onEnd=function(t){},r.onIterate=function(t){},r.initPoint=function(t){var e,i,r,n,o=this.options,a=this.lifetime,s=this.shape,u=o.startSpeed.getValue(a),c=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),h=t.position,l=new nQ({position:c.transformPoint(h,new eK),valid:!0}),f=t.direction;if(f=c.transformNormal(f,oP).normalize(),o.startTurbulence&&o.turbulence){for(var d=0;d<3;d++)oz.setElement(d,o.turbulence[d].getValue(a));ok.setFromVector3(oz.negate()),oB.setFromEuler(ok).transformNormal(f).normalize()}s.alignSpeedDirection?(oD.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=eK.Z.clone(),c.transformNormal(this.upDirectionWorld)),oN.crossVectors(oD,this.upDirectionWorld).normalize(),oN.isZero()&&oN.set(1,0,0)):(oN.set(1,0,0),oD.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=oU)[0]=p.animationDelay.getValue(a),n[1]=p.animationDuration.getValue(a),n[2]=p.cycles.getValue(a)),o.start3DRotation?oF.set(o.startRotationX.getValue(a),o.startRotationY.getValue(a),o.startRotationZ.getValue(a)):o.startRotation?oF.set(0,0,o.startRotation.getValue(a)):oF.set(0,0,0),l.setRotation(oF.x,oF.y,oF.z);var m=o.startColor.getValue(a);if(3===m.length&&(m[3]=1),o.start3DSize)oV.x=o.startSizeX.getValue(a),oV.y=o.startSizeY.getValue(a);else{var v=o.startSize.getValue(a),y=o.sizeAspect.getValue(a);oV.x=v,oV.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!o.particleFollowParent){var x=new eK;this.transform.assignWorldTRS(void 0,void 0,x),oV.x*=x.x,oV.y*=x.y}return l.setScale(oV.x,oV.y,1),{size:oV,vel:g,color:m,delay:o.startDelay.getValue(a),lifetime:o.startLifetime.getValue(a),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:o.gravity,sprite:n,dirY:oD,dirX:oN,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&ei(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,o,a,s,u,c,h,l,f,d,p=t.options,m=t.positionOverLifetime,v=void 0===m?{}:m,y=t.shape,g=null==v?void 0:v.gravityOverLifetime,x=rn(null==v?void 0:v.gravity),T=t.textureSheetAnimation,b=T?{animationDelay:rk(T.animationDelay||0),animationDuration:rk(T.animationDuration||1),cycles:rk(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,E=!!(y&&y.turbulenceX||(null==y?void 0:y.turbulenceY)||(null==y?void 0:y.turbulenceZ));E&&(n=[rk(null!=(o=y.turbulenceX)?o:0),rk(null!=(a=y.turbulenceY)?a:0),rk(null!=(s=y.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=oe(y),this.emission={rateOverTime:rk(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=ei(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 oE(t)})},this.textureSheetAnimation=b;var _=t.renderer||{},C={},S=t.rotationOverLifetime;S&&(C.asRotation=!!S.asRotation,C.z=S.z?rk(S.z):rk(0),S.separateAxes&&(C.x=S.x&&rk(S.x),C.y=S.y&&rk(S.y))),(null==v?void 0:v.forceTarget)&&(c={target:v.target||[0,0,0],curve:rk(v.forceCurve||[tA.LINE,[[0,0],[1,1]]])});var A={x:v.linearX&&rk(v.linearX||0),y:v.linearY&&rk(v.linearY||0),z:v.linearZ&&rk(v.linearZ||0),asMovement:v.asMovement},w={x:v.orbitalX&&rk(v.orbitalX),y:v.orbitalY&&rk(v.orbitalY),z:v.orbitalZ&&rk(v.orbitalZ),center:v.orbCenter,asRotation:v.asRotation},O=t.sizeOverLifetime||{},R=t.colorOverLifetime,I=(null==O?void 0:O.separateAxes)?{separateAxes:!0,x:rk(O.x),y:rk(O.y)}:{separateAxes:!1,x:rk(("size"in O?O.size:O.x)||1)};_.anchor=_.anchor||[0,0];var M=eQ.fromArray(_.anchor);this.options={particleFollowParent:!!p.particleFollowParent,startLifetime:rk(p.startLifetime),startDelay:rk(p.startDelay||0),startSpeed:rk(v.startSpeed||0),startColor:rk(p.startColor),looping:!1,maxCount:null!=(h=p.maxCount)?h:0,gravityModifier:rk(g||0),gravity:x,start3DSize:!!p.start3DSize,startTurbulence:E,turbulence:n,speedOverLifetime:v.speedOverLifetime&&rk(v.speedOverLifetime),linearVelOverLifetime:A,orbitalVelOverLifetime:w,forceTarget:c},p.startRotationZ&&(this.options.startRotation=rk(p.startRotationZ||0)),(p.startRotationX||p.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=rk(p.startRotationX||0),this.options.startRotationY=rk(p.startRotationY||0),this.options.startRotationZ=rk(p.startRotationZ||0)),p.start3DSize?(this.options.startSizeX=rk(p.startSizeX),this.options.startSizeY=rk(p.startSizeY)):(this.options.startSize=rk(p.startSize),this.options.sizeAspect=rk(p.sizeAspect||1));var L={meshSlots:p.meshSlots,name:this.name,matrix:e$.IDENTITY,shaderCachePrefix:"",renderMode:_.renderMode||tT.BILLBOARD,side:_.side||td.DOUBLE,gravity:x,blending:_.blending||tf.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:b,occlusion:!!_.occlusion,transparentOcclusion:!!_.transparentOcclusion,maxCount:p.maxCount,mask:_.mask,maskMode:null!=(l=_.maskMode)?l:tp.NONE,forceTarget:c,diffuse:_.texture,sizeOverLifetime:I,anchor:M};if(R){var P=R.color,V=R.opacity;L.colorOverLifetime={},V&&(L.colorOverLifetime.opacity=rk(R.opacity)),P&&(P[0]===tA.GRADIENT_COLOR?L.colorOverLifetime.color=R.color[1]:P[0]===tA.RGBA_COLOR?L.colorOverLifetime.color=iK.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):ei(P,iK)&&(L.colorOverLifetime.color=P))}var F=[],N=[0,0,1,1];if(t.splits){var D=t.splits[0];N=(f=D[4])?[D[0],D[1],D[3],D[2]]:[D[0],D[1],D[2],D[3]]}if(b&&!b.animate)for(var z=f?b.row:b.col,k=f?b.col:b.row,U=b.total||z*k,B=0,G=0;G<z;G++)for(var X=0;X<k&&B<U;X++,B++)F.push([G*N[2]/z+N[0],X*N[3]/k+N[1],N[2]/z,N[3]/k]);else F.push(N);this.uvs=F,L.textureFlip=f;var j=t.trails;j&&(this.trails={lifetime:rk(j.lifetime),dieWithParticles:!1!==j.dieWithParticles,sizeAffectsWidth:!!j.sizeAffectsWidth,sizeAffectsLifetime:!!j.sizeAffectsLifetime,inheritParticleColor:!!j.inheritParticleColor,parentAffectsPosition:!!j.parentAffectsPosition},d={name:"Trail",matrix:e$.IDENTITY,minimumVertexDistance:j.minimumVertexDistance||.02,maxTrailCount:p.maxCount,pointCountPerTrail:Math.round(j.maxPointPerTrail)||32,blending:j.blending,texture:j.texture,opacityOverLifetime:rk(j.opacityOverLifetime||1),widthOverTrail:rk(j.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!j.occlusion,transparentOcclusion:!!j.transparentOcclusion,textureMap:j.textureMap,mask:_.mask,maskMode:_.maskMode},j.colorOverLifetime&&j.colorOverLifetime[0]===tA.GRADIENT_COLOR&&(d.colorOverLifetime=j.colorOverLifetime[1]),j.colorOverTrail&&j.colorOverTrail[0]===tA.GRADIENT_COLOR&&(d.colorOverTrail=j.colorOverTrail[1])),this.renderer=new oL(this.engine,L,d),this.meshes=this.renderer.meshes;var H=t.interaction;H&&(this.interaction={multiple:H.multiple,radius:H.radius,behavior:H.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this,this.renderer.item=this.item,this.item.components.push(this.renderer),this.item.rendererComponents.push(this.renderer)},eU(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}(e7),t.ParticleSystem=en([e5(tX.ParticleSystem)],t.ParticleSystem);var oP=new eK,oV=new eQ,oF=new e0,oN=new eK,oD=new eK,oz=new eK,ok=new e0,oU=[0,0,0],oB=new e$,oG=function(e){function i(){return e.apply(this,arguments)}eG(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&ei(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){e.setVisible(!0);var i=t.deltaTime;this.time<e.item.duration&&e.isFrozen()&&e.reset(),e.onUpdate(i)}},i}(nz),oX=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createPlayable=function(t){return new oG(t)},e}(nU),oj={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;var r,n,o,a,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,T=i.gravityModifier,b=i.maxCount,E=i.textureFlip,_=i.useSprite,C=i.name,S=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,N=void 0===F?0:F,D=i.diffuse,z=void 0===D?iK.createWithData(e):D,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+N],["ENV_EDITOR",f===ib]],X=e.gpuCapability.level,j=rX(),H=rX(),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(j)),(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=ei(p.color,iK)?p.color:iK.createWithData(e,eT(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(j):Y.uOpacityOverLifetimeValue=rk(1).toUniform(j),["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(j),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(j),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(j),(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(j)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(j),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(j),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(j),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=T.toUniform(j),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(j)),U&&H.max?(q|=1048576,Y.uFCurveValueTexture=iJ(e,rA.getAllData(H,!0),H.index,1)):Y.uFCurveValues=rA.getAllData(H);var Q=j.max+j.curves.length-32>B;if(2===X&&(j.max=-1,j.index=V?V[0]:oY(j.index),H.index>0&&(H.max=-1,H.index=V?V[1]:oY(H.index))),Q&&U&&W){var K=iJ(e,rA.getAllData(j,!0),j.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=rA.getAllData(j);var J=["-p:",N,q,j.index,j.max,H.index,H.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",j.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",j.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]);var $={fragment:ne,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+ni,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=iw(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==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var te=i9.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(ei(e,iK)){te.setTexture(t,e);return}var i=[];switch(oj[t]){case"vec4":te.setVector4(t,ip.fromArray(e));break;case"vec3":te.setVector3(t,eK.fromArray(e));break;case"vec2":te.setVector2(t,eQ.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new ip(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 eK(0,0,0)),te.setFloat("emissionIntensity",0);var ti=r1.create(e,(r=4*b,n=this.useSprite,o="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(a=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*a,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*a,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*a,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*a,data:new Float32Array(0)},aSeed:{size:1,offset:3*a,stride:8*a,dataSource:"aRot"},aColor:{size:4,offset:4*a,stride:8*a,dataSource:"aRot"},aOffset:{size:4,stride:4*a,data:new Float32Array(0)}},n&&(u.aSprite={size:3,stride:3*a,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:o,maxVertex:r})),tr=r4.create(e,{name:"MParticle_"+C,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=T,this.maxCount=b,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[e[i],e[i+1],e[i+2],e[i+3]]},i.getPointPosition=function(t){var e=this.geometry,i=48*t,r=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,u=s.getVector4("uAcceleration").toVector3(),c=eK.fromArray(r,i),h=eK.fromArray(r,i+3),l=rr(new eK,this,u,o,a,c,h);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),d=this.forceTarget.curve.getValue(o/a),p=1-d;l.x=l.x*p+f.x*d,l.y=l.y*p+f.y*d,l.z=l.z*p+f.z*d}return l},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],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new i.constructor(0))},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,o=4*n,a=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)},h=this.useSprite;h&&(c.aSprite=new Float32Array(12));var l=new eK,f=new eJ,d=new eK(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=nQ.getRotation(f,new e0),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,b=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(r=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,w=4*C,O=12*C,R=8*C;c.aPos.set(m,O),T.fill(c.aPos,O+3),c.aRot.set(v,R),c.aRot[R+3]=_,c.aRot.set(b,R+4),h&&c.aSprite.set(r,A);var I=e.uv||x;if(I){var M=h?1-y[S+1]:y[S+1];g[0]=I[0]+y[S]*I[2],g[1]=I[1]+M*I[3]}c.aOffset.set(g,w);for(var L=C+C,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 N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=ef(a.getIndexData(),6*n,6*i,u);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(c).forEach(function(e){var r=c[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var h=ef(a.getAttributeData(e),o*n,4*i*n,u);h.set(r,r.length*t),a.setAttributeData(e,h)}else a.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),oW=[10,32,64,160];function oY(t){for(var e=0;e<oW.length;e++){var i=oW[e];if(i>t)return i}return t||oW[0]}function oZ(t,e,i){void 0===i&&(i="");var r,n,o,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===ib]],c=e.level,h=e.detail,l=rX(),f=rX(),d=h.maxVertexUniforms>0,p=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,rG(l,p));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&rG(l,x);var T=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[r])&&(rG(l,T[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==T?void 0:T[n])&&(rG(l,T[n]),a=1,v|=1<<10+e,o=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==T?void 0:T.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),o&&(null==T?void 0:T.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(rG(l,b.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,rG(l,b.y)):rG(l,b.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(rG(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(rG(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(rG(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)}rG(l,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,rG(l,T.forceCurve));var _=h.halfFloatTexture;_&&f.max&&(v|=1048576);var C=h.maxVertexUniforms,S=l.max+l.curves.length-32>C;nY[nH]&&(S=!0),2===c&&(l.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var A={fragment:ne,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+ni,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 oq(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 o=0;o<t.macros.length;o++){var a=t.macros[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=i;break}}}var oQ=function(e){function i(){return e.apply(this,arguments)}return eG(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,o=n.level,a=(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=oZ(e,n,a),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,T,b,E,_=(d=e.content.trails,p=e.content.options.maxCount,m=e.name,void 0===(v=a)&&(v=""),y=0,g=nY[nH]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===ib]],T=rX(),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),rG(T,d.opacityOverLifetime),rG(T,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),{vertex:nr,fragment:ne,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+T.index+"+"+T.max});_.vertex=iR(null!=(b=_.macros)?b:[],_.vertex,t.ShaderType.vertex,o),_.fragment=iR(null!=(E=_.macros)?E:[],_.fragment,t.ShaderType.fragment,o),_.glslVersion=2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,s.addShader(_)}}),c.forEach(function(e){var i,r;2===o?(oq(e,l,h),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=iR(null!=(i=e.macros)?i:[],e.vertex,t.ShaderType.vertex,o),e.fragment=iR(null!=(r=e.macros)?r:[],e.fragment,t.ShaderType.fragment,o),s.addShader(e)}),2===o&&u.forEach(function(t){t.content.options.meshSlots=[l,h]}),Promise.resolve()},i}(ir),oK=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ir);function oJ(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var o$=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(ei(e,o0))return e.animationStream},t}(),o0=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new o$(oJ(i)),i}return eG(e,t),e}(nz),o1=new e0,o2=new eK(1,1,1),o3=new eK,o4=function(e){function i(){return e.apply(this,arguments)}eG(i,e);var r=i.prototype;return r.start=function(){var t,e=this.binding,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new eK(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,o=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=rk(r.path));var a=r.linearX||r.linearY||r.linearZ;a&&(this.linearVelOverLifetime={x:r.linearX&&rk(r.linearX),y:r.linearY&&rk(r.linearY),z:r.linearZ&&rk(r.linearZ),asMovement:r.asMovement,enabled:!!a});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&rk(r.orbitalX),y:r.orbitalY&&rk(r.orbitalY),z:r.orbitalZ&&rk(r.orbitalZ),center:rn(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&rk(r.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=rk(o.x||1),this.sizeYOverLifetime=rk(o.y||1),this.sizeZOverLifetime=rk(o.z||1)):this.sizeXOverLifetime=rk(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:rk(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=rk(n.x||0),u.y=rk(n.y||0)}this.gravity=eK.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=rk(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?eK.fromArray(r.direction).normalize():new eK,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.binding){var i=e.output.getUserData();ei(i,t.VFXItem)&&(this.binding=i,this.start())}this.binding&&this.binding.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.binding,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){o2.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(o2.y=this.sizeYOverLifetime.getValue(r),o2.z=this.sizeZOverLifetime.getValue(r)):o2.z=o2.y=o2.x;var n=this.originalTransform.scale;e.transform.setScale(o2.x*n.x,o2.y*n.y,o2.z*n.z)}if(this.rotationOverLifetime){var o=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},a=o(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;o1.x=s?o(this.rotationOverLifetime.x):0,o1.y=s?o(this.rotationOverLifetime.y):0,o1.z=a;var u=o1.addEulers(this.originalTransform.rotation,o1);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(rr(o3,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&o3.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(o3.x,o3.y,o3.z))},i}(o0);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eG(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new o4(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(nU),t.TransformPlayableAsset=en([e5("TransformPlayableAsset")],t.TransformPlayableAsset);var o5=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.processFrame=function(t){},e}(nz);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createPlayable=function(t){return new o5(t)},e}(nU),t.ActivationPlayableAsset=en([e5("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}eG(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=ej(this.positionCurves);!(r=n()).done;){var o=r.value,a=o.keyFrames.getValue(i),s=this.findTarget(t,o.path);null==s||s.transform.setPosition(a.x,a.y,a.z)}for(var u,c=ej(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=ej(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=ej(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:rk(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var o,a=ej(t.rotationCurves);!(o=a()).done;){var s=o.value,u={path:s.path,keyFrames:rk(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var c,h=ej(t.scaleCurves);!(c=h()).done;){var l=c.value,f={path:l.path,keyFrames:rk(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=ej(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:rk(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=ej(e);!(i=n()).done;){for(var o,a=i.value,s=!1,u=ej(r.children);!(o=u()).done;){var c=o.value;if(c.name===a){r=c,s=!0;break}}if(!s)return}return r},e}(e9),t.AnimationClip=en([e5(tX.AnimationClip)],t.AnimationClip);var o6=function(e){function i(){return e.apply(this,arguments)}return eG(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();ei(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(nz),o8=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>.001&&(this.endBehavior===tO.restart?e%=i:this.endBehavior===tO.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}eG(e,t);var i=e.prototype;return i.resolveBinding=function(t){return t},i.createTrackMixer=function(t){return new nz(t)},i.createOutput=function(){return new nk},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=ej(this.clips);!(i=n()).done;){var o=i.value;r.push(o)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),o=ej(e);!(r=o()).done;){var a=r.value,s=this.createClipPlayable(t,a),u=new o9(a,s,n,this);i.push(u),n.addInput(s,0),n.setInputWeight(s,0)}return n},i.createPlayable=function(t){return new nz(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t)},i.createClip=function(t,e){var i=new o8;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=ej(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)},e}(nU),en([e8(o8,void 0)],t.TrackAsset.prototype,"clips",void 0),en([e8(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=en([e5("TrackAsset")],t.TrackAsset),t.TrackType=void 0,(to=t.TrackType||(t.TrackType={}))[to.MasterTrack=0]="MasterTrack",to[to.ObjectTrack=1]="ObjectTrack";var o9=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,ei(this.track.binding,t.VFXItem)&&(this.particleSystem=this.track.binding.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,o=!1,a=this.track.binding;e>i.start+i.duration+.001&&i.endBehavior===tO.destroy?ei(a,t.VFXItem)&&t.VFXItem.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,o=!0):e<i.start&&(r=0),o&&this.playable.getPlayState()!==t$.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,r),n&&(!ei(a,t.VFXItem)||a.ended||(a.ended=!0,a.onEnd(),a.compositionReusable||a.reusable||(a.dispose(),this.playable.dispose())),this.playable.getPlayState()===t$.Playing&&this.playable.pause());var s=i.toLocalTime(e);this.playable.setTime(s)},eU(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}();t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return eG(i,e),i.prototype.create=function(e){var i=this.binding;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(t.TrackAsset,this,"ParticleTrack");r.binding=this.binding;var n=r.createClip(oX);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}},i}(t.TrackAsset),t.ObjectBindingTrack=en([e5("ObjectBindingTrack")],t.ObjectBindingTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(t.TrackAsset),t.TransformTrack=en([e5("TransformTrack")],t.TransformTrack);var o7=function(e){function i(){return e.apply(this,arguments)}eG(i,e);var r=i.prototype;return r.processFrame=function(e){var i=e.output.getUserData();if(ei(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=ej(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(t){for(var e,i=ej(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled||(r.enabled=!0)}},i}(nz);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createTrackMixer=function(t){return new o7(t)},e}(t.TrackAsset),t.ActivationTrack=en([e5("ActivationTrack")],t.ActivationTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(t.TrackAsset),t.SpriteColorTrack=en([e5("SpriteColorTrack")],t.SpriteColorTrack),t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t}eG(i,e);var r=i.prototype;return r.createPlayable=function(e){var i=new at(e);i.setTraversalMode(t0.Passthrough);for(var r,n=ej(this.tracks);!(r=n()).done;){var o=r.value;ei(o,t.ObjectBindingTrack)&&o.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}(nU),en([e8(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=en([e5("TimelineAsset")],t.TimelineAsset);var at=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e}eG(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=ej(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){this.sortTracks(e);for(var i,r=[],n=ej(e);!(i=n()).done;){var o=i.value;r.push(o),this.addSubTracksRecursive(o,r)}for(var a,s=ej(r);!(a=s()).done;){var u=a.value,c=u.createPlayableGraph(t,this.clips);this.addInput(c,0);var h=u.createOutput();h.setUserData(u.binding),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 ae(t[i],i));e.sort(ar),t.length=0;for(var r,n=ej(e);!(r=n()).done;){var o=r.value;t.push(o.track)}},i.addSubTracksRecursive=function(t,e){for(var i,r=ej(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var o,a=ej(t.getChildTracks());!(o=a()).done;){var s=o.value;this.addSubTracksRecursive(s,e)}},e}(nz),ae=function(t,e){this.track=t,this.originalIndex=e};function ai(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1}function ar(e,i){var r=e.track.binding,n=i.track.binding;return ei(r,t.VFXItem)&&ei(n,t.VFXItem)?ai(r,n)?-1:ai(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}var an=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 nD,t}eG(i,e);var r=i.prototype;return r.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tO.destroy&&this.setReusable(!0)},r.setReusable=function(e){for(var r,n=ej(this.timelineAsset.tracks);!(r=n()).done;){var o=r.value,a=o.binding;if(ei(a,t.VFXItem)){ei(o,t.ObjectBindingTrack)&&(a.reusable=e);var s=a.getComponent(i);s&&s.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.update=function(t){var e=this.time;this.item.isEnded(this.time)&&!this.item.parent&&(this.item.ended=!0),this.timelinePlayable.setTime(e),this.graph.evaluate(t)},r.createContent=function(){for(var e,r=[],n=ej(this.data.sceneBindings);!(e=n()).done;){var o=e.value;r.push({key:this.engine.assetLoader.loadGUID(o.key.id),value:this.engine.assetLoader.loadGUID(o.value.id)})}this.sceneBindings=r;var a=this.data.timelineAsset?this.engine.assetLoader.loadGUID(this.data.timelineAsset.id):new t.TimelineAsset(this.engine);this.timelineAsset=a;var s=this.items;if(this.items.length=0,this.item.composition)for(var u=this.item.engine.assetLoader,c=this.item.props.items?this.item.props.items:[],h=0;h<c.length;h++){var l=void 0,f=c[h];if(t.Item.isComposition(f)){var d=f.content.options.refId,p=this.item.composition.refCompositionProps.get(d);if(!p)throw Error("Referenced precomposition with Id: "+d+" does not exist.");p.content=f.content,(l=u.loadGUID(f.id)).composition=this.item.composition;var m=l.addComponent(i);m.data=p,m.refId=d,l.transform.parentTransform=this.transform,this.item.composition.refContent.push(l),l.endBehavior===tO.restart&&(this.item.composition.autoRefTex=!1),m.createContent();for(var v,y=ej(m.items);!(v=y()).done;){var g=v.value;g.setInstanceId(eN());for(var x,T=ej(g.components);!(x=T()).done;)x.value.setInstanceId(eN())}}else(l=u.loadGUID(f.id)).composition=this.item.composition;l.parent=this.item,l.transform.parentTransform=f.type===tx.camera?new nQ:this.transform,t.VFXItem.isExtraCamera(l)&&(this.item.composition.extraCamera=l),s.push(l)}},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,o,a){for(var s,u=[],c=(null==a?void 0:a.stop)||eO,h=(null==a?void 0:a.skip)||eO,l=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(a){var l=s.items[a];if(l.getVisible()&&!l.ended&&!t.VFXItem.isComposition(l)&&!h(l)){var f=l.getHitTestParams(o);if(f){var d=!1,p=new eK;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,T=f.size,b=x.clone().addScaledVector(T,.5),E=x.clone().addScaledVector(T,-.5);e.intersectBox({min:b,max:E},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new eQ(i,r));S&&S.length>0&&(S.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(n.push(A),c(A))return{v:n}}}}}(f));if("object"===er(d))return d.v}return n},r.fromData=function(t){},r.resolveBindings=function(){for(var t,e=ej(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.binding=i.value}for(var r,n=ej(this.timelineAsset.tracks);!(r=n()).done;){var o=r.value;this.resolveTrackBindingsWithRoot(o)}},r.resolveTrackBindingsWithRoot=function(t){for(var e,i=ej(t.getChildTracks());!(e=i()).done;){var r=e.value;r.binding=r.resolveBinding(t.binding),this.resolveTrackBindingsWithRoot(r)}},i}(ie);t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}return eG(i,e),i.prototype.resolveBinding=function(e){if(!ei(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(an)},i}(t.TrackAsset),t.SubCompositionTrack=en([e5("SubCompositionTrack")],t.SubCompositionTrack);var ao=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();ei(e,an)&&(e.time=this.getTime())},e}(nz);function aa(t,e){return e&&("object"===er(e)||"function"==typeof e)?e:oJ(t)}t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.createPlayable=function(t){return new ao(t)},e}(nU),t.SubCompositionPlayableAsset=en([e5("SubCompositionPlayableAsset")],t.SubCompositionPlayableAsset);var as=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tz.display:r,o=t.textBaseline,a=void 0===o?tk.top:o,s=t.textAlign,u=void 0===s?tU.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=a,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,o=t.fontScale,a=(i-r)/3,s=r+n*o,u=i*(e-1),c=0;switch(this.textBaseline){case tk.top:c=s+a;break;case tk.middle:c=(this.height*o-u+s)/2;break;case tk.bottom:c=this.height*o-u-a}return c},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tU.left:i=t.outlineWidth*t.fontScale;break;case tU.middle:i=(this.width*t.fontScale-e)/2;break;case tU.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),au=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,o,a,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!=(o=h.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=h.shadowOffsetY)?a:0),this.fontStyle!==tG.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},ac=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)return this.elements.shift();if(nY[nW])return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?eh(this.elements,t):t.remove()},t}()),ah=["serif","sans-serif","monospace","courier"];t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.lineCount=0,r.canvas=ac.getCanvas(),ac.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return aa(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}eG(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.SpriteComponent),t.TextComponent=en([e5(tX.TextComponent)],t.TextComponent);var al=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new au(t),this.textLayout=new as(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,o=this.textLayout.width+this.textStyle.fontOffset,a=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>o&&u>0||"\n"===l)&&(a++,s=0),"\n"!==l&&(s+=f)}return a},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(this.textStyle.fontFamily===t&&!eS(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.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,o=(r.width+i.fontOffset)*n,a=r.height*n,s=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=o,this.canvas.height=a,e.clearRect(0,0,o,this.canvas.height),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,a),e.scale(1,-1)),e.fillRect(0,0,o,this.canvas.height),i.fontDesc=this.getFontDesc(),e.font=i.fontDesc,i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var c=[],h=0,l=r.getOffsetY(i,this.lineCount,u,s),f=[],d=[],p=0;p<this.char.length;p++){var m=this.char[p],v=e.measureText(m);((h+=r.letterSpace*n)+v.width>o&&p>0||"\n"===m)&&(c.push({y:l,width:h,chars:f,charOffsetX:d}),h=0,l+=u,f=[],d=[]),"\n"!==m&&(f.push(m),d.push(h),h+=v.width)}c.push({y:l,width:h,chars:f,charOffsetX:d}),c.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,o){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[o],t.y),e.fillText(r,n+t.charOffsetX[o],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var y=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",iK.createWithData(this.engine,{data:new Uint8Array(y.data),width:y.width,height:y.height},{flipY:t,magFilter:iC.LINEAR,minFilter:iC.LINEAR,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.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,o=t.fontStyle,a=""+(e*i).toString()+"px ";return ah.includes(r)?a+=r:a+='"'+r+'"',n!==tB.normal&&(a=n+" "+a),o!==tG.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],o=i[1],a=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*o+", "+255*a+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,o=e.shadowOffsetY,a=i[0],s=i[1],u=i[2],c=i[3];t&&(t.shadowColor="rgba("+255*a+", "+255*s+", "+255*u+", "+c+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-o)},t}();ez(t.TextComponent,[al]);var af=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(ir),ad=1;t.EffectComponent=function(e){function i(t){var i;return(i=e.call(this,t)||this).worldMatrix=e$.fromIdentity(),i.triangles=[],i.destroyed=!1,i.visible=!1,i.getHitTestParams=function(t){var e=i.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},i.id="Mesh"+ad++,i.name="<unnamed>",i._priority=0,i}eG(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},r.getVisible=function(){return this.visible},r.firstGeometry=function(){return this.geometry},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=t.getIndexData(),i=t.getAttributeData("aPos"),r=[],n=0;n<e.length;n+=3){var o=3*e[n],a=3*e[n+1],s=3*e[n+2],u={x:i[o],y:i[o+1],z:i[o+2]},c={x:i[a],y:i[a+1],z:i[a+2]},h={x:i[s],y:i[s+1],z:i[s+2]};r.push({p0:u,p1:c,p2:h})}return r}(this.geometry),this.hitTestGeometry=this.geometry);for(var i,r=[],n=ej(this.triangles);!(i=n()).done;){var o=i.value;r.push({p0:o.p0,p1:o.p1,p2:o.p2})}return r.forEach(function(t){t.p0=e.transformPoint(t.p0,new eK),t.p1=e.transformPoint(t.p1,new eK),t.p2=e.transformPoint(t.p2,new eK)}),{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))},eU(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ii),en([e8(void 0,void 0)],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=en([e5(tX.EffectComponent)],t.EffectComponent),t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new nQ,r.duration=0,r.start=0,r.ended=!1,r.reusable=!1,r.type=tx.base,r.components=[],r.itemBehaviours=[],r.rendererComponents=[],r.visible=!0,r.speed=1,r.listIndex=0,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}eG(i,e);var r=i.prototype;return 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.item=this,e.onAttached(),e},r.getComponent=function(t){for(var e,i,r=ej(this.components);!(i=r()).done;){var n=i.value;if(ei(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=ej(this.components);!(e=r()).done;){var n=e.value;ei(n,t)&&i.push(n)}return i},r.setParent=function(t){t!==this&&(this.parent&&el(this.parent.children,this),this.parent=t,t&&(i.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},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)},r.getWorldTransform=function(t){var e=null!=t?t:new nQ({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 e0(t,e,i),n=eJ.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,o=r.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/s)*o,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 eK;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;for(var e,i=ej(this.children);!(e=i()).done;){var r=e.value;if(r.name===t)return r}for(var n,o=ej(this.children);!(n=o()).done;){var a=n.value.find(t);if(a)return a}},r.fromData=function(t){e.prototype.fromData.call(this,t);var i=t.id,r=t.name,n=t.delay,o=t.parentId,a=t.endBehavior,s=t.transform,u=t.listIndex,c=t.duration,h=void 0===c?0:c;if(this.props=t,this.type=t.type,this.id=i.toString(),this.name=r,this.start=n||this.start,s&&(s.position=new eK().copyFrom(s.position),s.quat?s.quat=new eJ(s.quat.x,s.quat.y,s.quat.z,s.quat.w):s.rotation=new e0().copyFrom(null!=(l=s.eulerHint)?l:s.rotation),s.scale=new eK().copyFrom(s.scale),s.size&&(s.size=new eQ().copyFrom(s.size)),s.anchor&&(s.anchor=new eQ().copyFrom(s.anchor)),this.transform.setTransform(s)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=h,this.endBehavior=a,this.oldId=t.oldId,t.content||(t.content={options:{}}),h<=0)throw Error("Item duration can't be less than 0, see "+iE["Item duration can't be less than 0"]+".");for(var l,f,d=ej(this.components);!(f=d()).done;){var p=f.value;p.item=this,p.onAttached()}this.renderOrder=void 0===u?0:u},r.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=tX.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=ej(this.components);!(r=n()).done;){var o=r.value;ei(o,t.EffectComponent)&&this.taggedProperties.components.push(o)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.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=ej(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=ej(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&el(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tx.composition},i.isSprite=function(t){return t.type===tx.sprite},i.isParticle=function(t){return t.type===tx.particle},i.isNull=function(t){return t.type===tx.null},i.isTree=function(t){return t.type===tx.tree},i.isCamera=function(t){return t.type===tx.camera},i.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},eU(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=ej(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}}]),i}(e9),en([e8(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=en([e5(tX.VFXItemData)],t.VFXItem),t.Item=void 0,(ta=t.Item||(t.Item={})).is=function(t,e){return t.type===e},ta.isComposition=function(t){return t.type===tx.composition},ta.isParticle=function(t){return t.type===tx.particle},ta.isNull=function(t){return t.type===tx.null};var ap={},am=[],av={};function ay(t,e,i,r){av[t]=i,ap[t]=e,r&&eh(am,t)}var ag=function(){function e(t){var e={},i=[],r=function(t){var r=ap[t];i.includes(r)||(i.push(r),e[t]=r)};am.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=ap[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=ax[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 i=e.prototype;return i.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},i.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},i.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},i.createPluginItem=function(e,i,r){var n=av[e];if(!n)throw Error("The plugin '"+e+"' does not have a registered constructor.");var o=new n(r.getEngine(),i,r);if(o.composition=r,!ei(o,t.VFXItem))throw Error("The plugin '"+e+"' invalid constructor type.");return o},i.processRawJSON=function(t,e){var i=this;return ee(function(){return eo(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},i.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 ee(function(){var e,r,o,a,s,u;return eo(this,function(c){for(o=0,e=[],r=n.plugins;o<r.length;o++)t in(a=ap[r[o].name])&&e.push(Promise.resolve(null==(u=a[t])?void 0:(s=u).call.apply(s,[].concat([a],i))));return[2,Promise.all(e)]})})()},i.precompile=function(t,e,i){var r=this;return ee(function(){return eo(this,function(n){return[2,r.callStatic("precompile",t,e,i)]})})()},i.loadResources=function(t,e){var i=this;return ee(function(){return eo(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e}(),ax={"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"},aT=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=e6(e);if(r)for(var n,o=ej(Object.keys(r));!(n=o()).done;){var a=n.value,s=e.taggedProperties[a];if(void 0===s&&(s=e[a]),e9.is(s))t.collectSerializableObject(s,i);else if(eI(s))for(var u,c=ej(s);!(u=c()).done;){var h=u.value;e9.is(h)&&t.collectSerializableObject(h,i)}else if(eL(s))for(var l,f=ej(Object.keys(s));!(l=f()).done;){var d=s[l.value];e9.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 o,a=ej(Object.keys(i));!(o=a()).done;){var s=i[o.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serializeTaggedProperties(s,n[s.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,i){e.toData(),i||(i={});var r=e6(e);if(r)for(var n,o=ej(Object.keys(r));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[a]=s:eI(s)?(i[a]||(i[a]=[]),t.serializeArrayProperty(s,i[a],0)):e9.is(s)?i[a]={id:s.getInstanceId()}:eL(s)&&(i[a]||(i[a]={}),t.serializeObjectProperty(s,i[a],0))}for(var u,c=ej(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:eI(l)?(i[h]||(i[h]=[]),t.serializeArrayProperty(l,i[h],0)):e9.is(l)?i[h]={id:l.getInstanceId()}:eL(l)&&(i[h]||(i[h]={}),t.serializeObjectProperty(l,i[h],0))}return i},t.deserializeTaggedProperties=function(e,i){for(var r,n=i.taggedProperties,o=e6(i),a=i.engine,s=ej(Object.keys(e));!(r=s()).done;){var u=r.value;if(!o||!o[u]){var c=e[u];n[u]=t.deserializeProperty(c,a,0)}}if(o)for(var h,l=ej(Object.keys(o));!(h=l()).done;){var f=h.value,d=e[f];if(void 0!==d){var p=o[f].type;i[f]=t.deserializeProperty(d,a,0,p)}}i.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,i){return ee(function(){var r,n,o,a,s,u,c,h,l,f,d,p;return eo(this,function(m){switch(m.label){case 0:r=i.taggedProperties,n=e6(i),o=i.engine,a=ej(Object.keys(e)),m.label=1;case 1:if((s=a()).done)return[3,4];if(u=s.value,n&&n[u])return[3,3];return c=e[u],[4,t.deserializePropertyAsync(c,o,0)];case 2:r[u]=m.sent(),m.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];h=ej(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,o,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 ei(t,Int8Array)||ei(t,Uint8Array)||ei(t,Uint8ClampedArray)||ei(t,Int16Array)||ei(t,Uint16Array)||ei(t,Int32Array)||ei(t,Uint32Array)||ei(t,Float32Array)||ei(t,Float64Array)||ei(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eL(t)&&1===Object.keys(t).length&&"id"in t&&eR(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eL(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eP(t)||ei(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(eI(e)){for(var o,a=[],s=ej(e);!(o=s()).done;){var u=o.value;a.push(t.deserializeProperty(u,i,r+1,n))}return a}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!eL(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,h,l=ej(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 ee(function(){var o,a,s,u,c,h,l,f,d;return eo(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(!eI(e))return[3,5];o=[],a=ej(e),p.label=1;case 1:if((s=a()).done)return[3,4];return u=s.value,c=o.push,[4,t.deserializePropertyAsync(u,i,r+1,n)];case 2:c.apply(o,[p.sent()]),p.label=3;case 3:return[3,1];case 4:return[2,o];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(!eL(e)||e.constructor!==Object)return[2,e];for(h=n?new n:{},l=ej(Object.keys(e));!(f=l()).done;)h[d=f.value]=t.deserializeProperty(e[d],i,r+1);return[2,h];case 8: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,o=ej(Object.keys(e));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[a]=s:eI(s)?(i[a]||(i[a]=[]),t.serializeArrayProperty(s,i[a],r+1)):e9.is(s)?i[a]={id:s.getInstanceId()}:eL(s)&&(i[a]||(i[a]={}),t.serializeObjectProperty(s,i[a],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[n]=o:eI(o)?(i[n]||(i[n]=[]),t.serializeArrayProperty(o,i[n],r+1)):e9.is(o)?i[n]={id:o.getInstanceId()}:eL(o)&&(i[n]||(i[n]={}),t.serializeObjectProperty(o,i[n],r+1))}},t}(),ab=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 tX.Material:i=i9.create(this.engine);break;case tX.Geometry:i=r1.create(this.engine);break;case tX.Texture:i=iK.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),aT.deserializeTaggedProperties(r,i),i},e.loadGUIDAsync=function(e){var i=this;return ee(function(){var r,n,o;return eo(this,function(a){switch(a.label){case 0:if(i.engine.objectInstance[e])return[2,i.engine.objectInstance[e]];if(n=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(!(r=a.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return i.engine.addInstance(r),[2,r];case 2:switch(n.dataType){case tX.Material:r=i9.create(i.engine);break;case tX.Geometry:r=r1.create(i.engine);break;case tX.Texture:r=iK.create(i.engine);break;default:(o=t.getClass(n.dataType))&&(r=new o(i.engine))}if(!r)return console.error("Constructor for DataType: "+n.dataType+" not found."),[2,void 0];return r.setInstanceId(n.id),i.engine.addInstance(r),[4,aT.deserializeTaggedPropertiesAsync(n,r)];case 3:return a.sent(),[2,r]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e4[t]},t}(),aE=function(){function t(){}return t.prototype.loadGUID=function(t){return ee(function(){return eo(this,function(t){return[2,void 0]})})()},t}();function a_(t,e){if(!t.includes(e))return t.push(e),!0}function aC(t){if(Number.isFinite(t))return[tA.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tA.CONSTANT)return[tA.CONSTANT,t[1]];if("lines"===e)return[tA.LINE,t[1]];if(e===tA.LINE){var r=i.map(function(t){return[tw.LINE,t]});return[tA.BEZIER_CURVE,r]}return"curve"===e||e===tA.CURVE?[tA.BEZIER_CURVE,aB(i)]:t}}function aS(t,e){return Array.isArray(t)&&"random"===t[0]?[tA.CONSTANT,t[1][e]]:aC(t)}function aA(t){return t&&"color"===t[0]?aR(t[1],!0):[1,1,1,1]}function aw(t){return t&&"random"===t[0]?[tA.RANDOM,t[1]]:aC(t)}function aO(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,o=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,a=aR(t[r],e);i.push([o,a[0],a[1],a[2],a[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tA.GRADIENT_COLOR,i]}}function aR(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 ei(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=aI(i)),i}function aI(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function aM(t,e){return Array.isArray(t)?t[0]===tA.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&aO(t[1],e):aO(t,e)}function aL(t){if(t){if(3===t.length)return[tA.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tA.BEZIER_PATH||e===tA.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],o=i[2],a=aB(r);if(!o){o=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&o.push(u),o.push(u)}}return[tA.BEZIER_CURVE_PATH,[a,n,o]]}return t}}function aP(t){for(var e,i=ej(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function aV(t){for(var e,i=ej(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var aF=Math.cos,aN=Math.sin,aD=Math.PI/180,az=180/Math.PI;function ak(t,e){return t?[t[0]-.5,.5-t[1]]:e?aU[e]:[0,0]}var aU=((t2={})[tb.PARTICLE_ORIGIN_CENTER]=[0,0],t2[tb.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t2[tb.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t2[tb.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t2[tb.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t2[tb.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t2[tb.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t2[tb.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t2[tb.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t2);function aB(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]]],o=0;o<t.length-1;o++){var a=t[o][3]*(e-i),s=t[o+1][2]*(e-i),u=[t[o][0],t[o][1]],c=[t[o+1][0],t[o+1][1]];if(u[0]!=c[0]){var h=function(t,e,i,r){var n=i[0],o=i[1],a=r[0],s=r[1],u=a-n;return[[n+(a-n)/3,o+(t*=u)/3],[a-(a-n)/3,s-(e*=u)/3]]}(a,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?[tw.EASE_OUT,t]:e===n.length-1?[tw.EASE_IN,t]:[tw.EASE,t]})}function aG(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},o={path:aL(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:aC(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:aC(n.linearX),linearY:aC(n.linearY),linearZ:aC(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:aC(n.orbitalX),orbitalY:aC(n.orbitalY),orbitalZ:aC(n.orbitalZ),speedOverLifetime:aC(n.speedOverLifetime)};aV(o);var a={options:{startColor:aA(r.startColor)},positionOverLifetime:o};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=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=aC(s.x),u.y=aC(s.y),u.z=aC(s.z)):u.z=aC(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var h=a.colorOverLifetime={opacity:aC(c.opacity)};c.color&&(h.color=aM(c.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:aC(l.size),x:aC(l.x),y:aC(l.y),z:aC(l.z)}),a}function aX(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tx.null&&t.endBehavior===tO.destroy&&(t.endBehavior=tO.freeze)})}),t.version="2.1",t}function aj(t){for(var e,i=iP({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=ej(i.images);!(e=r()).done;)e.value.id=eN();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){t.id=eN(),t.dataType=tX.Texture,t.source={id:i.images[t.source].id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:eN(),dataType:tX.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(o=t.bins,i.bins=o.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eN()}}));for(var o,a,s={},u={},c=ej(t.compositions);!(a=c()).done;)!function(){var t=a.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=4),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tx.particle&&t.content.filter&&delete t.content.filter});for(var e,r=ej(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eN(),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],o=e.parentId.split("^")[1];e.parentId=s[n]+"^"+o}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var o=iP({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(o),function(t,e,i){for(var r,n=[],o=[],a=[],s={tracks:[],id:eN(),dataType:"TimelineAsset"},u=ej(t.items);!(r=u()).done;){var c=e[r.value.id],h=[],l={id:eN(),dataType:"ActivationPlayableAsset"};a.push(l);var f={id:eN(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:l.id}}]};if(h.push({id:f.id}),o.push(f),c.type!==tx.particle){var d={id:eN(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(d);var p={id:eN(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};h.push({id:p.id}),o.push(p)}if(c.type===tx.sprite){var m={id:eN(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime,startColor:c.content.options.startColor};a.push(m);var v={id:eN(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:m.id}}]};h.push({id:v.id}),o.push(v)}if(c.type===tx.composition){var y={id:eN(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:eN(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:y.id}}]};h.push({id:g.id}),o.push(g)}var x={id:eN(),dataType:"ObjectBindingTrack",children:h,clips:[]};o.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:c.id}})}for(var T,b=[],E=ej(o);!(T=E()).done;){var _=T.value;b.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,S=ej(o);!(C=S()).done;){var A=C.value;i.miscs.push(A)}for(var w,O=ej(a);!(w=O()).done;){var R=w.value;i.miscs.push(R)}}(o,u,i)}();for(var h,l=ej(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!=(T=f.transform.scale)?T:[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===tx.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tx.sprite){var g,x,T,b,E,_,C,S=f.content;S.renderer||(S.renderer={});var A=S.renderer,w=ak(A.anchor,A.particleOrigin),O=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(b=null==O?void 0:O.x)?b: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!=(C=null==O?void 0:O.y)?C:1)}}}if(f.type===tx.particle){var R=f.content;R.renderer||(R.renderer={});var I=R.renderer;R.renderer.anchor=ak(I.anchor,I.particleOrigin)}f.type===tx.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),f.content.tracks=[];var M=f.content.tracks;if(f.type!==tx.particle&&M.push({clips:[{id:eN(),dataType:"TransformPlayableAsset",sizeOverLifetime:f.content.sizeOverLifetime,rotationOverLifetime:f.content.rotationOverLifetime,positionOverLifetime:f.content.positionOverLifetime}]}),f.type===tx.sprite&&M.push({clips:[{id:eN(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:f.content.colorOverLifetime,startColor:f.content.options.startColor}]}),void 0!==f.pn){var L=f.pn,P=t.plugins,V=void 0===P?[]:P;void 0!==L&&Number.isInteger(L)&&(f.pluginName=V[L])}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===tx.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===tx.sprite||f.type===tx.particle||f.type===tx.mesh||f.type===tx.skybox||f.type===tx.light||"camera"===f.type||f.type===tx.tree||f.type===tx.interact||f.type===tx.camera||f.type===tx.text||f.type===tx.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eN(),f.content.item={id:f.id},f.dataType=tX.VFXItemData,f.components.push({id:f.content.id})),(f.type===tx.null||f.type===tx.composition)&&(f.components=[],f.dataType=tX.VFXItemData),f.type){case tx.sprite:f.content.dataType=tX.SpriteComponent;break;case tx.particle:f.content.dataType=tX.ParticleSystem;break;case tx.mesh:f.content.dataType=tX.MeshComponent;break;case tx.skybox:f.content.dataType=tX.SkyboxComponent;break;case tx.light:f.content.dataType=tX.LightComponent;break;case"camera":f.content.dataType=tX.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tx.tree:f.content.dataType=tX.TreeComponent;break;case tx.interact:f.content.dataType=tX.InteractComponent;break;case tx.camera:f.content.dataType=tX.CameraController;break;case tx.text:f.content.dataType=tX.TextComponent;break;case tx.spine:f.content.dataType="SpineComponent"}}return i.version="3.0",i}var aH=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,aW=/^(\d+)\.(\d+)$/,aY=!1;function aZ(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===tx.mesh||t.type===tx.light)&&(t.endBehavior=1===t.endBehavior?tO.destroy:t.endBehavior)})}),aH.test(t.version)){var e,i,r,n,o,a,s,u;return aY=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",aj(aX((aq="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(aq="1.3"),o=(e.requires||[]).slice(),a=e.images.map(function(t,i){return aQ(t,i,e.imageTags||[])}),s=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:aq,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return aK(t,{plugins:n,requires:o})}),images:a,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)))}var c,h,l,f,d,p=aW.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=ej(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=ej(Object.keys(e));!(i=r()).done;){var n=i.value,o=e[n],a=Array.isArray(o);a&&2===o.length&&Array.isArray(o[1])?"path"===n?e[n]=aL(o):e[n]=aC(o):a||"object"!=typeof o||t(o)}})(e.value.content)}),t=d),m<3?aj(aX(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var aq="1.0";function aQ(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eN(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eN(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eN(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eN(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function aK(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 a$(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var o=null==(i=t.meta)?void 0:i.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(r.previewSize=o),r}var aJ=[0,0,0,1];function a$(t,e){void 0===e&&(e={});var i=tx.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tx.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||T(l.transform)):t.particle?(i=tx.particle,h=T((l=t.particle).transform,aY,!0),f=function(t){var e=t.options,i=t.transform,r={type:tm.NONE};if(t.shape){var n,o=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iP({},t.shape,{type:tm[o]}),t.shape.upDirection){var a=t.shape.upDirection,s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=aw(e.turbulenceX),r.turbulenceY=aw(e.turbulenceY),r.turbulenceZ=aw(e.turbulenceZ));var h=t.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(t){return aP(t)})),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(t){return aP(t)})),h.rateOverTime&&(h.rateOverTime=aw(h.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:h,options:{startLifetime:aw(e.startLifetime),start3DSize:!!e.start3DSize,startSize:aw(e.startSize),startSizeX:aw(e.startSizeX),startSizeY:aw(e.startSizeY),sizeAspect:aw(e.sizeAspect),maxCount:e.maxCount,startDelay:aw(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tA.COLORS,t[1].map(function(t){return aR(t,e)})]:"gradient"===t[0]?aO(t[1],e):"color"===t[0]?[tA.RGBA_COLOR,aR(t[1],e)]:t}(e.startColor,!0),startRotationZ:aw(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=aw(e.startRotationX),l.options.startRotationY=aw(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:aL(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:aw(f.x),y:aw(f.y)}:l.sizeOverLifetime={size:aw(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?aC(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:aC(e.gravityModifier),startSpeed:aw(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:aw(d.linearX),linearY:aw(d.linearY),linearZ:aw(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:aw(d.orbitalX),orbitalY:aw(d.orbitalY),orbitalZ:aw(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:aC(d.forceCurve)},aV(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:aw(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=aC(m.y),l.rotationOverLifetime.x=aC(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:aC(v.opacity)};v.color&&(y.color=aM(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:aC(g.cycles),animationDelay:aS(g.animationDelay,0),animationDuration:aS(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:aw(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:aC(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&aM(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&aM(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:aw(x.opacityOverLifetime)}),l.trails&&aV(l.trails);var T=t.interaction;return T&&(l.interaction={behavior:T.behavior,radius:T.radius,multiple:T.multiple}),l}(l)):t.sprite?(i=tx.sprite,h=T((l=t.sprite).transform,!1,!0),s=aG(a=l,h),(u=a.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=a.renderer,a.splits&&(s.splits=a.splits),a.interaction&&(s.interaction=a.interaction),f=s):t.cal?(i=tx.null,h=T((l=t.cal).transform,!1,!0),f=aG(l,h)):t.ui?(i=tx.interact,h=T((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:ty.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&aA(i.previewColor),behavior:i.behavior||tg.NOTIFY};break;case"drag":e={type:ty.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:ty.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=tx.camera,h=T(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,o,a={path:aL(null==(o=t.transform)?void 0:o.path),linearX:aC(null==r?void 0:r.translateX),linearY:aC(null==r?void 0:r.translateY),linearZ:aC(null==r?void 0:r.translateZ)};aV(a),i.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:aC(null==s?void 0:s.rotateX),y:aC(null==s?void 0:s.rotateY),z:s.separateAxes?aC(null==s?void 0:s.rotateZ):aC(s.rotation)};aV(u),i.rotationOverLifetime=u}return i}(l))),null==(c=f.renderer)?void 0:c.anchor){var o=new Float32Array(f.renderer.anchor);.5==o[0]&&.5==o[1]?delete f.renderer.anchor:e.requires&&a_(e.requires,"anchor")}if(l){var a,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]?tO.restart:tO.destroy:tO.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tO.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?(a_(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 T(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 o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w,O,R=(o=r.rotation[0],a=r.rotation[1],s=r.rotation[2],u=aF(o*aD/2),c=aF(a*aD/2),h=aF(s*aD/2),l=aN(o*aD/2),f=aN(a*aD/2),d=aN(s*aD/2),aJ[0]=l*c*h+u*f*d,aJ[1]=u*f*h-l*c*d,aJ[2]=u*c*d+l*f*h,aJ[3]=u*c*h-l*f*d,aJ);r.rotation=(p=[],m=R[0],v=R[1],y=R[2],g=R[3],x=m+m,T=v+v,b=y+y,E=m*x,_=v*x,C=v*T,S=y*b,A=g*b,w=y*x-g*T,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*az,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*T+g*x,1-E-C)*az,p[2]=Math.atan2(_+A,1-C-S)*az):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-S)*az),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 a0=((t3={})[tl.S]=[tl.S,tl.BPlus,tl.APlus],t3[tl.A]=[tl.A,tl.BPlus,tl.APlus],t3[tl.B]=[tl.B,tl.BPlus],t3);function a1(t,e){if(!t||!e)return!0;var i=a0[e];return!!i&&i.includes(t)}function a2(t){return eL(t)&&"jsonScene"in t}function a3(t){return eL(t)&&"url"in t}function a4(t){return eL(t)&&"options"in t}function a5(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},o=n.name,a=n.url;return o&&(e&&e[o]?i=e[o]:a&&(i=a)),i}function a6(t,e,i){return a8.apply(this,arguments)}function a8(){return(a8=ee(function(t,e,i){var r,n,o,a;return eo(this,function(s){switch(s.label){case 0:if("string"!=typeof t)return[3,2];return[4,iz(t)];case 1:return r=s.sent(),[3,3];case 2:r=t,s.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=r,!((o=a5(e,i))&&eR(o)&&o!==r.src))return[3,7];if(!eR(o))return[3,5];return[4,iz(o)];case 4:return a=s.sent(),[3,6];case 5:a=o,s.label=6;case 6:n=a,s.label=7;case 7:return[2,n]}})})).apply(this,arguments)}var a9=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e}(e9),a7=1,st=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iV),this.options=t,this.downloader=e,this.assets={},this.id=a7++,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.updateSceneData=function(t){var e=this.options.variables;e&&0!==Object.keys(e).length&&t.forEach(function(t){if(t.type===tx.text){var i=e[t.name];i&&(t.content.options.text=i)}})},i.loadScene=function(e,i,r){var n=this;return ee(function(){var o,a,s,u,c,h,l,f,d,p,m,v,y,g,x;return eo(this,function(T){return s=eR(e)?e:n.id,u=performance.now(),c=[],f=null!=(l=null==(h=null==i?void 0:i.engine.gpuCapability)?void 0:null==(o=h.detail)?void 0:o.asyncShaderCompile)&&l,p=null!=(d=null==h?void 0:h.detail.compressedTexture)?d:t.COMPRESSED_TEXTURE.NONE,m={},y=!1,g=new Promise(function(t,e){v=window.setTimeout(function(){y=!0,n.removeTimer(v),e(Error("Load time out: totalTime: "+(performance.now()-u).toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."))},1e3*n.timeout),n.timers.push(v)}),x=ee(function(t,e){var i,r,n;return eo(this,function(o){switch(o.label){case 0:if(y)return[3,4];i=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return r=o.sent(),n=performance.now()-i,c.push("["+t+": "+n.toFixed(2)+"]"),m[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+o.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([g,ee(function(){var t,o,h,l,d,y,g,T,b,E,_,C,S,A,w,O,R,I,M,L,P;return eo(this,function(V){switch(V.label){case 0:if(!eL(e))return[3,1];return a=e,n.baseUrl=location.href,[3,3];case 1:return e=new URL(e,location.href).href,n.baseUrl=e,[4,x("loadJSON",function(){return n.loadJSON(e)})];case 2:a=V.sent(),V.label=3;case 3:if(!a2(a))return[3,6];if(t=iP({},a),!(n.options&&n.options.variables&&0!==Object.keys(n.options.variables).length))return[3,5];for(l=0,o=a.jsonScene.images,h=t.images;l<o.length;l++)ei(h[l],HTMLCanvasElement)&&(h[l]=o[l]);return[4,x("processImages",function(){return n.processImages(h,p)})];case 4:for(d=0,t.images=V.sent();d<t.images.length;d++)t.textureOptions[d].image=t.images[d];n.updateSceneData(t.jsonScene.items),V.label=5;case 5:return[3,12];case 6:return[4,x("processJSON",function(){return n.processJSON(a)})];case 7:return g=(y=V.sent()).usedImages,T=y.jsonScene,b=y.pluginSystem,_=void 0===(E=T.bins)?[]:E,C=T.images,S=T.compositions,A=T.fonts,[4,Promise.all([x("processBins",function(){return n.processBins(_)}),x("processImages",function(){return n.processImages(C,p)}),x((f?"async":"sync")+"Compile",function(){return n.precompile(S,b,i,r)})])];case 8:if(O=(w=V.sent())[0],R=w[1],i)for(I=0;I<C.length;I++)(M=new a9(i.engine)).data=R[I],M.setInstanceId(C[I].id),i.engine.addInstance(M);return[4,x("processFontURL",function(){return n.processFontURL(A)})];case 9:return V.sent(),[4,x("processTextures",function(){return n.processTextures(R,O,T,i.engine)})];case 10:return L=V.sent(),n.updateSceneData(T.items),t={timeInfos:m,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:b,jsonScene:T,usedImages:g,images:R,textureOptions:L,bins:O},[4,x("processPlugins",function(){return b.loadResources(t,n.options)})];case 11:V.sent(),V.label=12;case 12:return P=performance.now()-u,ew.info("Load asset: totalTime: "+P.toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."),window.clearTimeout(v),n.removeTimer(v),t.totalTime=P,t.startTime=u,t.timeInfos=m,[2,t]}})})()])]})})()},i.precompile=function(t,e,i,r){return ee(function(){var n;return eo(this,function(o){switch(o.label){case 0:if(!i||!i.getShaderLibrary())return[2];return n=null==i?void 0:i.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,i,r)];case 1:return o.sent(),[4,new Promise(function(t){null==n||n.compileAllShaders(function(){t(null)})})];case 2:return o.sent(),[2]}})})()},i.processJSON=function(t){var e=this;return ee(function(){var i,r,n,o,a,s,u,c,h;return eo(this,function(l){switch(l.label){case 0:return i=aZ(t),t.compositions.forEach(function(t,e){t.globalVolume&&(i.compositions[e].globalVolume=t.globalVolume)}),n=void 0===(r=i.plugins)?[]:r,o=i.compositions,a=i.imgUsage,s=i.images,[4,(u=new ag(n)).processRawJSON(i,e.options)];case 1:return l.sent(),c=e.options.renderLevel,h={},a?function(t,e,i,r,n){for(var o=0;o<e.length;o++){var a=i[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];a1(r[u].renderLevel,n)&&(t[u]=!0)}}}(h,o,a,s,c):null==s||s.forEach(function(t,e){h[e]=!0}),[2,{usedImages:h,jsonScene:i,pluginSystem:u}]}})})()},i.processBins=function(t){var e=this;return ee(function(){var i,r;return eo(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(ei(n,ArrayBuffer))return n;if(a1(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 ee(function(){return eo(this,function(r){return t?[2,Promise.all(t.map(ee(function(t){var r,n,o;return eo(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];eS(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(o=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return a.sent(),document.fonts.add(o),e.fonts.add(t.fontFamily),[3,4];case 3:return a.sent(),ew.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 ee(function(){var n,o,a,s;return eo(this,function(u){return o=(n=r.options).useCompressedTexture,a=n.variables,s=r.baseUrl,[2,Promise.all(e.map(ee(function(e,n){var u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C;return eo(this,function(S){switch(S.label){case 0:if(u=e.url,c=e.webp,h=new URL(u,s).href,l=c&&new URL(c,s).href,!("template"in e))return[3,8];if(!(d=(f=e.template).background))return[3,7];p=a5(f,a),m=d.type===tS.video,v=d&&m?iX:iz,S.label=1;case 1:return S.trys.push([1,6,,7]),[4,iH(p,v)];case 2:if(!ei(y=S.sent(),HTMLVideoElement))return[3,3];return[2,y];case 3:return d&&Array.isArray(p)&&a&&(a[d.name]=y.src),[4,a6(y,f,a)];case 4:return[2,S.sent()];case 5:return[3,7];case 6:throw g=S.sent(),Error("Failed to load. Check the template or if the URL is "+(m?"video":"image")+" type, URL: "+p+", Error: "+g.message+".");case 7:return[3,9];case 8:if("compressed"in e&&o&&i){if(x=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?T=x.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(T=x.pvrtc),T)return b=new URL(T,s).href,r.assets[n]={url:b,type:t.TextureSourceType.compressed},[2,r.loadBins(b)]}else if("sourceType"in e)return[2,e];else if(ei(e,HTMLImageElement)||ei(e,HTMLCanvasElement)||ei(e,HTMLVideoElement)||ei(e,iK))return[2,e];S.label=9;case 9:return[4,iN(h,l)];case 10:return _=(E=S.sent()).url,C=E.image,r.assets[n]={url:_,type:t.TextureSourceType.image},[2,C]}})})))]})})()},i.processTextures=function(e,i,r,n){var o=this;return ee(function(){var a;return eo(this,function(s){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(ee(function(e,a){var s,u,c;return eo(this,function(h){switch(h.label){case 0:if(ei(e,iK))return[2,e];if(!("mipmaps"in e))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,iY(e,i,n,r.bins)];case 2:return[2,h.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+h.sent()+".");case 4:if(!eL(s=e.source))return[3,5];return u=n.assetLoader.loadGUID(s.id).data,[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,iz(eD(s))];case 6:u=h.sent(),h.label=7;case 7:if(u)return(c=function(e,i){if(ei(e,iK))return e.source;if(ei(e,HTMLImageElement)||eP(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iC.LINEAR,magFilter:iC.LINEAR};if(ei(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:iC.LINEAR,magFilter:iC.LINEAR};if(ei(e,ArrayBuffer))return iP({},i3(e),{sourceFrom:i});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE,minFilter:iC.NEAREST,magFilter:iC.NEAREST};throw Error("Invalid texture options.")}(u,o.assets[a])).id=e.id,c.dataType=tX.Texture,[2,c.sourceType===t.TextureSourceType.compressed?c:iP({},c,e)];throw Error("Invalid texture source: "+s+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return ee(function(){return eo(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 ee(function(){return eo(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.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,i=this.assets[t];null==i||null==(e=i.dispose)||e.call(i)}this.assets={},this.timers=[]},e}();st.fonts=new Set;var se=new eK(1,1,1),si=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=e$.fromIdentity(),this.viewMatrix=e$.fromIdentity(),this.projectionMatrix=e$.fromIdentity(),this.viewProjectionMatrix=e$.fromIdentity(),this.inverseViewMatrix=e$.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,o=e.aspect,a=e.clipMode,s=void 0===a?tC.portrait:a,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===o?1:o,clipMode:s,position:eK.fromArray(void 0===u?[0,0,8]:u),rotation:e0.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 eK(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix(),n=i.projectPoint(e).z,o=r.projectPoint(new eK(1,1,n)),a=o.x,s=o.y,u=r.projectPoint(new eK(-1,-1,n));return new eK((a-u.x)/2,(s-u.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 eJ;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,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=o,this.position=a,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,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*eH,i,r,n,o===tC.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(a,this.getQuat(),se),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){nQ.getRotation(t,this.options.rotation)},eU(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}(),sr=0,sn=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var i=t.jsonScene,r=t.renderLevel,n=t.textureOptions,o=t.pluginSystem,a=t.totalTime,s=i.compositions,u=i.imgUsage,c=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var h,l=ej(s);!(h=l()).done;){var f=h.value;f.id===c?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+c+".");this.jsonScene=i,this.renderLevel=r,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,sr=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,i=t.duration,r=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=this.assembleItems(t);return iP({},t,{id:e,duration:i,name:r,endBehavior:isNaN(n)?tO.freeze:n,items:u,camera:o,startTime:void 0===s?0:s,globalVolume:a})},e.assembleItems=function(t){var e=[];this.mask++;for(var i,r={},n=ej(this.jsonScene.components);!(i=n()).done;){var o=i.value;r[o.id]=o}for(var a,s=ej(t.items);!(a=s()).done;){var u=a.value,c=this.engine.jsonSceneData[u.id];if(a1(c.renderLevel,this.renderLevel)){if(c.listIndex=sr++,c.type===tx.sprite||c.type===tx.particle)for(var h,l=ej(c.components);!(h=l()).done;){var f=r[h.value.id];this.preProcessItemContent(f)}if(c.type===tx.composition){var d=c.content.options.refId;if(!this.refCompositions.get(d))throw Error("Invalid ref composition id: "+d+".");var p=this.getContent(this.refCompositions.get(d));this.refCompositionProps.has(d)||this.refCompositionProps.set(d,p),c.items=p.items}e.push(c)}}return e},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,i=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=oT(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],i):t.renderer.shape&&eL(t.renderer.shape)&&(t.renderer.shape=oT(t.renderer.shape,i))}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&&(i.hasOwnProperty(t)||(i[t]=0),i[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tp.NONE&&(t.mask||(e===tp.MASK?t.mask=++this.mask:e!==tp.OBSCURED&&e!==tp.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}(),so=function(){function e(e,i){var r,n,o=this;this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.postLoaders=[],this.paused=!1,this.lastVideoUpdateTime=0;var a=e.reusable,s=void 0!==a&&a,u=e.speed,c=e.baseRenderOrder,h=e.renderer,l=e.onPlayerPause,f=e.onMessageItem,d=e.onEnd,p=e.event,m=e.width,v=e.height;this.compositionSourceManager=new sn(i,h.engine),i.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,i.textures=void 0,i.consumed=!0);var y=this.compositionSourceManager,g=y.sourceContent,x=y.pluginSystem,T=y.imgUsage,b=y.totalTime,E=y.refCompositionProps;eC(g),this.renderer=h,this.refCompositionProps=E,this.rootItem=new t.VFXItem(this.getEngine(),g),this.rootItem.name="rootItem",this.rootItem.composition=this,this.rootComposition=this.rootItem.addComponent(an),this.rootComposition.data=g;var _=!s&&T;this.globalVolume=g.globalVolume,this.width=m,this.height=v,this.renderOrder=void 0===c?0:c,this.id=g.id,this.renderer=h,this.texInfo=null!=_?_:{},this.event=p,this.statistic={loadTime:null!=b?b:0,loadStart:null!=(r=i.startTime)?r:0,firstFrameTime:0,precompileTime:null!=(n=i.timeInfos.asyncCompile)?n:i.timeInfos.syncCompile},this.reusable=s,this.speed=void 0===u?1:u,this.autoRefTex=!this.keepResource&&_&&this.rootItem.endBehavior!==tO.restart,this.name=g.name,this.pluginSystem=x,this.pluginSystem.initializeComposition(this,i),this.camera=new si(this.name,iP({},null==g?void 0:g.camera,{aspect:m/v})),this.url=i.url,this.assigned=!0,this.globalTime=0,this.interactive=!0,this.onPlayerPause=l,this.onMessageItem=f,this.onEnd=d,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==o.onEnd||o.onEnd.call(o,o)},0)},this.pluginSystem.resetComposition(this,this.renderFrame)}var i=e.prototype;return i.getDuration=function(){return this.rootItem.duration},i.restart=function(){this.reset(),this.forwardTime(this.startTime)},i.setIndex=function(t){this.renderOrder=t},i.getIndex=function(){return this.renderOrder},i.setSpeed=function(t){this.speed=t},i.setVisible=function(t){this.items.forEach(function(e){e.setVisible(t)})},i.getSpeed=function(){return this.speed},i.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootComposition.started?this.gotoAndPlay(0):this.gotoAndPlay(this.time-this.startTime)},i.pause=function(){this.paused=!0},i.getPaused=function(){return this.paused},i.resume=function(){this.paused=!1},i.gotoAndPlay=function(t){this.resume(),this.rootComposition.started||(this.rootComposition.start(),this.rootComposition.started=!0),this.forwardTime(t+this.startTime)},i.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},i.createRenderFrame=function(){this.renderFrame=new ny({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},i.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootComposition.started||(this.rootComposition.start(),this.rootComposition.started=!0),this.forwardTime(t+this.startTime,!0),e&&this.pause()},i.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},i.forwardTime=function(t,e){void 0===e&&(e=!1);for(var i=1e3*t-1e3*this.rootComposition.time,r=i<0,n=Math.abs(i),o=r?-15:15;n>15;n-=15)this.update(o,e);this.update(r?-n:n,e)},i.reset=function(){this.rendererOptions=null,this.globalTime=0,this.rootItem.ended=!1,this.pluginSystem.resetComposition(this,this.renderFrame)},i.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)})},i.gatherRendererComponent=function(t,e){for(var i,r=ej(t.rendererComponents);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var o,a=ej(t.children);!(o=a()).done;){var s=o.value;this.gatherRendererComponent(s,e)}},i.shouldRestart=function(){var t=this.rootItem,e=t.ended,i=t.endBehavior;return e&&i===tO.restart},i.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,i=t.endBehavior;return e&&(!i||3===i)},i.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var i=this.getUpdateTime(t*this.speed);if(this.globalTime+=i,this.rootComposition.isActiveAndEnabled){var r=this.toLocalTime(this.globalTime/1e3);this.rootComposition.time=r}this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,i),this.callLateUpdate(this.rootItem,i),this.updateCamera(),this.shouldDispose()?(null==this.onEnd||this.onEnd.call(this,this),this.dispose()):e||this.prepareRender()}},i.toLocalTime=function(t){var e=t-this.rootItem.start,i=this.rootItem.duration;return e-i>.001&&(this.rootItem.endBehavior===tO.restart?e%=i:this.rootItem.endBehavior===tO.freeze&&(e=Math.min(i,e))),e},i.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},i.callStart=function(t){for(var e,i=ej(t.itemBehaviours);!(e=i()).done;){var r=e.value;r.isActiveAndEnabled&&!r.started&&(r.start(),r.started=!0)}for(var n,o=ej(t.rendererComponents);!(n=o()).done;){var a=n.value;a.isActiveAndEnabled&&!a.started&&(a.start(),a.started=!0)}for(var s,u=ej(t.children);!(s=u()).done;){var c=s.value;this.callStart(c)}},i.callUpdate=function(e,i){for(var r,n=ej(e.itemBehaviours);!(r=n()).done;){var o=r.value;o.isActiveAndEnabled&&o.started&&o.update(i)}for(var a,s=ej(e.rendererComponents);!(a=s()).done;){var u=a.value;u.isActiveAndEnabled&&u.started&&u.update(i)}for(var c,h=ej(e.children);!(c=h()).done;){var l=c.value;t.VFXItem.isComposition(l)&&l.ended&&l.endBehavior===tO.restart?(l.ended=!1,this.callUpdate(l,0)):this.callUpdate(l,i)}},i.callLateUpdate=function(t,e){for(var i,r=ej(t.itemBehaviours);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&n.started&&n.lateUpdate(e)}for(var o,a=ej(t.rendererComponents);!(o=a()).done;){var s=o.value;s.isActiveAndEnabled&&s.started&&s.lateUpdate(e)}for(var u,c=ej(t.children);!(u=c()).done;){var h=u.value;this.callLateUpdate(h,e)}},i.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(an).items,o=ej(n);!(i=o()).done;){var a=i.value;r.set(a.id,a)}for(var s,u=ej(n);!(s=u()).done;){var c=s.value;if(void 0===c.parentId)c.setParent(e);else{var h=this.getParentIdWithoutSuffix(c.parentId),l=r.get(h);if(l)t.VFXItem.isTree(l)&&c.parentId.includes("^")?(c.parent=l,c.transform.parentTransform=l.getNodeTransform(c.parentId)):(c.parent=l,c.transform.parentTransform=l.transform),l.children.push(c);else throw Error("The element references a non-existent element, please check the data.")}}for(var f,d=ej(n);!(f=d()).done;){var p=f.value;t.VFXItem.isComposition(p)&&this.buildItemTree(p)}}},i.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},i.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)},i.updateCamera=function(){this.camera.updateMatrix()},i.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},i.getItemByName=function(t){return this.rootItem.find(t)},i.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return rc((t-i.z)/r,(e-i.w)/n,this.camera)},i.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},i.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,o=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(an))||n.hitTest(a,t,e,o,i,r),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(an))||s.hitTest(a,t,e,o,i,r)}),o},i.addInteractiveItem=function(t,e){if(e===ty.MESSAGE)return null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},i.removeInteractiveItem=function(t,e){e===ty.MESSAGE&&(null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},i.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()}}},i.destroyItem=function(t){var e=this;t.type==tx.composition?t.endBehavior!==tO.freeze&&t.getComponent(an).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(el(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},i.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()},i.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},o=this.textures;o&&this.keepResource&&o.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eO)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){ew.error("Update disposed composition: "+r.name+".")},this.onPlayerPause=eO,this.dispose=eO,o&&this.keepResource&&o.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==ib&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},i.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},i.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},i.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},i.translate=function(t,e,i){this.rootItem.translate(t,e,i)},i.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},i.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},i.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},i.scale=function(t,e,i){this.rootItem.scale(t,e,i)},i.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},i.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},i.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},i.reloadTexture=function(){var t=this;return ee(function(){return eo(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]}})})()},eU(e,[{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(){var t;return null!=(t=this.rootComposition.startTime)?t:0}},{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)}}]),e}(),sa=new Int32Array(2),ss=new Float32Array(sa.buffer),su=new Float64Array(sa.buffer),sc=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(ts=t4||(t4={}))[ts.UTF8_BYTES=1]="UTF8_BYTES",ts[ts.UTF16_STRING=2]="UTF16_STRING";var sh=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 sa[0]=this.readInt32(t),ss[0]},e.readFloat64=function(t){return sa[sc?0:1]=this.readInt32(t),sa[sc?1:0]=this.readInt32(t+4),su[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){ss[0]=e,this.writeInt32(t,sa[0])},e.writeFloat64=function(t,e){su[0]=e,this.writeInt32(t,sa[sc?0:1]),this.writeInt32(t+4,sa[sc?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===t4.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=sh.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,o=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(o+s)!=this.bb.readInt16(a+s))continue t;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:(ei(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=sh.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},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.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 sd(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}(),sd=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=sf.createDataVector(t,this.data);return sf.createFBEffectsObjectData(t,e,i)},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.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new sf).__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 sm(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}(),sm=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sp.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sp.createFBEffectsPackageData(t,e)},t}(),sv=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 sy(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}(),sy=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 sv.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},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.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 sx(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,o,a){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,o),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),sx=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 sg.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sT=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 sg).__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 sb(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}(),sb=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=sT.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sT.createFBVertexData(t,this.vertexCount,e)},t}(),sE=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 sT).__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 sv).__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 s_(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}(),s_=function(){function t(t,e,i,r,n,o,a,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===o&&(o=[]),void 0===a&&(a=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=o,this.mode=a,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=sE.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),o=null!==this.buffer?t.createString(this.buffer):0,a=sE.createBinaryDataVector(t,this.binaryData),s=sE.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,c=sE.createInverseBindMatricesVector(t,this.inverseBindMatrices);return sE.startFBGeometryData(t),sE.addId(t,e),sE.addName(t,i),sE.addVertexData(t,r),sE.addIndexFormat(t,this.indexFormat),sE.addIndexOffset(t,this.indexOffset),sE.addSubMeshes(t,n),sE.addMode(t,this.mode),sE.addBuffer(t,o),sE.addBinaryData(t,a),sE.addBoneNames(t,s),sE.addRootBoneName(t,u),sE.addInverseBindMatrices(t,c),sE.endFBGeometryData(t)},t}(),sC=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 sm,r=[],n=ej(this.exportObjectDatas);!(t=n()).done;){var o=t.value,a=void 0;o.dataType===tX.Geometry&&(a=new sd("Geometry",this.geometryDataToBinary(o))),a&&r.push(a)}return i.exportObjects=r,sp.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new sh(t),i=sp.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var o=n.dataArray(),a=n.dataType();if(o){var s=void 0;a===tX.Geometry&&(s=this.binaryToGeometryData(o)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new sl(1),i=new s_;i.indexFormat=t.indexFormat,i.indexOffset=t.indexOffset,i.mode=t.mode,i.id=t.id,i.boneNames=null!=(n=t.boneNames)?n:[],i.rootBoneName=null!=(o=t.rootBoneName)?o:"",i.inverseBindMatrices=null!=(a=t.inverseBindMatrices)?a:[],i.binaryData=null!=(s=t.binaryData)?s:[];var r=new sb;r.vertexCount=t.vertexData.vertexCount,r.channels=[];for(var n,o,a,s,u,c=ej(t.vertexData.channels);!(u=c()).done;){var h=u.value,l=new sx(h.semantic,h.offset,h.format,h.dimension,h.normalize);r.channels.push(l)}i.vertexData=r;for(var f,d=[],p=ej(t.subMeshes);!(f=p()).done;){var m=f.value,v=new sy(m.offset,m.indexCount,m.vertexCount);d.push(v)}return i.subMeshes=d,sp.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,o=new sh(t),a=sE.getRootAsFBGeometryData(o),s={vertexCount:0,channels:[]},u=a.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()};s.channels.push(f)}}}for(var d=[],p=0;p<a.subMeshesLength();p++){var m=a.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount()};d.push(v)}}for(var y=[],g=0;g<a.boneNamesLength();g++){var x=a.boneNames(g);y.push(x)}var T=a.inverseBindMatricesArray();return{vertexData:s,indexFormat:a.indexFormat(),indexOffset:a.indexOffset(),subMeshes:d,mode:a.mode(),buffer:null!=(e=a.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=a.rootBoneName())?i:"",inverseBindMatrices:T?Array.from(T):void 0,binaryData:null!=(r=a.binaryDataArray())?r:void 0,id:null!=(n=a.id())?n:"",dataType:tX.Geometry}},t}(),sS=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 ab(this),this.emptyTexture=i0(this),this.transparentTexture=i1(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,o=i.materials,a=i.shaders,s=i.geometries,u=i.components,c=i.animations,h=i.bins,l=void 0===h?[]:h,f=i.miscs,d=ej(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=ej(void 0===o?[]:o);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=ej(void 0===a?[]:a);!(g=x()).done;){var T=g.value;this.addEffectsObjectData(T)}for(var b,E=ej(void 0===s?[]:s);!(b=E()).done;){var _=b.value;this.addEffectsObjectData(_)}for(var C,S=ej(void 0===u?[]:u);!(C=S()).done;){var A=C.value;this.addEffectsObjectData(A)}for(var w,O=ej(void 0===c?[]:c);!(w=O()).done;){var R=w.value;this.addEffectsObjectData(R)}for(var I,M=ej(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===tX.BinaryAsset)V.buffer=F,V.id&&this.addEffectsObjectData(V);else{var N=new sC;N.deserializeFromBinary(new Uint8Array(F));for(var D,z=ej(N.exportObjectDatas);!(D=z()).done;){var k=D.value;this.addEffectsObjectData(k)}}}for(var U,B=ej(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return ee(function(){var i,r,n,o;return eo(this,function(a){switch(a.label){case 0:i=ej(t.jsonScene.items),a.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(o=(n=r.value).type)||"camera"===o||o===tx.sprite||o===tx.particle||o===tx.mesh||o===tx.skybox||o===tx.light||o===tx.tree||o===tx.interact||o===tx.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:a.sent(),a.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||eh(this.textures,t)},e.removeTexture=function(t){this.destroyed||el(this.textures,t)},e.addMaterial=function(t){this.destroyed||eh(this.materials,t)},e.removeMaterial=function(t){this.destroyed||el(this.materials,t)},e.addGeometry=function(t){this.destroyed||eh(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||el(this.geometries,t)},e.addMesh=function(t){this.destroyed||eh(this.meshes,t)},e.removeMesh=function(t){this.destroyed||el(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||eh(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||el(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&&ew.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}},eU(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),sA=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=eq(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)},eU(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return eG(e,t),e.prototype.fromData=function(t){},e}(e9),en([e8(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=en([e5("BinaryAsset")],t.BinaryAsset),ay("camera",io,t.VFXItem,!0),ay("text",af,t.VFXItem,!0),ay("sprite",nN,t.VFXItem,!0),ay("particle",oQ,t.VFXItem,!0),ay("cal",oK,t.VFXItem,!0),ay("interact",id,t.VFXItem,!0),ew.info("Core version: 2.0.0-alpha.27.");var sw=((t5={})[iC.ONE]=t7.OneFactor,t5[iC.ZERO]=t7.ZeroFactor,t5[iC.SRC_COLOR]=t7.SrcColorFactor,t5[iC.SRC_ALPHA]=t7.SrcAlphaFactor,t5[iC.ONE_MINUS_SRC_COLOR]=t7.OneMinusSrcColorFactor,t5[iC.ONE_MINUS_SRC_ALPHA]=t7.OneMinusSrcAlphaFactor,t5[iC.DST_COLOR]=t7.DstColorFactor,t5[iC.DST_ALPHA]=t7.DstAlphaFactor,t5[iC.ONE_MINUS_DST_COLOR]=t7.OneMinusDstColorFactor,t5[iC.ONE_MINUS_DST_ALPHA]=t7.OneMinusDstAlphaFactor,t5),sO=((t6={})[iC.NEVER]=t7.NeverStencilFunc,t6[iC.EQUAL]=t7.EqualStencilFunc,t6[iC.LESS]=t7.LessStencilFunc,t6[iC.LEQUAL]=t7.LessEqualStencilFunc,t6[iC.ALWAYS]=t7.AlwaysStencilFunc,t6[iC.NOTEQUAL]=t7.NotEqualStencilFunc,t6[iC.GREATER]=t7.GreaterStencilFunc,t6[iC.GEQUAL]=t7.GreaterEqualStencilFunc,t6),sR=((t8={})[iC.KEEP]=t7.KeepStencilOp,t8[iC.ZERO]=t7.ZeroStencilOp,t8[iC.REPLACE]=t7.ReplaceStencilOp,t8[iC.INCR]=t7.IncrementStencilOp,t8[iC.DECR]=t7.DecrementStencilOp,t8[iC.INCR_WRAP]=t7.IncrementWrapStencilOp,t8[iC.DECR_WRAP]=t7.IncrementWrapStencilOp,t8[iC.INVERT]=t7.InvertStencilOp,t8),sI=((t9={})[iC.NEVER]=t7.NeverDepth,t9[iC.ALWAYS]=t7.AlwaysDepth,t9[iC.EQUAL]=t7.EqualDepth,t9[iC.LESS]=t7.LessDepth,t9[iC.LEQUAL]=t7.LessEqualDepth,t9[iC.GREATER]=t7.GreaterDepth,t9[iC.GEQUAL]=t7.GreaterEqualDepth,t9[iC.NOTEQUAL]=t7.NotEqualDepth,t9),sM=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],sL=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new t7.RawShaderMaterial,n.uniforms={};for(var n,o=null==r?void 0:r.shader,a=i.gpuCapability.level,s=0;s<t.maxSpriteMeshItemCount;s++)n.uniforms["uSampler"+s]=new t7.Uniform(null);return n.uniforms.uEditorTransform=new t7.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new t7.Uniform(new t7.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new t7.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new t7.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new t7.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new t7.RawShaderMaterial({vertexShader:iR(o.macros,o.vertex,t.ShaderType.vertex,n.engine.gpuCapability.level),fragmentShader:iR(o.macros,o.fragment,t.ShaderType.fragment,n.engine.gpuCapability.level),alphaToCoverage:!1,depthFunc:t7.LessDepth,polygonOffsetFactor:t7.ZeroFactor,polygonOffsetUnits:t7.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===a?n.material.glslVersion=t7.GLSL1:n.material.glslVersion=t7.GLSL3,n}eG(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;sM.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new t7.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var o=new t7.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",o)}else{var a=r.camera;this.setMatrix("effects_MatrixVP",a.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",a.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=ej(e);!(i=n()).done;){var o=i.value;r=r.concat(o.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=ej(e);!(i=n()).done;){var o=i.value;r=r.concat(o.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 t7.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)},eU(i,[{key:"blending",get:function(){return this.material.blending!==t7.NoBlending},set:function(t){this.material.blending=t?t7.CustomBlending:t7.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=sw[e],this.material.blendDst=sw[i],this.material.blendSrcAlpha=sw[r],this.material.blendDstAlpha=sw[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=sI[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=sO[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=sR[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=sR[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=sR[t[0]])}},{key:"culling",get:function(){return this.material.side!==t7.DoubleSide},set:function(t){this.material.side=t?t7.FrontSide:t7.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===td.FRONT?this.material.side=t7.FrontSide:t===td.BACK&&(this.material.side=t7.BackSide)}}]),i}(i9),sP=1,sV=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return aa(r);var r,n=i.drawStart,o=i.drawCount,a=i.indices,s=i.mode,u=i.name,c=void 0===u?"effectsGeometry:"+sP++:u;r.name=c,r.mode=null!=s?s:iC.TRIANGLES;var h=[],l={},f=new t7.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 o=e.size,a=e.offset,s=e.normalize,u=l[n],c=u.buffer,d=u.dataLength,p=new t7.InterleavedBufferAttribute(c,o,(null!=a?a: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)}),a&&a.data&&f.setIndex(new t7.BufferAttribute(a.data,1)),r.geometry=f,r.attributes=l,r.attributesName=h,r.drawStart=void 0===n?0:n,r.drawCount=null!=o?o:0,r}eG(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 t7.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*r0[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 t7.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 o=e.stride,a=e.size,s=e.offset,u=e.normalize,c=e.type,h=void 0===c?iC.FLOAT:c,l=e.data;if(h&&!l&&(l=r2(h)),l){var f=ei(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===o?0:o)/f,p=(n=(null!=n?n:0)*d)||a*f;p&&0===l.length&&(l=ei(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new t7.InterleavedBuffer(l,d),v=new t7.InterleavedBufferAttribute(m,a,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:h,dataLength:f}}},eU(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}(r1),sF=function(e){function i(t,i){if(!i)return aa(r);var r,n=i.material,o=i.geometry,a=i.priority;return(r=e.call(this,t,i)||this).geometry=o,r.material=n,o.mode===iC.LINES?r.mesh=new t7.LineSegments(o.geometry,n.material):r.mesh=new t7.Mesh(o.geometry,n.material),r.priority=void 0===a?0:a,r}eG(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.start=function(){e.prototype.start.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)},eU(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(r4),sN=function(e){function i(i,r,n){if(void 0===n&&(n={}),o=e.call(this,i)||this,r){var o,a=r.width,s=r.height;o.texture=o.createTextureByType(iP({},n,{sourceType:t.TextureSourceType.data,data:r})),o.width=void 0===a?1:a,o.height=void 0===s?1:s}else o.texture=o.createTextureByType(n);return o.texture.needsUpdate=!0,o}eG(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 ee(function(){var i;return eo(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?iC.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:t7.RGBAFormat,type:t7.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,o=i.wrapS,a=i.wrapT,s=i.minFilter,u=i.magFilter,c=i.sourceType,h=t7.UVMapping,l=i.format,f=void 0;if(this.sourceType=c,c===t.TextureSourceType.data){var d=e.data;f=new t7.DataTexture(d.data,d.width,d.height,l,n,h,o,a,u,s),this.width=d.width,this.height=d.height}else if(c===t.TextureSourceType.image){var p=e.image;f=new t7.Texture(p,h,o,a,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=t7.RGBA_ASTC_4x4_Format,f=new t7.CompressedTexture(y,m,v,l,n,h,o,a,u,s),this.width=m,this.height=v}else if(c===t.TextureSourceType.video)f=new t7.VideoTexture(e.video,h,o,a,u,s,l,n);else if(c===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,T,b=null!=(x=g.width)?x:0,E=null!=(T=g.height)?T:0;f=new t7.FramebufferTexture(b,E,l),this.width=b,this.height=E}}else c===t.TextureSourceType.none&&((f=new t7.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=t7.MirroredRepeatWrapping,f.wrapT=t7.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===iC.LINEAR?t7.LinearFilter:t7.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iC.MIRRORED_REPEAT:return t7.MirroredRepeatWrapping;case iC.REPEAT:return t7.RepeatWrapping;default:return t7.ClampToEdgeWrapping}},i}(iK),sD=function(t){function e(e,i){return t.call(this,e,i)}eG(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=ej(this.rootComposition.items);!(e=i()).done;)for(var r,n=e.value.getComponents(ii),o=ej(n);!(r=o()).done;){var a=r.value;a.isActiveAndEnabled&&a.render(t)}for(var s,u=ej(this.refContent);!(s=u()).done;)for(var c,h=s.value,l=ej(h.getComponent(an).items);!(c=l()).done;)for(var f,d=c.value.getComponents(ii),p=ej(d);!(f=p()).done;){var m=f.value;m.isActiveAndEnabled&&m.render(t)}},i.getRendererOptions=function(){var t=sN.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}(so);sD.shape={};var sz=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new n_(e),i}return eG(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}(sS),sk=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new sz(e),i.renderingData={currentFrame:{}},i}return eG(e,t),e}(nA),sU=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.baseCompositionIndex=0,r.env="";var r,n=i.width,o=i.height,a=i.camera;return r.renderer=new sk(e),r.width=n,r.height=o,r.camera=a,r}eG(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return ee(function(){var r,n;return eo(this,function(o){switch(o.label){case 0:if(n=i.baseCompositionIndex,!eI(t))return[3,2];return i.baseCompositionIndex+=t.length,[4,Promise.all(t.map(ee(function(t,r){var o;return eo(this,function(a){switch(a.label){case 0:return[4,i.createComposition(t,e)];case 1:return(o=a.sent()).setIndex(n+r),[2,o]}})})))];case 1:return r=o.sent(),[3,4];case 2:return i.baseCompositionIndex+=1,[4,i.createComposition(t,e)];case 3:(r=o.sent()).setIndex(n),o.label=4;case 4:return[2,r]}})})()},i.createComposition=function(t,e){void 0===e&&(e={});var i=this;return ee(function(){var r,n,o,a,s,u,c,h;return eo(this,function(l){switch(l.label){case 0:return r=performance.now(),n=iP({autoplay:!0},e),a3(t)?(o=t.url,a4(t)&&(n=iP({},n,t.options||{}))):o=t,i.assetManager?i.assetManager.updateOptions(n):i.assetManager=new st(n),[4,i.assetManager.loadScene(o,i.renderer,{env:i.env})];case 1:for(a=l.sent(),(s=i.renderer.engine).clearResources(),s.addPackageDatas(a),u=0;u<a.textureOptions.length;u++)a.textureOptions[u]=s.assetLoader.loadGUID(a.textureOptions[u].id),a.textureOptions[u].initialize();if(!s.database)return[3,3];return[4,s.createVFXItems(a)];case 2:l.sent(),l.label=3;case 3:return c=new sD(iP({},n,{width:i.width,height:i.height,renderer:i.renderer}),a),i.renderer.engine.setOptions({threeCamera:i.camera,threeGroup:i,composition:c}),n.autoplay?c.play():c.pause(),h=performance.now()-r+c.statistic.loadTime,c.statistic.firstFrameTime=h,ew.info("First frame: ["+c.name+"]"+h.toFixed(4)+"ms."),i.compositions.push(c),[2,c]}})})()},i.update=function(t){this.compositions.forEach(function(e){e.update(t)})},eU(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(t7.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}eG(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===iC.LINES?this.threeMesh=new t7.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new t7.Mesh(this.geometry.geometry,this.material.material))},i.start=function(){t.prototype.start.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()},eU(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=en([e5(tX.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=ac.getCanvas(),ac.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return aa(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(!1),r}eG(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.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=en([e5(tX.TextComponent)],t.ThreeTextComponent),ez(t.ThreeTextComponent,[al]),nV(8),iK.create=function(t,e){return new sN(t,void 0,e)},iK.createWithData=function(t,e,i){return new sN(t,e,i)},i9.create=function(t,e){return new sL(t,e)},r1.create=function(t,e){return new sV(t,e)},r4.create=function(t,e){return new sF(t,e)};var sB="2.0.0-alpha.27";ew.info("THREEJS plugin version: "+sB+"."),t.AbstractPlugin=ir,t.ActivationPlayable=o5,t.AnimationClipPlayable=o6,t.AssetLoader=ab,t.AssetManager=st,t.BYTES_TYPE_MAP=r0,t.Behaviour=it,t.BezierCurve=rV,t.BezierCurvePath=rN,t.BezierCurveQuat=rD,t.CONSTANT_MAP_BLEND=sw,t.CONSTANT_MAP_DEPTH=sI,t.CONSTANT_MAP_STENCIL_FUNC=sO,t.CONSTANT_MAP_STENCIL_OP=sR,t.COPY_FRAGMENT_SHADER=rZ,t.COPY_MESH_SHADER_ID=rW,t.COPY_VERTEX_SHADER=rY,t.CalculateLoader=oK,t.Camera=si,t.CameraVFXItemLoader=io,t.Component=e7,t.Composition=so,t.CompositionComponent=an,t.CompositionSourceManager=sn,t.DEFAULT_FONTS=ah,t.Database=aE,t.Downloader=iV,t.EFFECTS_COPY_MESH_NAME=rH,t.EVENT_TYPE_CLICK=ia,t.EVENT_TYPE_TOUCH_END=ic,t.EVENT_TYPE_TOUCH_MOVE=iu,t.EVENT_TYPE_TOUCH_START=is,t.EffectsObject=e9,t.EffectsPackage=sC,t.Engine=sS,t.EventSystem=ih,t.Float16ArrayWrapper=rt,t.Framebuffer=nS,t.GPUCapability=n_,t.Geometry=r1,t.GlobalUniforms=nT,t.GradientValue=rL,t.HELP_LINK=iE,t.InteractLoader=id,t.InteractMesh=nO,t.ItemBehaviour=ie,t.KTXTexture=i2,t.LineSegments=rP,t.LinearValue=rM,t.Material=i9,t.MaterialDataBlock=i5,t.Mesh=r4,t.PLAYER_OPTIONS_ENV_EDITOR=ib,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=oG,t.ParticleBehaviourPlayableAsset=oX,t.ParticleLoader=oQ,t.ParticleMesh=oH,t.ParticleSystemRenderer=oL,t.PassTextureCache=rJ,t.PathSegments=rF,t.PluginSystem=ag,t.RENDER_PASS_NAME_PREFIX=nm,t.RENDER_PREFER_LOOKUP_TEXTURE=nH,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=rO,t.RandomValue=rR,t.RandomVectorValue=rI,t.RenderFrame=ny,t.RenderPass=r8,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=r5,t.Renderbuffer=nb,t.Renderer=nA,t.RendererComponent=ii,t.RuntimeClip=o9,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=r$,t.SerializationHelper=aT,t.ShaderVariant=rj,t.SpriteColorPlayable=nj,t.SpriteLoader=nN,t.StaticValue=rw,t.TEMPLATE_USE_OFFSCREEN_CANVAS=nW,t.TEXTURE_UNIFORM_MAP=sM,t.TextComponentBase=al,t.TextLayout=as,t.TextLoader=af,t.TextStyle=au,t.Texture=iK,t.TextureFactory=i4,t.ThreeComposition=sD,t.ThreeDisplayObject=sU,t.ThreeEngine=sz,t.ThreeMaterial=sL,t.ThreeTexture=sN,t.Ticker=sA,t.TimelineClip=o8,t.TimelinePlayable=at,t.TrackSortWrapper=ae,t.Transform=nQ,t.TransformAnimationPlayable=o4,t.ValueGetter=rA,t.addByOrder=eE,t.addItem=eh,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 o=t[n];if(r)for(;t[n-1][i]<o[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>o[i]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.applyMixins=ez,t.assertExist=eC,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=eD,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=rr,t.canvasPool=ac,t.colorGradingFrag=no,t.colorStopsFromGradient=em,t.colorToArr=ed,t.combineImageTemplate=a6,t.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.createCopyShader=rq,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=rX,t.createShaderWithMacros=iR,t.createShape=oe,t.createVFXItem=function(t,e){var i=t.type,r=t.pluginName;if(!r)switch(i){case tx.null:r="cal";break;case tx.sprite:r="sprite";break;case tx.particle:r="particle";break;case tx.interact:r="interact";break;case tx.camera:r="camera";break;case tx.text:r="text";break;case tx.tree:r="tree";break;default:throw Error("Invalid vfx item type.")}return e.pluginSystem.createPluginItem(r,t,e)},t.createValueGetter=rk,t.decimalEqual=rl,t.defaultGlobalVolume=np,t.defaultPlugins=am,t.deserializeMipmapTexture=iY,t.earcut=og,t.effectsClass=e5,t.effectsClassStore=e4,t.enlargeBuffer=ef,t.ensureFixedNumber=aC,t.ensureVec3=rn,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=na,t.gaussianDownVFrag=ns,t.gaussianUpFrag=nu,t.generateEmptyTypedArray=r2,t.generateGUID=eN,t.generateHalfFloatTexture=iJ,t.generateTransparentTexture=i1,t.generateWhiteTexture=i0,t.getBackgroundImage=a5,t.getColorFromGradientStops=ep,t.getConfig=function(t){return nY[t]},t.getDefaultTemplateCanvasPool=function(){return ac},t.getDefaultTextureFactory=function(){return tq||(tq=new i4),tq},t.getGeometryByShape=oT,t.getGeometryTriangles=ox,t.getImageItemRenderInfo=nI,t.getKTXTextureOptions=i3,t.getKeyFrameMetaByRawValue=rG,t.getMergedStore=e6,t.getParticleMeshShader=oZ,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=iw,t.getStandardComposition=aK,t.getStandardImage=aQ,t.getStandardItem=a$,t.getStandardJSON=aZ,t.getTextureSize=ng,t.glContext=iC,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tH.Float32;case WebGLRenderingContext.SHORT:return tH.Int16;case WebGLRenderingContext.BYTE:return tH.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tH.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tH.UInt8;default:return tH.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=ee(function(){return eo(this,function(n){return[2,new Promise(function(n,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);a&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(a||s)&&(t.deleteQuery(i),i=null),null!==a&&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){eR(t)&&(t=ed(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=eT,t.initErrors=i_,t.initGLContext=iS,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=ev,t.isAlipayMiniApp=function(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"},t.isAndroid=eg,t.isArray=eI,t.isCanvas=eP,t.isFunction=eM,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=eL,t.isSceneJSON=a2,t.isSceneURL=a3,t.isSceneWithOptions=a4,t.isSimulatorCellPhone=ex,t.isString=eR,t.isUniformStruct=i6,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&i6(t[0])},t.isValidFontFamily=eS,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemFrag=nt,t.itemFrameFrag=r9,t.itemVert=r7,t.loadBinary=iU,t.loadBlob=function(t){return iG.apply(this,arguments)},t.loadImage=iz,t.loadMedia=iH,t.loadVideo=iX,t.loadWebPOptional=iN,t.logger=ew,t.math=iT,t.modifyMaxKeyframeShader=oq,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=eO,t.normalizeColor=aI,t.numberToFix=rf,t.parsePercent=ey,t.particleFrag=ne,t.particleOriginTranslateMap=ru,t.particleUniformTypeMap=oj,t.particleVert=ni,t.pluginLoaderMap=ap,t.pointOnLine=function(t,e,i,r,n,o){var a=t*r+e*n+i*o-n*r-o*t-i*e;return a>-.001&&a<.001},t.randomInRange=eV,t.registerPlugin=ay,t.removeItem=el,t.rotateVec2=ob,t.screenMeshVert=nn,t.serialize=function(t,e){return e8(t,e)},t.setBlendMode=iI,t.setConfig=function(t,e){return nY[t]=e},t.setDefaultTextureFactory=function(t){tq=t},t.setMaskMode=iL,t.setMaxSpriteMeshItemCount=nV,t.setRayFromCamera=rc,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 t7.Uniform(i)},t.sortByOrder=eb,t.spec=e1,t.spriteMeshShaderFromFilter=nM,t.spriteMeshShaderFromRenderInfo=nP,t.spriteMeshShaderIdFromRenderInfo=nL,t.thresholdFrag=nc,t.throwDestroyedError=eF,t.trailVert=nr,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=rh,t.unregisterPlugin=function(t){delete av[t],delete ap[t],el(am,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\nin float aSeed;out 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.vecAssign=ra,t.vecFill=ro,t.vecMulCombine=rs,t.vecNormalize=function(t,e){1==arguments.length&&(e=t,t=[]);var i,r=e,n=(i=Math).hypot.apply(i,[].concat(r));if(0===n)return ra(t,r,r.length);for(var o=0;o<r.length;o++)t[o]=r[o]/n;return t},t.version=sB,t.vertexFormatType2GLType=function(t){switch(t){case tH.Float32:return WebGLRenderingContext.FLOAT;case tH.Int16:return WebGLRenderingContext.SHORT;case tH.Int8:return WebGLRenderingContext.BYTE;case tH.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tH.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
8
8
|
//# sourceMappingURL=index.min.js.map
|