@galacean/effects-threejs 2.0.0-alpha.2 → 2.0.0-alpha.21
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 +20552 -20788
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -16
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +21455 -21683
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +7 -4
- package/dist/three-composition.d.ts +3 -3
- package/dist/three-display-object.d.ts +1 -2
- package/dist/three-geometry.d.ts +7 -1
- package/dist/three-texture.d.ts +7 -186
- package/package.json +4 -4
package/dist/index.min.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
!/*!
|
|
2
2
|
* Name: @galacean/effects-threejs
|
|
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
|
-
*/
|
|
8
|
-
!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";function r(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)}var i=r(e),n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var a=function(){return a=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},a.apply(this,arguments)};function s(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 u(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(a,s)}u((i=i.apply(t,e||[])).next())}))}function c(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 new 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=a.trys,(n=n.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 l(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function f(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}let p;"function"==typeof SuppressedError&&SuppressedError;const d=new Uint8Array(16);function m(){if(!p&&(p="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!p))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return p(d)}const y=[];for(let t=0;t<256;++t)y.push((t+256).toString(16).slice(1));var v,x={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function g(t,e,r){if(x.randomUUID&&!e&&!t)return x.randomUUID();const i=(t=t||{}).random||(t.rng||m)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=i[t];return e}return function(t,e=0){return y[t[e+0]]+y[t[e+1]]+y[t[e+2]]+y[t[e+3]]+"-"+y[t[e+4]]+y[t[e+5]]+"-"+y[t[e+6]]+y[t[e+7]]+"-"+y[t[e+8]]+y[t[e+9]]+"-"+y[t[e+10]]+y[t[e+11]]+y[t[e+12]]+y[t[e+13]]+y[t[e+14]]+y[t[e+15]]}(i)}function T(t,e){return t.includes(e)||t.push(e),t}function E(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function b(t,e,r,i){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);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 _(t,e){var r=[0,0,0,0];if(ft(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]||[0,0,0,255])}else t instanceof 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 C(t,e,r){if(t.length){for(var i=void 0,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=w(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 S(t){var e=[];if(t instanceof Array?t.forEach((function(t){var r=h(t,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];e.push({stop:O(i),color:[n,o,a,s]})})):Object.keys(t).forEach((function(r){var i=_(t[r]);e.push({stop:O(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 w(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(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function O(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function A(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function R(){return A()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function L(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=S(t);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/e,s=void 0,u=void 0,c=0;c<n.length&&(s=n[c],u=n[c+1],!(s.stop<=a&&u.stop>a));c++);var l=w(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(l,4*o)}i.set(n[n.length-1].color,508)}return r}function M(e,r){void 0===r&&(r=t.OrderType.ascending);var i=e.length;if(i<=1||r===t.OrderType.none)return e;if(i<=30){for(var n=1;n<i;n++)P(e,n,r);return e}return V(e,r)}function I(e,r,i){return void 0===i&&(i=t.OrderType.ascending),e.includes(r)?e:(e.push(r),1===e.length||i!==t.OrderType.none&&P(e,e.length-1,i),e)}function P(e,r,i){var n=e[r];if(i!==t.OrderType.ascending)for(;r>=1&&e[r-1].priority<n.priority&&(e[r]=e[r-1],0!=--r););else for(;r>=1&&e[r-1].priority>n.priority&&(e[r]=e[r-1],0!=--r););e[r]=n}function V(e,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var s=e[i],u=i,c=n;u<c;){if(r===t.OrderType.ascending){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=h([e[c],e[u]],2),e[u]=o[0],e[c]=o[1]}return a=h([e[u],e[i]],2),e[i]=a[0],e[u]=a[1],V(e,r,i,u-1),V(e,r,c+1,n),e}function F(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}t.OrderType=void 0,(v=t.OrderType||(t.OrderType={}))[v.none=1]="none",v[v.ascending=2]="ascending",v[v.descending=3]="descending";var N=2*Math.PI,D=Math.PI/180,z=180/Math.PI,U=1e-6;function k(t,e){return Math.abs(t-e)<U||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var B=function(t,e,r){return(1-r)*t+r*e};function G(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,o=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,o),a)}var X,j=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this},t.prototype.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this},t.prototype.sum=function(){return this.x+this.y},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.isZero=function(){var t=U,e=(this,this.x),r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=t},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},t.prototype.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.ONE=new t(1,1),t.ZERO=new t(0,0),t}(),H=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}return t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},t.prototype.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):t instanceof 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},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):t instanceof 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},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):t instanceof 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},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):t instanceof 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},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.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},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){return this.crossVectors(this,t)},t.prototype.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},t.prototype.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},t.prototype.distance=function(t){return Math.sqrt(this.distanceSquared(t))},t.prototype.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},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},t.prototype.isZero=function(){var t,e=U,r=(t=this).x,i=t.y,n=t.z;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toVector2=function(){return new j(this.x,this.y)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t.prototype.applyEuler=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyMatrix=function(t,e){return t.transformPoint(this,e)},t.prototype.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},t.prototype.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.X=new t(1,0,0),t.Y=new t(0,1,0),t.Z=new t(0,0,1),t.ONE=new t(1,1,1),t.ZERO=new t(0,0,0),t}(),Y=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}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setFromEuler=function(t){return t.toQuaternion(this),this},t.prototype.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},t.prototype.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},t.prototype.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){f=2*Math.sqrt(1+r-a-l);this.w=(c-s)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(n+u)/f,this.negate()}else if(a>l){f=2*Math.sqrt(1+a-r-l);this.w=(n-u)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(s+c)/f,this.negate()}else{f=2*Math.sqrt(1+l-r-a);this.w=(o-i)/f,this.x=(n+u)/f,this.y=(s+c)/f,this.z=.25*f,this.negate()}return this},t.prototype.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.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(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()},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(G(this.dot(t),-1,1)))},t.prototype.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},t.prototype.identity=function(){return this.set(0,0,0,1)},t.prototype.invert=function(){return this.conjugate()},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.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},t.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},t.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},t.prototype.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},t.prototype.slerp=function(t,e){var r;if(0===e)return this;if(1===e)return this.copyFrom(t);var i=(r=this).x,n=r.y,o=r.z,a=r.w,s=a*t.w+i*t.x+n*t.y+o*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=a,this.x=i,this.y=n,this.z=o,this;var u=1-s*s;if(u<=Number.EPSILON){var c=1-e;return this.w=c*a+e*this.w,this.x=c*i+e*this.x,this.y=c*n+e*this.y,this.z=c*o+e*this.z,this.normalize(),this}var l=Math.sqrt(u),h=Math.atan2(l,s),f=Math.sin((1-e)*h)/l,p=Math.sin(e*h)/l;return this.w=a*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=o*f+this.z*p,this},t.prototype.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},t.prototype.rotateVector3=function(t,e){var r,i=(r=this).x,n=r.y,o=r.z,a=r.w,s=t.x,u=t.y,c=t.z,l=a*s+n*c-o*u,h=a*u+o*s-i*c,f=a*c+i*u-n*s,p=-i*s-n*u-o*c,d=null!=e?e:t;return d.x=l*a+p*-i+h*-o-f*-n,d.y=h*a+p*-n+f*-i-l*-o,d.z=f*a+p*-o+l*-n-h*-i,d},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},t.prototype.toEuler=function(t){return t.setFromQuaternion(this)},t.prototype.toMatrix4=function(t){return t.compose(H.ZERO,this,H.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},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.tempVec0=new H,t}(),W=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},Z=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},q=function(){function t(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){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===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){var y=this.elements;return y[0]=t,y[1]=e,y[2]=r,y[3]=i,y[4]=n,y[5]=o,y[6]=a,y[7]=s,y[8]=u,y[9]=c,y[10]=l,y[11]=h,y[12]=f,y[13]=p,y[14]=d,y[15]=m,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){var y=this.elements;return y[0]=t,y[4]=e,y[8]=r,y[12]=i,y[1]=n,y[5]=o,y[9]=a,y[13]=s,y[2]=u,y[6]=c,y[10]=l,y[14]=h,y[3]=f,y[7]=p,y[11]=d,y[15]=m,this},t.prototype.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)},t.prototype.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},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},t.prototype.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},t.prototype.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)},t.prototype.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)},t.prototype.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)},t.prototype.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)},t.prototype.setFromEuler=function(t){return t.toMatrix4(this),this},t.prototype.setFromQuaternion=function(t){return this.compose(H.ZERO,t,H.ONE)},t.prototype.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},t.prototype.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)},t.prototype.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.prototype.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]},t.prototype.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])},t.prototype.copyFrom=function(t){return this.elements=Z([],W(t.elements),!1),this},t.prototype.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])},t.prototype.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},t.prototype.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.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],p=r[2],d=r[6],m=r[10],y=r[14],v=r[3],x=r[7],g=r[11],T=r[15],E=i[0],b=i[4],_=i[8],C=i[12],S=i[1],w=i[5],O=i[9],A=i[13],R=i[2],L=i[6],M=i[10],I=i[14],P=i[3],V=i[7],F=i[11],N=i[15];return n[0]=o*E+a*S+s*R+u*P,n[4]=o*b+a*w+s*L+u*V,n[8]=o*_+a*O+s*M+u*F,n[12]=o*C+a*A+s*I+u*N,n[1]=c*E+l*S+h*R+f*P,n[5]=c*b+l*w+h*L+f*V,n[9]=c*_+l*O+h*M+f*F,n[13]=c*C+l*A+h*I+f*N,n[2]=p*E+d*S+m*R+y*P,n[6]=p*b+d*w+m*L+y*V,n[10]=p*_+d*O+m*M+y*F,n[14]=p*C+d*A+m*I+y*N,n[3]=v*E+x*S+g*R+T*P,n[7]=v*b+x*w+g*L+T*V,n[11]=v*_+x*O+g*M+T*F,n[15]=v*C+x*A+g*I+T*N,this},t.prototype.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},t.prototype.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)},t.prototype.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},t.prototype.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],p=t[12],d=t[13],m=t[14],y=t[15],v=l*m*u-d*h*u+d*s*f-a*m*f-l*s*y+a*h*y,x=p*h*u-c*m*u-p*s*f+o*m*f+c*s*y-o*h*y,g=c*d*u-p*l*u+p*a*f-o*d*f-c*a*y+o*l*y,T=p*l*s-c*d*s-p*a*h+o*d*h+c*a*m-o*l*m,E=e*v+r*x+i*g+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]=v*b,t[1]=(d*h*n-l*m*n-d*i*f+r*m*f+l*i*y-r*h*y)*b,t[2]=(a*m*n-d*s*n+d*i*u-r*m*u-a*i*y+r*s*y)*b,t[3]=(l*s*n-a*h*n-l*i*u+r*h*u+a*i*f-r*s*f)*b,t[4]=x*b,t[5]=(c*m*n-p*h*n+p*i*f-e*m*f-c*i*y+e*h*y)*b,t[6]=(p*s*n-o*m*n-p*i*u+e*m*u+o*i*y-e*s*y)*b,t[7]=(o*h*n-c*s*n+c*i*u-e*h*u-o*i*f+e*s*f)*b,t[8]=g*b,t[9]=(p*l*n-c*d*n-p*r*f+e*d*f+c*r*y-e*l*y)*b,t[10]=(o*d*n-p*a*n+p*r*u-e*d*u-o*r*y+e*a*y)*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-p*l*i+p*r*h-e*d*h-c*r*m+e*l*m)*b,t[14]=(p*a*i-o*d*i-p*r*s+e*d*s+o*r*m-e*a*m)*b,t[15]=(o*l*i-c*a*i+c*r*s-e*l*s-o*r*h+e*a*h)*b,this},t.prototype.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},t.prototype.compose=function(t,e,r,i){void 0===i&&(i=H.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,p=a+a,d=s+s,m=o*f,y=o*p,v=o*d,x=a*p,g=a*d,T=s*d,E=u*f,b=u*p,_=u*d,C=r.x,S=r.y,w=r.z;return n[0]=(1-(x+T))*C,n[1]=(y+_)*C,n[2]=(v-b)*C,n[3]=0,n[4]=(y-_)*S,n[5]=(1-(m+T))*S,n[6]=(g+E)*S,n[7]=0,n[8]=(v+b)*w,n[9]=(g-E)*w,n[10]=(1-(m+x))*w,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},t.prototype.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();this.determinant()<0&&(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},t.prototype.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},t.prototype.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]))},t.prototype.getTransform=function(){var t=new H,e=new Y,r=new H;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},t.prototype.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},t.prototype.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},t.prototype.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)},t.prototype.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},t.prototype.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()},t.prototype.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},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!k(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return Z([],W(this.elements),!1)},t.prototype.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,p,d,m,y){return new t(e,o,c,p,r,a,l,d,i,s,h,m,n,u,f,y)},t.IDENTITY=new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),t.ZERO=new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t.tempVec0=new H,t.tempVec1=new H,t.tempVec2=new H,t.tempMat0=new t,t}();!function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(X||(X={}));var Q=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}return t.prototype.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},t.prototype.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},t.prototype.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 X.XYZ:this.y=Math.asin(G(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(l,s),this.z=0);break;case X.YXZ:this.x=Math.asin(-G(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,i),this.z=0);break;case X.ZXY:this.x=Math.asin(G(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-c,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case X.ZYX:this.y=Math.asin(-G(c,-1,1)),Math.abs(c)<.9999999?(this.x=Math.atan2(l,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case X.YZX:this.z=Math.asin(G(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,i)):(this.x=0,this.y=Math.atan2(o,h));break;case X.XZY:this.z=Math.asin(-G(n,-1,1)),Math.abs(n)<.9999999?(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*=z,this.y*=z,this.z*=z,this.order=e,this},t.prototype.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},t.prototype.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},t.prototype.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])&&void 0!==i?i:0,this.y=null!==(n=t[e+1])&&void 0!==n?n:0,this.z=null!==(o=t[e+2])&&void 0!==o?o:0,this.order=null!==(a=t[e+3])&&void 0!==a?a:r,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.order)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},t.prototype.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},t.prototype.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.reorder=function(t){var e=new Y;return e.setFromEuler(this),this.setFromQuaternion(e,t)},t.prototype.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},t.prototype.toVector3=function(t){return t.set(this.x,this.y,this.z)},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toQuaternion=function(t){var e,r=(e=this).x,i=e.y,n=e.z,o=e.order,a=Math.cos(r*D*.5),s=Math.cos(i*D*.5),u=Math.cos(n*D*.5),c=Math.sin(r*D*.5),l=Math.sin(i*D*.5),h=Math.sin(n*D*.5);switch(o){case X.XYZ:t.set(c*s*u+a*l*h,a*l*u-c*s*h,a*s*h+c*l*u,a*s*u-c*l*h);break;case X.YXZ:t.set(c*s*u+a*l*h,a*l*u-c*s*h,a*s*h-c*l*u,a*s*u+c*l*h);break;case X.ZXY:t.set(c*s*u-a*l*h,a*l*u+c*s*h,a*s*h+c*l*u,a*s*u-c*l*h);break;case X.ZYX:t.set(c*s*u-a*l*h,a*l*u+c*s*h,a*s*h-c*l*u,a*s*u+c*l*h);break;case X.YZX:t.set(c*s*u+a*l*h,a*l*u+c*s*h,a*s*h-c*l*u,a*s*u-c*l*h);break;case X.XZY:t.set(c*s*u-a*l*h,a*l*u-c*s*h,a*s*h+c*l*u,a*s*u+c*l*h);break;default:console.error("unknown euler order: "+o)}return t},t.prototype.toMatrix4=function(t){var e,r=t.elements,i=(e=this).x,n=e.y,o=e.z,a=e.order,s=Math.cos(i*D),u=Math.sin(i*D),c=Math.cos(n*D),l=Math.sin(n*D),h=Math.cos(o*D),f=Math.sin(o*D);if(a===X.XYZ){var p=s*h,d=s*f,m=u*h,y=u*f;r[0]=c*h,r[4]=-c*f,r[8]=l,r[1]=d+m*l,r[5]=p-y*l,r[9]=-u*c,r[2]=y-p*l,r[6]=m+d*l,r[10]=s*c}else if(a===X.YXZ){var v=c*h,x=c*f,g=l*h,T=l*f;r[0]=v+T*u,r[4]=g*u-x,r[8]=s*l,r[1]=s*f,r[5]=s*h,r[9]=-u,r[2]=x*u-g,r[6]=T+v*u,r[10]=s*c}else if(a===X.ZXY){v=c*h,x=c*f,g=l*h,T=l*f;r[0]=v-T*u,r[4]=-s*f,r[8]=g+x*u,r[1]=x+g*u,r[5]=s*h,r[9]=T-v*u,r[2]=-s*l,r[6]=u,r[10]=s*c}else if(a===X.ZYX){p=s*h,d=s*f,m=u*h,y=u*f;r[0]=c*h,r[4]=m*l-d,r[8]=p*l+y,r[1]=c*f,r[5]=y*l+p,r[9]=d*l-m,r[2]=-l,r[6]=u*c,r[10]=s*c}else if(a===X.YZX){var E=s*c,b=s*l,_=u*c,C=u*l;r[0]=c*h,r[4]=C-E*f,r[8]=_*f+b,r[1]=f,r[5]=s*h,r[9]=-u*h,r[2]=-l*h,r[6]=b*f+_,r[10]=E-C*f}else if(a===X.XZY){E=s*c,b=s*l,_=u*c,C=u*l;r[0]=c*h,r[4]=-f,r[8]=l*h,r[1]=E*f+C,r[5]=s*h,r[9]=b*f-_,r[2]=_*f-b,r[6]=u*h,r[10]=C*f+E}else console.error("toMatrix4: Invalid order "+a);return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[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.DEFAULT_ORDER=X.ZYX,t.tempQuat0=new Y,t.tempMat0=new q,t}(),K=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}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this.w=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):t instanceof 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},t.prototype.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},t.prototype.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},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):t instanceof 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},t.prototype.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},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):t instanceof 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},t.prototype.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},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):t instanceof 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},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z+this.w},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.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},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.isZero=function(){var t,e=U,r=(t=this).x,i=t.y,n=t.z,o=t.w;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e&&Math.abs(o)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector3=function(){return new H(this.x,this.y,this.z)},t.prototype.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},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},t.prototype.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.ONE=new t(1,1,1,1),t.ZERO=new t(0,0,0,0),t}(),J=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},$=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},tt=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]}return t.prototype.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},t.prototype.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},t.prototype.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)},t.prototype.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])},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},t.prototype.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,p=i*s,d=n*o,m=n*a,y=n*s,v=this.elements;return v[0]=1-(h+p),v[1]=c+y,v[2]=l-m,v[3]=c-y,v[4]=1-(u+p),v[5]=f+d,v[6]=l+m,v[7]=f-d,v[8]=1-(u+h),this},t.prototype.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},t.prototype.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])},t.prototype.copyFrom=function(t){return this.elements=$([],J(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.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],p=r[8],d=i[0],m=i[3],y=i[6],v=i[1],x=i[4],g=i[7],T=i[2],E=i[5],b=i[8];return n[0]=o*d+a*v+s*T,n[3]=o*m+a*x+s*E,n[6]=o*y+a*g+s*b,n[1]=u*d+c*v+l*T,n[4]=u*m+c*x+l*E,n[7]=u*y+c*g+l*b,n[2]=h*d+f*v+p*T,n[5]=h*m+f*x+p*E,n[8]=h*y+f*g+p*b,this},t.prototype.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)},t.prototype.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,p=e*l+n*h+s*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;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},t.prototype.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},t.prototype.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},t.prototype.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!k(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return $([],J(this.elements),!1)},t.prototype.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}(),et=function(){function t(t,e){void 0===t&&(t=H.ZERO),void 0===e&&(e=H.X),this.origin=new H,this.direction=new H,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}return t.prototype.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},t.prototype.clone=function(){return new t(this.origin,this.direction)},t.prototype.copyFrom=function(t){return this.set(t.origin,t.direction)},t.prototype.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},t.prototype.at=function(t,e){var r=e||new H;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},t.prototype.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},t.prototype.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},t.prototype.intersectBox=function(t,e){var r,i,n,o,a,s,u,c,l,h,f=(r=this.origin).x,p=r.y,d=r.z,m=(i=this.direction).x,y=i.y,v=i.z,x=(n=t.min).x,g=n.y,T=n.z,E=(o=t.max).x,b=o.y,_=o.z,C=1/m,S=1/y,w=1/v;if(C>=0?(a=(x-f)*C,s=(E-f)*C):(a=(E-f)*C,s=(x-f)*C),S>=0?(u=(g-p)*S,c=(b-p)*S):(u=(b-p)*S,c=(g-p)*S),!(a>c||u>s||((u>a||a!=a)&&(a=u),(c<s||s!=s)&&(s=c),(u>a||a!=a)&&(a=u),(c<s||s!=s)&&(s=c),w>=0?(l=(T-d)*w,h=(_-d)*w):(l=(_-d)*w,h=(T-d)*w),a>h||l>s||((l>a||a!=a)&&(a=l),(h<s||s!=s)&&(s=h),s<0))))return a>=0?this.at(a,e):this.at(s,e)},t.prototype.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 H).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},t.prototype.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)}},t.prototype.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 p=n*this.direction.dot(c);if(!(p<0)){u.cross(l);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*l.dot(h);if(!(m<0))return this.at(m/f,r)}}},t.tempVec0=new H,t.tempVec1=new H,t.tempVec2=new H,t.tempVec3=new H,t}(),rt=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}return t.prototype.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},t.prototype.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},t.prototype.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},t.prototype.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.r=null!==(r=t[e])&&void 0!==r?r:0,this.g=null!==(i=t[e+1])&&void 0!==i?i:0,this.b=null!==(n=t[e+2])&&void 0!==n?n:0,this.a=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.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)},t.prototype.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)},t.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):t instanceof 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},t.prototype.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):t instanceof 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},t.prototype.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):t instanceof 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},t.prototype.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):t instanceof 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},t.prototype.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.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},t.prototype.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},t.prototype.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},t.prototype.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},t.prototype.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},t.prototype.toArray=function(){return[this.r,this.g,this.b,this.a]},t.prototype.toVector4=function(){return new K(this.r,this.g,this.b,this.a)},t.prototype.toHSV=function(){var e,r=(e=this).r,i=e.g,n=e.b,o=e.a,a=Math.max(r,i,n),s=Math.min(r,i,n),u=a-s,c=0,l=0;return 0!==a&&(l=u/a),a!=s&&(a==r?(c=(i-n)/u,i<n&&(c+=6)):a==i?c=(n-r)/u+2:a==n&&(c=(r-i)/u+4),c*=60),new t(c,l,a,o)},t.prototype.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},t.prototype.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.BLACK=new t(0,0,0,1),t.BLUE=new t(0,0,1,1),t.CLEAR=new t(0,0,0,0),t.CYAN=new t(0,1,1,1),t.GRAY=new t(.5,.5,.5,1),t.GREEN=new t(0,1,0,1),t.MAGENTA=new t(1,0,1,1),t.RED=new t(1,0,0,1),t.WHITE=new t(1,1,1,1),t.YELLOW=new t(1,.92,.016,1),t}(),it=function(){function t(t,e){void 0===t&&(t=new H(1/0,1/0,1/0)),void 0===e&&(e=new H(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}return t.prototype.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},t.prototype.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},t.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},t.prototype.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},t.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},t.prototype.clone=function(){return(new t).copyFrom(this)},t.prototype.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},t.prototype.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},t.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},t.prototype.getCenter=function(t){return void 0===t&&(t=new H),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},t.prototype.getSize=function(t){return void 0===t&&(t=new H),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},t.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},t.prototype.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},t.prototype.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},t.prototype.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.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},t.prototype.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)},t.prototype.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},t.prototype.getParameter=function(t,e){return void 0===e&&(e=new H),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))},t.prototype.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)},t.prototype.intersectsSphere=function(t){var e=new H;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},t.prototype.clampPoint=function(t,e){return void 0===e&&(e=new H),e.copyFrom(t).clamp(this.min,this.max)},t.prototype.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},t.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},t.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.applyMatrix4=function(t,e){if(void 0===e&&(e=new H),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},t.prototype.getOBBPoints=function(t,e){if(void 0===e&&(e=new H),this.isEmpty())return[];var r=[];return r[0]=new H(this.min.x,this.min.y,this.min.z),r[1]=new H(this.min.x,this.min.y,this.max.z),r[2]=new H(this.min.x,this.max.y,this.min.z),r[3]=new H(this.min.x,this.max.y,this.max.z),r[4]=new H(this.max.x,this.min.y,this.min.z),r[5]=new H(this.max.x,this.min.y,this.max.z),r[6]=new H(this.max.x,this.max.y,this.min.z),r[7]=new H(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},t.prototype.getBoundingSphere=function(t){this.getCenter(t.center);var e=new H;return t.radius=.5*this.getSize(e).length(),t},t.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},t.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),nt=function(){function t(t,e){void 0===t&&(t=H.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}return t.prototype.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},t.prototype.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 it).setFromPoints(t);o.getCenter(r),this.radius=o.getSize().length()/2}return this},t.prototype.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},t.prototype.isEmpty=function(){return this.radius<0},t.prototype.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},t.prototype.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},t.prototype.distanceToPoint=function(t){return t.distance(this.center)-this.radius},t.prototype.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},t.prototype.intersectsBox=function(t){return t.intersectsSphere(this)},t.prototype.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new H),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},t.prototype.getBoundingBox=function(t){return void 0===t&&(t=new it),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},t.prototype.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],o=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},t.prototype.translate=function(t){return this.center.add(t),this},t.prototype.expandByPoint=function(t){var e=(new H).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},t.prototype.union=function(t){var e=new H,r=new H;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},t.prototype.intersect=function(t){var e=(new H).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)},t.prototype.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t.prototype.clone=function(){return(new t).copyFrom(this)},t}(),ot=Object.freeze({__proto__:null,get EulerOrder(){return X},Euler:Q,Quaternion:Y,Vector2:j,Vector3:H,Vector4:K,Matrix3:tt,Matrix4:q,Ray:et,PI2:N,DEG2RAD:D,RAD2DEG:z,NumberEpsilon:U,isZero:function(t){return isNaN(t)||Math.abs(t)<U},isEqual:k,damp:function(t,e,r,i){return B(t,e,1-Math.exp(-r*i))},lerp:B,degToRad:function(t){return t*D},radToDeg:function(t){return t*z},clamp:G,Color:rt,Box3:it,Sphere:nt});new Q,new H(1,1,1),new H(0,0,0);var at,st="[Galacean Effects]";function ut(t){return["%c".concat(st),"background: #AA0100; color: white","".concat(t)]}var ct,lt={error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.error.apply(console,f(f([],h(ut(t)),!1),[e],!1)),null==at||at("error",t,e)},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.debug.apply(console,f([],h(ut(t)),!1)),null==at||at("info",t,e)},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.warn.apply(console,f([],h(ut(t)),!1)),null==at||at("warn",t,e)},register:function(t){t&&St(t)&&(at=t)}};function ht(){}function ft(t){return"string"==typeof t}t.DestroyOptions=void 0,(ct=t.DestroyOptions||(t.DestroyOptions={}))[ct.destroy=0]="destroy",ct[ct.keep=1]="keep",ct[ct.force=0]="force";var pt,dt,mt,yt,vt,xt,gt,Tt,Et,bt,_t,Ct=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function St(t){return"[object Function]"===Object.prototype.toString.call(t)}function wt(t){return"[object Object]"===Object.prototype.toString.call(t)}function Ot(t,e){return t+Math.random()*(e-t)}function At(){throw Error("destroyed item cannot be used again")}function Rt(){return g().replace(/-/g,"")}
|
|
9
|
-
/*!
|
|
10
|
-
* Name: @galacean/effects-specification
|
|
11
|
-
* Description: Galacean Effects JSON Specification
|
|
12
|
-
* Author: Ant Group CO., Ltd.
|
|
13
|
-
* Version: v1.0.1
|
|
14
|
-
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(pt||(pt={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(dt||(dt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(mt||(mt={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(yt||(yt={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(vt||(vt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(xt||(xt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(gt||(gt={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Tt||(Tt={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(Et||(Et={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(bt||(bt={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(_t||(_t={}));var Lt,Mt,It,Pt,Vt,Ft,Nt,Dt;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(Lt||(Lt={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Mt||(Mt={})),function(t){t[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"}(It||(It={})),function(t){t[t.AUTO=0]="AUTO",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.LINE=4]="LINE",t[t.HOLD=5]="HOLD",t[t.LINE_OUT=6]="LINE_OUT"}(Pt||(Pt={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(Vt||(Vt={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Ft||(Ft={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Nt||(Nt={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(Dt||(Dt={}));var zt,Ut,kt,Bt,Gt,Xt,jt,Ht,Yt;!function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(zt||(zt={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ut||(Ut={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(kt||(kt={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive"}(Bt||(Bt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(Gt||(Gt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Xt||(Xt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(jt||(jt={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Ht||(Ht={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Yt||(Yt={}));var Wt=Object.freeze({__proto__:null,get BezierKeyframeType(){return Pt},get BlendingMode(){return dt},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return Lt},get CompositionEndBehavior(){return Mt},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return Yt},get InteractBehavior(){return Tt},get InteractType(){return gt},get ItemEndBehavior(){return Vt},get ItemType(){return Et},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return yt},get MaterialBlending(){return kt},get MaterialType(){return Ut},get ModelBoundingType(){return zt},get ParentItemEndBehavior(){return Ft},get ParticleInteractionBehavior(){return Nt},get ParticleOrigin(){return _t},get PluginType(){return xt},get RenderLevel(){return pt},get RenderMode(){return bt},get RenderMode3D(){return Bt},get ShapeArcMode(){return Dt},get ShapeType(){return vt},get SideMode(){return mt},get TextAlignment(){return jt},get TextBaseline(){return Xt},get TextOverflow(){return Gt},get TextWeight(){return Ht},get ValueType(){return It}}),Zt={},qt={},Qt={};function Kt(t){var e=t.constructor.name;if(Qt[e])return Qt[e];Qt[e]={};for(var r=Qt[e],i=t,n=e;n;){var o=qt[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 Jt(t){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor.name;return qt[e]||(qt[e]={}),qt[e]}(r);n[i]||(n[i]={type:t,sourceName:e})}}(0,t)}function $t(t){return function(e,r){Zt[t]&&console.warn("Class "+t+" 重复注册"),Zt[t]=e}}var te,ee=function(){function t(t){this.engine=t,this.guid=Rt(),this.taggedProperties={},this.engine.addInstance(this)}return t.prototype.getInstanceId=function(){return this.guid},t.prototype.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},t.prototype.toData=function(){},t.prototype.fromData=function(t){t.id&&this.setInstanceId(t.id)},t.prototype.dispose=function(){},s([Jt()],t.prototype,"guid",void 0),t}(),re=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.item.transform},enumerable:!1,configurable:!0}),e.prototype.onAttached=function(){},e.prototype.onDestroy=function(){},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},e.prototype.dispose=function(){this.onDestroy(),this.item&&E(this.item.components,this)},e}(ee),ie=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._enabled=!0,e}return o(e,t),Object.defineProperty(e.prototype,"isActiveAndEnabled",{get:function(){return this.item.getVisible()&&this.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onBehaviourEnable()},enumerable:!1,configurable:!0}),e.prototype.onBehaviourEnable=function(){},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e)},e.prototype.toData=function(){t.prototype.toData.call(this)},s([Jt()],e.prototype,"_enabled",void 0),e}(re),ne=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.started=!1,e}return o(e,t),e.prototype.onEnable=function(){},e.prototype.start=function(){},e.prototype.update=function(t){},e.prototype.lateUpdate=function(t){},e.prototype.onAttached=function(){this.item.itemBehaviours.push(this)},e.prototype.dispose=function(){this.item&&E(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},e.prototype.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(ie),oe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.started=!1,e.materials=[],e._enabled=!0,e}return o(e,t),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},set:function(t){this._priority=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActiveAndEnabled",{get:function(){return this.item.getVisible()&&this.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t},enumerable:!1,configurable:!0}),e.prototype.onEnable=function(){},e.prototype.start=function(){},e.prototype.update=function(t){},e.prototype.lateUpdate=function(t){},e.prototype.render=function(t){},e.prototype.onAttached=function(){this.item.rendererComponents.push(this)},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e)},e.prototype.toData=function(){t.prototype.toData.call(this)},e.prototype.dispose=function(){this.item&&E(this.item.rendererComponents,this),t.prototype.dispose.call(this)},s([Jt()],e.prototype,"materials",void 0),s([Jt()],e.prototype,"_priority",void 0),s([Jt()],e.prototype,"_enabled",void 0),e}(re);t.ShaderType=void 0,(te=t.ShaderType||(t.ShaderType={}))[te.vertex=0]="vertex",te[te.fragment=1]="fragment";var ae,se=[],ue={};function ce(){"function"==typeof WebGL2RenderingContext?le(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(le(WebGLRenderingContext),le(WebGLRenderingContext.prototype)):se.push("iOS16 lockdown mode, WebGL Constants not in global"),se.length||"HALF_FLOAT"in ue||(ue.HALF_FLOAT=5131)}function le(t){for(var e in t)/^[A-Z_]/.test(e)&&(ue[e]=t[e])}function he(t){switch(t){case dt.ALPHA:case dt.ADD:case dt.SUBTRACTION:case dt.STRONG_LIGHT:case dt.WEAK_LIGHT:return 1;case dt.SUPERPOSITION:return 2;case dt.BRIGHTNESS:return 3;case dt.MULTIPLY:return 0;default:return 1}}se.length||ce();var fe,pe,de=((ae={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},ae[t.ShaderType.fragment]={in:"varying"},ae);function me(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach((function(t){var e=h(t,2),r=e[0],i=e[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(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=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(t){var e;return null!==(e=de[r][t])&&void 0!==e?e:t}))),s=s.replace(l,"\n")}return s}function ye(t,e){switch(e){case void 0:case dt.ALPHA:t.blendFunction=[ue.ONE,ue.ONE_MINUS_SRC_ALPHA,ue.ONE,ue.ONE_MINUS_SRC_ALPHA];break;case dt.ADD:t.blendFunction=[ue.ONE,ue.ONE,ue.ONE,ue.ONE];break;case dt.SUBTRACTION:t.blendFunction=[ue.ONE,ue.ONE,ue.ZERO,ue.ONE],t.blendEquation=[ue.FUNC_REVERSE_SUBTRACT,ue.FUNC_REVERSE_SUBTRACT];break;case dt.SUPERPOSITION:t.blendFunction=[ue.ONE,ue.ONE,ue.ONE,ue.ONE];break;case dt.MULTIPLY:t.blendFunction=[ue.DST_COLOR,ue.ONE_MINUS_SRC_ALPHA,ue.DST_COLOR,ue.ONE_MINUS_SRC_ALPHA];break;case dt.BRIGHTNESS:t.blendFunction=[ue.ONE,ue.ONE_MINUS_SRC_ALPHA,ue.ONE,ue.ONE_MINUS_SRC_ALPHA];break;case dt.STRONG_LIGHT:t.blendFunction=[ue.DST_COLOR,ue.DST_ALPHA,ue.ZERO,ue.ONE];break;case dt.WEAK_LIGHT:t.blendFunction=[ue.DST_COLOR,ue.ZERO,ue.ZERO,ue.ONE];break;default:console.warn("blendMode ".concat(e," not in specification, please set blend params separately"))}}function ve(t,e){e===mt.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=ue.CW,t.cullFace=e===mt.BACK?ue.BACK:ue.FRONT)}function xe(t,e){switch(e){case void 0:t.stencilTest=!1;break;case yt.MASK:t.stencilTest=!0,t.stencilFunc=[ue.ALWAYS,ue.ALWAYS],t.stencilOpZPass=[ue.REPLACE,ue.REPLACE];break;case yt.OBSCURED:t.stencilTest=!0,t.stencilFunc=[ue.EQUAL,ue.EQUAL];break;case yt.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[ue.NOTEQUAL,ue.NOTEQUAL];break;case yt.NONE:t.stencilTest=!1;break;default:console.warn("maskMode ".concat(e," not in specification, please set stencil params seperately"))}}t.TextureLoadAction=void 0,(fe=t.TextureLoadAction||(t.TextureLoadAction={}))[fe.whatever=0]="whatever",fe[fe.clear=2]="clear",t.TextureSourceType=void 0,(pe=t.TextureSourceType||(t.TextureSourceType={}))[pe.none=0]="none",pe[pe.data=1]="data",pe[pe.image=2]="image",pe[pe.compressed=3]="compressed",pe[pe.video=4]="video",pe[pe.canvas=5]="canvas",pe[pe.framebuffer=6]="framebuffer",pe[pe.mipmaps=7]="mipmaps";var ge=function(){function t(){this.callbacks={}}return t.prototype.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},t.prototype.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},t.prototype.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},t.prototype.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()}},t.prototype.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},t.prototype.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}(),Te=!1;function Ee(t,e){return u(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return!Te&&e?[3,2]:[4,be(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,be(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Te=!0,[4,be(t)];case 6:return[2]}}))}))}function be(t){return u(this,void 0,void 0,(function(){var e,r;return c(this,(function(i){if(e="",t instanceof HTMLImageElement){if(t.complete)return[2,t];e=t.src}else t instanceof Blob?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: ".concat(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: ".concat(e,", reason: ").concat(JSON.stringify(t)))},n.src=e}))]}))}))}function _e(t){return u(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e,r){(new ge).downloadBinary(t,e,(function(e,i){r("Couldn't load bins ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))}function Ce(t,e){return void 0===e&&(e={}),u(this,void 0,void 0,(function(){var r;return c(this,(function(i){return r=document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,e.loop&&r.addEventListener("ended",(function(){return r.play()})),A()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e(t)}))}))]}))}))}function Se(e,r,i){return void 0===i&&(i=[]),u(this,void 0,void 0,(function(){var n,o,s,u,l,h,f;return c(this,(function(c){switch(c.label){case 0:return 34067!==e.target?[3,2]:(s=(n=e).mipmaps,u=n.target,l=s.map((function(t){return Promise.all(t.map((function(t){return we(t,r)})))})),[4,Promise.all(l)]);case 1:return h=c.sent(),f=i[s[0][0][1][0]].url,[2,a(a({keepImageSource:!1},e),{mipmaps:h,sourceFrom:{target:u,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:s.map((function(t){return t.map((function(t){return[t[1][1],t[1][2]]}))}))}})];case 2:return s=(o=e).mipmaps,u=o.target,l=s.map((function(t){return we(t,r)})),[4,Promise.all(l)];case 3:return h=c.sent(),f=i[s[0][1][0]].url,[2,a(a({keepImageSource:!1},e),{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:u,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:s.map((function(t){return[t[1][1],t[1][2]]}))}})]}}))}))}function we(t,e){return u(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){if(r=h(t[1],3),i=r[0],n=r[1],o=r[2],!(a=e[i]))throw new Error("invalid bin pointer: ".concat(JSON.stringify(t)));return[2,be(new Blob([new Uint8Array(a,n,o)]))]}))}))}var Oe=1,Ae=function(e){function r(t){var r=e.call(this,t)||this;return r.destroyed=!1,r.id="Tex"+Oe++,r}return o(r,e),Object.defineProperty(r.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),r.prototype.getWidth=function(){return this.width||0},r.prototype.getHeight=function(){return this.height||0},r.prototype.uploadCurrentVideoFrame=function(){},r.prototype.offloadData=function(){},r.prototype.reloadData=function(){},r.prototype.initialize=function(){},r.prototype.assembleOptions=function(e){var r=e.target,i=void 0===r?ue.TEXTURE_2D:r,n=e.format,o=void 0===n?ue.RGBA:n;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:0),a({minFilter:ue.NEAREST,magFilter:ue.NEAREST,wrapS:ue.CLAMP_TO_EDGE,wrapT:ue.CLAMP_TO_EDGE,target:i,format:ue.RGBA,internalFormat:o,type:ue.UNSIGNED_BYTE},e)},r}(ee);function Re(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?ue.RGBA:3===a?ue.RGB:2===a?ue.LUMINANCE_ALPHA:ue.LUMINANCE,Ae.createWithData(t,{data:e,width:r,height:i},{type:ue.HALF_FLOAT,format:n,internalFormat:o,wrapS:ue.CLAMP_TO_EDGE,wrapT:ue.CLAMP_TO_EDGE})}var Le=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);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?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:lt.warn("Number of faces expected"+e+", but found "+this.numberOfFaces):lt.warn("Texture arrays not currently supported"):lt.warn("Only 2D textures currently supported")}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,r+=3-(s+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function Me(e){var r=new Le(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,c=r.glFormat,l=i>=Math.floor(Math.log2(Math.max(n,o))+1);return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?ue.TEXTURE_CUBE_MAP:ue.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var Ie,Pe=function(){function e(){this.reloadPending={}}return e.prototype.reload=function(t){return u(this,void 0,void 0,(function(){var e,r;return c(this,(function(i){switch(i.label){case 0:return e=t.id,this.reloadPending[e]?[2]:t.sourceFrom?(this.reloadPending[e]=!0,[4,this.loadSource(t.sourceFrom)]):[3,2];case 1:return r=i.sent(),t.updateSource(r),this.reloadPending[e]=!1,[3,3];case 2:throw new Error("No source from");case 3:return[2]}}))}))},e.prototype.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e,n=i.target,o=i.map,a=e.url;return n===ue.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:ft(a)&&a.length>0}if(r===t.TextureSourceType.mipmaps){var s=e,u=s.bin,c=s.mipmaps,l=e,h=(n=l.target,l.maps),f=e.urls;return u?c.length>0:n===ue.TEXTURE_CUBE_MAP?h.every((function(t){return"object"==typeof t&&t})):f.every((function(t){return ft(t)&&t.length>0}))}}return!1},e.prototype.loadSource=function(e,r){return u(this,void 0,void 0,(function(){var i,n,o,s,u,l,h,f,p,d,m,y,v,x,g,T,E,b=this;return c(this,(function(c){switch(c.label){case 0:return i=e.type,n=e.target,o=e.map,s=e.url,l=(u=e).bin,h=u.mipmaps,f=e.urls,p=e.maps,n!==ue.TEXTURE_CUBE_MAP||i===t.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return d=c.sent(),[2,a(a({},r),{cube:d,target:ue.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:a({},o),target:ue.TEXTURE_CUBE_MAP}})];case 2:return i!==t.TextureSourceType.image?[3,4]:[4,be(s)];case 3:return m=c.sent(),[2,a(a({},r),{image:m,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:s,target:ue.TEXTURE_2D}})];case 4:return i!==t.TextureSourceType.video?[3,6]:[4,Ce(s)];case 5:return y=c.sent(),[2,a(a({},r),{video:y,sourceType:t.TextureSourceType.video})];case 6:return i!==t.TextureSourceType.compressed?[3,8]:[4,_e(s)];case 7:return v=c.sent(),[2,a(a(a({},Me(v)),r),{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:return i!==t.TextureSourceType.mipmaps?[3,17]:l?[4,_e(l)]:[3,13];case 9:return x=c.sent(),g=null!=n?n:ue.TEXTURE_2D,T=g===ue.TEXTURE_2D?h.slice():h.map((function(t){return t.slice()})),E=void 0,n!==ue.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(h.map((function(t){return b.loadMipmapImages(t,x)})))];case 10:return E=c.sent(),[3,12];case 11:E=this.loadMipmapImages(h,x),c.label=12;case 12:return[2,a(a({},r),{mipmaps:E,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:l,mipmaps:T,target:g,type:t.TextureSourceType.mipmaps}})];case 13:return n!==ue.TEXTURE_2D&&n?[3,15]:[4,Promise.all(f.map((function(t){return be(t)})))];case 14:return E=c.sent(),[2,a(a({},r),{mipmaps:E,target:ue.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:f.slice(),target:ue.TEXTURE_2D}})];case 15:return n!==ue.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(p.map((function(t){return b.loadCubeMap(t)})))];case 16:return E=c.sent(),[2,a(a({},r),{mipmaps:E,target:ue.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:p.map((function(t){return a({},t)})),target:ue.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},e.prototype.loadMipmapImages=function(t,e){return u(this,void 0,void 0,(function(){return c(this,(function(r){return[2,Promise.all(t.map((function(t){return be(new Blob([new Uint8Array(e,t[0],t[1])]))})))]}))}))},e.prototype.loadCubeMap=function(t){return u(this,void 0,void 0,(function(){return c(this,(function(e){return[2,Promise.all(t.map((function(t){return be(t)})))]}))}))},e}();var Ve,Fe=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}return t.prototype.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},t.prototype.invalidAllFlags=function(){},t.prototype.updateUniformSubData=function(t,e,r){},t}();function Ne(t){return"object"==typeof t&&t&&void 0===t.length&&t instanceof Ae}t.MaterialRenderType=void 0,(Ve=t.MaterialRenderType||(t.MaterialRenderType={}))[Ve.normal=0]="normal",Ve[Ve.transformFeedback=1]="transformFeedback";var De,ze,Ue=1,ke=function(e){function r(r,i){var n=e.call(this,r)||this;if(n.destroyed=!1,n.initialized=!1,i){var o=i.name,s=void 0===o?"Material"+Ue++:o,u=i.renderType,c=void 0===u?t.MaterialRenderType.normal:u,l=i.shader,h=i.uniformSemantics;n.name=s,n.renderType=c,n.shaderSource=l,n.props=i,n.uniformSemantics=a({},h)}else n.name="Material"+Ue++,n.renderType=t.MaterialRenderType.normal;return n}return o(r,e),Object.defineProperty(r.prototype,"blending",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"frontFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendColor",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthRange",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"colorMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{set:function(t){},enumerable:!1,configurable:!0}),r.prototype.initialize=function(){},r.prototype.use=function(t,e){},r}(ee),Be="uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}";t.ShaderCompileResultStatus=void 0,(De=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[De.noShader=0]="noShader",De[De.success=1]="success",De[De.fail=2]="fail",De[De.compiling=3]="compiling",t.GLSLVersion=void 0,(ze=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",ze.GLSL3="300 es";var Ge=function(t){function e(e,r){var i=t.call(this,e)||this;return i.source=r,i}return o(e,t),e}(ee),Xe="effects-internal-copy",je="effects-internal-copy-mesh",He="\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}",Ye="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\n".concat(Be,"\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 fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n");function We(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:Xe,vertex:me([],n+"\n"+He,t.ShaderType.vertex,e),fragment:me([],n+"\n"+Ye,t.ShaderType.fragment,e),glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:je+ +r}}var Ze,qe={format:ue.RGBA,type:ue.UNSIGNED_BYTE,minFilter:ue.LINEAR,magFilter:ue.LINEAR,wrapS:ue.CLAMP_TO_EDGE,wrapT:ue.CLAMP_TO_EDGE},Qe=Symbol("dispose"),Ke=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}return e.prototype.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(qe).forEach((function(t){var r,i=null!==(r=e[t])&&void 0!==r?r:qe[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;F(l),c=Ae.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[Qe]=c.dispose,c.dispose=function(){return r.removeTexture(u)}}return c},e.prototype.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[Qe](),r.dispose=r[Qe]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.prototype.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var r=t.textureCache[e];r[Qe](),r.dispose=r[Qe]})),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),Je=function(){function t(t){void 0===t&&(t={}),this.semantics=a({},t)}return t.prototype.toObject=function(){return a({},this.semantics)},t.prototype.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},t.prototype.getSemanticValue=function(t,e){var r=this.semantics[t];return St(r)?r(e):r},t.prototype.hasSemanticValue=function(t){return t in this.semantics},t.prototype.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),$e=((Ze={})[ue.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Ze[ue.INT]=Int32Array.BYTES_PER_ELEMENT,Ze[ue.SHORT]=Int16Array.BYTES_PER_ELEMENT,Ze[ue.BYTE]=Int8Array.BYTES_PER_ELEMENT,Ze),tr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.initialize=function(){},e.prototype.flush=function(){},e}(ee);function er(t){return t===ue.INT?new Int32Array(0):t===ue.SHORT?new Int16Array(0):new Float32Array(0)}var rr,ir,nr=1,or=function(e){function r(t,r){var i=e.call(this,t)||this;if(i.destroyed=!1,i.visible=!0,r){var n=r.material,o=r.geometry,a=r.name,s=void 0===a?"<unnamed>":a,u=r.priority,c=void 0===u?0:u,l=r.worldMatrix,h=void 0===l?q.fromIdentity():l;i.id="Mesh"+nr++,i.name=s,i.geometry=o,i.material=n,i.priority=c,i.worldMatrix=h}else i.id="Mesh"+nr++,i.name="<unnamed>",i.worldMatrix=q.fromIdentity(),i._priority=0;return i}return o(r,e),Object.defineProperty(r.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(t){this.visible=t},r.prototype.getVisible=function(){return this.visible},r.prototype.render=function(t){if(!this.isDestroyed&&this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),r.flush(),t.drawGeometry(r,e)}},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},r.prototype.restore=function(){},r.prototype.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)}},r}(oe),ar=1e3;t.RenderPassAttachmentStorageType=void 0,(rr=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[rr.none=0]="none",rr[rr.color=1]="color",rr[rr.stencil_8_opaque=2]="stencil_8_opaque",rr[rr.depth_16_opaque=3]="depth_16_opaque",rr[rr.depth_stencil_opaque=4]="depth_stencil_opaque",rr[rr.depth_16_texture=5]="depth_16_texture",rr[rr.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(ir=t.TextureStoreAction||(t.TextureStoreAction={}))[ir.store=0]="store",ir[ir.clear=2]="clear";var sr,ur=function(){function e(e,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof Ae)this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,s=i.wrapS,u=i.minFilter,c=i.magFilter,l=i.internalFormat,h=i.format,f=void 0===h?ue.RGBA:h,p=i.type,d=void 0===p?ue.UNSIGNED_BYTE:p;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:d,internalFormat:l||f,wrapT:o,wrapS:s,minFilter:u,magFilter:c,name:r.name},this.texture=Ae.create(e,a(a({},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)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"storageType",{get:function(){return t.RenderPassAttachmentStorageType.color},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),e}();t.RenderPassDestroyAttachmentType=void 0,(sr=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[sr.force=0]="force",sr[sr.keep=1]="keep",sr[sr.keepExternal=2]="keepExternal",sr[sr.destroy=0]="destroy";var cr=1,lr=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+cr++:i,o=r.clearAction,s=r.semantics,u=r.depthStencilAttachment,c=r.storeAction,l=r.priority,h=void 0===l?0:l,f=r.meshOrder,p=void 0===f?t.OrderType.ascending:f,d=r.meshes,m=void 0===d?[]:d,y=r.delegate,v=void 0===y?{}:y;this.name=n,this.renderer=e,this.priority=h,this.meshOrder=p,this.meshes=M(m.slice(),this.meshOrder),this.depthStencilType=(null==u?void 0:u.storageType)||t.RenderPassAttachmentStorageType.none,this.clearAction=a({},o),this.storeAction=a({colorAction:t.TextureStoreAction.store,depthAction:t.TextureStoreAction.store,stencilAction:t.TextureStoreAction.store},c),this.semantics=new Je(s),this.options=r,this.delegate=v,this.setViewportOptions(r)}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),e.prototype.addMesh=function(t){I(this.meshes,t,this.meshOrder)},e.prototype.removeMesh=function(t){E(this.meshes,t)},e.prototype.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,f([0,0],h(t),!1)),M(this.meshes,this.meshOrder),this.meshes},e.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.prototype.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=h(this.getViewport(),4),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},e.prototype.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.prototype.frameCleanup=function(t){},e.prototype.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 ur(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}}))})},e.prototype.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.prototype.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)},e.prototype._resetAttachments=function(){var e,r,i=this,n=this.renderer,o=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null===(e=this.frameBuffer)||void 0===e||e.dispose({depthStencilAttachment:t.RenderPassDestroyAttachmentType.keepExternal}),this.frameBuffer=null);var s=this.viewportScale,u=this.isCustomViewport?this.customViewport:[0,0,n.getWidth()*s,n.getHeight()*s],c=[u[2],u[3]],l=this.name;if(null===(r=o.attachments)||void 0===r?void 0:r.length){var h=o.attachments.map((function(t,e){var r;return new ur(i.renderer.engine,a({size:c,name:(null===(r=t.texture)||void 0===r?void 0:r.name)||"".concat(l,"##color_").concat(e)},t))}));this.attachments=h;var f=Xr.create({storeAction:this.storeAction,name:l,viewport:u,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:o.depthStencilAttachment||{storageType:t.RenderPassAttachmentStorageType.none}},n);f.bind(),f.unbind(),this.frameBuffer=f}else this.attachments.length=0},e.prototype.getViewport=function(){var t,e=(null===(t=this.frameBuffer)||void 0===t?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]},e.prototype.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}},e.prototype.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}},e.prototype.getDepthTexture=function(t,e){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.prototype.getStencilTexture=function(t,e){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.prototype.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.prototype.dispose=function(e){var r,i;if(!this.destroyed){var 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:t.RenderPassDestroyAttachmentType.force;this.attachments.forEach((function(e){e.externalTexture&&o===t.RenderPassDestroyAttachmentType.keepExternal||o===t.RenderPassDestroyAttachmentType.keep||e.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:t.RenderPassDestroyAttachmentType.force,s=this.frameBuffer;if(s)s.dispose({depthStencilAttachment:a}),s.externalStorage&&a===t.RenderPassDestroyAttachmentType.keepExternal||a===t.RenderPassDestroyAttachmentType.keep||(null===(r=this.stencilTexture)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose());this.options=this.renderer=null,this.initialize=At}},e}(),hr="#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;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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);}",fr="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;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.xyz,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}",pr="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;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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;}",dr="#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;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\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\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\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",mr="#version 300 es\nprecision highp 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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}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#pragma EDITOR_VERT_DEFINE\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 USE_FILTER\n#pragma FILTER_VERT\n#endif\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 USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n#pragma EDITOR_VERT_TRANSFORM\n}}",yr="#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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}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}",vr="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",xr="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;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));}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;}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);}",gr="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);}",Tr="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);}",Er="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);}",br="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);}",_r=function(e){function r(r,i){var n=e.call(this,r,i)||this,o=n.renderer.engine,a=tr.create(o,{mode:ue.TRIANGLE_STRIP,attributes:{aPos:{type:ue.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ke.create(o,{shader:{vertex:vr,fragment:br,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=or.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},r.prototype.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}(lr),Cr=function(e){function r(r,i,n){var o=e.call(this,r,n)||this;o.type=i;var a=o.renderer.engine,s="PostProcess",u=tr.create(a,{name:s,mode:ue.TRIANGLE_STRIP,attributes:{aPos:{type:ue.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:vr,fragment:"H"==i?gr:Tr,glslVersion:t.GLSLVersion.GLSL1},l=ke.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=or.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},r.prototype.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",Mr(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFrameBuffer().getColorTextures()[0])},r}(lr),Sr=function(e){function r(t,r){var i=e.call(this,t,r)||this,n="PostProcess",o=i.renderer.engine,a=tr.create(o,{name:n,mode:ue.TRIANGLE_STRIP,attributes:{aPos:{type:ue.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:vr,fragment:Er},u=ke.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=or.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},r.prototype.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",Mr(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},r}(lr),wr=function(e){function r(r,i){var n=e.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new ur(a);var s=tr.create(a,{name:o,mode:ue.TRIANGLE_STRIP,attributes:{aPos:{type:ue.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ke.create(a,{name:o,shader:{vertex:vr,fragment:xr,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=or.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return o(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},r.prototype.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.bloomIntensity,n=r.brightness,o=r.saturation,a=r.contrast,s=r.useBloom,u=r.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",n),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",a),this.screenMesh.material.setInt("_UseBloom",s),s&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i)),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},r}(lr),Or={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},Ar="_effects_default_",Rr=1,Lr=function(){function e(e){var r;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=e.camera,n=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=void 0===s?[1,1,0,0]:s,c=e.globalVolume,l=e.clearAction,h=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,f=o.engine;c&&(this.globalVolume=a(a({},Or),c)),this.globalUniforms=new Pr;var p,d=[],m={};if(this.renderer=o,this.globalVolume){var y=this.globalVolume.useHDR?ue.HALF_FLOAT:ue.UNSIGNED_BYTE;d=[{texture:{format:ue.RGBA,type:y,magFilter:ue.LINEAR,minFilter:ue.LINEAR}}],p={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var v=[new lr(o,{name:Ar,priority:ar,meshOrder:t.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m})];if(this.setRenderPasses(v),this.globalVolume){var x=this.globalVolume.useBloom,g=new ur(f);if(x){var T=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],E=new Array(7),b=(y=this.globalVolume.useHDR?ue.HALF_FLOAT:ue.UNSIGNED_BYTE,new _r(o,{name:"BloomThresholdPass",attachments:[{texture:{format:ue.RGBA,type:y,minFilter:ue.LINEAR,magFilter:ue.LINEAR}}]}));b.sceneTextureHandle=g,this.addRenderPass(b);for(var _=0;_<7;_++){E[_]=new ur(f);var C=new Cr(o,"H",{name:"GaussianDownPassH"+_,viewport:T,attachments:[{texture:{format:ue.RGBA,type:y,minFilter:ue.LINEAR,magFilter:ue.LINEAR}}]}),S=new Cr(o,"V",{name:"GaussianDownPassV"+_,viewport:T,attachments:[{texture:{format:ue.RGBA,type:y,minFilter:ue.LINEAR,magFilter:ue.LINEAR}}]});S.gaussianResult=E[_],this.addRenderPass(C),this.addRenderPass(S),T[2]/=2,T[3]/=2}T[2]*=4,T[3]*=4;for(_=0;_<6;_++){var w=new Sr(o,{name:"GaussianUpPass"+_,viewport:T,attachments:[{texture:{format:ue.RGBA,type:y,minFilter:ue.LINEAR,magFilter:ue.LINEAR}}]});w.gaussianDownSampleResult=E[5-_],this.addRenderPass(w),T[2]*=2,T[3]*=2}}var O=void 0;O=x?new wr(o,g):new wr(o),this.addRenderPass(O)}this.semantics=new Je(e.semantics),this.clearAction=h,this.name="RenderFrame".concat(Rr++);var A=v[0],R={type:ue.UNSIGNED_BYTE,format:ue.RGBA,internalFormat:ue.RGBA,wrapS:ue.MIRRORED_REPEAT,wrapT:ue.MIRRORED_REPEAT,minFilter:ue.NEAREST,magFilter:ue.NEAREST};this.emptyTexture=Ae.create(f,a({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},R)),this.transparentTexture=Ae.create(f,a({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},R)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(A,{listStart:0,listEnd:0,renderPass:A,intermedia:!1}),this.editorTransform=K.fromArray(u),e.clearAction||this.resetClearActions(),this.passTextureCache=new Ke(f);var L=f.gpuCapability,M=L.detail,I=We(L.level,M.readableDepthStencilTextures&&M.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(I)}return Object.defineProperty(e.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},e.prototype.removeMeshFromDefaultRenderPass=function(t){},e.prototype.dispose=function(e){var r,i;(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var 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=null===(r=this.resource.depthStencil)||void 0===r?void 0:r.texture)||void 0===i||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},e.prototype.resetRenderPassDefaultAttachment=function(t,e){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,u=e;u<t.length;u++){var c=t[u],l=null===(r=c.attachments[0])||void 0===r?void 0:r.texture;if(l&&n===l){var h=l===a?s:a;c.resetColorAttachments([h])}(l=null===(i=c.attachments[0])||void 0===i?void 0:i.texture)&&(n=l)}},e.prototype.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(Ar)||!r.meshes.includes(t)||(e=i,!1)})),e},e.prototype.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)},e.prototype.getRPAttachments=function(t,e){var r;if(1===(null==t?void 0:t.length)){var i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==e?void 0:e.getInitAttachments())&&void 0!==r?r:[];if(a===ue.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},e.prototype.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)},e.prototype.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.prototype.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.prototype.createResource=function(){var e,r=this.renderer.engine;if(!this.resource){var i=r.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?ue.LINEAR:ue.NEAREST,c=Ae.create(r,{sourceType:t.TextureSourceType.framebuffer,format:ue.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=Ae.create(r,{sourceType:t.TextureSourceType.framebuffer,format:ue.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 lr(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:c}]}).initialize(this.renderer),p=new Ir(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===(e=f.getDepthAttachment())||void 0===e?void 0:e.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:p,depthStencil:f.depthAttachment,resRP:f}}},e.prototype.createCopyMesh=function(t){var e=Xe,r=this.renderer.engine,i=tr.create(r,{name:e,mode:ue.TRIANGLE_STRIP,attributes:{aPos:{type:ue.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=We(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=ke.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:e,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[ue.SRC_ALPHA,ue.ONE_MINUS_SRC_ALPHA,ue.SRC_ALPHA,ue.ONE_MINUS_SRC_ALPHA]),or.create(r,{name:e,geometry:i,material:o,priority:0})},e.prototype.removeRenderPass=function(t){E(this._renderPasses,t)},e}();function Mr(t){return t?new j(t.getWidth(),t.getHeight()):new j}var Ir=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Mr(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(lr),Pr=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},Vr=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 Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t}(),Fr="function"==typeof WebGL2RenderingContext,Nr=function(){function t(t){this.setupCapability(t)}return t.prototype.setupCapability=function(t){var e,r=Fr&&t instanceof 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=Dr(t,t.HALF_FLOAT)),i&&!s&&(s=Dr(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?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:Br(t),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)},t.prototype.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw new Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT".concat(r,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(r)];a?t.framebufferTexture2D(e,a,i,n,0):console.error("invalid color attachment index: "+r)},t.prototype.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT".concat(i,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(i)]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw Error("draw buffers not available")},t.prototype.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function Dr(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}var zr,Ur,kr={NONE:0,PVRTC:1,ASTC:2};function Br(t){return t.getExtension("WEBGL_compressed_texture_astc")?kr.ASTC:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?kr.PVRTC:kr.NONE}t.FilterMode=void 0,(zr=t.FilterMode||(t.FilterMode={}))[zr.Nearest=0]="Nearest",zr[zr.Linear=1]="Linear",t.RenderTextureFormat=void 0,(Ur=t.RenderTextureFormat||(t.RenderTextureFormat={}))[Ur.RGBA32=0]="RGBA32",Ur[Ur.RGBAHalf=1]="RGBAHalf";var Gr,Xr=function(){function t(){}return t.prototype.resize=function(t,e,r,i){},t.prototype.resetColorTextures=function(t){},t.prototype.unbind=function(){},t.prototype.bind=function(){},Object.defineProperty(t.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),t.prototype.getDepthTexture=function(){},t.prototype.getStencilTexture=function(){},t.prototype.getColorTextures=function(){return[]},t.prototype.dispose=function(t){},t}(),jr=function(){function t(){}return t.prototype.setGlobalFloat=function(t,e){},t.prototype.setGlobalInt=function(t,e){},t.prototype.setGlobalMatrix=function(t,e){},t.prototype.getFrameBuffer=function(){return null},t.prototype.setFrameBuffer=function(t){},t.prototype.setViewport=function(t,e,r,i){},t.prototype.resize=function(t,e){},t.prototype.clear=function(t){},t.prototype.getWidth=function(){return 0},t.prototype.getHeight=function(){return 0},t.prototype.addLostHandler=function(t){},t.prototype.addRestoreHandler=function(t){},t.prototype.lost=function(t){},t.prototype.restore=function(){},t.prototype.getShaderLibrary=function(){},t.prototype.renderRenderFrame=function(t){},t.prototype.renderMeshes=function(t){},t.prototype.drawGeometry=function(t,e){},t.prototype.getTemporaryRT=function(t,e,r,i,n,o){return null},t.prototype.dispose=function(t){},t}(),Hr=function(){function t(){}return t.collectSerializableObject=function(t,e){var r,i,n,o,a,s;if(!e[t.getInstanceId()]){t.toData(),e[t.getInstanceId()]=t;var u=Kt(t);try{for(var c=l(Object.keys(u)),h=c.next();!h.done;h=c.next()){var f=h.value,p=t.taggedProperties[f];if(void 0===p&&(p=t[f]),p instanceof ee)this.collectSerializableObject(p,e);else if(p instanceof Array)try{for(var d=(n=void 0,l(p)),m=d.next();!m.done;m=d.next()){var y=m.value;y instanceof ee&&this.collectSerializableObject(y,e)}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}else if(p instanceof Object)try{for(var v=(a=void 0,l(Object.keys(p))),x=v.next();!x.done;x=v.next()){var g=p[x.value];g instanceof ee&&this.collectSerializableObject(g,e)}}catch(t){a={error:t}}finally{try{x&&!x.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}},t.serializeEffectObject=function(e){var r,i,n={},o=e.engine,s=a({},o.jsonSceneData);t.collectSerializableObject(e,n);try{for(var u=l(Object.keys(n)),c=u.next();!c.done;c=u.next()){var h=n[c.value];s[h.getInstanceId()]||(s[h.getInstanceId()]={}),t.serializeTaggedProperties(h,s[h.getInstanceId()])}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return s},t.serializeTaggedProperties=function(e,r){var i,n,o,a;e.toData(),r||(r={});var s=Kt(e);try{for(var u=l(Object.keys(s)),c=u.next();!c.done;c=u.next()){"number"==typeof(p=e[d=c.value])||"string"==typeof p||"boolean"==typeof p||t.checkTypedArray(p)?r[d]=p:p instanceof Array?(r[d]||(r[d]=[]),t.serializeArrayProperty(p,r[d],0)):p instanceof ee?r[d]={id:p.getInstanceId()}:p instanceof Object&&(r[d]||(r[d]={}),t.serializeObjectProperty(p,r[d],0))}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}try{for(var h=l(Object.keys(e.taggedProperties)),f=h.next();!f.done;f=h.next()){var p,d=f.value;"number"==typeof(p=e.taggedProperties[d])||"string"==typeof p||"boolean"==typeof p||t.checkTypedArray(p)?r[d]=p:p instanceof Array?(r[d]||(r[d]=[]),t.serializeArrayProperty(p,r[d],0)):p instanceof ee?r[d]={id:p.getInstanceId()}:p instanceof Object&&(r[d]||(r[d]={}),t.serializeObjectProperty(p,r[d],0))}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}return r},t.deserializeTaggedProperties=function(e,r){var i,n,o,a,s=r.taggedProperties,u=Kt(r),c=r.engine;try{for(var h=l(Object.keys(e)),f=h.next();!f.done;f=h.next()){if(!u[y=f.value]){var p=e[y];s[y]=t.deserializeProperty(p,c,0)}}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}try{for(var d=l(Object.keys(u)),m=d.next();!m.done;m=d.next()){var y;void 0!==(p=e[y=m.value])&&(r[y]=t.deserializeProperty(p,c,0))}}catch(t){o={error:t}}finally{try{m&&!m.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}r.fromData(s)},t.deserializeTaggedPropertiesAsync=function(e,r){return u(this,void 0,void 0,(function(){var i,n,o,a,s,u,h,f,p,d,m,y,v,x,g,T,E,b,_;return c(this,(function(c){switch(c.label){case 0:i=r.taggedProperties,n=Kt(r),o=r.engine,c.label=1;case 1:c.trys.push([1,6,7,8]),a=l(Object.keys(e)),s=a.next(),c.label=2;case 2:return s.done?[3,5]:(m=s.value,n[m]?[3,4]:(y=e[m],u=i,h=m,[4,t.deserializePropertyAsync(y,o,0)]));case 3:u[h]=c.sent(),c.label=4;case 4:return s=a.next(),[3,2];case 5:return[3,8];case 6:return f=c.sent(),T={error:f},[3,8];case 7:try{s&&!s.done&&(E=a.return)&&E.call(a)}finally{if(T)throw T.error}return[7];case 8:c.trys.push([8,13,14,15]),p=l(Object.keys(n)),d=p.next(),c.label=9;case 9:return d.done?[3,12]:(m=d.value,void 0===(y=e[m])?[3,11]:(v=r,x=m,[4,t.deserializePropertyAsync(y,o,0)]));case 10:v[x]=c.sent(),c.label=11;case 11:return d=p.next(),[3,9];case 12:return[3,15];case 13:return g=c.sent(),b={error:g},[3,15];case 14:try{d&&!d.done&&(_=p.return)&&_.call(p)}finally{if(b)throw b.error}return[7];case 15:return r.fromData(i),[2]}}))}))},t.checkTypedArray=function(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array},t.checkDataPath=function(t){return t instanceof Object&&1===Object.keys(t).length&&t.id&&32===t.id.length},t.checkGLTFNode=function(t){return t instanceof Object&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.deserializeProperty=function(e,r,i){var n,o,a,s;if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{if("number"==typeof e||"string"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){var u=[];try{for(var c=l(e),h=c.next();!h.done;h=c.next()){var f=h.value;u.push(t.deserializeProperty(f,r,i+1))}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}return u}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(e instanceof ee||t.checkTypedArray(e)||t.checkGLTFNode(e))return e;if(e instanceof Object){u={};try{for(var p=l(Object.keys(e)),d=p.next();!d.done;d=p.next()){var m=d.value;u[m]=t.deserializeProperty(e[m],r,i+1)}}catch(t){a={error:t}}finally{try{d&&!d.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}return u}}},t.deserializePropertyAsync=function(e,r,i){return u(this,void 0,void 0,(function(){var n,o,a,s,u,h,f,p,d,m,y,v,x,g,T,E,b;return c(this,(function(c){switch(c.label){case 0:return i>10?(console.error("序列化数据的内嵌对象层数大于上限"),[2]):"number"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e?[3,1]:[2,e];case 1:if(!(e instanceof Array))return[3,10];f=[],c.label=2;case 2:c.trys.push([2,7,8,9]),n=l(e),o=n.next(),c.label=3;case 3:return o.done?[3,6]:(a=o.value,u=(s=f).push,[4,t.deserializePropertyAsync(a,r,i+1)]);case 4:u.apply(s,[c.sent()]),c.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return h=c.sent(),g={error:h},[3,9];case 8:try{o&&!o.done&&(T=n.return)&&T.call(n)}finally{if(g)throw g.error}return[7];case 9:return[2,f];case 10:return t.checkDataPath(e)?[4,r.assetLoader.loadGUIDAsync(e.id)]:[3,12];case 11:return[2,f=c.sent()];case 12:return e instanceof ee||t.checkTypedArray(e)||t.checkGLTFNode(e)?[2,e]:[3,13];case 13:if(!(e instanceof Object))return[3,22];f={},c.label=14;case 14:c.trys.push([14,19,20,21]),p=l(Object.keys(e)),d=p.next(),c.label=15;case 15:return d.done?[3,18]:(m=d.value,y=f,v=m,[4,t.deserializePropertyAsync(e[m],r,i+1)]);case 16:y[v]=c.sent(),c.label=17;case 17:return d=p.next(),[3,15];case 18:return[3,21];case 19:return x=c.sent(),E={error:x},[3,21];case 20:try{d&&!d.done&&(b=p.return)&&b.call(p)}finally{if(E)throw E.error}return[7];case 21:return[2,f];case 22:return[2]}}))}))},t.serializeObjectProperty=function(e,r,i){var n,o;if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{r||(r={});try{for(var a=l(Object.keys(e)),s=a.next();!s.done;s=a.next()){var u=s.value,c=e[u];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(e)?r[u]=c:c instanceof Array?(r[u]||(r[u]=[]),t.serializeArrayProperty(c,r[u],i+1)):c instanceof ee?r[u]={id:c.getInstanceId()}:c instanceof Object&&(r[u]||(r[u]={}),t.serializeObjectProperty(c,r[u],i+1))}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}},t.serializeArrayProperty=function(e,r,i){if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{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:o instanceof Array?(r[n]||(r[n]=[]),this.serializeArrayProperty(o,r[n],i+1)):o instanceof ee?r[n]={id:o.getInstanceId()}:o instanceof Object&&(r[n]||(r[n]={}),t.serializeObjectProperty(o[n],r[n],i+1))}}},t}(),Yr=function(){function e(t){this.engine=t}return e.prototype.loadGUID=function(r){if(this.engine.objectInstance[r])return this.engine.objectInstance[r];var i,n=this.findData(r);if(n){switch(n.dataType){case t.DataType.Material:i=ke.create(this.engine);break;case t.DataType.Geometry:i=tr.create(this.engine);break;case t.DataType.Texture:return i=Ae.create(this.engine,n);case t.DataType.Shader:i=this.engine.getShaderLibrary().createShader(n);break;default:var o=e.getClass(n.dataType);o&&(i=new o(this.engine))}if(i)return i.setInstanceId(n.id),this.engine.addInstance(i),Hr.deserializeTaggedProperties(n,i),i;console.error("未找到 DataType: "+n.dataType+"的构造函数")}else console.error("未找到 uuid: "+r+"的对象数据")},e.prototype.loadGUIDAsync=function(r){return u(this,void 0,void 0,(function(){var i,n,o;return c(this,(function(a){switch(a.label){case 0:return this.engine.objectInstance[r]?[2,this.engine.objectInstance[r]]:(n=this.findData(r))?[3,2]:this.engine.database?[4,this.engine.database.loadGUID(r)]:(console.error("未找到 uuid: "+r+"的对象数据"),[2,void 0]);case 1:return(i=a.sent())?(this.engine.addInstance(i),[2,i]):(console.error("未找到 uuid: "+r+"的磁盘数据"),[2,void 0]);case 2:switch(n.dataType){case t.DataType.Material:i=ke.create(this.engine);break;case t.DataType.Geometry:i=tr.create(this.engine);break;case t.DataType.Texture:return[2,i=Ae.create(this.engine,n)];case t.DataType.Shader:i=this.engine.getShaderLibrary().createShader(n);break;default:(o=e.getClass(n.dataType))&&(i=new o(this.engine))}return i?(i.setInstanceId(n.id),this.engine.addInstance(i),[4,Hr.deserializeTaggedPropertiesAsync(n,i)]):(console.error("未找到 DataType: "+n.dataType+"的构造函数"),[2,void 0]);case 3:return a.sent(),[2,i]}}))}))},e.prototype.findData=function(t){return this.engine.jsonSceneData[t]},e.getClass=function(t){return Zt[t]},e}(),Wr=function(){function t(){}return t.prototype.loadGUID=function(t){return u(this,void 0,void 0,(function(){return c(this,(function(t){return[2,void 0]}))}))},t}();t.DataType=void 0,(Gr=t.DataType||(t.DataType={}))[Gr.VFXItemData=0]="VFXItemData",Gr[Gr.EffectComponent=1]="EffectComponent",Gr[Gr.Material=2]="Material",Gr[Gr.Shader=3]="Shader",Gr[Gr.SpriteComponent=4]="SpriteComponent",Gr[Gr.ParticleSystem=5]="ParticleSystem",Gr[Gr.InteractComponent=6]="InteractComponent",Gr[Gr.CameraController=7]="CameraController",Gr[Gr.Geometry=8]="Geometry",Gr[Gr.Texture=9]="Texture",Gr[Gr.TextComponent=10]="TextComponent",Gr[Gr.MeshComponent=1e4]="MeshComponent",Gr[Gr.SkyboxComponent=10001]="SkyboxComponent",Gr[Gr.LightComponent=10002]="LightComponent",Gr[Gr.CameraComponent=10003]="CameraComponent",Gr[Gr.ModelPluginComponent=10004]="ModelPluginComponent",Gr[Gr.TreeComponent=10005]="TreeComponent";var Zr,qr,Qr=function(){function t(){this.order=100,this.name=""}return t.precompile=function(t,e){return Promise.resolve()},t.prototype.onCompositionConstructed=function(t,e){},t.prototype.onCompositionItemLifeBegin=function(t,e){},t.prototype.onCompositionItemLifeEnd=function(t,e){},t.prototype.onCompositionItemRemoved=function(t,e){},t.prototype.onCompositionReset=function(t,e){},t.prototype.onCompositionWillReset=function(t,e){},t.prototype.onCompositionDestroyed=function(t){},t.prototype.onCompositionUpdate=function(t,e){},t.prototype.prepareRenderFrame=function(t,e){return!1},t.prototype.postProcessFrame=function(t,e){},t}(),Kr=(Zr=new Float32Array(1),qr=new Int32Array(Zr.buffer),function(t){Zr[0]=t;var e=qr[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?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),Jr=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]=Kr(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=Kr(t[r])},t}();var $r,ti=new Q,ei=new q;function ri(t,e,r,i,n,o,a){var s=t,u=i/n,c=i,l=e.speedOverLifetime;l&&(c=l.getIntegrateValue(0,i,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;s.copyFrom(o),s.addScaledVector(a,c),s.addScaledVector(r,h);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{},d=["x","y","z"];if(p.enabled){var m=new H;p.center&&m.setFromArray(p.center);var y=s.clone().subtract(m),v=p.asRotation,x=d.map((function(t){var e=p[t];return e?v?e.getValue(u):e.getIntegrateValue(0,i,n):0}));ti.setFromArray(x).negate(),ei.setFromEuler(ti);var g=ei.transformPoint(y);s.addVectors(m,g)}if(f.enabled)for(var T=f.asMovement,E=0;E<3;E++){var b=f[d[E]];if(b){var _=T?b.getValue(u):b.getIntegrateValue(0,i,n);s.setElement(E,s.getElement(E)+_)}}return s}function ii(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ni(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function oi(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function ai(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(i=0;i<e.length;i++)t[i]=e[i]}else if(r&&t!==r)for(i=0;i<r.length;i++)t[i]=r[i];return t}var si,ui=(($r={})[_t.PARTICLE_ORIGIN_CENTER]=[0,0],$r[_t.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],$r[_t.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],$r[_t.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],$r[_t.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],$r[_t.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],$r[_t.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],$r[_t.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],$r[_t.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],$r);function ci(t,e,r){var i=r.position,n=new H(t,e,0),o=new H;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new et(i,o)}function li(t,e,r){var i=t.x,n=t.y,o=t.z,a=new H(i-e,n+r,o),s=new H(i-e,n-r,o),u=new H(i+e,n-r,o),c=new H(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}var hi="not_implement",fi=function(){function t(t){this.onCreate(t)}return t.prototype.onCreate=function(t){throw Error(hi)},t.prototype.getIntegrateValue=function(t,e,r){throw Error(hi)},t.prototype.getIntegrateByTime=function(t,e){throw Error(hi)},t.prototype.getValue=function(t){throw Error(hi)},t.prototype.toUniform=function(t){throw Error(hi)},t.prototype.map=function(t){throw Error(hi)},t.prototype.scaleXCoord=function(t){return this},t}(),pi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.value=t},e.prototype.getIntegrateValue=function(t,e,r){return this.value*(e-t)},e.prototype.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},e.prototype.getValue=function(t){return this.value},e.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},e.prototype.map=function(t){var e=this.value;return this.value=t(e),this},e}(fi),di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.items=t},e.prototype.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},e.prototype.map=function(t){return this.items=this.items.map(t),this},e}(fi),mi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){return Ot(this.min,this.max)},e.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(fi),yi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.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},e.prototype.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(fi),vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},e.prototype.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},e.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},e.prototype.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},e.prototype.getIntegrateByTime=function(t,e){return wi(e,0,this.xCoord,this.min,this.max)-wi(t,0,this.xCoord,this.min,this.max)},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e.prototype.scaleXCoord=function(t){return this.xCoord=t,this},e}(fi),xi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.stops=S(t)},e.prototype.getStops=function(){return this.stops},e.prototype.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 w(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(fi),gi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.getAllData=function(t,e){for(var r=new(e?Jr: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},e.prototype.onCreate=function(t){var e=1/0,r=-1/0;if(Number.isFinite(t[0])&&Number.isFinite(t[1])){for(var i=[],n=2;n<t.length;n++)i.push(t[n].slice(0,4));this.keys=i,this.min=t[0],this.dist=t[1]-t[0]}else{i=t.map((function(t){if(Ct(t))return e=Math.min(e,t[1]),r=Math.max(r,t[1]),t.slice(0,4);if("object"==typeof t&&t){var i=t,n=i.time,o=i.value,a=i.inTangent,s=void 0===a?0:a,u=i.outTangent,c=void 0===u?0:u;return e=Math.min(e,o),r=Math.max(r,o),[n,o,s,c]}throw new Error("invalid keyframe")}));var o=r-e;if(this.keys=i,0!==o)for(n=0;n<i.length;n++){var a=i[n];a[1]=(a[1]-e)/o}var s=i[0];s[0]>0&&(s[2]=0,i.unshift([0,s[1],0,0]));var u=i[i.length-1];u[0]<1&&(u[3]=0,i.push([1,u[1],0,0])),this.min=e,this.dist=o}this.isCurveValue=!0},e.prototype.getValue=function(t){var e=this,r=e.keys,i=e.min,n=e.dist,o=r;if(t<=o[0][0])return o[0][1]*n+i;for(var a=o.length-1,s=0;s<a;s++){var u=o[s],c=o[s+1];if(t>u[0]&&t<=c[0])return Oi(t,u,c)*n+i}return o[a][1]*n+i},e.prototype.getIntegrateByTime=function(t,e){var r=this.integrate(e,!0)-this.integrate(t,!0);return.5*this.min*(e-t)*(e-t)+r*this.dist},e.prototype.getIntegrateValue=function(t,e,r){r=r||1;var i=(this.integrate(e/r,!1)-this.integrate(t/r,!1))*r,n=(e-t)/r;return this.min*n+i*this.dist},e.prototype.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?Ri:Ai,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,s,u);i+=o(l,s,u)}return i},e.prototype.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},e.prototype.toUniform=function(t){var e=t.index,r=this.keys;return t.curves.push(this),t.index+=r.length,t.max=Math.max(t.max,r.length),t.curveCount+=r.length,new Float32Array([2,e+1/r.length,this.min,this.dist])},e.prototype.map=function(t){return this.keys.forEach((function(e){e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(fi),Ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.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},e.prototype.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]},e.prototype.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},e.prototype.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},e.prototype.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?wi:Si,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},e.prototype.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},e.prototype.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.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])},e.prototype.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(fi),Ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(t){this.keys=t[0],this.values=t[1]},e.prototype.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;if(0===a)s=(t-n[0])/(o[0]-n[0]);else s=(Oi(t,n,o)-n[1])/a;return this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},e.prototype.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}(fi),bi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onCreate=function(e){t.prototype.onCreate.call(this,e),this.cps=e[2]},e.prototype.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=this.cps[t+t],o=this.cps[t+t+1],a=[0,0,0],s=1-e,u=s*s*s,c=3*e*s*s,l=3*e*e*s,h=e*e*e,f=0;f<r.length;f++)a[f]=u*r[f]+c*n[f]+l*o[f]+h*i[f];return a},e}(Ei),_i=((si={})[It.RANDOM]=function(t){return t[0]instanceof Array?new yi(t):new mi(t)},si[It.CONSTANT]=function(t){return new pi(t)},si[It.CONSTANT_VEC2]=function(t){return new pi(t)},si[It.CONSTANT_VEC3]=function(t){return new pi(t)},si[It.CONSTANT_VEC4]=function(t){return new pi(t)},si[It.CURVE]=function(t){return new gi(t)},si[It.RGBA_COLOR]=function(t){return new pi(t)},si[It.COLORS]=function(t){return new di(t.map((function(t){return _(t,!1)})))},si[It.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new vi([t[0][1],t[1][1]]):new Ti(t)},si[It.GRADIENT_COLOR]=function(t){return new xi(t)},si[It.LINEAR_PATH]=function(t){return new Ei(t)},si[It.BEZIER_PATH]=function(t){return new bi(t)},si);function Ci(t){if(!t||!isNaN(+t))return new pi(t||0);if(t instanceof fi)return t;if(St(_i[t[0]]))return _i[t[0]](t[1]);throw new Error("ValueType: ".concat(t[0]," is not support"))}function Si(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function wi(t,e,r,i,n){var o=t*t,a=e*e;return(2*(o*t)*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function Oi(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,c=u-2*s+a,l=u-s,h=-2*u+3*s;return(2*u-3*s+1)*e[1]+c*n+l*o+h*r[1]}function Ai(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],c=a-t,l=c*c,h=l*c;return(n+o+2*s-2*u)*h*c/(4*i*i*i)+(2*n+o+3*s-3*u)*h/(3*i*i)+n*l/2/i-s*c}function Ri(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],c=a-t,l=c*c,h=l*c,f=i*i,p=f*i;return(-30*p*s*(a+t)*c+10*f*n*(a+2*t)*l+5*i*(a+3*t)*(2*n+o+3*s-3*u)*h+3*(a+4*t)*(n+o+2*s-2*u)*h*c)/60/p}function Li(t,e){if(e){var r=e[0],i=e[1];if(r===It.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===It.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}}}function Mi(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var Ii,Pi=new Y,Vi=1,Fi=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new H(0,0,0),this.quat=new Y(0,0,0,1),this.rotation=new Q(0,0,0),this.scale=new H(1,1,1),this.anchor=new H(0,0,0),this.size=new j(1,1),this.children=[],this.worldMatrix=q.fromIdentity(),this.localMatrix=q.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new H(0,0,0),quat:new Y(0,0,0,1),scale:new H(1,1,1)},this.name="transform_".concat(Vi++),t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}return t.getRotation=function(t,e){var r=Pi.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},Object.defineProperty(t.prototype,"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)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())},enumerable:!1,configurable:!0}),t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.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())},t.prototype.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&&(r instanceof H?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)a instanceof Y?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;i instanceof Q?this.setRotation(i.x*c,i.y*c,i.z*c):this.setRotation(i[0]*c,i[1]*c,i[2]*c)}n&&(n instanceof H?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(u instanceof j?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},t.prototype.addChild=function(t){T(this.children,t)},t.prototype.removeChild=function(t){E(this.children,t)},t.prototype.getRotation=function(){return t.getRotation(this.quat,new Q)},t.prototype.getQuaternion=function(){return this.quat},t.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.localMatrix.multiply(new q(this.size.x,0,0,0,0,this.size.y,0,0,0,0,1,0,0,0,0,1)),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},t.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},t.prototype.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},t.prototype.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},t.prototype.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},t.prototype.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},t.prototype.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Q)},t.prototype.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)},t.prototype.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},t.prototype.getValid=function(){return this.valid},t.prototype.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.rotation={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},t.prototype.fromData=function(t){var e={position:(new H).copyFrom(t.position),rotation:new Q(t.rotation.x,t.rotation.y,t.rotation.z),scale:(new H).copyFrom(t.scale)};this.setTransform(e)},t.prototype.dispose=function(){},t.prototype.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}},t.prototype.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t}(),Ni=function(e){function r(t,r){var i=e.call(this,t)||this;return r&&i.fromData(r),i}return o(r,e),r.prototype.start=function(){this.options.position=this.transform.position.clone(),this.options.rotation=this.transform.getRotation().clone()},r.prototype.update=function(){var t=this.item.lifetime;if(!(t<0)&&this.item.transform.getValid()){var e=new Y,r=new H,i=new Q;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=G(t,0,1),n&&(r.x+=n.x.getValue(t),r.y+=n.y.getValue(t),r.z+=n.z.getValue(t),n.path)){var a=n.path.getValue(t);r.x+=a[0],r.y+=a[1],r.z+=a[2]}if(o){var s=o.z.getValue(t);i.z+=s,o.separateAxes?(i.x+=o.x.getValue(t),i.y+=o.y.getValue(t)):(i.x+=s,i.y+=s)}this.far=this.options.far.getValue(t),this.near=this.options.near.getValue(t),this.fov=this.options.fov.getValue(t),this.transform.setPosition(r.x,r.y,r.z),this.transform.setRotation(i.x,i.y,i.z),this.transform.assignWorldTRS(r,e),this.position=r,this.rotation=Fi.getRotation(e,i),this.updateCamera()}},r.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.options,i=r.near,n=r.far,o=r.fov,a=r.clipMode;if(this.clipMode=a,this.options={position:new H,rotation:new Q,near:Ci(i),far:Ci(n),fov:Ci(o)},t.positionOverLifetime){var s=t.positionOverLifetime,u=s.path,c=s.linearX,l=void 0===c?0:c,h=s.linearY,f=void 0===h?0:h,p=s.linearZ,d=void 0===p?0:p;this.translateOverLifetime={path:u&&Ci(u),x:Ci(l),y:Ci(f),z:Ci(d)}}if(t.rotationOverLifetime){var m=t.rotationOverLifetime,y=m.separateAxes,v=m.x,x=void 0===v?0:v,g=m.y,T=void 0===g?0:g,E=m.z,b=void 0===E?0:E;this.rotationOverLifetime={separateAxes:y,x:Ci(x),y:Ci(T),z:Ci(b)}}},r.prototype.updateCamera=function(){if(this.item.composition){var t=this.item.composition.camera;t.near=this.near,t.far=this.far,t.fov=this.fov,t.clipMode=this.clipMode,t.position=this.position,t.rotation=this.rotation}},r=s([$t(t.DataType.CameraController)],r)}(ne),Di=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(Qr);t.HitTestType=void 0,(Ii=t.HitTestType||(t.HitTestType={}))[Ii.triangle=1]="triangle",Ii[Ii.box=2]="box",Ii[Ii.sphere=3]="sphere",Ii[Ii.custom=4]="custom";var zi="click",Ui="touchstart",ki="touchmove",Bi="touchend",Gi=Tt,Xi=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}return t.prototype.bindListeners=function(){var t,e,r,i,n,o,a=this;o=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",l=function(t,e,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=a.target,u=s.width,c=s.height,l=performance.now(),h=0,f=0;if(n){var p=l-n.ts;h=(i-n.dx)/p||0,f=(o-n.dy)/p||0,n={dx:i,dy:o,ts:l}}return{x:e,y:r,vx:h,vy:f,dx:i,dy:o,ts:l,width:u,height:c,origin:t}};R()&&(o=function(t){var e=t,r=e.touches,i=e.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((t={})[s]=function(t){if(a.enabled){var s=o(t),u=ji(s);e=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:e,y:r},a.dispatchEvent(Ui,l(t,e,r))}},t[u]=function(t){if(i&&a.enabled){var n=ji(o(t));e=n.x,r=n.y,a.dispatchEvent(ki,l(t,e,r,e-i.x,r-i.y))}},t[c]=function(t){if(i&&a.enabled){!a.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=o(t),s=ji(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);e=s.x,r=s.y,u<4&&a.dispatchEvent(zi,l(t,e,r)),a.dispatchEvent(Bi,l(t,e,r,e-i.x,r-i.y))}i=0},t),Object.keys(this.nativeHandlers).forEach((function(t){var e;null===(e=a.target)||void 0===e||e.addEventListener(String(t),a.nativeHandlers[t])}))},t.prototype.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},t.prototype.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),T(r,e),function(){E(r,e)}},t.prototype.removeEventListener=function(t,e){var r=this.handlers[t];r&&E(r,e)},t.prototype.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null===(r=t.target)||void 0===r||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function ji(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 Hi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(Qr),Yi=6,Wi="editor",Zi={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"},qi=1,Qi=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()}return e.prototype.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new H,n=new Y,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)},e.prototype.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null===(r=this.engine.renderer)||void 0===r?void 0:r.env)===Wi]],n=Ci(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:me(i,"\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",t.ShaderType.vertex,o),fragment:me(i,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",t.ShaderType.fragment,o),glslVersion:t.GLSLVersion.GLSL1,cacheId:"".concat(e.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=ke.create(this.engine,a);return s.depthTest=!1,s.setVector4("uPos",new K(0,0,0,0)),s.setVector2("uSize",new j(1,1)),s.setVector4("uColor",new K(n[0]/255,n[1]/255,n[2]/255,n[3])),s.setQuaternion("uQuat",new Y(0,0,0,0)),s},e.prototype.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return tr.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:ue.LINES,maxVertex:4})},e.prototype.createMesh=function(t,e){return or.create(this.engine,{name:"Interact_preview"+qi++,priority:0,worldMatrix:q.fromIdentity(),geometry:t,material:e})},e}(),Ki=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.getHitTestParams=function(e){if(t.clickable){var r=t.item.props.content.options.behavior,i=t.getBoundingBox();return i?{type:i.type,triangles:i.area,behavior:r}:void 0}},t}var i;return o(r,e),i=r,r.prototype.start=function(){var t,e,r,i=this.item.props.content.options,n=(null!==(e=null===(t=this.item.engine)||void 0===t?void 0:t.renderer)&&void 0!==e?e:{}).env,o=this.item.composition,a=this.interactData.options,s=a.type,u=a.showPreview;if(s===gt.CLICK&&(this.clickable=!0,u&&n===Wi)){var c=this.item.composition.getRendererOptions();this.previewContent=new Qi(this.item.props.content,c,this.transform,this.engine)}null===(r=this.item.composition)||void 0===r||r.addInteractiveItem(this.item,i.type),i.type===gt.DRAG&&(n!==Wi||i.enableInEditor)&&o.event&&this.beginDragTarget(i,o.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.prototype.update=function(t){var e;if(null===(e=this.previewContent)||void 0===e||e.updateMesh(),this.dragEvent&&this.bouncingArg){this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,Ji(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg)}},r.prototype.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.prototype.onDestroy=function(){var t;this.item&&this.item.composition&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null===(t=this.previewContent)||void 0===t||t.mesh.dispose(),this.endDragTarget())},r.prototype.endDragTarget=function(){},r.prototype.handleDragMove=function(t,e){var r,i;if(t&&t.cameraParam&&this.item.composition){var n=this.item.props.content.options,o=t.cameraParam,a=o.position,s=o.fov,u=e.dy,c=e.dx*e.width/e.height,l=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(l),p=u*f,d=c*f,m=a[0]-d,y=a[1]-p;if(n.dxRange){var v=h(n.dxRange,2);(m=G(m,x=v[0],g=v[1]))!==x&&m!==g&&x!==g&&(null===(r=e.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var x,g,T=h(n.dyRange,2);(y=G(y,x=T[0],g=T[1]))!==x&&y!==g&&x!==g&&(null===(i=e.origin)||void 0===i||i.preventDefault())}this.item.composition.camera.position=new H(m,y,l)}},r.prototype.beginDragTarget=function(t,e){var r=this;if("camera"===t.target){var n,o={touchstart:function(t){var e;r.dragEvent=null,r.bouncingArg=null;var i=null===(e=r.item.composition)||void 0===e?void 0:e.camera;n={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){r.handleDragMove(n,t),r.bouncingArg=t},touchend:function(t){var e=r.bouncingArg;if(!Ji(e,3)&&e){e.vx*=5,e.vy*=5,r.dragEvent=a({},n)}n=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.prototype.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=li(H.ZERO,.5,.5);return r.forEach((function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:r}},r.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.interactData=t},r=i=s([$t(t.DataType.InteractComponent)],r)}(oe);function Ji(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}function $i(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=+r,c=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:o,maskMode:a,cachePrefix:c,cacheId:"".concat(c,".").concat(+i,"+").concat(+n,"+").concat(u,"+").concat(s,"+").concat(a,".").concat(o)}}function tn(e,r){var i=null!=r?r:{},n=i.count,o=void 0===n?2:n,a=i.env,s=void 0===a?"":a,u=i.ignoreBlend,c=i.wireframe,l=[["MAX_ITEM_COUNT",o],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",s===Wi],["USE_BLEND",!u],["MAX_FRAG_TEX",t.maxSpriteTextureCount>=16?16:8]],h=c?hr:pr.replace(/#pragma\s+FILTER_FRAG/,""),f=fr.replace(/#pragma\s+FILTER_VERT/,"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:me(l,h,t.ShaderType.fragment,e),vertex:me(l,f,t.ShaderType.vertex,e),glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,marcos:l,shared:!0}}function en(t,e){return"".concat(t.cachePrefix,"_effects_sprite_").concat(e)}function rn(t,e,r,i){var n=t.wireframe,o=tn(r,{count:e,wireframe:n,env:i});return o.shared=!0,n||(o.cacheId=en(t,e)),o}function nn(e){t.maxSpriteMeshItemCount=e}t.maxSpriteMeshItemCount=8,t.maxSpriteTextureCount=8;var on={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},an=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="sprite",t}return o(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[en(on,2)]||(n.addShader(rn(on,2,1,u)),n.addShader(rn(on,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&n.addShader(We(a,!0))),Promise.resolve()},r}(Qr),sn=function(){function t(){this.playableOutputs=[]}return t.prototype.evaluate=function(t){var e,r;try{for(var i=l(this.playableOutputs),n=i.next();!n.done;n=i.next()){var o=n.value;this.callProcessFrame(o.sourcePlayable,t),o.processFrame(t)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.connect=function(t,e){e.connect(t)},t.prototype.addOutput=function(t){this.playableOutputs.push(t)},t.prototype.callProcessFrame=function(t,e){var r,i;try{for(var n=l(t.getInputs()),o=n.next();!o.done;o=n.next()){var a=o.value;this.callProcessFrame(a,e)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}t.processFrame(e)},t}(),un=function(){function t(){this.inputs=[]}return t.prototype.connect=function(t){this.inputs.push(t)},t.prototype.getInputs=function(){return this.inputs},t.prototype.getInput=function(t){if(!(t>this.inputs.length-1))return this.inputs[t]},t.prototype.setTime=function(t){this.time=t},t.prototype.getTime=function(){return this.time},t.prototype.onGraphStart=function(){},t.prototype.onGraphStop=function(){},t.prototype.onPlayablePlay=function(){},t.prototype.processFrame=function(t){},t.prototype.onPlayableDestroy=function(){},t.prototype.fromData=function(t){},t}(),cn=function(){function t(){}return t.prototype.setSourcePlayeble=function(t){this.sourcePlayable=t},t.prototype.onGraphStart=function(){},t.prototype.processFrame=function(t){},t}(),ln=function(){function t(){this.clips=[],this.clipSeed=0}return t.prototype.createOutput=function(){return new cn},t.prototype.createMixerPlayable=function(){return new un},t.prototype.createPlayebleTree=function(){var t,e,r=this.createMixerPlayable();try{for(var i=l(this.clips),n=i.next();!n.done;n=i.next()){var o=n.value;r.connect(o.playable)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return r},t.prototype.createClip=function(t,e){var r=new hn;return r.playable=new t,r.name=e||"TimelineClip"+r.id,this.addClip(r),r},t.prototype.getClips=function(){return this.clips},t.prototype.findClip=function(t){var e,r;try{for(var i=l(this.clips),n=i.next();!n.done;n=i.next()){var o=n.value;if(o.name===t)return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.addClip=function(t){t.playable.bindingItem=this.bindingItem,t.id=(this.clipSeed++).toString(),this.clips.push(t)},t}(),hn=function(){this.start=0,this.duration=0},fn=function(){function t(t){this.curveValues={},this.playable=t}return t.prototype.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]},t.prototype.findCurveValue=function(t,e){return this.curveValues[t+e]},t.prototype.getInputStream=function(t){var e=this.playable.getInput(t);if(e instanceof pn)return e.animationStream},t}(),pn=function(t){function e(){var e=t.call(this)||this;return e.animationStream=new fn(e),e}return o(e,t),e}(un),dn=new Q,mn=new H(1,1,1),yn=new H,vn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.processFrame=function(t){this.bindingItem.composition&&this.sampleAnimation()},e.prototype.sampleAnimation=function(){var t=this,e=this.bindingItem.duration,r=this.time/e;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){mn.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(mn.y=this.sizeYOverLifetime.getValue(r),mn.z=this.sizeZOverLifetime.getValue(r)):mn.z=mn.y=mn.x;var i=this.originalTransform.scale;this.bindingItem.transform.setScale(mn.x*i.x,mn.y*i.y,mn.z*i.z)}if(this.rotationOverLifetime){var n=function(i){return t.rotationOverLifetime.asRotation?i.getValue(r):i.getIntegrateValue(0,r,e)},o=n(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;dn.x=a?n(this.rotationOverLifetime.x):0,dn.y=a?n(this.rotationOverLifetime.y):0,dn.z=o;var s=dn.addEulers(this.originalTransform.rotation,dn);this.bindingItem.transform.setRotation(s.x,s.y,s.z)}if(this.positionOverLifetime){var u=yn;ri(u,this,this.gravity,this.time,e,this.originalTransform.position,this.velocity),this.originalTransform.path&&u.add(this.originalTransform.path.getValue(r)),this.bindingItem.transform.setPosition(u.x,u.y,u.z)}},e.prototype.fromData=function(t){var e,r=this.bindingItem.transform.scale;this.originalTransform={position:this.bindingItem.transform.position.clone(),rotation:this.bindingItem.transform.getRotation().clone(),scale:new H(r.x,r.y,r.x)};var i=t.positionOverLifetime,n=t.rotationOverLifetime,o=t.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=Ci(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&Ci(i.linearX),y:i.linearY&&Ci(i.linearY),z:i.linearZ&&Ci(i.linearZ),asMovement:i.asMovement,enabled:!!a});var s=i.orbitalX||i.orbitalY||i.orbitalZ;s&&(this.orbitalVelOverLifetime={x:i.orbitalX&&Ci(i.orbitalX),y:i.orbitalY&&Ci(i.orbitalY),z:i.orbitalZ&&Ci(i.orbitalZ),center:ii(i.orbCenter),asRotation:i.asRotation,enabled:!!s}),this.speedOverLifetime=i.speedOverLifetime&&Ci(i.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Ci(o.x||1),this.sizeYOverLifetime=Ci(o.y||1),this.sizeZOverLifetime=Ci(o.z||1)):this.sizeXOverLifetime=Ci(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Ci(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=Ci(n.x||0),u.y=Ci(n.y||0)}this.gravity=H.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=Ci(null!==(e=null==i?void 0:i.gravityOverLifetime)&&void 0!==e?e:0),this.direction=(null==i?void 0:i.direction)?H.fromArray(i.direction).normalize():new H,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},e}(pn),xn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onGraphStart=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},e.prototype.onPlayablePlay=function(){this.bindingItem.transform.setValid(!0),this.showRendererComponents()},e.prototype.onPlayableDestroy=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},e.prototype.hideRendererComponents=function(){var t,e;try{for(var r=l(this.bindingItem.rendererComponents),i=r.next();!i.done;i=r.next()){var n=i.value;n.enabled&&(n.enabled=!1)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.showRendererComponents=function(){var t,e;try{for(var r=l(this.bindingItem.rendererComponents),i=r.next();!i.done;i=r.next()){var n=i.value;n.enabled||(n.enabled=!0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e}(un),gn=function(t){function e(e){var r=t.call(this,e)||this;return r.reusable=!1,r.timelineStarted=!1,r.playableGraph=new sn,r.time=0,r.tracks=[],r.trackSeed=0,r}return o(e,t),e.prototype.start=function(){var t,e,r,i;try{for(var n=l(this.tracks),o=n.next();!o.done;o=n.next()){var a=o.value;try{for(var s=(r=void 0,l(a.getClips())),u=s.next();!u.done;u=s.next()){var c=u.value;c.start=this.item.start,c.duration=this.item.duration}}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.compileTracks(this.playableGraph)},e.prototype.update=function(t){var e,r,i,n,o,a,s,u,c,h,f,p,d,m,y,v;if(!this.item.stopped&&this.item.composition){if(!this.timelineStarted){try{for(var x=l(this.tracks),g=x.next();!g.done;g=x.next()){var T=g.value;try{for(var E=(i=void 0,l(T.getClips())),b=E.next();!b.done;b=E.next()){b.value.playable.onGraphStart()}}catch(t){i={error:t}}finally{try{b&&!b.done&&(n=E.return)&&n.call(E)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{g&&!g.done&&(r=x.return)&&r.call(x)}finally{if(e)throw e.error}}this.timelineStarted=!0}var _=this.time;if(this.item.delaying&&_>=0&&_<=this.item.duration){this.item.delaying=!1;try{for(var C=l(this.tracks),S=C.next();!S.done;S=C.next()){T=S.value;try{for(var w=(s=void 0,l(T.getClips())),O=w.next();!O.done;O=w.next()){O.value.playable.onPlayablePlay()}}catch(t){s={error:t}}finally{try{O&&!O.done&&(u=w.return)&&u.call(w)}finally{if(s)throw s.error}}}}catch(t){o={error:t}}finally{try{S&&!S.done&&(a=C.return)&&a.call(C)}finally{if(o)throw o.error}}}if(wa.isParticle(this.item)?this.item.isEnded(_)&&this.item.content.destoryed:this.item.isEnded(_)){var A=this.item.endBehavior;if(!this.item.ended&&(this.item.ended=!0,this.item.onEnd(),0===A)){try{for(var R=l(this.tracks),L=R.next();!L.done;L=R.next()){T=L.value;try{for(var M=(f=void 0,l(T.getClips())),I=M.next();!I.done;I=M.next()){I.value.playable.onPlayableDestroy()}}catch(t){f={error:t}}finally{try{I&&!I.done&&(p=M.return)&&p.call(M)}finally{if(f)throw f.error}}}}catch(t){c={error:t}}finally{try{L&&!L.done&&(h=R.return)&&h.call(R)}finally{if(c)throw c.error}}if(this.item.delaying=!0,!this.item.reusable&&!this.reusable)return void this.item.dispose()}}if(!this.item.delaying){var P=this.time/this.item.duration;this.item.lifetime=P;try{for(var V=l(this.tracks),F=V.next();!F.done;F=V.next()){T=F.value;try{for(var N=(y=void 0,l(T.getClips())),D=N.next();!D.done;D=N.next()){D.value.playable.setTime(this.time)}}catch(t){y={error:t}}finally{try{D&&!D.done&&(v=N.return)&&v.call(N)}finally{if(y)throw y.error}}}}catch(t){d={error:t}}finally{try{F&&!F.done&&(m=V.return)&&m.call(V)}finally{if(d)throw d.error}}this.playableGraph.evaluate(t)}}},e.prototype.setTime=function(t){this.time=t},e.prototype.getTime=function(){return this.time},e.prototype.toLocalTime=function(t){var e=t-this.options.start,r=this.options.duration;return e-r>.001&&(5===this.options.endBehavior?e%=r:4===this.options.endBehavior&&(e=Math.min(r,e))),e},e.prototype.createTrack=function(t,e){var r=new t;return r.bindingItem=this.item,r.id=(this.trackSeed++).toString(),r.name=e||"Track"+r.id,this.tracks.push(r),r},e.prototype.getTracks=function(){return this.tracks},e.prototype.findTrack=function(t){var e,r;try{for(var i=l(this.tracks),n=i.next();!n.done;n=i.next()){var o=n.value;if(o.name===t)return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.rebuildGraph=function(){this.playableGraph=new sn,this.compileTracks(this.playableGraph)},e.prototype.compileTracks=function(t){var e,r;try{for(var i=l(this.tracks),n=i.next();!n.done;n=i.next()){var o=n.value,a=o.createPlayebleTree(),s=o.createOutput();t.addOutput(s),s.setSourcePlayeble(a)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),this.options={start:this.item.start,duration:this.item.duration,looping:5===this.item.endBehavior,endBehavior:this.item.endBehavior||0},this.id=this.item.id,this.name=this.item.name,this.createTrack(ln,"ActivationTrack").createClip(xn,"ActivationTimelineClip")},e.prototype.toData=function(){t.prototype.toData.call(this)},s([Jt()],e.prototype,"time",void 0),e}(ne),Tn=[[0,0,1,1,void 0]],En=[1,1,1,1],bn=0,_n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.renderColor=[1,1,1,1],e}return o(e,t),e.prototype.onPlayablePlay=function(){this.spriteMaterial=this.bindingItem.getComponent(Cn).material},e.prototype.processFrame=function(t){var e,r=ni(En,1),i=this.time/this.bindingItem.duration,n=this.opacityOverLifetime,o=this.colorOverLifetime;o&&(r=C(o,i,!0),e=!0),n&&(r[3]*=n.getValue(i),e=!0),e&&(ai(this.renderColor,r,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))},e.prototype.fromData=function(t){var e;this.clipData=t;var r=t.colorOverLifetime;return r&&(this.opacityOverLifetime=Ci(null!==(e=r.opacity)&&void 0!==e?e:1),r.color&&r.color[0]===It.GRADIENT_COLOR&&(this.colorOverLifetime=S(r.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},e}(un),Cn=function(e){function r(t,r){var i=e.call(this,t)||this;return i.color=[1,1,1,1],i.visible=!0,i.getHitTestParams=function(t){var e,r=i.interaction;if(t||r){var n=i.getBoundingBox();if(n)return{behavior:(null===(e=i.interaction)||void 0===e?void 0:e.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===mt.FRONT}}},r&&i.fromData(r),i}return o(r,e),r.prototype.setVisible=function(t){this.visible=t},r.prototype.getVisible=function(){return this.visible},r.prototype.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),r.flush(),t.drawGeometry(r,e)}},r.prototype.start=function(){this.priority=this.item.listIndex,this.timelineComponent=this.item.getComponent(gn),this.item.getHitTestParams=this.getHitTestParams},r.prototype.update=function(t){var e=this.timelineComponent.getTime(),r=this.item.duration,i=Math.min(Math.max(e/r,0),1),n=this.textureSheetAnimation;if(n){var o=n.total||n.row*n.col,a=0,s=0,u=1,c=1,l=void 0;if(this.splits){var h=this.splits[0];l=h[4],a=h[0],s=h[1],l?(u=h[3],c=h[2]):(u=h[2],c=h[3])}var f=void 0,p=void 0;l?(f=1/n.row*u,p=1/n.col*c):(f=1/n.col*u,p=1/n.row*c);var d=void 0;if(n.animate){var m=Math.round(i*(o-1)),y=Math.floor(m/n.col),v=m-y*n.col;d=l?[f*y,p*(n.col-v)]:[f*v,p*(1+y)]}else d=[0,p];this.material.getVector4("_TexOffset").setFromArray([a+d[0],c+s-d[1],f,p])}},r.prototype.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.prototype.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}},r.prototype.setItem=function(){var e=[],r=this.renderer.texture;r&&T(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 p=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)u.setTexture("uSampler"+d,p)},r.prototype.createGeometry=function(t){var e=12*this.splits.length;return tr.create(this.engine,{attributes:{aPos:{type:ue.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:ue.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.prototype.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:rn(t,e,1)};this.preMultiAlpha=he(n);var u=ke.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,ye(u,c.blendMode),xe(u,c.maskMode),ve(u,c.side),u.hasUniform("_Color")||u.setVector4("_Color",new K(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new K),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new K),u},r.prototype.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=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],d=[],m=2,y=2;1===r.length&&(m=1,y=1);for(var v=[],x=0;x<m;x++)for(var g=0;g<y;g++){var T=4*(2*g+x),E=n?[0,0,1,1,r[0][4]]:r[2*g+x],b=E[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],_=((x+x+1)/m-1)/2,C=((g+g+1)/y-1)/2,S=E[0],w=E[1],O=E[4]?E[3]:E[2],A=E[4]?E[2]:E[3],R=[f[0]/m+_,f[1]/y+C,f[2]/m+_,f[3]/y+C,f[4]/m+_,f[5]/y+C,f[6]/m+_,f[7]/y+C];p.push(b[0]*O+S,b[1]*A+w,b[2]*O+S,b[3]*A+w,b[4]*O+S,b[5]*A+w,b[6]*O+S,b[7]*A+w),v.push(1*R[0],1*R[1],0,1*R[2],1*R[3],0,1*R[4],1*R[5],0,1*R[6],1*R[7],0),d.push(T,1+T,2+T,2+T,1+T,3+T)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:p}},r.prototype.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.prototype.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),r=li(H.ZERO,.5,.5);return r.forEach((function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:r}}},r.prototype.fromData=function(t){var r,i,n,o,a,s;e.prototype.fromData.call(this,t);var u=t.interaction,c=t.options,l=t.listIndex,h=void 0===l?0:l,f=t.renderer;f||(f={}),this.interaction=u,this.renderer={renderMode:null!==(r=f.renderMode)&&void 0!==r?r:bt.BILLBOARD,blending:null!==(i=f.blending)&&void 0!==i?i:dt.ALPHA,texture:null!==(n=f.texture)&&void 0!==n?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===yt.MASK,side:null!==(o=f.side)&&void 0!==o?o:mt.DOUBLE,shape:f.shape,mask:null!==(a=f.mask)&&void 0!==a?a:0,maskMode:null!==(s=f.maskMode)&&void 0!==s?s:yt.NONE,order:h},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||Tn,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=$i(this);var p=this.createGeometry(ue.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=q.fromIdentity(),this.material=d,this.geometry=p,this.name="MSprite"+bn++;var m=c.startColor||[1,1,1,1];this.material.setVector4("_Color",(new K).setFromArray(m)),this.material.setVector4("_TexOffset",(new K).setFromArray([0,0,1,1])),this.setItem(),this.item.getComponent(gn).createTrack(ln,"SpriteColorTrack").createClip(_n,"SpriteColorClip").playable.fromData({colorOverLifetime:t.colorOverLifetime,startColor:t.options.startColor})},r.prototype.toData=function(){e.prototype.toData.call(this)},r=s([$t(t.DataType.SpriteComponent)],r)}(oe),Sn="lookup_texture",wn="offscreen_canvas",On={};function An(t){return On[t]}var Rn=function(){function e(e,r){var i,n;this.particleCount=0;var o=(null!==(i=e.renderer)&&void 0!==i?i:{}).env,a=r.speedOverLifetime,s=r.colorOverLifetime,u=r.linearVelOverLifetime,c=r.orbitalVelOverLifetime,l=r.sizeOverLifetime,h=r.rotationOverLifetime,f=r.sprite,p=r.gravityModifier,d=r.maxCount,m=r.textureFlip,y=r.useSprite,v=r.name;r.filter;var x,g=r.gravity,T=r.forceTarget,E=r.side,b=r.occlusion,_=r.anchor,C=r.blending,S=r.maskMode,w=r.mask,O=r.transparentOcclusion,A=r.meshSlots,R=r.renderMode,M=void 0===R?0:R,I=r.diffuse,P=void 0===I?Ae.createWithData(e):I,V=e.gpuCapability.detail,F=V.halfFloatTexture,N=V.maxVertexUniforms,D=[["RENDER_MODE",+M],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",o===Wi]],z=e.gpuCapability.level,U={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},k={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},B=N>0,G={},X=0,Y=0;this.useSprite=y,B&&D.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(D.push(["SPEED_OVER_LIFETIME",!0]),Y|=2,G.uSpeedLifetimeValue=a.toUniform(U)),(null==f?void 0:f.animate)&&(D.push(["USE_SPRITE",!0]),Y|=4,G.uFSprite=G.uSprite=new Float32Array([f.col,f.row,f.total,f.blend?1:0]),this.useSprite=!0),(null==s?void 0:s.color)&&(D.push(["COLOR_OVER_LIFETIME",!0]),Y|=16,G.uColorOverLifetime=s.color instanceof Ae?s.color:Ae.createWithData(e,L(s.color))),(null==s?void 0:s.opacity)?G.uOpacityOverLifetimeValue=s.opacity.toUniform(U):G.uOpacityOverLifetimeValue=Ci(1).toUniform(U),["x","y","z"].forEach((function(t,e){var r=0,i=0;(null==u?void 0:u[t])&&(G["uLinear".concat(t.toUpperCase(),"ByLifetimeValue")]=u[t].toUniform(U),r=1,Y|=1<<7+e,u.enabled=!0),D.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]),(null==c?void 0:c[t])&&(G["uOrb".concat(t.toUpperCase(),"ByLifetimeValue")]=c[t].toUniform(U),i=1,Y|=1<<10+e,x=!0,c.enabled=!0),D.push(["ORB_VEL_".concat(t.toUpperCase()),i])})),(null==u?void 0:u.asMovement)&&(D.push(["AS_LINEAR_MOVEMENT",!0]),Y|=32),x&&((null==c?void 0:c.asRotation)&&(D.push(["AS_ORBITAL_MOVEMENT",!0]),Y|=64),G.uOrbCenter=new Float32Array((null==c?void 0:c.center)||[0,0,0])),G.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(U),(null==l?void 0:l.separateAxes)&&(D.push(["SIZE_Y_BY_LIFE",1]),Y|=16384,G.uSizeYByLifetimeValue=null===(n=null==l?void 0:l.y)||void 0===n?void 0:n.toUniform(U)),(null==h?void 0:h.z)&&(G.uRZByLifeTimeValue=h.z.toUniform(U),Y|=32768,D.push(["ROT_Z_LIFETIME",1])),(null==h?void 0:h.x)&&(G.uRXByLifeTimeValue=h.x.toUniform(U),Y|=65536,D.push(["ROT_X_LIFETIME",1])),(null==h?void 0:h.y)&&(G.uRYByLifeTimeValue=h.y.toUniform(U),Y|=1<<17,D.push(["ROT_Y_LIFETIME",1])),(null==h?void 0:h.asRotation)&&(D.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Y|=1<<18),G.uGravityModifierValue=p.toUniform(U),T&&(D.push(["FINAL_TARGET",!0]),Y|=1<<19,G.uFinalTarget=new Float32Array(T.target||[0,0,0]),G.uForceCurve=T.curve.toUniform(U)),F&&k.max?(Y|=1<<20,G.uFCurveValueTexture=Re(e,gi.getAllData(k,!0),k.index,1)):G.uFCurveValues=gi.getAllData(k);var W=U.max+U.curves.length-32>N;if(2===z&&(U.max=-1,U.index=A?A[0]:Mn(U.index),k.index>0&&(k.max=-1,k.index=A?A[1]:Mn(k.index))),W&&F&&B){var Z=Re(e,gi.getAllData(U,!0),U.index,1);G.uVCurveValueTexture=Z,X=1}else G.uVCurveValues=gi.getAllData(U);var q=["-p:",M,Y,U.index,U.max,k.index,k.max].join("+");D.push(["VERT_CURVE_VALUE_COUNT",U.index],["FRAG_CURVE_VALUE_COUNT",k.index],["VERT_MAX_KEY_FRAME_COUNT",U.max],["FRAG_MAX_KEY_FRAME_COUNT",k.max]);var Q=dr,J="#define LOOKUP_TEXTURE_CURVE ".concat(X,"\n").concat(mr),$={shader:{fragment:me(D,Q,t.ShaderType.fragment,z),vertex:me(D,J,t.ShaderType.vertex,z),glslVersion:1===z?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:q,marcos:D,name:"particle#".concat(v)},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},tt=he(C);G.uTexOffset=new Float32Array(P?[1/P.getWidth(),1/P.getHeight()]:[0,0]),G.uMaskTex=P,G.uColorParams=new Float32Array([P?1:0,+tt,0,+(!!b&&!O)]),G.uParams=[0,0,0,0],G.uAcceleration=[(null==g?void 0:g[0])||0,(null==g?void 0:g[1])||0,(null==g?void 0:g[2])||0,0];var et=ke.create(e,$);et.blending=!0,et.depthTest=!0,et.depthMask=!!b,et.stencilRef=w?[w,w]:void 0,xe(et,S),ye(et,C),ve(et,E);var rt={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"};Object.keys(G).map((function(t){var e=G[t];if(e instanceof Ae)et.setTexture(t,e);else{var r=[];switch(rt[t]){case"vec4":et.setVector4(t,K.fromArray(e));break;case"vec3":et.setVector3(t,H.fromArray(e));break;case"vec2":et.setVector2(t,j.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new K(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}et.setVector4Array(t,r),r.length=0;break;default:console.warn("uniform ".concat(t,"'s type not in typeMap"))}}})),et.setVector3("emissionColor",new H(0,0,0)),et.setFloat("emissionIntensity",0);var it=tr.create(e,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)}};e&&(o.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*d,this.useSprite,"particle#".concat(v))),nt=or.create(e,{name:"MParticle_".concat(v),material:et,geometry:it});this.anchor=_,this.mesh=nt,this.geometry=nt.firstGeometry(),this.forceTarget=T,this.sizeOverLifetime=l,this.speedOverLifetime=a,this.linearVelOverLifetime=u,this.orbitalVelOverLifetime=c,this.orbitalVelOverLifetime=c,this.gravityModifier=p,this.maxCount=d,this.textureOffsets=m?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}return e.prototype.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]]},e.prototype.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=H.fromArray(i,r),l=H.fromArray(i,r+3),h=ri(new H,this,u,o,a,c,l);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),p=this.forceTarget.curve.getValue(o/a),d=1-p;h.x=h.x*d+f.x*p,h.y=h.y*d+f.y*p,h.z=h.z*d+f.z*p}return h},e.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.prototype.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))},e.prototype.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},e.prototype.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.prototype.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(u.aSprite=new Float32Array(12));var l=new H,h=new Y,f=new H(1,1,1);e.transform.assignWorldTRS(l,h,f);var p=Fi.getRotation(h,new Q),d=l.toArray(),m=p.toArray(),y=this.textureOffsets,v=[0,0,e.delay,e.lifetime],x=[0,0,1,1],g=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random(),C=void 0;c&&(C=e.sprite);for(var S=0;S<4;S++){var w=2*S,O=3*S,A=4*S,R=12*S,L=8*S;u.aPos.set(d,R),g.fill(u.aPos,R+3),u.aRot.set(m,L),u.aRot[L+3]=_,u.aRot.set(T,L+4),c&&u.aSprite.set(C,O);var M=e.uv||x;if(M){var I=c?1-y[w+1]:y[w+1];v[0]=M[0]+y[w]*M[2],v[1]=M[1]+I*M[3]}u.aOffset.set(v,A);for(var P=S+S,V=(E[P]-this.anchor.x)*f.x,F=(E[P+1]-this.anchor.y)*f.y,N=0;N<3;N++)u.aPos[R+6+N]=e.dirX.getElement(N)*V,u.aPos[R+9+N]=e.dirY.getElement(N)*F}var D=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var z=b(o.getIndexData(),6*i,s,6*r);z.set(D,6*t),o.setIndexData(z),this.maxParticleBufferCount=z.length/6}else o.setIndexSubData(6*t,D);Object.keys(u).forEach((function(e){var i=u[e],c=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=b(o.getAttributeData(e),n*c,s,4*r*c);l.set(i,i.length*t),o.setAttributeData(e,l)}else o.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},e}(),Ln=[10,32,64,160];function Mn(t){for(var e=0;e<Ln.length;e++){var r=Ln[e];if(r>t)return r}return t||Ln[0]}function In(t,e,r){var i,n;void 0===e&&(e="");var o=t.content,a=+((null===(i=o.renderer)||void 0===i?void 0:i.renderMode)||0),s=[["RENDER_MODE",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===Wi]],u=r.level,c=r.detail,l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=c.maxVertexUniforms>0,p=(null!==(n=o.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,d=0,m=0;f&&s.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(s.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Li(l,p));var y=o.textureSheetAnimation;y&&y.animate&&(s.push(["USE_SPRITE",!0]),m|=4);var v=o.colorOverLifetime;v&&v.color&&(s.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var x=v&&v.opacity;x&&Li(l,x);var g,T=o.positionOverLifetime;["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[i])&&(Li(l,T[i]),r=1,m|=1<<7+e),s.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]);var o=0;(null==T?void 0:T[n])&&(Li(l,T[n]),o=1,m|=1<<10+e,g=!0),s.push(["ORB_VEL_".concat(t.toUpperCase()),o])})),(null==T?void 0:T.asMovement)&&(s.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),g&&(null==T?void 0:T.asRotation)&&(s.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64);var E=o.sizeOverLifetime;Li(l,null==E?void 0:E.x),(null==E?void 0:E.separateAxes)&&(s.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Li(l,null==E?void 0:E.y));var b=o.rotationOverLifetime;(null==b?void 0:b.z)&&(Li(l,null==b?void 0:b.z),m|=32768,s.push(["ROT_Z_LIFETIME",1])),(null==b?void 0:b.separateAxes)&&(b.x&&(Li(l,b.x),m|=65536,s.push(["ROT_X_LIFETIME",1])),b.y&&(Li(l,b.y),m|=1<<17,s.push(["ROT_Y_LIFETIME",1]))),(null==b?void 0:b.asRotation)&&(s.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18),Li(l,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(s.push(["FINAL_TARGET",!0]),m|=1<<19,Li(l,T.forceCurve));var _=c.halfFloatTexture;_&&h.max&&(m|=1<<20);var C=c.maxVertexUniforms,S=l.max+l.curves.length-32>C;An(Sn)&&(S=!0),2===u&&(l.max=-1,h.index>0&&(h.max=-1)),S&&_&&f&&(d=1);var w=["-p:",a,m,l.index,l.max,h.index,h.max].join("+"),O={fragment:dr,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(d,"\n").concat(mr),shared:!0,cacheId:w,marcos:s,name:"particle#".concat(t.name)};return s.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",h.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",h.max]),{shader:O,vertex:l.index,fragment:h.index}}function Pn(t,e,r){var i,n=null===(i=t.cacheId)||void 0===i?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.marcos)for(var o=0;o<t.marcos.length;o++){var a=t.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var Vn=new H,Fn=new H,Nn=function(){function e(e,r){var i;this.pointStart=[];var n=r.colorOverLifetime,o=r.colorOverTrail,a=r.maxTrailCount,s=r.opacityOverLifetime,u=void 0===s?Ci(1):s,c=r.widthOverTrail,l=r.name,h=r.occlusion,f=r.blending,p=r.maskMode,d=r.textureMap,m=void 0===d?[0,0,1,1]:d,y=r.texture,v=r.transparentOcclusion,x=r.minimumVertexDistance,g=r.lifetime,T=r.matrix,E=e.gpuCapability,b=E.detail,_=E.level,C=Math.max(r.pointCountPerTrail,2),S={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},w=b.maxVertexTextures>0,O=(null!==(i=e.renderer)&&void 0!==i?i:{}).env,A={},R=[["ENABLE_VERTEX_TEXTURE",w],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",O===Wi]],M=a>64,I=0;n&&(R.push(["COLOR_OVER_LIFETIME",!0]),I|=1,A.uColorOverLifetime=Ae.createWithData(e,L(n))),o&&(R.push(["COLOR_OVER_TRAIL",!0]),I|=4,A.uColorOverTrail=Ae.createWithData(e,L(o))),M?(R.push(["ATTR_TRAIL_START",1]),I|=8):A.uTrailStart=new Float32Array(a),A.uOpacityOverLifetimeValue=u.toUniform(S);var P=c.toUniform(S);R.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),A.uVCurveValues=gi.getAllData(S);var V={shader:{vertex:me(R,yr,t.ShaderType.vertex,_),fragment:me(R,dr,t.ShaderType.fragment,_),marcos:R,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(I,"+").concat(S.index,"+").concat(S.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},F=C*a*2,N=(C-1)*a,D=Float32Array.BYTES_PER_ELEMENT,z=12*D,U={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*F)},aSeed:{size:1,stride:z,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(F)},aDir:{size:3,data:new Float32Array(3*F)}},indices:{data:new Uint16Array(6*F)},drawCount:6*N,name:"trail#".concat(l),bufferUsage:ue.DYNAMIC_DRAW};if(M)U.attributes.aTrailStart={size:1,data:new Float32Array(F)};else{var k=new Float32Array(F);U.attributes.aTrailStartIndex={size:1,data:k};for(var B=0;B<a;B++)for(var G=2*C,X=B*G,H=0;H<G;H++)k[X+H]=B}var Y=he(f),W=ke.create(e,V);W.blending=!0,W.depthMask=h,W.depthTest=!0,xe(W,p),ye(W,f);var Z=this.mesh=or.create(e,{name:"MTrail_".concat(l),material:W,geometry:tr.create(e,U)}),q=null!=y?y:Ae.createWithData(e);Object.keys(A).map((function(t){var e=A[t];if(e instanceof Ae)W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){var r=[];r.push(new K(e[0],e[1],e[2],e[3])),r.push(new K(e[4],e[5],e[6],e[7])),W.setVector4Array(t,r)}else W.setVector4(t,K.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",K.fromArray(P)),W.setVector2("uTexOffset",new j(0,0)),W.setVector4("uTextureMap",K.fromArray(m)),W.setVector4("uParams",new K(0,C-1,0,0)),W.setTexture("uMaskTex",q),W.setVector4("uColorParams",new K(y?1:0,+Y,0,+(h&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=C,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=M,this.lifetime=g,T&&(this.mesh.worldMatrix=T),this.geometry=Z.firstGeometry(),this.trailCursors=new Uint16Array(a)}return Object.defineProperty(e.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)},enumerable:!1,configurable:!0}),e.prototype.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,Vn);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=kn(l,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,y=6*h,v=new Float32Array(6);v.set(f,0),v.set(f,3),o.setAttributeSubData("aDir",y,v),o.setAttributeSubData("aTime",2*h,new Float32Array([p,p]));var x=r.color||[1,1,1,1],g=new Float32Array(24),T=e.toArray();if(g.set(x,0),g.set(d,4),g[7]=0,g.set(T,8),g[11]=.5*m,g.set(x,12),g.set(d,16),g[19]=1,g.set(T,20),g[23]=-.5*m,o.setAttributeSubData("aColor",24*h,g),u>=0){var E=this.getTrailPosition(t,c,Fn),b=new Float32Array(kn(E,l,e)),_=6*(t*n+u);o.setAttributeSubData("aDir",_,b),o.setAttributeSubData("aDir",_+3,b);var C=t*n*2,S=new Uint16Array([2*u+C,2*u+1+C,2*s+C,2*s+C,2*u+1+C,2*s+1+C]),w=6*(t*a+(i-1)%a);o.setIndexSubData(w,S)}i=++this.trailCursors[t];var O=this.mesh.material,A=O.getVector4("uParams"),R=d[2];if(this.useAttributeTrailStart){for(var L=2*n,M=new Float32Array(L),I=0;I<L;I++)M[I]=R;o.setAttributeSubData("aTrailStart",t*M.length,M)}else{var P=O.getFloats("uTrailStart");null!=P&&(P[t]=R,O.setFloats("uTrailStart",P))}A&&(A.y=Math.max(A.y,i-1)-Math.max(0,i-n),O.setVector4("uParams",A))}},e.prototype.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},e.prototype.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},e.prototype.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},e.prototype.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},e.prototype.getPointStartPos=function(t){return this.pointStart[t]},e.prototype.setPointStartPos=function(t,e){this.pointStart[t]=e},e.prototype.onUpdate=function(t){},e}(),Dn=new H,zn=new H,Un=new H;function kn(t,e,r){var i=Dn;return t||r?(t?r?(zn.subtractVectors(e,t).normalize(),zn.subtractVectors(r,e),Un.copyFrom(zn).normalize(),i.addVectors(zn,Un)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var Bn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return o(r,e),r.precompile=function(e,r,i){var n=e[0],o={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},a={colorOverLifetime:{opacity:1,color:[It.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,c=(null!=i?i:{}).env,l=r.getShaderLibrary(),h=[],f=[],p=[],d=0,m=0;return n.items.forEach((function(e){t.Item.isParticle(e)&&(f.push(e),function(e){if(t.Item.isParticle(e)){var r=e.content;r.rotationOverLifetime||(r.rotationOverLifetime={});var i=r.rotationOverLifetime;i.z||(i.z=[It.CONSTANT,0]),i.separateAxes||(delete i.y,delete i.x),r.sizeOverLifetime||(r.sizeOverLifetime={});var n=r.sizeOverLifetime;n.separateAxes||delete n.y,n.size&&(n.x=n.size,delete n.size),n.x||(n.x=[It.CONSTANT,1])}}(e),2===u&&Object.keys(o).forEach((function(t){var r=o[t],i=e.content[t];i&&Object.keys(r).forEach((function(e){i[e]&&(r[e]=!0,T(h,t))}))})))})),f.forEach((function(e){var r,i,n=e.content;2===u&&(h.forEach((function(t){var e=o[t],r=n[t]||(n[t]={});Object.keys(e).forEach((function(i){if(e[i]&&!r[i]){var n=a[t]&&a[t][i]||0;r[i]=isNaN(n)?n:[It.CONSTANT,n]}}))})),o.positionOverLifetime.forceCurve&&(n.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(n.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(n.sizeOverLifetime.separateAxes=!0));var f=In(e,c,s),y=f.shader,v=f.fragment,x=f.vertex;if(p.push(y),d=Math.max(d,v),m=Math.max(m,x),e.content.trails){var g=function(t,e,r,i,n){void 0===i&&(i="");var o=0,a=An(Sn)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===Wi]],u={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return t.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),t.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),e>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),Li(u,t.opacityOverLifetime),Li(u,t.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:yr,fragment:dr,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(u.index,"+").concat(u.max)}}(e.content.trails,e.content.options.maxCount,e.name,c,s);g.vertex=me(null!==(r=g.marcos)&&void 0!==r?r:[],g.vertex,t.ShaderType.vertex,u),g.fragment=me(null!==(i=g.marcos)&&void 0!==i?i:[],g.fragment,t.ShaderType.fragment,u),g.glslVersion=2===u?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,l.addShader(g)}})),p.forEach((function(e){var r,i;2===u?(Pn(e,m,d),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=me(null!==(r=e.marcos)&&void 0!==r?r:[],e.vertex,t.ShaderType.vertex,u),e.fragment=me(null!==(i=e.marcos)&&void 0!==i?i:[],e.fragment,t.ShaderType.fragment,u),l.addShader(e)})),2===u&&f.forEach((function(t){t.content.options.meshSlots=[m,d]})),Promise.resolve()},r}(Qr);var Gn=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=Xn(this.arc,this.arcMode,t)*D,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new H(r,i,0),o=Math.tan(this.angle*D),a=n.clone().multiply(o);return a.z+=1,{position:n.multiply(Ot(0,1)),direction:a.normalize()}},t}();function Xn(t,e,r){if(e===Dt.RANDOM)t=Ot(0,t);else if(e===Dt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Dt.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);t*=Math.floor(i)%2?1-n:n}else e===Dt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var jn,Hn=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=Xn(this.arc,this.arcMode,t)*D,r=new H(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Yn=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=Ot(-this._d,this._d),r=Ot(-this._h,this._h);return{direction:new H(0,0,1),position:new H(e,r,0)}},t}(),Wn=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=Xn(this.arc,this.arcMode,t)*D,r=new H(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new H;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}(),Zn=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Dt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Ot(0,1);return{direction:new H(0,1,0),position:new H(this._d*(e-.5),0,0)}},t}(),qn=new q,Qn=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=Ot(0,2*Math.PI),n=Xn(this.arc,this.arcMode,t)*D,o=qn.setFromRotationZ(n),a=new H(Math.cos(i),Math.sin(i),0),s=new H(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),Kn=new q,Jn=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.getHorizontalAngle=function(){return Ot(-90,90)},t.prototype.generate=function(t){var e=Xn(this.arc,this.arcMode,t)*D,r=this.getHorizontalAngle()*D,i=this.radius,n=new H(Math.cos(r),0,Math.sin(r)),o=Kn.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),$n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getHorizontalAngle=function(){return Ot(0,90)},e}(Jn),to=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=G(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(Xn(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new H(n,o,0);return{position:new H(n*this.width,o*this.height,0),direction:a.normalize()}},t}(),eo=function(){function t(){}return t.prototype.generate=function(){return{position:new H,direction:new H}},t}(),ro=((jn={})[vt.NONE]=eo,jn[vt.CONE]=Gn,jn[vt.SPHERE]=Jn,jn[vt.HEMISPHERE]=$n,jn[vt.CIRCLE]=Hn,jn[vt.DONUT]=Qn,jn[vt.RECTANGLE]=Yn,jn[vt.EDGE]=Zn,jn[vt.RECTANGLE_EDGE]=Wn,jn[vt.TEXTURE]=to,jn);function io(t){if(!t)return new eo;var e=a({radius:1,arc:360,angle:0,arcMode:Dt.RANDOM},t),r=t.type,i=ro[r];if(!i)throw Error("invalid shape:"+r);var n=new i(e);if(r!==vt.NONE){var o=t,s=o.alignSpeedDirection,u=o.upDirection,c=void 0===u?[0,0,1]:u;n.alignSpeedDirection=s,n.upDirection=H.fromArray(c).normalize()}return n}function no(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=_o(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=_o(o,t[o],t[o+1],a);return a&&vo(a,a.next)&&(Co(a),a=a.next),a}function oo(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!vo(i,i.next)&&0!==yo(i.prev,i,i.next))i=i.next;else{if(Co(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function ao(t){var e=t.prev,r=t,i=t.next;if(yo(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(po(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&yo(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function so(t,e,r,i){var n=t.prev,o=t,a=t.next;if(yo(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,u=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,c=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,h=ho(s,u,e,r,i),f=ho(c,l,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&po(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&yo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&po(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&yo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&po(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&yo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&po(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&yo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function uo(t,e){return t.x-e.x}function co(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var u,c=r,l=r.x,h=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=l&&n!==i.x&&po(o<h?n:a,o,l,h,o<h?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),Eo(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&lo(r,i)))&&(r=i,f=u)),i=i.next}while(i!==c);return r}(t,e),e){var r=bo(e,t);oo(e,e.next),oo(r,r.next)}}function lo(t,e){return yo(t.prev,t,e.prev)<0&&yo(e.next,t,t.next)<0}function ho(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fo(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}function po(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 mo(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&xo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Eo(t,e)&&Eo(e,t)&&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}(t,e)&&(yo(t.prev,t,e.prev)||yo(t,e.prev,e))||vo(t,e)&&yo(t.prev,t,t.next)>0&&yo(e.prev,e,e.next)>0)}function yo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function vo(t,e){return t.x===e.x&&t.y===e.y}function xo(t,e,r,i){var n=To(yo(t,e,r)),o=To(yo(t,e,i)),a=To(yo(r,i,t)),s=To(yo(r,i,e));return n!==o&&a!==s||(!(0!==n||!go(t,r,e))||(!(0!==o||!go(t,i,e))||(!(0!==a||!go(r,t,i))||!(0!==s||!go(r,e,i)))))}function go(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 To(t){return t>0?1:t<0?-1:0}function Eo(t,e){return yo(t.prev,t,t.next)<0?yo(t,e,t.next)>=0&&yo(t,t.prev,e)>=0:yo(t,e,t.prev)<0||yo(t,t.next,e)<0}function bo(t,e){var r=new So(t.i,t.x,t.y),i=new So(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 _o(t,e,r,i){var n=new So(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 Co(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 So(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 wo=0;function Oo(t,e,r,i){r=r||2,wo=i||0;var n,o,a,s,u,c,l,h=e&&e.length,f=h?e[0]*r:t.length,p=no(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,r,i){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=no(t,e[n]*i,n<o-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(fo(a));for(s.sort(uo),n=0;n<s.length;n++)co(s[n],r),r=oo(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(c=t[m+1])<o&&(o=c),u>a&&(a=u),c>s&&(s=c);l=0!==(l=Math.max(a-n,s-o))?1/l:0}return Ao(p,d,r,n,o,l),d}function Ao(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=ho(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)}(t,i,n,o);for(var s,u,c=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?so(t,i,n,o):ao(t))e.push(s.i/r+wo),e.push(t.i/r+wo),e.push(u.i/r+wo),Co(t),t=u.next,c=u.next;else if((t=u)===c){a?1===a?Ao(t=Ro(oo(t),e,r),e,r,i,n,o,2):2===a&&Lo(t,e,r,i,n,o):Ao(oo(t),e,r,i,n,o,1);break}}}function Ro(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!vo(n,o)&&xo(n,i,i.next,o)&&Eo(n,o)&&Eo(o,n)&&(e.push(n.i/r+wo),e.push(i.i/r+wo),e.push(o.i/r+wo),Co(i),Co(i.next),i=t=o),i=i.next}while(i!==t);return oo(i)}function Lo(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&mo(a,s)){var u=bo(a,s);return a=oo(a,a.next),u=oo(u,u.next),Ao(a,e,r,i,n,o),void Ao(u,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}var Mo=2;function Io(t,e){for(var r=t.s,i=t.p,n=r[1],o=i[1],a=0,s=0;s<n.length;s++){a+=(T=n[s]).length-1}var u,c=new Float32Array(a*Yi),l=e.indexBase,h=void 0===l?0:l,f=e.uvTransform,p=0,d=0,m=0,y=1,v=1;f&&(d=f[0],m=f[1],u=f[4],y=u?f[3]:f[2],v=u?f[2]:f[3]);var x=[0,0],g=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var T=n[s],E=o[s],b=o[s+1]||o[0],_=T,C=[0,0],S=0;S<_.length-1;S++){Fo(C,_[S],E,b,E[4],E[5],b[2],b[3]),O(C[0],C[1])}var w=Oo(Array.from(c),null,Yi,h);return{aPoint:c,index:new Uint16Array(w)};function O(t,e){c[p++]=t/2,c[p++]=e/2,f?(x[0]=t,x[1]=e,Vo(x,x,g),c[p++]=d+(x[0]+1)/2*y,c[p++]=m+(x[1]+1)/2*v):(c[p++]=(t+1)/2,c[p++]=(e+1)/2),p+=Mo}}function Po(t,e){for(var r=[],i=function(t){var e=[];return t.gs?t.gs.forEach((function(t){e.push({p:[It.SHAPE_POINTS,t.p],s:[It.SHAPE_SPLITS,t.s]})})):t.g?e.push({p:[It.SHAPE_POINTS,t.g.p],s:[It.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(f=Io(i[s],{indexBase:n,uvTransform:e})).aPoint.length/5,r.push(f),o+=f.aPoint.length,a+=f.index.length}if(1===r.length)return r[0];for(var u=new Float32Array(o),c=new Uint16Array(a),l=(s=0,0),h=0;s<r[s];s++){var f=r[s];u.set(f.aPoint,l),l+=f.aPoint.length,c.set(f.index,h),h+=f.index.length}return{aPoint:u,index:c}}function Vo(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}function Fo(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;return t[0]=c*r[0]+l*n+h*a+f*i[0],t[1]=c*r[1]+l*o+h*s+f*i[1],t}var No=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=i instanceof fi?i:Ci(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return t.prototype.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},t.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},t.prototype.clone=function(){return new t(this)},t}(),Do=function(t){this.content=t},zo=function(){function t(t){this.sort=t,this.length=0}return t.prototype.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},t.prototype.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},t.prototype.shiftNode=function(t){var e=new Do(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))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}},t.prototype.pushNode=function(t){var e=new Do(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))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}},t.prototype.removeNode=function(t){var e=this.first;if(this.length--,e===t)(r=this.first=e.next)&&(r.pre=null);else if((e=this.last)===t){var r;(r=this.last=e.pre)&&(r.next=null)}else if(t){var i=t.pre,n=t.next;i.next=n,n&&(n.pre=i)}t.pre=null,t.next=null},t.prototype.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},t.prototype.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}(),Uo=function(t){function e(e,r,i){var n=t.call(this,e)||this;n.name="ParticleSystemRenderer",n.particleMesh=new Rn(e,r),void 0!==i&&(n.trailMesh=new Nn(e,i));var 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}return o(e,t),e.prototype.start=function(){var t,e;this._priority=this.item.listIndex,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);try{for(var r=l(this.meshes),i=r.next();!i.done;i=r.next()){i.value.start()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new K(e,this.item.duration,0,0))},e.prototype.render=function(t){var e,r;try{for(var i=l(this.meshes),n=i.next();!n.done;n=i.next()){n.value.render(t)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.reset=function(){var t;this.particleMesh.clearPoints(),null===(t=this.trailMesh)||void 0===t||t.clearAllTrails()},e.prototype.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},e.prototype.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null===(e=this.trailMesh)||void 0===e||e.minusTime(t)},e.prototype.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},e.prototype.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null===(e=this.trailMesh)||void 0===e||e.mesh.setVisible(t)},e.prototype.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},e.prototype.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},e.prototype.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},e.prototype.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},e.prototype.hasTrail=function(){return void 0!==this.trailMesh},e.prototype.clearTrail=function(t){var e;null===(e=this.trailMesh)||void 0===e||e.clearTrail(t)},e.prototype.addTrailPoint=function(t,e,r){var i;null===(i=this.trailMesh)||void 0===i||i.addPoint(t,e,r)},e.prototype.setTrailStartPosition=function(t,e){var r;null===(r=this.trailMesh)||void 0===r||r.setPointStartPos(t,e)},e.prototype.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(oe),ko=function(e){function r(r,i){var n=e.call(this,r)||this;return n.destoryed=!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)===Nt.removeParticle,ray:t})}}},i&&n.fromData(i),n}return o(r,e),Object.defineProperty(r.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lifetime",{get:function(){return this.timePassed/this.item.duration},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),r.prototype.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]===It.CONSTANT_VEC3?e.add(i[1]):t=Ci(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)}},r.prototype.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)}},r.prototype.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())},r.prototype.setVisible=function(t){this.renderer.setVisible(t)},r.prototype.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?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new K(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},r.prototype.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?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new K(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},r.prototype.setParentTransform=function(t){},r.prototype.getTextures=function(){return this.renderer.getTextures()},r.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},r.prototype.stop=function(){this.ended=!0,this.started=!1},r.prototype.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 zo((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1},r.prototype.onUpdate=function(t){var e,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,n=this.options,o=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,u=(i-o)/this.item.duration,c=this.timePassed,l=!1,p=function(){r.trails&&!l&&(l=!0,s.forEach((function(t){var e=h(t,4),i=e[0],n=e[1],o=e[2],a=e[3];i<c?r.clearPointTrail(n):c>o&&r.updatePointTrail(n,u,a,o)})))};if(this.ended){if(this.item.endBehavior!==Vt.loop&&0===this.item.endBehavior){var d=s.last;d&&d.content[0]<this.lastUpdate&&(this.destoryed=!0)}}else{var m=this.item.duration,y=this.lifetime;if(c<m){var v=1/a.rateOverTime.getValue(y),x=Math.floor((c-this.lastEmitTime)/v),g=x,T=v/x,E=i,b=n.maxCount;this.updateEmitterTransform(c);for(var _=function(){var t=s.first;return r.emissionStopped||s.length===b&&t&&t.content[0]-o>c},C=0;C<g&&C<b&&!_();C++){(I=this.createPoint(y)).delay+=E+C*T,this.addParticle(I,b),this.lastEmitTime=c}for(var S=a.bursts,w=(null==S?void 0:S.length)-1,O=0;w>=0&&O<b&&!_();w--){var A=S[w],R=!A.disabled&&A.getGeneratorOptions(c,y);if(R){var L=a.burstOffsets[w],M=L&&L[R.cycleIndex]||[0,0,0];A.once&&this.removeBurst(w);for(C=0;C<R.count&&O<b&&!_();C++){var I;(I=this.initPoint(this.shape.generate({total:R.total,index:R.index,burstIndex:C,burstCount:R.count}))).delay+=E,O++,(e=I.transform).translate.apply(e,f([],h(M),!1)),this.addParticle(I,b)}}}}else if(this.item.endBehavior===Vt.loop)p(),this.loopStartTime=i-m,this.lastEmitTime-=m,this.lastUpdate-=m,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=m,t[2]-=m,t[3].delay-=m})),this.renderer.minusTimeForLoop(m),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===this.item.endBehavior&&(this.frozen=!0)}}p()}},r.prototype.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.prototype.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},r.prototype.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],o=new H,a=!1;if(i&&i.content)do{var s=h(i.content,4),u=s[0],c=s[1];s[2];var l=s[3];if(!(u>this.timePassed))break;var f=this.getPointPosition(l),p=t.ray,d=!1;p&&(d=!!p.intersectSphere({center:f,radius:t.radius},o)),d&&(t.removeParticle&&(r.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(i),i.content=[0]),n.push(f),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},r.prototype.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.prototype.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})}},r.prototype.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=void 0===o?[]:o,s=this.options.forceTarget,u=this.lastUpdate-n,c=new H,l=H.fromArray(a);e.assignWorldTRS(c);var h=ri(new H,this.options,l,u,i,c,r);if(s){var f=s.target||[0,0,0],p=s.curve.getValue(u/i),d=1-p;h.x=h.x*d+f[0]*p,h.y=h.y*d+f[1]*p,h.z=h.z*d+f[2]*p}return h},r.prototype.onEnd=function(t){},r.prototype.onIterate=function(t){},r.prototype.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),o=e.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),a=o.transformPoint(t.position,new H),s=new Fi({position:a,valid:!0}),u=t.direction;if(u=o.transformNormal(u,Bo).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)Yo.setElement(c,e.turbulence[c].getValue(r));Wo.setFromVector3(Yo.negate()),qo.setFromEuler(Wo).transformNormal(u).normalize()}var l,h=jo,f=Ho;i.alignSpeedDirection?(f.copyFrom(u),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=H.Z.clone(),o.transformNormal(this.upDirectionWorld)),h.crossVectors(f,this.upDirectionWorld).normalize(),h.isZero()&&h.set(1,0,0)):(h.set(1,0,0),f.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((l=Zo)[0]=p.animationDelay.getValue(r),l[1]=p.animationDuration.getValue(r),l[2]=p.cycles.getValue(r));var d=Xo;e.start3DRotation?d.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?d.set(0,0,e.startRotation.getValue(r)):d.set(0,0,0),s.setRotation(d.x,d.y,d.z);var m=e.startColor.getValue(r);3===m.length&&(m[3]=1);var y=Go;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var v=e.startSize.getValue(r),x=e.sizeAspect.getValue(r);y.x=v,y.y=0===x?0:v/x}var g=u.clone();if(g.multiply(n),!e.particleFollowParent){var T=new H;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return s.setScale(y.x,y.y,1),{size:y,vel:g,color:m,delay:e.startDelay.getValue(r),lifetime:e.startLifetime.getValue(r),uv:Ko(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:f,dirX:h,transform:s}},r.prototype.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e instanceof Array){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},r.prototype.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.prototype.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.prototype.stopParticleEmission=function(){this.emissionStopped=!0},r.prototype.resumeParticleEmission=function(){this.emissionStopped=!1},r.prototype.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.prototype.fromData=function(t){var r,i,n,o,a,s;e.prototype.fromData.call(this,t);var u=t;this.props=u,this.destoryed=!1;var c,l=u.options,h=u.positionOverLifetime,f=u.shape,p=h.gravityOverLifetime,d=ii(h.gravity),m=u.textureSheetAnimation,y=m?{animationDelay:Ci(m.animationDelay||0),animationDuration:Ci(m.animationDuration||1),cycles:Ci(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,v=!!(f&&f.turbulenceX||f.turbulenceY||f.turbulenceZ);v&&(c=[Ci(null!==(r=f.turbulenceX)&&void 0!==r?r:0),Ci(null!==(i=f.turbulenceY)&&void 0!==i?i:0),Ci(null!==(n=f.turbulenceZ)&&void 0!==n?n:0)]),this.name="ParticleSystem",this.shape=io(f),this.emission={rateOverTime:Ci(u.emission.rateOverTime),burstOffsets:Qo(null!==(o=u.emission.burstOffsets)&&void 0!==o?o:[]),bursts:(u.emission.bursts||[]).map((function(t){return new No(t)}))},this.textureSheetAnimation=y;var x,g=u.renderer||{},T={},E=u.rotationOverLifetime;E&&(T.asRotation=!!E.asRotation,T.z=E.z?Ci(E.z):Ci(0),E.separateAxes&&(T.x=E.x&&Ci(E.x),T.y=E.y&&Ci(E.y))),h.forceTarget&&(x={target:h.target||[0,0,0],curve:Ci(h.forceCurve||[It.LINE,[[0,0],[1,1]]])});var b={x:h.linearX&&Ci(h.linearX||0),y:h.linearY&&Ci(h.linearY||0),z:h.linearZ&&Ci(h.linearZ||0),asMovement:h.asMovement},_={x:h.orbitalX&&Ci(h.orbitalX),y:h.orbitalY&&Ci(h.orbitalY),z:h.orbitalZ&&Ci(h.orbitalZ),center:h.orbCenter,asRotation:h.asRotation},C=u.sizeOverLifetime||{},S=u.colorOverLifetime,w=(null==C?void 0:C.separateAxes)?{separateAxes:!0,x:Ci(C.x),y:Ci(C.y)}:{separateAxes:!1,x:Ci(("size"in C?C.size:C.x)||1)};g.anchor=g.anchor||[0,0];var O=j.fromArray(g.anchor);this.options={particleFollowParent:!!l.particleFollowParent,startLifetime:Ci(l.startLifetime),startDelay:Ci(l.startDelay||0),startSpeed:Ci(h.startSpeed||0),startColor:Ci(l.startColor),looping:!1,maxCount:null!==(a=l.maxCount)&&void 0!==a?a:0,gravityModifier:Ci(p||0),gravity:d,start3DSize:!!l.start3DSize,startTurbulence:v,turbulence:c,speedOverLifetime:h.speedOverLifetime&&Ci(h.speedOverLifetime),linearVelOverLifetime:b,orbitalVelOverLifetime:_,forceTarget:x},l.startRotationZ&&(this.options.startRotation=Ci(l.startRotationZ||0)),(l.startRotationX||l.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Ci(l.startRotationX||0),this.options.startRotationY=Ci(l.startRotationY||0),this.options.startRotationZ=Ci(l.startRotationZ||0)),l.start3DSize?(this.options.startSizeX=Ci(l.startSizeX),this.options.startSizeY=Ci(l.startSizeY)):(this.options.startSize=Ci(l.startSize),this.options.sizeAspect=Ci(l.sizeAspect||1));var A={meshSlots:l.meshSlots,name:this.name,matrix:q.IDENTITY,filter:u.filter,shaderCachePrefix:"",renderMode:g.renderMode||bt.BILLBOARD,side:g.side||mt.DOUBLE,gravity:d,blending:g.blending||dt.ALPHA,rotationOverLifetime:T,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:y,occlusion:!!g.occlusion,transparentOcclusion:!!g.transparentOcclusion,maxCount:l.maxCount,mask:g.mask,maskMode:null!==(s=g.maskMode)&&void 0!==s?s:yt.NONE,forceTarget:x,diffuse:g.texture,sizeOverLifetime:w,anchor:O};if(S){var R=S.color,L=S.opacity;A.colorOverLifetime={},L&&(A.colorOverLifetime.opacity=Ci(S.opacity)),R&&(R[0]===It.GRADIENT_COLOR?A.colorOverLifetime.color=S.color[1]:R[0]===It.RGBA_COLOR?A.colorOverLifetime.color=Ae.createWithData(this.engine,{data:new Uint8Array(R[1]),width:1,height:1}):R instanceof Ae&&(A.colorOverLifetime.color=R))}var M,I=[],P=[0,0,1,1];if(u.splits){var V=u.splits[0];P=(M=V[4])?[V[0],V[1],V[3],V[2]]:[V[0],V[1],V[2],V[3]]}if(y&&!y.animate)for(var F=M?y.row:y.col,N=M?y.col:y.row,D=y.total||F*N,z=0,U=0;U<F;U++)for(var k=0;k<N&&z<D;k++,z++)I.push([U*P[2]/F+P[0],k*P[3]/N+P[1],P[2]/F,P[3]/N]);else I.push(P);this.uvs=I,A.textureFlip=M;var B,G=u.trails;G&&(this.trails={lifetime:Ci(G.lifetime),dieWithParticles:!1!==G.dieWithParticles,sizeAffectsWidth:!!G.sizeAffectsWidth,sizeAffectsLifetime:!!G.sizeAffectsLifetime,inheritParticleColor:!!G.inheritParticleColor,parentAffectsPosition:!!G.parentAffectsPosition},B={name:"Trail",matrix:q.IDENTITY,minimumVertexDistance:G.minimumVertexDistance||.02,maxTrailCount:l.maxCount,pointCountPerTrail:Math.round(G.maxPointPerTrail)||32,blending:G.blending,texture:G.texture,opacityOverLifetime:Ci(G.opacityOverLifetime||1),widthOverTrail:Ci(G.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!G.occlusion,transparentOcclusion:!!G.transparentOcclusion,textureMap:G.textureMap,mask:g.mask,maskMode:g.maskMode},G.colorOverLifetime&&G.colorOverLifetime[0]===It.GRADIENT_COLOR&&(B.colorOverLifetime=G.colorOverLifetime[1]),G.colorOverTrail&&G.colorOverTrail[0]===It.GRADIENT_COLOR&&(B.colorOverTrail=G.colorOverTrail[1])),this.renderer=new Uo(this.engine,A,B),this.meshes=this.renderer.meshes;var X=u.interaction;X&&(this.interaction={multiple:X.multiple,radius:X.radius,behavior:X.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),this.item.getComponent(gn).createTrack(ln).createClip($o)},r=s([$t(t.DataType.ParticleSystem)],r)}(re),Bo=new H,Go=new j,Xo=new Q,jo=new H,Ho=new H,Yo=new H,Wo=new Q,Zo=[0,0,0],qo=new q;function Qo(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=t instanceof Array,i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function Ko(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var Jo,$o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.onPlayablePlay=function(){this.particleSystem=this.bindingItem.getComponent(ko),this.particleSystem&&(this.particleSystem.name=this.bindingItem.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform())},e.prototype.processFrame=function(t){var e=this.particleSystem;e&&(this.bindingItem.parent,e.setVisible(!0),e.onUpdate(t))},e}(un),ta=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(Qr),ea=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,o=t.textOverflow,a=void 0===o?Gt.display:o,s=t.textBaseline,u=void 0===s?Xt.top:s,c=t.textAlign,l=void 0===c?jt.left:c,h=t.text,f=t.letterSpace,p=void 0===f?0:f,d=t.autoWidth,m=void 0!==d&&d,y=t.fontSize,v=t.lineHeight,x=void 0===v?y:v,g=y+p;this.autoWidth=m,this.maxTextWidth=h.length*g,this.width=n,this.height=r,this.letterSpace=p,this.overFlow=a,this.textBaseline=u,this.textAlign=l,this.lineHeight=x}return t.prototype.getOffsetY=function(t){var e=0,r=(t.fontSize+t.outlineWidth)*t.fontScale;switch(this.textBaseline){case 0:e=r;break;case 1:e=(this.height+r)/2;break;case 2:e=this.height-r/2}return e},t.prototype.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case 0:r=t.outlineWidth*t.fontScale;break;case 1:r=(this.width*t.fontScale-e)/2;break;case 2:r=this.width*t.fontScale-e}return r},t.prototype.setSize=function(t,e){this.width=t,this.height=e},t}(),ra=function(t){var e,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=t.textColor,u=void 0===s?[1,1,1,1]:s,c=t.fontSize,l=void 0===c?40:c,h=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,y=void 0===m?"normal":m,v=t.fontFamily,x=void 0===v?"sans-serif":v;this.textColor=u,this.textWeight=d,this.fontStyle=y,this.fontFamily=x,this.fontSize=l,h&&(this.isOutlined=!0,this.outlineColor=null!==(e=h.outlineColor)&&void 0!==e?e:[1,1,1,1],this.outlineWidth=null!==(r=h.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),f&&(this.hasShadow=!0,this.shadowBlur=null!==(i=f.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=f.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=f.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=f.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==Yt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},ia=function(){function t(){}return t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var r={ascent:0,descent:0,fontSize:0},i=t._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),u=Math.ceil(t.HEIGHT_MULTIPLIER*s);s=s*t.BASELINE_MULTIPLIER|0,i.width=a,i.height=u,n.fillStyle="#f00",n.fillRect(0,0,a,u),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var c=n.getImageData(0,0,a,u).data,l=c.length,h=4*a,f=0,p=0,d=!1;for(f=0;f<s;++f){for(var m=0;m<h;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p+=h}for(r.ascent=s-f,p=l-h,d=!1,f=u;f>s;--f){for(m=0;m<h;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p-=h}return r.descent=f-s,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},Object.defineProperty(t,"_canvas",{get:function(){var e;return An(wn)?(e=window._createOffscreenCanvas(10,10),t.__canvas=e):t.__canvas||((e=document.createElement("canvas")).width=e.height=10,t.__canvas=e),t.__canvas},enumerable:!1,configurable:!0}),t._fonts={},t.METRICS_STRING="|ÉqÅ",t.BASELINE_SYMBOL="M",t.BASELINE_MULTIPLIER=1.4,t.HEIGHT_MULTIPLIER=2,t}(),na=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];t.QTextWrapMode=void 0,(Jo=t.QTextWrapMode||(t.QTextWrapMode={}))[Jo.Default=0]="Default",Jo[Jo.Clip=1]="Clip",Jo[Jo.Ellipsis=2]="Ellipsis";var oa=function(){function e(e,r){var i,n,o,a,s,u,c,l,h,f;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=t.QTextWrapMode.Clip,this.scaleX=1,this.scaleY=1,this.angle=0,this.active=!0,this.padding=0,this.borderColor="#ffffffff",this.borderWidth=1,this.fontProperties={ascent:0,descent:0,fontSize:0},this.fontVariant="normal",this.originX="left",this.originY="top",this.ellipsis="…",this.text=e,this.left=null!==(i=r.left)&&void 0!==i?i:0,this.top=null!==(n=r.top)&&void 0!==n?n:0,this.maxLineWidth=null!==(o=r.maxWidth)&&void 0!==o?o:0,this.letterSpacing=null!==(a=r.letterSpacing)&&void 0!==a?a:0,this.originX="left",this.originY="top",this.color=null!==(s=r.color)&&void 0!==s?s:"black",this.fontFamily=null!==(u=r.fontFamily)&&void 0!==u?u:"Arial",this.fontSize=null!==(c=r.fontSize)&&void 0!==c?c:48,this.wrap=null!==(l=r.wrap)&&void 0!==l?l:t.QTextWrapMode.Clip,this.fontStyle=null!==(h=r.fontStyle)&&void 0!==h?h:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!==(f=r.angle)&&void 0!==f?f:0,this.name=r.name||""}return e.prototype.update=function(){this.updateDimension()},e.prototype.render=function(){if(void 0!==this.viewer){var t=this.viewer.renderContext;void 0!==t&&(t.save(),this.setRenderTransform(t),this.renderText(t),this.active&&this.drawBorders(t),t.restore())}},e.prototype.init=function(t){this.viewer=t,this.updateDimension()},e.prototype.getLayout=function(){var t=this.viewer.scaleX,e=this.viewer.scaleY;return{x:this.left*t,y:this.top*e,width:this.width*t,height:this.height*e}},e.prototype.updateDimension=function(){var t=this.viewer.renderContext;this.configTextStyle(t),this.configTextLayout(t);var e=this.getFontDesc();this.fontProperties=ia.measureFont(e),0===this.fontProperties.fontSize&&(this.fontProperties.fontSize=this.fontSize,this.fontProperties.ascent=this.fontSize);var r=this.createCharsFromText(t,this.text),i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}this.chars=r,this.maxLineWidth=i,void 0===this.height&&(this.height=this.fontProperties.fontSize),void 0===this.width&&(this.width=this.maxLineWidth)},e.prototype.configTextStyle=function(t){t.font=this.getFontDesc(),t.fillStyle=this.color},e.prototype.getFontDesc=function(){for(var t="number"==typeof this.fontSize?"".concat(this.fontSize,"px"):this.fontSize,e=this.fontFamily.split(","),r=e.length-1;r>=0;r--){var i=e[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||na.includes(i)||(i='"'.concat(i,'"')),e[r]=i}return e.push("Arial, Helvetica, sans-serif"),"".concat(this.fontStyle," ").concat(this.fontVariant," ").concat(this.fontWeight," ").concat(t," ").concat(e.join(","))},e.prototype.configTextLayout=function(t){t.textBaseline=this.textBaseline,t.textAlign=this.textAlign},e.prototype.setRenderTransform=function(t){t.scale(this.scaleX,this.scaleY),t.translate(this.left,this.top)},e.prototype.renderText=function(t){this.drawCharsInTextBox(t,{min:[0,0],max:[0+this.width,0+this.height]})},e.prototype.drawCharsInTextBox=function(e,r){var i=this.chars,n=0;if(i.length>0){var o=i[i.length-1];n=o.left+o.width}var a=r.max[0]-r.min[0],s=0;"left"===this.textAlign?s=0:"center"===this.textAlign?s=.5*(a-n):"right"===this.textAlign&&(s=a-n),this.addOffsetToChars(i,s);var u=this.cloneChars(this.clipCharsWithTextBox(i,r)),c=u;this.wrap===t.QTextWrapMode.Ellipsis&&0===(c=this.replaceCharWithEllipsis(e,u,r)).length&&0!==i.length&&this.addEllipsisToChars(e,c,r),this.drawCharsFromLeft(e,c)},e.prototype.addEllipsisToChars=function(t,e,r){var i,n,o,a=t.measureText(this.ellipsis).width;if("left"===this.textAlign)e.push({char:this.ellipsis,left:r.min[0],top:0,width:a,heigh:null!==(i=this.height)&&void 0!==i?i:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else if("right"===this.textAlign)e.push({char:this.ellipsis,left:r.max[0]-a,top:0,width:a,heigh:null!==(n=this.height)&&void 0!==n?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var s=.5*(r.max[0]+r.min[0]);e.push({char:this.ellipsis,left:s-.5*a,top:0,width:a,heigh:null!==(o=this.height)&&void 0!==o?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},e.prototype.createCharsFromText=function(t,e){var r=e.split(""),i=0,n=0;"top"===this.textBaseline?n=0:"middle"===this.textBaseline?n+=.5*this.fontProperties.ascent:"alphabetic"===this.textBaseline&&(n+=this.fontProperties.ascent);for(var o=[],a=0;a<r.length;++a){var s=r[a],u=Math.floor(t.measureText(s).width),c={left:i,top:n,width:u,heigh:this.fontSize,char:s,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!1,scale:1,index:a};o.push(c),i+=u+this.letterSpacing}return o},e.prototype.addOffsetToChars=function(t,e){return t.forEach((function(t){t.left+=e})),t},e.prototype.clipCharsWithTextBox=function(t,e){for(var r=[],i=0;i<t.length;++i){var n=t[i];n.left>=e.min[0]&&n.left+n.width<e.max[0]+.5&&r.push(n)}return r},e.prototype.cloneChars=function(t){return t.map((function(t){return a({},t)}))},e.prototype.replaceCharWithEllipsis=function(t,e,r){var i=t.measureText(this.ellipsis).width;if(e.length>0){if(0!==e[0].index)(n=a({},e[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromLeft(e,n,r);var n,o=e.length-1,s=this.chars.length;if(e[o].index!==s-1)(n=a({},e[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromRight(e,n,r)}return e},e.prototype.findEllipsisPositionAndReplaceCharsFromLeft=function(t,e,r){for(var i=0,n=0;n<t.length;++n){var o=t[n];if(i=n,o.left+o.width-e.width>=r.min[0])break}var a=t[i];e.left=a.left+a.width-e.width;for(n=0;n<i+1;++n)t.shift();return[e].concat(t)},e.prototype.findEllipsisPositionAndReplaceCharsFromRight=function(t,e,r){for(var i=t.length-1,n=i;n>=0;--n){if(i=n,t[n].left+e.width<=r.max[0])break}e.left=t[i].left;for(n=t.length-1;n>=i;--n)t.pop();return t.concat([e])},e.prototype.drawCharsFromLeft=function(t,e){var r=t.textAlign||"left";t.textAlign="left";for(var i=0;i<e.length;++i){var n=e[i];t.fillText(n.char,n.left,n.top)}t.textAlign=r},e.prototype.drawBorders=function(t){this.padding;var e=this.borderWidth;t.strokeStyle=this.borderColor,t.lineWidth=e;var r=this.width,i=this.height,n=0,o=0;"center"===this.originX?n-=this.width/2:"right"===this.originX&&(n-=this.width),"center"===this.originY?o-=this.height/2:"bottom"===this.originY&&(o-=this.height),t.strokeRect(n+e/2,o+e/2,r-e,i-e)},e}(),aa=function(){function t(t,e,r,i,n,o){var a;this.textList=[],a="string"==typeof t?document.getElementById(t):t,this.scaleX=null!=i?i:1,this.scaleY=null!=n?n:1,this.flipY=null!=o&&o,this.width=e,this.height=r,a.style.width="".concat(e*this.scaleX,"px"),a.style.height="".concat(r*this.scaleY,"px");this.devicePixelRatio=1,a.width=1*e*this.scaleX,a.height=1*r*this.scaleY,a.className="lower-canvas",this.renderCanvas=a,this.renderContext=this.renderCanvas.getContext("2d"),this.renderContext.scale(1*this.scaleX,1*this.scaleY)}return t.prototype.initDimension=function(t,e,r,i){this.width=t,this.height=e,this.scaleX=null!=r?r:1,this.scaleY=null!=i?i:1,this.renderCanvas.style.width="".concat(t*this.scaleX,"px"),this.renderCanvas.style.height="".concat(e*this.scaleY,"px");var n=this.devicePixelRatio;this.renderCanvas.width=n*t*this.scaleX,this.renderCanvas.height=n*e*this.scaleY,this.flipY&&(this.renderContext.translate(0,this.height),this.renderContext.scale(1,-1)),this.renderContext.scale(n*this.scaleX,n*this.scaleY)},t.prototype.clearText=function(){this.textList=[]},t.prototype.clearCanvasWithContext=function(t){t.clearRect(0,0,this.width,this.height)},t.prototype.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},t.prototype.addObject=function(t){t.init(this),this.textList.push(t)},t.prototype.render=function(){this.clearCanvasWithContext(this.renderContext),this.renderContext.fillStyle="rgba(255, 255, 255, 0.0039)",this.renderContext.fillRect(0,0,this.width,this.height);var t=this.background;t&&void 0!==t.width&&void 0!==t.height&&this.renderContext.drawImage(t,0,0,t.width,t.height,0,0,this.width,this.height);for(var e=0;e<this.textList.length;++e){this.renderContext.save();var r=this.textList[e];r.update(),r.render(),this.renderContext.restore()}},t}();function sa(t,e){return e=e||{},new Promise((function(r,i){var n=new XMLHttpRequest;n.responseType=(null==e?void 0:e.responseType)||"json",n.addEventListener("load",(function(){return r(n.response)})),n.addEventListener("error",(function(){return i(Error("load ".concat(t," fail")))})),n.open((null==e?void 0:e.method)||"get",t),n.send(null==e?void 0:e.data)}))}function ua(t,e,r,i,n){return u(this,void 0,void 0,(function(){var o,a,s,u,l,h,f,p,d,m;return c(this,(function(c){switch(c.label){case 0:return o={},a=[],i=i||{},r=r||{},e.asImage?(s=e.content.replace(/\$/g,""),u=r[s]||e.variables[s],l=function(t){var r=(null==i?void 0:i.canvas)||document.createElement("canvas"),o=r.width=e.backgroundWidth,a=r.height=e.backgroundHeight,s=r.getContext("2d");return null==s||s.clearRect(0,0,o,a),n&&(null==s||s.translate(0,a),null==s||s.scale(1,-1)),null==s||s.drawImage(t,0,0,t.width,t.height,0,0,o,a),r},u?[2,be(u).then(l)]:[2,ca(t).then(l)]):(h=i.templateScale||1,Object.keys(e.variables).forEach((function(t){var i=e.variables[t];if(r.hasOwnProperty(t)&&(i=r[t]),/^image_/.test(t)){var n=i instanceof Array,s=n?i[0]:i;a.push(function(t,e){return r(t,(function(i){return e?r(e,(function(){return t})):t}));function r(t,e){return/^(https?:)?\/\//.test(t)?sa(t,{responseType:"blob"}).then(la,e):Promise.resolve(t)}}(s,n&&i[1]).then((function(e){return o[t]=e})))}else o[t]=i})),[4,Promise.all(a)]);case 1:return c.sent(),[4,be(t)];case 2:return f=c.sent(),p=e.content.replace(/\$([\w_]+)\$/g,(function(t,e){return o[e]})).replace('width="'.concat(e.width,'px"'),'width="'.concat(e.width*h,'px"')).replace('height="'.concat(e.height,'px"'),'height="'.concat(e.height*h,'px"')),[4,be("data:image/svg+xml,".concat(encodeURIComponent(p)))];case 3:return d=c.sent(),(m=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=f.width*h,m.height=f.height*h,[2,new Promise((function(t,r){var i=m.getContext("2d");i.clearRect(0,0,m.width,m.height),n&&(i.translate(0,m.height),i.scale(1,-1)),i.drawImage(f,0,0,f.width,f.height,0,0,m.width,m.height),i.drawImage(d,0,0,d.width,d.height,(e.x||0)*h,(e.y||0)*h,e.width*h/e.backgroundWidth*f.width,e.height*h/e.backgroundHeight*f.height),t(m)}))]}}))}))}function ca(t){return ft(t)?be(t):Promise.resolve(t)}function la(t){return new Promise((function(e,r){var i=new FileReader;i.readAsDataURL(t),i.onload=function(){e(i.result)},i.onerror=r}))}var ha=["serif","sans-serif","monospace","courier"],fa=800,pa=600,da=new Map,ma=new(function(){function t(){this.elements=[]}return t.prototype.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(An(wn))return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},t.prototype.saveCanvas=function(t){t.width=t.height=1,this.elements.length<3?T(this.elements,t):t.remove()},t}());function ya(t,e){var r,i,n;if(null===(r=null==t?void 0:t.background)||void 0===r?void 0:r.name){var o=t.background.name;e&&e[o]?n=e[o]:(null===(i=t.background)||void 0===i?void 0:i.url)&&(n=t.background.url)}return n}function va(e,r,i,n,o){var s;return u(this,void 0,void 0,(function(){var u,l,h,f,p,d,m,y,v,x,g;return c(this,(function(c){switch(c.label){case 0:if(!r)throw Error("image not provided");return u=(null==o?void 0:o.templateScale)||1,l=u,h=u,f=r,p=r.width,d=r.height,i?(p=i.width,d=i.height,r.width===p&&r.height===d||(l*=r.width/i.width,h*=r.height/i.height),(m=ya(i,n))&&m!==r.src?ft(m)?[4,be(m)]:[3,2]:[3,4]):[3,5];case 1:return y=c.sent(),[3,3];case 2:y=m,c.label=3;case 3:f=y,c.label=4;case 4:(v=i.content)&&(x=function(e,r,i){var n=e.fonts,o=[];return e.texts.forEach((function(a){var s,u=a.t,c=a.x,l=a.y,h={weight:400,family:"serif",size:48,style:Yt.normal};void 0!==a.f&&(h=n[a.f]);var f=a.n;f&&r&&r.hasOwnProperty(f)&&(u="".concat(r[f]));var p=new oa(u,{left:c,top:l,fontSize:h.size,fontFamily:h.family,fontWeight:"".concat(h.weight),fontStyle:"normal",name:f});if(void 0!==a.r&&(p.angle=a.r*Math.PI/180),p.active=null!==(s=null==i?void 0:i.debug)&&void 0!==s&&s,void 0!==a.w&&(p.width=a.w),void 0!==h.letterSpace&&(p.letterSpacing=h.letterSpace),a.of===Gt.display?p.wrap=t.QTextWrapMode.Default:a.of===Gt.clip?p.wrap=t.QTextWrapMode.Clip:a.of===Gt.ellipsis&&(p.wrap=t.QTextWrapMode.Ellipsis),void 0!==a.c){var d=e.colors[a.c][1],m=1;void 0!==d[3]&&(m=d[3]/255),p.color="rgba(".concat(d[0],", ").concat(d[1],", ").concat(d[2],", ").concat(m,")")}a.a===jt.left?p.textAlign="left":a.a===jt.middle?p.textAlign="center":a.a===jt.right&&(p.textAlign="right"),h.style===Yt.normal?p.fontStyle="normal":h.style===Yt.italic?p.fontStyle="italic":h.style===Yt.oblique&&(p.fontStyle="oblique"),void 0!==h.weight&&(p.fontWeight=String(h.weight)),(null==i?void 0:i.borderColor)&&(p.borderColor=i.borderColor),void 0!==(null==i?void 0:i.borderWidth)&&(p.borderWidth=i.borderWidth),o.push(p)})),o}(v,n,a(a({},o),{scaleX:l,scaleY:h})),x.forEach((function(t){e.addObject(t)}))),c.label=5;case 5:return e.flipY=null!==(s=null==o?void 0:o.flipY)&&void 0!==s&&s,e.initDimension(p,d,l,h),e.background=f,e.render(),(g=null==o?void 0:o.textLayouts)&&(g.length=0,e.textList.forEach((function(t){var e=t.getLayout(),r={x:e.x,y:e.y,width:e.width,height:e.height};g.push(r)}))),[2]}}))}))}function xa(t){return u(this,void 0,void 0,(function(){var e,r,i;return c(this,(function(n){switch(n.label){case 0:if(!t.content||!t.content.fonts)return[3,4];e=t.content.fonts,r=function(t){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=e[t].family,i=e[t].url,n=!1,ha.includes(r)?n=!0:void 0!==document.fonts&&document.fonts.forEach((function(t){t.family===r&&(n=!0)})),n||void 0===i||""===i?[3,2]:(o="url(".concat(i,")"),void 0===document.fonts?[3,2]:[4,(a=new FontFace("".concat(r),o)).load()]);case 1:s.sent(),document.fonts.add(a),s.label=2;case 2:return[2]}}))},i=0,n.label=1;case 1:return i<e.length?[5,r(i)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}}))}))}function ga(t,e,r,i,n){return u(this,void 0,void 0,(function(){var o,s,u;return c(this,(function(c){switch(c.label){case 0:return o=a(a({},i),{flipY:n}),s=function(t,e,r){var i,n=(null==r?void 0:r.templateScale)||1,o=(null==r?void 0:r.flipY)||!1;if(null==r?void 0:r.canvas){if(!(i=da.get(r.canvas))){var a=new aa(r.canvas,t,e,n,n,o);da.set(r.canvas,a),i=a}}else{var s=ma.getCanvas();i=new aa(s,fa,pa,n,n,o)}return i}(fa,fa,o),void 0===e?[3,2]:[4,xa(e)];case 1:c.sent(),c.label=2;case 2:return s.clearText(),"string"!=typeof t?[3,5]:[4,be(t)];case 3:return u=c.sent(),[4,va(s,u,e,r,o)];case 4:return c.sent(),[2,s.renderCanvas];case 5:return[4,va(s,t,e,r,o)];case 6:return c.sent(),[2,s.renderCanvas]}}))}))}function Ta(t,e,r,i,n){return u(this,void 0,void 0,(function(){return c(this,(function(o){return 2===e.v?[2,ga(t,e,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,ua(t,e,r,i,n)]}))}))}var Ea=function(e){function r(t,r){var i=e.call(this,t,r)||this;if(i.isDirty=!0,i.canvas=ma.getCanvas(),ma.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return i;var n=r.options;return i.textStyle=new ra(n),i.textLayout=new ea(n),i.text=n.text,i.updateTexture(),i}return o(r,e),r.prototype.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}},r.prototype.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},r.prototype.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},r.prototype.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},r.prototype.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},r.prototype.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},r.prototype.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},r.prototype.setFontFamily=function(t){this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},r.prototype.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},r.prototype.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},r.prototype.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},r.prototype.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},r.prototype.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},r.prototype.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},r.prototype.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},r.prototype.update=function(t){e.prototype.update.call(this,t),this.updateTexture()},r.prototype.updateTexture=function(){if(this.isDirty&&this.context&&this.canvas){var t=this.context,e=this.textStyle,r=this.textLayout,i=e.fontScale,n=(r.width+e.fontOffset)*i,o=r.height*i,a=e.fontSize*i,s=r.lineHeight*i;this.char=(this.text||"").split(""),this.canvas.width=n,this.canvas.height=o,t.clearRect(0,0,n,this.canvas.height),t.fillStyle="rgba(255, 255, 255, 0.0039)",t.fillRect(0,0,n,this.canvas.height),e.fontDesc=this.getFontDesc(),t.font=e.fontDesc,e.hasShadow&&this.setupShadow(),e.isOutlined&&this.setupOutline(),t.fillStyle="rgba(".concat(e.textColor[0],", ").concat(e.textColor[1],", ").concat(e.textColor[2],", ").concat(e.textColor[3],")");for(var u=[],c=(s-a)/3,l=0,h=r.getOffsetY(e)+c,f=[],p=[],d=0;d<this.char.length;d++){var m=this.char[d],y=t.measureText(m);((l+=r.letterSpace*i)+y.width>n&&d>0||"\n"===m)&&(u.push({y:h,width:l,chars:f,charOffsetX:p}),l=0,h+=s,f=[],p=[]),"\n"!==m&&(f.push(m),p.push(l),l+=y.width)}u.push({y:h,width:l,chars:f,charOffsetX:p}),u.forEach((function(i){var n=r.getOffsetX(e,i.width);i.chars.forEach((function(r,o){e.isOutlined&&t.strokeText(r,n+i.charOffsetX[o],i.y),t.fillText(r,n+i.charOffsetX[o],i.y)}))})),e.hasShadow&&(t.shadowColor="transparent");var v=t.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",Ae.createWithData(this.engine,{data:new Uint8Array(v.data),width:v.width,height:v.height},{flipY:!0,magFilter:ue.LINEAR,minFilter:ue.LINEAR,wrapS:ue.CLAMP_TO_EDGE,wrapT:ue.CLAMP_TO_EDGE})),this.isDirty=!1}},r.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.options;this.textStyle=new ra(r),this.textLayout=new ea(r),this.text=r.text,this.updateTexture()},r.prototype.getFontDesc=function(){var t=this.textStyle,e="".concat((t.fontSize*t.fontScale).toString(),"px ");return ha.includes(t.fontFamily)?e+=t.fontFamily:e+='"'.concat(t.fontFamily,'"'),t.textWeight!==Ht.normal&&(e="".concat(t.textWeight," ").concat(e)),t.fontStyle!==Yt.normal&&(e="".concat(t.fontStyle," ").concat(e)),e},r.prototype.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba(".concat(255*e.outlineColor[0],", ").concat(255*e.outlineColor[1],", ").concat(255*e.outlineColor[2],", ").concat(e.outlineColor[3],")"),t.lineWidth=2*e.outlineWidth},r.prototype.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba(".concat(255*e.shadowColor[0],", ").concat(255*e.shadowColor[1],", ").concat(255*e.shadowColor[2],", ").concat(e.shadowColor[3],")"),t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},r=s([$t(t.DataType.TextComponent)],r)}(Cn),ba=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(Qr),_a=1,Ca=function(e){function r(t){var r=e.call(this,t)||this;return r.worldMatrix=q.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"+_a++,r.name="<unnamed>",r._priority=0,r}return o(r,e),Object.defineProperty(r.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(t){this.visible=t},r.prototype.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.prototype.render=function(t){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),r.flush(),t.drawGeometry(r,e)},r.prototype.getVisible=function(){return this.visible},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},r.prototype.getBoundingBox=function(){var e,r,i=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);var n=[];try{for(var o=l(this.triangles),a=o.next();!a.done;a=o.next()){var s=a.value;n.push({p0:s.p0,p1:s.p1,p2:s.p2})}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n.forEach((function(t){t.p0=i.transformPoint(t.p0,new H),t.p1=i.transformPoint(t.p1,new H),t.p2=i.transformPoint(t.p2,new H)})),{type:t.HitTestType.triangle,area:n}},r.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},r.prototype.toData=function(){this.taggedProperties.id=this.guid},r.prototype.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},s([Jt()],r.prototype,"geometry",void 0),r=s([$t(t.DataType.EffectComponent)],r)}(oe);var Sa,wa=function(e){function r(t,r){var i=e.call(this,t)||this;return i.children=[],i.transform=new Fi,i.duration=0,i.start=0,i.ended=!1,i.delaying=!0,i.type=Et.base,i.stopped=!1,i.components=[],i.itemBehaviours=[],i.rendererComponents=[],i.visible=!0,i._contentVisible=!1,i.speed=1,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=t,i.addComponent(gn),r&&i.fromData(r),i}var i;return o(r,e),i=r,r.isComposition=function(t){return t.type===Et.composition},r.isSprite=function(t){return t.type===Et.sprite},r.isParticle=function(t){return t.type===Et.particle},r.isNull=function(t){return t.type===Et.null},r.isTree=function(t){return t.type===Et.tree},r.isCamera=function(t){return t.type===Et.camera},r.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},Object.defineProperty(r.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"reusable",{get:function(){var t,e;return null!==(e=null===(t=this.composition)||void 0===t?void 0:t.reusable)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lifetimeStarted",{get:function(){return!this.delaying},enumerable:!1,configurable:!0}),r.prototype.setSpeed=function(t){this.speed=t},r.prototype.getSpeed=function(){return this.speed},r.prototype.addComponent=function(t){var e=new t(this.engine);return e.item=this,this.components.push(e),e.onAttached(),e},r.prototype.getComponent=function(t){var e,r,i;try{for(var n=l(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;if(a instanceof t){i=a;break}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},r.prototype.getComponents=function(t){var e,r,i=[];try{for(var n=l(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;a instanceof t&&i.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},r.prototype.setParent=function(t){t!==this&&(this.parent&&E(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.prototype.stop=function(){this.stopped=!0},r.prototype.onEnd=function(){},r.prototype.setColor=function(t,e,r,i){},r.prototype.setOpacity=function(t){},r.prototype.getVisible=function(){return this.visible},r.prototype.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},r.prototype.getWorldTransform=function(t){var e=null!=t?t:new Fi({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.prototype.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},r.prototype.translate=function(t,e,r){this.transform.translate(t,e,r)},r.prototype.rotate=function(t,e,r){var i=new Q(t,e,r),n=Y.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},r.prototype.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},r.prototype.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*n/a,-2*e*o/s,r)}},r.prototype.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},r.prototype.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},r.prototype.setScale=function(t,e,r){this.transform.setScale(t,e,r)},r.prototype.getBoundingBox=function(){},r.prototype.getHitTestParams=function(t){},r.prototype.getCurrentPosition=function(){var t=new H;return this.transform.assignWorldTRS(t),t},r.prototype.isEnded=function(t){return t-this.duration>.001},r.prototype.find=function(t){var e,r,i,n;if(this.name===t)return this;try{for(var o=l(this.children),a=o.next();!a.done;a=o.next()){if((c=a.value).name===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}try{for(var s=l(this.children),u=s.next();!u.done;u=s.next()){var c;return(c=u.value).find(t)}}catch(t){i={error:t}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}},r.prototype.fromData=function(t){var r,i;e.prototype.fromData.call(this,t);var n=t.id,o=t.name,a=t.delay,s=t.parentId,u=t.endBehavior,c=t.transform,h=t.listIndex,f=void 0===h?0:h,p=t.duration,d=void 0===p?0:p;this.props=t,this.type=t.type,this.id=n.toString(),this.name=o,this.start=a||this.start,c&&(c.position=(new H).copyFrom(c.position),c.rotation=(new Q).copyFrom(c.rotation),c.scale=(new H).copyFrom(c.scale),c.size&&(c.size=(new j).copyFrom(c.size)),c.anchor&&(c.anchor=(new j).copyFrom(c.anchor)),this.transform.setTransform(c)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=d,this.endBehavior=u,this.lifetime=-this.start/this.duration,this.listIndex=f,this.oldId=t.oldId,t.content||(t.content={options:{}});var m=this.getComponent(gn);(m.fromData(t.content),this.type!==Et.particle)&&m.createTrack(ln,"AnimationTrack").createClip(vn,"AnimationTimelineClip").playable.fromData(t.content);if(d<=0)throw Error("Item duration can't be less than 0, see ".concat(Zi["Item duration can't be less than 0"]));if(t.components)try{for(var y=l(t.components),v=y.next();!v.done;v=y.next()){var x=v.value;this.components.push(x),x instanceof oe?this.rendererComponents.push(x):x instanceof ne&&this.itemBehaviours.push(x)}}catch(t){r={error:t}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}},r.prototype.toData=function(){var e,r,i,n;if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=t.DataType.VFXItemData,"rootItem"!==(null===(i=this.parent)||void 0===i?void 0:i.name)&&(this.taggedProperties.parentId=null===(n=this.parent)||void 0===n?void 0:n.guid),!this.taggedProperties.components){this.taggedProperties.components=[];try{for(var o=l(this.components),a=o.next();!a.done;a=o.next()){var s=a.value;s instanceof Ca&&this.taggedProperties.components.push(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}}this.taggedProperties.content={}},r.prototype.translateByPixel=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.translate(2*t*n/a,-2*e*o/s,0)}},r.prototype.dispose=function(){var t,e;if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);try{for(var r=l(this.components.slice()),i=r.next();!i.done;i=r.next()){i.value.dispose()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.components=[],this._content=void 0,this.composition=null,this._contentVisible=!1,this.transform.setValid(!1)}},r.prototype.resetChildrenParent=function(){var t,e,r;try{for(var i=l(this.children),n=i.next();!n.done;n=i.next()){var o=n.value;this.parent&&o.setParent(this.parent)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.parent&&E(null===(r=this.parent)||void 0===r?void 0:r.children,this)},r=i=s([$t(t.DataType.VFXItemData)],r)}(ee);function Oa(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case Et.null:case Et.base:i="cal";break;case Et.sprite:i="sprite";break;case Et.particle:i="particle";break;case Et.interact:i="interact";break;case Et.camera:i="camera";break;case Et.filter:i="filter";break;case Et.text:i="text";break;case Et.tree:i="tree";break;default:throw new Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}t.Item=void 0,(Sa=t.Item||(t.Item={})).is=function(t,e){return t.type===e},Sa.isFilter=function(t){return t.type===Et.filter},Sa.isComposition=function(t){return t.type===Et.composition},Sa.isParticle=function(t){return t.type===Et.particle},Sa.isNull=function(t){return t.type===Et.null};var Aa={},Ra=[],La={};function Ma(t,e,r,i){La[t]=r,Aa[t]=e,i&&T(Ra,t)}var Ia,Pa,Va,Fa,Na,Da,za,Ua,ka,Ba,Ga,Xa=function(){function t(t){var e={},r=[],i=function(t){var i=Aa[t];r.includes(i)||(r.push(i),e[t]=i)};Ra.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map((function(t){var e=Aa[t];if(!e)throw new Error("plugin '".concat(t,"' not found.")+function(t){var e=ja[t];return e?"\nInstall Plugin: npm i ".concat(e,"@latest --save\nImport Plugin: import '").concat(e,"'"):""}
|
|
15
|
-
/*!
|
|
16
|
-
* Name: @galacean/effects-specification
|
|
17
|
-
* Description: Galacean Effects JSON Specification
|
|
18
|
-
* Author: Ant Group CO., Ltd.
|
|
19
|
-
* Version: v1.0.1
|
|
20
|
-
*/(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}return t.prototype.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},t.prototype.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},t.prototype.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},t.prototype.createPluginItem=function(t,e,r){var i=La[t];if(!i)throw new Error("plugin ".concat(t," no registered constructor"));var n=new i(r.getEngine(),e,r);if(n.composition=r,!(n instanceof wa))throw new Error("plugin ".concat(t," invalid constructor type"));return n},t.prototype.processRawJSON=function(t,e){return u(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this.callStatic("processRawJSON",t,e)]}))}))},t.prototype.callStatic=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return u(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=Aa[o.name],t in a&&r.push(Promise.resolve(a[t].apply(a,f([],h(e),!1))));return[2,Promise.all(r)]}))}))},t.prototype.precompile=function(t,e,r){return u(this,void 0,void 0,(function(){return c(this,(function(i){return[2,this.callStatic("precompile",t,e,r)]}))}))},t.prototype.loadResources=function(t,e){return u(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this.callStatic("prepareResource",t,e)]}))}))},t}(),ja={"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"};!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Ia||(Ia={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(Pa||(Pa={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Va||(Va={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Fa||(Fa={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(Na||(Na={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Da||(Da={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(za||(za={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Ua||(Ua={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(ka||(ka={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(Ba||(Ba={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Ga||(Ga={}));var Ha,Ya,Wa,Za,qa,Qa,Ka,Ja,$a,ts,es,rs,is,ns,os,as,ss,us=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=us]="landscape"}(Ha||(Ha={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Ya||(Ya={})),function(t){t[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"}(Wa||(Wa={})),function(t){t[t.AUTO=0]="AUTO",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.LINE=4]="LINE",t[t.HOLD=5]="HOLD",t[t.LINE_OUT=6]="LINE_OUT"}(Za||(Za={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(qa||(qa={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Qa||(Qa={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ka||(Ka={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(Ja||(Ja={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}($a||($a={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(ts||(ts={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(es||(es={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive"}(rs||(rs={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(is||(is={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(ns||(ns={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(os||(os={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(as||(as={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ss||(ss={}));var cs=function(){return cs=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},cs.apply(this,arguments)};function ls(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function hs(t,e){if(!t.includes(e))return t.push(e),!0}function fs(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function ps(t){if(Number.isFinite(t))return[Wa.CONSTANT,t];if(t){if("lines"===t[0])return[Wa.LINE,t[1]];if("curve"===t[0])return[Wa.CURVE,t[1]];if("static"===t[0])return[Wa.CONSTANT,t[1]]}}function ds(t,e){return Array.isArray(t)&&"random"===t[0]?[Wa.CONSTANT,t[1][e]]:ps(t)}function ms(t){return t&&"color"===t[0]?gs(t[1],!0):[1,1,1,1]}function ys(t,e){if(t){if("colors"===t[0])return[Wa.COLORS,t[1].map((function(t){return gs(t,e)}))];if("gradient"===t[0])return xs(t[1],e);if("color"===t[0])return[Wa.RGBA_COLOR,gs(t[1],e)]}}function vs(t){return t&&"random"===t[0]?[Wa.RANDOM,t[1]]:ps(t)}function xs(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),o=gs(t[i],e);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Wa.GRADIENT_COLOR,r]}}function gs(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]||[0,0,0,255])}else t instanceof Array&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=function(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}(r)),r}function Ts(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&xs(t[1],e):xs(t,e)}function Es(t){if(t){if(3===t.length)return[Wa.CONSTANT_VEC3,t];if("path"===t[0])return[Wa.LINEAR_PATH,t[1]];if("bezier"===t[0])return[Wa.BEZIER_PATH,t[1]]}}function bs(t){var e,r;try{for(var i=ls(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;t[o]=Number(t[o])}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}function _s(t){var e,r;try{for(var i=ls(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===t[o]&&delete t[o]}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}"function"==typeof SuppressedError&&SuppressedError;var Cs=Math.cos,Ss=Math.sin,ws=Math.PI/180,Os=180/Math.PI;function As(t){var e,r=t.options,i=t.transform,n={type:Na.NONE};if(t.shape){var o=null===(e=t.shape.shape)||void 0===e?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=cs(cs({},t.shape),{type:Na[o]}),t.shape.upDirection){var a=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}(t.shape.upDirection,3),s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=vs(r.turbulenceX),n.turbulenceY=vs(r.turbulenceY),n.turbulenceZ=vs(r.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return bs(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return bs(t)}))),l.rateOverTime&&(l.rateOverTime=vs(l.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:l,options:{startLifetime:vs(r.startLifetime),start3DSize:!!r.start3DSize,startSize:vs(r.startSize),startSizeX:vs(r.startSizeX),startSizeY:vs(r.startSizeY),sizeAspect:vs(r.sizeAspect),maxCount:r.maxCount,startDelay:vs(r.startDelay),startColor:ys(r.startColor,!0),startRotationZ:vs(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=vs(r.startRotationX),h.options.startRotationY=vs(r.startRotationY)),t.filter){var f={};fs(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(vs(r)||Es(r)||ys(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:Es(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:vs(p.x),y:vs(p.y)}:h.sizeOverLifetime={size:vs(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?ps(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:ps(r.gravityModifier),startSpeed:vs(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:vs(d.linearX),linearY:vs(d.linearY),linearZ:vs(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:vs(d.orbitalX),orbitalY:vs(d.orbitalY),orbitalZ:vs(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:ps(d.forceCurve)},_s(h.positionOverLifetime);var y=t.rotationOverLifetime;y&&(h.rotationOverLifetime={separateAxes:y.separateAxes,asRotation:y.asRotation,z:vs(y.separateAxes?y.z:y.angularVelocity)},y.separateAxes&&(h.rotationOverLifetime.y=ps(y.y),h.rotationOverLifetime.x=ps(y.x)));var v=t.colorOverLifetime;if(v){var x=h.colorOverLifetime={opacity:ps(v.opacity)};v.color&&(x.color=Ts(v.color))}var g=t.textureSheetAnimation;g&&(h.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:ps(g.cycles),animationDelay:ds(g.animationDelay,0),animationDuration:ds(g.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:vs(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:ps(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&Ts(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&Ts(T.colorOverLifetime,!1),inheritParticleColor:T.inheritParticleColor,occlusion:T.occlusion,transparentOcclusion:T.transparentOcclusion,orderOffset:T.orderOffset,sizeAffectsLifetime:T.sizeAffectsLifetime,sizeAffectsWidth:T.sizeAffectsWidth,texture:T.texture,parentAffectsPosition:T.parentAffectsPosition,opacityOverLifetime:vs(T.opacityOverLifetime)}),h.trails&&_s(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function Rs(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:Es(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:ps(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:ps(n.linearX),linearY:ps(n.linearY),linearZ:ps(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:ps(n.orbitalX),orbitalY:ps(n.orbitalY),orbitalZ:ps(n.orbitalZ),speedOverLifetime:ps(n.speedOverLifetime)};_s(o);var a={options:{startColor:ms(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=ps(s.x),u.y=ps(s.y),u.z=ps(s.z)):u.z=ps(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:ps(c.opacity)};c.color&&(l.color=Ts(c.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:ps(h.size),x:ps(h.x),y:ps(h.y),z:ps(h.z)}),a}function Ls(t,e){var r=Rs(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}var Ms=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],Is=["path","position"];function Ps(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===ka.null&&t.endBehavior===qa.destroy&&(t.endBehavior=qa.freeze)}))})),t.version="2.1",t}var Vs=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Fs=/^(\d+)\.(\d+)$/,Ns=!1;function Ds(t){var e,r;if(!t||"object"!=typeof t)throw Error("expect a json object");if(function(t){var e,r=null===(e=t.version)||void 0===e?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==ka.mesh&&t.type!==ka.light||(t.endBehavior=1===t.endBehavior?qa.destroy:t.endBehavior)}))}))}(t),Vs.test(t.version))return Ns="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),Ps(function(t){var e,r;zs="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(zs="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return Us(e,r,t.imageTags||[])})),a=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:zs,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return ks(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t));var i=null===(r=Fs.exec(t.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?Ps(t):t;throw Error("invalid json version "+t.version)}var zs="1.0";function Us(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,type:t.type,webp:t.webp,renderLevel:i,oriY:n,loop:t.loop};if(t&&t.sourceType)return t;throw Error("invalid image type")}function ks(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:us},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return js(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null===(r=t.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var Bs,Gs=[0,0,0,1],Xs=.5;function js(t,e){var r,i,n;void 0===e&&(e={});var o,a,s,u,c,l,h=ka.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||ka.plugin,l=t.pn,c=t.pluginName,s=t.content,a=t.content,isNaN(l)&&!c&&(c=s.options.type),t.duration&&(p=t.duration),o=t.transform||v(a.transform),h===ka.filter&&(zs<"1.1"&&(zs="1.1"),(s=Ls(a,o)).filter=function(t){var e={};return fs(t,(function(t,r){Ms.includes(r)?e[r]=ps(t):Is.includes(r)?e[r]=Es(t):e[r]=t})),e}(a.filter))):t.particle?(h=ka.particle,o=v((a=t.particle).transform,Ns,!0),s=As(a)):t.sprite?(h=ka.sprite,s=Ls(a=t.sprite,o=v(a.transform,!1,!0))):t.cal?(h=ka.null,s=Rs(a=t.cal,o=v(a.transform,!1,!0))):t.ui?(h=ka.interact,o=v((a=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:za.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&ms(r.previewColor),behavior:r.behavior||Ua.NOTIFY};break;case"drag":e={type:za.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:za.MESSAGE}}return{options:e}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):t.model&&(a=t.model,1===t.model.options.type&&(h=ka.camera,o=v(a.transform),s=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:Es(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:ps(null==o?void 0:o.translateX),linearY:ps(null==o?void 0:o.translateY),linearZ:ps(null==o?void 0:o.translateZ)};_s(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:ps(null==s?void 0:s.rotateX),y:ps(null==s?void 0:s.rotateY),z:s.separateAxes?ps(null==s?void 0:s.rotateZ):ps(s.rotation)};_s(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==Xs&&d[1]==Xs?delete s.renderer.anchor:e.requires&&hs(e.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?qa.loop:qa.destroy:qa.loop:f||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||qa.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var y={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:s};return c?e.plugins?(hs(e.plugins,c),y.pn=e.plugins.indexOf(c)):y.pluginName=c:Number.isInteger(l)&&(y.pn=l),t.parentId&&(y.parentId=t.parentId+""),y;function v(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(a=Gs,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=Cs(s*ws/2),h=Cs(u*ws/2),f=Cs(c*ws/2),p=Ss(s*ws/2),d=Ss(u*ws/2),m=Ss(c*ws/2),a[0]=p*h*f+l*d*m,a[1]=l*d*f-p*h*m,a[2]=l*h*m+p*d*f,a[3]=l*h*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,l=a+a,h=s+s,f=o*c,p=a*c,d=a*l,m=s*h,y=u*h,v=1-d-m,x=p-y,g=p+y,T=1-f-m,E=s*c-u*l,b=s*l+u*c,_=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*Os,Math.abs(E)<.9999999?(t[0]=Math.atan2(b,_)*Os,t[2]=Math.atan2(g,v)*Os):(t[0]=0,t[2]=Math.atan2(-x,T)*Os),t}([],o)}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}var a,s,u,c,l,h,f,p,d,m;return{}}}var Hs=((Bs={})[pt.S]=[pt.S,pt.BPlus,pt.APlus],Bs[pt.A]=[pt.A,pt.BPlus,pt.APlus],Bs[pt.B]=[pt.B,pt.BPlus],Bs);function Ys(t,e){if(!t||!e)return!0;var r=Hs[e];return!!r&&r.includes(t)}function Ws(t){return wt(t)&&"jsonScene"in t}function Zs(t,e){return t?[t[0]-.5,.5-t[1]]:e?ui[e]:[0,0]}var qs=1,Qs=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new ge),this.options=t,this.downloader=e,this.assets={},this.id=qs++,this.timers=[],this.updateOptions(t)}return e.prototype.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},e.prototype.updateSceneData=function(t){var e=this.options.variables;return!e||Object.keys(e).length<=0||t.forEach((function(t){t.items.forEach((function(t){if(t.type===Et.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(e,r,i){var n,o,s;return u(this,void 0,void 0,(function(){var f,p,d,m,y,v,x,T,E,b,_,C,S=this;return c(this,(function(w){return p=ft(e)?e:this.id,d=performance.now(),m=[],y=null==r?void 0:r.engine.gpuCapability,v=null!==(o=null===(n=null==y?void 0:y.detail)||void 0===n?void 0:n.asyncShaderCompile)&&void 0!==o&&o,x=null!==(s=null==y?void 0:y.detail.compressedTexture)&&void 0!==s?s:0,E=!1,b=new Promise((function(t,e){T=window.setTimeout((function(){E=!0,S.removeTimer(T);var t=performance.now()-d;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p))}),1e3*S.timeout),S.timers.push(T)})),_=function(t,e){return u(S,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:if(E)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(),m.push("[".concat(t,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 3:throw n=o.sent(),new Error("load error in ".concat(t,", ").concat(n));case 4:throw new Error("load canceled.")}}))}))},C=function(){return u(S,void 0,void 0,(function(){var n,o,s,u,y,E,b,C,S,w,O,A,R,L,M,I,P,V,F,N=this;return c(this,(function(c){switch(c.label){case 0:return wt(e)?(f=e,this.baseUrl=location.href,[3,3]):[3,1];case 1:return e=new URL(e,location.href).href,this.baseUrl=e,[4,_("loadJSON",(function(){return N.loadJSON(e)}))];case 2:f=c.sent(),c.label=3;case 3:if(!Ws(f))return[3,6];if(n=a({},f),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(o=f.jsonScene.images,s=n.images,y=0;y<o.length;y++)s[y]instanceof HTMLCanvasElement&&(s[y]=o[y]);return u=n,[4,_("processImages",(function(){return N.processImages(s,n.usedImages,x)}))];case 4:for(u.images=c.sent(),y=0;y<n.images.length;y++)n.textureOptions[y].image=n.images[y];n.jsonScene.compositions=this.updateSceneData(n.jsonScene.compositions),c.label=5;case 5:return[3,12];case 6:return[4,_("processJSON",(function(){return N.processJSON(f)}))];case 7:return E=c.sent(),b=E.usedImages,C=E.jsonScene,S=E.pluginSystem,w=C.bins,O=void 0===w?[]:w,A=C.images,R=C.compositions,L=C.fonts,[4,Promise.all([_("processBins",(function(){return N.processBins(O)})),_("processImages",(function(){return N.processImages(A,b,x)})),_("".concat(v?"async":"sync"," compile"),(function(){return N.precompile(R,S,r,i)}))])];case 8:return M=h.apply(void 0,[c.sent(),2]),I=M[0],P=M[1],[4,_("processFontURL",(function(){return N.processFontURL(L)}))];case 9:return c.sent(),[4,_("processTextures",(function(){return N.processTextures(P,I,C)}))];case 10:return V=c.sent(),C.compositions=this.updateSceneData(C.compositions),n={url:e,renderLevel:this.options.renderLevel,storage:{},pluginSystem:S,jsonScene:C,usedImages:b,images:P,textureOptions:V,bins:I},[4,_("processPlugins",(function(){return S.loadResources(n,N.options)}))];case 11:c.sent(),c.label=12;case 12:return F=performance.now()-d,lt.info("Load asset: totalTime: ".concat(F.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p)),window.clearTimeout(T),this.removeTimer(T),n.totalTime=F,n.startTime=d,Number(n.jsonScene.version)<3&&(console.warn("The current json version "+n.jsonScene.version+" is less than 3.0, try to convert to the new version."),n=function(e){var r,i,n,o,a,s,u,c,h,f,p,d;e.jsonScene.version="3.0";var m=e.jsonScene;m.items||(m.items=[]);try{for(var y=l(e.jsonScene.compositions),v=y.next();!v.done;v=y.next()){for(var x=v.value,T=0;T<x.items.length;T++)m.items.push(x.items[T]);3!==x.endBehavior&&1!==x.endBehavior||(x.endBehavior=4)}}catch(t){r={error:t}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}var E={};try{for(var b=l(m.items),_=b.next();!_.done;_=b.next())E[(N=_.value).id]=Rt(),N.oldId=N.id,N.id=E[N.id]}catch(t){n={error:t}}finally{try{_&&!_.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}try{for(var C=l(m.items),S=C.next();!S.done;S=C.next())if((N=S.value).parentId)if(N.parentId.includes("^")){var w=N.parentId.split("^")[0],O=N.parentId.split("^")[1];N.parentId=E[w]+"^"+O}else N.parentId=E[N.parentId]}catch(t){a={error:t}}finally{try{S&&!S.done&&(s=C.return)&&s.call(C)}finally{if(a)throw a.error}}try{for(var A=l(e.jsonScene.compositions),R=A.next();!R.done;R=A.next())for(x=R.value,T=0;T<x.items.length;T++)x.items[T]={id:x.items[T].id}}catch(t){u={error:t}}finally{try{R&&!R.done&&(c=A.return)&&c.call(A)}finally{if(u)throw u.error}}try{for(var L=l(e.textureOptions),M=L.next();!M.done;M=L.next()){var I=M.value;I.id=Rt(),I.dataType=t.DataType.Texture}}catch(t){h={error:t}}finally{try{M&&!M.done&&(f=L.return)&&f.call(L)}finally{if(h)throw h.error}}m.components||(m.components=[]);var P=m.components;try{for(var V=l(m.items),F=V.next();!F.done;F=V.next()){var N;if((N=F.value).content){if(N.content.renderer&&void 0!==N.content.renderer.texture){var D=N.content.renderer.texture;N.content.renderer.texture={id:e.textureOptions[D].id}}N.content.trails&&void 0!==N.content.trails.texture&&(D=N.content.trails.texture,N.content.trails.texture={id:e.textureOptions[D].id})}if(N.transform){var z=N.transform.position,U=N.transform.rotation,k=N.transform.scale;if(z||(z=[0,0,0]),U||(U=[0,0,0]),k||(k=[1,1,1]),N.transform={position:{x:z[0],y:z[1],z:z[2]},rotation:{x:U[0],y:U[1],z:U[2]},scale:{x:k[0],y:k[1],z:k[0]}},N.type===Et.sprite&&(N.transform.size={x:k[0],y:k[1]},N.transform.scale={x:1,y:1,z:1}),N.type===Et.sprite){(X=N.content).renderer||(X.renderer={});var B=Zs((j=X.renderer).anchor,j.particleOrigin),G=N.transform.size;j.anchor||void 0===j.particleOrigin||(N.transform.position.x+=-B[0]*G.x,N.transform.position.y+=-B[1]*G.y),N.transform.anchor={x:B[0]*G.x,y:B[1]*G.y}}}if(N.type===Et.particle){var X;(X=N.content).renderer||(X.renderer={});var j=X.renderer;X.renderer.anchor=Zs(j.anchor,j.particleOrigin)}3!==N.endBehavior&&1!==N.endBehavior||(N.endBehavior=4);var H=g().replace(/-/g,"");N.type===Et.sprite?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.SpriteComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.particle?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.ParticleSystem,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.mesh?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.MeshComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.skybox?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.SkyboxComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.light?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.LightComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):"camera"===N.type?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.CameraComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.tree?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.TreeComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.interact?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.InteractComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.camera?(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.CameraController,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id})):N.type===Et.text&&(N.components=[],P.push(N.content),N.content.id=H,N.content.dataType=t.DataType.TextComponent,N.content.item={id:N.id},N.dataType=t.DataType.VFXItemData,N.components.push({id:N.content.id}))}}catch(t){p={error:t}}finally{try{F&&!F.done&&(d=V.return)&&d.call(V)}finally{if(p)throw p.error}}return e}(n)),[2,n]}}))}))},[2,Promise.race([b,C()])]}))}))},e.prototype.precompile=function(t,e,r,i){return u(this,void 0,void 0,(function(){var n;return c(this,(function(o){switch(o.label){case 0:return r&&r.getShaderLibrary()?(n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)]):[2];case 1:return o.sent(),[4,new Promise((function(t){n.compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),[2]}}))}))},e.prototype.processJSON=function(t){return u(this,void 0,void 0,(function(){var e,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return e=Ds(t),t.compositions.forEach((function(t,r){t.globalVolume&&(e.compositions[r].globalVolume=t.globalVolume)})),r=e.plugins,i=void 0===r?[]:r,n=e.compositions,o=e.imgUsage,a=e.images,[4,(s=new Xa(i)).processRawJSON(e,this.options)];case 1:return c.sent(),u=this.options.renderLevel,l={},o?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];Ys(i[u].renderLevel,n)&&(t[u]=!0)}}}(l,n,o,a,u):null==a||a.forEach((function(t,e){l[e]=!0})),[2,{usedImages:l,jsonScene:e,pluginSystem:s}]}}))}))},e.prototype.processBins=function(t){return u(this,void 0,void 0,(function(){var e,r,i=this;return c(this,(function(n){return e=this.options.renderLevel,r=t.map((function(r){if(r instanceof ArrayBuffer)return r;if(Ys(r.renderLevel,e))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(r)]}))}))},e.prototype.processFontURL=function(t){return u(this,void 0,void 0,(function(){var r,i=this;return c(this,(function(n){return t?(r=t.map((function(t){return u(i,void 0,void 0,(function(){var r,i;return c(this,(function(n){switch(n.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];r=new FontFace(null!==(i=t.fontFamily)&&void 0!==i?i:"","url("+t.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),e.fonts.add(t.fontFamily),[3,4];case 3:return n.sent(),lt.warn("Invalid fonts source: ".concat(JSON.stringify(t.fontURL))),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},e.prototype.processImages=function(e,r,i){return u(this,void 0,void 0,(function(){var n,o,a,s,l,h=this;return c(this,(function(f){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,l=e.map((function(e,n){return u(h,void 0,void 0,(function(){var u,l,h,f,p,d,m,y,v,x,g,T,E,b,_,C,S,w,O;return c(this,(function(c){switch(c.label){case 0:if(!r[n])return[3,19];if(u=e.url,l=e.webp,h=new URL(u,s).href,f=l&&new URL(l,s).href,!("template"in e))return[3,16];if(p=e.template,d=void 0,!("v"in p)||2!==p.v||!p.background)return[3,9];if(!((m=ya(p,a))instanceof Array))return[3,6];y=p.background.name,c.label=1;case 1:return c.trys.push([1,3,,5]),S={},[4,be(m[0])];case 2:return S.image=c.sent(),S.url=m[0],d=S,[3,5];case 3:return c.sent(),w={},[4,be(m[1])];case 4:return w.image=c.sent(),w.url=m[1],d=w,[3,5];case 5:return a&&(a[y]=d.url),[3,8];case 6:return"string"!=typeof m?[3,8]:(O={},[4,be(m)]);case 7:O.image=c.sent(),O.url=m,d=O,c.label=8;case 8:return[3,11];case 9:return[4,Ee(h,f)];case 10:d=c.sent(),c.label=11;case 11:v=void 0,c.label=12;case 12:return c.trys.push([12,14,,15]),[4,Ta(d.image,p,a,this.options,-1===e.oriY)];case 13:return v=c.sent(),[3,15];case 14:throw c.sent(),new Error("image template fail: ".concat(h));case 15:return[2,v];case 16:if("type"in e&&"video"===e.type)return x=e.loop,[2,Ce(e.url,{loop:x})];if("compressed"in e&&o&&i){if(g=e.compressed,T=void 0,i===kr.ASTC?T=g.astc:i===kr.PVRTC&&(T=g.pvrtc),T)return E=new URL(T,s).href,this.assets[n]={url:E,type:t.TextureSourceType.compressed},[2,this.loadBins(E)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof Ae)return[2,e]}c.label=17;case 17:return[4,Ee(h,f)];case 18:return b=c.sent(),_=b.url,C=b.image,this.assets[n]={url:_,type:t.TextureSourceType.image},[2,C];case 19:return[2,void 0]}}))}))})),[2,Promise.all(l)]}))}))},e.prototype.processTextures=function(e,r,i){var n;return u(this,void 0,void 0,(function(){var o,s,l=this;return c(this,(function(h){return o=null!==(n=i.textures)&&void 0!==n?n:e.map((function(t,e){return{source:e}})),s=o.map((function(n,o){return u(l,void 0,void 0,(function(){var s,u,l,h;return c(this,(function(c){switch(c.label){case 0:if(n instanceof Ae)return[2,n];if(!("mipmaps"in n))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,Se(n,r,i.bins)];case 2:return[2,c.sent()];case 3:throw s=c.sent(),new Error("load texture ".concat(o," fails, error message: ").concat(s));case 4:return"number"!=typeof(u=n.source)?[3,5]:(l=e[u],[3,7]);case 5:return"string"!=typeof u?[3,7]:[4,be(Ks(u))];case 6:l=c.sent(),c.label=7;case 7:if(l)return h=function(e,r){if(e instanceof Ae)return e.source;if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:ue.LINEAR,magFilter:ue.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:ue.LINEAR,magFilter:ue.LINEAR};if(e instanceof ArrayBuffer)return a(a({},Me(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:ue.CLAMP_TO_EDGE,wrapT:ue.CLAMP_TO_EDGE,minFilter:ue.NEAREST,magFilter:ue.NEAREST};throw new Error("Invalid texture options")}(l,this.assets[o]),[2,h.sourceType===t.TextureSourceType.compressed?h:a(a({},h),n)];throw new Error("Invalid texture source: ".concat(u))}}))}))})),[2,Promise.all(s)]}))}))},e.prototype.loadJSON=function(t){return u(this,void 0,void 0,(function(){var e=this;return c(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.loadBins=function(t){return u(this,void 0,void 0,(function(){var e=this;return c(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.prototype.dispose=function(){var t;for(var e in this.timers.length&&this.timers.map((function(t){return window.clearTimeout(t)})),this.assets){var r=this.assets[e];null===(t=null==r?void 0:r.dispose)||void 0===t||t.call(r)}this.assets={},this.timers=[]},e.fonts=new Set,e}();function Ks(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=t.split(",")[1]||t,n=atob(i),o=[],a=0;a<n.length;a+=512){for(var s=n.slice(a,a+512),u=new Array(s.length),c=0;c<s.length;c++)u[c]=s.charCodeAt(c);var l=new Uint8Array(u);o.push(l)}var h=new Blob(o,{type:r});return new File([h],e,{type:r})}var Js,$s,tu,eu,ru=new H(1,1,1),iu=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=q.fromIdentity(),this.projectionMatrix=q.fromIdentity(),this.viewProjectionMatrix=q.fromIdentity(),this.inverseViewMatrix=q.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,o=void 0===n?20:n,a=e.fov,s=void 0===a?60:a,u=e.aspect,c=void 0===u?1:u,l=e.clipMode,h=void 0===l?Lt.portrait:l,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:c,clipMode:h,position:H.fromArray(p),rotation:Q.fromArray(m)},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(t.prototype,"near",{get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"far",{get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fov",{get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspect",{get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"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)},enumerable:!1,configurable:!0}),t.prototype.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},t.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},t.prototype.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},t.prototype.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null===(t=this.inverseProjectionMatrix)||void 0===t?void 0:t.clone()},t.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},t.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},t.prototype.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},t.prototype.getInverseVPRatio=function(t){var e=new H(0,0,t),r=this.getViewProjectionMatrix(),i=e.applyMatrix(r).z;return new H(1,1,i).applyMatrix(r)},t.prototype.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):(this.options.quat,this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0)),this.dirty&&this.setRotationByQuat(t)},t.prototype.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new Y;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},t.prototype.getOptions=function(){return this.options},t.prototype.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()},t.prototype.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*D,r,i,n,o===Lt.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),ru),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){Fi.getRotation(t,this.options.rotation)},t}(),nu=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t}return o(r,e),r.prototype.start=function(){var t,e,r=this.item.props.startTime,i=void 0===r?0:r;this.startTime=i,this.timelineComponents=[],this.timelineComponent=this.item.getComponent(gn);try{for(var n=l(this.items),o=n.next();!o.done;o=n.next()){var a=o.value.getComponent(gn);a&&(this.timelineComponents.push(a),(0!==this.item.endBehavior||this.timelineComponent.reusable)&&(a.reusable=!0))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},r.prototype.update=function(t){var e,r,i=this.timelineComponent.getTime();try{for(var n=l(this.timelineComponents),o=n.next();!o.done;o=n.next()){var a=o.value,s=a.toLocalTime(i);a.setTime(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},r.prototype.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},r.prototype.createContent=function(){var e=this.items;if(this.items.length=0,this.item.composition){var i=this.item.engine.assetLoader;this.item.composition.compositionSourceManager.jsonScene;for(var n=this.item.props.items?this.item.props.items:[],o=0;o<n.length;o++){var s=void 0,u=n[o];if(t.Item.isComposition(u)){var c=u.content.options.refId,l=this.item.composition.refCompositionProps.get(c);if(!l)throw new Error("引用的Id: ".concat(c," 的预合成不存在"));l.content=u.content,(s=new wa(this.engine,a(a({},l),{id:u.id,name:u.name,delay:u.delay,duration:u.duration,endBehavior:u.endBehavior,parentId:u.parentId,transform:u.transform,oldId:u.oldId}))).type=Et.composition,s.composition=this.item.composition,s.addComponent(r).refId=c,s.transform.parentTransform=this.transform,this.item.composition.refContent.push(s),5===s.endBehavior&&(this.item.composition.autoRefTex=!1),s.getComponent(r).createContent()}else if("ECS"===u.type||u.type===Et.sprite||u.type===Et.text||u.type===Et.particle||u.type===Et.mesh||u.type===Et.skybox||u.type===Et.light||"camera"===u.type||u.type===Et.tree||u.type===Et.interact||u.type===Et.camera)(s=i.loadGUID(u.id)).composition=this.item.composition;else if((s=new wa(this.engine,u)).composition=this.item.composition,u.type===Et.text){var h=new Ea(this.engine,u.content);h.item=s,s.components.push(h),s.rendererComponents.push(h),s._content=h}else s=Oa(u,this.item.composition);s.parent=this.item,s.transform.parentTransform=u.type===Et.camera?new Fi:this.transform,wa.isExtraCamera(s)&&(this.item.composition.extraCamera=s),e.push(s)}}},r.prototype.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},r.prototype.hitTest=function(e,r,i,n,o,a){for(var s=[],u=(null==a?void 0:a.stop)||ht,c=(null==a?void 0:a.skip)||ht,l=(null==a?void 0:a.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<l;h++){var f=this.items[h];if(f.lifetime>=0&&!f.ended&&!wa.isComposition(f)&&!c(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new H;if(p.type===t.HitTestType.triangle)for(var y=p.triangles,v=p.backfaceCulling,x=0;x<y.length;x++){var g=y[x];if(e.intersectTriangle(g,m,v)){d=!0,s.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,b=T.clone().addScaledVector(E,.5),_=T.clone().addScaledVector(E,-.5);e.intersectBox({min:b,max:_},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var C=p.radius;e.intersectSphere({center:T,radius:C},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.custom){var S=p.collect(e,new j(r,i));S&&S.length>0&&(S.forEach((function(t){s.push(t)})),d=!0)}if(d){var w={compContent:this.item,id:f.id,name:f.name,position:s[s.length-1],parentId:f.parentId,hitPositions:s,behavior:p.behavior};if(n.push(w),u(w))return n}}}}return n},r}(ne),ou=function(){function e(t,e,r){var i,n=this;this.compositionSourceManager=r,this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var o=t.reusable,s=void 0!==o&&o,u=t.speed,c=void 0===u?1:u,l=t.baseRenderOrder,h=void 0===l?0:l,f=t.renderer,p=t.onPlayerPause,d=t.onMessageItem,m=t.onEnd,y=t.event,v=t.width,x=t.height;e.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var g=this.compositionSourceManager,T=g.sourceContent,E=g.pluginSystem,b=g.imgUsage,_=g.totalTime,C=g.renderLevel,S=g.refCompositionProps;F(T),this.renderer=f,this.refCompositionProps=S;var w=new wa(this.getEngine(),T);w.name="rootItem",w.type=Et.composition,w.composition=this,this.rootComposition=w.addComponent(nu),this.rootTimeline=w.getComponent(gn);var O=!s&&b;this.transform=new Fi({name:this.name}),this.transform.engine=this.getEngine(),w.transform=this.transform,this.globalVolume=T.globalVolume,this.width=v,this.height=x,this.renderOrder=h,this.id=T.id,this.renderer=f,this.texInfo=null!=O?O:{},this.event=y,this.statistic={loadTime:null!=_?_:0,loadStart:null!==(i=e.startTime)&&void 0!==i?i:0,firstFrameTime:0},this.reusable=s,this.speed=c,this.renderLevel=C,this.autoRefTex=!this.keepResource&&O&&5!==w.endBehavior,this.rootItem=w,this.name=T.name,this.pluginSystem=E,this.pluginSystem.initializeComposition(this,e),this.camera=new iu(this.name,a(a({},null==T?void 0:T.camera),{aspect:v/x})),this.url=e.url,this.assigned=!0,this.globalTime=0,this.onPlayerPause=p,this.onMessageItem=d,this.onEnd=m,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout((function(){var t;null===(t=n.onEnd)||void 0===t||t.call(n,n)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)}return Object.defineProperty(e.prototype,"handleEnd",{set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.rootComposition.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.rootComposition.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.rootTimeline.getTime()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.rootItem.duration},e.prototype.restart=function(){this.rootComposition.items,this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),this.forwardTime(this.startTime)},e.prototype.setIndex=function(t){this.renderOrder=t},e.prototype.getIndex=function(){return this.renderOrder},e.prototype.setSpeed=function(t){this.speed=t},e.prototype.getSpeed=function(){return this.speed},e.prototype.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootTimeline.timelineStarted?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.getPaused=function(){return this.paused},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new Lr({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},e.prototype.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},e.prototype.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},e.prototype.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-1e3*this.rootTimeline.getTime(),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)},e.prototype.reset=function(){var t=this,e=new wa(this.getEngine(),this.compositionSourceManager.sourceContent);e.type=Et.composition,e.composition=this,this.rootComposition=e.addComponent(nu),this.rootTimeline=e.getComponent(gn),this.transform=new Fi({name:this.name}),this.transform.engine=this.getEngine(),e.transform=this.transform,this.rootItem=e,this.rendererOptions=null,this.globalTime=0,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout((function(){var e;null===(e=t.onEnd)||void 0===e||e.call(t,t)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)},e.prototype.prepareRender=function(){var t,e,r,i,n,o,a,s,u,c,h=this,f=this.renderFrame;f._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(t){t.prepareRenderFrame(h,f)&&h.postLoaders.push(t)}));try{for(var p=l(this.rootComposition.items),d=p.next();!d.done;d=p.next()){var m=d.value.getComponents(oe);try{for(var y=(r=void 0,l(m)),v=y.next();!v.done;v=y.next()){(S=v.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(S)}}catch(t){r={error:t}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(e=p.return)&&e.call(p)}finally{if(t)throw t.error}}try{for(var x=l(this.refContent),g=x.next();!g.done;g=x.next()){var T=g.value;try{for(var E=(a=void 0,l(T.getComponent(nu).items)),b=E.next();!b.done;b=E.next()){m=b.value.getComponents(oe);try{for(var _=(u=void 0,l(m)),C=_.next();!C.done;C=_.next()){var S;(S=C.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(S)}}catch(t){u={error:t}}finally{try{C&&!C.done&&(c=_.return)&&c.call(_)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{b&&!b.done&&(s=E.return)&&s.call(E)}finally{if(a)throw a.error}}}}catch(t){n={error:t}}finally{try{g&&!g.done&&(o=x.return)&&o.call(x)}finally{if(n)throw n.error}}this.postLoaders.forEach((function(t){return t.postProcessFrame(h,f)}))},e.prototype.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.prototype.update=function(t,e){var r,i;if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var n=this.getUpdateTime(t*this.speed);if(this.globalTime+=n,this.rootTimeline.isActiveAndEnabled){var o=this.rootTimeline.toLocalTime(this.globalTime/1e3);this.rootTimeline.setTime(o)}this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,n),this.callLateUpdate(this.rootItem,n),null===(i=null===(r=this.extraCamera)||void 0===r?void 0:r.getComponent(gn))||void 0===i||i.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},e.prototype.getUpdateTime=function(t){var e=1e3*this.startTime;this.rootItem;var r=1e3*this.rootTimeline.getTime();return t<0&&r+t<e?e-r:t},e.prototype.callStart=function(t){var e,r,i,n,o,a;try{for(var s=l(t.itemBehaviours),u=s.next();!u.done;u=s.next()){var c=u.value;c.isActiveAndEnabled&&!c.started&&(c.start(),c.started=!0)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}try{for(var h=l(t.rendererComponents),f=h.next();!f.done;f=h.next()){var p=f.value;p.isActiveAndEnabled&&!p.started&&(p.start(),p.started=!0)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}try{for(var d=l(t.children),m=d.next();!m.done;m=d.next()){var y=m.value;this.callStart(y)}}catch(t){o={error:t}}finally{try{m&&!m.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}},e.prototype.callUpdate=function(t,e){var r,i,n,o,a,s;try{for(var u=l(t.itemBehaviours),c=u.next();!c.done;c=u.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.update(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var f=l(t.rendererComponents),p=f.next();!p.done;p=f.next()){var d=p.value;d.isActiveAndEnabled&&d.started&&d.update(e)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var m=l(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;wa.isComposition(v)&&v.ended&&5===v.endBehavior?(v.getComponent(nu).resetStatus(),this.callUpdate(v,0)):this.callUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}},e.prototype.callLateUpdate=function(t,e){var r,i,n,o,a,s;try{for(var u=l(t.itemBehaviours),c=u.next();!c.done;c=u.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.lateUpdate(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var f=l(t.rendererComponents),p=f.next();!p.done;p=f.next()){var d=p.value;d.isActiveAndEnabled&&d.started&&d.lateUpdate(e)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var m=l(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;this.callLateUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}},e.prototype.buildItemTree=function(t){var e,r,i,n,o,a;if(t.composition){var s=new Map,u=t.getComponent(nu).items;try{for(var c=l(u),h=c.next();!h.done;h=c.next()){var f=h.value;s.set(f.id,f)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}try{for(var p=l(u),d=p.next();!d.done;d=p.next()){if(void 0===(f=d.value).parentId)f.setParent(t);else{var m=this.getParentIdWithoutSuffix(f.parentId),y=s.get(m);if(!y)throw Error("元素引用了不存在的元素,请检查数据");wa.isTree(y)&&f.parentId.includes("^")?(f.parent=y,f.transform.parentTransform=y.getNodeTransform(f.parentId)):(f.parent=y,f.transform.parentTransform=y.transform),y.children.push(f)}}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}try{for(var v=l(u),x=v.next();!x.done;x=v.next()){f=x.value;wa.isComposition(f)&&this.buildItemTree(f)}}catch(t){o={error:t}}finally{try{x&&!x.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}}},e.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},e.prototype.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!==(t=this.textures)&&void 0!==t?t:[]).forEach((function(t){return null==t?void 0:t.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=e)},e.prototype.updateCamera=function(){this.camera.updateMatrix()},e.prototype.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},e.prototype.getItemByName=function(t){return this.rootItem.find(t)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return ci((t-r.z)/i,(e-r.w)/n,this.camera)},e.prototype.getEngine=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.engine},e.prototype.hitTest=function(t,e,r,i){var n;if(this.isDestroyed)return[];var o=[],a=this.getHitTestRay(t,e);return null===(n=this.rootItem.getComponent(nu))||void 0===n||n.hitTest(a,t,e,o,r,i),this.refContent.forEach((function(n){var s;null===(s=n.getComponent(nu))||void 0===s||s.hitTest(a,t,e,o,r,i)})),o},e.prototype.addInteractiveItem=function(t,e){var r;if(e===gt.MESSAGE)return null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},e.prototype.removeInteractiveItem=function(t,e){var r;e===gt.MESSAGE&&(null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},e.prototype.destroyTextures=function(e){for(var r,i=0;i<e.length;i++){var n=e[i];if(n)if(n.sourceType!==t.TextureSourceType.data||this.texInfo[n.getInstanceId()]){if(this.autoRefTex)--this.texInfo[n.getInstanceId()]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==Et.composition?4!==t.endBehavior&&t.getComponent(nu).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(E(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},e.prototype.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()},e.prototype.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=ht)})),this.rootItem.dispose(),this.renderFrame.dispose(),null===(e=this.rendererOptions)||void 0===e||e.emptyTexture.dispose(),null===(r=this.pluginSystem)||void 0===r||r.destroyComposition(this),this.update=function(){lt.error("Update disposed composition: ".concat(i.name,"."))},this.onPlayerPause=ht,this.dispose=ht,o&&this.keepResource&&o.forEach((function(t){return t.dispose=n[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==Wi&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.rootItem.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.rootItem.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},e.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},e.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},e.prototype.reloadTexture=function(){return u(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this.textureOffloaded?[4,Promise.all(this.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:t.sent(),this.textureOffloaded=!1,t.label=2;case 2:return[2]}}))}))},e}(),au=0,su=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var n=t.jsonScene,o=t.renderLevel,a=t.textureOptions,s=t.pluginSystem,u=t.totalTime,c=n.compositions,h=n.imgUsage,f=n.compositionId;if(!a)throw new Error("scene.textures expected");var p=a;try{for(var d=l(c),m=d.next();!m.done;m=d.next()){var y=m.value;y.id===f?this.composition=y:this.refCompositions.set(y.id,y)}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(!this.composition)throw new Error("Invalid composition id: "+f);this.jsonScene=n,this.renderLevel=o,this.pluginSystem=s,this.totalTime=null!=u?u:0,this.imgUsage=null!=h?h:{},this.textures=p,au=0,this.sourceContent=this.getContent(this.composition)}return t.prototype.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=void 0===s?0:s,c=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:c,camera:o,startTime:u,globalVolume:a}},t.prototype.assembleItems=function(t){var e,r,i,n,o,a,s=this,u=[];this.mask++;var c={};try{for(var h=l(this.jsonScene.components),f=h.next();!f.done;f=h.next()){var p=f.value;c[p.id]=p}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}try{for(var d=l(t.items),m=d.next();!m.done;m=d.next()){var y=m.value,v=this.engine.jsonSceneData[y.id],x=v;if(Ys(v.renderLevel,this.renderLevel)){if(x.type===Et.sprite||x.type===Et.particle)try{for(var g=(o=void 0,l(x.components)),T=g.next();!T.done;T=g.next()){var E=c[T.value.id];this.preProcessItemContent(E)}}catch(t){o={error:t}}finally{try{T&&!T.done&&(a=g.return)&&a.call(g)}finally{if(o)throw o.error}}else{var b=x.content;b&&this.preProcessItemContent(b)}var _=v.pn,C=this.jsonScene.plugins,S=void 0===C?[]:C;if(x.listIndex=au++,void 0!==_&&Number.isInteger(_)&&(x.pluginName=S[_]),x.type===Et.composition){var w=v.content.options.refId;if(!this.refCompositions.get(w))throw new Error("Invalid Ref Composition id: "+w);var O=this.getContent(this.refCompositions.get(w));this.refCompositionProps.has(w)||this.refCompositionProps.set(w,O),O.items.forEach((function(t){s.processMask(t.content)})),x.items=O.items}u.push(x)}}}catch(t){i={error:t}}finally{try{m&&!m.done&&(n=d.return)&&n.call(d)}finally{if(i)throw i.error}}return u},t.prototype.preProcessItemContent=function(t){var e;if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=Po(null===(e=this.jsonScene)||void 0===e?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&wt(t.renderer.shape)&&(t.renderer.shape=Po(t.renderer.shape,r))}t.trails&&(t.trails=this.changeTex(t.trails))},t.prototype.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},t.prototype.addTextureUsage=function(t){var e,r=t,i=null!==(e=this.imgUsage)&&void 0!==e?e:{};r&&i&&(i.hasOwnProperty(r)||(i[r]=0),i[r]++)},t.prototype.processMask=function(t){if(t.maskMode!==yt.NONE&&!t.mask){var e=t.maskMode;e===yt.MASK?t.mask=++this.mask:e!==yt.OBSCURED&&e!==yt.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.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}(),uu=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new Yr(this),this.createDefaultTexture()}return e.prototype.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.prototype.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.prototype.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.prototype.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.prototype.getInstance=function(t){return this.objectInstance[t]},e.prototype.removeInstance=function(t){delete this.objectInstance[t]},e.prototype.addPackageDatas=function(t){var e,r,i,n,o,a,s,u,c,h,f,p,d=t.jsonScene;if(d.items)try{for(var m=l(d.items),y=m.next();!y.done;y=m.next()){var v=y.value;this.addEffectsObjectData(v)}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(e)throw e.error}}if(d.materials)try{for(var x=l(d.materials),g=x.next();!g.done;g=x.next()){var T=g.value;this.addEffectsObjectData(T)}}catch(t){i={error:t}}finally{try{g&&!g.done&&(n=x.return)&&n.call(x)}finally{if(i)throw i.error}}if(d.shaders)try{for(var E=l(d.shaders),b=E.next();!b.done;b=E.next()){var _=b.value;this.addEffectsObjectData(_)}}catch(t){o={error:t}}finally{try{b&&!b.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}if(d.geometries)try{for(var C=l(d.geometries),S=C.next();!S.done;S=C.next()){var w=S.value;this.addEffectsObjectData(w)}}catch(t){s={error:t}}finally{try{S&&!S.done&&(u=C.return)&&u.call(C)}finally{if(s)throw s.error}}if(d.components)try{for(var O=l(d.components),A=O.next();!A.done;A=O.next()){var R=A.value;this.addEffectsObjectData(R)}}catch(t){c={error:t}}finally{try{A&&!A.done&&(h=O.return)&&h.call(O)}finally{if(c)throw c.error}}if(t.textureOptions)try{for(var L=l(t.textureOptions),M=L.next();!M.done;M=L.next()){var I=M.value;this.addEffectsObjectData(I)}}catch(t){f={error:t}}finally{try{M&&!M.done&&(p=L.return)&&p.call(L)}finally{if(f)throw f.error}}},e.prototype.createVFXItemsAsync=function(t){return u(this,void 0,void 0,(function(){var e,r,i,n,o,a,s;return c(this,(function(u){switch(u.label){case 0:e=t.jsonScene,u.label=1;case 1:u.trys.push([1,6,7,8]),r=l(e.items),i=r.next(),u.label=2;case 2:return i.done?[3,5]:"ECS"!==(n=i.value).type&&n.type!==Et.sprite&&n.type!==Et.particle&&n.type!==Et.mesh&&n.type!==Et.skybox&&n.type!==Et.light&&"camera"!==n.type&&n.type!==Et.tree&&n.type!==Et.interact&&n.type!==Et.camera?[3,4]:this.database?[4,this.assetLoader.loadGUIDAsync(n.id)]:[3,4];case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=u.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(s=r.return)&&s.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}}))}))},e.prototype.addTexture=function(t){this.destroyed||T(this.textures,t)},e.prototype.removeTexture=function(t){this.destroyed||E(this.textures,t)},e.prototype.addMaterial=function(t){this.destroyed||T(this.materials,t)},e.prototype.removeMaterial=function(t){this.destroyed||E(this.materials,t)},e.prototype.addGeometry=function(t){this.destroyed||T(this.geometries,t)},e.prototype.removeGeometry=function(t){this.destroyed||E(this.geometries,t)},e.prototype.addMesh=function(t){this.destroyed||T(this.meshes,t)},e.prototype.removeMesh=function(t){this.destroyed||E(this.meshes,t)},e.prototype.addRenderPass=function(t){this.destroyed||T(this.renderPasses,t)},e.prototype.removeRenderPass=function(t){this.destroyed||E(this.renderPasses,t)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.prototype.createDefaultTexture=function(){var e={type:ue.UNSIGNED_BYTE,format:ue.RGBA,internalFormat:ue.RGBA,wrapS:ue.MIRRORED_REPEAT,wrapT:ue.MIRRORED_REPEAT,minFilter:ue.NEAREST,magFilter:ue.NEAREST};this.emptyTexture=Ae.create(this,a({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},e)),this.transparentTexture=Ae.create(this,a({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},e))},e.prototype.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass ".concat(this.renderPasses.length)),this.meshes.length>0&&t.push("Mesh ".concat(this.meshes.length)),this.geometries.length>0&&t.push("Geom ".concat(this.geometries.length)),this.textures.length>0&&t.push("Tex ".concat(this.textures.length)),t.length>0&<.warn("Release GPU memory: ".concat(t.join(", "))),this.renderPasses.forEach((function(t){t.dispose()})),this.meshes.forEach((function(t){t.dispose()})),this.geometries.forEach((function(t){t.dispose()})),this.materials.forEach((function(t){t.dispose()})),this.textures.forEach((function(t){t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},e}(),cu=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this._deltaTime=0,this.setFPS(t),this.tickers=[]}return Object.defineProperty(t.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:!1,configurable:!0}),t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=G(t,1,120),this.interval=Math.floor(1e3/t)-2},t.prototype.getPaused=function(){return this.paused},t.prototype.start=function(){var t=this;if(this.paused=!1,this._deltaTime=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()}},t.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this._deltaTime=0,this.tickers=[]},t.prototype.pause=function(){this.paused=!0,this._deltaTime=0},t.prototype.resume=function(){this.paused=!1,this._deltaTime=0},t.prototype.tick=function(){if(!this.paused){var t=performance.now();if(this._deltaTime=t-this.lastTime,this._deltaTime>=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._deltaTime)}}}},t.prototype.add=function(t){if("function"!=typeof t)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},t}();Ma("camera",Di,wa,!0),Ma("text",ba,wa,!0),Ma("sprite",an,wa,!0),Ma("particle",Bn,wa,!0),Ma("cal",ta,wa,!0),Ma("interact",Hi,wa,!0);var lu=((Js={})[ue.ONE]=i.OneFactor,Js[ue.ZERO]=i.ZeroFactor,Js[ue.SRC_COLOR]=i.SrcColorFactor,Js[ue.SRC_ALPHA]=i.SrcAlphaFactor,Js[ue.ONE_MINUS_SRC_COLOR]=i.OneMinusSrcColorFactor,Js[ue.ONE_MINUS_SRC_ALPHA]=i.OneMinusSrcAlphaFactor,Js[ue.DST_COLOR]=i.DstColorFactor,Js[ue.DST_ALPHA]=i.DstAlphaFactor,Js[ue.ONE_MINUS_DST_COLOR]=i.OneMinusDstColorFactor,Js[ue.ONE_MINUS_DST_ALPHA]=i.OneMinusDstAlphaFactor,Js),hu=(($s={})[ue.NEVER]=i.NeverStencilFunc,$s[ue.EQUAL]=i.EqualStencilFunc,$s[ue.LESS]=i.LessStencilFunc,$s[ue.LEQUAL]=i.LessEqualStencilFunc,$s[ue.ALWAYS]=i.AlwaysStencilFunc,$s[ue.NOTEQUAL]=i.NotEqualStencilFunc,$s[ue.GREATER]=i.GreaterStencilFunc,$s[ue.GEQUAL]=i.GreaterEqualStencilFunc,$s),fu=((tu={})[ue.KEEP]=i.KeepStencilOp,tu[ue.ZERO]=i.ZeroStencilOp,tu[ue.REPLACE]=i.ReplaceStencilOp,tu[ue.INCR]=i.IncrementStencilOp,tu[ue.DECR]=i.DecrementStencilOp,tu[ue.INCR_WRAP]=i.IncrementWrapStencilOp,tu[ue.DECR_WRAP]=i.IncrementWrapStencilOp,tu[ue.INVERT]=i.InvertStencilOp,tu),pu=((eu={})[ue.NEVER]=i.NeverDepth,eu[ue.ALWAYS]=i.AlwaysDepth,eu[ue.EQUAL]=i.EqualDepth,eu[ue.LESS]=i.LessDepth,eu[ue.LEQUAL]=i.LessEqualDepth,eu[ue.GREATER]=i.GreaterDepth,eu[ue.GEQUAL]=i.GreaterEqualDepth,eu[ue.NOTEQUAL]=i.NotEqualDepth,eu);var du=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],mu=function(e){function r(r,n){var o=e.call(this,r,n)||this;o.textures={},o.material=new i.RawShaderMaterial,o.uniforms={};for(var a=null==n?void 0:n.shader,s=r.gpuCapability.level,u=0;u<t.maxSpriteMeshItemCount;u++)o.uniforms["uSampler".concat(u)]=new i.Uniform(null);return o.uniforms.uEditorTransform=new i.Uniform([1,1,0,0]),o.uniforms.effects_ObjectToWorld=new i.Uniform((new i.Matrix4).identity()),o.uniforms.effects_MatrixInvV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.uniforms.effects_MatrixVP=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),o.uniforms.effects_MatrixV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.material=new i.RawShaderMaterial({vertexShader:null==a?void 0:a.vertex,fragmentShader:null==a?void 0:a.fragment,alphaToCoverage:!1,depthFunc:i.LessDepth,polygonOffsetFactor:i.ZeroFactor,polygonOffsetUnits:i.ZeroFactor,polygonOffset:!1,uniforms:o.uniforms}),o.material.glslVersion=1===s?i.GLSL1:i.GLSL3,o}return o(r,e),r.prototype.onSetUniformValue=function(t,e){var r;du.includes(t)&&(r=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=r||e:this.material.uniforms[t]=new i.Uniform(r||e)},r.prototype.use=function(t,e){var r=this.engine,n=r.composition,o=r.threeCamera;if(o){var a=(new i.Matrix4).multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var s=n.camera;this.setMatrix("effects_MatrixVP",s.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",s.getViewMatrix())}},r.prototype.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},Object.defineProperty(r.prototype,"blending",{get:function(){return this.material.blending!==i.NoBlending},set:function(t){this.material.blending=t?i.CustomBlending:i.NoBlending},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"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=h(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.material.blendSrc=lu[r],this.material.blendDst=lu[i],this.material.blendSrcAlpha=lu[n],this.material.blendDstAlpha=lu[o]}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=h(t,2),r=e[0],i=e[1];this.material.blendEquation=r,this.material.blendEquationAlpha=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=pu[t])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=h(t,2),r=e[0],i=e[1];this.material.polygonOffsetFactor=r,this.material.polygonOffsetUnits=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=hu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=fu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=fu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=fu[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.material.side!==i.DoubleSide},set:function(t){this.material.side=t?i.FrontSide:i.DoubleSide},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.material.side},set:function(t){t===mt.FRONT?this.material.side=i.FrontSide:t===mt.BACK&&(this.material.side=i.BackSide)},enumerable:!1,configurable:!0}),r.prototype.getTexture=function(t){return this.textures[t]},r.prototype.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.prototype.getVector4Array=function(t){return this.uniforms[t].value},r.prototype.setVector4Array=function(t,e){var r,i,n=[];try{for(var o=l(e),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s.toArray())}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(t,n)},r.prototype.getMatrixArray=function(t){return this.uniforms[t].value},r.prototype.setMatrixArray=function(t,e){var r,i,n=[];try{for(var o=l(e),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s.elements)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(t,n)},r.prototype.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.prototype.getMatrix=function(t){return this.uniforms[t].value},r.prototype.setMatrix=function(t,e){this.setUniform(t,e)},r.prototype.setMatrix3=function(t,e){this.setUniform(t,e)},r.prototype.getVector2=function(t){return this.uniforms[t].value},r.prototype.setVector2=function(t,e){this.setUniform(t,e)},r.prototype.getVector3=function(t){return this.uniforms[t].value},r.prototype.setVector3=function(t,e){this.setUniform(t,e)},r.prototype.getVector4=function(t){return this.uniforms[t].value},r.prototype.setVector4=function(t,e){this.setUniform(t,e)},r.prototype.getQuaternion=function(t){return this.uniforms[t].value},r.prototype.setQuaternion=function(t,e){this.setUniform(t,e)},r.prototype.getFloat=function(t){return this.uniforms[t].value},r.prototype.setFloat=function(t,e){this.setUniform(t,e)},r.prototype.getFloats=function(t){return this.uniforms[t].value},r.prototype.setFloats=function(t,e){this.setUniform(t,e)},r.prototype.getInt=function(t){return this.uniforms[t].value},r.prototype.setInt=function(t,e){this.setUniform(t,e)},r.prototype.hasUniform=function(t){return!!this.uniforms[t]},r.prototype.setUniform=function(t,e){var r=new i.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=r},r.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},r.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},r.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},r.prototype.clone=function(t){throw new Error("Method not implemented.")},r.prototype.cloneUniforms=function(t){throw new Error("Method not implemented.")},r.prototype.fromData=function(t){throw new Error("Method not implemented.")},r.prototype.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},r}(ke),yu=1,vu=function(t){function e(e,r){var n=t.call(this,e)||this;if(n.attributes={},n.destroyed=!1,n.attributesName=[],!r)return n;var o=r.drawStart,a=void 0===o?0:o,s=r.drawCount,u=r.indices,c=r.mode,l=r.name,h=void 0===l?"effectsGeometry:".concat(yu++):l;n.name=h,n.mode=null!=c?c:ue.TRIANGLES;var f=[],p={},d=new i.BufferGeometry;return Object.keys(r.attributes).forEach((function(t){var e=r.attributes[t];if("dataSource"in e){var o=e.dataSource;if(o){void 0===p[o]&&n.setAttributeType(o,e,d,p,r.maxVertex);var a=e.size,s=e.offset,u=e.normalize,c=p[o],l=c.buffer,h=c.dataLength,m=new i.InterleavedBufferAttribute(l,a,(null!=s?s:0)/h,u);d.setAttribute(t,m),p[t]={buffer:l,attribute:m,type:c.type,dataLength:h}}}else n.setAttributeType(t,e,d,p,r.maxVertex);f.push(t)})),u&&u.data&&d.setIndex(new i.BufferAttribute(u.data,1)),n.geometry=d,n.attributes=p,n.attributesName=f,n.drawStart=a,n.drawCount=null!=s?s:0,n}return o(e,t),Object.defineProperty(e.prototype,"drawCount",{get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawStart",{get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t},enumerable:!1,configurable:!0}),e.prototype.getAttributeData=function(t){if(null!=this.attributes[t])return this.attributes[t].buffer.array},e.prototype.setAttributeData=function(t,e){if(null!=this.attributes[t]){var r=this.attributes[t].buffer;if(e.length>r.array.length){var n=new i.InterleavedBuffer(e,r.stride);r=this.attributes[t].attribute.data=n,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}},e.prototype.setAttributeSubData=function(t,e,r){null!=this.attributes[t]&&(this.attributes[t].buffer.set(r,e),this.geometry.attributes[t].needsUpdate=!0)},e.prototype.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*$e[e.type]},e.prototype.getAttributeNames=function(){return this.attributesName},e.prototype.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},e.prototype.setIndexData=function(t){t&&(this.geometry.setIndex(new i.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},e.prototype.setIndexSubData=function(t,e){var r=this.geometry.getIndex();if(null!==r){var i=t,n=t+e.length;if(r.count<n){var o=new e.constructor(end);o.set(r.array),r.array=o}r.array.set(e,i),this.geometry.index.needsUpdate=!0}},e.prototype.setDrawStart=function(t){this.drawStart=t},e.prototype.getDrawStart=function(){return this.drawStart},e.prototype.setDrawCount=function(t){this.drawCount=t},e.prototype.getDrawCount=function(){return this.drawCount},e.prototype.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},e.prototype.setAttributeType=function(t,e,r,n,o){var a=e,s=a.stride,u=void 0===s?0:s,c=a.size,l=a.offset,h=a.normalize,f=a.type,p=void 0===f?ue.FLOAT:f,d=e.data;if(p&&!d&&(d=er(p)),d){var m=d instanceof Float32Array?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,y=u/m,v=(o=(null!=o?o:0)*y)||c*m;v&&0===d.length&&(d=d instanceof Float32Array?new Float32Array(v):new Uint16Array(v));var x=new i.InterleavedBuffer(d,y),g=new i.InterleavedBufferAttribute(x,c,(null!=l?l:0)/m,h);r.setAttribute(t,g),n[t]={buffer:x,attribute:g,type:p,dataLength:m}}},e}(tr),xu=function(e){function r(t,r){var n=this;if(!r)return n;var o=r.material,a=r.geometry,s=r.priority,u=void 0===s?0:s;return(n=e.call(this,t,r)||this).geometry=a,n.material=o,a.mode===ue.LINES?n.mesh=new i.LineSegments(a.geometry,o.material):n.mesh=new i.Mesh(a.geometry,o.material),n.priority=u,n}return o(r,e),Object.defineProperty(r.prototype,"priority",{get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(t){this.mesh.visible=t},r.prototype.getVisible=function(){return this.mesh.visible},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e,this.mesh.material=e.material},r.prototype.start=function(){e.prototype.start.call(this),this.engine.threeGroup.add(this.mesh)},r.prototype.restore=function(){},r.prototype.render=function(t){this.isDestroyed||this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.prototype.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},r}(or),gu=function(e){function r(r,i,n){void 0===n&&(n={});var o=e.call(this,r)||this;if(i){var s=i.width,u=void 0===s?1:s,c=i.height,l=void 0===c?1:c;o.texture=o.createTextureByType(a(a({},n),{sourceType:t.TextureSourceType.data,data:i})),o.width=u,o.height=l}else o.texture=o.createTextureByType(n);return o.texture.needsUpdate=!0,o}return o(r,e),r.toThreeJsTextureFilter=function(t){return t===ue.LINEAR?i.LinearFilter:i.NearestFilter},r.toThreeJsTextureWrap=function(t){switch(t){case ue.MIRRORED_REPEAT:return i.MirroredRepeatWrapping;case ue.REPEAT:return i.RepeatWrapping;default:return i.ClampToEdgeWrapping}},r.prototype.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.prototype.startVideo=function(){return u(this,void 0,void 0,(function(){var e;return c(this,(function(r){switch(r.label){case 0:return this.sourceType!==t.TextureSourceType.video?[3,2]:(e=this.texture.source.data).paused?[4,e.play()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r.prototype.assembleOptions=function(e){var n=e.target,o=void 0===n?ue.TEXTURE_2D:n;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:t.TextureSourceType.none),a(a({target:o,format:i.RGBAFormat,type:i.UnsignedByteType},e),{minFilter:r.toThreeJsTextureFilter(e.minFilter),magFilter:r.toThreeJsTextureFilter(e.magFilter),wrapS:r.toThreeJsTextureWrap(e.wrapS),wrapT:r.toThreeJsTextureWrap(e.wrapT)})},r.prototype.dispose=function(){this.texture.dispose()},r.prototype.createTextureByType=function(e){var r,n,o=this.assembleOptions(e),a=o.flipY,s=o.type,u=o.wrapS,c=o.wrapT,l=o.minFilter,h=o.magFilter,f=o.sourceType,p=i.UVMapping,d=o.format,m=void 0;if(this.sourceType=f,f===t.TextureSourceType.data){var y=e.data;m=new i.DataTexture(y.data,y.width,y.height,d,s,p,u,c,h,l),this.width=y.width,this.height=y.height}else if(f===t.TextureSourceType.image){var v=e.image;m=new i.Texture(v,p,u,c,h,l,d,s),this.width=v.width,this.height=v.height}else if(f===t.TextureSourceType.compressed){var x=0,g=0,T=e.mipmaps.map((function(t){var e=t.data,r=t.width,i=t.height;return x=x<r?r:x,g=g<i?i:g,{data:e,width:r,height:i,colorSpace:"srgb"}}));d=i.RGBA_ASTC_4x4_Format,m=new i.CompressedTexture(T,x,g,d,s,p,u,c,h,l),this.width=x,this.height=g}else if(f===t.TextureSourceType.video)m=new i.VideoTexture(e.video,p,u,c,h,l,d,s);else if(f===t.TextureSourceType.framebuffer){if(y=e.data){var E=null!==(r=y.width)&&void 0!==r?r:0,b=null!==(n=y.height)&&void 0!==n?n:0;m=new i.FramebufferTexture(E,b,d),this.width=E,this.height=b}}else f===t.TextureSourceType.none&&((m=new i.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=i.MirroredRepeatWrapping,m.wrapT=i.MirroredRepeatWrapping,this.width=this.height=1);if(m)return m.flipY=!!a,m;throw new Error("使用未知的数据类型创建纹理")},r}(Ae),Tu=function(t){function e(e,r,i){var n=t.call(this,e,r,i)||this;return n.rootItem.getComponent(nu).resetStatus(),n}return o(e,t),e.prototype.updateVideo=function(){this.textures.map((function(t){return t.startVideo()}))},e.prototype.prepareRender=function(){var t,e,r,i,n,o,a,s,u,c,h=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;try{for(var f=l(this.rootComposition.items),p=f.next();!p.done;p=f.next()){var d=p.value.getComponents(oe);try{for(var m=(r=void 0,l(d)),y=m.next();!y.done;y=m.next()){(C=y.value).isActiveAndEnabled&&C.render(h)}}catch(t){r={error:t}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{p&&!p.done&&(e=f.return)&&e.call(f)}finally{if(t)throw t.error}}try{for(var v=l(this.refContent),x=v.next();!x.done;x=v.next()){var g=x.value;try{for(var T=(a=void 0,l(g.getComponent(nu).items)),E=T.next();!E.done;E=T.next()){d=E.value.getComponents(oe);try{for(var b=(u=void 0,l(d)),_=b.next();!_.done;_=b.next()){var C;(C=_.value).isActiveAndEnabled&&C.render(h)}}catch(t){u={error:t}}finally{try{_&&!_.done&&(c=b.return)&&c.call(b)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{E&&!E.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}}catch(t){n={error:t}}finally{try{x&&!x.done&&(o=v.return)&&o.call(v)}finally{if(n)throw n.error}}},e.prototype.getRendererOptions=function(){var t=gu.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.shape={},e}(ou),Eu=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new Nr(e),r}return o(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}(uu),bu=function(t){function e(e){var r=t.call(this)||this;return r.engine=new Eu(e),r.renderingData={currentFrame:{}},r}return o(e,t),e}(jr),_u=function(t){function e(e,r){var i=t.call(this)||this;i.compositions=[],i.baseCompositionIndex=0,i.env="";var n=r.width,o=r.height,a=r.camera;return i.renderer=new bu(e),i.width=n,i.height=o,i.camera=a,i}return o(e,t),Object.defineProperty(e.prototype,"currentComposition",{get:function(){return this.compositions[0]},enumerable:!1,configurable:!0}),e.prototype.loadScene=function(t,e){return u(this,void 0,void 0,(function(){var r,i,n=this;return c(this,(function(o){switch(o.label){case 0:return i=this.baseCompositionIndex,Ct(t)?(this.baseCompositionIndex+=t.length,[4,Promise.all(t.map((function(t,r){return u(n,void 0,void 0,(function(){var n;return c(this,(function(o){switch(o.label){case 0:return[4,this.createComposition(t,e)];case 1:return(n=o.sent()).setIndex(i+r),[2,n]}}))}))})))]):[3,2];case 1:return r=o.sent(),[3,4];case 2:return this.baseCompositionIndex+=1,[4,this.createComposition(t,e)];case 3:(r=o.sent()).setIndex(i),o.label=4;case 4:return[2,r]}}))}))},e.prototype.createComposition=function(t,e){return void 0===e&&(e={}),u(this,void 0,void 0,(function(){var r,i,n,o,s,u,l,h,f;return c(this,(function(c){switch(c.label){case 0:return r=performance.now(),i=a({autoplay:!0},e),Cu(t)?(n=t.scene,i=a(a({},i),t.options||{})):n=t,this.assetManager?this.assetManager.updateOptions(i):this.assetManager=new Qs(i),[4,this.assetManager.loadScene(n,this.renderer,{env:this.env})];case 1:for(o=c.sent(),(s=this.renderer.engine).clearResources(),s.addPackageDatas(o),u=0;u<o.textureOptions.length;u++)o.textureOptions[u]=s.assetLoader.loadGUID(o.textureOptions[u].id),o.textureOptions[u].initialize();return l=new su(o,s),s.database?[4,s.createVFXItemsAsync(o)]:[3,3];case 2:c.sent(),c.label=3;case 3:return h=new Tu(a(a({},i),{width:this.width,height:this.height,renderer:this.renderer}),o,l),this.renderer.engine.setOptions({threeCamera:this.camera,threeGroup:this,composition:h}),i.autoplay?h.play():h.pause(),f=performance.now()-r+h.statistic.loadTime,h.statistic.firstFrameTime=f,lt.info("first frame: [".concat(h.name,"]").concat(f.toFixed(4),"ms")),this.compositions.push(h),[2,h]}}))}))},e.prototype.update=function(t){this.compositions.forEach((function(e){e.update(t)}))},e}(i.Group);function Cu(t){return wt(t)&&"scene"in t}var Su=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return o(r,e),Object.defineProperty(r.prototype,"priority",{get:function(){return this.threeMesh.renderOrder},set:function(t){this.threeMesh&&(this.threeMesh.renderOrder=t)},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(t){this.threeMesh.visible=t},r.prototype.getVisible=function(){return this.threeMesh.visible},Object.defineProperty(r.prototype,"enabled",{get:function(){return this.threeMesh.visible},set:function(t){this.threeMesh.visible=t,t&&this.onEnable()},enumerable:!1,configurable:!0}),r.prototype.dispose=function(){e.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},r.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.threeMesh||(this.geometry.mode===ue.LINES?this.threeMesh=new i.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new i.Mesh(this.geometry.geometry,this.material.material))},r.prototype.start=function(){e.prototype.start.call(this),this.engine.threeGroup.add(this.threeMesh)},r.prototype.render=function(t){this.isActiveAndEnabled&&(this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.prototype.onDestroy=function(){this.threeMesh.clear()},r=s([$t(t.DataType.SpriteComponent)],r)}(Cn);nn(8),Ae.create=function(t,e){return new gu(t,void 0,e)},Ae.createWithData=function(t,e,r){return new gu(t,e,r)},ke.create=function(t,e){return new mu(t,e)},tr.create=function(t,e){return new vu(t,e)},or.create=function(t,e){return new xu(t,e)};var wu="2.0.0-alpha.2";lt.info("THREEJS plugin version: "+wu),t.AbstractPlugin=Qr,t.ActivationClipPlayable=xn,t.AnimationClipPlayable=vn,t.AssetLoader=Yr,t.AssetManager=Qs,t.BYTES_TYPE_MAP=$e,t.Behaviour=ie,t.BezierSegments=bi,t.COMPRESSED_TEXTURE=kr,t.CONSTANT_MAP_BLEND=lu,t.CONSTANT_MAP_DEPTH=pu,t.CONSTANT_MAP_STENCIL_FUNC=hu,t.CONSTANT_MAP_STENCIL_OP=fu,t.COPY_FRAGMENT_SHADER=Ye,t.COPY_MESH_SHADER_ID=je,t.COPY_VERTEX_SHADER=He,t.CalculateLoader=ta,t.Camera=iu,t.CameraController=Ni,t.CameraVFXItemLoader=Di,t.Component=re,t.Composition=ou,t.CompositionComponent=nu,t.CompositionSourceManager=su,t.CurveValue=gi,t.DEFAULT_FONTS=ha,t.Database=Wr,t.Downloader=ge,t.EFFECTS_COPY_MESH_NAME=Xe,t.EVENT_TYPE_CLICK=zi,t.EVENT_TYPE_TOUCH_END=Bi,t.EVENT_TYPE_TOUCH_MOVE=ki,t.EVENT_TYPE_TOUCH_START=Ui,t.EffectComponent=Ca,t.EffectsObject=ee,t.Engine=uu,t.EventSystem=Xi,t.FILTER_NAME_NONE="none",t.Float16ArrayWrapper=Jr,t.FrameBuffer=Xr,t.GPUCapability=Nr,t.Geometry=tr,t.GlobalUniforms=Pr,t.GradientValue=xi,t.HELP_LINK=Zi,t.InteractBehavior=Gi,t.InteractComponent=Ki,t.InteractLoader=Hi,t.InteractMesh=Qi,t.ItemBehaviour=ne,t.KTXTexture=Le,t.LineSegments=Ti,t.LinearValue=vi,t.Material=ke,t.MaterialDataBlock=Fe,t.Mesh=or,t.PLAYER_OPTIONS_ENV_EDITOR=Wi,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=$o,t.ParticleLoader=Bn,t.ParticleMesh=Rn,t.ParticleSystem=ko,t.ParticleSystemRenderer=Uo,t.PassTextureCache=Ke,t.PathSegments=Ei,t.PluginSystem=Xa,t.QCanvasViewer=aa,t.QText=oa,t.RENDER_PASS_NAME_PREFIX=Ar,t.RENDER_PREFER_LOOKUP_TEXTURE=Sn,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=di,t.RandomValue=mi,t.RandomVectorValue=yi,t.RenderBuffer=Vr,t.RenderFrame=Lr,t.RenderPass=lr,t.RenderPassPriorityNormal=ar,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=ur,t.Renderer=jr,t.RendererComponent=oe,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=Yi,t.SemanticMap=Je,t.SerializationHelper=Hr,t.Shader=Ge,t.SpriteColorPlayable=_n,t.SpriteComponent=Cn,t.SpriteLoader=an,t.StaticValue=pi,t.TEMPLATE_USE_OFFSCREEN_CANVAS=wn,t.TEXTURE_UNIFORM_MAP=du,t.TextComponent=Ea,t.TextLoader=ba,t.Texture=Ae,t.TextureFactory=Pe,t.ThreeComposition=Tu,t.ThreeDisplayObject=_u,t.ThreeEngine=Eu,t.ThreeMaterial=mu,t.ThreeSpriteComponent=Su,t.ThreeTexture=gu,t.Ticker=cu,t.TimelineClip=hn,t.TimelineComponent=gn,t.Track=ln,t.Transform=Fi,t.VFXItem=wa,t.ValueGetter=fi,t.addByOrder=I,t.addItem=T,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.alphaFrameFrag="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",t.alphaMaskFrag="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",t.assertExist=F,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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.bloomMixVert="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",t.bloomThresholdVert="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",t.calculateTranslation=ri,t.cameraMoveFrag="uniform vec2 uMoveTexSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uMoveTexSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uMoveTexSize,(coordMin+vec2(1.))/uMoveTexSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 cB=mix(cLB,cRB,pp.x);vec4 cT=mix(cLT,cRT,pp.x);return mix(cB,cT,pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}",t.cameraMoveVert="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",t.canvasPool=ma,t.colorGradingFrag=xr,t.colorStopsFromGradient=S,t.colorToArr=_,t.combineImageTemplate=Ta,t.combineImageTemplate1=ua,t.combineImageTemplate1Async=function(t,e,r,i,n){return u(this,void 0,void 0,(function(){return c(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,ua(t,e,r,i,n)]}))}))},t.combineImageTemplate2=ga,t.combineImageTemplate2Async=function(t,e,r,i,n){return u(this,void 0,void 0,(function(){return c(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,ga(t,e,r,i,n)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,n){return u(this,void 0,void 0,(function(){return c(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,Ta(t,e,r,i,n)]}))}))},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.copyFrag=Be,t.createCopyShader=We,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 new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i},t.createKeyFrameMeta=Mi,t.createShaderWithMarcos=me,t.createShape=io,t.createVFXItem=Oa,t.createValueGetter=Ci,t.deepClone=function t(e){if(Ct(e))return e.map(t);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var r={},i=Object.keys(e),n=0;n<i.length;n++){var o=i[n];r[o]=t(e[o])}return r}return e},t.defaultGlobalVolume=Or,t.defaultPlugins=Ra,t.delayFrag="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",t.deserializeMipmapTexture=Se,t.distortionFrag="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",t.distortionVert="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",t.earcut=Oo,t.effectsClass=$t,t.effectsClassStore=Zt,t.enlargeBuffer=b,t.ensureVec3=ii,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=gr,t.gaussianDownVFrag=Tr,t.gaussianUpFrag=Er,t.generateEmptyTypedArray=er,t.generateGUID=Rt,t.generateHalfFloatTexture=Re,t.getBackgroundImage=ya,t.getColorFromGradientStops=C,t.getConfig=An,t.getDefaultTemplateCanvasPool=function(){return ma},t.getDefaultTextureFactory=function(){return Ie||(Ie=new Pe),Ie},t.getGeometryByShape=Po,t.getGeometryTriangles=Io,t.getImageItemRenderInfo=$i,t.getKTXTextureOptions=Me,t.getKeyFrameMetaByRawValue=Li,t.getMergedStore=Kt,t.getParticleMeshShader=In,t.getPixelRatio=function(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0),e=screen.width/t;return Math.min(2*e,2)}return 1},t.getPreMultiAlpha=he,t.getStandardComposition=ks,t.getStandardImage=Us,t.getStandardItem=js,t.getStandardJSON=Ds,t.getTextureSize=Mr,t.glContext=ue,t.gpuTimer=function(t){var e=this,r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=t.createQuery(),n=function(){return u(e,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(r.GPU_DISJOINT_EXT);if(a&&!s){var u=t.getQueryParameter(i,t.QUERY_RESULT);e(u/1e3/1e3)}(a||s)&&(t.deleteQuery(i),i=null),null!==a&&i&&window.setTimeout((function(){n().then(e).catch}),1)}}))]}))}))};if(!i)return;return{begin:function(){i&&t.beginQuery(r.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:n}}},t.imageDataFromColor=function(t){ft(t)&&(t=_(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=L,t.initErrors=se,t.initGLContext=ce,t.integrate="float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}return 0.;}",t.interpolateColor=w,t.isAndroid=A,t.isArray=Ct,t.isFunction=St,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=wt,t.isScene=Ws,t.isSceneWithOptions=Cu,t.isSimulatorCellPhone=R,t.isString=ft,t.isUniformStruct=Ne,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&Ne(t[0])},t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=pr,t.itemFrameFrag=hr,t.itemVert=fr,t.loadBinary=_e,t.loadBlob=function(t){return u(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e,r){(new ge).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=be,t.loadVideo=Ce,t.loadWebPOptional=Ee,t.logger=lt,t.math=ot,t.modifyMaxKeyframeShader=Pn,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=ht,t.parsePercent=O,t.particleFrag=dr,t.particleOriginTranslateMap=ui,t.particleVert=mr,t.pluginLoaderMap=Aa,t.random=Ot,t.registerPlugin=Ma,t.removeItem=E,t.requestAsync=sa,t.rotateVec2=Vo,t.screenMeshVert=vr,t.serialize=Jt,t.setBlendMode=ye,t.setConfig=function(t,e){return On[t]=e},t.setDefaultTextureFactory=function(t){Ie=t},t.setMaskMode=xe,t.setMaxSpriteMeshItemCount=nn,t.setRayFromCamera=ci,t.setSideMode=ve,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=function(e){return t.maxSpriteTextureCount=Math.min(e.maxFragmentTextures,16),e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void(t.maxSpriteTextureCount=8)},t.setUniformValue=function(t,e,r){t[e]?t[e].value=r:t[e]=new i.Uniform(r)},t.sortByOrder=M,t.spec=Wt,t.spriteMeshShaderFromFilter=tn,t.spriteMeshShaderFromRenderInfo=rn,t.spriteMeshShaderIdFromRenderInfo=en,t.thresholdFrag=br,t.throwDestroyedError=At,t.trailVert=yr,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=li,t.unregisterPlugin=function(t){delete La[t],delete Aa[t],E(Ra,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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}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=oi,t.vecFill=ni,t.vecMulCombine=ai,t.vecNormalize=function(t,e){1===arguments.length&&(e=t,t=[]);var r=e,i=Math.hypot.apply(Math,f([],h(r),!1));if(0===i)return oi(t,r,r.length);for(var n=0;n<r.length;n++)t[n]=r[n]/i;return t},t.version=wu,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
6
|
+
* Version: v2.0.0-alpha.21
|
|
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,N,z,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,tN,tz,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 eN(){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 ez(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],N=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*N,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*N,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*N,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*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],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=tN||(tN={})).unlit="unlit",M.pbr="pbr",M.hair="hair",(I=tz||(tz={}))[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",(N=tG||(tG={})).normal="normal",N.bold="bold",N.lighter="lighter",(z=tX||(tX={})).normal="normal",z.italic="italic",z.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.TrackAsset="TrackAsset",D.TimelineAsset="TimelineAsset",D.TransformPlayableAsset="TransformPlayableAsset",D.SpriteColorPlayableAsset="SpriteColorPlayableAsset",D.BinaryAsset="BinaryAsset",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 tN},get MaterialBlending(){return tz},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=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 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,rN(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,rN(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),rP=!0,[4,rN(t)];case 6:return[2]}})})).apply(this,arguments)}function rN(t){return rz.apply(this,arguments)}function rz(){return(rz=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,rN(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,rN(e)];case 1:return n=a.sent(),(o=r.create(i,{sourceType:t.TextureSourceType.image,image:n,id:eN()})).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,rN(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 rN(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 rN(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 rN(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.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),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=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),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=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 iN(t)},tJ[tR.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new iR(im(eJ,[].concat(t[1][0]))):new iz(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:"-"},nN=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),nz=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,N=12*F,z={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#"+l,bufferUsage:rb.DYNAMIC_DRAW};if(O)z.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var D=new Float32Array(P);z.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,z)}),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.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},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?(oz.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=eK.Z.clone(),c.transformNormal(this.upDirectionWorld)),oN.crossVectors(oz,this.upDirectionWorld).normalize(),oN.isZero()&&oN.set(1,0,0)):(oN.set(1,0,0),oz.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:oz,dirX:oN,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=[],N=[0,0,1,1];if(t.splits){var z=t.splits[0];N=(f=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(E&&!E.animate)for(var 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*N[2]/D+N[0],X*N[3]/k+N[1],N[2]/D,N[3]/k]);else F.push(N);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,oN=new eK,oz=new eK,oD=new eK,ok=new e0,oU=[0,0,0],oB=new e$,oG=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}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.lastTime===this.time&&(r=0),e.onUpdate(r)}this.lastTime=this.time},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,N=void 0===F?0:F,z=r.diffuse,D=void 0===z?rq.createWithData(e):z,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+N],["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:",N,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 N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var z=ef(a.getIndexData(),6*n,6*r,u);z.set(N,6*t),a.setIndexData(z),this.maxParticleBufferCount=z.length/6}else a.setIndexSubData(6*t,N);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.endBehaviour===tO.loop?e%=r:this.endBehaviour===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))}var r=e.prototype;return r.evaluateAt=function(e){var r=this.clip,i=1,n=!1,o=!1,a=this.track.binding;e>r.start+r.duration+.001&&r.endBehaviour===tO.destroy?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&&!a.ended&&(a.ended=!0,a.onEnd()),n&&this.playable.getPlayState()===t0.Playing&&(this.playable.pause(),this.onClipEnd());var s=r.toLocalTime(e);this.playable.setTime(s)},r.onClipEnd=function(){var t=this.track.binding;if(!t.compositionReusable&&!t.reusable){t.dispose(),this.playable.dispose();return}},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.endBehaviour=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 nz,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(eN());for(var x,T=eH(g.components);!(x=T()).done;)x.value.setInstanceId(eN())}}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,aN=Math.sin,az=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=eN();if(null!=r.textures||(r.textures=[]),r.textures.forEach(function(t){t.id=eN(),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:eN(),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:eN()}}));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]=eN(),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:eN(),dataType:"TimelineAsset"},u=eH(t.items);!(i=u()).done;){var c=e[i.value.id],l=[],h={id:eN(),dataType:"ActivationPlayableAsset"};a.push(h);var f={id:eN(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehaviour:c.endBehavior,asset:{id:h.id}}]};if(l.push({id:f.id}),o.push(f),c.type!==tx.particle){var m={id:eN(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(m);var d={id:eN(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehaviour:c.endBehavior,asset:{id:m.id}}]};l.push({id:d.id}),o.push(d)}if(c.type===tx.sprite){var p={id:eN(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime,startColor:c.content.options.startColor};a.push(p);var v={id:eN(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehaviour:c.endBehavior,asset:{id:p.id}}]};l.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,endBehaviour:c.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),o.push(g)}var x={id:eN(),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:eN(),dataType:"TransformPlayableAsset",sizeOverLifetime:f.content.sizeOverLifetime,rotationOverLifetime:f.content.rotationOverLifetime,positionOverLifetime:f.content.positionOverLifetime}]}),f.type===tx.sprite&&I.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,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=eN(),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:eN(),renderLevel:i,url:t,oriY:n};if(t.template)return{id:eN(),url:t.url,template:t.template,webp:t.webp,renderLevel:i,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:i};if(t.url)return{id:eN(),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*az/2),c=aF(a*az/2),l=aF(s*az/2),h=aN(o*az/2),f=aN(a*az/2),m=aN(s*az/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,rN(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,rN(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:rN,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,rN(ez(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.fovScaleRatio=1,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.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*this.fovScaleRatio,r,i,n,o===tC.portrait),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:"editorScaleRatio",get:function(){return this.camera.fovScaleRatio},set:function(t){this.camera.fovScaleRatio=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 N,z=eH(void 0===i?[]:i);!(N=z()).done;){var D=N.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",nN,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.21.");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({target:n,format:t7.RGBAFormat,type:t7.UnsignedByteType},e,{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),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.21";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=iN,t.BezierCurveQuat=iz,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=nN,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=ez,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=eN,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=rN,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})});
|
|
21
8
|
//# sourceMappingURL=index.min.js.map
|