@galacean/effects-threejs 2.10.0 → 2.10.1
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 +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.10.
|
|
7
|
-
*/function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,S,E,C,w,_,M,A,P,I,R,O,V,N,F,L,D,k,B,z,U,G,W,j,X,H,Y,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tl,tc,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tS,tE,tC,tw,t_,tM,tA,tP,tI,tR,tO,tV,tN,tF,tL,tD,tk,tB,tz,tU,tG,tW,tj,tX,tH,tY,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,el,ec,ef,ed,ep,em,ev,ey,eg,ex,eb,eT,eS,eE,eC,ew,e_,eM,eA,eP,eI,eR,eO,eV,eN,eF,eL,eD,ek,eB,ez,eU,eG,eW,ej,eX=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function eH(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function eY(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){eH(a,r,n,o,s,"next",t)}function s(t){eH(a,r,n,o,s,"throw",t)}o(void 0)})}}function eZ(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):eZ(t,e)}function eq(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function eK(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var eQ=new Uint8Array(16),eJ=[],e$=0;e$<256;++e$)eJ.push((e$+256).toString(16).slice(1));var e0={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function e1(t,e){return t.includes(e)||t.push(e),t}function e2(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function e3(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}var e4=Math.PI/180,e5=180/Math.PI;function e6(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var e8=function(t,e,i){return(1-i)*t+i*e};function e9(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}var e7=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.angle=function(){return Math.atan2(-this.y,-this.x)+Math.PI},e.rotateAround=function(t,e){var i=Math.cos(e),r=Math.sin(e),n=this.x-t.x,a=this.y-t.y;return this.x=n*i-a*r+t.x,this.y=n*r+a*i+t.y,this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();e7.ONE=new e7(1,1),e7.ZERO=new e7(0,0);var it=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new e7(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)},e.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},e.setFromMatrixColumn=function(t,e){return this.setFromArray(t.elements,4*e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();it.X=new it(1,0,0),it.Y=new it(0,1,0),it.Z=new it(0,0,1),it.ONE=new it(1,1,1),it.ZERO=new it(0,0,0);var ie=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new it(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();ie.ONE=new ie(1,1,1,1),ie.ZERO=new ie(0,0,0,0);var ii=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,h=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,h=o):a>=3&&a<=4?(u=o,h=n):a>=4&&a<=5?(s=o,h=n):a>=5&&a<=6&&(s=n,h=o);var l=i-n;return this.set(s+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new ie(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,h=0;return 0!==a&&(h=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,h,a,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*Math.min(Math.max(this.r,0),1))),r=t.ToHex(Math.round(255*Math.min(Math.max(this.g,0),1))),n=t.ToHex(Math.round(255*Math.min(Math.max(this.b,0),1))),a=t.ToHex(Math.round(255*Math.min(Math.max(this.a,0),1)));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)},t.linearToGamma=function(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function ir(t,e){var i=[0,0,0,0];if(iA(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eZ(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function ia(t,e,i){if(0===t.length)return[0,0,0,0];if(e<=t[0].time)r=t[0].color.toArray();else if(e>=t[t.length-1].time)r=t[t.length-1].color.toArray();else{r=t[t.length-1].color.toArray();for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.time<=e&&e<=o.time){r=is(a.color.toArray(),o.color.toArray(),(e-a.time)/(o.time-a.time));break}}}return i?r.map(function(t){return t/255}):r}function io(t){var e=[];return eZ(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({time:iu(i),color:new ii(r,n,a,o)})}):Object.keys(t).forEach(function(i){var r=t[i],n=new ii().setFromArray(ir(r));e.push({time:iu(i),color:n})}),e=e.sort(function(t,e){return t.time-e.time})}function is(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function iu(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function ih(){return"object"==typeof window?Math.min(2,window.devicePixelRatio||1):1}ii.BLACK=new ii(0,0,0,1),ii.BLUE=new ii(0,0,1,1),ii.CLEAR=new ii(0,0,0,0),ii.CYAN=new ii(0,1,1,1),ii.GRAY=new ii(.5,.5,.5,1),ii.GREEN=new ii(0,1,0,1),ii.MAGENTA=new ii(1,0,1,1),ii.RED=new ii(1,0,0,1),ii.WHITE=new ii(1,1,1,1),ii.YELLOW=new ii(1,.92,.016,1);var il="undefined"!=typeof window;function ic(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function id(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ip(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function im(){return id()||ip()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function iv(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function iy(){return"miniprogram"===window.__wxjs_environment}function ig(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=io(t);if(r.length)for(var n=0;n<128;n++){var a=n/127;if(a<=r[0].time)i.set(r[0].color.toArray(),4*n);else if(a>=r[r.length-1].time)i.set(r[r.length-1].color.toArray(),4*n);else for(var o=0;o<r.length-1;o++){var s=r[o],u=r[o+1];if(s.time<=a&&u.time>a){var h=is(s.color.toArray(),u.color.toArray(),(a-s.time)/(u.time-s.time));i.set(h,4*n);break}}}return e}function ix(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var a,o,s=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>s.priority&&h>=u;)h--;for(;e[u].priority<=s.priority&&u<h;)u++}else{for(;e[h].priority<s.priority&&h>=u;)h--;for(;e[u].priority>=s.priority&&u<h;)u++}a=[e[h],e[u]],e[u]=a[0],e[h]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)iT(t,r,e);return t}function ib(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&iT(t,t.length-1,i)),t}function iT(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function iS(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function iE(t){return iC(t)||!im()}function iC(t){return/^[^\d.][\w-]*$/.test(t)}function iw(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var i_={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(iw(t),[r])),null==tG||tG("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(iw(t))),null==tG||tG("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(iw(t))),null==tG||tG("warn",t,r)},register:function(t){t&&iI(t)&&(tG=t)}};function iM(){}function iA(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var iP=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function iI(t){return"[object Function]"===Object.prototype.toString.call(t)}function iR(t){return"[object Object]"===Object.prototype.toString.call(t)}function iO(t){if(null===t||"object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function iV(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function iN(t,e){return t+Math.random()*(e-t)}function iF(){throw Error("Destroyed item cannot be used again.")}function iL(){return(function(t,e,i){if(e0.randomUUID&&!t)return e0.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tU&&!(tU="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tU(eQ)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eJ[n[r+0]]+eJ[n[r+1]]+eJ[n[r+2]]+eJ[n[r+3]]+"-"+eJ[n[r+4]]+eJ[n[r+5]]+"-"+eJ[n[r+6]]+eJ[n[r+7]]+"-"+eJ[n[r+8]]+eJ[n[r+9]]+"-"+eJ[n[r+10]]+eJ[n[r+11]]+eJ[n[r+12]]+eJ[n[r+13]]+eJ[n[r+14]]+eJ[n[r+15]]})().replace(/-/g,"")}function iD(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var h=new Uint8Array(s);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function ik(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var iB={},iz=[];function iU(t,e){iB[t]&&i_.error("Duplicate registration for plugin "+t+"."),iB[t]=e;var i=new e;i.name=t,iz.push(i),iz.sort(function(t,e){return t.order-e.order})}var iG=function(){function t(){}return t.getPlugins=function(){return iz},t.notifyCompositionCreating=function(t,e){iz.forEach(function(i){return i.onCompositionCreating(t,e)})},t.notifyCompositionCreated=function(t,e){iz.forEach(function(i){return i.onCompositionCreated(t,e)})},t.notifyCompositionDestroy=function(t){iz.forEach(function(e){return e.onCompositionDestroy(t)})},t.notifyEngineCreated=function(t){iz.forEach(function(e){return e.onEngineCreated(t)})},t.notifyEngineDestroy=function(t){iz.forEach(function(e){return e.onEngineDestroy(t)})},t.notifyAssetsLoadStart=function(t,e){return eY(function(){return eK(this,function(i){return[2,Promise.all(iz.map(function(i){return i.onAssetsLoadStart(t,e)}))]})})()},t.notifyAssetsLoadFinish=function(t,e,i){iz.forEach(function(r){return r.onAssetsLoadFinish(t,e,i)})},t}(),iW={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",ffd:"@galacean/effects-plugin-ffd",ktx2:"@galacean/effects-plugin-ktx2",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function ij(t){var e=iW[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var iX=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return eY(function(){return eK(this,function(t){return[2]})})()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreating=function(t,e){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},e.onEngineCreated=function(t){},e.onEngineDestroy=function(t){},t}();function iH(t,e){return(iH=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function iY(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&&iH(t,e)}(n=tW||(tW={}))["1_0"]="1.0",n["1_1"]="1.1",n["1_2"]="1.2",n["1_3"]="1.3",n["1_5"]="1.5",n["1_8"]="1.8",n["2_0"]="2.0",n["2_1"]="2.1",n["2_2"]="2.2",n["2_3"]="2.3",n["2_4"]="2.4",n["3_0"]="3.0",n["3_1"]="3.1",n["3_2"]="3.2",n["3_3"]="3.3",n["3_4"]="3.4",n["3_5"]="3.5",n["3_6"]="3.6",n["3_7"]="3.7",n["3_8"]="3.8",n.LATEST="3.8",(a=tj||(tj={})).S="S",a.APlus="A+",a.A="A",a.BPlus="B+",a.B="B",(o=tX||(tX={}))[o.ALPHA=0]="ALPHA",o[o.ADD=1]="ADD",o[o.MULTIPLY=2]="MULTIPLY",o[o.BRIGHTNESS=3]="BRIGHTNESS",o[o.SUBTRACTION=4]="SUBTRACTION",o[o.STRONG_LIGHT=5]="STRONG_LIGHT",o[o.WEAK_LIGHT=6]="WEAK_LIGHT",o[o.SUPERPOSITION=7]="SUPERPOSITION",(s=tH||(tH={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tY||(tY={}))[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(h=tZ||(tZ={}))[h.NONE=0]="NONE",h[h.SPHERE=1]="SPHERE",h[h.CONE=2]="CONE",h[h.HEMISPHERE=3]="HEMISPHERE",h[h.CIRCLE=4]="CIRCLE",h[h.DONUT=5]="DONUT",h[h.RECTANGLE=6]="RECTANGLE",h[h.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",h[h.EDGE=8]="EDGE",h[h.TEXTURE=9]="TEXTURE",(l=tq||(tq={}))[l.GYROSCOPE=0]="GYROSCOPE",l[l.SPINE=1]="SPINE",(c=tK||(tK={}))[c.CLICK=0]="CLICK",c[c.MESSAGE=1]="MESSAGE",c[c.DRAG=2]="DRAG",(f=tQ||(tQ={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(d=tJ||(tJ={})).base="0",d.sprite="1",d.particle="2",d.null="3",d.interact="4",d.plugin="5",d.camera="6",d.composition="7",d.spine="spine",d.mesh="mesh",d.tree="tree",d.text="text",d.light="light",d.skybox="skybox",d.effect="effect",d.shape="shape",d.postProcessVolume="postProcessVolume",d.node="node",d.video="video",d.audio="audio",d.richtext="richtext",(p=t$||(t$={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=t0||(t0={}))[m.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",m[m.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",m[m.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",m[m.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",m[m.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",m[m.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",m[m.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",m[m.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",m[m.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=t1||(t1={})).Opaque="Opaque",v.Transparent="Transparent",(y=t2||(t2={})).Both="Both",y.Back="Back",y.Front="Front",(g=t3||(t3={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=t4||(t4={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",x[x.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",x[x.COLOR_CURVE=24]="COLOR_CURVE",x[x.VECTOR4_CURVE=25]="VECTOR4_CURVE",x[x.VECTOR2_CURVE=26]="VECTOR2_CURVE",x[x.VECTOR3_CURVE=27]="VECTOR3_CURVE",x[x.REFERENCE_CURVE=28]="REFERENCE_CURVE",(b=t5||(t5={}))[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",(T=t6||(t6={}))[T.destroy=0]="destroy",T[T.restart=5]="restart",T[T.forward=2]="forward",T[T.freeze=4]="freeze",(S=t8||(t8={}))[S.none=0]="none",S[S.removeParticle=1]="removeParticle",(E=t9||(t9={}))[E.RANDOM=0]="RANDOM",E[E.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",E[E.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",E[E.UNIFORM_BURST=3]="UNIFORM_BURST",(C=t7||(t7={})).point="point",C.spot="spot",C.directional="directional",C.ambient="ambient",(w=et||(et={}))[w.box=2]="box",w[w.sphere=3]="sphere",(_=ee||(ee={})).orthographic="orthographic",_.perspective="perspective",(M=ei||(ei={})).unlit="unlit",M.pbr="pbr",M.hair="hair",(A=er||(er={}))[A.opaque=100]="opaque",A[A.masked=101]="masked",A[A.translucent=102]="translucent",A[A.additive=103]="additive",(P=en||(en={})).none="none",P.uv="uv",P.normal="normal",P.basecolor="basecolor",P.alpha="alpha",P.metallic="metallic",P.roughness="roughness",P.ao="ao",P.emissive="emissive",P.diffuse="diffuse",(I=ea||(ea={}))[I.visible=0]="visible",I[I.display=1]="display",I[I.clip=2]="clip",I[I.ellipsis=3]="ellipsis",(R=eo||(eo={}))[R.autoWidth=0]="autoWidth",R[R.autoHeight=1]="autoHeight",R[R.fixed=2]="fixed",(O=es||(es={}))[O.top=0]="top",O[O.middle=1]="middle",O[O.bottom=2]="bottom",(V=eu||(eu={}))[V.left=0]="left",V[V.middle=1]="middle",V[V.right=2]="right",(N=eh||(eh={}))[N.top=0]="top",N[N.middle=1]="middle",N[N.bottom=2]="bottom",(F=el||(el={})).normal="normal",F.bold="bold",F.lighter="lighter",(L=ec||(ec={})).normal="normal",L.italic="italic",L.oblique="oblique";var iZ={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(D=ef||(ef={}))[D.None=0]="None",D[D.Rotate90=1]="Rotate90",(k=ed||(ed={}))[k.Solid=0]="Solid",k[k.GradientLinear=1]="GradientLinear",k[k.GradientRadial=2]="GradientRadial",k[k.GradientAngular=3]="GradientAngular",k[k.Texture=4]="Texture",(B=ep||(ep={}))[B.Fill=0]="Fill",B[B.Fit=1]="Fit",B[B.Crop=2]="Crop",B[B.Tile=3]="Tile",(z=em||(em={}))[z.Custom=0]="Custom",z[z.Rectangle=1]="Rectangle",z[z.Ellipse=2]="Ellipse",z[z.Polygon=3]="Polygon",z[z.Star=4]="Star",(U=ev||(ev={}))[U.Butt=0]="Butt",U[U.Round=1]="Round",U[U.Square=2]="Square",(G=ey||(ey={}))[G.Round=0]="Round",G[G.Bevel=1]="Bevel",G[G.Miter=2]="Miter",(W=eg||(eg={})).AnimationClipNodeData="AnimationClipNodeData",W.BlendNodeData="BlendNodeData",W.ApplyAdditiveNodeData="ApplyAdditiveNodeData",W.LayerBlendNodeData="LayerBlendNodeData",W.StateMachineNodeData="StateMachineNodeData",W.TransitionNodeData="TransitionNodeData",W.StateNodeData="StateNodeData",W.ConstFloatNodeData="ConstFloatNodeData",W.ConstBoolNodeData="ConstBoolNodeData",W.ControlParameterBoolNodeData="ControlParameterBoolNodeData",W.ControlParameterFloatNodeData="ControlParameterFloatNodeData",W.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",W.NotNodeData="NotNodeData",W.AndNodeData="AndNodeData",W.OrNodeData="OrNodeData",W.EqualNodeData="EqualNodeData",W.GreaterNodeData="GreaterNodeData",W.LessNodeData="LessNodeData",(j=ex||(ex={})).video="video",j.image="image",(X=eb||(eb={})).video="video",X.audio="audio",(H=eT||(eT={})).L30="hev1.1.0.L30.B0",H.L60="hev1.1.0.L60.B0",H.L63="hev1.1.0.L63.B0",H.L90="hev1.1.0.L90.B0",H.L93="hev1.1.0.L93.B0",H.L120="hev1.1.0.L120.B0",H.L150="hev1.1.0.L150.B0",H.L180="hev1.1.0.L180.B0",(Y=eS||(eS={})).VFXItemData="VFXItemData",Y.Material="Material",Y.Shader="Shader",Y.Geometry="Geometry",Y.Texture="Texture",Y.Image="Image",Y.AnimationClip="AnimationClip",Y.BinaryAsset="BinaryAsset",Y.Sprite="Sprite",Y.TrackAsset="TrackAsset",Y.TimelineAsset="TimelineAsset",Y.ObjectBindingTrack="ObjectBindingTrack",Y.TransformTrack="TransformTrack",Y.SpriteColorTrack="SpriteColorTrack",Y.ActivationTrack="ActivationTrack",Y.SubCompositionTrack="SubCompositionTrack",Y.FloatPropertyTrack="FloatPropertyTrack",Y.ColorPropertyTrack="ColorPropertyTrack",Y.Vector2PropertyTrack="Vector2PropertyTrack",Y.Vector3PropertyTrack="Vector3PropertyTrack",Y.Vector4PropertyTrack="Vector4PropertyTrack",Y.SpritePropertyTrack="SpritePropertyTrack",Y.TransformPlayableAsset="TransformPlayableAsset",Y.SpriteColorPlayableAsset="SpriteColorPlayableAsset",Y.ActivationPlayableAsset="ActivationPlayableAsset",Y.SubCompositionPlayableAsset="SubCompositionPlayableAsset",Y.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",Y.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",Y.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",Y.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",Y.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",Y.SpritePropertyPlayableAsset="SpritePropertyPlayableAsset",Y.MeshComponent="MeshComponent",Y.SkyboxComponent="SkyboxComponent",Y.LightComponent="LightComponent",Y.CameraComponent="CameraComponent",Y.ModelPluginComponent="ModelPluginComponent",Y.TreeComponent="TreeComponent",Y.AnimationComponent="AnimationComponent",Y.SpineComponent="SpineComponent",Y.VideoComponent="VideoComponent",Y.AudioComponent="AudioComponent",Y.RichTextComponent="RichTextComponent",Y.OrientationComponent="OrientationComponent",Y.ShapeComponent="ShapeComponent",Y.SpriteComponent="SpriteComponent",Y.ParticleSystem="ParticleSystem",Y.InteractComponent="InteractComponent",Y.CameraController="CameraController",Y.PostProcessVolume="PostProcessVolume",Y.EffectComponent="EffectComponent",Y.TextComponent="TextComponent",Y.AnimationGraphAsset="AnimationGraphAsset",Y.CompositionComponent="CompositionComponent",Y.FFDComponent="FFDComponent",Y.FrameComponent="FrameComponent",Y.Animator="Animator",Y.DomContentComponent="DomContentComponent",Y.UIControl="UIControl",Y.Control="Control",Y.Container="Container",Y.HBoxContainer="HBoxContainer",Y.VBoxContainer="VBoxContainer",Y.GridContainer="GridContainer",Y.PanelContainer="PanelContainer",Y.MarginContainer="MarginContainer",Y.CenterContainer="CenterContainer",Y.AspectRatioContainer="AspectRatioContainer",Y.ScrollContainer="ScrollContainer",Y.HScrollBar="HScrollBar",Y.VScrollBar="VScrollBar",Y.HSeparator="HSeparator",Y.VSeparator="VSeparator",Y.Label="Label",Y.LineEdit="LineEdit",Y.TextEdit="TextEdit",Y.PopupPanel="PopupPanel",Y.PopupMenu="PopupMenu",Y.MenuButton="MenuButton",Y.OptionButton="OptionButton",Y.ColorPicker="ColorPicker",Y.ColorPickerButton="ColorPickerButton",Y.TextureRect="TextureRect",Y.NinePatchRect="NinePatchRect",Y.ColorRect="ColorRect",Y.Panel="Panel",Y.ProgressBar="ProgressBar",Y.Button="Button",Y.Checkbox="Checkbox",Y.CheckButton="CheckButton",Y.HSlider="HSlider",Y.VSlider="VSlider",Y.TimelineClip="TimelineClip",(Z=eE||(eE={}))[Z.POINTS=0]="POINTS",Z[Z.LINES=1]="LINES",Z[Z.LINE_LOOP=2]="LINE_LOOP",Z[Z.LINE_STRIP=3]="LINE_STRIP",Z[Z.TRIANGLES=4]="TRIANGLES",Z[Z.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",Z[Z.TRIANGLE_FAN=6]="TRIANGLE_FAN",(q=eC||(eC={}))[q.Float16=0]="Float16",q[q.Float32=1]="Float32",q[q.Int8=2]="Int8",q[q.Int16=3]="Int16",q[q.Int32=4]="Int32",q[q.UInt8=5]="UInt8",q[q.UInt16=6]="UInt16",q[q.UInt32=7]="UInt32",(K=ew||(ew={}))[K.None=-1]="None",K[K.UInt8=0]="UInt8",K[K.UInt16=1]="UInt16",K[K.UInt32=2]="UInt32",(Q=e_||(e_={})).Position="POSITION",Q.Uv="TEXCOORD0",Q.Uv2="TEXCOORD1",Q.Normal="NORMAL",Q.Tangent="TANGENT",Q.Color="COLOR",Q.Joints="JOINTS",Q.Weights="WEIGHTS",Q.PositionBS0="POSITION_BS0",Q.PositionBS1="POSITION_BS1",Q.PositionBS2="POSITION_BS2",Q.PositionBS3="POSITION_BS3",Q.PositionBS4="POSITION_BS4",Q.PositionBS5="POSITION_BS5",Q.PositionBS6="POSITION_BS6",Q.PositionBS7="POSITION_BS7",Q.NormalBS0="NORMAL_BS0",Q.NormalBS1="NORMAL_BS1",Q.NormalBS2="NORMAL_BS2",Q.NormalBS3="NORMAL_BS3",Q.TangentBS0="TANGENT_BS0",Q.TangentBS1="TANGENT_BS1",Q.TangentBS2="TANGENT_BS2",Q.TangentBS3="TANGENT_BS3";var iq=Object.freeze({__proto__:null,LATEST_VERSION:tW.LATEST,get RenderLevel(){return tj},get BlendingMode(){return tX},get SideMode(){return tH},get ObscuredMode(){return tY},get ParticleEmitterShapeType(){return tZ},get PluginType(){return tq},get InteractType(){return tK},get InteractBehavior(){return tQ},get ItemType(){return tJ},get RenderMode(){return t$},get ParticleOrigin(){return t0},get RenderType(){return t1},get RenderFace(){return t2},get CameraClipMode(){return t3},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 t4},get BezierKeyframeType(){return t5},get JSONSceneVersion(){return tW},get EndBehavior(){return t6},get ParticleInteractionBehavior(){return t8},get ShapeArcMode(){return t9},get LightType(){return t7},get ModelBoundingType(){return et},get CameraType(){return ee},get MaterialType(){return ei},get MaterialBlending(){return er},get RenderMode3D(){return en},get TextOverflow(){return ea},get TextSizeMode(){return eo},get TextBaseline(){return es},get TextAlignment(){return eu},get TextVerticalAlign(){return eh},get TextWeight(){return el},get FontStyle(){return ec},BuiltinObjectGUID:iZ,get SpriteRotation(){return ef},get FillType(){return ed},get TexturePaintScaleMode(){return ep},get ShapePrimitiveType(){return em},get LineCap(){return ev},get LineJoin(){return ey},get NodeDataType(){return eg},get BackgroundType(){return ex},get MultimediaType(){return eb},get HevcVideoCodec(){return eT},get DataType(){return eS},get GeometryType(){return eE},get VertexFormatType(){return eC},get IndexFormatType(){return ew},get VertexBufferSemantic(){return e_}});function iK(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function iQ(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return iK(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return iK(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var iJ=new Map,i$=new Map,i0={};function i1(t){return function(e,i){i0[t]&&console.warn("Class "+t+" is already registered."),i0[t]=e}}function i2(t){var e=t.constructor;if(i$.get(e))return i$.get(e);var i={};i$.set(e,i);for(var r=t,n=e;n;){var a=iJ.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function i3(t,e){return function(i,r){var n,a=(n=i.constructor,iJ.get(n)||iJ.set(n,{}),iJ.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var i4=function(){function t(t){this.engine=t,this.guid=iL(),this.definition={},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){void 0!==t.id&&this.setInstanceId(t.id)},e.dispose=function(){this.engine.removeInstance(this.guid)},t.is=function(e){return eZ(e,t)&&"guid"in e},t}(),i5=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),i6={};function i8(t){return function(e,i){i6[t]&&console.warn("NodeData Class "+t+" is already registered."),i6[t]=e}}var i9=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw Error("Node still initialized!");this.lastUpdateID=-1},t}(),i7=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i.asset=this,i},t}(),rt=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.previousTime=0,e.currentTime=0,e}iY(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(i9),re=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.setValue=function(t){},e}(i9),ri=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(re),rr=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(re);t.AnimationGraphAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.nodeDatas=[],e.graphDataSet=new i5,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=-1,e}return iY(e,t),e.prototype.fromData=function(t){var i=t.nodeDatas;this.rootNodeIndex=t.rootNodeIndex,this.controlParameterIDs=t.controlParameterIDs;for(var r=t.controlParameterIDs.length,n=0;n<r;n++)this.parameterLookupMap.set(t.controlParameterIDs[n],n);this.nodeDatas=[];for(var a=0;a<i.length;a++)this.nodeDatas[a]=e.createNodeData(i[a].type),this.nodeDatas[a].load(i[a]);this.graphDataSet=new i5,this.graphDataSet.resources=[];for(var o,s=iQ(t.graphDataSet.resources);!(o=s()).done;){var u=o.value,h=this.engine.findObject(u);this.graphDataSet.resources.push(h)}},e.createNodeData=function(t){var e=i6[t];if(e)return new e;throw Error("Unknown node type: "+t+".")},e}(i4),t.AnimationGraphAsset=eq([i1("AnimationGraphAsset")],t.AnimationGraphAsset),(J=eM||(eM={}))[J.Active=0]="Active",J[J.Inactive=1]="Inactive";var rn=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),ra=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t]):null},t}();function ro(){return(ro=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}t.AnimationClipNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rs,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=ro({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(i7),t.AnimationClipNodeData=eq([i8(eg.AnimationClipNodeData)],t.AnimationClipNodeData);var rs=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.animation=null,e.animatable=null,e}iY(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=e9(this.currentTime,0,1),this.sampleEvents(t);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.sampleEvents=function(t){if(this.animatable&&0!==this.animatable.events.length)for(var e,i=this.previousTime*this.duration,r=this.currentTime*this.duration,n=iQ(this.animatable.events);!(e=n()).done;){var a=e.value,o=a.data.startTime;(this.previousTime<=this.currentTime?i<o&&o<=r:o>i||o<=r)&&(a.currentTime=r,a.deltaTime=t.deltaTime,t.activeEvents.push(a))}},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new ru(e.skeleton,this.animation))},e}(rt);($=eA||(eA={}))[$.Position=0]="Position",$[$.Scale=1]="Scale",$[$.Rotation=2]="Rotation",$[$.Euler=3]="Euler";var ru=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=iQ(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,o=iQ(e.scaleCurves);!(a=o()).done;){var s=a.value;this.addTransformCurveInfo(s,1)}for(var u,h=iQ(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=iQ(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=iQ(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=iQ(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}for(var b,T=iQ(this.animationClip.events);!(b=T()).done;){var S=b.value;this.events.push({data:S,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=e9(t,0,this.animationClip.duration),n=iQ(this.transformCurveInfos);!(i=n()).done;){var a=i.value,o=a.curve.keyFrames.getValue(r),s=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:s.position.copyFrom(o);break;case 1:s.scale.copyFrom(o);break;case 2:s.rotation.copyFrom(o);break;case 3:s.euler.copyFrom(o)}}for(var u,h=iQ(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=iQ(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),rh=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],o=e[5],s=e[9],u=e[2],h=e[6],l=e[10],c=i+o+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>l){var d=2*Math.sqrt(1+i-o-l);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>l){var p=2*Math.sqrt(1+o-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(e9(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=e.x,s=e.y,u=e.z,h=e.w;return this.x=i*h+a*o+r*u-n*s,this.y=r*h+a*s+n*o-i*u,this.z=n*h+a*u+i*s-r*o,this.w=a*h-i*o-r*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(s),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,f=Math.sin(e*l)/h;return this.w=a*c+this.w*f,this.x=i*c+this.x*f,this.y=r*c+this.y*f,this.z=n*c+this.z*f,this},e.slerpQuaternions=function(t,e,i){return this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,a=this.w,o=t.x,s=t.y,u=t.z,h=a*o+r*u-n*s,l=a*s+n*o-i*u,c=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=h*a+-(f*i)+-(l*n)- -(c*r),d.y=l*a+-(f*r)+-(c*i)- -(h*n),d.z=c*a+-(f*n)+-(h*r)- -(l*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(it.ZERO,this,it.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();rh.tempVec0=new it;var rl=new rh,rc=function(){},rf=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(rc),rd=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=rl.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(rc),rp=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var o=t.parentSpaceTransforms[a],s=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=o.position,l=s.position,c=u.position;n.blendVector3(h,l,i,c);var f=o.rotation,d=s.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=o.scale,v=s.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=o.euler,x=s.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var S=t.floatPropertyValues[T],E=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(S,E,i)}for(var C=0;C<t.colorPropertyValues.length;C++){var w=t.colorPropertyValues[C],_=e.colorPropertyValues[C],M=r.colorPropertyValues[C];n.blendColor(w,_,i,M)}},t}();rp.normalBlendFunction=new rf,rp.additiveBlendFunction=new rd;var rm=function(){function t(t){this.position=new it,this.rotation=new rh,this.scale=new it,this.euler=new it,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),rv=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=iQ(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push(new rm().copyFrom(r))}for(var n,a=iQ(t.defaultFloatPropertyValues);!(n=a()).done;){var o=n.value;this.floatPropertyValues.push(o)}for(var s,u=iQ(t.defaultColorPropertyValues);!(s=u()).done;){var h=s.value;this.colorPropertyValues.push(new ii().copyFrom(h))}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),ry=function(t){this.pose=new rv(t)};t.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rg,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(i7),t.ApplyAdditiveNodeData=eq([i8(eg.ApplyAdditiveNodeData)],t.ApplyAdditiveNodeData);var rg=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new ry(e.skeleton),this.additiveNodeResult=new ry(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){rp.additiveBlend(t,e,i,r)},e}(rt);t.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rx,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(i7),t.BlendNodeData=eq([i8(eg.BlendNodeData)],t.BlendNodeData);var rx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.source0=null,e.source1=null,e.inputParameterValueNode=null,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new ry(e.skeleton),this.source1Result=new ry(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){rp.localBlend(t,e,i,r)},e}(rt);t.AndNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(rb,t),r=iQ(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(i7),t.AndNodeData=eq([i8(eg.AndNodeData)],t.AndNodeData);var rb=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=iQ(this.conditionNodes);!(e=i()).done;)if(!e.value.getValue(t)){this.result=!1;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(rr);t.OrNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(rT,t),r=iQ(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(i7),t.OrNodeData=eq([i8(eg.OrNodeData)],t.OrNodeData);var rT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=iQ(this.conditionNodes);!(e=i()).done;)if(e.value.getValue(t)){this.result=!0;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(rr);t.NotNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rS,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(i7),t.NotNodeData=eq([i8(eg.NotNodeData)],t.NotNodeData);var rS=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.result=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(rr);t.ConstFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rE,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ConstFloatNodeData=eq([i8(eg.ConstFloatNodeData)],t.ConstFloatNodeData);var rE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}return iY(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(ri);t.ConstBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rC,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ConstBoolNodeData=eq([i8(eg.ConstBoolNodeData)],t.ConstBoolNodeData);var rC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}return iY(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(rr);t.ControlParameterFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rw,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ControlParameterFloatNodeData=eq([i8(eg.ControlParameterFloatNodeData)],t.ControlParameterFloatNodeData);var rw=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(ri);t.ControlParameterBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(r_,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ControlParameterBoolNodeData=eq([i8(eg.ControlParameterBoolNodeData)],t.ControlParameterBoolNodeData);var r_=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(rr);t.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rM,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(i7),t.ControlParameterTriggerNodeData=eq([i8(eg.ControlParameterTriggerNodeData)],t.ControlParameterTriggerNodeData);var rM=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(rr);t.LayerBlendNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNodeIndex=-1,e.layerDatas=[],e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rA,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=iQ(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:-1,e.layerDatas)for(var i,r,n=iQ(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(ro({inputNodeIndex:-1,weightValueNodeIndex:-1},a))}},e}(i7),t.LayerBlendNodeData=eq([i8(eg.LayerBlendNodeData)],t.LayerBlendNodeData);var rA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseLayerNode=null,e.layers=[],e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new ry(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var i,r,n=iQ(this.layers);!(r=n()).done;){var a,o,s=r.value;null==(a=s.inputNode)||a.initialize(e),null==(o=s.weightValueNode)||o.initialize(e)}},i.shutdownInternal=function(e){null==(i=this.baseLayerNode)||i.shutdown(e);for(var i,r,n=iQ(this.layers);!(r=n()).done;){var a,o,s=r.value;null==(a=s.inputNode)||a.shutdown(e),null==(o=s.weightValueNode)||o.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()&&(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e)),e},i.updateLayers=function(t,e){for(var i,r=iQ(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var a=n.weightValueNode.getValue(t);rp.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(rt);t.EqualNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rP,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(i7),t.EqualNodeData=eq([i8(eg.EqualNodeData)],t.EqualNodeData);var rP=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(rr),rI=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}return iY(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(i7);(tt=eP||(eP={}))[tt.GreaterThan=0]="GreaterThan",tt[tt.LessThan=1]="LessThan";var rR=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(rr);t.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rR,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rI),t.GreaterNodeData=eq([i8(eg.GreaterNodeData)],t.GreaterNodeData),t.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rR,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rI),t.LessNodeData=eq([i8(eg.LessNodeData)],t.LessNodeData),t.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(rO,t),r=iQ(this.stateDatas);!(e=r()).done;){var n=e.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(a);for(var o,s=iQ(n.transitionDatas);!(o=s()).done;){var u=o.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(i7),t.StateMachineNodeData=eq([i8(eg.StateMachineNodeData)],t.StateMachineNodeData);var rO=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.states=[],e.activeTransition=null,e.activeStateIndex=-1,e}iY(e,t);var i=e.prototype;return i.getCurrentStateName=function(){return this.states[this.activeStateIndex].stateNode.getNodeData().stateName},i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===eM.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=-1,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(-1===o.targetStateIndex)throw Error("Invalid target state index.");if(!this.states[o.targetStateIndex].stateNode.isTransitioning()){var s=!1;if(o.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>o.transitionNode.exitTime&&(s=!0)}else null!==o.conditionNode&&o.conditionNode.getValue(t)&&(s=!0);if(s){r=a;break}}}if(-1!==r){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.getNodeData().defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=-1,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=iQ(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=iQ(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(rt);t.TransitionState=void 0,(te=t.TransitionState||(t.TransitionState={}))[te.None=0]="None",te[te.TransitioningIn=1]="TransitioningIn",te[te.TransitioningOut=2]="TransitioningOut",t.StateNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rV,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex,this.stateName=e.stateName},e}(i7),t.StateNodeData=eq([i8(eg.StateNodeData)],t.StateNodeData);var rV=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}iY(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(rt);t.SourceType=void 0,(ti=t.SourceType||(t.SourceType={}))[ti.State=0]="State",ti[ti.Transition=1]="Transition",ti[ti.CachedPose=2]="CachedPose",t.TransitionNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rN,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(i7),t.TransitionNodeData=eq([i8(eg.TransitionNodeData)],t.TransitionNodeData);var rN=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.hasExitTime=!1,t.exitTime=.75,t.transitionLength=0,t.transitionProgress=0,t.blendWeight=0,t.sourceNode=null,t.sourceType=0,t.blendedDuration=0,t}iY(i,e);var r=i.prototype;return r.evaluate=function(t,e){iS(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=e9(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=eM.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult);if(this.registerPoseTasksAndUpdateRootMotion(i,n,e),this.blendedDuration=e8(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var a=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+a)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),e},r.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},r.getProgressPercentage=function(){return this.transitionProgress},r.getSourceType=function(){return this.sourceType},r.isSourceATransition=function(){return 1===this.sourceType},r.isSourceAState=function(){return 0===this.sourceType},r.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.getSourceStateNode=function(){return this.sourceNode},r.getSourceTransitionNode=function(){return this.sourceNode},r.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},r.initializeInternal=function(t){e.prototype.initializeInternal.call(this,t),this.sourceNodeResult=new ry(t.skeleton),this.targetNodeResult=new ry(t.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},r.shutdownInternal=function(i){this.targetNode.setTransitioningState(t.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(i),this.sourceNode.shutdown(i),this.sourceNode=null),e.prototype.shutdownInternal.call(this,i)},r.endSourceTransition=function(e){var i,r=this.getSourceTransitionNode().targetNode;null==(i=this.sourceNode)||i.shutdown(e),this.sourceNode=r,this.sourceType=0,this.getSourceStateNode().setTransitioningState(t.TransitionState.TransitioningOut)},r.initializeTargetStateAndUpdateTransition=function(t,e,i){this.markNodeActive(t);var r=this.targetNodeResult;return 0===this.sourceType&&this.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),r=this.targetNode.evaluate(t,r),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,r,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=e8(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},r.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=e9(this.blendWeight,0,1))},r.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;rp.localBlend(t.pose,e.pose,r,i.pose)},i}(rt);(tr=eI||(eI={}))[tr.Float=0]="Float",tr[tr.Color=1]="Color";var rF=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=iQ(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,o=iQ(e.rotation);!(a=o()).done;){var s=a.value;this.addReferenceTransform(s)}for(var u,h=iQ(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=iQ(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new rm(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n,a=t+e+i;if(void 0===this.pathToObjectIndex.get(a)){var o=this.findTarget(t);if(o){(n="VFXItem"===e?o:o.getComponent(i0[e]))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=n,l=0;l<s.length-1;l++){var c=h[s[l]];void 0===c&&console.error("The "+s[l]+" property of "+h+" was not found."),h=c}var f={target:n,propertyPath:i,directTarget:h,propertyName:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(new ii().copyFrom(h[u])),this.pathToObjectIndex.set(a,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=iQ(i);!(e=n()).done;){var a=e.value,o=r.find(a);if(!o)return null;r=o}return r},t}(),rL=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new rn;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=iQ(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var o,s=iQ(a.positionCurves);!(o=s()).done;){var u=o.value;r.position.push(u.path)}for(var h,l=iQ(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=iQ(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=iQ(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=iQ(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,S=iQ(a.colorCurves);!(T=S()).done;){var E=T.value;r.colors.push(E)}}}this.skeleton=new rF(e,r),this.result=new ry(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var C=new ra;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var w=0;w<t.nodeDatas.length;w++)C.nodes[w]||t.nodeDatas[w].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.activeEvents.length=0,this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];eZ(i,rM)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.getStateMachineNode=function(t){for(var e,i=null,r=iQ(this.nodes);!(e=r()).done;){var n=e.value;eZ(n,rO)&&n.getNodeData().machineName===t&&(i=n)}return i},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),-1)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);-1!==i&&this.nodes[i].setValue(e)},t}();function rD(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rk(t,e,i){return e&&rD(t.prototype,e),i&&rD(t,i),t}var rB=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}iY(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onPreRender=function(){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.onParentChanged=function(){},i.onOrderInParentChanged=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&e2(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},rk(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this.enabled!==t){var e;this._enabled=t,(null==(e=this.item)?void 0:e.isDuringPlay)&&this.item.isActive&&(t?this.isEnableCalled||(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}}]),e}(i4);eq([i3(void 0,void 0)],rB.prototype,"item",void 0),eq([i3(void 0,void 0)],rB.prototype,"_enabled",void 0);var rz=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(rB);t.Animator=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.graphInstance=null,e.graphAsset=null,e}iY(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graphInstance&&this.graphInstance.setBool(t,e)},i.setFloat=function(t,e){this.graphInstance&&this.graphInstance.setFloat(t,e)},i.setTrigger=function(t){this.graphInstance&&this.graphInstance.setTrigger(t)},i.resetTrigger=function(t){this.graphInstance&&this.graphInstance.resetTrigger(t)},i.getStateMachineNode=function(t){var e=null;return this.graphInstance&&(e=this.graphInstance.getStateMachineNode(t)),e},i.onStart=function(){this.graphAsset&&(this.graphInstance=new rL(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graphInstance){for(var e=this.graphInstance.evaluateGraph(t/1e3),i=this.graphInstance.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,o=e.pose.parentSpaceTransforms[r].scale,s=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(o.x,o.y,o.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(s.x,s.y,s.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graphInstance.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.propertyName;l.directTarget[c]=e.pose.floatPropertyValues[h],eZ(l.target,rB)&&l.target.onApplyAnimationProperties()}for(var f=this.graphInstance.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.propertyName;p.directTarget[m]=e.pose.colorPropertyValues[d],eZ(p.target,rB)&&p.target.onApplyAnimationProperties()}for(var v,y=iQ(this.graphInstance.activeEvents);!(v=y()).done;){var g=v.value;g.data.event.onEvent(this.item,g)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(rB),t.Animator=eq([i1("Animator")],t.Animator),t.ShaderType=void 0,(tn=t.ShaderType||(t.ShaderType={}))[tn.vertex=0]="vertex",tn[tn.fragment=1]="fragment",t.MaskMode=void 0,(ta=t.MaskMode||(t.MaskMode={}))[ta.NONE=0]="NONE",ta[ta.MASK=1]="MASK",ta[ta.OBSCURED=2]="OBSCURED",ta[ta.REVERSE_OBSCURED=3]="REVERSE_OBSCURED";var rU=[],rG={},rW="WebGL Constants not in global, please check your environment";function rj(){"function"==typeof WebGL2RenderingContext?rX(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(rX(WebGLRenderingContext),rX(WebGLRenderingContext.prototype)):il?rU.push(ic()?"iOS16 lockdown mode, WebGL Constants not in global":rW):rU.push(rW),rU.length||"HALF_FLOAT"in rG||(rG.HALF_FLOAT=5131)}function rX(t){for(var e in t)/^[A-Z_]/.test(e)&&(rG[e]=t[e])}function rH(t){switch(t){case tX.ALPHA:case tX.ADD:case tX.SUBTRACTION:case tX.STRONG_LIGHT:case tX.WEAK_LIGHT:return 1;case tX.SUPERPOSITION:return 2;case tX.BRIGHTNESS:return 3;case tX.MULTIPLY:return 0;default:return 1}}function rY(t,e){switch(e){case void 0:case tX.ALPHA:t.blendFunction=[rG.ONE,rG.ONE_MINUS_SRC_ALPHA,rG.ONE,rG.ONE_MINUS_SRC_ALPHA];break;case tX.ADD:t.blendFunction=[rG.ONE,rG.ONE,rG.ONE,rG.ONE];break;case tX.SUBTRACTION:t.blendFunction=[rG.ONE,rG.ONE,rG.ZERO,rG.ONE],t.blendEquation=[rG.FUNC_REVERSE_SUBTRACT,rG.FUNC_REVERSE_SUBTRACT];break;case tX.SUPERPOSITION:t.blendFunction=[rG.ONE,rG.ONE,rG.ONE,rG.ONE];break;case tX.MULTIPLY:t.blendFunction=[rG.DST_COLOR,rG.ONE_MINUS_SRC_ALPHA,rG.DST_COLOR,rG.ONE_MINUS_SRC_ALPHA];break;case tX.BRIGHTNESS:t.blendFunction=[rG.ONE,rG.ONE_MINUS_SRC_ALPHA,rG.ONE,rG.ONE_MINUS_SRC_ALPHA];break;case tX.STRONG_LIGHT:t.blendFunction=[rG.DST_COLOR,rG.DST_ALPHA,rG.ZERO,rG.ONE];break;case tX.WEAK_LIGHT:t.blendFunction=[rG.DST_COLOR,rG.ZERO,rG.ZERO,rG.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function rZ(t,e){e===tH.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rG.CW,t.cullFace=e===tH.BACK?rG.BACK:rG.FRONT)}rU.length||rj(),t.TextureLoadAction=void 0,(to=t.TextureLoadAction||(t.TextureLoadAction={}))[to.whatever=0]="whatever",to[to.clear=2]="clear",t.TextureSourceType=void 0,(ts=t.TextureSourceType||(t.TextureSourceType={}))[ts.none=0]="none",ts[ts.data=1]="data",ts[ts.image=2]="image",ts[ts.compressed=3]="compressed",ts[ts.video=4]="video",ts[ts.canvas=5]="canvas",ts[ts.framebuffer=6]="framebuffer",ts[ts.mipmaps=7]="mipmaps";var rq=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.downloadText=function(t,e,i){this.download(t,"text",e,i)},e.download=function(e,i,r,n){var a=this;if(void 0===i&&(i="json"),!this.start(e,r,n)){var o=new XMLHttpRequest,s=function(){a.finish(e,o.status,o.response)};o.responseType=i,o.addEventListener("load",function(){200==o.status||0==o.status&&t.trustXHRStatusZero?a.finish(e,200,o.response):s()}),o.addEventListener("error",s),o.open("GET",e,!0),o.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var a=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],o=a.length-1,s=n.length;o<s;o+=2)n[o].apply(null,a)},t}();rq.trustXHRStatusZero=!1;var rK=!1,rQ=!1;function rJ(t,e){return r$.apply(this,arguments)}function r$(){return(r$=eY(function(t,e){return eK(this,function(i){switch(i.label){case 0:if(!(rK||!e))return[3,2];return[4,r2(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,r2(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rK=!0,[4,r2(t)];case 6:return[2]}})})).apply(this,arguments)}function r0(t,e){return r1.apply(this,arguments)}function r1(){return(r1=eY(function(t,e){return eK(this,function(i){switch(i.label){case 0:if(!(rQ||!e))return[3,2];return[4,r2(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,r2(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rQ=!0,[4,r2(t)];case 6:return[2]}})})).apply(this,arguments)}function r2(t){return r3.apply(this,arguments)}function r3(){return(r3=eY(function(t){var e,i;return eK(this,function(r){if(e="",eZ(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else eZ(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function r4(t){return r5.apply(this,arguments)}function r5(){return(r5=eY(function(t){return eK(this,function(e){return[2,new Promise(function(e,i){new rq().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function r6(){return(r6=eY(function(t){return eK(this,function(e){return[2,new Promise(function(e,i){new rq().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function r8(t){return r9.apply(this,arguments)}function r9(){return(r9=eY(function(t){var e;return eK(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,e.autoplay=!1,id()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=!1,n=function(){r||(r=!0,o(),t(e))},a=function(){r||(r=!0,o(),i("Load video fail."))},o=function(){e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",n),e.removeEventListener("error",a)};e.addEventListener("loadeddata",n),e.addEventListener("canplay",n),e.addEventListener("error",a),e.play().catch(function(t){console.warn("Autoplay blocked:",t)})})]})})).apply(this,arguments)}function r7(t,e){return nt.apply(this,arguments)}function nt(){return(nt=eY(function(t,e){return eK(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function ne(t,e,i){return ni.apply(this,arguments)}function ni(){return(ni=eY(function(e,i,r,n){var a,o,s,u,h,l,c;return eK(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:nr(t,i)}))}))];case 1:return s=f.sent(),[2,ro({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,h=e.target,[4,Promise.all(u.map(function(t){return nr(t,i)}))];case 3:return l=f.sent(),c=n[u[0][1][0]].url,[2,ro({keepImageSource:!1},e,{mipmaps:l,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:h,bin:c,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function nr(t,e){return nn.apply(this,arguments)}function nn(){return(nn=eY(function(t,e){var i,r,n,a,o;return eK(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,r2(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var na=1,no=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+na++,i}iY(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?rG.TEXTURE_2D:i,n=e.format,a=void 0===n?rG.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),ro({minFilter:rG.NEAREST,magFilter:rG.NEAREST,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,target:r,format:rG.RGBA,internalFormat:a,type:rG.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return eY(function(){var a,o;return eK(this,function(s){switch(s.label){case 0:return[4,r2(e)];case 1:return a=s.sent(),(o=i.create(r,ro({sourceType:t.TextureSourceType.image,image:a,target:rG.TEXTURE_2D,id:iL(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return eY(function(){var a,o;return eK(this,function(s){switch(s.label){case 0:return[4,r8(e)];case 1:return a=s.sent(),(o=i.create(r,ro({sourceType:t.TextureSourceType.video,video:a,id:iL(),flipY:!0},n))).initialize(),[2,o]}})})()},rk(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(i4);function ns(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?rG.RGBA:3===o?rG.RGB:2===o?rG.LUMINANCE_ALPHA:rG.LUMINANCE,no.createWithData(t,{data:e,width:i,height:r},{type:rG.HALF_FLOAT,format:n,internalFormat:a,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE})}var nu={type:rG.UNSIGNED_BYTE,format:rG.RGBA,internalFormat:rG.RGBA,wrapS:rG.MIRRORED_REPEAT,wrapT:rG.MIRRORED_REPEAT,minFilter:rG.NEAREST,magFilter:rG.NEAREST};function nh(e){return no.create(e,ro({id:iZ.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},nu))}function nl(e){return no.create(e,ro({id:iZ.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},nu))}var nc=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){if(this.loaders.has(t)){console.warn('TextureLoader for type "'+t+'" is already registered, skipping.');return}this.loaders.set(t,e)},e.unregister=function(t){var e=this.instances.get(t);e&&(e.dispose(),this.instances.delete(t)),this.loaders.delete(t)},e.getLoader=function(t){if(this.instances.has(t))return this.instances.get(t);var e=this.loaders.get(t);if(!e)return console.error('TextureLoader for type "'+t+'" is not registered.'),null;var i=e();return this.instances.set(t,i),i},e.has=function(t){return this.loaders.has(t)},e.getRegisteredTypes=function(){return Array.from(this.loaders.keys())},e.dispose=function(){this.instances.forEach(function(t){return t.dispose()}),this.instances.clear(),this.loaders.clear()},t}()),nf=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return eY(function(){var i,r;return eK(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},i.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,a=e.url;return r===rG.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:iA(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,l=e.urls;return o?s.length>0:u===rG.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return iA(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,S,E,C,w;return eK(this,function(_){switch(_.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,h=e.mipmaps,l=e.urls,c=e.maps,!(a===rG.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=_.sent(),[2,ro({},i,{cube:f,target:rG.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:ro({},o),target:rG.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,r2(s)];case 3:return d=_.sent(),[2,ro({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:rG.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,r8(s)];case 5:return p=_.sent(),[2,ro({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,14];return[4,r4(s)];case 7:if(m=_.sent(),!(v=nc.getLoader("ktx2")))return[3,12];_.label=8;case 8:return _.trys.push([8,10,,11]),[4,v.loadFromBuffer(m)];case 9:if((y=_.sent()).sourceType===t.TextureSourceType.compressed)return[2,ro({sourceType:y.sourceType,type:y.type,target:y.target,internalFormat:y.internalFormat,format:y.format,mipmaps:y.mipmaps,minFilter:rG.LINEAR,magFilter:rG.LINEAR,sourceFrom:e},i)];return[3,11];case 10:throw g=_.sent(),Error("Failed to parse KTX2 from "+(null!=(x=null==e?void 0:e.url)?x:"buffer")+": "+(g.message||g));case 11:return[3,13];case 12:throw Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:if(n!==t.TextureSourceType.mipmaps)return[3,23];if(!u)return[3,19];return[4,r4(u)];case 15:if(b=_.sent(),S=(T=null!=a?a:rG.TEXTURE_2D)===rG.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),a!==rG.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(h.map(function(t){return r.loadMipmapImages(t,b)}))];case 16:return E=_.sent(),[3,18];case 17:E=r.loadMipmapImages(h,b),_.label=18;case 18:return[2,ro({},i,{mipmaps:E,target:T,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:S,target:T,type:t.TextureSourceType.mipmaps}})];case 19:if(!(a===rG.TEXTURE_2D||!a))return[3,21];return[4,Promise.all(l.map(function(t){return r2(t)}))];case 20:return C=_.sent(),[2,ro({},i,{mipmaps:C,target:rG.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:l.slice(),target:rG.TEXTURE_2D}})];case 21:if(a!==rG.TEXTURE_CUBE_MAP)return[3,23];return[4,Promise.all(c.map(function(t){return r.loadCubeMap(t)}))];case 22:return w=_.sent(),[2,ro({},i,{mipmaps:w,target:rG.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:c.map(function(t){return ro({},t)}),target:rG.TEXTURE_CUBE_MAP}})];case 23:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return eY(function(){return eK(this,function(i){return[2,Promise.all(t.map(function(t){return r2(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return eY(function(){return eK(this,function(e){return[2,Promise.all(t.map(function(t){return r2(t)}))]})})()},e}(),nd=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function np(t){return"object"==typeof t&&t&&void 0===t.length&&eZ(t,no)}var nm=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),o=1-n,s=r.x,u=r.y,h=r.z,l=o*s,c=o*u;return this.set(l*s+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*s,0,l*h+a*u,c*h-a*s,o*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(it.ZERO,t,it.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),0===o.lengthSquared()&&(o.z=1),o.normalize(),n.crossVectors(r,o),0===n.lengthSquared()&&(1===Math.abs(r.z)?o.x+=1e-4:o.z+=1e-4,o.normalize(),n.crossVectors(r,o)),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[4]=a.x,s[8]=o.x,s[1]=n.y,s[5]=a.y,s[9]=o.y,s[2]=n.z,s[6]=a.z,s[10]=o.z,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[4],s=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],S=r[4],E=r[8],C=r[12],w=r[1],_=r[5],M=r[9],A=r[13],P=r[2],I=r[6],R=r[10],O=r[14],V=r[3],N=r[7],F=r[11],L=r[15];return n[0]=a*T+o*w+s*P+u*V,n[4]=a*S+o*_+s*I+u*N,n[8]=a*E+o*M+s*R+u*F,n[12]=a*C+o*A+s*O+u*L,n[1]=h*T+l*w+c*P+f*V,n[5]=h*S+l*_+c*I+f*N,n[9]=h*E+l*M+c*R+f*F,n[13]=h*C+l*A+c*O+f*L,n[2]=d*T+p*w+m*P+v*V,n[6]=d*S+p*_+m*I+v*N,n[10]=d*E+p*M+m*R+v*F,n[14]=d*C+p*A+m*O+v*L,n[3]=y*T+g*w+x*P+b*V,n[7]=y*S+g*_+x*I+b*N,n[11]=y*E+g*M+x*R+b*F,n[15]=y*C+g*A+x*O+b*L,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],o=t[5],s=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*s*l-r*u*l-n*o*c+i*u*c+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*c+n*a*c-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*l-e*o*f-n*a*l+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*l+e*o*c+r*a*l-i*a*c+i*s*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],o=t[5],s=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*s*f-o*m*f-l*s*v+o*c*v,g=d*c*u-h*m*u-d*s*f+a*m*f+h*s*v-a*c*v,x=h*p*u-d*l*u+d*o*f-a*p*f-h*o*v+a*l*v,b=d*l*s-h*p*s-d*o*c+a*p*c+h*o*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/T;return t[0]=y*S,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*S,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*S,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*S,t[4]=g*S,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*S,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*S,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*S,t[8]=x*S,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*S,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*S,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*S,t[12]=b*S,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*S,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*S,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*S,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=it.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,S=u*d,E=u*p,C=i.x,w=i.y,_=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+E)*C,n[2]=(y-S)*C,n[3]=0,n[4]=(v-E)*w,n[5]=(1-(m+b))*w,n[6]=(x+T)*w,n[7]=0,n[8]=(y+S)*_,n[9]=(x-T)*_,n[10]=(1-(m+g))*_,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,n[15]=1,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();if(0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14],r.x=o,r.y=s,r.z=u,1e-8>Math.abs(o)||1e-8>Math.abs(s)||1e-8>Math.abs(u))return i.set(0,0,0,1),this;var h=t.tempMat0;h.copyFrom(this);var l=1/o,c=1/s,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),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.extractRotation=function(e){var i=t.tempVec0,r=e.elements,n=this.elements,a=1/i.set(r[0],r[1],r[2]).length(),o=1/i.set(r[4],r[5],r[6]).length(),s=1/i.set(r[8],r[9],r[10]).length();return n[0]=r[0]*a,n[1]=r[1]*a,n[2]=r[2]*a,n[3]=0,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[7]=0,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},e.setPosition=function(t){return this.elements[12]=t.x,this.elements[13]=t.y,this.elements[14]=t.z,this},e.getTransform=function(){var t=new it,e=new rh,i=new it;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),h=-(e+t)*o,l=-(i+r)*s,c=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!e6(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return new t().perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,o,l,p,r,s,c,m,n,u,f,v)},t}();nm.IDENTITY=new nm(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),nm.ZERO=new nm(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),nm.tempVec0=new it,nm.tempVec1=new it,nm.tempVec2=new it,nm.tempMat0=new nm,(tu=eO||(eO={}))[tu.XYZ=0]="XYZ",tu[tu.XZY=1]="XZY",tu[tu.YXZ=2]="YXZ",tu[tu.YZX=3]="YZX",tu[tu.ZXY=4]="ZXY",tu[tu.ZYX=5]="ZYX";var nv=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case eO.XYZ:this.y=Math.asin(e9(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case eO.YXZ:this.x=Math.asin(-e9(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case eO.ZXY:this.x=Math.asin(e9(l,-1,1)),.9999999>Math.abs(l)?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case eO.ZYX:this.y=Math.asin(-e9(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case eO.YZX:this.z=Math.asin(e9(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case eO.XZY:this.z=Math.asin(-e9(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(l,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=e5,this.y*=e5,this.z*=e5,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,o;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new rh;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,a=Math.cos(e*e4*.5),o=Math.cos(i*e4*.5),s=Math.cos(r*e4*.5),u=Math.sin(e*e4*.5),h=Math.sin(i*e4*.5),l=Math.sin(r*e4*.5);switch(n){case eO.XYZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eO.YXZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eO.ZXY:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eO.ZYX:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eO.YZX:t.set(u*o*s+a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s-u*h*l);break;case eO.XZY:t.set(u*o*s-a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s+u*h*l);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,a=this.order,o=Math.cos(i*e4),s=Math.sin(i*e4),u=Math.cos(r*e4),h=Math.sin(r*e4),l=Math.cos(n*e4),c=Math.sin(n*e4);if(a===eO.XYZ){var f=o*l,d=o*c,p=s*l,m=s*c;e[0]=u*l,e[4]=-u*c,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-s*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=o*u}else if(a===eO.YXZ){var v=u*l,y=u*c,g=h*l,x=h*c;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*c,e[5]=o*l,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===eO.ZXY){var b=u*l,T=u*c,S=h*l,E=h*c;e[0]=b-E*s,e[4]=-o*c,e[8]=S+T*s,e[1]=T+S*s,e[5]=o*l,e[9]=E-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===eO.ZYX){var C=o*l,w=o*c,_=s*l,M=s*c;e[0]=u*l,e[4]=_*h-w,e[8]=C*h+M,e[1]=u*c,e[5]=M*h+C,e[9]=w*h-_,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===eO.YZX){var A=o*u,P=o*h,I=s*u,R=s*h;e[0]=u*l,e[4]=R-A*c,e[8]=I*c+P,e[1]=c,e[5]=o*l,e[9]=-s*l,e[2]=-h*l,e[6]=P*c+I,e[10]=A-R*c}else if(a===eO.XZY){var O=o*u,V=o*h,N=s*u,F=s*h;e[0]=u*l,e[4]=-c,e[8]=h*l,e[1]=O*c+F,e[5]=o*l,e[9]=V*c-N,e[2]=N*c-V,e[6]=s*l,e[10]=F*c+O}else console.error("toMatrix4: Invalid order "+a);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();nv.DEFAULT_ORDER=eO.ZYX,nv.tempQuat0=new rh,nv.tempMat0=new nm;var ny=function(){function t(t,e,i,r,n,a,o,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=o,h[1]=e,h[4]=n,h[7]=s,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=o,h[5]=s,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,o=i+i,s=r+r,u=e*a,h=e*o,l=e*s,c=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],o=r[6],s=r[1],u=r[4],h=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*h,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[3],s=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],S=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*S,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*S,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*S,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8];return e*(a*h-u*o)+n*(u*r-i*h)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8],l=h*a-u*o,c=u*r-h*i,f=o*i-a*r,d=e*l+n*c+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=c*p,t[4]=(h*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!e6(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h){return new t(e,n,s,i,a,u,r,o,h)},t}(),ng=function(){function t(t,e){void 0===t&&(t=it.ZERO),void 0===e&&(e=it.X),this.origin=new it,this.direction=new it,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new it;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.distanceToPlane=function(t){var e=t.normal,i=e.dot(this.direction);if(0===i)return e.dot(this.origin)+t.distance===0?0:null;var r=-(this.origin.dot(e)+t.distance)/i;return r>=0?r:null},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,S=b.y,E=b.z,C=1/d,w=1/p,_=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),w>=0?(n=(g-l)*w,a=(S-l)*w):(n=(S-l)*w,a=(g-l)*w),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),_>=0?(o=(x-c)*_,s=(E-c)*_):(o=(E-c)*_,s=(x-c)*_),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new it).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){if(!(e.radius<0)){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),h=t.tempVec1.subtractVectors(s,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();ng.tempVec0=new it,ng.tempVec1=new it,ng.tempVec2=new it,ng.tempVec3=new it;var nx=function(){function t(t,e){void 0===t&&(t=new it(1/0,1/0,1/0)),void 0===e&&(e=new it(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var h=t[s],l=t[s+1],c=t[s+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>o&&(o=c)}return this.min.set(e,i,r),this.max.set(n,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new it),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new it),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new it),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(e){var i=t.tempVec0;return this.clampPoint(e.center,i),i.distanceSquared(e.center)<=e.radius*e.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new it),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new it),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new it),this.isEmpty())return[];var i=[];return i[0]=new it(this.min.x,this.min.y,this.min.z),i[1]=new it(this.min.x,this.min.y,this.max.z),i[2]=new it(this.min.x,this.max.y,this.min.z),i[3]=new it(this.min.x,this.max.y,this.max.z),i[4]=new it(this.max.x,this.min.y,this.min.z),i[5]=new it(this.max.x,this.min.y,this.max.z),i[6]=new it(this.max.x,this.max.y,this.min.z),i[7]=new it(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(t.tempVec0).length(),e)},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}();nx.tempVec0=new it;var nb=function(){function t(t,e){void 0===t&&(t=it.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(e,i){var r=this.center;void 0!==i?r.copyFrom(i):t.tempBox.setFromPoints(e).getCenter(r);for(var n=0,a=0;a<e.length;a++)n=Math.max(n,r.distanceSquared(e[a]));return this.radius=Math.sqrt(n),this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new it),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new nx),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(e){if(this.isEmpty())return this.set(e,0);var i=t.tempVec0.subtractVectors(e,this.center),r=i.lengthSquared();if(r>this.radius*this.radius){var n=Math.sqrt(r),a=(n-this.radius)*.5;this.center.add(i.multiply(a/n)),this.radius+=a}return this},e.union=function(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copyFrom(e);if(this.center.equals(e.center))this.radius=Math.max(this.radius,e.radius);else{var i=t.tempVec0,r=t.tempVec1.subtractVectors(e.center,this.center).setLength(e.radius);this.expandByPoint(i.copyFrom(e.center).add(r)),this.expandByPoint(i.copyFrom(e.center).subtract(r))}return this},e.intersect=function(t){if(this.isEmpty()||t.isEmpty())return this.makeEmpty();var e=this.center.distance(t.center);return e>this.radius+t.radius?this.makeEmpty():this.radius>=e+t.radius?this.copyFrom(t):t.radius>=e+this.radius?this:this.radius<=t.radius?this:this.copyFrom(t)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}();nb.tempBox=new nx,nb.tempVec0=new it,nb.tempVec1=new it;var nT=Object.freeze({__proto__:null,get EulerOrder(){return eO},Euler:nv,Quaternion:rh,Vector2:e7,Vector3:it,Vector4:ie,Matrix3:ny,Matrix4:nm,Ray:ng,PI2:2*Math.PI,DEG2RAD:e4,RAD2DEG:e5,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:e6,damp:function(t,e,i,r){return e8(t,e,1-Math.exp(-i*r))},lerp:e8,degToRad:function(t){return t*e4},radToDeg:function(t){return t*e5},clamp:e9,Color:ii,Box3:nx,Sphere:nb});t.ShaderCompileResultStatus=void 0,(th=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[th.noShader=0]="noShader",th[th.success=1]="success",th[th.fail=2]="fail",th[th.compiling=3]="compiling",t.GLSLVersion=void 0,(tl=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",tl.GLSL3="300 es";var nS=function(t){function e(e,i,r){var n;return(n=t.call(this,e)||this).source=i,n.key=r,n}return iY(e,t),e.prototype.initialize=function(){},e}(i4);t.Shader=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=iQ(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(i4),t.Shader=eq([i1(eS.Shader)],t.Shader);var nE=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[rG.ONE,rG.ONE_MINUS_SRC_ALPHA,rG.ONE,rG.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[rG.FUNC_ADD,rG.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=rG.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[rG.ALWAYS,rG.ALWAYS],this.stencilOpFail=[rG.KEEP,rG.KEEP],this.stencilOpZFail=[rG.KEEP,rG.KEEP],this.stencilOpZPass=[rG.KEEP,rG.KEEP],this.culling=!1,this.frontFace=rG.CCW,this.cullFace=rG.FRONT},e.apply=function(t){if(t.setSampleAlphaToCoverage(this.sampleAlphaToCoverage),t.setBlending(this.blending),t.setDepthTest(this.depthTest),t.setStencilTest(this.stencilTest),t.setCulling(this.culling),t.setPolygonOffsetFill(this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(rG.BACK,this.stencilMask[1]),t.stencilMaskSeparate(rG.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(rG.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(rG.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(rG.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(rG.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}();t.MaterialRenderType=void 0,(tc=t.MaterialRenderType||(t.MaterialRenderType={}))[tc.normal=0]="normal",tc[tc.transformFeedback=1]="transformFeedback";var nC=1,nw=function(e){function i(i,r){var n;if((n=e.call(this,i)||this).stringTags={},n.enabledMacros={},n.destroyed=!1,n.initialized=!1,n.shaderDirty=!0,n.floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirty=!0,n.macrosDirty=!0,n.materialState=new nE,r){var a=r.name,o=void 0===a?"Material"+nC++:a,s=r.renderType,u=r.shader;n.name=o,n.renderType=void 0===s?0:s,n.shaderSource=u,n.props=r,n._shader=new t.Shader(i),n._shader.shaderData=ro({},r.shader,{id:iL(),dataType:eS.Shader})}else n.name="Material"+nC++,n.renderType=0;return n}iY(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!iI(i.initialize)){i_.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this._shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.materialState.apply(t)},r.use=function(t,e){var i=t.engine,r=this.shaderVariant;if(r.bind(),this.setupStates(i),e){for(var n,a,o=iQ(e.uniforms);!(a=o()).done;)n=a.value,this.checkUniform(n);for(var s,u=iQ(e.samplers);!(s=u()).done;)n=s.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=iQ(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=iQ(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;iS(r);var n=i.create(r,e);return n.materialState=Object.assign(new nE,n.materialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new ie(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],a=0;a<t.matrixArrays[e].length;a+=16){for(var o=nm.fromIdentity(),s=0;s<16;s++)o.elements[s]=t.matrixArrays[e][a+s];n.push(o)}this.setMatrixArray(e,n)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=ro({},t);void 0!==t.stringTags.RenderType&&(this.blending=t.stringTags.RenderType===t1.Transparent),void 0!==t.floats.ZTest&&(this.depthTest=0!==t.floats.ZTest),void 0!==t.floats.ZWrite&&(this.depthMask=0!==t.floats.ZWrite);var a=t.stringTags.RenderFace;for(i in a===t2.Front?(this.culling=!0,this.cullFace=rG.BACK):a===t2.Back?(this.culling=!0,this.cullFace=rG.FRONT):this.culling=!1,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var o=n.vector4s[i];this.setVector4(i,new ie(o.x,o.y,o.z,o.w))}for(i in n.colors){var s=n.colors[i];this.setColor(i,new ii(s.r,s.g,s.b,s.a))}for(i in n.textures){var u=n.textures[i],h=this.engine.findObject(u.texture);this.setTexture(i,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(i+"_ST",new ie(c.x,c.y,l.x,l.y))}if(t.shader){var f=this.engine.findObject(t.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.definition;for(var e in this._shader&&(t.shader=this._shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=eS.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var o=t.textures[a],s=this.getVector4(a+"_ST");s&&(o.scale={x:s.x,y:s.y},o.offset={x:s.z,y:s.w},delete t.vector4s[a+"_ST"])}return t},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(){var t;this.destroyed||(null==(t=this.shaderVariant)||t.dispose(),this.textures={},this.shaderSource=null,this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=iF,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),e.prototype.dispose.call(this))},rk(i,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",get:function(){return this.materialState.blending},set:function(t){void 0!==t&&this.materialState.setBlending(t)}},{key:"blendColor",get:function(){return this.materialState.blendColor},set:function(t){t&&this.materialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.materialState.blendFunctionParameters},set:function(t){t&&this.materialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.materialState.blendEquationParameters},set:function(t){t&&this.materialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.materialState.depthTest},set:function(t){void 0!==t&&this.materialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.materialState.depthMask},set:function(t){void 0!==t&&this.materialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.materialState.depthRange},set:function(t){t&&this.materialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.materialState.depthFunc},set:function(t){void 0!==t&&this.materialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.materialState.polygonOffsetFill},set:function(t){void 0!==t&&this.materialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.materialState.polygonOffset},set:function(t){t&&this.materialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.materialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.materialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.materialState.colorMask[0]},set:function(t){this.materialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.materialState.stencilTest},set:function(t){void 0!==t&&this.materialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.materialState.stencilMask},set:function(t){t&&this.materialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.materialState.stencilRef},set:function(t){t&&this.materialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.materialState.stencilFunc},set:function(t){t&&this.materialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.materialState.stencilOpFail},set:function(t){t&&this.materialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.materialState.stencilOpZFail},set:function(t){t&&this.materialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.materialState.stencilOpZPass},set:function(t){t&&this.materialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.materialState.culling},set:function(t){void 0!==t&&this.materialState.setCulling(t)}},{key:"frontFace",get:function(){return this.materialState.frontFace},set:function(t){void 0!==t&&this.materialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.materialState.cullFace},set:function(t){void 0!==t&&this.materialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(i4);nw.create=function(t,e){return new nw(t,e)};var n_=function(){function e(){this.alphaMaskEnabled=!1,this.isMask=!1,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpFail=[0,0],this.prevStencilOpZFail=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.references,a=void 0===n?[]:n,o=e.alphaMaskEnabled;if(this.alphaMaskEnabled=void 0!==o&&o,this.isMask=r,this.maskReferences=[],!r&&0!==a.length)for(var s,u=new Map,h=iQ(a);!(s=h()).done;){var l,c=s.value,f=c.mask;if(f){var d=t.findObject(f);if(!d){console.warn("Mask reference not found: "+JSON.stringify(f)+". Skipping.");continue}var p=null!=(l=c.inverted)&&l,m=u.get(d);if(void 0!==m){m!==p&&console.warn("Same maskable referenced with conflicting inverted flags; keeping the first occurrence.");continue}if(this.maskReferences.length>=254){console.warn("Maximum of 254 mask references exceeded. Additional masks will be ignored.");break}u.set(d,p),this.maskReferences.push({maskable:d,inverted:p})}}},i.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some(function(e){return e.maskable===t})){if(this.maskReferences.length>=254){console.warn("Maximum of 254 mask references exceeded. Additional masks will be ignored.");return}this.maskReferences.push({maskable:t,inverted:e})}},i.removeMaskReference=function(t){var e=this.maskReferences.findIndex(function(e){return e.maskable===t});-1!==e&&this.maskReferences.splice(e,1)},i.clearMaskReferences=function(){this.maskReferences=[]},i.getMaskReferences=function(){return this.maskReferences.slice()},i.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=[],a=iQ(r);!(i=a()).done;){var o=i.value,s=this.maskReferences.length;this.addMaskReference(o,!1),this.maskReferences.length>s&&n.push(o)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var u,h=[],l=[],c=iQ(this.maskReferences);!(u=c()).done;){var f=u.value;f.inverted?l.push(f):h.push(f)}for(var d=0;d<h.length;d++)h[d].maskable.drawStencilMask(d);for(var p,m=h.length,v=iQ(l);!(p=v()).done;)p.value.maskable.drawStencilMask(m);this.expectedStencilValue=m}for(var y,g=iQ(e.materials);!(y=g()).done;){var x=y.value;this.setupMaskedMaterial(x)}for(var b,T=iQ(n);!(b=T()).done;){var S=b.value;this.removeMaskReference(S)}},i.drawGeometryMask=function(t,e,i,r,n,a){void 0===a&&(a=0);var o=r.colorMask,s=r.stencilTest;this.copyStencilArrayValue(this.prevStencilFunc,r.stencilFunc),this.copyStencilArrayValue(this.prevStencilOpFail,r.stencilOpFail),this.copyStencilArrayValue(this.prevStencilOpZFail,r.stencilOpZFail),this.copyStencilArrayValue(this.prevStencilOpZPass,r.stencilOpZPass),this.copyStencilArrayValue(this.prevStencilRef,r.stencilRef),this.copyStencilArrayValue(this.prevStencilMask,r.stencilMask),this.setupMaskMaterial(r,n),t.drawGeometry(e,i,r,a),r.colorMask=o,r.stencilTest=s,r.stencilFunc=this.prevStencilFunc,r.stencilOpFail=this.prevStencilOpFail,r.stencilOpZFail=this.prevStencilOpZFail,r.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},i.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[rG.EQUAL,rG.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpFail=[rG.KEEP,rG.KEEP],t.stencilOpZFail=[rG.KEEP,rG.KEEP],t.stencilOpZPass=[rG.INCR,rG.INCR],t.colorMask=!1},i.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[rG.EQUAL,rG.EQUAL],t.stencilOpZPass=[rG.KEEP,rG.KEEP]):t.stencilTest=!1},i.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},rk(e,[{key:"maskable",get:function(){return this.maskReferences.length>0?this.maskReferences[0].maskable:null},set:function(t){this.maskReferences=[],t&&this.maskReferences.push({maskable:t,inverted:!1})}}]),e}();t.BufferUsage=void 0,(tf=t.BufferUsage||(t.BufferUsage={}))[tf.Stream=35040]="Stream",tf[tf.Static=35044]="Static",tf[tf.Dynamic=35048]="Dynamic",t.BufferDataType=void 0,(td=t.BufferDataType||(t.BufferDataType={}))[td.Byte=5120]="Byte",td[td.UnsignedByte=5121]="UnsignedByte",td[td.Short=5122]="Short",td[td.UnsignedShort=5123]="UnsignedShort",td[td.Int=5124]="Int",td[td.UnsignedInt=5125]="UnsignedInt",td[td.Float=5126]="Float";var nM=function(){function t(){this.references=0,this.capacity=0,this.is32Bits=!1}return rk(t,[{key:"underlyingResource",get:function(){return null}}]),t}();function nA(t){switch(t){case 5120:case 5121:return 1;case 5122:case 5123:return 2;case 5124:case 5125:case 5126:return 4;default:return 0}}function nP(t){return eZ(t,Int8Array)?5120:eZ(t,Uint8Array)?5121:eZ(t,Int16Array)?5122:eZ(t,Uint16Array)?5123:eZ(t,Int32Array)?5124:eZ(t,Uint32Array)?5125:5126}function nI(t){return Array.isArray(t)?t.length*Float32Array.BYTES_PER_ELEMENT:t.byteLength}function nR(t,e){switch(t){case 5120:return new Int8Array(e);case 5121:return new Uint8Array(e);case 5122:return new Int16Array(e);case 5123:return new Uint16Array(e);case 5124:return new Int32Array(e);case 5125:return new Uint32Array(e);default:return new Float32Array(e)}}var nO=function(){function e(t,e,i,r,n,a,o,s,u){void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===o&&(o=!1),this.engine=t,this.isAlreadyOwned=!1,this._isDisposed=!1,this.updatable=i,this.instanced=a,this.divisor=s||1,this.label=u,this.byteStride=o?r:r*Float32Array.BYTES_PER_ELEMENT,eZ(e,nM)?this.buffer=e:this.data=e,n||this.create()}var i=e.prototype;return i.isUpdatable=function(){return this.updatable},i.getData=function(){return this.data},i.getBuffer=function(){return this.buffer},i.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},i.createVertexBuffer=function(t,e,i,r,n,a,o){void 0===a&&(a=!1);var s=a?e:e*Float32Array.BYTES_PER_ELEMENT,u=r?a?r:r*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new nV(this.engine,this,t,{size:i,stride:u,offset:s,instanced:void 0===n?this.instanced:n,useBytes:!0,divisor:null!=o?o:this.divisor})},i.create=function(t){if((t||!this.buffer)&&(t=null!=t?t:this.data)){var e=this.getDataBufferOptions(t);this.buffer?this.updatable&&(this.engine.updateDynamicVertexBuffer(this.buffer,t),this.data=t):(this.buffer=this.updatable?this.engine.createDynamicVertexBuffer(t,e):this.engine.createVertexBuffer(t,e),this.updatable&&(this.data=t))}},i.update=function(t){this.create(t)},i.updateDirectly=function(t,e,i,r){void 0===r&&(r=!1),this.buffer&&this.updatable&&(this.engine.updateDynamicVertexBuffer(this.buffer,t,r?e:e*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),0===e&&void 0===i?this.data=t:this.data=void 0)},i.rebuild=function(){if(!this.data){if(!this.buffer)return;var t=this.buffer.capacity;if(t>0){var e=this.getDataBufferOptions();this.buffer=this.updatable?this.engine.createDynamicVertexBuffer(t,e):this.engine.createVertexBuffer(t,e)}else this.buffer=void 0;return}this.buffer=void 0,this.create(this.data)},i.increaseReferences=function(){if(this.buffer){if(!this.isAlreadyOwned){this.isAlreadyOwned=!0;return}this.buffer.references++}},i.dispose=function(){this.buffer&&this.engine.releaseBuffer(this.buffer)&&(this.data=void 0,this.buffer=void 0,this._isDisposed=!0)},i.getDataBufferOptions=function(e){return{usage:this.updatable?t.BufferUsage.Dynamic:t.BufferUsage.Static,type:e?nP(e):t.BufferDataType.Float,byteStride:this.byteStride,instanceDivisor:this.instanced?this.divisor:0,label:this.label}},rk(e,[{key:"isDisposed",get:function(){return this._isDisposed}},{key:"capacity",get:function(){var t,e;return null!=(e=null==(t=this.buffer)?void 0:t.capacity)?e:this.data?nI(this.data):0}}]),e}(),nV=function(){function t(e,i,r,n){void 0===n&&(n={}),this._isDisposed=!1,this.engine=e,this.kind=r,eZ(i,nO)?(this.buffer=i,this.ownsBuffer=null!=(a=n.takeBufferOwnership)&&a):(this.buffer=new nO(e,i,null!=(o=n.updatable)&&o,null!=(s=n.stride)?s:0,null!=(u=n.postponeInternalCreation)&&u,null!=(h=n.instanced)&&h,null!=(l=n.useBytes)&&l,n.divisor,n.label),this.ownsBuffer=!0);var a,o,s,u,h,l,c,f,d,p,m,v,y,g=this.getData();this.type=null!=(c=n.type)?c:g?nP(g):t.FLOAT;var x=nA(this.type),b=null!=(f=n.useBytes)&&f,T=null!=(d=n.stride)?d:0,S=null!=(p=n.offset)?p:0;b?(this.size=n.size||(T?T/x:0),this.byteStride=T||this.buffer.byteStride||this.size*x,this.byteOffset=S):(this.size=n.size||T,this.byteStride=T?T*x:this.buffer.byteStride||this.size*x,this.byteOffset=S*x),this.normalized=null!=(m=n.normalized)&&m,this.instanced=null!=(v=n.instanced)&&v,this._instanceDivisor=this.instanced?null!=(y=n.divisor)?y:1:0}var e=t.prototype;return e.getKind=function(){return this.kind},e.isUpdatable=function(){return this.buffer.isUpdatable()},e.getData=function(){return this.buffer.getData()},e.getBuffer=function(){return this.buffer.getBuffer()},e.getWrapperBuffer=function(){return this.buffer},e.getStrideSize=function(){return this.byteStride/nA(this.type)},e.getOffset=function(){return this.byteOffset/nA(this.type)},e.getSize=function(t){return void 0===t&&(t=!1),t?this.size*nA(this.type):this.size},e.getIsInstanced=function(){return this.instanced},e.getInstanceDivisor=function(){return this._instanceDivisor},e.create=function(t){this.buffer.create(t)},e.update=function(t){this.buffer.update(t)},e.updateDirectly=function(t,e,i){void 0===i&&(i=!1),this.buffer.updateDirectly(t,e,void 0,i)},e.rebuild=function(){this.buffer.rebuild()},e.dispose=function(){this.ownsBuffer&&this.buffer.dispose(),this._isDisposed=!0},rk(t,[{key:"isDisposed",get:function(){return this._isDisposed}},{key:"instanceDivisor",get:function(){return this._instanceDivisor},set:function(t){this._instanceDivisor=t,this.instanced=0!==t}}]),t}();nV.PositionKind="aPos",nV.NormalKind="aNormal",nV.TangentKind="aTangent",nV.UVKind="aUV",nV.UV2Kind="aUV2",nV.UV3Kind="aUV3",nV.UV4Kind="aUV4",nV.UV5Kind="aUV5",nV.UV6Kind="aUV6",nV.ColorKind="aColor",nV.JointsKind="aJoints",nV.WeightsKind="aWeights",nV.BYTE=t.BufferDataType.Byte,nV.UNSIGNED_BYTE=t.BufferDataType.UnsignedByte,nV.SHORT=t.BufferDataType.Short,nV.UNSIGNED_SHORT=t.BufferDataType.UnsignedShort,nV.INT=t.BufferDataType.Int,nV.UNSIGNED_INT=t.BufferDataType.UnsignedInt,nV.FLOAT=t.BufferDataType.Float,t.HitTestType=void 0,(tp=t.HitTestType||(t.HitTestType={}))[tp.triangle=1]="triangle",tp[tp.box=2]="box",tp[tp.sphere=3]="sphere",tp[tp.custom=4]="custom";var nN=function(){this.position=new e7,this.delta=new e7,this.pointerCurrentRaycast=new nF},nF=function(){this.point=null,this.item=null},nL=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new it),this.vectorsWorld.push(new it);for(var n=0;n<3;n++)this.directions.push(new it);this.minimum=new it,this.maximum=new it,this.minimumWorld=new it,this.maximumWorld=new it,this.center=new it,this.centerWorld=new it,this.extendSize=new it,this.extendSizeWorld=new it,this.worldMatrix=i||nm.fromIdentity(),this.reConstruct(t,e,i)}var e=t.prototype;return e.reConstruct=function(e,i,r){var n=e.x,a=e.y,o=e.z,s=i.x,u=i.y,h=i.z;this.minimum.set(n,a,o),this.maximum.set(s,u,h),this.vectors[0].set(n,a,o),this.vectors[1].set(s,u,h),this.vectors[2].set(s,a,o),this.vectors[3].set(n,u,o),this.vectors[4].set(n,a,h),this.vectors[5].set(s,u,o),this.vectors[6].set(n,u,h),this.vectors[7].set(s,a,h);var l=t.tempVector0,c=t.tempVector1;l.copyFrom(i).add(e),this.center.copyFrom(l).scale(.5),c.copyFrom(i).subtract(e),this.extendSize.copyFrom(c).scale(.5),this.worldMatrix=r||nm.fromIdentity(),this.update(this.worldMatrix)},e.update=function(e){var i=this.minimumWorld,r=this.maximumWorld,n=this.vectorsWorld,a=this.vectors;if(e.isIdentity()){i.copyFrom(this.minimum),r.copyFrom(this.maximum);for(var o=0;o<8;o++)n[o].copyFrom(a[o]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var s=0;s<8;s++){e.transformPoint(a[s],n[s]);var u=n[s];i.x=Math.min(i.x,u.x),i.y=Math.min(i.y,u.y),i.z=Math.min(i.z,u.z),r.x=Math.max(r.x,u.x),r.y=Math.max(r.y,u.y),r.z=Math.max(r.z,u.z)}var h=t.tempVector0,l=t.tempVector1;h.copyFrom(r).subtract(i),this.extendSizeWorld.copyFrom(h).scale(.5),l.copyFrom(r).add(i),this.centerWorld.copyFrom(l).scale(.5)}var c=e.elements;this.directions[0].set(c[0],c[1],c[2]),this.directions[1].set(c[4],c[5],c[6]),this.directions[2].set(c[8],c[9],c[10]),this.worldMatrix=e},e.scale=function(e){var i=t.tempVector0;i.copyFrom(this.maximum).subtract(this.minimum);var r=i.length();i.scale(1/r),i.scale(r*e*.5);var n=t.tempVector1,a=t.tempVector2;return n.copyFrom(this.center).subtract(i),a.copyFrom(this.center).add(i),this.reConstruct(n,a,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld;return!(i.x-t.x<-.000001)&&!(-.000001>t.x-e.x)&&!(i.y-t.y<-.000001)&&!(-.000001>t.y-e.y)&&!(i.z-t.z<-.000001)&&!(-.000001>t.z-e.z)},e.intersectsBox=function(t){return this.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.intersectsMinMax=function(t,e){var i=this.minimumWorld,r=this.maximumWorld;return!(r.x<t.x)&&!(i.x>e.x)&&!(r.y<t.y)&&!(i.y>e.y)&&!(r.z<t.z)&&!(i.z>e.z)},t.intersects=function(t,e){return t.intersectsMinMax(e.minimumWorld,e.maximumWorld)},t}();nL.tempVector0=new it,nL.tempVector1=new it,nL.tempVector2=new it;var nD=function(){function e(){this.boundingBox=new nL(new it,new it),this.triangles=[],this.worldMatrix=new nm,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var o=3*e[a],s=3*e[a+1],u=3*e[a+2],h={x:t[o],y:t[o+1],z:t[o+2]},l={x:t[s],y:t[s+1],z:t[s+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var i=e.prototype;return i.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},i.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},i.getBoundingBoxTriangle=function(e){for(var i,r=-Number.MAX_VALUE,n=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=Number.MAX_VALUE,s=iQ(this.boundingBoxTriangle.area);!(i=s()).done;){var u=i.value;r=Math.max(u.p0.x,u.p1.x,u.p2.x,r),n=Math.max(u.p0.y,u.p1.y,u.p2.y,n),a=Math.min(u.p0.x,u.p1.x,u.p2.x,a),o=Math.min(u.p0.y,u.p1.y,u.p2.y,o)}var h=[],l=new it(a,n,0),c=new it(r,n,0),f=new it(r,o,0),d=new it(a,o,0);return h.push({p0:l,p1:c,p2:f}),h.push({p0:l,p1:f,p2:d}),this.applyWorldMatrix(h),{type:t.HitTestType.triangle,area:h}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,n=[],a=iQ(this.triangles);!(r=a()).done;){var o=r.value;n.push({p0:o.p0,p1:o.p1,p2:o.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxTriangle={type:t.HitTestType.triangle,area:n}},i.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData(nV.PositionKind),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=iQ(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount){var s=e.BYTES_PER_ELEMENT,u=o.offset/s,h=u+o.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new it),t.p1=e.worldMatrix.transformPoint(t.p1,new it),t.p2=e.worldMatrix.transformPoint(t.p2,new it)}),t},e}(),nk=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e.frameClipMasks=[],e.maskManager=new n_,e._priority=0,e.boundingBoxInfo=new nD,e}iY(e,t);var i=e.prototype;return i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},i.onParentChanged=function(){this.frameClipMasks=[]},i.getBoundingBoxInfo=function(){return this.boundingBoxInfo},i.render=function(t){},rk(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(rB);eq([i3(void 0,void 0)],nk.prototype,"materials",void 0),eq([i3(void 0,void 0)],nk.prototype,"_priority",void 0);var nB="editor",nz={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b","Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT"},nU=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}},nG=new rh,nW=new it,nj=new it,nX=1,nH=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new it(0,0,0),this.quat=new rh(0,0,0,1),this.rotation=new nv(0,0,0),this.scale=new it(1,1,1),this.anchor=new it(0,0,0),this.size=new e7(1,1),this.children=[],this.worldMatrix=nm.fromIdentity(),this.localMatrix=nm.fromIdentity(),this.localMatrix2D=ny.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix2D:!1,worldMatrix:!1,worldTRS:!1},this.worldTRSCache={position:new it(0,0,0),quat:new rh(0,0,0,1),scale:new it(1,1,1)},this.eventEmitter=new nU,this.name="transform_"+nX++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.on=function(t,e,i){this.eventEmitter.on(t,e,i)},e.off=function(t,e){this.eventEmitter.off(t,e)},e.onParentTransformChanged=function(t,e){},e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(eZ(i,it)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)eZ(o,rh)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var h=e?-1:1;eZ(r,nv)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(eZ(n,it)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(eZ(u,e7)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){e1(this.children,t)},e.removeChild=function(t){e2(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new nv)},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.worldMatrix=!0,this.dirtyFlags.localMatrix2D=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix2D=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getMatrix2D=function(){var t,e,i;return this.updateLocalMatrix(),this.dirtyFlags.localMatrix2D&&(t=this.localMatrix2D,e=this.localMatrix.elements,(i=t.elements)[0]=e[0],i[1]=e[1],i[2]=0,i[3]=e[4],i[4]=e[5],i[5]=0,i[6]=e[12],i[7]=e[13],i[8]=1,this.dirtyFlags.localMatrix2D=!1),this.localMatrix2D},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix()),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return this.dirtyFlags.worldMatrix&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldTRS=!0,this.dirtyFlags.worldMatrix=!1),this.worldMatrix},e.getWorldScale=function(){return this.updateTRSCache(),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.setWorldPosition=function(t,e,i){var r=this.getParentMatrix();r?(nW.set(0,0,0),nG.set(0,0,0,1),nj.set(1,1,1),r.decompose(nW,nG,nj),nW.set(t-nW.x,e-nW.y,i-nW.z),nG.invert(),nW.applyQuaternion(nG),nW.x=0!==nj.x?nW.x/nj.x:0,nW.y=0!==nj.y?nW.y/nj.y:0,nW.z=0!==nj.z?nW.z/nj.z:0,this.setPosition(nW.x,nW.y,nW.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new nv)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),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.worldMatrix=!0,this.dirtyFlags.localMatrix2D=!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={};e.position=new it().copyFrom(t.position),t.quat?e.quat=new rh(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new nv(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=new it().copyFrom(t.scale),t.size&&(e.size=new e7().copyFrom(t.size)),t.anchor&&(e.anchor=new e7().copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldTRS){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldTRS=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.worldMatrixDirty=!0}),this.eventEmitter.emit("changed",this)},t.getRotation=function(t,e){var i=nG.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},rk(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){if(this.parent!==t&&this!==t){var e=this.parent;this.parent&&this.parent.removeChild(this),t&&t.addChild(this),this.parent=t,this.worldMatrixDirty=!0,this.onParentTransformChanged(e,t)}}},{key:"worldMatrixDirty",get:function(){return this.dirtyFlags.worldMatrix},set:function(t){this.dirtyFlags.worldMatrix!==t&&(this.dirtyFlags.worldMatrix=t,this.dispatchValueChange())}}]),t}();t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new nH,r.time=-1,r.duration=0,r.endBehavior=t6.forward,r.type=tJ.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new nU,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}iY(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,i,r=iQ(this.components);!(i=r()).done;){var n=i.value;if(eZ(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=iQ(this.components);!(e=r()).done;){var n=e.value;eZ(n,t)&&i.push(n)}return i},r.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},r.setParent=function(t){t!==this&&this.parent!==t&&(this.parent&&e2(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),this.onParentChanged(),!this.isDuringPlay&&t.isDuringPlay&&(this.awake(),this.beginPlay()))},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.setActive=function(t){!!t!==this.active&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=iQ(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new nH({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new nv(t,e,i),n=rh.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.engine.canvas.getBoundingClientRect(),s=o.width,u=o.height;this.transform.setPosition((2*t/s-1)*n,(1-2*e/u)*a,i)}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.engine.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.hitTest=function(e,r,n,a,o,s,u){if(!this.isActive)return!1;var h=!1,l=null==u?void 0:u.maxCount,c=this.getHitTestParams(s);if(c){var f=c.clipMasks,d=!0;if(f.length>0&&!function(t,e){for(var i,r=iQ(e);!(i=r()).done;){var n=i.value.item;if(n.isActive&&n.transform.getValid()){var a=n.transform,o=a.getWorldMatrix(),s=a.size.x,u=a.size.y,h=new it(-.5*s,.5*u,0).applyMatrix(o),l=new it(-.5*s,-.5*u,0).applyMatrix(o),c=new it(.5*s,.5*u,0).applyMatrix(o),f=new it(.5*s,-.5*u,0).applyMatrix(o),d={p0:h,p1:l,p2:c},p={p0:c,p1:l,p2:f};if(!t.intersectTriangle(d)&&!t.intersectTriangle(p))return!1}}return!0}(e,f)&&(d=!1),d){var p=!1,m=new it;if(c.type===t.HitTestType.triangle){for(var v=c.triangles,y=c.backfaceCulling,g=0;g<v.length;g++)if(e.intersectTriangle(v[g],m,y)){p=!0,o.push(m);break}}else if(c.type===t.HitTestType.box){var x=c.center,b=c.size,T=x.clone().addScaledVector(b,.5),S=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:S},m)&&(p=!0,o.push(m))}else if(c.type===t.HitTestType.sphere){var E=c.center,C=c.radius;e.intersectSphere({center:E,radius:C},m)&&(p=!0,o.push(m))}else if(c.type===t.HitTestType.custom){var w=c.collect(e,new e7(r,n));w&&w.length>0&&(w.forEach(function(t){o.push(t)}),p=!0)}if(p){var _,M,A={id:this.getInstanceId(),name:this.name,position:o[o.length-1],parentId:this.parentId,hitPositions:o,behavior:c.behavior,item:this,composition:this.composition};if(a.push(A),h=!0,null==u?void 0:null==(M=u.stop)?void 0:M.call(u,A))return!0}}}for(var P,I=iQ(this.children);!(P=I()).done;){var R,O=P.value;if(void 0!==l&&a.length>=l)break;(null==u||null==(R=u.skip)||!R.call(u,O))&&O.hitTest(e,r,n,a,o,s,u)&&(h=!0)}return i.isComposition(this)&&h&&this!==(null==(_=this.composition)?void 0:_.sceneRoot)&&a.push({id:this.getInstanceId(),name:this.name,position:o[o.length-1],parentId:this.parentId,hitPositions:o,behavior:tQ.NONE,item:this,composition:this.composition}),h},r.getCurrentPosition=function(){var t=new it;return this.transform.assignWorldTRS(t),t},r.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.refreshGUIDRecursive();var e=this.engine.findObject({id:this.definition.id});return e.refreshGUIDRecursive(),this.refreshGUIDRecursive(t),this.composition&&e.setParent(this.composition.sceneRoot),e},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=iQ(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.awake=function(){for(var t,e=iQ(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=iQ(this.children);!(r=n()).done;)r.value.awake()},r.onActiveChanged=function(){this.isDuringPlay&&this.composition&&(this.active?this.isEnabled||this.onEnable():this.isEnabled&&this.onDisable())},r.onEnable=function(){this.isEnabled=!0;for(var t,e=iQ(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=iQ(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=iQ(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.onParentChanged=function(){for(var t,e=iQ(this.components);!(t=e()).done;)t.value.onParentChanged();for(var i,r=iQ(this.children);!(i=r()).done;)i.value.onParentChanged()},r.onOrderInParentChanged=function(){for(var t,e=iQ(this.components);!(t=e()).done;)t.value.onOrderInParentChanged()},r.setRendererComponentOrder=function(t){for(var e,i=iQ(this.components);!(e=i()).done;){var r=e.value;eZ(r,nk)&&(r.priority=t)}},r.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.id,n=t.name,a=t.parentId,o=t.endBehavior,s=t.transform,u=t.duration,h=void 0===u?0:u,l=t.visible;if(this.type=t.type,this.props=t,this.id=r.toString(),this.parentId=a,this.components.length=0,i.isComposition(this)){var c=this.definition.content.options.refId,f=this.engine.findEffectsObjectData(c);if(!f)throw Error("Referenced precomposition with Id: "+c+" does not exist.");this.instantiatePreComposition(f)}if(this.name=n,this.duration=h,this.endBehavior=o,s&&this.transform.fromData(s),this.transform.name=this.name,this.transform.engine=this.engine,t.content||(t.content={options:{}}),h<0)throw Error("Item duration can't be less than 0, see "+nz["Item duration can't be less than 0"]+".");if(t.components)for(var d,p=iQ(t.components);!(d=p()).done;){var m=d.value,v=this.engine.findObject(m);this.components.push(v)}for(var y,g,x=iQ(null!=(y=t.children)?y:[]);!(g=x()).done;){var b=g.value;this.engine.findObject(b).setParent(this)}this.setVisible(void 0===l||l)},r.toData=function(){if(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=eS.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="sceneRoot"&&(this.definition.parentId=null==(i=this.parent)?void 0:i.guid),!this.definition.components){this.definition.components=[];for(var e,i,r,n=iQ(this.components);!(r=n()).done;){var a=r.value;eZ(a,t.EffectComponent)&&this.definition.components.push(a)}}this.definition.content={}},r.dispose=function(){this.composition&&this.composition.destroyItem(this);for(var t,i=iQ(this.components.slice());!(t=i()).done;)t.value.dispose();this.components=[],this._composition=null,this.transform.setValid(!1),this.resetChildrenParent(),e.prototype.dispose.call(this)},r.resetChildrenParent=function(){for(var t,e,i=iQ(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&e2(null==(t=this.parent)?void 0:t.children,this)},r.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i=this.getInstanceId();this.setInstanceId(t.id);for(var r,n=iQ(t.components);!(r=n()).done;){var a=r.value,o=this.engine.findObject(a);o.item=this,this.components.push(o)}for(var s,u,h=iQ(null!=(s=t.children)?s:[]);!(u=h()).done;){var l=u.value;this.engine.findObject(l).setParent(this)}if(e){for(var c,f=iQ(this.components);!(c=f()).done;)c.value.setInstanceId(iL());for(var d,p=iQ(this.children);!(d=p()).done;)d.value.refreshGUIDRecursive()}this.setInstanceId(i)},r.refreshGUIDRecursive=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:iL();this.setInstanceId(e);for(var i,r,n=iQ(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:iL();o.setInstanceId(s)}for(var u,h=iQ(this.children);!(u=h()).done;)u.value.refreshGUIDRecursive(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=iQ(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=iQ(this.children);!(n=a()).done;)n.value.gatherPreviousObjectID(t)},r.getDescendantsInternal=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var r=0;r<this.children.length;r++){var n=this.children[r];(!i||i(n))&&t.push(n),e||n.getDescendantsInternal(t,!1,i)}},i.isComposition=function(t){return t.type===tJ.composition},i.isSprite=function(t){return t.type===tJ.sprite},i.isParticle=function(t){return t.type===tJ.particle},i.isNull=function(t){return t.type===tJ.null},i.isTree=function(t){return t.type===tJ.tree},i.isCamera=function(t){return t.type===tJ.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},rk(i,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=iQ(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{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){this.listIndex=t,this.isManuallySetRenderOrder=!0,this.setRendererComponentOrder(t)}},{key:"orderInParent",get:function(){var t,e;return null!=(e=null==(t=this.parent)?void 0:t.children.indexOf(this))?e:-1},set:function(t){var e=null==(n=this.parent)?void 0:n.children,i=null!=(a=null==e?void 0:e.indexOf(this))?a:-1;if(e&&-1!==i){var r=Math.max(0,Math.min(Math.trunc(t),e.length-1));if(i!==r){e.splice(i,1),e.splice(r,0,this);for(var n,a,o,s=iQ(e);!(o=s()).done;)o.value.onOrderInParentChanged()}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),i}(i4),t.VFXItem=eq([i1(eS.VFXItemData)],t.VFXItem),t.Item=void 0,(tm=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tm.isComposition=function(t){return t.type===tJ.composition},tm.isParticle=function(t){return t.type===tJ.particle},tm.isNull=function(t){return t.type===tJ.null};var nY=(ty=new Int32Array((tv=new Float32Array(1)).buffer),function(t){tv[0]=t;var e=ty[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),nZ=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=nY(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=nY(t[i])},t}(),nq=new nv,nK=new nm;function nQ(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,l);var c=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new it;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(s):e.getIntegrateValue(0,r,n):0});nq.setFromArray(v).negate(),nK.setFromEuler(nq);var y=nK.transformPoint(p);t.addVectors(d,y)}if(c.enabled){var g=c.asMovement,x=c.x,b=c.y,T=c.z;if(x){var S=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+S}if(b){var E=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+E}if(T){var C=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function nJ(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function n$(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function n0(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var n1=((eV={})[t0.PARTICLE_ORIGIN_CENTER]=[0,0],eV[t0.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eV[t0.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eV[t0.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eV[t0.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eV[t0.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eV[t0.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eV[t0.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eV[t0.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eV);function n2(t,e,i){var r=i.position,n=new it(t,e,0),a=new it;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new ng(r,a)}function n3(t,e,i){var r=t.x,n=t.y,a=t.z,o=new it(r-e,n+i,a),s=new it(r-e,n-i,a),u=new it(r+e,n-i,a),h=new it(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function n4(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function n5(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function n6(t,e,i,r,n){void 0===r&&(r=null);var a=new it(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new it(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);n||(n=3);for(var s=e,u=e*n;s<e+i;s++,u+=n){var h=t[u],l=t[u+1],c=t[u+2];a.x=Math.min(a.x,h),a.y=Math.min(a.y,l),a.z=Math.min(a.z,c),o.x=Math.max(o.x,h),o.y=Math.max(o.y,l),o.z=Math.max(o.z,c)}return r&&(a.x-=a.x*r.x+r.y,a.y-=a.y*r.x+r.y,a.z-=a.z*r.x+r.y,o.x+=o.x*r.x+r.y,o.y+=o.y*r.x+r.y,o.z+=o.z*r.x+r.y),{minimum:a,maximum:o}}var n8={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex;return new e7(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===t5.LINE?0:i===t5.EASE_OUT?0:i===t5.EASE_IN?2:i===t5.EASE?2:i===t5.HOLD&&r===t5.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===t5.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===t5.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[t5.EASE,t5.EASE_IN,t5.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[t5.EASE,t5.EASE_OUT,t5.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===t5.HOLD&&[t5.HOLD,t5.LINE_OUT,t5.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===t5.HOLD&&[t5.HOLD,t5.LINE,t5.EASE_IN].includes(i)}},n9=function(t,e){this.points=t,this.totalLength=e},n7={},at={};function ae(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function ai(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}function ar(t,e,i,r){var n=n5(e.x-t.x,3)+"_"+n5(e.y-t.y,3)+"_"+n5(e.z-t.z,3)+"&"+(n5(i.x-t.x,3)+"_"+n5(i.y-t.y,3))+"_"+n5(i.z-t.z,3)+"&"+(n5(r.x-t.x,3)+"_"+n5(r.y-t.y,3))+"_"+n5(r.z-t.z,3);if(at[n])return{data:at[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new it,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==o&&(u+=Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2)+Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new n9(a,s);return at[n]=f,{data:f,interval:new it(t.x,t.y,t.z)}}var an=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=ar(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(n4(1-t,0))return e.points[299].point.clone().add(this.interval);if(n4(e.totalLength,0))return this.p1.clone();var i=new it,r=n5(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(n4(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=n5(e.points[a].partialLength,5)):s<0&&a>0?(n-=n5(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),aa=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new rh,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):n4(1-t,0)?this.temp.copyFrom(this.p2):(ah.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),ao=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new e7,this.control2=new e7,this.weighted=!1,this.isConstant=!1,this.mSampleValues=Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),ae(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,o=a*a,s=n*n;return o*a*t+e*o*n*3+i*a*s*3+s*n*r},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=ae(.1*t,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,a=ai(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=ai(e,i,r);if(0===a)break;var o=ae(e,i,r)-t;e-=o/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=ae(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,(this.control1.x!==this.control1.y||this.control2.x!==this.control2.y)&&this.calcSampleValues()},t}();function as(t,e){var i,r,n,a=au(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;iS(u),iS(h);var l=h.x-o.x,c=h.y-o.y,f=n5((s.x-o.x)/l,5),d=n5((u.x-o.x)/l,5);n4(c,0)?i=r=NaN:(i=n5((s.y-o.y)/c,5),r=n5((u.y-o.y)/c,5)),f<0&&(f=0),d<0&&(d=0),f>1&&(f=1),d>1&&(d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return n7[p]?n=n7[p]:(n=n4(c,0)?new ao:new ao(f,i,d,r),n7[p]=n),{points:[o,s,u,h],timeInterval:l,valueInterval:c,curve:n}}function au(t,e,i){var r=t[1],n=n8.isHoldOutKeyframe(t),a=n8.isHoldInKeyframe(e),o=!a&&n8.isRightSideEase(t),s=!n&&n8.isLeftSideEase(e);if(o&&!s&&!a){var u=new e7(r[r.length-4],r[r.length-3]),h=new e7(r[r.length-2],r[r.length-1]),l=n8.getPointInCurve(e),c=new e7(l.x,l.y),f=new e7(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:h,p2:f,p3:c}}if(!o&&s&&!n){var d=e[1],p=n8.getPointInCurve(t),m=new e7(p.x,p.y),v=new e7(d[0],d[1]),y=new e7(d[2],d[3]),g=new e7(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new e7(r[r.length-4],r[r.length-3]),p1:new e7(r[r.length-2],r[r.length-1]),p2:new e7(x[0],x[1]),p3:new e7(x[2],x[3])}}var b=n8.getPointInCurve(t),T=n8.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var S=new e7((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),E=new e7((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"line",p0:b,p1:S,p2:E,p3:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var ah=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=h,t.z=l,t.w=c;return}if(s!==c||n!==u||a!==h||o!==l){var f=1-r,d=n*u+a*h+o*l+s*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,o=o*f+l*g,s=s*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),al="not_implement",ac=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(al)},e.getIntegrateValue=function(t,e,i){throw Error(al)},e.getIntegrateByTime=function(t,e){throw Error(al)},e.getValue=function(t){throw Error(al)},e.getMaxTime=function(){throw Error(al)},e.toUniform=function(t){throw Error(al)},e.map=function(t){throw Error(al)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(al)},t.getAllData=function(t,e){for(var i=new(e?nZ:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),af=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(ac),ad=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(ac),ap=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(ac),am=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(ac),av=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return aE(e,0,this.xCoord,this.min,this.max)-aE(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(ac),ay=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=io(t)},i.getStops=function(){return this.stops},i.getValue=function(t){var e=this.stops;if(0===e.length)return[0,0,0,0];if(t<=e[0].time)return e[0].color.toArray();var i=e.length-1;if(t>=e[i].time)return e[i].color.toArray();for(var r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.time<=t&&a.time>t){var o=(t-n.time)/(a.time-n.time);return is(n.color.toArray(),a.color.toArray(),o,!0)}}return e[i].color.toArray()},e}(ac),ag=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?aE:aS,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,s[1],u[1]);r+=a(l,h,l,s[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(ac),ax=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(ac),ab=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=new it(i[n][0],i[n][1],i[n][2]),u=new it(i[n+1][0],i[n+1][1],i[n+1][2]),h=new it(r[2*n][0],r[2*n][1],r[2*n][2]),l=new it(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=as(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new an(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=n5(t,5),i=0,r=new it,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=this.curveSegments[n[s]].timeStart,h=this.curveSegments[n[s]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=n5((e-r.x)/n,4);return e9(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(ac),aT=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=rh.fromArray(i[n]),u=rh.fromArray(i[n+1]),h=rh.fromArray(r[2*n]),l=rh.fromArray(r[2*n+1]),c=as(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new aa(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=n5(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],h=s[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=n5((e-r.x)/n,4);return e9(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(ac);function aS(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function aE(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function aC(t,e){if(e){var i=e[0],r=e[1];if(i===t4.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===t4.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===t4.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function aw(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function a_(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(a_=function(){return!!t})()}function aM(t,e,i){return(aM=a_()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&iH(n,i.prototype),n}).apply(null,arguments)}var aA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new ie,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aF(t[0]),this.yCurve=aF(t[1]),this.zCurve=aF(t[2]),this.wCurve=aF(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(ac),aP=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new it,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aF(t[0]),this.yCurve=aF(t[1]),this.zCurve=aF(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(ac),aI=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new e7,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aF(t[0]),this.yCurve=aF(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(ac);t.TangentMode=void 0,(tg=t.TangentMode||(t.TangentMode={}))[tg.Cubic=0]="Cubic",tg[tg.Linear=1]="Linear",tg[tg.Constant=2]="Constant",t.WeightedMode=void 0,(tx=t.WeightedMode||(t.WeightedMode={}))[tx.None=0]="None",tx[tx.In=1]="In",tx[tx.Out=2]="Out",tx[tx.Both=3]="Both";var aR=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=aO(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=function(t,e){var i,r,n,a=new e7(t.time,t.value),o=new e7,s=new e7,u=new e7,h=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,l=2===t.tangentMode,c=(h?t.outWeight:1)*(e.time-t.time)/3;o.x=t.time+c,o.y=t.value+c*(l?0:t.outSlope);var f=(h?e.inWeight:1)*(e.time-t.time)/3;s.x=e.time-f,s.y=e.value-f*(l?0:e.inSlope),u.x=e.time,u.y=l?t.value:e.value,iS(s),iS(u);var d=u.x-a.x,p=u.y-a.y,m=n5((o.x-a.x)/d,5),v=n5((s.x-a.x)/d,5);n4(p,0)?i=r=NaN:(i=n5((o.y-a.y)/p,5),r=n5((s.y-a.y)/p,5)),m<0&&(m=0),v<0&&(v=0),m>1&&(m=1),v>1&&(v=1);var y=("bez_"+m+"_"+i+"_"+v+"_"+r).replace(/\./g,"p");return n7[y]?n=n7[y]:(n=n4(p,0)?new ao:h?new ao(m,i,v,r):new ao(i,r),n7[y]=n),{points:[a,o,s,u],timeInterval:d,valueInterval:p,curve:n}}(e[i],e[i+1]),n=r.points,a=r.curve,o=r.timeInterval,s=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:o,valueInterval:s,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var o=this.curveInfos[r],s=o.points[0],u=o.timeInterval,h=o.valueInterval,l=(t-s.x)/u,c=0;c=1===this.keyFrames[r].tangentMode?l:o.curve.getValue(l),e=s.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var h=u*s/n,l=r.y+a*i.curve.getValue(h);0===u||20===u?o+=l:u%2==1?o+=4*l:o+=2*l}return s/3*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(ac);function aO(t){for(var e=[],i=[],r={x:0,y:0},n=0;n<t.length;n++){var a=t[n],o=au(a,n+1<t.length?t[n+1]:t[n],!0),s=o.p0,u=o.p1,h=o.p2,l=o.p3,c=o.type;iS(h),iS(l);var f={leftControl:r,value:s,rightControl:u,tangentMode:"line"===c?1:0};a[0]===t5.HOLD&&(f.tangentMode=2),i.push(f),r=h}for(var d=function(t,e){return(e.y-t.y)/(e.x-t.x+1e-6)},p=0;p<i.length;p++){var m=i[p].leftControl,v=i[p].value,y=i[p].rightControl,g=0,x=0;p>0&&(g=d(m,v)),p<i.length-1&&(x=d(v,y));var b={time:v.x,value:v.y,inSlope:g,outSlope:x,inWeight:0,outWeight:0,tangentMode:i[p].tangentMode,weightedMode:3};e.push(b),p>0&&(b.inWeight=(v.x-m.x)/((v.x-i[p-1].value.x)/3)),p+1<i.length&&(b.outWeight=(y.x-v.x)/((i[p+1].value.x-v.x)/3))}return e}var aV=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyframes=t},i.getValue=function(t){var e=this.keyframes;if(0!==e.length){for(var i=e[0][1],r=0;r<e.length;r++)if(e[r][0]<=(null!=t?t:0))i=e[r][1];else break;return i}},e}(ac),aN=((eN={})[t4.RANDOM]=function(t){return eZ(t[0],Array)?new am(t):new ap(t)},eN[t4.CONSTANT]=function(t){return new af(t)},eN[t4.CONSTANT_VEC2]=function(t){return new af(t)},eN[t4.CONSTANT_VEC3]=function(t){return new af(t)},eN[t4.CONSTANT_VEC4]=function(t){return new af(t)},eN[t4.RGBA_COLOR]=function(t){return new af(t)},eN[t4.COLORS]=function(t){return new ad(t.map(function(t){return ir(t,!1)}))},eN[t4.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new av([t[0][1],t[1][1]]):new ag(t)},eN[t4.GRADIENT_COLOR]=function(t){return new ay(t)},eN[t4.LINEAR_PATH]=function(t){return new ax(t)},eN[t4.BEZIER_CURVE]=function(t){return 1===t.length?new af(t[0][1][1]):new aR(t)},eN[t4.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new af(aM(it,[].concat(t[1][0]))):new ab(t)},eN[t4.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new af(aM(rh,[].concat(t[1][0]))):new aT(t)},eN[t4.COLOR_CURVE]=function(t){return new aL(t)},eN[t4.VECTOR4_CURVE]=function(t){return new aA(t)},eN[t4.VECTOR2_CURVE]=function(t){return new aI(t)},eN[27]=function(t){return new aP(t)},eN[28]=function(t){return new aV(t)},eN);function aF(t){if(!t||!isNaN(+t))return new af(t||0);if(eZ(t,ac))return t;if(iI(aN[t[0]]))return aN[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nz["ValueType: 21/22 is not supported"]+".")}var aL=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new ii,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=aF(t[0]),this.gCurve=aF(t[1]),this.bCurve=aF(t[2]),this.aCurve=aF(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(ac),aD=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},rk(t,null,[{key:"shared",get:function(){return ak.x=0,ak.y=0,ak}}]),t}(),ak=new aD;function aB(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(l,c),s.push(f,d),2}function az(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);s&&l<c?l+=2*Math.PI:!s&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.sqrt(u*u+h*h),m=(15*Math.abs(d)*Math.sqrt(p)/Math.PI>>0)+1,v=d/m;if(f+=v,s){o.push(t,e),o.push(i,r);for(var y=1,g=f;y<m;y++,g+=v)o.push(t,e),o.push(t+Math.sin(g)*p,e+Math.cos(g)*p);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var x=1,b=f;x<m;x++,b+=v)o.push(t+Math.sin(b)*p,e+Math.cos(b)*p),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*m}function aU(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var l=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var o=t[r],s=t[r+1];i+=(o-n)*(s+a),n=o,a=s}return i<0?-1:1}(t);i&&(l*=-1),h=(h-.5)*l+.5}var c=new aD(t[0],t[1]),f=new aD(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(c.x-f.x)&&1e-4>Math.abs(c.y-f.y);if(r){t=t.slice(),d&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));var p=(c.x+f.x)*.5,m=(f.y+c.y)*.5;t.unshift(p,m),t.push(p,m)}var v=t.length/2,y=t.length,g=n.length/2,x=e.width/2,b=x*x,T=e.miterLimit*e.miterLimit,S=t[0],E=t[1],C=t[2],w=t[3],_=0,M=0,A=-(E-w),P=S-C,I=0,R=0,O=Math.sqrt(A*A+P*P)+1e-6;A/=O,P/=O,A*=x,P*=x;var V=h,N=(1-V)*2,F=2*V;r||(e.cap===ev.Round?y+=az(S-A*(N-F)*.5,E-P*(N-F)*.5,S-A*N,E-P*N,S+A*F,E+P*F,n,!0)+2:e.cap===ev.Square&&(y+=aB(S,E,A,P,N,F,!0,n))),n.push(S-A*N,E-P*N),n.push(S+A*F,E+P*F);for(var L=1;L<v-1;++L){S=t[(L-1)*2],E=t[(L-1)*2+1],C=t[2*L],w=t[2*L+1],_=t[(L+1)*2],M=t[(L+1)*2+1],O=Math.sqrt((A=-(E-w))*A+(P=S-C)*P)+1e-6,A/=O,P/=O,A*=x,P*=x,O=Math.sqrt((I=-(w-M))*I+(R=C-_)*R)+1e-6,I/=O,R/=O,I*=x,R*=x;var D=C-S,k=E-w,B=C-_,z=M-w,U=D*B+k*z,G=k*B-z*D,W=G<0;if(Math.abs(G)<.001*Math.abs(U)){n.push(C-A*N,w-P*N),n.push(C+A*F,w+P*F),U>=0&&(e.join===ey.Round?y+=az(C,w,C-A*N,w-P*N,C-I*N,w-R*N,n,!1)+4:y+=2,n.push(C-I*F,w-R*F),n.push(C+I*N,w+R*N));continue}var j=(-A+S)*(-P+w)-(-A+C)*(-P+E),X=(-I+_)*(-R+w)-(-I+C)*(-R+M),H=(D*X-B*j)/G,Y=(z*j-k*X)/G,Z=(H-C)*(H-C)+(Y-w)*(Y-w),q=C+(H-C)*N,K=w+(Y-w)*N,Q=C-(H-C)*F,J=w-(Y-w)*F,$=W?N:F;Z<=Math.min(D*D+k*k,B*B+z*z)+$*$*b?e.join===ey.Bevel||Z/b>T?(W?(n.push(q,K),n.push(C+A*F,w+P*F),n.push(q,K),n.push(C+I*F,w+R*F)):(n.push(C-A*N,w-P*N),n.push(Q,J),n.push(C-I*N,w-R*N),n.push(Q,J)),y+=2):e.join===ey.Round?W?(n.push(q,K),n.push(C+A*F,w+P*F),y+=az(C,w,C+A*F,w+P*F,C+I*F,w+R*F,n,!0)+4,n.push(q,K),n.push(C+I*F,w+R*F)):(n.push(C-A*N,w-P*N),n.push(Q,J),y+=az(C,w,C-A*N,w-P*N,C-I*N,w-R*N,n,!1)+4,n.push(C-I*N,w-R*N),n.push(Q,J)):(n.push(q,K),n.push(Q,J)):(n.push(C-A*N,w-P*N),n.push(C+A*F,w+P*F),e.join===ey.Round?W?y+=az(C,w,C+A*F,w+P*F,C+I*F,w+R*F,n,!0)+2:y+=az(C,w,C-A*N,w-P*N,C-I*N,w-R*N,n,!1)+2:e.join===ey.Miter&&Z/b<=T&&(W?(n.push(Q,J),n.push(Q,J)):(n.push(q,K),n.push(q,K)),y+=2),n.push(C-I*N,w-R*N),n.push(C+I*F,w+R*F),y+=2)}S=t[(v-2)*2],E=t[(v-2)*2+1],C=t[(v-1)*2],O=Math.sqrt((A=-(E-(w=t[(v-1)*2+1])))*A+(P=S-C)*P)+1e-6,A/=O,P/=O,A*=x,P*=x,n.push(C-A*N,w-P*N),n.push(C+A*F,w+P*F),r||(e.cap===ev.Round?y+=az(C-A*(N-F)*.5,w-P*(N-F)*.5,C-A*N,w-P*N,C+A*F,w+P*F,n,!1)+2:e.cap===ev.Square&&(y+=aB(C,w,A,P,N,F,!1,n)));for(var tt=g;tt<y+g-2;++tt)S=n[2*tt],E=n[2*tt+1],C=n[(tt+1)*2],w=n[(tt+1)*2+1],_=n[(tt+2)*2],1e-8>Math.abs(S*(w-(M=n[(tt+2)*2+1]))+C*(M-E)+_*(E-w))||s.push(tt,tt+1,tt+2)}}var aG=function(){},aW=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}iY(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,o=r-a,s=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(o*o)+c*c/(s*s)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t,e){var i=this.x,r=this.y,n=this.halfWidth,a=this.halfHeight;if(!(n>=0&&a>=0))return t;var o=Math.ceil(Math.sqrt((null!=e?e:1)*(n+a))),s=8*o+0+0;if(0===s)return t;if(0===o)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,t[5]=t[7]=r-0,t;var u=0,h=4*o+0+2,l=h,c=s,f=0+n,d=0,p=i+f,m=i-f,v=r+0;t[u++]=p,t[u++]=v,t[--h]=v,t[--h]=m;for(var y=1;y<o;y++){var g=Math.PI/2*(y/o),x=0+Math.cos(g)*n,b=0+Math.sin(g)*a,T=i+x,S=i-x,E=r+b,C=r-b;t[u++]=T,t[u++]=E,t[--h]=E,t[--h]=S,t[l++]=S,t[l++]=C,t[--c]=C,t[--c]=T}f=0,d=0+a,p=i+f,m=i-f,v=r+d;var w=r-d;return t[u++]=p,t[u++]=v,t[--c]=w,t[--c]=p,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(aG),aj=function(t){function e(e,i,r,n,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(o=t.call(this)||this).x=e,o.y=i,o.width=r,o.height=n,o.roundness=a,o}iY(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t,e){var i,r=this.width/2,n=this.height/2,a=this.x+r,o=this.y+n,s=i=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,n)),u=r-s,h=n-i;if(s>=0&&i>=0&&u>=0&&h>=0){var l=Math.ceil(Math.sqrt((null!=e?e:1)*(s+i))),c=8*l+(u?4:0)+(h?4:0);if(0!==c){if(0===l){t[0]=t[6]=a+u,t[1]=t[3]=o+h,t[2]=t[4]=a-u,t[5]=t[7]=o-h;return}var f=0,d=4*l+(u?2:0)+2,p=d,m=c,v=u+s,y=h,g=a+v,x=a-v,b=o+y;if(t[f++]=g,t[f++]=b,t[--d]=b,t[--d]=x,h){var T=o-y;t[p++]=x,t[p++]=T,t[--m]=T,t[--m]=g}for(var S=1;S<l;S++){var E=Math.PI/2*(S/l),C=u+Math.cos(E)*s,w=h+Math.sin(E)*i,_=a+C,M=a-C,A=o+w,P=o-w;t[f++]=_,t[f++]=A,t[--d]=A,t[--d]=M,t[p++]=M,t[p++]=P,t[--m]=P,t[--m]=_}v=u,y=h+i,g=a+v,x=a-v,b=o+y;var I=o-y;t[f++]=g,t[f++]=b,t[--m]=I,t[--m]=g,u&&(t[f++]=x,t[f++]=b,t[--m]=I,t[--m]=x)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(aG),aX=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).x=e,s.y=i,s.x2=r,s.y2=n,s.x3=a,s.y3=o,s}iY(e,t);var i=e.prototype;return i.contains=function(t,e){var i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),r=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=r<0&&0!==i&&0!==r)return!1;var n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return 0===n||n<0==i+r<=0},i.clone=function(){return new e(this.x,this.y,this.x2,this.y2,this.x3,this.y3)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getBounds=function(t){t=t||new aj;var e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),r=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=r,t.width=i-e,t.height=n-r,t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t,e){t[0]=this.x,t[1]=this.y,t[2]=this.x2,t[3]=this.y2,t[4]=this.x3,t[5]=this.y3},i.triangulate=function(t,e,i,r,n){var a=0;e[(i*=2)+0]=t[0],e[i+a+1]=t[1],e[i+(a+=2)]=t[2],e[i+a+1]=t[3],e[i+(a+=2)]=t[4],e[i+a+1]=t[5];var o=i/2;r[n++]=o,r[n++]=o+1,r[n++]=o+2},e}(aG);function aH(t,e,i,r,n,a,o,s,u,h,l,c){var f=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/(null!=l?l:1);return function t(e,i,r,n,a,o,s,u,h,l,c,f,d,p){if(void 0===d&&(d=0),void 0===p&&(p=1),!(c>8)){var m=(e+r)/2,v=(i+n)/2,y=(r+a)/2,g=(n+o)/2,x=(a+s)/2,b=(o+u)/2,T=(m+y)/2,S=(v+g)/2,E=(y+x)/2,C=(g+b)/2,w=(T+E)/2,_=(S+C)/2,M=(d+p)/2;if(c>0){var A=s-e,P=u-i,I=Math.abs((r-s)*P-(n-u)*A),R=Math.abs((a-s)*P-(o-u)*A);if(I>11920929e-14&&R>11920929e-14){if((I+R)*(I+R)<=l*(A*A+P*P)){h.push(w,_),null==f||f.push(M);return}}else if(I>11920929e-14){if(I*I<=l*(A*A+P*P)){h.push(w,_),null==f||f.push(M);return}}else if(R>11920929e-14){if(R*R<=l*(A*A+P*P)){h.push(w,_),null==f||f.push(M);return}}else if((A=w-(e+s)/2)*A+(P=_-(i+u)/2)*P<=l){h.push(w,_),null==f||f.push(M);return}}t(e,i,m,v,T,S,w,_,h,l,c+1,f,d,M),t(w,_,E,C,x,b,s,u,h,l,c+1,f,M,p)}}(e,i,r,n,a,o,s,u,t,f*=f,0,c),t.push(s,u),null==c||c.push(1),t}var aY="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},aZ={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function s(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function l(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function c(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=K(t),t.a.c=t.c,m(t,K(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=K(e),e.a.c=e.c,m(e,K(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,K(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var S,E=4*1e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function _(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function M(t,e){c(t.a),t.c=!1,t.a=e,e.i=t}function A(t){var e=t.a.a;do t=tl(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),M(t,e),t=tl(t)),t}function P(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function I(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function R(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,_(t)}function O(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){R(t);break}M(r,n=d(e.c.b,n.b))}e.c!==n&&(l(K(n),n),l(e,n)),R(t),e=r.a,t=r}return e}function V(t,e,i,r,n,a){var o=!0;do P(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(l(K(i),i),l(K(n),i)),r.f=e.f-i.f,r.d=I(t,r.f),e.b=!0,!o&&D(t,e)&&(C(i,n),_(e),c(n)),o=!1,e=r,n=i;e.b=!0,a&&B(t,e)}function N(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function F(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,N(t,e.a,r,[.5,.5,0,0],!1),l(e,i)}function L(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function D(t,r){var a=th(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,h=a.d,c=a.e,d=a.c,p=d[u];h[p]=h[a.a],d[h[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(c[h[p>>1]],c[h[p]])?to(a,p):ts(a,p)),c[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;F(t,K(s),o)}}else f(s.b),l(o,K(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tl(r).b=r.b=!0,f(o.b),l(K(s),o)}return!0}function k(t,h){var c=th(h),d=h.a,p=c.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,S=y,E=m,C=g,w=v;if(i(S,E)||(b=S,S=E,E=b),i(C,w)||(b=C,C=w,w=b),i(S,C)||(b=S,S=C,C=b,b=E,E=w,w=b),i(C,E)?i(E,w)?(0>(b=r(S,C,E))+(T=r(C,E,w))&&(b=-b,T=-T),x.b=u(b,C.b,T,E.b)):(0>(b=n(S,C,E))+(T=-n(S,w,E))&&(b=-b,T=-T),x.b=u(b,C.b,T,w.b)):x.b=(C.b+E.b)/2,a(S,E)||(b=S,S=E,E=b),a(C,w)||(b=C,C=w,w=b),a(S,C)||(b=S,S=C,C=b,b=E,E=w,w=b),a(C,E)?a(E,w)?(0>(b=o(S,C,E))+(T=o(C,E,w))&&(b=-b,T=-T),x.a=u(b,C.a,T,E.a)):(0>(b=s(S,C,E))+(T=-s(S,w,E))&&(b=-b,T=-T),x.a=u(b,C.a,T,w.a)):x.a=(C.a+E.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),S=i(m,v)?m:v,i(S,x)&&(x.b=S.b,x.a=S.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),l(p.b,d),d=th(h=A(h)).a,O(t,th(h),c),V(t,h,K(d),d,d,!0),!0;if(y===t.a){f(p.b),l(d.e,K(p)),v=(m=c=h).a.b.a;do m=tl(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,c.a=K(p),p=O(t,c,null),V(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tl(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=c.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),l(K(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,L(d,m,y,p,0),L(d,v,g,p,2),N(t,d,x,p,!0),tl(h).b=h.b=c.b=!0,!1}function B(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tl(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=th(a=e),h=a.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){a=!1;break t}tl(a).b=a.b=!0,p=f(h),l(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,h.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),l(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(_(r),c(s),s=(r=th(e)).a):e.c&&(_(e),c(o),o=(e=tl(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)D(t,e);else if(k(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),_(e),c(o),e=tl(r))}}function z(t,e){var i=new tu,r=h(t.b);r.a.b=E,r.a.a=e,r.b.a.b=-E,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function U(t){this.a=new W,this.b=t,this.c=w}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new W(i,e.a,e),e.a.c=t,e.a=t}function W(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function j(){this.d=X,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var X=0;function H(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case X:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function K(t){return t.b.e}function Q(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[s],n[h])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[s])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tl(t){return t.e.a.b}(S=j.prototype).x=function(){H(this,X)},S.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:Y(this,100900);return}Y(this,100901)},S.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(this,100900)}return!1},S.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},S.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Y(this,100900)}},S.C=function(t,e){var i=!1,r=[0,0,0];H(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?l(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},S.u=function(t){H(this,X),this.d=1,this.b=new Q,this.c=t},S.t=function(){H(this,1),this.d=2,this.q=null},S.v=function(){H(this,2),this.d=1},S.w=function(){H(this,1),this.d=X;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,h=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])h[0]=0,h[1]=0,h[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>o&&(o=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=o&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<h[v]?1:-1,h=a.e;h!==a;h=h.e)h.b=h.g[o],h.a=v*h.g[s];if(u){for(h=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do h+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,a=(h=this.b.b).h;a!==h;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(F(this,o,a),c(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),c(o)),(a===u||a===u.b)&&(u=u.h),c(a));for(this.e=h=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(h,a);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)to(t,e);t.h=!0}(t.b)}(h),this.f=new U(this),z(this,-E),z(this,E);null!==(h=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,h))break;u=te(this.e),F(this,h.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var h=o.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=h.a).a,s)||e(u.b.a,s)||(f(u.b),h.c&&(c(u.c),h.c=!1),l(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?M(v,m):(u=o,(h=P(o,h,m)).f=tl(h).f+h.a.f,h.d=I(u,h.f)),t(o,s)):V(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=A(o.i))).a,(u=O(r,u,null)).c===h){var h=u,u=h.c,p=th(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,o),e(m.a,r.a)&&(l(K(u),m),u=th(o=A(o)).a,O(r,th(o),p),y=!0),e(v.a,r.a)&&(l(h,K(v)),h=O(r,p,null),y=!0),y?V(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?K(v):m,V(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,B(r,o))}else V(r,o,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,_(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,a=(h=this.b).a.b;a!==h.a;a=u)u=a.b,(a=a.a).e.e===a&&(C(a.c,a),c(a));if(!this.n){if(h=this.b,this.m)for(a=h.b.h;a!==h.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:c(a);else for(a=h.a.b;a!==h.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,a=!1,o=-1,s=h.a.d;s!==h.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(h=this.b).a.b;a!==h.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,K(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,K(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},aY.libtess={GluTesselator:j,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},j.prototype.gluDeleteTess=j.prototype.x,j.prototype.gluTessProperty=j.prototype.B,j.prototype.gluGetTessProperty=j.prototype.y,j.prototype.gluTessNormal=j.prototype.A,j.prototype.gluTessCallback=j.prototype.z,j.prototype.gluTessVertex=j.prototype.C,j.prototype.gluTessBeginPolygon=j.prototype.u,j.prototype.gluTessBeginContour=j.prototype.t,j.prototype.gluTessEndContour=j.prototype.v,j.prototype.gluTessEndPolygon=j.prototype.w,t.exports=aY.libtess}(aZ);var aq=((tb=new aZ.exports.GluTesselator).gluTessCallback(aZ.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==aZ.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tb);function aK(t){aq.gluTessNormal(0,0,1);var e=[];aq.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){aq.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];aq.gluTessVertex(a,a)}aq.gluTessEndContour()}return aq.gluTessEndPolygon(),e}t.StarType=void 0,(tT=t.StarType||(t.StarType={}))[tT.Star=0]="Star",tT[tT.Polygon=1]="Polygon";var aQ=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).pointCount=e,s.outerRadius=i,s.innerRadius=r,s.outerRoundness=n,s.innerRoundness=a,s.starType=o,s.v=[],s.in=[],s.out=[],s}iY(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t,e){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var i=null!=e?e:1,r=0;r<this.v.length-2;r+=2)aH(t,this.v[r],this.v[r+1],this.out[r],this.out[r+1],this.in[r+2],this.in[r+3],this.v[r+2],this.v[r+3],void 0,i);var n=this.v.length-1;aH(t,this.v[n-1],this.v[n],this.out[n-1],this.out[n],this.in[0],this.in[1],this.v[0],this.v[1],void 0,i)},i.triangulate=function(t,e,i,r,n){for(var a=aK([t]),o=e.length/2,s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,o=!0,s=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*s/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=o?s:u,i=o?h:l,r=o?c:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,o=!o,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),o=-(.5*Math.PI);for(t=0;t<e;t++){var s=r*Math.cos(o),u=r*Math.sin(o),h=0===s&&0===u?0:u/Math.sqrt(s*s+u*u),l=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),c=2*t;this.v[c]=s,this.v[c+1]=u,this.in[c]=s+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=s-h*a*n*1,this.out[c+1]=u-l*a*n*1,o+=1*i}},e}(aG),aJ=function(t){function e(e,i,r){var n;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),(n=t.call(this)||this).x=e,n.y=i,n.radius=r,n}iY(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.radius)},i.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i},i.strokeContains=function(t,e,i,r){if(void 0===r&&(r=.5),0===this.radius)return!1;var n=this.x-t,a=this.y-e,o=this.radius,s=(1-r)*i,u=Math.sqrt(n*n+a*a);return u<=o+s&&u>o-(i-s)},i.getBounds=function(t){return t||(t=new aj),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t,e){var i=this.x,r=this.y,n=this.radius,a=this.radius;if(!(n<=0)){var o=Math.ceil(Math.sqrt((null!=e?e:1)*(n+a))),s=8*o+0+0;if(0!==s){if(0===o){t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,t[5]=t[7]=r-0;return}var u=0,h=4*o+0+2,l=h,c=s,f=0+n,d=0,p=i+f,m=i-f,v=r+0;t[u++]=p,t[u++]=v,t[--h]=v,t[--h]=m;for(var y=1;y<o;y++){var g=Math.PI/2*(y/o),x=0+Math.cos(g)*n,b=0+Math.sin(g)*a,T=i+x,S=i-x,E=r+b,C=r-b;t[u++]=T,t[u++]=E,t[--h]=E,t[--h]=S,t[l++]=S,t[l++]=C,t[--c]=C,t[--c]=T}f=0,d=0+a,p=i+f,m=i-f,v=r+d;var w=r-d;t[u++]=p,t[u++]=v,t[--c]=w,t[--c]=p}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(aG),a$=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}iY(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];s>e!=h>e&&t<(e-s)/(h-s)*(u-o)+o&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t,e){for(var i=0;i<this.points.length;i++)t[i]=this.points[i]},i.triangulate=function(t,e,i,r,n){var a=aK([t]),o=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw Error("Invalid points array");if(2===t.length){e.push(t[0],t[1],t[0],t[1],t[0],t[1]);return}var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],o=t[0],s=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>o&&(o=h,s=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},rk(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(aG);t.UpdateModes=void 0,(tS=t.UpdateModes||(t.UpdateModes={}))[tS.EveryUpdate=0]="EveryUpdate",tS[tS.Manual=1]="Manual",t.CompositionComponent=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.items=[],i.state=t.PlayState.Stopped,i.updateMode=0,i.playOnStart=!1,i.endBehavior=t6.forward,i.time=0,i.lastTime=0,i.sceneBindings=[],i.timelineAsset=null,i._timelineInstance=null,i.nestedCompositions=[],i}iY(i,e);var r=i.prototype;return r.onStart=function(){this.playOnStart&&this.play()},r.pause=function(){this.state=t.PlayState.Paused;for(var e,i=iQ(this.nestedCompositions);!(e=i()).done;)e.value.pause()},r.play=function(){this.state=t.PlayState.Playing;for(var e,i=iQ(this.nestedCompositions);!(e=i()).done;)e.value.play()},r.stop=function(){this.state=t.PlayState.Stopped,this.time=0,this.lastTime=0;for(var e,i=iQ(this.nestedCompositions);!(e=i()).done;)e.value.stop()},r.getTime=function(){return this.time},r.setTime=function(t){this.time=t},r.onUpdate=function(e){this.state===t.PlayState.Playing&&0===this.updateMode&&this.tick(e/1e3)},r.tick=function(t){if(this.timelineInstance){var e=this.time;if(n4(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case t6.forward:break;case t6.freeze:e=this.item.duration;break;case t6.restart:e%=this.item.duration;break;case t6.destroy:this.item.dispose();return}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},r.onEnable=function(){this.item.getDescendants(!1,function(t){return t.setActive(!0),!1})},r.onDisable=function(){this.item.getDescendants(!1,function(t){return t.setActive(!1),!1})},r.onDestroy=function(){this.item.getDescendants().forEach(function(t){return t.dispose()})},r.setChildrenRenderOrder=function(e){if(!this.timelineInstance)return e;var r=[];this.collectChildren(this.item,r);for(var n,a=new Set,o=iQ(this.timelineInstance.masterTrackInstances);!(n=o()).done;){var s=n.value;eZ(s.boundObject,t.VFXItem)&&a.add(s.boundObject)}for(var u=[],h=0;h<r.length;h++)a.has(r[h])&&u.push(h);for(var l,c=[],f=iQ(this.timelineInstance.masterTrackInstances);!(l=f()).done;){var d=l.value;eZ(d.boundObject,t.VFXItem)&&c.push(d.boundObject)}for(var p=0;p<u.length&&p<c.length;p++)r[u[p]]=c[p];for(var m,v=iQ(r);!(m=v()).done;){var y=m.value,g=e++;y.isManuallySetRenderOrder||y.setRendererComponentOrder(g);var x=y.getComponent(i);x&&(e=x.setChildrenRenderOrder(e))}return e},r.collectChildren=function(e,i){for(var r,n=iQ(e.children);!(r=n()).done;){var a=r.value;i.push(a),t.VFXItem.isComposition(a)||this.collectChildren(a,i)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this._timelineInstance=null},rk(i,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new uz(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var e,r=iQ(this._timelineInstance.masterTrackInstances);!(e=r()).done;){var n=e.value.boundObject;if(eZ(n,t.VFXItem)&&t.VFXItem.isComposition(n)){var a=n.getComponent(i);a.updateMode=1,this.nestedCompositions.push(a)}}}return this._timelineInstance}}]),i}(rB),eq([i3(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),eq([i3(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),eq([i3(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=eq([i1("CompositionComponent")],t.CompositionComponent),t.FilterMode=void 0,(tE=t.FilterMode||(t.FilterMode={}))[tE.Nearest=0]="Nearest",tE[tE.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tC=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tC.RGBA32=0]="RGBA32",tC[tC.RGBAHalf=1]="RGBAHalf";var a0=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rk(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}();t.RenderPassAttachmentStorageType=void 0,(tw=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[tw.none=0]="none",tw[tw.color=1]="color",tw[tw.stencil_8_opaque=2]="stencil_8_opaque",tw[tw.depth_16_opaque=3]="depth_16_opaque",tw[tw.depth_stencil_opaque=4]="depth_stencil_opaque",tw[tw.depth_16_texture=5]="depth_16_texture",tw[tw.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(t_=t.TextureStoreAction||(t.TextureStoreAction={}))[t_.store=0]="store",t_[t_.clear=2]="clear";var a1=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(eZ(r,no))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,h=r.internalFormat,l=r.format,c=void 0===l?rG.RGBA:l,f=r.type,d=void 0===f?rG.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:c,type:d,internalFormat:h||c,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=no.create(e,ro({},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)},rk(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,(tM=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tM.force=0]="force",tM[tM.keep=1]="keep",tM[tM.keepExternal=2]="keepExternal",tM[tM.destroy=0]="destroy";var a2=1,a3=function(){function e(t){this.priority=0,this.name="RenderPass"+a2++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var i=e.prototype;return i.addMesh=function(t){ib(this.meshes,t)},i.removeMesh=function(t){e2(this.meshes,t)},i.configure=function(t){},i.execute=function(t){},i.onCameraCleanup=function(t){},i.getViewport=function(){var t,e=null==(t=this.framebuffer)?void 0:t.viewport;if(e)return e;var i=this.renderer;return i?[0,0,i.getWidth(),i.getHeight()]:[0,0,0,0]},i.dispose=function(e){if(!this.disposed){var i=(null==e?void 0:e.meshes)||void 0;i!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(i)}),this.meshes.length=0,this.disposed=!0}},rk(e,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),e}(),a4=function(e){function i(t){var i;return(i=e.call(this,t)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}iY(i,e);var r=i.prototype;return r.setup=function(t){this.useRenderTarget=t},r.configure=function(e){this.useRenderTarget&&(this.framebuffer=e.getTemporaryRT("DrawObjectPass",e.getWidth(),e.getHeight(),16,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf),e.setFramebuffer(this.framebuffer))},r.execute=function(e){this.useRenderTarget&&e.clear({colorAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear}),this.meshes.sort(function(t,e){return t.priority-e.priority}),e.renderMeshes(this.meshes)},r.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},i}(a3),a5=1,a6=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).name="",n.subMeshes=[],n.mode=4,n.instanceCount=0,n.vertexBuffers={},n.indices=new Uint16Array(0),n.drawCount=0,n.drawStart=0,n.skin={},n.disposed=!1,n.initialized=!1,n.bufferUsage=t.BufferUsage.Static,a9(i)&&(n.vertexArrayObjects={}),r&&n.processProps(r),n}iY(i,e);var r=i.prototype;return r.isDisposed=function(){return this.disposed},r.getOptions=function(){return this.options?ro({},this.options):void 0},r.getVertexBuffer=function(t){return this.vertexBuffers[t]},r.getVertexBuffers=function(){return this.vertexBuffers},r.setVerticesBuffer=function(t,e){void 0===e&&(e=!0);var i=t.getKind(),r=this.vertexBuffers[i];r&&e&&r.dispose(),t.ownsBuffer&&t.buffer.increaseReferences(),this.vertexBuffers[i]=t,this.disposeVertexArrayObjects()},r.getAttributeBuffer=function(t){var e;return null==(e=this.vertexBuffers[t])?void 0:e.getWrapperBuffer()},r.getAttributeData=function(t){var e;return null==(e=this.vertexBuffers[t])?void 0:e.getData()},r.setAttributeData=function(t,e){var i=this.vertexBuffers[t];i&&(i.update(e),this.disposeVertexArrayObjects())},r.setAttributeSubData=function(t,e,i){var r=this.vertexBuffers[t];if(r){var n=r.getWrapperBuffer(),a=n.byteStride>0?Math.ceil(i.byteLength/n.byteStride):0;n.updateDirectly(i,e,a),this.disposeVertexArrayObjects()}},r.getAttributeStride=function(t){var e,i;return null!=(i=null==(e=this.vertexBuffers[t])?void 0:e.byteStride)?i:0},r.getAttributeNames=function(){return Object.keys(this.vertexBuffers)},r.getIndexBuffer=function(){return this.indexBuffer},r.getIndexData=function(){return this.indices},r.getIndexType=function(){var e;return(null==(e=this.indexBuffer)?void 0:e.is32Bits)||ot(this.indices)?t.BufferDataType.UnsignedInt:t.BufferDataType.UnsignedShort},r.setIndexData=function(t){if(!a7(t))throw TypeError("Index data must use a supported integer array.");this.indices=Array.isArray(t)?ot(t)?new Uint32Array(t):new Uint16Array(t):t,this.releaseIndexBuffer(),this.disposeVertexArrayObjects(),this.initialized&&this.createIndexBuffer()},r.setIndexSubData=function(t,e){var i=this.indices;if(t<0||t+e.length>i.length)throw RangeError("Buffer '"+this.name+"##index' update is out of range.");if(i.set(e,t),this.indexBuffer){var r=i.slice(t,t+e.length);this.engine.updateDynamicIndexBuffer(this.indexBuffer,r,t*(this.indexBuffer.is32Bits?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT)),this.disposeVertexArrayObjects()}},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 this.skin},r.bind=function(t){var e,i,r,n,a=this.vertexArrayObjects,o=this.engine;if(!a||!a9(o)){o.bindBuffers(this.vertexBuffers,null!=(e=this.indexBuffer)?e:null,t);return}var s=a[t.key];!s&&(s=o.recordVertexArrayObject(this.vertexBuffers,null!=(i=this.indexBuffer)?i:null,t))&&(a[t.key]=s),s?o.bindVertexArrayObject(s,null!=(r=this.indexBuffer)?r:null):o.bindBuffers(this.vertexBuffers,null!=(n=this.indexBuffer)?n:null,t)},r.releaseVertexArrayObject=function(t){var e=this.vertexArrayObjects;if(e){var i=e[t];i&&a8(this.engine)&&this.engine.releaseVertexArrayObject(i),delete e[t]}},r.initialize=function(){this.initialized||this.disposed||(this.forEachVertexBuffer(function(t){t.create()}),this.createIndexBuffer(),this.engine.addGeometry(this),this.initialized=!0,this.options=void 0)},r.flush=function(){this.disposed||(this.initialize(),this.forEachVertexBuffer(function(t){return t.create()}))},r.restore=function(){this.initialized&&!this.disposed&&(this.vertexArrayObjects&&(this.vertexArrayObjects={}),this.forEachVertexBuffer(function(t){return t.rebuild()}),this.indices.length>0&&(this.indexBuffer=void 0,this.createIndexBuffer()))},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.subMeshes=t.subMeshes,t.buffer?n=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(t.buffer)):t.binaryData&&(n=t.binaryData),n){var i=t.vertexData.vertexCount,r={name:t.name,mode:4,attributes:{}};if(t.vertexData.channels.some(function(t){return!!t.semantic}))t.vertexData.channels.forEach(function(t){var e,a=null!=(e=on[t.semantic])?e:t.semantic;r.attributes[a]={type:or(t.format),size:t.dimension,data:oi(t,n,i),normalize:t.normalize}});else{var n,a,o=t.vertexData.channels[0],s=t.vertexData.channels[1],u=t.vertexData.channels[2];r.attributes=((a={})[nV.PositionKind]=oe(o,n,i,3),a[nV.UVKind]=oe(s,n,i,2),a[nV.NormalKind]=oe(u,n,i,3),a)}if(t.indexFormat!==ew.None){var h=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,a=e.byteLength-i;switch(t){case ew.UInt16:return new Uint16Array(r,n,a/Uint16Array.BYTES_PER_ELEMENT);case ew.UInt32:return new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT);default:throw Error("Unsupported index format: "+t+".")}}(t.indexFormat,n,t.indexOffset);r.indices={data:h},r.drawCount=h.length}else r.drawCount=i;this.processProps(r),this.skin={boneNames:t.boneNames,rootBoneName:t.rootBoneName,inverseBindMatrices:t.inverseBindMatrices}}},r.dispose=function(){var t=this;this.disposed||(this.disposeVertexArrayObjects(),Object.keys(this.vertexBuffers).forEach(function(e){return t.vertexBuffers[e].dispose()}),this.releaseIndexBuffer(),this.vertexBuffers={},this.indices=new Uint16Array(0),this.options=void 0,this.drawStart=0,this.drawCount=0,this.initialized&&this.engine.removeGeometry(this),this.initialized=!1,this.disposed=!0,e.prototype.dispose.call(this))},r.processProps=function(e){var i,r,n,a,o,s,u=this;this.releaseCurrentBuffers();var h=null!=(i=e.bufferUsage)?i:t.BufferUsage.Static,l={},c={},f={};if(Object.keys(e.attributes).forEach(function(t){var i,r,n=e.attributes[t],a="dataSource"in n?n.dataSource:t;c[a]=Math.max(null!=(i=c[a])?i:0,null!=(r=n.instanceDivisor)?r:0)}),Object.keys(e.attributes).forEach(function(i){var r,n,a=e.attributes[i];if(!("dataSource"in a)){var o,s=ArrayBuffer.isView(o=a.data)&&!eZ(o,DataView)?a.data:void 0,d=null!=(r=a.type)?r:s?nP(s):t.BufferDataType.Float,p=nA(d),m=a.stride||a.size*p,v=null!=s?s:nR(d,0);if(0===v.length&&e.maxVertex&&e.maxVertex>0){var y=m/p;v=nR(d,Math.ceil(e.maxVertex*y))}var g=null!=(n=c[i])?n:0;f[i]=d,l[i]=new nO(u.engine,v,h!==t.BufferUsage.Static,m,!1,g>0,!0,g,i)}}),Object.keys(e.attributes).forEach(function(i){var r,n,a,o,s,h=e.attributes[i],c="dataSource"in h?h.dataSource:i,d=l[c];if(!d)throw Error("Attribute '"+i+"' references missing data source '"+c+"'.");var p=null!=(n=null!=(r=h.type)?r:f[c])?n:t.BufferDataType.Float,m=h.stride||d.byteStride,v=null!=(a=h.instanceDivisor)?a:0,y=new nV(u.engine,d,i,{size:h.size,type:p,stride:m,offset:null!=(o=h.offset)?o:0,normalized:null!=(s=h.normalize)&&s,instanced:v>0,divisor:v,useBytes:!0,takeBufferOwnership:!0});u.setVerticesBuffer(y)}),this.name=null!=(r=e.name)?r:"effectsGeometry:"+a5++,this.drawStart=null!=(n=e.drawStart)?n:0,this.drawCount=null!=(a=e.drawCount)?a:0,this.mode=null!=(o=e.mode)?o:4,this.instanceCount=null!=(s=e.instanceCount)?s:0,this.bufferUsage=h,this.options=e,e.indices){var d=e.indices.data;if(!a7(d))throw TypeError("Index data must use a supported integer array.");this.indices=Array.isArray(d)?ot(d)?new Uint32Array(d):new Uint16Array(d):d}this.disposeVertexArrayObjects()},r.releaseCurrentBuffers=function(){var t=this,e=this.initialized;this.disposeVertexArrayObjects(),Object.keys(this.vertexBuffers).forEach(function(e){return t.vertexBuffers[e].dispose()}),this.releaseIndexBuffer(),this.vertexBuffers={},this.indices=new Uint16Array(0),e&&(this.engine.removeGeometry(this),this.initialized=!1)},r.disposeVertexArrayObjects=function(){var t=this,e=this.vertexArrayObjects;e&&(Object.keys(e).forEach(function(i){var r=e[i];r&&a8(t.engine)&&t.engine.releaseVertexArrayObject(r)}),this.vertexArrayObjects={})},r.createIndexBuffer=function(){var t=this.indices;0===t.length||this.indexBuffer||(this.indexBuffer=this.engine.createIndexBuffer(t,{usage:this.bufferUsage,type:this.getIndexType(),byteStride:0,instanceDivisor:0,label:""+this.name+"##index"}))},r.releaseIndexBuffer=function(){this.indexBuffer&&(this.engine.releaseBuffer(this.indexBuffer),this.indexBuffer=void 0)},r.forEachVertexBuffer=function(t){var e=this,i=new Set;Object.keys(this.vertexBuffers).forEach(function(r){var n=e.vertexBuffers[r].getWrapperBuffer();i.has(n)||(i.add(n),t(n))})},rk(i,[{key:"isInitialized",get:function(){return this.initialized}}]),i}(i4);function a8(t){return"function"==typeof t.recordVertexArrayObject&&"function"==typeof t.bindVertexArrayObject&&"function"==typeof t.releaseVertexArrayObject}function a9(t){var e;return(null==(e=t.gpuCapability)?void 0:e.detail.vertexArrayObject)===!0&&a8(t)}function a7(t){return Array.isArray(t)||eZ(t,Int32Array)||eZ(t,Uint16Array)||eZ(t,Uint32Array)}function ot(t){if(eZ(t,Uint32Array))return!0;if(eZ(t,Uint16Array))return!1;for(var e=0;e<t.length;e++)if(t[e]>=65535)return!0;return!1}function oe(t,e,i,r){return{type:or(t.format),size:r,data:oi(t,e,i),normalize:t.normalize}}function oi(t,e,i){var r=e.buffer,n=e.byteOffset+t.offset,a=t.dimension*i;switch(t.format){case eC.Float32:return new Float32Array(r,n,a);case eC.Int16:return new Int16Array(r,n,a);case eC.Int8:return new Int8Array(r,n,a);case eC.UInt16:return new Uint16Array(r,n,a);case eC.UInt8:return new Uint8Array(r,n,a);default:throw Error("Unsupported vertex format: "+t.format+".")}}function or(e){switch(e){case eC.Float32:return t.BufferDataType.Float;case eC.Int16:return t.BufferDataType.Short;case eC.Int8:return t.BufferDataType.Byte;case eC.UInt16:return t.BufferDataType.UnsignedShort;case eC.UInt8:return t.BufferDataType.UnsignedByte;default:throw Error("Unsupported vertex format: "+e+".")}}a6.create=function(t,e){return new a6(t,e)};var on={POSITION:nV.PositionKind,TEXCOORD0:nV.UVKind,TEXCOORD_0:nV.UVKind,TEXCOORD1:nV.UV2Kind,NORMAL:nV.NormalKind,TANGENT:nV.TangentKind,COLOR:nV.ColorKind,JOINTS:nV.JointsKind,JOINTS_0:nV.JointsKind,WEIGHTS:nV.WeightsKind,WEIGHTS_0:nV.WeightsKind,POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},oa=((eF={})[t.BufferDataType.Float]=4,eF[t.BufferDataType.Int]=4,eF[t.BufferDataType.UnsignedInt]=4,eF[t.BufferDataType.Short]=2,eF[t.BufferDataType.UnsignedShort]=2,eF[t.BufferDataType.Byte]=1,eF[t.BufferDataType.UnsignedByte]=1,eF),oo=1,os=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,h=void 0===u?nm.fromIdentity():u;r.id="Mesh"+oo++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=h}else r.id="Mesh"+oo++,r.name="<unnamed>",r.worldMatrix=nm.fromIdentity(),r._priority=0;return r}iY(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(),this.material=e},r.restore=function(){},r.dispose=function(i){this.destroyed||((null==i?void 0:i.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose(),(null==i?void 0:i.material)!==t.DestroyOptions.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),e.prototype.dispose.call(this))},rk(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(nk),ou="precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;void main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}}",oh="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",ol="#version 100\nprecision mediump float;\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\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#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",oc="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;vec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;}}",of="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;void 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;}",od="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",op="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",om="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);}",ov="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);}",oy="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);}",og="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",ox={},ob=function(){function e(){}return e.registerInclude=function(t,e){ox[t]&&i_.warn('The "'+t+'" shader include already exist.'),ox[t]=e},e.unRegisterInclude=function(t){delete ox[t]},e.unRegisterAllIncludes=function(){Object.keys(ox).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),h=e.genShaderVersion(r),l=e.parseIncludes(a),c=e.isVersion300(l);return(l=e.removeWebGLVersion(l),2!==r||c||(l=e.convertTo300(l,n===t.ShaderType.fragment)),s)?u+l:h+u+l},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=ox[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),oT=function(e){function i(i,r){void 0===r&&(r=4),(n=e.call(this,i)||this).tempRTs=[],n.iterationCount=r;var n,a=n.renderer.engine;return n.thresholdMaterial=nw.create(a,{shader:{vertex:od,fragment:og,glslVersion:t.GLSLVersion.GLSL1}}),n.thresholdMaterial.blending=!1,n.thresholdMaterial.depthTest=!1,n.thresholdMaterial.culling=!1,n.downSampleHMaterial=nw.create(a,{shader:{vertex:od,fragment:om,glslVersion:t.GLSLVersion.GLSL1}}),n.downSampleHMaterial.blending=!1,n.downSampleHMaterial.depthTest=!1,n.downSampleHMaterial.culling=!1,n.downSampleVMaterial=nw.create(a,{shader:{vertex:od,fragment:ov,glslVersion:t.GLSLVersion.GLSL1}}),n.downSampleVMaterial.blending=!1,n.downSampleVMaterial.depthTest=!1,n.downSampleVMaterial.culling=!1,n.upSampleMaterial=nw.create(a,{shader:{vertex:od,fragment:oy,glslVersion:t.GLSLVersion.GLSL1}}),n.upSampleMaterial.blending=!1,n.upSampleMaterial.depthTest=!1,n.upSampleMaterial.culling=!1,n.priority=5e3,n.name="BloomPass",n}iY(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},r.execute=function(e){var i,r,n,a=e.getWidth(),o=e.getHeight(),s=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.thresholdRT=e.getTemporaryRT("_BloomThreshold",a,o,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",s),e.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var u=this.thresholdRT.getColorTextures()[0],h=0;h<this.iterationCount;h++){var l=Math.floor(a/Math.pow(2,h+1)),c=Math.floor(o/Math.pow(2,h+1)),f=e.getTemporaryRT("_BloomDownH"+h,l,c,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",ow(u)),e.blit(u,f,this.downSampleHMaterial);var d=e.getTemporaryRT("_BloomDownV"+h,l,c,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",ow(f.getColorTextures()[0])),e.blit(f.getColorTextures()[0],d,this.downSampleVMaterial),e.releaseTemporaryRT(f),this.tempRTs.push(d),u=d.getColorTextures()[0]}e.releaseTemporaryRT(this.thresholdRT);for(var p=this.iterationCount-1;p>0;p--){var m=Math.floor(a/Math.pow(2,p-1)),v=Math.floor(o/Math.pow(2,p-1)),y=e.getTemporaryRT("_BloomUp"+p,m,v,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf),g=this.tempRTs[p-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",g),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",ow(g)),e.blit(u,y,this.upSampleMaterial),u=y.getColorTextures()[0],this.tempRTs.push(y)}e.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},r.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},r.dispose=function(t){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),e.prototype.dispose.call(this,t)},i}(a3),oS=function(e){function i(i,r){n=e.call(this,i)||this;var n,a,o="PostProcess",s=n.renderer.engine;n.sceneTextureHandle=r||new a1(s);var u=a6.create(s,{name:o,mode:rG.TRIANGLE_STRIP,attributes:((a={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])},a),drawCount:4}),h=nw.create(s,{name:o,shader:{vertex:od,fragment:op,glslVersion:t.GLSLVersion.GLSL1}});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=os.create(s,{name:o,geometry:u,material:h,priority:0}),n.priority=5e3,n.name="ToneMappingPass",n}iY(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=ro({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=ro({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=ro({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=ro({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,a.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*a.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*a.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new e7(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new it(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(a3),oE=1,oC=function(){function e(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=t.globalVolume,a=t.postProcessingEnabled,o=void 0!==a&&a,s=i.engine;if(n&&(this.globalVolume=n),this.postProcessingEnabled=o,this.globalUniforms=new o_,this.renderer=i,o&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");this.drawObjectPass=new a4(i);var u=[this.drawObjectPass];if(this.setRenderPasses(u),o){var h=new a1(s),l=new oT(i,7);l.sceneTextureHandle=h,this.addRenderPass(l);var c=new oS(i,h);this.addRenderPass(c)}this.name="RenderFrame"+oE++,this.camera=e,this.editorTransform=ie.fromArray(void 0===r?[1,1,0,0]:r)}var i=e.prototype;return i.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){var i=(null==e?void 0:e.passes)?e.passes:void 0;i!==t.DestroyOptions.keep&&this.renderPasses.forEach(function(t){t.dispose(i)}),this.renderPasses.length=0,this.disposed=!0},i.setRenderPasses=function(t){this.renderPasses=t.slice()},i.addRenderPass=function(t){this.renderPasses.push(t)},i.removeRenderPass=function(t){e2(this.renderPasses,t)},rk(e,[{key:"isDisposed",get:function(){return this.disposed}}]),e}();function ow(t){return t?new e7(t.getWidth(),t.getHeight()):new e7}var o_=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},oM=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return rk(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),oA=function(){function e(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var i=e.prototype;return i.flush=function(t,e){void 0===t&&(t=!1),void 0===e&&(e=-1),this.currentFrame++;for(var i=e>=0?e:this.maxUnusedFrames,r=0;r<this.temporaryRTs.length;r++){var n=this.temporaryRTs[r];!n.isOccupied&&(t||this.currentFrame-n.lastFrameReleased>i)&&(n.RT.dispose(),this.temporaryRTs.splice(r--,1))}},i.get=function(e,i,r,n,a,o){void 0===n&&(n=0),void 0===a&&(a=t.FilterMode.Linear),void 0===o&&(o=t.RenderTextureFormat.RGBA32);for(var s,u,h,l=i+"_"+r+"_"+n+"_"+a+"_"+o,c=iQ(this.temporaryRTs);!(h=c()).done;){var f=h.value;if(!f.isOccupied&&f.descriptionHash===l)return f.isOccupied=!0,f.RT.name=e,f.RT}var d=t.RenderPassAttachmentStorageType.none;a===t.FilterMode.Linear?s=rG.LINEAR:a===t.FilterMode.Nearest&&(s=rG.NEAREST),o===t.RenderTextureFormat.RGBA32?u=rG.UNSIGNED_BYTE:o===t.RenderTextureFormat.RGBAHalf&&(u=rG.HALF_FLOAT),0===n?d=t.RenderPassAttachmentStorageType.none:16===n?d=t.RenderPassAttachmentStorageType.depth_stencil_opaque:24===n&&(d=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var p=no.create(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:rG.RGBA,format:rG.RGBA,type:u}),m={RT:a0.create({name:e,storeAction:{},viewport:[0,0,i,r],attachments:[p],depthStencilAttachment:{storageType:d}},this.engine.renderer),lastFrameReleased:0,descriptionHash:l,isOccupied:!0};return this.temporaryRTs.push(m),m.RT},i.release=function(t){for(var e,i=iQ(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},i.dispose=function(){for(var t,e=iQ(this.temporaryRTs);!(t=e()).done;)t.value.RT.dispose()},e}(),oP="function"==typeof WebGL2RenderingContext,oI=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},e.setupCapability=function(t){var e,i,r=oP&&eZ(t,WebGL2RenderingContext)?2:1,n=2===r,a=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),s=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),n&&!s&&(s=oR(t,t.HALF_FLOAT)),n&&!u&&(u=oR(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=n||t.getExtension("OES_texture_float")?t.FLOAT:0,l=n?WebGL2RenderingContext.HALF_FLOAT:(null==(i=t.getExtension("OES_texture_half_float"))?void 0:i.HALF_FLOAT_OES)||0;this.compressTextureCapabilityList=new Map([["WEBGL_compressed_texture_astc",!!t.getExtension("WEBGL_compressed_texture_astc")],["WEBKIT_WEBGL_compressed_texture_astc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_astc")],["WEBGL_compressed_texture_etc",!!t.getExtension("WEBGL_compressed_texture_etc")],["WEBKIT_WEBGL_compressed_texture_etc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_etc")],["WEBGL_compressed_texture_etc1",!!t.getExtension("WEBGL_compressed_texture_etc1")],["WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["WEBKIT_WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["EXT_sRGB",!!t.getExtension("EXT_sRGB")]]);var c={floatTexture:h,halfFloatTexture:l,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:s,floatLinear:u,maxTextureAnisotropy:a?t.getParameter(a.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),vertexArrayObject:n||!!this.vaoExt,ktx2Support:!!((e=this.compressTextureCapabilityList).get("WEBGL_compressed_texture_astc")||e.get("WEBKIT_WEBGL_compressed_texture_astc")),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!o,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=c,a&&(this.textureMaxAnisotropyExt=a.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},rk(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function oR(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.CompressTextureCapabilityType=void 0,(tA=t.CompressTextureCapabilityType||(t.CompressTextureCapabilityType={})).astc="WEBGL_compressed_texture_astc",tA.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",tA.etc="WEBGL_compressed_texture_etc",tA.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",tA.etc1="WEBGL_compressed_texture_etc1",tA.pvrtc="WEBGL_compressed_texture_pvrtc",tA.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",tA.sRGB="EXT_sRGB";var oO=function(){function t(t){this.engine=t,this.currentFramebuffer=null,this.disposed=!1,this.blitGeometry=null,this.blitMaterial=null}var e=t.prototype;return e.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},e.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},e.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},e.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},e.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},e.getFramebuffer=function(){return this.currentFramebuffer},e.setFramebuffer=function(t){t?(this.currentFramebuffer=t,this.currentFramebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.currentFramebuffer=null,this.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},e.setViewport=function(t,e,i,r){this.engine.setViewport(t,e,i,r)},e.clear=function(t){this.engine.clear(t)},e.getWidth=function(){return this.engine.getWidth()},e.getHeight=function(){return this.engine.getHeight()},e.getShaderLibrary=function(){return this.engine.getShaderLibrary()},e.renderRenderFrame=function(t){var e=t.renderPasses;if(this.disposed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(r=t.renderer.engine.getShaderLibrary())||r.compileAllShaders(),t.setup(),this.setFramebuffer(null);var i=t.camera;this.renderingData.currentFrame=t,this.renderingData.currentCamera=i,this.setGlobalMatrix("effects_MatrixInvV",i.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",i.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",i.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",i.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",i.position),ix(e);for(var r,n,a=iQ(e);!(n=a()).done;){var o=n.value;this.renderRenderPass(o)}for(var s,u=iQ(e);!(s=u()).done;)s.value.onCameraCleanup(this)},e.renderRenderPass=function(t){this.renderingData.currentPass=t,t.configure(this),t.execute(this)},e.renderMeshes=function(t){for(var e,i=iQ(t);!(e=i()).done;)e.value.render(this)},e.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush(),i.setMatrix("effects_ObjectToWorld",e);try{i.use(this,this.renderingData.currentFrame.globalUniforms)}catch(t){console.error(t),this.engine.renderErrors.add(t);return}var n=t.getIndexBuffer(),a=t.getDrawStart(),o=t.getDrawCount(),s=t.subMeshes;if(s.length>0){var u,h=s[r];a=h.offset,o=n?null!=(u=h.indexCount)?u:0:h.vertexCount}if(!(o<=0)){t.bind(i.shaderVariant);var l=t.instanceCount||void 0;n?this.engine.drawElementsType(t.mode,a,o,l):this.engine.drawArraysType(t.mode,a,o,l)}}},e.getTemporaryRT=function(t,e,i,r,n,a){return this.engine.renderTargetPool.get(t,e,i,r,n,a)},e.releaseTemporaryRT=function(t){this.engine.renderTargetPool.release(t)},e.blit=function(t,e,i){if(!this.blitGeometry){var r;this.blitGeometry=a6.create(this.engine,{mode:rG.TRIANGLE_STRIP,attributes:((r={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])},r),drawCount:4})}this.blitMaterial||(this.blitMaterial=nw.create(this.engine,{shader:{vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos, 0.0, 1.0);\n vTex = (aPos + vec2(1.0)) / 2.0;\n}",fragment:"\nprecision mediump float;\nvarying vec2 vTex;\nuniform sampler2D _MainTex;\nvoid main(){\n gl_FragColor = texture2D(_MainTex, vTex);\n}"}}),this.blitMaterial.blending=!1,this.blitMaterial.depthTest=!1,this.blitMaterial.culling=!1);var n=i||this.blitMaterial;n.setTexture("_MainTex",t);var a=this.currentFramebuffer;if(e){var o=e.viewport,s=o[0],u=o[1],h=o[2],l=o[3];this.setFramebuffer(e),this.setViewport(s,u,h,l)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,nm.IDENTITY,n),this.setFramebuffer(a)},e.dispose=function(){var t,e;this.disposed||(null==(t=this.blitGeometry)||t.dispose(),this.blitGeometry=null,null==(e=this.blitMaterial)||e.dispose(),this.blitMaterial=null,this.disposed=!0)},e.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},t.create=function(e){return new t(e)},rk(t,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),t}(),oV="lookup_texture",oN="offscreen_canvas",oF={},oL=new(function(){function t(){this._maxCachedCount=16,this._canvasPool=Object.create(null),this._cachedCanvasAndContexts=[]}var e=t.prototype;return e.dispose=function(){this.clear()},e.clear=function(){for(var t,e=this,i=iQ(Object.keys(this._canvasPool));!(t=i()).done;){var r=t.value;this._canvasPool[r].forEach(function(t){var i=t.canvas;return e.destroyCanvas(i)}),delete this._canvasPool[r]}this._cachedCanvasAndContexts.length=0},e.getCanvasAndContext=function(t,e){var i=this.getKey(t,e),r=this._canvasPool[i];if(r&&0!==r.length){var n=r.pop();return iS(n),e2(this._cachedCanvasAndContexts,n),0===r.length&&delete this._canvasPool[i],n}return this.createCanvasAndContext(t,e)},e.releaseCanvasAndContext=function(t){var e=t.canvas,i=e.width,r=e.height,n=this.getKey(i,r);this.resetCanvasAndContext(t),this._canvasPool[n]||(this._canvasPool[n]=[]),e1(this._canvasPool[n],t),e2(this._cachedCanvasAndContexts,t),this._cachedCanvasAndContexts.push(t),this.getCachedCount()>this._maxCachedCount&&this.cleanUnusedCachedCanvasPool()},e.createCanvasAndContext=function(t,e){var i,r=(void 0===t&&(t=1),void 0===e&&(e=1),i=oF[oN]?window._createOffscreenCanvas(10,10):document.createElement("canvas")).getContext("2d",{willReadFrequently:!0});return iS(r),i.width=t,i.height=e,{canvas:i,context:r}},e.resetCanvasAndContext=function(t){var e=t.canvas,i=t.context;"resetTransform"in i&&"function"==typeof i.resetTransform?i.resetTransform():i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height)},e.getKey=function(t,e){return(t<<17)+(e<<1)},e.getCachedCount=function(){return this._cachedCanvasAndContexts.length},e.cleanUnusedCachedCanvasPool=function(){for(var t=Math.max(1,Math.ceil(this._cachedCanvasAndContexts.length/2)),e=0;e<t;e++){var i=this._cachedCanvasAndContexts.shift();iS(i);var r=i.canvas,n=r.width,a=r.height,o=this.getKey(n,a),s=this._canvasPool[o];s&&(e2(s,i),0===s.length&&delete this._canvasPool[o]),this.destroyCanvas(i.canvas)}},e.destroyCanvas=function(t){"remove"in t&&"function"==typeof t.remove&&t.remove()},t}()),oD=function(){function e(e,i,r,n,a,o){this.engine=e,this.scaledFontString=i,this.glyphs=new Map,this.currentX=0,this.currentY=0,this.full=!1,this.dirty=!0,this.resolution=o,this.canvas=document.createElement("canvas"),this.canvas.width=Math.ceil(512*o),this.canvas.height=Math.ceil(512*o);var s=this.canvas.getContext("2d",{willReadFrequently:!1});if(!s)throw Error("GlyphAtlas: failed to get 2d context");this.ctx=s,s.font=i,s.textBaseline="alphabetic",s.fillStyle="#ffffff",this.paddingPx=4*o,this.italicScale="italic"===a||"oblique"===a?2:1,this.baselinePx=this.paddingPx+r,this.cellHPx=Math.ceil(r+n+2*this.paddingPx),this.lineHeight=this.cellHPx/o,this.texture=no.create(e,{sourceType:t.TextureSourceType.image,image:this.canvas,target:rG.TEXTURE_2D,flipY:!0,magFilter:rG.LINEAR,minFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,premultiplyAlpha:!0}),this.texture.initialize()}var i=e.prototype;return i.ensureChar=function(t){var e=this.glyphs.get(t);if(e)return e;if(this.full)return null;var i=this.ctx;i.font=this.scaledFontString;var r=i.measureText(t).width,n=Math.max(1,Math.ceil(r*this.italicScale))+2*this.paddingPx,a=this.cellHPx;if(this.currentX+n>this.canvas.width&&(this.currentX=0,this.currentY+=a),this.currentY+a>this.canvas.height)return this.full=!0,console.warn('GlyphAtlas full, dropping char "'+t+'"'),null;var o=this.currentX,s=this.currentY;i.fillText(t,o+this.paddingPx,s+this.baselinePx),this.currentX+=n,this.dirty=!0;var u={px:o,py:s,pw:n,ph:a,advance:r/this.resolution,paddingLeft:this.paddingPx/this.resolution};return this.glyphs.set(t,u),u},i.uploadIfDirty=function(){this.dirty&&(this.texture.updateSource({sourceType:t.TextureSourceType.image,image:this.canvas,target:rG.TEXTURE_2D,flipY:!0,magFilter:rG.LINEAR,minFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,premultiplyAlpha:!0}),this.dirty=!1)},i.dispose=function(){this.texture.dispose(),this.glyphs.clear()},e}(),ok=function(){function t(t){this.engine=t,this.atlases=new Map,this.resolution=t.pixelRatio}var e=t.prototype;return e.getAtlas=function(t,e,i,r){var n=this.engine.pixelRatio;n!==this.resolution&&(this.clear(),this.resolution=n);var a=r+"|"+i+"|"+t+"|"+e+"|"+n,o=this.atlases.get(a);if(o)return o;var s=r+" "+i+" "+t*n+"px "+e,u=oL.getCanvasAndContext(1,1),h=u.context,l=.8*t*n,c=.2*t*n;h.font=s;var f=h.measureText("|\xc9q\xc5M");l=f.actualBoundingBoxAscent||l,c=f.actualBoundingBoxDescent||c,oL.releaseCanvasAndContext(u);var d=new oD(this.engine,s,l,c,r,n);return this.atlases.set(a,d),d},e.uploadDirty=function(){for(var t,e=iQ(this.atlases.values());!(t=e()).done;)t.value.uploadIfDirty()},e.dispose=function(){this.clear()},e.clear=function(){for(var t,e=iQ(this.atlases.values());!(t=e()).done;)t.value.dispose();this.atlases.clear()},t}(),oB={u0:0,v0:0,u1:1,v1:1},oz="aDrawSourceSize",oU="aSourceRect",oG="aMargins",oW="aOptions",oj=function(){function t(t){var e,i;this.engine=t,this.lineShape=new a$,this.bezierShape=new a$,this.triangleShape=new aX,this.rectangleShape=new aj,this.circleShape=new aJ,this.buildPoints=[],this.vertices=[],this.colors=[],this.uvs=[],this.indices=[],this.ninePatchDrawSourceSizes=[],this.ninePatchSourceRects=[],this.ninePatchMargins=[],this.ninePatchOptions=[],this.lineStyle={width:1,alignment:.5,cap:ev.Butt,join:ey.Miter,miterLimit:10},this.currentBatchType="colored",this.currentBatchTexture=null,this.transformStack=[],this.currentTransform=ny.fromIdentity(),this.clipStack=[],this.logicalWidth=1,this.logicalHeight=1,this.geometry=a6.create(this.engine,{attributes:((e={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array([-.5,.5,-.5,-.5,.5,.5,.5,-.5])},e[nV.ColorKind]={type:rG.FLOAT,size:4,data:new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},e[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},e),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),this.ninePatchGeometry=a6.create(this.engine,{attributes:((i={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array(8)},i[nV.ColorKind]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[nV.UVKind]={type:rG.FLOAT,size:2,data:new Float32Array(8)},i[oz]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[oU]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[oG]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[oW]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),this.coloredMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n varying vec4 vColor;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n void main() {\n vec4 color = vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.coloredMaterial.depthTest=!1,this.coloredMaterial.depthMask=!1,this.coloredMaterial.blending=!0,this.texturedMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n vec4 color = texture2D(uMainTexture, vUV) * vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.texturedMaterial.depthTest=!1,this.texturedMaterial.depthMask=!1,this.texturedMaterial.blending=!0,this.ninePatchMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n attribute vec4 aDrawSourceSize;\n attribute vec4 aSourceRect;\n attribute vec4 aMargins;\n attribute vec4 aOptions;\n varying vec4 vColor;\n varying vec2 vUV;\n varying vec4 vDrawSourceSize;\n varying vec4 vSourceRect;\n varying vec4 vMargins;\n varying vec4 vOptions;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n vDrawSourceSize = aDrawSourceSize;\n vSourceRect = aSourceRect;\n vMargins = aMargins;\n vOptions = aOptions;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n varying vec4 vDrawSourceSize;\n varying vec4 vSourceRect;\n varying vec4 vMargins;\n varying vec4 vOptions;\n uniform sampler2D uMainTexture;\n\n float mapNinePatchAxis(\n float pixel,\n float drawSize,\n float sourceSize,\n float marginBegin,\n float marginEnd,\n float repeatMode,\n inout float drawCenter\n ) {\n if (pixel < marginBegin) {\n return pixel / sourceSize;\n } else if (pixel >= drawSize - marginEnd) {\n return (sourceSize - (drawSize - pixel)) / sourceSize;\n } else {\n if (vOptions.z < 0.5) {\n drawCenter -= 1.0;\n }\n\n if (repeatMode < 0.5) {\n float ratio = (pixel - marginBegin) / (drawSize - marginBegin - marginEnd);\n return (marginBegin + ratio * (sourceSize - marginBegin - marginEnd)) / sourceSize;\n } else if (repeatMode < 1.5) {\n float offset = mod(pixel - marginBegin, sourceSize - marginBegin - marginEnd);\n return (marginBegin + offset) / sourceSize;\n } else {\n float drawArea = drawSize - marginBegin - marginEnd;\n float sourceArea = sourceSize - marginBegin - marginEnd;\n float scale = max(1.0, floor(drawArea / max(sourceArea, 0.0000001) + 0.5));\n float ratio = mod((pixel - marginBegin) / drawArea * scale, 1.0);\n return (marginBegin + ratio * sourceArea) / sourceSize;\n }\n }\n }\n\n void main() {\n vec2 pixel = vec2(vUV.x, 1.0 - vUV.y) * vDrawSourceSize.xy;\n float drawCenter = 2.0;\n vec2 sourceUV = vec2(\n mapNinePatchAxis(\n pixel.x, vDrawSourceSize.x, vDrawSourceSize.z,\n vMargins.x, vMargins.z, vOptions.x, drawCenter\n ),\n mapNinePatchAxis(\n pixel.y, vDrawSourceSize.y, vDrawSourceSize.w,\n vMargins.y, vMargins.w, vOptions.y, drawCenter\n )\n );\n\n if (drawCenter < 0.5) {\n discard;\n }\n\n vec2 uv = vec2(\n vSourceRect.x + sourceUV.x * vSourceRect.z,\n vSourceRect.y - sourceUV.y * vSourceRect.w\n );\n vec4 color = texture2D(uMainTexture, uv) * vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.ninePatchMaterial.depthTest=!1,this.ninePatchMaterial.depthMask=!1,this.ninePatchMaterial.blending=!0,this.textMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n vec4 textureColor = texture2D(uMainTexture, vUV);\n float alpha = textureColor.a * vColor.a;\n vec3 rgb = textureColor.rgb * vColor.rgb * vColor.a;\n gl_FragColor = vec4(rgb, alpha);\n }"}}),this.textMaterial.depthTest=!1,this.textMaterial.depthMask=!1,this.textMaterial.blending=!0,this.textCache=new ok(t)}var e=t.prototype;return e.begin=function(){this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.uvs.length=0,this.ninePatchDrawSourceSizes.length=0,this.ninePatchSourceRects.length=0,this.ninePatchMargins.length=0,this.ninePatchOptions.length=0,this.transformStack=[],this.currentTransform=ny.fromIdentity(),this.clipStack=[],this.currentBatchType="colored",this.currentBatchTexture=null,this.engine.setScissorTest(!1);var t=this.engine.canvas.getBoundingClientRect(),e=t.width||this.engine.canvas.width/this.engine.pixelRatio||1,i=t.height||this.engine.canvas.height/this.engine.pixelRatio||1;this.logicalWidth=e,this.logicalHeight=i;var r=new nm(2/e,0,0,0,0,-2/i,0,0,0,0,-1,0,-1,1,0,1);this.coloredMaterial.setMatrix("effects_MatrixVP",r),this.texturedMaterial.setMatrix("effects_MatrixVP",r),this.textMaterial.setMatrix("effects_MatrixVP",r),this.ninePatchMaterial.setMatrix("effects_MatrixVP",r)},e.pushTransform=function(t){this.transformStack.push(this.currentTransform.clone()),this.currentTransform=this.currentTransform.multiply(t)},e.popTransform=function(){var t=this.transformStack.pop();if(!t){console.warn("Render2D: 变换栈为空,无法弹出");return}this.currentTransform=t},e.pushClipRect=function(t,e,i,r){for(var n,a=this.currentTransform.elements,o=1/0,s=1/0,u=-1/0,h=-1/0,l=iQ([[t,e],[t+i,e],[t,e+r],[t+i,e+r]]);!(n=l()).done;){var c=n.value,f=a[0]*c[0]+a[3]*c[1]+a[6],d=a[1]*c[0]+a[4]*c[1]+a[7];o=Math.min(o,f),s=Math.min(s,d),u=Math.max(u,f),h=Math.max(h,d)}var p=this.clipStack[this.clipStack.length-1];p&&(o=Math.max(o,p.x),s=Math.max(s,p.y),u=Math.min(u,p.x+p.width),h=Math.min(h,p.y+p.height));var m={x:o,y:s,width:Math.max(0,u-o),height:Math.max(0,h-s)};this.clipStack.push(m),this.clipRectsEqual(p,m)||(this.flushBatch(),this.applyClipRect(m))},e.popClipRect=function(){var t=this.clipStack.pop();if(!t){console.warn("Graphics: clip stack is empty.");return}var e=this.clipStack[this.clipStack.length-1];this.clipRectsEqual(t,e)||(this.flushBatch(),e?this.applyClipRect(e):this.engine.setScissorTest(!1))},e.end=function(){this.flushBatch(),this.clipStack=[],this.engine.setScissorTest(!1)},e.ensureBatch=function(t,e){void 0===e&&(e=null),!(this.currentBatchType===t&&("colored"===t||this.currentBatchTexture===e))&&this.currentVertexCount>0&&this.flushBatch(),this.currentBatchType=t,this.currentBatchTexture=e},e.applyClipRect=function(t){var e=this.engine.canvas.width,i=this.engine.canvas.height,r=e/this.logicalWidth,n=i/this.logicalHeight,a=Math.max(0,Math.min(e,Math.floor(t.x*r))),o=Math.max(0,Math.min(i,Math.floor(t.y*n))),s=Math.max(a,Math.min(e,Math.ceil((t.x+t.width)*r))),u=Math.max(o,Math.min(i,Math.ceil((t.y+t.height)*n)));this.engine.setScissorTest(!0),this.engine.setScissor(a,i-u,s-a,u-o)},e.clipRectsEqual=function(t,e){return t&&e?t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height:t===e},e.flushBatch=function(){if(0!==this.currentVertexCount&&0!==this.currentIndexCount){this.textCache.uploadDirty();var t=new Float32Array(this.vertices),e=new Float32Array(this.colors),i=new Float32Array(this.uvs),r=new Uint16Array(this.indices),n="ninePatch"===this.currentBatchType?this.ninePatchGeometry:this.geometry;if(this.updateAttributeData(n,nV.PositionKind,t,2),this.updateAttributeData(n,nV.ColorKind,e,4),this.updateAttributeData(n,nV.UVKind,i,2),"ninePatch"===this.currentBatchType&&(this.updateAttributeData(n,oz,new Float32Array(this.ninePatchDrawSourceSizes),4),this.updateAttributeData(n,oU,new Float32Array(this.ninePatchSourceRects),4),this.updateAttributeData(n,oG,new Float32Array(this.ninePatchMargins),4),this.updateAttributeData(n,oW,new Float32Array(this.ninePatchOptions),4)),n.setIndexData(r),n.setDrawCount(this.currentIndexCount),"textured"===this.currentBatchType||"text"===this.currentBatchType||"ninePatch"===this.currentBatchType){a="text"===this.currentBatchType?this.textMaterial:"ninePatch"===this.currentBatchType?this.ninePatchMaterial:this.texturedMaterial;var a,o,s=null!=(o=this.currentBatchTexture)?o:this.engine.whiteTexture;a.setTexture("uMainTexture",s)}else a=this.coloredMaterial;this.engine.renderer.drawGeometry(n,nm.IDENTITY,a),this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.uvs.length=0,this.ninePatchDrawSourceSizes.length=0,this.ninePatchSourceRects.length=0,this.ninePatchMargins.length=0,this.ninePatchOptions.length=0}},e.updateAttributeData=function(t,e,i,r){var n,a=null==(n=t.getVertexBuffer(e))?void 0:n.getBuffer();if(a&&i.byteLength>a.capacity){t.setVerticesBuffer(new nV(this.engine,i,e,{updatable:!0,size:r}));return}t.setAttributeData(e,i)},e.drawLines=function(t,e,i){if(void 0===e&&(e=ii.WHITE),void 0===i&&(i=1),!t||t.length<4||t.length%2!=0){console.warn("drawLines: 至少需要2个点(4个数值),且数组长度必须为偶数");return}var r=t.length/2,n=t[0]===t[t.length-2]&&t[1]===t[t.length-1],a=n?r-1:r,o=this.lineShape.points;o.length=0;for(var s=0;s<a;s++)o.push(t[2*s],t[2*s+1]);this.ensureBatch("colored"),this.buildShapeLine(this.lineShape,e,i,n)},e.drawLine=function(t,e,i,r,n,a){void 0===n&&(n=ii.WHITE),void 0===a&&(a=1);var o=this.lineShape.points;o.length=0,o.push(t,e,i,r),this.ensureBatch("colored"),this.buildShapeLine(this.lineShape,n,a,!1)},e.drawBezier=function(t,e,i,r,n,a,o,s,u,h){void 0===u&&(u=ii.WHITE),void 0===h&&(h=1);var l=this.bezierShape.points;l.length=0,l.push(t,e),aH(l,t,e,i,r,n,a,o,s),this.ensureBatch("colored"),this.buildShapeLine(this.bezierShape,u,h,!1)},e.drawTriangle=function(t,e,i,r,n,a,o,s){void 0===o&&(o=ii.WHITE),void 0===s&&(s=1),this.setTriangleShape(t,e,i,r,n,a),this.ensureBatch("colored"),this.buildShapeLine(this.triangleShape,o,s,!0)},e.drawRectangle=function(t,e,i,r,n,a){void 0===n&&(n=ii.WHITE),void 0===a&&(a=1),this.setRectangleShape(t,e,i,r,0),this.ensureBatch("colored"),this.buildShapeLine(this.rectangleShape,n,a,!0)},e.drawCircle=function(t,e,i,r,n){void 0===r&&(r=ii.WHITE),void 0===n&&(n=1),this.setCircleShape(t,e,i),this.ensureBatch("colored"),this.buildShapeLine(this.circleShape,r,n,!0)},e.fillTriangle=function(t,e,i,r,n,a,o){void 0===o&&(o=ii.WHITE),this.setTriangleShape(t,e,i,r,n,a),this.ensureBatch("colored"),this.buildShape(this.triangleShape,o)},e.fillRectangle=function(t,e,i,r,n){void 0===n&&(n=ii.WHITE),this.ensureBatch("colored"),this.pushQuad(t,e,i,r,n)},e.fillCircle=function(t,e,i,r){void 0===r&&(r=ii.WHITE),this.setCircleShape(t,e,i),this.ensureBatch("colored"),this.buildShape(this.circleShape,r)},e.drawTexture=function(t,e,i,r,n,a,o){void 0===a&&(a=oB),void 0===o&&(o=ii.WHITE),this.ensureBatch("textured",n),this.pushQuad(t,e,i,r,o,a)},e.drawNinePatch=function(t,e,i,r,n,a,o){if(void 0===o&&(o=ii.WHITE),!(i<=0)&&!(r<=0)&&!(a.sourceWidth<=0)&&!(a.sourceHeight<=0)){this.ensureBatch("ninePatch",n);var s,u,h,l=a.sourceX/n.width,c=1-a.sourceY/n.height,f=a.sourceWidth/n.width,d=a.sourceHeight/n.height,p=null!=(s=a.horizontalMode)?s:0,m=null!=(u=a.verticalMode)?u:0,v=Number(null==(h=a.drawCenter)||h);this.pushQuad(t,e,i,r,o,oB);for(var y=0;y<4;y++)this.ninePatchDrawSourceSizes.push(i,r,a.sourceWidth,a.sourceHeight),this.ninePatchSourceRects.push(l,c,f,d),this.ninePatchMargins.push(a.marginLeft,a.marginTop,a.marginRight,a.marginBottom),this.ninePatchOptions.push(p,m,v,0)}},e.drawText=function(t,e,i,r,n,a,o,s){if(void 0===n&&(n=ii.WHITE),void 0===a&&(a="sans-serif"),void 0===o&&(o="normal"),void 0===s&&(s="normal"),i){var u=this.textCache.getAtlas(r,a,o,s);this.ensureBatch("text",u.texture);for(var h=u.lineHeight,l=t,c=Array.from(i),f=0;f<c.length;f++){var d=u.ensureChar(c[f]);if(d){var p=u.canvas.width,m=u.canvas.height,v=d.px/p,y=(d.px+d.pw)/p,g=1-(d.py+d.ph)/m,x=1-d.py/m;this.pushQuad(l-d.paddingLeft,e,d.pw/u.resolution,h,n,{u0:v,v0:g,u1:y,v1:x}),l+=d.advance}}}},e.measureText=function(t,e,i,r,n){void 0===i&&(i="sans-serif"),void 0===r&&(r="normal"),void 0===n&&(n="normal");for(var a,o=this.textCache.getAtlas(e,i,r,n),s=Array.from(t),u=[],h=0,l=iQ(s);!(a=l()).done;){var c,f,d=a.value,p=null!=(f=null==(c=o.ensureChar(d))?void 0:c.advance)?f:0;u.push(p),h+=p}return{width:h,lineHeight:o.lineHeight,advances:u}},e.dispose=function(){this.geometry.dispose(),this.ninePatchGeometry.dispose(),this.coloredMaterial.dispose(),this.texturedMaterial.dispose(),this.textMaterial.dispose(),this.ninePatchMaterial.dispose(),this.textCache.dispose()},e.buildShape=function(t,e){var i=this.buildPoints,r=this.indices.length,n=this.vertices.length/2;i.length=0,t.build(i,this.getScreenScale()),t.triangulate(i,this.vertices,n,this.indices,r),this.applyTransformAndColor(n,this.vertices.length/2-n,e)},e.buildShapeLine=function(t,e,i,r){void 0===r&&(r=!1);var n=this.buildPoints;this.indices.length;var a=this.vertices.length/2;n.length=0,t.build(n,this.getScreenScale()),this.lineStyle.width=i,aU(n,this.lineStyle,!1,r,this.vertices,2,a,this.indices),this.applyTransformAndColor(a,this.vertices.length/2-a,e)},e.getScreenScale=function(){var t=this.currentTransform.elements,e=Math.hypot(t[0],t[1]),i=Math.hypot(t[3],t[4]);return Math.max(this.engine.canvas.width/this.logicalWidth*e,this.engine.canvas.height/this.logicalHeight*i,1)},e.setTriangleShape=function(t,e,i,r,n,a){this.triangleShape.x=t,this.triangleShape.y=e,this.triangleShape.x2=i,this.triangleShape.y2=r,this.triangleShape.x3=n,this.triangleShape.y3=a},e.setRectangleShape=function(t,e,i,r,n){this.rectangleShape.x=t,this.rectangleShape.y=e,this.rectangleShape.width=i,this.rectangleShape.height=r,this.rectangleShape.roundness=n},e.setCircleShape=function(t,e,i){this.circleShape.x=t,this.circleShape.y=e,this.circleShape.radius=i},e.applyTransformAndColor=function(t,e,i){for(var r=0;r<e;r++){var n=(t+r)*2,a=(t+r)*4;this.applyTransform(this.vertices[n],this.vertices[n+1],this.vertices,n),this.colors[a]=i.r,this.colors[a+1]=i.g,this.colors[a+2]=i.b,this.colors[a+3]=i.a,this.uvs[n]=0,this.uvs[n+1]=0}},e.pushQuad=function(t,e,i,r,n,a){for(var o=this.vertices.length/2,s=[[t,e],[t+i,e],[t,e+r],[t+i,e+r]],u=a?a.u0:0,h=a?a.v0:0,l=a?a.u1:0,c=a?a.v1:0,f=[[u,c],[l,c],[u,h],[l,h]],d=0;d<4;d++){var p=(o+d)*2,m=(o+d)*4;this.applyTransform(s[d][0],s[d][1],this.vertices,p),this.colors[m]=n.r,this.colors[m+1]=n.g,this.colors[m+2]=n.b,this.colors[m+3]=n.a,this.uvs[p]=f[d][0],this.uvs[p+1]=f[d][1]}this.indices.push(o,o+1,o+2,o+2,o+1,o+3)},e.applyTransform=function(t,e,i,r){void 0===r&&(r=0);var n=this.currentTransform.elements;i[r]=n[0]*t+n[3]*e+n[6],i[r+1]=n[1]*t+n[4]*e+n[7]},rk(t,[{key:"currentVertexCount",get:function(){return this.vertices.length/2}},{key:"currentIndexCount",get:function(){return this.indices.length}}]),t}(),oX=function(t){function e(e){var i;return(i=t.call(this,e)||this).getHitTestParams=function(t){var e=i.transform.getWorldMatrix();i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:i.frameClipMasks}},i}iY(e,t);var i=e.prototype;return i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++){var i=this.materials[e];this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),i,t,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData(nV.PositionKind);if(t){var e=n6(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.mask;i&&this.maskManager.setMaskOptions(this.engine,i)},e}(nk);eq([i3(void 0,void 0)],oX.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}iY(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new ie;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(oX),t.EffectComponent=eq([i1(eS.EffectComponent)],t.EffectComponent);var oH=new it(0,0,0),oY=new it(0,0,0),oZ=function(){this.target=null,this.weight=1};t.PositionConstraint=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.positionAtRest=new it(0,0,0),e.positionOffset=new it(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}iY(e,t);var i=e.prototype;return i.onStart=function(){var t=this.item.transform.getWorldPosition();this.positionAtRest.copyFrom(t)},i.onUpdate=function(t){if(0!==this.targets.length){oH.set(0,0,0);for(var e,i=0,r=iQ(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var a=n.target.transform.getWorldPosition(),o=n.weight;oH.x+=a.x*o,oH.y+=a.y*o,oH.z+=a.z*o,i+=o}}i>0&&(oH.x/=i,oH.y/=i,oH.z/=i),oH.x+=this.positionOffset.x,oH.y+=this.positionOffset.y,oH.z+=this.positionOffset.z,oY.set(this.lerp(this.positionAtRest.x,oH.x,this.weight),this.lerp(this.positionAtRest.y,oH.y,this.weight),this.lerp(this.positionAtRest.z,oH.z,this.weight)),oH.copyFrom(this.item.transform.getWorldPosition());var s=this.constrainX?oY.x:oH.x,u=this.constrainY?oY.y:oH.y,h=this.constrainZ?oY.z:oH.z;this.item.transform.setWorldPosition(s,u,h)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new oZ;i.target=t,i.weight=Math.max(0,Math.min(1,e)),this.targets.push(i)},i.removeTarget=function(t){var e=this.targets.findIndex(function(e){return e.target===t});-1!==e&&this.targets.splice(e,1)},i.clearTargets=function(){this.targets=[]},i.setPositionOffset=function(t,e,i){this.positionOffset.set(t,e,i)},i.setWeight=function(t){this.weight=Math.max(0,Math.min(1,t))},i.lerp=function(t,e,i){return t+(e-t)*i},i.fromData=function(e){t.prototype.fromData.call(this,e),this.positionAtRest.copyFrom(e.positionAtRest),this.positionOffset.copyFrom(e.positionOffset),this.weight=e.weight,this.constrainX=e.constrainX,this.constrainY=e.constrainY,this.constrainZ=e.constrainZ,this.targets=[];for(var i,r=iQ(e.targets);!(i=r()).done;){var n=i.value,a=new oZ;a.target=this.engine.findObject(n.target),a.weight=n.weight,this.targets.push(a)}},e}(rB),t.PositionConstraint=eq([i1("PositionConstraint")],t.PositionConstraint),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return iY(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(rB),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=eq([i1(eS.PostProcessVolume)],t.PostProcessVolume);var oq=function(t){function e(e){(i=t.call(this,e)||this).visible=!0,i._color=new ii(1,1,1,1),i.getHitTestParams=function(t){var e=nm.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.boundingBoxInfo.setGeometry(i.geometry,e);var n,a=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===tH.FRONT,clipMasks:i.frameClipMasks}}},i.renderer={renderMode:t$.MESH,blending:tX.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:tH.DOUBLE,mask:0},i.defaultGeometry=a6.create(i.engine,{attributes:((r={})[nV.PositionKind]={type:rG.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},r[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},r),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),i.geometry=i.defaultGeometry;var i,r,n=nw.create(i.engine,{shader:{fragment:oh,vertex:ou,shared:!0}});return i.material=n,i.material.setColor("_Color",new ii(1,1,1,1)),i.configureMaterial(i.renderer),i}iY(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){eZ(t,ii)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return eY(function(){var i;return eK(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,no.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}})})()},i.onUpdate=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),(this.renderer.renderMode===t$.BILLBOARD||this.renderer.renderMode===t$.VERTICAL_BILLBOARD||this.renderer.renderMode===t$.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale)}},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t,this),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.materials[e],t,e)},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle(this.transform.size)},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData(nV.PositionKind);if(t){var e=n6(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.texture,a=this.material;a.blending=!0,a.depthTest=!0,a.depthMask=i,rY(a,r),rZ(a,e),a.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',a.setVector4("_TexOffset",new ie(0,0,1,1)),a.setTexture("_MainTex",n);var o=rH(r),s=new ie;return s.x=t.occlusion?+t.transparentOcclusion:1,s.y=o,s.z=t.renderMode,a.setVector4("_TexParams",s),0===s.x||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},i.draw=function(t){for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.materials[e],e)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,a,o=null!=(i=e.renderer)?i:{},s=e.mask;s&&this.maskManager.setMaskOptions(this.engine,s),this.renderer={renderMode:null!=(r=o.renderMode)?r:t$.MESH,blending:null!=(n=o.blending)?n:tX.ALPHA,texture:o.texture?this.engine.findObject(o.texture):this.engine.whiteTexture,occlusion:!!o.occlusion,transparentOcclusion:!!o.transparentOcclusion||this.maskManager.isMask,side:null!=(a=o.side)?a:tH.DOUBLE,mask:1},this.configureMaterial(this.renderer)},rk(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(nk);function oK(t,e,i){var r=t.elements;r[0]*=e,r[1]*=e,r[2]*=e,r[3]*=e,r[4]*=i,r[5]*=i,r[6]*=i,r[7]*=i}function oQ(t){return(oQ=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function oJ(t){var e="function"==typeof Map?new Map:void 0;return(oJ=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return aM(t,arguments,oQ(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),iH(i,t)})(t)}t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}iY(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",i*this.amountOfMotion),o.setFloat("_PosZ",r*this.amountOfMotion)}},i}(rB),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=eq([i1("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tP=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tP.Circular=0]="Circular",tP[tP.Linear=1]="Linear",t.FrameComponent=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.color=new ii(1,1,1,1),i.worldMatrix=new nm,i.getHitTestParams=function(e){if(e){var r=nm.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),n=function(t,e){return r.transformPoint(new it(t,e,0),new it)},a=n(-.5,.5),o=n(.5,.5),s=n(.5,-.5),u=n(-.5,-.5),h=i.getBorderWorldThickness(a,o),l=i.getBorderTriangles(a,o,s,u,h);return{type:t.HitTestType.triangle,triangles:l,clipMasks:i.frameClipMasks}}},i}iY(i,e);var r=i.prototype;return r.onAwake=function(){this.clipGeometry=a6.create(this.engine,{attributes:((t={})[nV.PositionKind]={type:rG.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},t[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},t),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6});var t,e=nw.create(this.engine,{shader:{fragment:"\n precision mediump float;\n\n uniform vec4 _Color;\n\n void main() {\n gl_FragColor = _Color;\n }\n ",vertex:"\n precision highp float;\n attribute vec3 aPos;\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n void main() {\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * vec4(aPos, 1.0);\n }\n ",shared:!0}});e.depthTest=!0,e.depthMask=!1,e.setColor("_Color",this.color),this.material=e},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},r.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),oK(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},r.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},r.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),oK(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},r.fromData=function(t){e.prototype.fromData.call(this,t),t.color&&this.color.copyFrom(t.color)},r.getBorderWorldThickness=function(t,e){var i,r=null==(i=this.item.composition)?void 0:i.camera;if(!r)return .05;var n=r.worldToScreenPoint(t),a=r.worldToScreenPoint(e),o=Math.hypot(a.x-n.x,a.y-n.y)/(Math.hypot(e.x-t.x,e.y-t.y)||1);return o>0?13.6/o:.05},r.getBorderTriangles=function(t,e,i,r,n){var a=e.clone().subtract(t).normalize(),o=t.clone().subtract(r).normalize(),s=function(t,e,i){return t.clone().addScaledVector(a,e).addScaledVector(o,i)},u=n/2,h=s(t,-u,u),l=s(e,u,u),c=s(i,u,-u),f=s(r,-u,-u),d=s(t,u,-u),p=s(e,-u,-u),m=s(i,-u,u),v=s(r,u,u),y=function(t,e,i,r){return[{p0:t,p1:e,p2:i},{p0:t,p1:i,p2:r}]};return[].concat(y(h,l,p,d),y(l,c,m,p),y(c,f,v,m),y(f,h,d,v))},r.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},r.setClipRectangleRecursive=function(t){for(var e,i=iQ(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(nk);n&&e1(n.frameClipMasks,this),this.setClipRectangleRecursive(r)}},i}(nk),t.FrameComponent=eq([i1("FrameComponent")],t.FrameComponent),t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}iY(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(rB),t.CameraController=eq([i1(eS.CameraController)],t.CameraController);var o$=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX));function o0(t,e){var i=t.elements;return new e7(i[0]*e.x+i[3]*e.y+i[6],i[1]*e.x+i[4]*e.y+i[7])}function o1(t,e){var i=t.elements;return new e7(i[0]*e.x+i[3]*e.y,i[1]*e.x+i[4]*e.y)}t.MouseButton=void 0,(tI=t.MouseButton||(t.MouseButton={}))[tI.None=0]="None",tI[tI.Left=1]="Left",tI[tI.Right=2]="Right",tI[tI.Middle=3]="Middle",tI[tI.WheelUp=4]="WheelUp",tI[tI.WheelDown=5]="WheelDown",tI[tI.WheelLeft=6]="WheelLeft",tI[tI.WheelRight=7]="WheelRight",tI[tI.Xbutton1=8]="Xbutton1",tI[tI.Xbutton2=9]="Xbutton2",t.MouseButtonMask=void 0,(tR=t.MouseButtonMask||(t.MouseButtonMask={}))[tR.None=0]="None",tR[tR.Left=1]="Left",tR[tR.Right=2]="Right",tR[tR.Middle=4]="Middle",tR[tR.Xbutton1=128]="Xbutton1",tR[tR.Xbutton2=256]="Xbutton2",t.KeyLocation=void 0,(tO=t.KeyLocation||(t.KeyLocation={}))[tO.Unspecified=0]="Unspecified",tO[tO.Left=1]="Left",tO[tO.Right=2]="Right";var o2=function(){function t(){this.device=0,this.pressed=!1,this.canceled=!1,this._accepted=!1}var e=t.prototype;return e.accept=function(){this._accepted=!0},e.clearAccepted=function(){this._accepted=!1},e.isAccepted=function(){return this._accepted},e.isPressed=function(){return this.pressed&&!this.canceled},e.isReleased=function(){return!this.pressed&&!this.canceled},e.isCanceled=function(){return this.canceled},e.isEcho=function(){return!1},e.xformedBy=function(t){return this},t}();o2.deviceIdEmulation=-1,o2.deviceIdInternal=-2,o2.deviceIdKeyboard=16,o2.deviceIdMouse=32;var o3=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.commandOrControlAutoremap=!1,e.shiftPressed=!1,e.altPressed=!1,e.metaPressed=!1,e.ctrlPressed=!1,e}return iY(e,t),e.prototype.copyModifiersTo=function(t){t.device=this.device,t.pressed=this.pressed,t.canceled=this.canceled,t.commandOrControlAutoremap=this.commandOrControlAutoremap,t.shiftPressed=this.shiftPressed,t.altPressed=this.altPressed,t.metaPressed=this.metaPressed,t.ctrlPressed=this.ctrlPressed},e}(oJ(o2)),o4=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.keycode="",i.physicalKeycode="",i.keyLabel="",i.unicode=0,i.location=t.KeyLocation.Unspecified,i.echo=!1,i}return iY(i,e),i.prototype.isEcho=function(){return this.echo},i}(o3),o5=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.buttonMask=t.MouseButtonMask.None,i.position=new e7,i.globalPosition=new e7,i}return iY(i,e),i.prototype.copyMouseTo=function(t){this.copyModifiersTo(t),t.buttonMask=this.buttonMask,t.position.copyFrom(this.position),t.globalPosition.copyFrom(this.globalPosition)},i}(o3),o6=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.factor=1,i.buttonIndex=t.MouseButton.None,i.doubleClick=!1,i}return iY(i,e),i.prototype.xformedBy=function(t){var e=new i;return this.copyMouseTo(e),e.position.copyFrom(o0(t,this.position)),e.factor=this.factor,e.buttonIndex=this.buttonIndex,e.doubleClick=this.doubleClick,e},i}(o5),o8=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.tilt=new e7,e.pressure=0,e.relative=new e7,e.screenRelative=new e7,e.velocity=new e7,e.screenVelocity=new e7,e.penInverted=!1,e}return iY(e,t),e.prototype.xformedBy=function(t){var i=new e;return this.copyMouseTo(i),i.position.copyFrom(o0(t,this.position)),i.tilt.copyFrom(this.tilt),i.pressure=this.pressure,i.relative.copyFrom(o1(t,this.relative)),i.screenRelative.copyFrom(this.screenRelative),i.velocity.copyFrom(o1(t,this.velocity)),i.screenVelocity.copyFrom(this.screenVelocity),i.penInverted=this.penInverted,i},e}(o5),o9=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.index=0,e.position=new e7,e.doubleTap=!1,e}return iY(e,t),e.prototype.xformedBy=function(t){var i=new e;return i.device=this.device,i.pressed=this.pressed,i.canceled=this.canceled,i.index=this.index,i.position.copyFrom(o0(t,this.position)),i.doubleTap=this.doubleTap,i},e}(oJ(o2)),o7=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.index=0,e.position=new e7,e.relative=new e7,e.screenRelative=new e7,e.velocity=new e7,e.screenVelocity=new e7,e.pressure=0,e.tilt=new e7,e.penInverted=!1,e}return iY(e,t),e.prototype.xformedBy=function(t){var i=new e;return i.device=this.device,i.pressed=this.pressed,i.canceled=this.canceled,i.index=this.index,i.position.copyFrom(o0(t,this.position)),i.relative.copyFrom(o1(t,this.relative)),i.screenRelative.copyFrom(this.screenRelative),i.velocity.copyFrom(o1(t,this.velocity)),i.screenVelocity.copyFrom(this.screenVelocity),i.pressure=this.pressure,i.tilt.copyFrom(this.tilt),i.penInverted=this.penInverted,i},e}(oJ(o2)),st="click",se="touchstart",si="touchmove",sr="touchend";t.PointerEventType=void 0,(tV=t.PointerEventType||(t.PointerEventType={}))[tV.PointerDown=0]="PointerDown",tV[tV.PointerUp=1]="PointerUp",tV[tV.PointerMove=2]="PointerMove";var sn=function(e){function i(i,r){var n;return void 0===r&&(r=!1),(n=e.call(this)||this).engine=i,n.allowPropagation=r,n.skipPointerMovePicking=!0,n.emulateMouseFromTouch=!0,n.emulateTouchFromMouse=!1,n._enabled=!0,n.handlers={},n.nativeHandlers=[],n.target=null,n.mouseState=null,n.mouseButtonMask=t.MouseButtonMask.None,n.touchStates=new Map,n.mouseFromTouchIndex=null,n.touchFromMousePressed=!1,n.addedTabIndex=!1,n.addedOutlineStyle=!1,n.onNativeWheel=function(e){if(n.enabled&&n.target){var i=n.getCanvasPosition(e.clientX,e.clientY),r=!1;0!==e.deltaY&&(r=n.pushWheelButton(e.deltaY<0?t.MouseButton.WheelUp:t.MouseButton.WheelDown,so(e.deltaY,e.deltaMode),i,e)||r),0!==e.deltaX&&(r=n.pushWheelButton(e.deltaX<0?t.MouseButton.WheelLeft:t.MouseButton.WheelRight,so(e.deltaX,e.deltaMode),i,e)||r),n.consumeNativeEvent(e,r)}},n.onNativeKeyDown=function(t){n.handleNativeKey(t,!0)},n.onNativeKeyUp=function(t){n.handleNativeKey(t,!1)},n.onNativeMouseDown=function(t){n.handleNativeMouseDown(t)},n.onNativeMouseMove=function(t){if(n.enabled&&n.target){var e,i=n.getCanvasPosition(t.clientX,t.clientY),r=null!=(e=n.mouseState)?e:n.createPointerState(i);n.mouseState=r;var a=new e7(i.x-r.last.x,i.y-r.last.y),o=n.getVelocity(r,i),s=n.pushNativeMouseMotion(t,i,a,o);if(r.inputHandled||(r.inputHandled=s),!s&&(!r.pressed||!r.inputHandled)){var u=n.createPointerEvent(t,i,r,o);n.dispatchEvent(si,u)}n.updatePointerState(r,i),n.consumeNativeEvent(t,s)}},n.onNativeMouseUp=function(t){if(n.enabled&&n.target){n.setMouseButtonPressed(t.button,!1);var e=n.getCanvasPosition(t.clientX,t.clientY),i=n.mouseState;if(null==i?void 0:i.pressed){var r=n.pushNativeMouseButton(t,e,!1),a=n.createPointerEvent(t,e,i);!i.inputHandled&&!r&&n.isClick(i,e)&&n.dispatchEvent(st,a),r||i.inputHandled||n.dispatchEvent(sr,a),n.mouseState=null,n.consumeNativeEvent(t,r||i.inputHandled||!n.allowPropagation)}}},n.onNativeTouchStart=function(t){if(n.enabled){n.focusTarget();for(var e,i=iQ(Array.from(t.changedTouches));!(e=i()).done;){var r=e.value,a=n.getCanvasPosition(r.clientX,r.clientY),o=n.createPointerState(a);n.touchStates.set(r.identifier,o),o.pressed=!0;var s=n.pushNativeScreenTouch(r.identifier,a,!0,!1,!1);if(o.inputHandled=s,!s){var u=n.createPointerEvent(t,a,o);n.dispatchEvent(se,u)}n.consumeNativeEvent(t,s)}n.preventTouchDefaults(t)}},n.onNativeTouchMove=function(t){if(n.enabled){for(var e,i=iQ(Array.from(t.changedTouches));!(e=i()).done;){var r,a=e.value,o=n.getCanvasPosition(a.clientX,a.clientY),s=null!=(r=n.touchStates.get(a.identifier))?r:n.createPointerState(o);n.touchStates.set(a.identifier,s);var u=new e7(o.x-s.last.x,o.y-s.last.y),h=n.getVelocity(s,o),l=n.pushNativeScreenDrag(a.identifier,o,u,h);if(s.inputHandled||(s.inputHandled=l),!l&&!s.inputHandled){var c=n.createPointerEvent(t,o,s,h);n.dispatchEvent(si,c)}n.updatePointerState(s,o),n.consumeNativeEvent(t,l)}n.preventTouchDefaults(t)}},n.onNativeTouchEnd=function(t){n.handleNativeTouchEnd(t,!1)},n.onNativeTouchCancel=function(t){n.handleNativeTouchEnd(t,!0)},n.onCanvasFocus=function(){n.emit("canvasFocus")},n.onCanvasBlur=function(){n.emit("canvasBlur")},n}iY(i,e);var r=i.prototype;return r.bindListeners=function(t){this.unbindListeners(),this.target=t,t&&"undefined"!=typeof window&&(t.hasAttribute("tabindex")||(t.tabIndex=0,this.addedTabIndex=!0),t.style.outline||(t.style.outline="none",this.addedOutlineStyle=!0),this.addNativeHandler(t,"mousedown",this.onNativeMouseDown),this.addNativeHandler(t,"mouseup",this.onNativeMouseUp),this.addNativeHandler(window,"mouseup",this.onNativeMouseUp),this.addNativeHandler(window,"pointermove",this.onNativeMouseMove),this.addNativeHandler(t,"touchstart",this.onNativeTouchStart,{passive:!1}),this.addNativeHandler(t,"touchmove",this.onNativeTouchMove,{passive:!1}),this.addNativeHandler(t,"touchend",this.onNativeTouchEnd,{passive:!1}),this.addNativeHandler(t,"touchcancel",this.onNativeTouchCancel,{passive:!1}),this.addNativeHandler(t,"wheel",this.onNativeWheel,{passive:!1}),this.addNativeHandler(t,"keydown",this.onNativeKeyDown),this.addNativeHandler(t,"keyup",this.onNativeKeyUp),this.addNativeHandler(t,"focus",this.onCanvasFocus),this.addNativeHandler(t,"blur",this.onCanvasBlur))},r.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.slice().forEach(function(t){return t(e)}),t===st?this.onClick(e):t===se?this.onPointerDown(e):t===sr?this.onPointerUp(e):t===si&&this.onPointerMove(e)},r.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),e1(i,e),function(){e2(i,e)}},r.removeEventListener=function(t,e){var i=this.handlers[t];i&&e2(i,e)},r.dispose=function(){this.resetInputState(),this.handlers={},this.unbindListeners(),this.target=null},r.handleNativeMouseDown=function(t){if(this.enabled&&this.target){this.setMouseButtonPressed(t.button,!0);var e=this.getCanvasPosition(t.clientX,t.clientY);this.focusTarget();var i=this.createPointerState(e);this.mouseState=i,i.pressed=!0;var r=this.pushNativeMouseButton(t,e,!0);if(i.inputHandled=r,!r){var n=this.createPointerEvent(t,e,i);this.dispatchEvent(se,n)}this.consumeNativeEvent(t,r)}},r.handleNativeKey=function(e,i){if(this.enabled){var r,n,a,o=new o4;o.device=o2.deviceIdKeyboard,o.pressed=i,o.echo=i&&e.repeat,o.keycode=e.key,o.physicalKeycode=e.code,o.keyLabel=e.key,o.unicode=1===(n=Array.from(e.key)).length&&null!=(r=n[0].codePointAt(0))?r:0,o.location=1===(a=e.location)?t.KeyLocation.Left:2===a?t.KeyLocation.Right:t.KeyLocation.Unspecified,o.shiftPressed=e.shiftKey,o.altPressed=e.altKey,o.metaPressed=e.metaKey,o.ctrlPressed=e.ctrlKey,this.consumeNativeEvent(e,this.pushInput(o))}},r.handleNativeTouchEnd=function(t,e){if(this.enabled){for(var i,r=iQ(Array.from(t.changedTouches));!(i=r()).done;){var n=i.value,a=this.getCanvasPosition(n.clientX,n.clientY),o=this.touchStates.get(n.identifier);if(null==o?void 0:o.pressed){var s=this.pushNativeScreenTouch(n.identifier,a,!1,e,!1),u=this.createPointerEvent(t,a,o);!e&&!o.inputHandled&&!s&&this.isClick(o,a)&&this.dispatchEvent(st,u),s||e||o.inputHandled||this.dispatchEvent(sr,u),this.touchStates.delete(n.identifier),this.consumeNativeEvent(t,s||o.inputHandled||!this.allowPropagation)}}this.preventTouchDefaults(t)}},r.pushNativeMouseButton=function(e,i,r){var n=!1,a=sa(e.button);return r&&this.emulateTouchFromMouse&&a===t.MouseButton.Left&&(this.touchFromMousePressed=!0),this.touchFromMousePressed&&a===t.MouseButton.Left&&(n=this.pushScreenTouch(0,i,r,!1,e.detail>1,o2.deviceIdEmulation),r||(this.touchFromMousePressed=!1)),this.pushMouseButton(e,i,r)||n},r.pushNativeMouseMotion=function(e,i,r,n){var a=!1;return this.touchFromMousePressed&&(this.mouseButtonMask&t.MouseButtonMask.Left)!=0&&(a=this.pushScreenDrag(0,i,r,n,o2.deviceIdEmulation)),this.pushMouseMotion(e,i,r,n)||a},r.pushNativeScreenTouch=function(t,e,i,r,n){var a=!1,o=!1;return i&&this.emulateMouseFromTouch&&null===this.mouseFromTouchIndex?(this.mouseFromTouchIndex=t,o=!0):i||this.mouseFromTouchIndex!==t||(o=!0,this.mouseFromTouchIndex=null),o&&(a=this.pushEmulatedMouseButton(e,i,r,n)),this.pushScreenTouch(t,e,i,r,n,0)||a},r.pushNativeScreenDrag=function(t,e,i,r){var n=!1;return this.emulateMouseFromTouch&&this.mouseFromTouchIndex===t&&(n=this.pushEmulatedMouseMotion(e,i,r)),this.pushScreenDrag(t,e,i,r,0)||n},r.pushEmulatedMouseButton=function(e,i,r,n){var a=new o6;return a.device=o2.deviceIdEmulation,a.position.copyFrom(e),a.globalPosition.copyFrom(e),a.buttonIndex=t.MouseButton.Left,a.buttonMask=i?t.MouseButtonMask.Left:t.MouseButtonMask.None,a.pressed=i,a.canceled=r,a.doubleClick=n,this.pushInput(a)},r.pushEmulatedMouseMotion=function(e,i,r){var n=new o8;return n.device=o2.deviceIdEmulation,n.position.copyFrom(e),n.globalPosition.copyFrom(e),n.buttonMask=t.MouseButtonMask.Left,n.pressed=!0,n.relative.copyFrom(i),n.screenRelative.copyFrom(i),n.velocity.copyFrom(r),n.screenVelocity.copyFrom(r),this.pushInput(n)},r.pushMouseButton=function(t,e,i){var r=new o6;return this.copyMouseFields(r,t,e),r.device=o2.deviceIdMouse,r.buttonIndex=sa(t.button),r.buttonMask=this.mouseButtonMask,r.pressed=i,r.doubleClick=t.detail>1,this.pushInput(r)},r.setMouseButtonPressed=function(e,i){var r=function(e){switch(e){case t.MouseButton.Left:return t.MouseButtonMask.Left;case t.MouseButton.Right:return t.MouseButtonMask.Right;case t.MouseButton.Middle:return t.MouseButtonMask.Middle;case t.MouseButton.Xbutton1:return t.MouseButtonMask.Xbutton1;case t.MouseButton.Xbutton2:return t.MouseButtonMask.Xbutton2;default:return t.MouseButtonMask.None}}(sa(e));i?this.mouseButtonMask|=r:this.mouseButtonMask&=~r},r.pushWheelButton=function(t,e,i,r){var n=new o6;return this.copyMouseFields(n,r,i),n.device=o2.deviceIdMouse,n.buttonIndex=t,n.buttonMask=this.mouseButtonMask,n.factor=e,n.pressed=!0,this.pushInput(n)},r.pushMouseMotion=function(e,i,r,n){var a=new o8;return this.copyMouseFields(a,e,i),a.device=o2.deviceIdMouse,a.buttonMask=this.mouseButtonMask,a.pressed=this.mouseButtonMask!==t.MouseButtonMask.None,a.relative.copyFrom(r),a.screenRelative.copyFrom(r),a.velocity.copyFrom(n),a.screenVelocity.copyFrom(n),"pressure"in e&&(a.pressure=e.pressure,a.tilt.set(e.tiltX,e.tiltY)),this.pushInput(a)},r.pushScreenTouch=function(t,e,i,r,n,a){var o=new o9;return o.index=t,o.device=a,o.position.copyFrom(e),o.pressed=i,o.canceled=r,o.doubleTap=n,this.pushInput(o)},r.pushScreenDrag=function(t,e,i,r,n){var a=new o7;return a.index=t,a.device=n,a.position.copyFrom(e),a.relative.copyFrom(i),a.screenRelative.copyFrom(i),a.velocity.copyFrom(r),a.screenVelocity.copyFrom(r),a.pressed=!0,this.pushInput(a)},r.copyMouseFields=function(t,e,i){t.position.copyFrom(i),t.globalPosition.copyFrom(i),t.shiftPressed=e.shiftKey,t.altPressed=e.altKey,t.metaPressed=e.metaKey,t.ctrlPressed=e.ctrlKey},r.onClick=function(t){for(var e,i=[],r=iQ(this.engine.compositions);!(e=r()).done;){var n=e.value;i.push.apply(i,[].concat(n.hitTest(t.x,t.y)))}for(var a,o=iQ(i);!(a=o()).done;){var s=a.value,u=s.item.composition;if(u){var h=ro({},s,{compositionId:u.id,compositionName:u.name});s.item.emit("click",s),u.emit("click",h),this.engine.emit("click",h)}}},r.onPointerDown=function(t){this.handlePointerEvent(t,0)},r.onPointerUp=function(t){this.handlePointerEvent(t,1)},r.onPointerMove=function(t){this.handlePointerEvent(t,2)},r.handlePointerEvent=function(t,e){var i=null;if(!(2===e&&this.skipPointerMovePicking))for(var r,n=iQ(this.engine.compositions);!(r=n()).done;){var a=r.value.hitTest(t.x,t.y);a.length>0&&(i=a[a.length-1])}var o=new nN;o.position.x=(t.x+1)/2*t.width,o.position.y=(t.y+1)/2*t.height,o.delta.x=t.vx*t.width,o.delta.y=t.vy*t.height,i&&(o.pointerCurrentRaycast.point=i.position,o.pointerCurrentRaycast.item=i.item);var s=0===e?"pointerdown":1===e?"pointerup":"pointermove";if(i){var u=i.item,h=u.composition;u.emit(s,o),h.emit(s,o),this.engine.emit(s,o)}},r.createPointerState=function(t){return{start:t.clone(),last:t.clone(),lastTime:performance.now(),inputHandled:!1,pressed:!1}},r.updatePointerState=function(t,e){t.last.copyFrom(e),t.lastTime=performance.now()},r.getVelocity=function(t,e){var i=Math.max(performance.now()-t.lastTime,1);return new e7((e.x-t.last.x)/i,(e.y-t.last.y)/i)},r.isClick=function(t,e){return Math.abs(e.x-t.start.x)+Math.abs(e.y-t.start.y)<4},r.createPointerEvent=function(t,e,i,r){void 0===r&&(r=new e7);var n,a,o=this.target,s=null==o?void 0:o.getBoundingClientRect(),u=(null==s?void 0:s.width)||1,h=(null==s?void 0:s.height)||1;return{x:e.x/u*2-1,y:1-e.y/h*2,vx:r.x/u*2,vy:-r.y/h*2,ts:performance.now(),dx:(e.x-i.start.x)/u*2,dy:-(e.y-i.start.y)/h*2,width:null!=(n=null==o?void 0:o.width)?n:0,height:null!=(a=null==o?void 0:o.height)?a:0,origin:t}},r.getCanvasPosition=function(t,e){var i,r=null==(i=this.target)?void 0:i.getBoundingClientRect();return r?new e7(t-r.left,e-r.top):new e7},r.consumeNativeEvent=function(t,e){e&&!this.allowPropagation&&(t.cancelable&&t.preventDefault(),t.stopPropagation())},r.pushInput=function(t){return t.clearAccepted(),this.emit("input",t),t.isAccepted()},r.preventTouchDefaults=function(t){t.cancelable&&t.preventDefault()},r.focusTarget=function(){var t;null==(t=this.target)||t.focus()},r.resetInputState=function(){this.mouseState=null,this.mouseButtonMask=t.MouseButtonMask.None,this.touchStates.clear(),this.mouseFromTouchIndex=null,this.touchFromMousePressed=!1},r.addNativeHandler=function(t,e,i,r){t.addEventListener(e,i,r),this.nativeHandlers.push({target:t,name:e,handler:i,options:r})},r.unbindListeners=function(){for(var t,e=iQ(this.nativeHandlers);!(t=e()).done;){var i=t.value;i.target.removeEventListener(i.name,i.handler,i.options)}this.nativeHandlers=[],this.addedTabIndex&&this.target&&this.target.removeAttribute("tabindex"),this.addedOutlineStyle&&this.target&&this.target.style.removeProperty("outline"),this.addedTabIndex=!1,this.addedOutlineStyle=!1},rk(i,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t)}}]),i}(nU);function sa(e){switch(e){case 0:return t.MouseButton.Left;case 1:return t.MouseButton.Middle;case 2:return t.MouseButton.Right;case 3:return t.MouseButton.Xbutton1;case 4:return t.MouseButton.Xbutton2;default:return t.MouseButton.None}}function so(t,e){var i=Math.abs(t);return 1===e?i/3:2===e?i:i/100}var ss=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX)),su=1,sh=function(){function e(t,e,i){this.transform=e,this.engine=i,this.color=t.options.previewColor;var r=this.createMaterial(),n=this.createGeometry();this.mesh=this.createMesh(n,r),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new it,n=new rh,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(){var e=[["ENV_EDITOR",this.engine.env===nB]],i=aF(this.color).getValue(0),r={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPos;\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\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(aPos.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}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:t.GLSLVersion.GLSL1,macros:e}},n=nw.create(this.engine,r);return n.blending=!0,n.depthTest=!1,n.setVector4("uPos",new ie(0,0,0,0)),n.setVector2("uSize",new e7(1,1)),n.setVector4("uColor",new ie(i[0]/255,i[1]/255,i[2]/255,i[3])),n.setQuaternion("uQuat",new rh(0,0,0,0)),n},i.createGeometry=function(){var t,e=new Uint16Array([0,1,1,2,2,3,3,0]);return a6.create(this.engine,{attributes:((t={})[nV.PositionKind]={size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])},t),drawCount:e.length,indices:{data:e},mode:rG.LINES,maxVertex:4})},i.createMesh=function(t,e){return os.create(this.engine,{name:"Interact_preview"+su++,priority:0,worldMatrix:nm.fromIdentity(),geometry:t,material:e})},e}();function sl(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.speed=25,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.invalidBorderRange=0,t.invalidByBorderRange=!1,t.duringPlay=!1,t._interactive=!0,t.lastTime=-1,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i,clipMasks:t.frameClipMasks}}},t}iY(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.engine.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===tK.CLICK&&(this.clickable=!0,r&&t===nB&&(this.previewContent=new sh(this.item.props.content,this.transform,this.engine))),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this);var t=this.interactData.options.type,i=this.item.engine.env;if(t===tK.CLICK)this.clickable=!0;else if(t===tK.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==nB||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,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,sl(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,o=n.fov,s=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(h),c=this.dragRange,f=c.dxRange,d=c.dyRange,p=a[0]-this.dragRatio[0]*(u*l),m=a[1]-this.dragRatio[1]*(s*l),v=f[0],y=f[1],g=d[0],x=d[1];p=e9(p,v,y),m=e9(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new it(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={touchstart:function(t){if(n.canInteract()&&(n.invalidByBorderRange=n.checkInvalidBorderRange({x:t.x,y:t.y}),!n.invalidByBorderRange)){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.invalidByBorderRange||(n.handleDragMove(r,t),n.bouncingArg=t)},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!sl(e,3)&&e&&(e.vx*=n.speed,e.vy*=n.speed,n.dragEvent=ro({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=n3(it.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tK.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},r.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i,r,n,a,o=0,s=0,u=0,h=0;if("number"==typeof e?(o=e,s=e,u=e,h=e):iP(e)&&(o=void 0===(i=e[0])?0:i,s=void 0===(r=e[1])?0:r,u=void 0===(n=e[2])?0:n,h=void 0===(a=e[3])?0:a),t.x<h-1||t.x>1-s||t.y<o-1||t.y>1-u)return!0}return!1},rk(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(nk),t.InteractComponent=eq([i1(eS.InteractComponent)],t.InteractComponent);var sc=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return iY(e,t),e}(oJ(iX));t.SpriteRotation=void 0,(tN=t.SpriteRotation||(t.SpriteRotation={}))[tN.None=0]="None",tN[tN.Rotate90=1]="Rotate90",t.Sprite=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).rect=[0,0,1,1],r.rotation=0,i&&r.fromData(i),r}return iY(e,t),e.prototype.fromData=function(e){var i,r;t.prototype.fromData.call(this,e),this.texture=e.texture?this.engine.findObject(e.texture):this.engine.whiteTexture,this.rect=null!=(i=e.rect)?i:[0,0,1,1],this.rotation=null!=(r=e.rotation)?r:0},e}(i4),t.Sprite=eq([i1("Sprite")],t.Sprite);var sf=function(){function t(){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0}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.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),sd=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),sp=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(i4);t.PlayState=void 0,(tF=t.PlayState||(t.PlayState={}))[tF.Playing=0]="Playing",tF[tF.Paused=1]="Paused",tF[tF.Stopped=2]="Stopped";var sm=[1,1,1,1],sv=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}iY(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(eZ(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(o=this.activeComponent)?void 0:o.material;var o,s,u=null==(s=this.activeMaterial)?void 0:s.getColor("_Color");u&&(this.startColor=u.toArray())}var h=n$(sm,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,f=this.colorOverLifetime;f&&(h=ia(f,l,!0),i=!0),c&&(h[3]*=c.getValue(l),i=!0),i&&(n0(this.renderColor,h,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getColor("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=aF(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===t4.GRADIENT_COLOR&&(this.colorOverLifetime=io(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(oq)},i}(sf),sy=function(){function t(){}return t.prototype.onEvent=function(t,e){},t}(),sg=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.onEvent=function(t,e){t.emit("animationevent",e)},e}(oJ(sy));t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e.events=[],e}iY(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=e9(e,0,this.duration),n=iQ(this.positionCurves);!(i=n()).done;){var a=i.value,o=a.keyFrames.getValue(r),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,h=iQ(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=iQ(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=iQ(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),S=this.findTarget(t,b.path);null==S||S.transform.setScale(T.x,T.y,T.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=iQ(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:aF(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var o,s=iQ(t.rotationCurves);!(o=s()).done;){var u=o.value,h={path:u.path,keyFrames:aF(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=iQ(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:aF(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=iQ(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:aF(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=iQ(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:aF(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var S,E=iQ(t.colorCurves);!(S=E()).done;){var C=S.value,w={path:C.path,keyFrames:aF(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,w.keyFrames.getMaxTime()),this.colorCurves.push(w)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var _,M=iQ(t.events);!(_=M()).done;){var A,P=_.value,I={name:P.name,startTime:P.startTime,duration:null!=(A=P.duration)?A:0,event:new sg};this.events.push(I)}},i.findTarget=function(t,e){for(var i,r=t,n=e.split("."),a=iQ(n);!(i=a()).done;){for(var o,s=i.value,u=!1,h=iQ(r.children);!(o=h()).done;){var l=o.value;if(l.name===s){r=l,u=!0;break}}if(!u)return}return r},e}(i4),t.AnimationClip=eq([i1(eS.AnimationClip)],t.AnimationClip);var sx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}iY(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=iQ(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(eZ(t,sf)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t){this.clipWeights[i]=e;return}}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(sf),sb=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(eZ(i,t.VFXItem)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sx),sT=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eZ(i,t.VFXItem)&&(i.time=this.time)},i}(sf),sS=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(sf),sE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyPath="",e.propertyName="",e}iY(e,t);var i=e.prototype;return i.evaluate=function(t){var e=t.output.getUserData();if(e){this.directTarget||this.preparePath(e);var i=!1;if(this.propertyValue=this.directTarget[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var a=this.getClipPlayable(r);if(!eZ(a,sS)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=a.value;this.addWeightedValue(o,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,eZ(e,rB)&&e.onApplyAnimationProperties())}}},i.preparePath=function(t){for(var e=this.propertyPath.split("."),i=t,r=0;r<e.length-1;r++){var n=i[e[r]];void 0===n&&console.error("The "+e[r]+" property of "+t+" was not found"),i=n}e.length>0&&(this.propertyName=e[e.length-1]),this.directTarget=i},e}(sx),sC=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(sE),sw=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(sE),s_=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.evaluate=function(t){},e}(sx),sM=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.evaluate=function(t){},e}(sx),sA=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){for(var i=0;i<this.clipPlayables.length;i++)if(this.getClipWeight(i)>0){var r=this.getClipPlayable(i);eZ(r,sS)&&r.value&&(e.sprite=r.value);break}}},e}(sx),sP=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eZ(i,t.CompositionComponent)&&i.tick(this.getTime()-i.getTime())},i}(sf),sI=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(eZ(i,t.CompositionComponent)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},i}(sx),sR=function(){function t(){this.hasContribution=!1,this.hasPosition=!1,this.hasRotation=!1,this.hasScale=!1,this.appliedPosition=!1,this.appliedRotation=!1,this.appliedScale=!1,this.outPos=new it,this.outRot=new nv,this.outScale=new it(1,1,1),this.weightedRot=new nv}var e=t.prototype;return e.captureBasePose=function(t){this.ensureBasePose(t)},e.getBasePosition=function(){var t;return null==(t=this.basePose)?void 0:t.position},e.resetFrame=function(){this.hasContribution=!1,this.hasPosition=!1,this.hasRotation=!1,this.hasScale=!1},e.addContribution=function(t,e,i){if(!(i<=0)){if(this.ensureBasePose(t),!this.hasContribution){var r=this.basePose;this.outPos.copyFrom(r.position),this.outRot.copyFrom(r.rotation),this.outScale.copyFrom(r.scale),this.hasContribution=!0}e.hasPosition&&(this.hasPosition=!0,this.outPos.x+=e.position.x*i,this.outPos.y+=e.position.y*i,this.outPos.z+=e.position.z*i),e.hasRotation&&(this.hasRotation=!0,this.weightedRot.set(e.rotation.x*i,e.rotation.y*i,e.rotation.z*i,e.rotation.order),this.outRot.addEulers(this.outRot,this.weightedRot)),e.hasScale&&(this.hasScale=!0,this.outScale.x*=Math.pow(e.scale.x,i),this.outScale.y*=Math.pow(e.scale.y,i),this.outScale.z*=Math.pow(e.scale.z,i))}},e.flush=function(t){var e=this.basePose;e&&(this.hasContribution||this.appliedPosition||this.appliedRotation||this.appliedScale)&&(this.hasPosition?(t.transform.setPosition(this.outPos.x,this.outPos.y,this.outPos.z),this.appliedPosition=!0):this.appliedPosition&&(t.transform.setPosition(e.position.x,e.position.y,e.position.z),this.appliedPosition=!1),this.hasRotation?(t.transform.setRotation(this.outRot.x,this.outRot.y,this.outRot.z),this.appliedRotation=!0):this.appliedRotation&&(t.transform.setRotation(e.rotation.x,e.rotation.y,e.rotation.z),this.appliedRotation=!1),this.hasScale?(t.transform.setScale(this.outScale.x,this.outScale.y,this.outScale.z),this.appliedScale=!0):this.appliedScale&&(t.transform.setScale(e.scale.x,e.scale.y,e.scale.z),this.appliedScale=!1))},e.dispose=function(){this.basePose=void 0,this.boundInstanceId=void 0,this.appliedPosition=!1,this.appliedRotation=!1,this.appliedScale=!1,this.resetFrame()},e.ensureBasePose=function(t){if(!this.basePose||this.boundInstanceId!==t.getInstanceId()){var e=t.transform.scale;this.basePose={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new it(e.x,e.y,e.x)},this.boundInstanceId=t.getInstanceId(),this.appliedPosition=!1,this.appliedRotation=!1,this.appliedScale=!1}},t}(),sO=new nv,sV=new it,sN=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.started=!1,t.contribution={hasPosition:!1,position:new it,hasRotation:!1,rotation:new nv,hasScale:!1,scale:new it(1,1,1)},t}iY(i,e);var r=i.prototype;return r.start=function(){var t,e=this.data.positionOverLifetime,i=this.data.rotationOverLifetime,r=this.data.sizeOverLifetime;if(e&&0!==Object.keys(e).length){this.positionOverLifetime=e,e.path&&(this.pathGetter=aF(e.path));var n=e.linearX||e.linearY||e.linearZ;n&&(this.linearVelOverLifetime={x:e.linearX&&aF(e.linearX),y:e.linearY&&aF(e.linearY),z:e.linearZ&&aF(e.linearZ),asMovement:e.asMovement,enabled:!!n});var a=e.orbitalX||e.orbitalY||e.orbitalZ;a&&(this.orbitalVelOverLifetime={x:e.orbitalX&&aF(e.orbitalX),y:e.orbitalY&&aF(e.orbitalY),z:e.orbitalZ&&aF(e.orbitalZ),center:nJ(e.orbCenter),asRotation:e.asRotation,enabled:!!a}),this.speedOverLifetime=e.speedOverLifetime&&aF(e.speedOverLifetime)}if(r&&(r.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=aF(r.x||1),this.sizeYOverLifetime=aF(r.y||1),this.sizeZOverLifetime=aF(r.z||1)):this.sizeXOverLifetime=aF(r.size||1)),i&&(this.rotationOverLifetime={asRotation:i.asRotation,separateAxes:i.separateAxes,z:aF(i.z||0)},i.separateAxes)){var o=this.rotationOverLifetime;o.x=aF(i.x||0),o.y=aF(i.y||0)}this.gravity=it.fromArray((null==e?void 0:e.gravity)||[]),this.gravityModifier=aF(null!=(t=null==e?void 0:e.gravityOverLifetime)?t:0),this.direction=(null==e?void 0:e.direction)?it.fromArray(e.direction).normalize():new it,this.startSpeed=(null==e?void 0:e.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){this.ensureStarted();var i=e.output.getUserData();!this.originalTransform&&eZ(i,t.VFXItem)&&this.captureOriginalTransform(i)},r.getContribution=function(t){return this.ensureStarted(),this.sampleAnimation(t),this.contribution},r.ensureStarted=function(){this.started||(this.start(),this.started=!0)},r.sampleAnimation=function(t){var e,i=this,r=this.contribution;r.hasPosition=!1,r.hasRotation=!1,r.hasScale=!1;var n=this.getDuration();if(!(n<=0)){var a=this.time/n;if(a=a<0?0:a,this.sizeXOverLifetime?(r.hasScale=!0,r.scale.x=this.sizeXOverLifetime.getValue(a),this.sizeSeparateAxes?(r.scale.y=this.sizeYOverLifetime.getValue(a),r.scale.z=this.sizeZOverLifetime.getValue(a)):r.scale.z=r.scale.y=r.scale.x):r.hasScale=!1,this.rotationOverLifetime){r.hasRotation=!0;var o=function(t){return i.rotationOverLifetime.asRotation?t.getValue(a):t.getIntegrateValue(0,a,n)},s=o(this.rotationOverLifetime.z),u=this.rotationOverLifetime.separateAxes;sO.x=u?o(this.rotationOverLifetime.x):0,sO.y=u?o(this.rotationOverLifetime.y):0,sO.z=s,r.rotation.copyFrom(sO)}else r.hasRotation=!1;this.positionOverLifetime?(r.hasPosition=!0,(null==(e=this.orbitalVelOverLifetime)?void 0:e.enabled)&&t?(nQ(r.position,this,this.gravity,this.time,n,t,this.velocity),this.pathGetter&&r.position.add(this.pathGetter.getValue(a)),r.position.subtract(t)):(sV.set(0,0,0),nQ(r.position,this,this.gravity,this.time,n,sV,this.velocity),this.pathGetter&&r.position.add(this.pathGetter.getValue(a)))):r.hasPosition=!1}},r.captureOriginalTransform=function(t){var e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new it(e.x,e.y,e.x)},this.pathGetter&&(this.originalTransform.path=this.pathGetter)},i}(sf);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new sN;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(sp),t.TransformPlayableAsset=eq([i1(eS.TransformPlayableAsset)],t.TransformPlayableAsset);var sF=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.clipMixer=new sR,t}iY(i,e);var r=i.prototype;return r.dispose=function(){this.clipMixer.dispose(),e.prototype.dispose.call(this)},r.evaluate=function(e){var i=e.output.getUserData();if(eZ(i,t.VFXItem)){this.clipMixer.captureBasePose(i),this.clipMixer.resetFrame();for(var r=0;r<this.clipPlayables.length;r++){var n=this.clipWeights[r];if(n&&!(n<=0)){var a=this.clipPlayables[r];eZ(a,sN)&&this.clipMixer.addContribution(i,a.getContribution(this.clipMixer.getBasePosition()),n)}}this.clipMixer.flush(i)}},i}(sx),sL=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(sE),sD=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e},e}(sE),sk=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(sE),sB=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===t6.restart?e%=i:this.endBehavior===t6.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}iY(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new sx},i.createOutput=function(){return new sd},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=iQ(this.clips);!(e=r()).done;){var n=e.value;i.push(n)}return this.compileClips(i,t)},i.compileClips=function(t,e){for(var i,r=this.createTrackMixer(),n=iQ(t);!(i=n()).done;){var a=i.value,o=this.createClipPlayable(a);o.setDuration(a.duration);var s=new sz(a,o,r);e.push(s),r.clipPlayables.push(o),r.setClipWeight(o,0)}return r},i.createPlayable=function(){return new sf},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new sB;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=iQ(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t){return t.asset.createPlayable()},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=iQ(this.children);!(i=r()).done;)i.value.parent=this},e}(sp),eq([i3(sB,void 0)],t.TrackAsset.prototype,"clips",void 0),eq([i3(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=eq([i1(eS.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tL=t.TrackType||(t.TrackType={}))[tL.MasterTrack=0]="MasterTrack",tL[tL.ObjectTrack=1]="ObjectTrack";var sz=function(){function e(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,a=!1;e>=i.start+i.duration&&i.endBehavior===t6.destroy?(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==t.PlayState.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var o=i.toLocalTime(e);this.playable.setTime(o),n&&this.playable.getPlayState()===t.PlayState.Playing&&this.playable.pause()},rk(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),e}();t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sb},e}(t.TrackAsset),t.ActivationTrack=eq([i1(eS.ActivationTrack)],t.ActivationTrack);var sU=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}return iY(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);eq([i3(void 0,void 0)],sU.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sw;return t.propertyPath=this.path,t},e}(sU),t.FloatPropertyTrack=eq([i1(eS.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sM},e}(t.TrackAsset),t.SpriteColorTrack=eq([i1(eS.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}iY(i,e);var r=i.prototype;return r.updateAnimatedObject=function(e){if(!eZ(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(t.CompositionComponent)},r.createTrackMixer=function(){return new sI},i}(t.TrackAsset),t.SubCompositionTrack=eq([i1(eS.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sF},e}(t.TrackAsset),t.TransformTrack=eq([i1(eS.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.updateAnimatedObject=function(t){if(!eZ(t,nk))throw Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(t.TrackAsset),eq([i3(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=eq([i1("MaterialTrack")],t.MaterialTrack);var sG=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new s_},e}(t.TrackAsset);function sW(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sL;return t.propertyPath=this.path,t},e}(sU),t.Vector4PropertyTrack=eq([i1(eS.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector3PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sD;return t.propertyPath=this.path,t},e}(sU),t.Vector3PropertyTrack=eq([i1(eS.Vector3PropertyTrack)],t.Vector3PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sk;return t.propertyPath=this.path,t},e}(sU),t.Vector2PropertyTrack=eq([i1(eS.Vector2PropertyTrack)],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sC;return t.propertyPath=this.path,t},e}(sU),t.ColorPropertyTrack=eq([i1(eS.ColorPropertyTrack)],t.ColorPropertyTrack),t.SpritePropertyTrack=function(e){function i(){return e.apply(this,arguments)}iY(i,e);var r=i.prototype;return r.createTrackMixer=function(){return new sA},r.updateAnimatedObject=function(e){return e.getComponent(t.SpriteComponent)},i}(sU),t.SpritePropertyTrack=eq([i1("SpritePropertyTrack")],t.SpritePropertyTrack);var sj=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=new it(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*e4),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(iN(0,1)),direction:n.normalize()}},t}();function sX(t,e,i){if(e===t9.RANDOM)t=iN(0,t);else if(e===t9.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===t9.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===t9.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var sH=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=new it(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),sY=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=iN(-this._d,this._d),i=iN(-this._h,this._h);return{direction:new it(0,0,1),position:new it(e,i,0)}},t}(),sZ=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=new it(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new it;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),sq=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===t9.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):iN(0,1);return{direction:new it(0,1,0),position:new it(this._d*(e-.5),0,0)}},t}(),sK=new nm,sQ=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=iN(0,2*Math.PI),n=sX(this.arc,this.arcMode,t)*e4,a=sK.setFromRotationZ(n),o=new it(Math.cos(r),Math.sin(r),0),s=new it(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),sJ=new nm,s$=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return iN(-90,90)},e.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=this.getHorizontalAngle()*e4,r=this.radius,n=new it(Math.cos(i),0,Math.sin(i)),a=sJ.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),s0=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.getHorizontalAngle=function(){return iN(0,90)},e}(s$),s1=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=e9(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(sX(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new it(r,n,0);return{position:new it(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),s2=function(){function t(){}return t.prototype.generate=function(){return{position:new it,direction:new it}},t}(),s3=((eL={})[tZ.NONE]=s2,eL[tZ.CONE]=sj,eL[tZ.SPHERE]=s$,eL[tZ.HEMISPHERE]=s0,eL[tZ.CIRCLE]=sH,eL[tZ.DONUT]=sQ,eL[tZ.RECTANGLE]=sY,eL[tZ.EDGE]=sq,eL[tZ.RECTANGLE_EDGE]=sZ,eL[tZ.TEXTURE]=s1,eL);function s4(t){if(!t)return new s2;var e=ro({radius:1,arc:360,angle:0,arcMode:t9.RANDOM},t),i=t.type,r=s3[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tZ.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=it.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function s5(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=us(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=us(a,t[a],t[a+1],o);return o&&ue(o,o.next)&&(uu(o),o=o.next),o}function s6(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ue(r,r.next)||0===ut(r.prev,r,r.next))){if(uu(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function s8(t,e){return t.x-e.x}function s9(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function s7(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function ut(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ue(t,e){return t.x===e.x&&t.y===e.y}function ui(t,e,i,r){var n=un(ut(t,e,i)),a=un(ut(t,e,r)),o=un(ut(i,r,t)),s=un(ut(i,r,e));return!!(n!==a&&o!==s||0===n&&ur(t,i,e)||0===a&&ur(t,r,e)||0===o&&ur(i,t,r)||0===s&&ur(i,e,r))}function ur(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function un(t){return t>0?1:t<0?-1:0}function ua(t,e){return 0>ut(t.prev,t,t.next)?ut(t,e,t.next)>=0&&ut(t,t.prev,e)>=0:0>ut(t,e,t.prev)||0>ut(t,t.next,e)}function uo(t,e){var i=new uh(t.i,t.x,t.y),r=new uh(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function us(t,e,i,r){var n=new uh(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function uu(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 uh(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ul=0;function uc(t,e,i,r){i=i||2,ul=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=s5(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,o,s,u,h=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=s5(t,o,s,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(s8),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var h=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=o&&h>u){if(u=h,h===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var l,c=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&s7(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(l=Math.abs(s-a.y)/(o-a.x),ua(a,t)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>ut(i.prev,i,r.prev)&&0>ut(r.next,i,i.next))))&&(n=a,p=l)),a=a.next;while(a!==c);return n}(t,e)){var i=uo(e,t);s6(e,e.next),s6(i,i.next)}})(h[n],i),i=s6(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=s9(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,o,s,u,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<h&&(s++,r=r.nextZ);e++);for(u=h;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(o>1)}(n)}(e,n,a,o);for(var u,h,l=e;e.prev!==e.next;){if(u=e.prev,h=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(ut(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,h=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,l=s9(o,s,e,i,r),c=s9(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=l&&d&&d.z<=c;){if(f!==t.prev&&f!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ut(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ut(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ut(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ut(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(ut(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(s7(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&ut(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+ul),i.push(e.i/r+ul),i.push(h.i/r+ul),uu(e),e=h.next,l=h.next;continue}if((e=h)===l){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ue(n,a)&&ui(n,r,r.next,a)&&ua(n,a)&&ua(a,n)&&(e.push(n.i/i+ul),e.push(r.i/i+ul),e.push(a.i/i+ul),uu(r),uu(r.next),r=t=a),r=r.next}while(r!==t);return s6(r)}(s6(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,h,l=s.next.next;l!==s.prev;){if(s.i!==l.i&&(u=s,h=l,u.next.i!==h.i&&u.prev.i!==h.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ui(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(ua(u,h)&&ua(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(ut(u.prev,u,h.prev)||ut(u,h.prev,h))||ue(u,h)&&ut(u.prev,u,u.next)>0&&ut(h.prev,h,h.next)>0))){var c=uo(s,l);s=s6(s,s.next),c=s6(c,c.next),t(s,i,r,n,a,o),t(c,i,r,n,a,o);return}l=l.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(s6(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,l),p}function uf(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,h=0;h<o.length;h++)u+=o[h].length-1;var l,c=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(l=d[4])?d[3]:d[2],g=l?d[2]:d[3]);for(var x=[0,0],b=0===l?0:-Math.PI/2,T=0;T<o.length;T++)for(var S=o[T],E=s[T],C=s[T+1]||s[0],w=[0,0],_=0;_<S.length-1;_++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1]})(w,S[_],E,C,E[4],E[5],C[2],C[3]),i=w[0],r=w[1],c[p++]=i/2,c[p++]=r/2,d?(x[0]=i,x[1]=r,up(x,x,b),c[p++]=m+(x[0]+1)/2*y,c[p++]=v+(x[1]+1)/2*g):(c[p++]=(i+1)/2,c[p++]=(r+1)/2),p+=2;var M=uc(Array.from(c),null,6,void 0===f?0:f);return{aPoint:c,index:new Uint16Array(M)}}function ud(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[t4.SHAPE_POINTS,t.p],s:[t4.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[t4.SHAPE_POINTS,t.g.p],s:[t4.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=uf(n[u],{indexBase:a,uvTransform:e});a+=h.aPoint.length/5,r.push(h),o+=h.aPoint.length,s+=h.index.length}if(1===r.length)return r[0];for(var l=new Float32Array(o),c=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];l.set(m.aPoint,d),d+=m.aPoint.length,c.set(m.index,p),p+=m.index.length}return{aPoint:l,index:c}}function up(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var um=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=eZ(r,ac)?r:aF(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),uv=function(t){this.content=t},uy=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new uv(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new uv(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),ug=new it,ux=new it,ub=function(){function e(e,i){var r,n=this;this.pointStart=[],this.attributeData=new Map;var a=i.colorOverLifetime,o=i.colorOverTrail,s=i.maxTrailCount,u=i.opacityOverLifetime,h=void 0===u?aF(1):u,l=i.widthOverTrail,c=i.name,f=i.occlusion,d=i.blending,p=i.texture,m=i.transparentOcclusion,v=i.minimumVertexDistance,y=i.lifetime,g=i.matrix,x=e.gpuCapability,b=x.detail,T=x.level,S=Math.max(i.pointCountPerTrail,2),E=aw(),C=b.maxVertexTextures>0,w=(null!=e?e:{}).env,_={},M=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===nB]],A=s>64,P=0;a&&(M.push(["COLOR_OVER_LIFETIME",!0]),P|=1,_.uColorOverLifetime=no.createWithData(e,ig(a))),o&&(M.push(["COLOR_OVER_TRAIL",!0]),P|=4,_.uColorOverTrail=no.createWithData(e,ig(o))),A?(M.push(["ATTR_TRAIL_START",1]),P|=8):_.uTrailStart=new Float32Array(s),_.uOpacityOverLifetimeValue=h.toUniform(E);var I=l.toUniform(E);M.push(["VERT_CURVE_VALUE_COUNT",E.index],["VERT_MAX_KEY_FRAME_COUNT",E.max]),_.uVCurveValues=ac.getAllData(E);var R={shader:{vertex:of,fragment:ol,macros:M,glslVersion:1===T?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+P+"+"+E.index+"+"+E.max}},O=S*s*2,V=(S-1)*s,N=Float32Array.BYTES_PER_ELEMENT,F=12*N,L={attributes:((r={})[nV.ColorKind]={size:4,stride:F,data:new Float32Array(12*O)},r.aSeed={size:1,stride:F,offset:4*N,dataSource:nV.ColorKind},r.aInfo={size:3,stride:F,offset:5*N,dataSource:nV.ColorKind},r[nV.PositionKind]={size:4,stride:F,offset:8*N,dataSource:nV.ColorKind},r.aTime={size:1,data:new Float32Array(O)},r.aDir={size:3,data:new Float32Array(3*O)},r),indices:{data:new Uint16Array(6*O)},drawCount:6*V,name:"trail#"+c,bufferUsage:rG.DYNAMIC_DRAW};if(A)L.attributes.aTrailStart={size:1,data:new Float32Array(O)};else{var D=new Float32Array(O);L.attributes.aTrailStartIndex={size:1,data:D};for(var k=0;k<s;k++)for(var B=2*S,z=k*B,U=0;U<B;U++)D[z+U]=k}var G=rH(d),W=nw.create(e,R);W.blending=!0,W.depthMask=f,W.depthTest=!0,rY(W,d);var j=this.mesh=os.create(e,{name:"MTrail_"+c,material:W,geometry:a6.create(e,L)}),X=null!=p?p:no.createWithData(e);Object.keys(_).map(function(t){var e=_[t];if(eZ(e,no))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new ie(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,ie.fromArray(e))}),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",ie.fromArray(I)),W.setVector2("uTexOffset",new e7(0,0)),W.setVector4("uTextureMap",new ie(0,0,1,1)),W.setVector4("uParams",new ie(0,S-1,0,0)),W.setTexture("uMaskTex",X),W.setVector4("uColorParams",new ie(p?1:0,+G,0,+(f&&!m))),this.maxTrailCount=s,this.pointCountPerTrail=S,this.checkVertexDistance=v>0,this.minimumVertexDistance=Math.pow(v||.001,2),this.useAttributeTrailStart=A,this.lifetime=y,g&&(this.mesh.worldMatrix=g),this.geometry=j.firstGeometry(),this.geometry.getAttributeNames().forEach(function(t){var e=n.geometry.getVertexBuffer(t),i=n.geometry.getAttributeData(t);e&&eZ(i,Float32Array)&&n.attributeData.set(e.getWrapperBuffer(),i)}),this.trailCursors=new Uint16Array(s)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,ug);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=uC(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),this.setAttributeSubData("aDir",6*c,v),this.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,this.setAttributeSubData(nV.ColorKind,24*c,g),u>=0){var b=new Float32Array(uC(this.getTrailPosition(t,h,ux),l,e)),T=(t*n+u)*6;this.setAttributeSubData("aDir",T,b),this.setAttributeSubData("aDir",T+3,b);var S=t*n*2,E=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),C=(t*o+(r-1)%o)*6;a.setIndexSubData(C,E)}r=++this.trailCursors[t];var w=this.mesh.material,_=w.getVector4("uParams"),M=p[2];if(this.useAttributeTrailStart){for(var A=2*n,P=new Float32Array(A),I=0;I<A;I++)P[I]=M;this.setAttributeSubData("aTrailStart",t*P.length,P)}else{var R=w.getFloats("uTrailStart");void 0!=R&&(R[t]=M,w.setFloats("uTrailStart",R))}_&&(_.y=Math.max(_.y,r-1)-Math.max(0,r-n),w.setVector4("uParams",_))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.getAttributeData(nV.ColorKind);return i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();iS(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){for(var e=this.getAttributeData("aTime"),i=0;i<e.length;i++)e[i]-=t;this.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();iS(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},i.getAttributeData=function(t){var e=this.geometry.getVertexBuffer(t),i=e&&this.attributeData.get(e.getWrapperBuffer());return iS(i),i},i.setAttributeData=function(t,e){var i=this.geometry.getVertexBuffer(t);iS(i),this.attributeData.set(i.getWrapperBuffer(),e),this.geometry.setAttributeData(t,e)},i.setAttributeSubData=function(t,e,i){this.getAttributeData(t).set(i,e),this.geometry.setAttributeSubData(t,e,i)},i.rebuild=function(){!this.geometry.isInitialized||this.geometry.isDisposed()||this.attributeData.forEach(function(t,e){e.getData()||e.update(t)})},rk(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}(),uT=new it,uS=new it,uE=new it;function uC(t,e,i){return t||i?(t?i?(uS.subtractVectors(e,t).normalize(),uS.subtractVectors(i,e),uE.copyFrom(uS).normalize(),uT.addVectors(uS,uE)):uT.subtractVectors(e,t):uT.subtractVectors(i,e),uT.normalize().toArray()):[0,0,0]}var uw=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.particleSystem=null,t}iY(i,e);var r=i.prototype;return r.getParticleSystem=function(e){if(this.particleSystem)return this.particleSystem;var i=e.output.getUserData();return eZ(i,t.VFXItem)?(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem):null},r.processFrame=function(t){var e=this.getParticleSystem(t);if(e){for(this.time>=0&&this.time<e.time&&e.reset();e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},i}(sf),u_=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new uw},e}(sp),uM={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"},uA=function(){function e(e,i){var r,n,a,o,s,u,h,l,c,f=this;this.particleCount=0,this.cachedRotationVector3=new it,this.cachedRotationMatrix=new ny,this.cachedLinearMove=new it,this.tempMatrix3=new ny,this.attributeData=new Map,this.VERT_MAX_KEY_FRAME_COUNT=0;var d=(null!=e?e:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,b=i.sprite,T=i.gravityModifier,S=i.maxCount,E=i.textureFlip,C=i.useSprite,w=i.name,_=i.gravity,M=i.forceTarget,A=i.side,P=i.occlusion,I=i.anchor,R=i.blending,O=i.transparentOcclusion,V=i.renderMode,N=void 0===V?0:V,F=i.diffuse,L=void 0===F?no.createWithData(e):F,D=e.gpuCapability.detail,k=D.halfFloatTexture,B=D.maxVertexUniforms,z=[["RENDER_MODE",+N],["ENV_EDITOR",d===nB]],U=e.gpuCapability.level,G=aw(),W=aw(),j=B>0,X={},H=0,Y=0;if(this.useSprite=C,j&&z.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(z.push(["SPEED_OVER_LIFETIME",!0]),Y|=2,X.uSpeedLifetimeValue=p.toUniform(G)),(null==b?void 0:b.animate)&&(z.push(["USE_SPRITE",!0]),Y|=4,X.uFSprite=X.uSprite=new Float32Array([b.col,b.row,b.total,b.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(z.push(["COLOR_OVER_LIFETIME",!0]),Y|=16,X.uColorOverLifetime=eZ(m.color,no)?m.color:no.createWithData(e,ig(m.color))),(null==m?void 0:m.opacity)?X.uOpacityOverLifetimeValue=m.opacity.toUniform(G):X.uOpacityOverLifetimeValue=aF(1).toUniform(G),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(X["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(G),i=1,Y|=1<<7+e,v.enabled=!0),z.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(X["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(G),r=1,Y|=1<<10+e,l=!0,y.enabled=!0),z.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(z.push(["AS_LINEAR_MOVEMENT",!0]),Y|=32),l&&((null==y?void 0:y.asRotation)&&(z.push(["AS_ORBITAL_MOVEMENT",!0]),Y|=64),X.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),X.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(G),(null==g?void 0:g.separateAxes)&&(z.push(["SIZE_Y_BY_LIFE",1]),Y|=16384,X.uSizeYByLifetimeValue=null==g?void 0:null==(c=g.y)?void 0:c.toUniform(G)),(null==x?void 0:x.z)&&(X.uRZByLifeTimeValue=x.z.toUniform(G),Y|=32768,z.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(X.uRXByLifeTimeValue=x.x.toUniform(G),Y|=65536,z.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(X.uRYByLifeTimeValue=x.y.toUniform(G),Y|=131072,z.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(z.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Y|=262144),X.uGravityModifierValue=T.toUniform(G),M&&(z.push(["FINAL_TARGET",!0]),Y|=524288,X.uFinalTarget=new Float32Array(M.target||[0,0,0]),X.uForceCurve=M.curve.toUniform(G)),k&&W.max?(Y|=1048576,X.uFCurveValueTexture=ns(e,ac.getAllData(W,!0),W.index,1)):X.uFCurveValues=ac.getAllData(W),G.max+G.curves.length-32>B&&k&&j){var Z=ns(e,ac.getAllData(G,!0),G.index,1);X.uVCurveValueTexture=Z,H=1}else X.uVCurveValues=ac.getAllData(G);var q=["-p:",N,Y,G.index,G.max,W.index,W.max].join("+");z.push(["VERT_CURVE_VALUE_COUNT",G.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",G.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]),this.VERT_MAX_KEY_FRAME_COUNT=G.max;var K={fragment:ol,vertex:"#define LOOKUP_TEXTURE_CURVE "+H+"\n"+oc,glslVersion:1===U?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:q,macros:z,name:"particle#"+w},Q=rH(R);X.uTexOffset=new Float32Array(L?[1/L.getWidth(),1/L.getHeight()]:[0,0]),X.uMaskTex=L,X.uColorParams=new Float32Array([L?1:0,+Q,0,+(!!P&&!O)]),X.uParams=[0,0,0,0],X.uAcceleration=[(null==_?void 0:_[0])||0,(null==_?void 0:_[1])||0,(null==_?void 0:_[2])||0,0];var J=nw.create(e,{shader:K});J.blending=!0,J.depthTest=!0,J.depthMask=!!P,rY(J,R),rZ(J,A),Object.keys(X).map(function(t){var e=X[t];if(eZ(e,no)){J.setTexture(t,e);return}var i=[];switch(uM[t]){case"vec4":J.setVector4(t,ie.fromArray(e));break;case"vec3":J.setVector3(t,it.fromArray(e));break;case"vec2":J.setVector2(t,e7.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new ie(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}J.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),J.setVector3("emissionColor",new it(0,0,0)),J.setFloat("emissionIntensity",0);var $=a6.create(e,(r=4*S,n=this.useSprite,a="particle#"+w,u=12*(s=Float32Array.BYTES_PER_ELEMENT),(o={})[nV.PositionKind]={size:3,offset:0,stride:u,data:new Float32Array(0)},o.aVel={size:3,offset:3*s,stride:u,dataSource:nV.PositionKind},o.aDirX={size:3,offset:6*s,stride:u,dataSource:nV.PositionKind},o.aDirY={size:3,offset:9*s,stride:u,dataSource:nV.PositionKind},o.aRot={size:3,offset:0,stride:8*s,data:new Float32Array(0)},o.aSeed={size:1,offset:3*s,stride:8*s,dataSource:"aRot"},o[nV.ColorKind]={size:4,offset:4*s,stride:8*s,dataSource:"aRot"},o.aOffset={size:4,stride:4*s,data:new Float32Array(0)},o.aTranslation={size:3,data:new Float32Array(0)},o.aLinearMove={size:3,data:new Float32Array(0)},o.aRotation0={size:3,offset:0,stride:9*s,data:new Float32Array(0)},o.aRotation1={size:3,offset:3*s,stride:9*s,dataSource:"aRotation0"},o.aRotation2={size:3,offset:6*s,stride:9*s,dataSource:"aRotation0"},h=o,n&&(h.aSprite={size:3,stride:3*s,data:new Float32Array(0)}),{attributes:h,indices:{data:new Uint16Array(r/4*6)},name:a,maxVertex:r,bufferUsage:t.BufferUsage.Dynamic})),tt=os.create(e,{name:"MParticle_"+w,material:J,geometry:$});this.anchor=I,this.mesh=tt,this.geometry=tt.firstGeometry(),this.geometry.getAttributeNames().forEach(function(t){var e=f.geometry.getVertexBuffer(t),i=f.geometry.getAttributeData(t);e&&eZ(i,Float32Array)&&f.attributeData.set(e.getWrapperBuffer(),i)}),this.forceTarget=M,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=T,this.rotationOverLifetime=x,this.maxCount=S,this.maxParticleBufferCount=S,this.textureOffsets=E?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.getAttributeData("aRot"),i=32*t+4;return[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.particleCount=0,this.geometry.setDrawCount(0)},i.onUpdate=function(t){var e=Math.ceil(this.getAttributeData(nV.PositionKind).length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this,r=this.maxCount;if(t<r){var n,a=t+1,o=4*a,s=this.geometry,u=a>this.maxParticleBufferCount,h=1;this.particleCount>300?h=(this.particleCount+100)/this.particleCount:this.particleCount>100?h=1.4:this.particleCount>0&&(h=2);var l={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},c=this.useSprite;c&&(l.aSprite=new Float32Array(12));var f=new it,d=new rh,p=new it(1,1,1);e.transform.assignWorldTRS(f,d,p);var m=nH.getRotation(d,new nv),v=f.toArray(),y=m.toArray(),g=this.textureOffsets,x=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,S=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random();c&&(n=e.sprite);for(var w=0;w<4;w++){var _=2*w,M=3*w,A=4*w,P=12*w,I=8*w;l.aPos.set(v,P),T.fill(l.aPos,P+3),l.aRot.set(y,I),l.aRot[I+3]=C,l.aRot.set(S,I+4),c&&l.aSprite.set(n,M);var R=e.uv||b;if(R){var O=c?1-g[_+1]:g[_+1];x[0]=R[0]+g[_]*R[2],x[1]=R[1]+O*R[3]}l.aOffset.set(x,A);for(var V=w+w,N=(E[V]-this.anchor.x)*p.x,F=(E[V+1]-this.anchor.y)*p.y,L=0;L<3;L++)l.aPos[P+6+L]=e.dirX.getElement(L)*N,l.aPos[P+9+L]=e.dirY.getElement(L)*F}var D=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(u){var k=e3(s.getIndexData(),6*a,6*r,h);k.set(D,6*t),s.setIndexData(k),this.maxParticleBufferCount=k.length/6}else s.setIndexSubData(6*t,D);Object.keys(l).forEach(function(e){var n=l[e],a=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(u){var c=e3(i.getAttributeData(e),o*a,4*r*a,h);c.set(n,n.length*t),i.setAttributeData(e,c)}else i.setAttributeSubData(e,n.length*t,n)}),this.particleCount=Math.max(a,this.particleCount),s.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.getAttributeData("aTranslation"),n=this.getAttributeData("aVel"),a=this.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=e/1e3*o,S=e/1e3*s,E=e/1e3*u;r[b]+=T,r[b+1]+=S,r[b+2]+=E,r[b+3]+=T,r[b+4]+=S,r[b+5]+=E,r[b+6]+=T,r[b+7]+=S,r[b+8]+=E,r[b+9]+=T,r[b+10]+=S,r[b+11]+=E}}this.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.getAttributeData("aRotation0"),r=this.getAttributeData("aOffset"),n=this.getAttributeData("aRot"),a=this.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=e9((o-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(eZ(this.rotationOverLifetime.x,ap)?c.x+=this.rotationOverLifetime.x.getValue(h,f):c.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(eZ(this.rotationOverLifetime.y,ap)?c.y+=this.rotationOverLifetime.y.getValue(h,f):c.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(eZ(this.rotationOverLifetime.z,ap)?c.z+=this.rotationOverLifetime.z.getValue(h,f):c.z+=this.rotationOverLifetime.z.getValue(h))):s.setZero(),0===c.dot(c)&&s.identity();var d=Math.PI/180,p=c.x*d,m=c.y*d,v=c.z*d,y=Math.sin(p),g=Math.sin(m),x=Math.sin(v),b=Math.cos(p),T=Math.cos(m),S=Math.cos(v);s.set(S,-x,0,x,S,0,0,0,1),s.multiply(this.tempMatrix3.set(T,0,g,0,1,0,-g,0,T)),s.multiply(this.tempMatrix3.set(1,0,0,0,b,-y,0,y,b));var E=9*u,C=s.elements;i.set(C,E),u+4<=t&&(i.set(C,E+9),i.set(C,E+18),i.set(C,E+27))}this.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.getAttributeData("aLinearMove"),r=this.getAttributeData("aOffset"),n=this.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var s=0;s<t;s+=4){var u=a-r[4*s+2],h=r[4*s+3],l=u/h,c=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(eZ(this.linearVelOverLifetime.x,ap)?o.x=this.linearVelOverLifetime.x.getValue(l,c):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(eZ(this.linearVelOverLifetime.y,ap)?o.y=this.linearVelOverLifetime.y.getValue(l,c):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(eZ(this.linearVelOverLifetime.z,ap)?o.z=this.linearVelOverLifetime.z.getValue(l,c):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(eZ(this.linearVelOverLifetime.x,ap)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(eZ(this.linearVelOverLifetime.y,ap)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(eZ(this.linearVelOverLifetime.z,ap)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.setAttributeData("aLinearMove",i)},i.getAttributeData=function(t){var e=this.geometry.getVertexBuffer(t),i=e&&this.attributeData.get(e.getWrapperBuffer());return iS(i),i},i.setAttributeData=function(t,e){var i=this.geometry.getVertexBuffer(t);iS(i),this.attributeData.set(i.getWrapperBuffer(),e),this.geometry.setAttributeData(t,e)},i.setAttributeSubData=function(t,e,i){this.getAttributeData(t).set(i,e),this.geometry.setAttributeSubData(t,e,i)},i.rebuild=function(){!this.geometry.isInitialized||this.geometry.isDisposed()||this.attributeData.forEach(function(t,e){e.getData()||e.update(t)})},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),uP=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="ParticleSystemRenderer",i}iY(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new ie;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e,i=iQ(this.meshes);!(e=i()).done;)e.value.render(t)},i.setup=function(t,e){void 0===e&&(e=null),this.meshes=[],this.materials=[],this.particleMesh=new uA(this.engine,t),e&&(this.trailMesh=new ub(this.engine,e)),this.meshes.push(this.particleMesh.mesh),this.materials.push(this.particleMesh.mesh.material),this.trailMesh&&(this.meshes.push(this.trailMesh.mesh),this.materials.push(this.trailMesh.mesh.material))},i.rebuild=function(){var t;this.particleMesh.rebuild(),null==(t=this.trailMesh)||t.rebuild()},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(nk);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).particleMeshProps=null,n.trailMeshProps=null,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,clipMasks:n.renderer.frameClipMasks,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===t8.removeParticle,ray:t})}}},i.addParticleSystem(sW(n)),n.maskManager=new n_,r&&n.fromData(r),n}iY(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===t4.CONSTANT_VEC3?e.add(r[1]):t=aF(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new uy(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1},r.onStart=function(){var t=this;this.particleMeshProps&&(this.renderer=this.item.addComponent(uP),this.renderer.setup(this.particleMeshProps,this.trailMeshProps),this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes,this.startEmit(),this.initEmitterTransform(),this.item.on("click",function(){var e;if((null==(e=t.interaction)?void 0:e.behavior)===t8.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}}))},r.onUpdate=function(t){this.frozen||this.update(t)},r.simulate=function(t){this.update(1e3*t),this.frozen=!0},r.update=function(t){var e=this;if(this.started){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(!this.ended){var c=this.item.duration,f=this.lifetime;if(u<c){var d=1/a.rateOverTime.getValue(f),p=Math.floor((u-this.lastEmitTime)/d),m=d/p,v=r.maxCount;this.updateEmitterTransform(u);for(var y=function(){var t=o.first;return e.emissionStopped||o.length===v&&t&&t.content[0]-n>u},g=0;g<p&&g<v&&!y();g++){var x=this.createPoint(f);x.delay+=i+g*m,this.addParticle(x,v),this.lastEmitTime=u}for(var b=a.bursts,T=(null==b?void 0:b.length)-1,S=0;T>=0&&S<v&&!y();T--){var E=b[T],C=!E.disabled&&E.getGeneratorOptions(u,f);if(C){var w=[0,0,0],_=a.burstOffsets[T],M=_&&_[C.cycleIndex]||w;E.once&&this.removeBurst(T);for(var A=0;A<C.count&&S<v&&!y();A++){var P,I=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:A,burstCount:C.count}));I.delay+=i,S++,(P=I.transform).translate.apply(P,[].concat(M)),this.addParticle(I,v)}}}}else this.options.looping?(l(),this.loopStartTime=i-c,this.lastEmitTime-=c,this.time-=c,a.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=c,t[2]-=c,t[3]&&(t[3].delay-=c)}),this.renderer.minusTimeForLoop(c)):(this.ended=!0,this.item.endBehavior===t6.freeze&&(this.frozen=!0))}l()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=iQ(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(t){return t.dispose()})},r.rebuild=function(){var t;null==(t=this.renderer)||t.rebuild()},r.dispose=function(){this.engine.removeParticleSystem(this),e.prototype.dispose.call(this)},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new it,o=!1;if(r&&r.content)do{var s=r.content,u=s[0];s[2];var h=s[3];if(u>this.timePassed){var l=this.getPointPosition(h),c=t.ray,f=!1;c&&(f=!!c.intersectSphere({center:l,radius:t.radius},a)),f&&(this.clickedPoint=r,n.push(l),t.multiple||(o=!0))}}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&o.subtract(c)}n.addTrailPoint(t,o,{color:s,lifetime:l,size:h,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.time-n,u=new it,h=it.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var l=nQ(new it,this.options,h,s,r,u,i);if(o){var c=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;l.x=l.x*d+c[0]*f,l.y=l.y*d+c[1]*f,l.z=l.z*d+c[2]*f}return l},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),h=a.particleFollowParent?nm.IDENTITY:this.transform.getWorldMatrix(),l=t.position,c=new nH({position:h.transformPoint(l,new it),valid:!0}),f=t.direction;if(f=h.transformNormal(f,uI).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)uF.setElement(d,a.turbulence[d].getValue(o));uL.setFromVector3(uF.negate()),uk.setFromEuler(uL).transformNormal(f).normalize()}s.alignSpeedDirection?(uN.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=it.Z.clone(),h.transformNormal(this.upDirectionWorld)),uV.crossVectors(uN,this.upDirectionWorld).normalize(),uV.isZero()&&uV.set(1,0,0)):(uV.set(1,0,0),uN.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=uD)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?uO.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?uO.set(0,0,a.startRotation.getValue(o)):uO.set(0,0,0),c.setRotation(uO.x,uO.y,uO.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)uR.x=a.startSizeX.getValue(o),uR.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);uR.x=v,uR.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new it;this.transform.assignWorldTRS(void 0,void 0,x),uR.x*=x.x,uR.y*=x.y}return c.setScale(uR.x,uR.y,1),{size:uR,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:uN,dirX:uV,transform:c}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&eZ(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t;var i,r,n,a,o,s,u,h,l,c,f,d,p,m,v=t.options,y=t.positionOverLifetime,g=void 0===y?{}:y,x=t.shape,b=null==g?void 0:g.gravityOverLifetime,T=nJ(null==g?void 0:g.gravity),S=t.textureSheetAnimation,E=S?{animationDelay:aF(S.animationDelay||0),animationDuration:aF(S.animationDuration||1),cycles:aF(S.cycles||1),animate:S.animate,col:S.col,row:S.row,total:S.total||S.col*S.row}:void 0,C=!!(x&&x.turbulenceX||(null==x?void 0:x.turbulenceY)||(null==x?void 0:x.turbulenceZ));C&&(n=[aF(null!=(a=x.turbulenceX)?a:0),aF(null!=(o=x.turbulenceY)?o:0),aF(null!=(s=x.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=s4(x),this.emission={rateOverTime:aF(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=eZ(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new um(t)})},this.textureSheetAnimation=E;var w=t.renderer||{},_=t.rotationOverLifetime;_&&((h={}).asRotation=!!_.asRotation,h.z=_.z?aF(_.z):aF(0),_.separateAxes&&(h.x=_.x&&aF(_.x),h.y=_.y&&aF(_.y))),(null==g?void 0:g.forceTarget)&&(l={target:g.target||[0,0,0],curve:aF(g.forceCurve||[t4.LINE,[[0,0],[1,1]]])});var M={x:g.linearX&&aF(g.linearX||0),y:g.linearY&&aF(g.linearY||0),z:g.linearZ&&aF(g.linearZ||0),asMovement:g.asMovement},A={x:g.orbitalX&&aF(g.orbitalX),y:g.orbitalY&&aF(g.orbitalY),z:g.orbitalZ&&aF(g.orbitalZ),center:g.orbCenter,asRotation:g.asRotation},P=t.sizeOverLifetime||{},I=t.colorOverLifetime,R=(null==P?void 0:P.separateAxes)?{separateAxes:!0,x:aF(P.x),y:aF(P.y)}:{separateAxes:!1,x:aF(("size"in P?P.size:P.x)||1)};w.anchor=w.anchor||[0,0];var O=e7.fromArray(w.anchor);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:aF(v.startLifetime),startDelay:aF(v.startDelay||0),startSpeed:aF(g.startSpeed||0),startColor:aF(v.startColor),looping:null!=(c=v.looping)&&c,maxCount:null!=(f=v.maxCount)?f:0,gravityModifier:aF(b||0),gravity:T,start3DSize:!!v.start3DSize,startTurbulence:C,turbulence:n,speedOverLifetime:g.speedOverLifetime&&aF(g.speedOverLifetime),linearVelOverLifetime:M,orbitalVelOverLifetime:A,forceTarget:l},v.startRotationZ&&(this.options.startRotation=aF(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=aF(v.startRotationX||0),this.options.startRotationY=aF(v.startRotationY||0),this.options.startRotationZ=aF(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=aF(v.startSizeX),this.options.startSizeY=aF(v.startSizeY)):(this.options.startSize=aF(v.startSize),this.options.sizeAspect=aF(v.sizeAspect||1)),t.mask&&this.maskManager.setMaskOptions(this.engine,t.mask);var V={name:this.name,matrix:nm.IDENTITY,shaderCachePrefix:"",renderMode:w.renderMode||t$.BILLBOARD,side:w.side||tH.DOUBLE,gravity:T,blending:w.blending||tX.ALPHA,rotationOverLifetime:h,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!w.occlusion,transparentOcclusion:!!w.transparentOcclusion,maxCount:v.maxCount,forceTarget:l,diffuse:w.texture?this.engine.findObject(w.texture):void 0,sizeOverLifetime:R,anchor:O};if(I){var N=I.color,F=I.opacity;V.colorOverLifetime={},F&&(V.colorOverLifetime.opacity=aF(I.opacity)),N&&(N[0]===t4.GRADIENT_COLOR?V.colorOverLifetime.color=I.color[1]:N[0]===t4.RGBA_COLOR?V.colorOverLifetime.color=no.createWithData(this.engine,{data:new Uint8Array(N[1]),width:1,height:1}):eZ(N,no)&&(V.colorOverLifetime.color=N))}var L=[],D=[0,0,1,1];if(t.splits){var k=t.splits[0];D=(d=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(E&&!E.animate)for(var B=d?E.row:E.col,z=d?E.col:E.row,U=E.total||B*z,G=0,W=0;W<B;W++)for(var j=0;j<z&&G<U;j++,G++)L.push([W*D[2]/B+D[0],j*D[3]/z+D[1],D[2]/B,D[3]/z]);else L.push(D);this.uvs=L,V.textureFlip=d;var X=t.trails;X&&(this.trails={lifetime:aF(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},p={name:"Trail",matrix:nm.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:aF(X.opacityOverLifetime||1),widthOverTrail:aF(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion},X.colorOverLifetime&&X.colorOverLifetime[0]===t4.GRADIENT_COLOR&&(p.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===t4.GRADIENT_COLOR&&(p.colorOverTrail=X.colorOverTrail[1])),this.particleMeshProps=V,p&&(this.trailMeshProps=p);var H=t.interaction;H&&(this.interaction={multiple:H.multiple,radius:null!=(m=H.radius)?m:.4,behavior:H.behavior}),this.item.getHitTestParams=this.getHitTestParams},rk(i,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),i}(rB),t.ParticleSystem=eq([i1(eS.ParticleSystem)],t.ParticleSystem);var uI=new it,uR=new e7,uO=new nv,uV=new it,uN=new it,uF=new it,uL=new nv,uD=[0,0,0],uk=new nm;t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.create=function(e,i){var r=i[this.getInstanceId()];if(eZ(r,t.VFXItem))for(var n,a=iQ(this.getChildTracks());!(n=a()).done;){var o=n.value;if(eZ(o,t.ActivationTrack)){if(r.getComponent(t.ParticleSystem))for(var s,u=e.createTrack(sG,this,"ParticleTrack"),h=iQ(o.getClips());!(s=h()).done;){var l=s.value,c=u.createClip(u_);c.start=l.start,c.duration=l.duration,c.endBehavior=l.endBehavior}if(r.getComponent(t.SpriteComponent))for(var f,d=e.createTrack(uW,this,"SpriteComponentTimeTrack"),p=iQ(o.getClips());!(f=p()).done;){var m=f.value,v=d.createClip(uX);v.start=m.start,v.duration=m.duration,v.endBehavior=m.endBehavior}if(r.getComponent(t.EffectComponent))for(var y,g=e.createTrack(uj,this,"EffectComponentTimeTrack"),x=iQ(o.getClips());!(y=x()).done;){var b=y.value,T=g.createClip(uX);T.start=b.start,T.duration=b.duration,T.endBehavior=b.endBehavior}break}}},i}(t.TrackAsset),t.ObjectBindingTrack=eq([i1(eS.ObjectBindingTrack)],t.ObjectBindingTrack),t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new sT},e}(sp),t.ActivationPlayableAsset=eq([i1(eS.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=eq([i1(eS.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=eq([i1(eS.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SpritePropertyPlayableAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.curveData=[28,[]],e}iY(e,t);var i=e.prototype;return i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i=e.curveData[1],r=[],n=0;n<i.length;n++){var a=i[n],o=a[0],s=a[1];r.push([o,this.engine.findObject(s)])}this.curveData[1]=r},i.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),t.SpritePropertyPlayableAsset=eq([i1("SpritePropertyPlayableAsset")],t.SpritePropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new sP},e}(sp),t.SubCompositionPlayableAsset=eq([i1(eS.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=eq([i1(eS.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector3ropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.Vector3ropertyPlayableAsset.prototype,"curveData",void 0),t.Vector3ropertyPlayableAsset=eq([i1(eS.Vector3PropertyPlayableAsset)],t.Vector3ropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=eq([i1(eS.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset);var uB=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i,this.mixer.trackInstance=this}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.tracks=[],e.cacheFlattenedTracks=null,e}iY(e,t);var i=e.prototype;return i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=iQ(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=iQ(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},rk(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=iQ(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(i4),eq([i3(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=eq([i1(eS.TimelineAsset)],t.TimelineAsset);var uz=function(){function e(e,i){this.masterTrackInstances=[],this.clips=[];for(var r,n={},a=iQ(i);!(r=a()).done;){var o=r.value;n[o.key.getInstanceId()]=o.value}for(var s,u=iQ(e.tracks);!(s=u()).done;){var h=s.value;eZ(h,t.ObjectBindingTrack)&&h.create(e,n)}this.compileTracks(e.flattenedTracks,i)}var i=e.prototype;return i.evaluate=function(t,e){for(var i,r=iQ(this.clips);!(i=r()).done;)i.value.evaluateAt(t);for(var n,a=iQ(this.masterTrackInstances);!(n=a()).done;){var o=n.value;this.tickTrack(o,e)}},i.compileTracks=function(t,e){for(var i,r={},n=iQ(t);!(i=n()).done;){var a=i.value,o=a.createPlayableGraph(this.clips),s=a.createOutput(),u=new uB(a,o,s);r[a.getInstanceId()]=u,a.parent||this.masterTrackInstances.push(u)}for(var h,l=iQ(t);!(h=l()).done;)for(var c,f=h.value,d=r[f.getInstanceId()],p=iQ(f.getChildTracks());!(c=p()).done;){var m=r[c.value.getInstanceId()];d.addChild(m)}for(var v,y=iQ(e);!(v=y()).done;){var g=v.value;r[g.key.getInstanceId()].boundObject=g.value}for(var x,b=iQ(this.masterTrackInstances);!(x=b()).done;){var T=x.value;this.updateTrackAnimatedObject(T)}},i.tickTrack=function(e,i){var r=e.output.context;r.deltaTime=i,e.output.setUserData(e.boundObject);for(var n,a=iQ(e.mixer.clipPlayables);!(n=a()).done;){var o=n.value;o.getPlayState()===t.PlayState.Playing&&o.processFrame(r)}e.mixer.evaluate(r);for(var s,u=iQ(e.children);!(s=u()).done;){var h=s.value;this.tickTrack(h,i)}},i.updateTrackAnimatedObject=function(t){for(var e,i=iQ(t.children);!(e=i()).done;){var r=e.value;if(!r.boundObject){var n=r.trackAsset.updateAnimatedObject(t.boundObject);r.boundObject=n}this.updateTrackAnimatedObject(r)}},e}(),uU=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new sv;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(sp),t.SpriteColorPlayableAsset=eq([i1(eS.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset);var uG=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sx},e}(t.TrackAsset),uW=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.updateAnimatedObject=function(e){return e.getComponent(t.SpriteComponent)},i}(uG),uj=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.updateAnimatedObject=function(e){return e.getComponent(t.EffectComponent)},i}(uG),uX=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new uH},e}(sp),uH=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(sf);t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).time=0,r.duration=1,r.name="MSprite"+uU++,i&&r.fromData(i),r}iY(i,e);var r=i.prototype;return r.onUpdate=function(i){var r=this;e.prototype.onUpdate.call(this,i);var n=this.time,a=this.duration,o=this.textureSheetAnimation,s=null==(l=null==o?void 0:o.loop)||l;n>a&&s&&(n%=a);var u=Math.min(Math.max(n/a,0),1),h=this.renderer.texture.source.video;if(h&&(0===n?h.pause():h.play().catch(function(t){r.engine.renderErrors.add(t)}),this.renderer.texture.uploadCurrentVideoFrame()),o){var l,c,f,d,p,m=o.total||o.row*o.col,v=this.sprite,y=null!=(f=null==v?void 0:v.rect)?f:[0,0,1,1],g=(null!=(d=null==v?void 0:v.rotation)?d:t.SpriteRotation.None)===t.SpriteRotation.Rotate90,x=y[0],b=y[1],T=g?y[3]:y[2],S=g?y[2]:y[3],E=g?1/o.row*T:1/o.col*T,C=g?1/o.col*S:1/o.row*S;if(o.animate){var w=Math.round(u*(m-1)),_=Math.floor(w/o.col),M=w-_*o.col;p=g?[E*_,C*(o.col-M)]:[E*M,C*(1+_)]}else p=[0,C];null==(c=this.material.getVector4("_TexOffset"))||c.setFromArray([x+p[0],S+b-p[1],E,C])}this.time=n+i/1e3},r.onDisable=function(){e.prototype.onDisable.call(this),this.time=0},r.onDestroy=function(){var e=this.renderer.texture.source;e.sourceType===t.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())},r.updateGeometry=function(e){var i=this.sprite,r=null!=(C=null==i?void 0:i.rotation)?C:t.SpriteRotation.None,n=null!=(w=null==i?void 0:i.rect)?w:[0,0,1,1],a=this.textureSheetAnimation?[0,0,1,1]:[n[0],n[1],n[2],n[3]],o=a[0],s=a[1],u=a[2],h=a[3],l=r===t.SpriteRotation.Rotate90,c=l?h:u,f=l?u:h,d=l?-Math.PI/2:0,p=e.getAttributeData(nV.UVKind),m=e.getAttributeData(nV.PositionKind),v=e.getIndexData(),y=[0,0];if(p&&m&&v){for(var g=p.length/2,x=0;x<g;x++){var b=3*x,T=2*x,S=m[b],E=m[b+1];y[0]=S,y[1]=E,up(y,y,d),p[T]=(y[0]+.5)*c+o,p[T+1]=(y[1]+.5)*f+s}this.updateAttributeData(nV.PositionKind,m.slice(),3),this.updateAttributeData(nV.UVKind,p.slice(),2),this.geometry.setIndexData(v.slice()),this.geometry.setDrawCount(v.length)}this.geometry.subMeshes.length=0;for(var C,w,_,M=iQ(e.subMeshes);!(_=M()).done;){var A=_.value;this.geometry.subMeshes.push({offset:A.offset,indexCount:A.indexCount,vertexCount:A.vertexCount})}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),t.sprite){var i,r=this.engine.findObject(t.sprite);r&&this.applySpriteToRenderer(r)}this.textureSheetAnimation=t.textureSheetAnimation;var n=t.geometry?this.engine.findObject(t.geometry):this.defaultGeometry,a=t.splits;a&&a.length>1?this.updateGeometryFromMultiSplit(a):this.updateGeometry(n),this.interaction=t.interaction;var o=t.options.startColor||[1,1,1,1];this.material.setColor("_Color",new ii().setFromArray(o)),this.duration=null!=(i=t.duration)?i:this.item.duration},r.applySpriteToRenderer=function(t){this._sprite=t,this.renderer.texture=t.texture,this.material.setTexture("_MainTex",t.texture)},r.updateGeometryFromMultiSplit=function(t){for(var e=this.defaultGeometry,i=[],r=[],n=[],a=0;a<2;a++)for(var o=0;o<2;o++){var s=(2*o+a)*4,u=t[2*o+a],h=u[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],l=((a+a+1)/2-1)/2,c=((o+o+1)/2-1)/2,f=u[0],d=u[1],p=u[4]?u[3]:u[2],m=u[4]?u[2]:u[3],v=[-.25+l,.25+c,-.25+l,-.25+c,.25+l,.25+c,.25+l,-.25+c];i.push(h[0]*p+f,h[1]*m+d,h[2]*p+f,h[3]*m+d,h[4]*p+f,h[5]*m+d,h[6]*p+f,h[7]*m+d),n.push(1*v[0],1*v[1],0,1*v[2],1*v[3],0,1*v[4],1*v[5],0,1*v[6],1*v[7],0),r.push(s,1+s,2+s,2+s,1+s,3+s)}this.updateAttributeData(nV.PositionKind,new Float32Array(n),3),e.setIndexData(new Uint16Array(r)),this.updateAttributeData(nV.UVKind,new Float32Array(i),2),e.setDrawCount(r.length)},r.updateAttributeData=function(t,e,i){var r=this.geometry.getVertexBuffer(t),n=null==r?void 0:r.getBuffer();if(!r||n&&e.byteLength>n.capacity){this.geometry.setVerticesBuffer(new nV(this.engine,e,t,{updatable:!0,size:i}));return}this.geometry.setAttributeData(t,e)},rk(i,[{key:"sprite",get:function(){return this._sprite},set:function(t){this.applySpriteToRenderer(t),this.updateGeometry(this.geometry)}}]),i}(oq),t.SpriteComponent=eq([i1(eS.SpriteComponent)],t.SpriteComponent);var uY=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX));function uZ(t){return" "===t||" "===t||"\xa0"===t}function uq(t){var e,i=null!=(e=t.codePointAt(0))?e:0;return i>=13312&&i<=19903||i>=19968&&i<=40959||i>=63744&&i<=64255||i>=131072&&i<=195103||i>=12352&&i<=12447||i>=12448&&i<=12543||i>=12784&&i<=12799||i>=44032&&i<=55215}function uK(t){return uZ(t)?"swallow":!!uq(t)&&"keep"}var uQ=function(){function t(t){this.width=0,this.height=0,this.autoResize=eo.fixed,this.keepWordIntact=!0,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?ea.clip:r,a=t.textVerticalAlign,o=void 0===a?eh.top:a,s=t.textAlign,u=void 0===s?eu.left:s,h=t.letterSpace,l=t.fontSize,c=t.lineHeight,f=t.autoResize,d=void 0===f?eo.fixed:f,p=t.keepWordIntact;this.letterSpace=void 0===h?0:h,this.overflow=n,this.textVerticalAlign=o,this.textAlign=u,this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.autoResize=d,this.keepWordIntact=void 0===p||p,this.lineHeight=void 0===c?l:c},e.getOffsetY=function(t,e,i,r,n){var a=(i-r)/3,o=void 0!==n?n:i*(e-1),s=0;switch(this.textVerticalAlign){case eh.top:s=r+a;break;case eh.middle:s=(this.height-o+r)/2;break;case eh.bottom:s=this.height-o-a}return s},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case eu.left:i=0;break;case eu.middle:i=(this.width-e)/2;break;case eu.right:i=this.width-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),uJ=function(){function t(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0,this.update(t)}return t.prototype.update=function(t){var e,i,r,n,a,o,s,u=t.textColor,h=t.fontSize,l=t.outline,c=t.shadow,f=t.fontWeight,d=t.fontStyle,p=t.fontFamily;this.textColor=[].concat(void 0===u?[1,1,1,1]:u),this.textWeight=void 0===f?"normal":f,this.fontStyle=void 0===d?"normal":d,this.fontFamily=void 0===p?"sans-serif":p,this.fontSize=void 0===h?40:h,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,l&&(null!=(e=l.outlineWidth)?e:0)>0&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=l.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=l.outlineWidth)?r:0),this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,c&&(this.hasShadow=!0,this.shadowBlur=null!=(n=c.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(a=c.shadowColor)?a:[0,0,0,1]),this.shadowOffsetX=null!=(o=c.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(s=c.shadowOffsetY)?s:0),this.fontOffset=0,this.fontStyle!==ec.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),u$=function(){function t(){this.isDirty=!0,this.maxLineWidth=0,this.ALPHA_FIX_VALUE=1/255}var e=t.prototype;return e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextVerticalAlign=function(t){this.textLayout.textVerticalAlign!==t&&(this.textLayout.textVerticalAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。本次调用将转调用 setTextVerticalAlign。"),this.setTextVerticalAlign(t)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(!iE(t)){console.warn("Risky font family, ignored:",t);return}this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=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.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontFamily,n=e.textWeight,a=e.fontStyle,o=""+(t||i).toString()+"px ";return["serif","sans-serif","monospace","courier"].includes(r)?o+=r:o+='"'+r+'"',n!==el.normal&&(o=n+" "+o),a!==ec.normal&&(o=a+" "+o),o},e.setupOutline=function(t){void 0===t&&(t=1);var e=this.context,i=this.textStyle,r=i.outlineColor,n=i.outlineWidth,a=r[0],o=r[1],s=r[2],u=r[3];e&&(e.strokeStyle="rgba("+255*a+", "+255*o+", "+255*s+", "+u+")",e.lineWidth=2*n/t)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.shadowColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=e.fontScale,s=i[0],u=i[1],h=i[2],l=i[3];t&&(t.shadowColor="rgba("+255*s+", "+255*u+", "+255*h+", "+l+")",t.shadowBlur=r*o,t.shadowOffsetX=n*o,t.shadowOffsetY=-a*o)},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.releaseTextCanvas=function(){this.canvas&&this.context&&(oL.releaseCanvasAndContext({canvas:this.canvas,context:this.context}),this.canvas=void 0,this.context=null)},e.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var a=this.context,o=Math.max(1,t),s=Math.max(1,e);a.save(),this.canvas.width=o,this.canvas.height=s,a.setTransform(1,0,0,1,0,0),i||(a.translate(0,s),a.scale(1,-1)),a.clearRect(0,0,o,s),a.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(a),a.restore();var u=a.getImageData(0,0,o,s),h=no.createWithData(this.engine,{data:new Uint8Array(u.data),width:u.width,height:u.height},{flipY:i,magFilter:rG.LINEAR,minFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=h,this.material.setTexture("_MainTex",h)}},e.initTextBase=function(t){this.engine=t;var e=oL.getCanvasAndContext(1,1);this.canvas=e.canvas,this.context=e.context},t}(),u0=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,u1=0;t.TextComponent=function(t){function e(e){(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+u1++;var i,r=oL.getCanvasAndContext(1,1);i.canvas=r.canvas,i.context=r.context;var n=i.getDefaultProps().options;return i.updateWithOptions(n),i}iY(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=iQ(this.materials);!(i=r()).done;){var n=i.value,a=this.transform.size.x,o=this.transform.size.y,s=this.getTextureExpandScale(),u=s[0],h=s[1];a*=u,o*=h,n.setVector2("_Size",new e7(a,o))}},i.render=function(t){this.maskManager.drawStencilMask(t,this),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.material)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture(),this.releaseTextCanvas()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.resetState(),this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new ii(1,1,1,1))},i.resetState=function(){this.disposeTextTexture(),this.isDirty=!0,this.lineCount=0,this.maxLineWidth=0},i.updateWithOptions=function(t){this.textStyle?this.textStyle.update(t):this.textStyle=new uJ(t),this.textLayout?this.textLayout.update(t):this.textLayout=new uQ(t),this.text=t.text.toString()},i.getLineCount=function(t){var e=this.context,i=this.textLayout,r=i.letterSpace,n=i.overflow;this.maxLineWidth=0;var a=this.textLayout.width+this.textStyle.fontOffset,o=1,s=0,u=0,h=Array.from(t);if(e&&(e.font=this.getFontDesc(this.textStyle.fontSize)),n===ea.display){for(var l,c=iQ(h);!(l=c()).done;){var f,d,p=l.value,m=null!=(d=null==e?void 0:null==(f=e.measureText(p))?void 0:f.width)?d:0;"\n"===p?(o++,s=0,u=0):(u>0&&(s+=r),s+=m,u++,this.maxLineWidth=Math.max(this.maxLineWidth,s))}return o}if(this.textLayout.keepWordIntact)for(var v,y=0,g=0,x=iQ(h);!(v=x()).done;){var b,T,S=v.value,E=null!=(T=null==e?void 0:null==(b=e.measureText(S))?void 0:b.width)?T:0;if("\n"===S){o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0,y=0,g=0;continue}s+(u>0?r:0)+E>a&&u>0&&(o++,g>1?(this.maxLineWidth=Math.max(this.maxLineWidth,y),s-=y,u-=g):(this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),y=0,g=0),u>0&&(s+=r),s+=E,u++,!1!==uK(S)&&(y=s,g=u)}else for(var C=0;C<h.length;C++){var w,_,M=h[C],A=null!=(_=null==e?void 0:null==(w=e.measureText(M))?void 0:w.width)?_:0;u>0&&(s+=r),(s+A>a&&C>0||"\n"===M)&&(o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),"\n"!==M&&(s+=A,u++)}return this.maxLineWidth=Math.max(this.maxLineWidth,s),o},i.setLineHeight=function(t){var e=Math.max(this.textStyle.fontSize,t);this.textLayout.lineHeight!==e&&(this.textLayout.lineHeight=e,this.isDirty=!0)},i.updateTexture=function(t){var e=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var i=this.textStyle,r=this.textLayout,n=i.fontScale;r.autoResize===eo.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):r.autoResize===eo.autoHeight?(this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):this.lineCount=this.getLineCount(this.text);var a=r.width+i.fontOffset,o=r.height,s=i.fontSize,u=r.lineHeight;i.fontDesc=this.getFontDesc(s);var h=Array.from(this.text||""),l=this.getEffectPadding(),c=l.padL,f=l.padR,d=l.padT,p=l.padB,m=(c|f|d|p)!=0,v=this.engine.gpuCapability.detail.maxTextureSize/2,y=m?a+c+f:a,g=m?o+d+p:o;n=Math.min(n,v/Math.max(y,g,1));var x=Math.ceil(y*n),b=Math.ceil(g*n),T=m?c:0,S=m?t?d:p:0;this.effectScaleX=a>0?x/(a*n):1,this.effectScaleY=o>0?b/(o*n):1,this.transform.setSize(.0123044998279225*a,.0123044998279225*o),this.renderToTexture(x,b,t,function(t){t.scale(n,n),e.maxLineWidth>a&&r.overflow===ea.display?t.font=e.getFontDesc(s*a/e.maxLineWidth):t.font=i.fontDesc;var o=i.textColor,l=o[0],c=o[1],f=o[2],d=o[3];t.fillStyle="rgba("+255*l+", "+255*c+", "+255*f+", "+d+")";var p=[],m=0,v=r.getOffsetY(i,e.lineCount,u,s),y=[],g=[];if(r.keepWordIntact)for(var x=-1,b=!1,E=0;E<h.length;E++){var C=h[E],w=t.measureText(C);if("\n"===C){p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1,b=!1;continue}if(m+(y.length>0?r.letterSpace:0)+w.width>a&&y.length>0){if(x>0){var _=b?x:x+1,M=y.slice(0,_),A=g.slice(0,_),P=M.length>0?A[A.length-1]+t.measureText(M[M.length-1]).width:0;p.push({y:v,width:P,chars:M,charOffsetX:A}),v+=u,y=y.slice(x+1),m=0,g=[];for(var I=0;I<y.length;I++)I>0&&(m+=r.letterSpace),g.push(m),m+=t.measureText(y[I]).width;x=-1,b=!1}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1,b=!1}y.length>0&&(m+=r.letterSpace),g.push(m),y.push(C),m+=w.width;var R=uK(C);!1!==R&&(x=y.length-1,b="swallow"===R)}else for(var O=0;O<h.length;O++){var V=h[O],N=t.measureText(V);y.length>0&&(m+=r.letterSpace),(m+N.width>a&&O>0||"\n"===V)&&(p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[]),"\n"!==V&&(y.push(V),g.push(m),m+=N.width)}y.length>0&&p.push({y:v,width:m,chars:y,charOffsetX:g});var F=i.isOutlined&&i.outlineWidth>0;F&&(i.hasShadow&&e.setupShadow(),e.setupOutline(n),p.forEach(function(e){var n=S+e.y,a=e.chars.join("");if(a.length>0&&u0.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.strokeText(a,T+s+o,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=T+u+e.charOffsetX[h];t.strokeText(l,c,n)}}),i.hasShadow&&(t.shadowColor="transparent")),!F&&i.hasShadow&&e.setupShadow(),p.forEach(function(e){var n=S+e.y,a=e.chars.join("");if(a.length>0&&u0.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.fillText(a,T+s+o,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=T+u+e.charOffsetX[h];t.fillText(l,c,n)}}),i.hasShadow&&(t.shadowColor="transparent")}),this.isDirty=!1}},i.renderText=function(t){this.updateTexture()},i.getTextureExpandScale=function(){return[this.effectScaleX,this.effectScaleY]},i.getEffectPadding=function(){var t=this.textStyle,e=(t.isOutlined&&t.outlineWidth>0?Math.ceil(2*t.outlineWidth):0)+(t.hasShadow&&(t.shadowBlur>0||0!==t.shadowOffsetX||0!==t.shadowOffsetY)?Math.ceil(Math.abs(t.shadowOffsetX)+Math.abs(t.shadowOffsetY)+t.shadowBlur):0);return{padL:e,padR:e,padT:e,padB:e}},i.setAutoResize=function(t){this.textLayout.autoResize!==t&&(this.textLayout.autoResize=t,this.isDirty=!0)},i.setTextWidth=function(t){var e=Math.max(0,Number(t)||0),i=this.textLayout;i.width!==e&&(i.autoResize===eo.autoWidth&&(i.autoResize=eo.autoHeight),i.width=e,this.isDirty=!0)},i.setTextHeight=function(t){var e=Math.max(0,Number(t)||0);if(0!==e){var i=this.textLayout;i.height!==e&&(i.height=e,this.isDirty=!0)}},i.setFontSize=function(t){var e=Math.max(1,Number(t)||1);this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.isDirty=!0)},i.setOutlineWidth=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},i.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},i.setShadowBlur=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},i.setShadowColor=function(t){var e=null!=t?t:[0,0,0,1];this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},i.setShadowOffsetX=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},i.setShadowOffsetY=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},i.getTextWidth=function(){var t,e,i,r=this.context;if(!r)return null!=(e=null==(t=this.textLayout)?void 0:t.width)?e:0;var n=(null!=(i=this.text)?i:"").toString(),a=this.textLayout,o=this.textStyle;r.font=this.getFontDesc(o.fontSize);for(var s=0,u=0,h=0;h<n.length;h++){var l=n[h];if("\n"===l){s=Math.max(s,u),u=0;continue}u+=(a.letterSpace||0)+r.measureText(l).width}return Math.max(0,Math.ceil((s=Math.max(s,u))-(o.fontOffset||0)-1e-4)+2)},i.getDefaultProps=function(){return{id:"default-id-"+Math.random().toString(36).substr(2,9),item:{id:"default-item-"+Math.random().toString(36).substr(2,9)},dataType:eS.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:el.normal,letterSpace:0,textAlign:eu.middle,fontStyle:ec.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(oq),t.TextComponent=eq([i1(eS.TextComponent)],t.TextComponent),ik(t.TextComponent,[u$]);var u2=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX));function u3(t,e,i){return Math.max(e,Math.min(i,t))}function u4(t,e){return t.x===e.x&&t.y===e.y}function u5(t){return new e7(t.x,t.y)}function u6(t,e){var i=Math.hypot(t,e);return i<=Number.EPSILON?new e7(1,0):new e7(t/i,e/i)}function u8(t,e){var i=1-e,r=i*i,n=e*e,a=r*i,o=3*r*e,s=3*i*n,u=n*e;return new e7(a*t[0].x+o*t[1].x+s*t[2].x+u*t[3].x,a*t[0].y+o*t[1].y+s*t[2].y+u*t[3].y)}function u9(t,e){var i,r,n,a,o,s,u,h,l,c,f,d,p=new e7((i=t[0].x)+(t[1].x-i)*e,(r=t[0].y)+(t[1].y-r)*e),m=new e7((n=t[1].x)+(t[2].x-n)*e,(a=t[1].y)+(t[2].y-a)*e),v=new e7((o=t[2].x)+(t[3].x-o)*e,(s=t[2].y)+(t[3].y-s)*e),y=new e7((u=p.x)+(m.x-u)*e,(h=p.y)+(m.y-h)*e),g=new e7((l=m.x)+(v.x-l)*e,(c=m.y)+(v.y-c)*e),x=new e7((f=y.x)+(g.x-f)*e,(d=y.y)+(g.y-d)*e);return[[u5(t[0]),p,y,x],[x,g,v,u5(t[3])]]}function u7(t,e){t.push({action:"moveTo",data:[e]})}function ht(t,e){t.push({action:"lineTo",data:[e]})}function he(t){t.push({action:"closePath",data:[]})}var hi=new it;function hr(t,e,i,r){if(0===t.length)return t.push(u5(i)),r;var n=t[t.length-1],a=Math.hypot(i.x-n.x,i.y-n.y);if(a<=Number.EPSILON)return r;var o=t.length-1;return t.push(u5(i)),r+=a,e.push({distance:r,pointIndex:o,tValue:1,type:"line"}),r}function hn(t,e,i,r){return 0===e.length||t.length<2||i<=Number.EPSILON?null:{points:t,segments:e,closePath:r}}function ha(t,e){for(var i=t[e].pointIndex,r=e+1;r<t.length&&t[r].pointIndex===i;)r++;return r}function ho(t,e){return[t[e],t[e+1]]}function hs(t,e){return[t[e],t[e+1],t[e+2],t[e+3]]}var hu=function(){function t(t,e,i,r){this.segments=t,this.points=e,this.contourLength=i,this.contourClosed=r}var e=t.prototype;return e.length=function(){return this.contourLength},e.isClosed=function(){return this.contourClosed},e.getPosTan=function(t){if(0===this.segments.length)return{pos:new e7,tan:new e7(1,0)};var e,i,r,n,a,o,s=u3(t,0,this.contourLength),u=this.findSegment(s),h=this.segments[u],l=u>0?this.segments[u-1].distance:0,c=h.distance-l,f=c<=Number.EPSILON?0:(s-l)/c;if("line"===h.type)return{pos:[new e7((i=(e=ho(this.points,h.pointIndex))[0].x)+(e[1].x-i)*f,(r=e[0].y)+(e[1].y-r)*f),new e7((n=e[0].x)+(e[1].x-n)*f,(a=e[0].y)+(e[1].y-a)*f)][0],tan:u6(e[1].x-e[0].x,e[1].y-e[0].y)};var d=u>0?this.segments[u-1]:void 0,p=(o=d&&d.pointIndex===h.pointIndex?d.tValue:0)+(h.tValue-o)*f;return function(t,e){if(e<=0){var i=u4(t[0],t[1])?u4(t[1],t[2])?t[3]:t[2]:t[1];return{pos:new e7(t[0].x,t[0].y),tan:u6(i.x-t[0].x,i.y-t[0].y)}}if(e>=1){var r=u4(t[3],t[2])?u4(t[2],t[1])?t[0]:t[1]:t[2];return{pos:new e7(t[3].x,t[3].y),tan:u6(t[3].x-r.x,t[3].y-r.y)}}var n=u8(t,Math.max(0,e-1e-4)),a=u8(t,Math.min(1,e+1e-4));return{pos:u8(t,e),tan:u6(a.x-n.x,a.y-n.y)}}(hs(this.points,h.pointIndex),p)},e.getSegment=function(t,e,i,r){var n=u3(t,0,this.contourLength),a=u3(e,0,this.contourLength);if(!(n>=a)&&0!==this.segments.length){var o=this.findSegment(n),s=this.findSegment(a),u=this.segments[o],h=this.segments[s],l=this.computeT(o,n),c=this.computeT(s,a);if(1-l<Number.EPSILON&&o<s&&(o++,u=this.segments[o],l=0),u.pointIndex===h.pointIndex){this.extractSegment(o,l,c,i,r);return}this.extractSegment(o,l,1,i,r);for(var f=ha(this.segments,o);f<this.segments.length&&this.segments[f].pointIndex!==h.pointIndex;)this.extractWholeSegment(f,i),f=ha(this.segments,f);this.extractSegment(s,0,c,i,!1)}},e.warp=function(t){var e=this.getPosTan(t.x);return new e7(e.pos.x-e.tan.y*t.y,e.pos.y+e.tan.x*t.y)},e.dump=function(){console.log("ContourMeasure",{length:this.contourLength,points:this.points.length,segments:this.segments.length,isClosed:this.contourClosed})},e.findSegment=function(t){for(var e=0,i=this.segments.length-1;e<i;){var r=e+i>>1;this.segments[r].distance<t?e=r+1:i=r}return e},e.computeT=function(t,e){var i=this.segments[t],r=t>0?this.segments[t-1]:void 0,n=r?r.distance:0,a=r&&r.pointIndex===i.pointIndex?r.tValue:0,o=i.distance<=n?0:(e-n)/(i.distance-n);return u3(a+(i.tValue-a)*o,a,i.tValue)},e.extractWholeSegment=function(t,e){var i=this.segments[t];if("line"===i.type){var r=ho(this.points,i.pointIndex)[1];e.lineTo(r.x,r.y);return}var n=hs(this.points,i.pointIndex),a=n[1],o=n[2],s=n[3];e.bezierCurveTo(a.x,a.y,o.x,o.y,s.x,s.y,i.smoothness,i.scale)},e.extractSegment=function(t,e,i,r,n){var a=this.segments[t];if("line"===a.type){var o,s,u,h,l=ho(this.points,a.pointIndex),c=l[0],f=l[1],d=new e7((o=c.x)+(f.x-o)*e,(s=c.y)+(f.y-s)*e),p=new e7((u=c.x)+(f.x-u)*i,(h=c.y)+(f.y-h)*i);n&&r.moveTo(d.x,d.y),r.lineTo(p.x,p.y);return}var m=function(t,e,i){if(e<=0&&i>=1)return t.map(u5);var r=u3(e,0,1),n=u3(i,r,1),a=t.map(u5);return r>0&&(a=u9(a,r)[1]),n<1&&(a=u9(a,r>=1?0:(n-r)/(1-r))[0]),a}(hs(this.points,a.pointIndex),e,i);n&&r.moveTo(m[0].x,m[0].y),r.bezierCurveTo(m[1].x,m[1].y,m[2].x,m[2].y,m[3].x,m[3].y,a.smoothness,a.scale)},t}(),hh=function(){function t(t,e){void 0===e&&(e=1),this.contourPath=[],this.cursor=0,this.screenScale=1,this.rewind(t,e)}var e=t.prototype;return e.rewind=function(t,e){var i,r;void 0===e&&(e=1),this.contourPath=(i=e,null!=(r=function(t){for(var e,i=[],r=iQ(t.instructions);!(e=r()).done;){var n=e.value,a=n.data;switch(n.action){case"moveTo":u7(i,new e7(a[0],a[1]));break;case"lineTo":ht(i,new e7(a[0],a[1]));break;case"bezierCurveTo":!function(t,e,i,r,n,a){t.push({action:"bezierCurveTo",data:[e,i,r],smoothness:n,scale:a})}(i,new e7(a[0],a[1]),new e7(a[2],a[3]),new e7(a[4],a[5]),a[6],a[7]);break;case"closePath":he(i);break;default:return null}}return i}(t))?r:function(t,e){for(var i,r=[],n=iQ(t.shapePrimitives);!(i=n()).done;)!function(){var t,n=i.value,a=n.shape,o=n.transform;!function(t,e,i){if(!(e.length<2)){u7(t,new e7(e[0],e[1]));for(var r=2;r<e.length;r+=2)ht(t,new e7(e[r],e[r+1]));i&&he(t)}}(r,function(t,e){if(!e)return t.slice();for(var i=Array(t.length),r=0;r<t.length;r+=2){hi.set(t[r],t[r+1],0);var n=e.transformPoint(hi,hi);i[r]=n.x,i[r+1]=n.y}return i}(eZ(a,a$)?a.points.slice():(t=[],a.build(t,e),t),o),!eZ(a,a$)||a.closePath)}();return r}(t.shapePath,i)),this.screenScale=e,this.cursor=0},e.tryNext=function(){var e=function(t,e,i,r){for(var n=[],a=[],o=0,s=null,u=!1,h=function(){if(0===n.length){var t=null!=s?s:new e7(0,0);n.push(u5(t)),s=u5(t)}},l=e;l<t.length;l++){var c=t[l];switch(c.action){case"moveTo":var f=hn(n,a,o,u);if(f)return{contour:f,nextIndex:l};n=[],a=[],o=0,s=u5(c.data[0]),u=!1,n.push(u5(s));break;case"lineTo":h(),o=hr(n,a,c.data[0],o);break;case"bezierCurveTo":h();var d,p=n[n.length-1],m=n.length-1,v=c.data,y=v[0],g=v[1],x=v[2],b=function(t,e,i,r,n,a,o,s){var u=[],h=[];aH(u,r[0].x,r[0].y,r[1].x,r[1].y,r[2].x,r[2].y,r[3].x,r[3].y,null!=o?o:a,null!=s?s:n,h);for(var l=[],c=r[0],f=0;f<h.length;f++){var d=h[f],p=2*f,m=d>=1?r[3]:new e7(u[p],u[p+1]),v=Math.hypot(m.x-c.x,m.y-c.y);v>Number.EPSILON&&(i+=v,l.push({distance:i,pointIndex:e,tValue:d,type:"cubic",smoothness:o,scale:s}),c=m)}return 0===l.length||t.push(u5(r[1]),u5(r[2]),u5(r[3])),{distance:i,segments:l}}(n,m,o,[u5(p),u5(y),u5(g),u5(x)],i,r,c.smoothness,c.scale);o=b.distance,(d=a).push.apply(d,[].concat(b.segments));break;case"closePath":n.length>0&&s&&(o=hr(n,a,s,o),u=!0);var T=hn(n,a,o,u);if(T)return{contour:T,nextIndex:l+1};n=[],a=[],o=0,s=null,u=!1}}return{contour:hn(n,a,o,u),nextIndex:t.length}}(this.contourPath,this.cursor,this.screenScale,t.defaultTolerance);this.cursor=e.nextIndex;var i=e.contour?function(t){if(t.points.length<2||0===t.segments.length)return null;var e=t.segments[t.segments.length-1].distance;return e<=Number.EPSILON?null:{points:t.points,segments:t.segments,contourLength:e,contourClosed:t.closePath}}(e.contour):null;return i?new hu(i.segments,i.points,i.contourLength,i.contourClosed):null},e.next=function(){for(;this.cursor<this.contourPath.length;){var t=this.tryNext();if(t)return t}return null},e.toArray=function(){for(var t,e=this.cursor,i=[];t=this.next();)i.push(t);return this.cursor=e,i},t}();hh.defaultTolerance=.5;var hl=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=iQ(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"lineTo":this.lineTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4]);break;case"circle":this.circle(a[0],a[1],a[2],a[3]);break;case"polyStar":this.polyStar(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"rect":this.rect(a[0],a[1],a[2],a[3],a[4]);break;case"triangle":this.triangle(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o,s){this.ensurePoly();var u=this.currentPoly;return aH(u.points,u.lastX,u.lastY,t,e,i,r,n,a,o,s),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.lineTo=function(t,e){this.ensurePoly();var i=this.currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new aW(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new aJ(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new aQ(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new aj(t,e,i,r,n),a),this},e.triangle=function(t,e,i,r,n,a,o){return this.drawShape(new aX(t,e,i,r,n,a),o),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new a$).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new a$,this.currentPoly.points.push(0,0))},t}(),hc=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o,s){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,o,s]}),this.dirty=!0,this},e.lineTo=function(t,e){return this.instructions.push({action:"lineTo",data:[t,e]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.circle=function(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.triangle=function(t,e,i,r,n,a,o){return this.instructions.push({action:"triangle",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,o){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},rk(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new hl(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();t.TrimPathMode=void 0,(tD=t.TrimPathMode||(t.TrimPathMode={}))[tD.Synchronized=0]="Synchronized",tD[tD.Sequential=1]="Sequential";var hf=function(){function t(){this.start=0,this.end=1,this.offset=0,this.mode=0,this.trimmedGraphicsPath=new hc}var e=t.prototype;return e.clone=function(){var e=new t;return e.start=this.start,e.end=this.end,e.offset=this.offset,e.mode=this.mode,e},e.createTrimmedPath=function(t,e){if(this.isIdentity())return t;var i=new hh(t,e).toArray();return this.trimmedGraphicsPath.clear(),0===i.length||(1===this.mode?this.applySequentialTrimPath(i,this.trimmedGraphicsPath):this.applySynchronizedTrimPath(i,this.trimmedGraphicsPath)),this.trimmedGraphicsPath},e.isIdentity=function(){return 0===this.start&&1===this.end},e.fromData=function(t){this.start=t.start,this.end=t.end,this.offset=t.offset,this.mode=t.mode},e.normalizeTrimOffset=function(){return(this.offset%1+1)%1},e.applySequentialTrimPath=function(t,e){for(var i,r=0,n=iQ(t);!(i=n()).done;)r+=i.value.length();if(!(r<=0)){var a=this.normalizeTrimOffset(),o=r*(this.start+a),s=r*(this.end+a);if(s<o){var u=o;o=s,s=u}o>r&&(o-=r,s-=r);for(var h=[],l=0;s>0;){var c=l%t.length,f=t[c].length();o<f?(h.push({contourIndex:c,startLength:o,endLength:s}),s-=f,o=0):(o-=f,s-=f),l++}for(var d=-1,p=0;p<h.length;p++){var m=h[p],v=t[m.contourIndex],y=v.length();v.getSegment(m.startLength,m.endLength,e,d!==m.contourIndex||!v.isClosed()),0===m.startLength&&m.endLength-m.startLength>=y&&v.isClosed()&&e.closePath(),d=m.contourIndex}}},e.applySynchronizedTrimPath=function(t,e){for(var i,r=this.normalizeTrimOffset(),n=iQ(t);!(i=n()).done;){var a=i.value,o=a.length(),s=o*(this.start+r),u=o*(this.end+r);if(u<s){var h=s;s=u,u=h}for(s>=o&&(s-=o,u-=o),a.getSegment(s,u,e,!0);u>o;)s=0,u-=o,a.getSegment(s,u,e,!a.isClosed());0===this.start&&1===this.end&&a.isClosed()&&e.closePath()}},t}();t.TexturePaintScaleMode=void 0,(tk=t.TexturePaintScaleMode||(t.TexturePaintScaleMode={}))[tk.Fill=0]="Fill",tk[tk.Fit=1]="Fit",tk[tk.Crop=2]="Crop",tk[tk.Tile=3]="Tile",t.ShapeComponent=function(e){function i(t){(i=e.call(this,t)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new hc,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:ev.Butt,join:ey.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=ev.Butt,i.strokeJoin=ey.Miter,i.strokes=[],i._strokeTrimPath=null,i._fillTrimPath=null,i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=nm.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===tH.FRONT,clipMasks:i.frameClipMasks}}},i.rendererOptions={renderMode:t$.MESH,blending:tX.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:tH.DOUBLE,mask:0};var i,r,n={type:ed.Solid,color:new ii(1,1,1,1)};i.strokes.push(n);var a={type:ed.Solid,color:new ii(1,1,1,1)};return i.fills.push(a),i.shapeAttributes={type:em.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=a6.create(i.engine,{attributes:((r={})[nV.PositionKind]={type:rG.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},r[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},r),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}iY(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){if(this.shapeDirty){var e,i,r,n,a=this.computeScreenScale();this.buildPath(this.shapeAttributes,a);var o=null!=(r=null==(e=this._fillTrimPath)?void 0:e.createTrimmedPath(this.graphicsPath,a))?r:this.graphicsPath,s=null!=(n=null==(i=this._strokeTrimPath)?void 0:i.createTrimmedPath(this.graphicsPath,a))?n:this.graphicsPath;this.buildGeometryFromPath(o.shapePath,s.shapePath,a),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},r.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=0;e<this.fillMaterials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],t,0);for(var i=0;i<this.strokeMaterials.length;i++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],t,1)}},r.draw=function(t){for(var e=0;e<this.fillMaterials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],0);for(var i=0;i<this.strokeMaterials.length;i++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],1)},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},r.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData(nV.PositionKind);if(t){var e=n6(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},r.buildGeometryFromPath=function(t,e,i){var r=[],n=[];if(this.fills.length>0)for(var a,o=iQ(t.shapePrimitives);!(a=o()).done;){var s=a.value.shape,u=[],h=n.length,l=r.length/2;s.build(u,i),s.triangulate(u,r,l,n,h)}var c=n.length;if(this.strokes.length>0)for(var f,d=iQ(e.shapePrimitives);!(f=d()).done;){var p=f.value.shape,m=[];n.length;var v=r.length/2,y=this.strokeAttributes;y.cap=this.strokeCap,y.join=this.strokeJoin,y.width=this.strokeWidth;var g=!0;this._strokeTrimPath&&!this._strokeTrimPath.isIdentity()?g=!1:eZ(p,a$)&&(g=p.closePath),p.build(m,i),aU(m,y,!1,g,r,2,v,n)}var x=n.length-c,b=r.length/2,T=this.geometry.getAttributeData(nV.PositionKind),S=this.geometry.getAttributeData(nV.UVKind),E=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!S||S.length<2*b)&&(S=new Float32Array(2*b)),(!E||E.length<n.length)&&(E=new Uint16Array(n.length));for(var C=Number.MAX_VALUE,w=Number.MAX_VALUE,_=Number.MIN_VALUE,M=Number.MIN_VALUE,A=0;A<b;A++){var P=3*A,I=2*A,R=r[I],O=r[I+1];T[P]=R,T[P+1]=O,T[P+2]=0,C=Math.min(C,R),w=Math.min(w,O),_=Math.max(_,R),M=Math.max(M,O)}for(var V=_-C,N=M-w,F=0;F<b;F++){var L=3*F,D=2*F;S[D]=(T[L]-C)/V,S[D+1]=(T[L+1]-w)/N}E.set(n),this.updateAttributeData(nV.PositionKind,T,3),this.updateAttributeData(nV.UVKind,S,2),this.geometry.setIndexData(E),this.geometry.setDrawCount(n.length);var k=this.geometry.subMeshes[0],B=this.geometry.subMeshes[1];k.indexCount=c,B.offset=2*c,B.indexCount=x},r.updateAttributeData=function(t,e,i){var r,n=null==(r=this.geometry.getVertexBuffer(t))?void 0:r.getBuffer();if(n&&e.byteLength>n.capacity){this.geometry.setVerticesBuffer(new nV(this.engine,e,t,{updatable:!0,size:i}));return}this.geometry.setAttributeData(t,e)},r.computeScreenScale=function(){var t=this.item.composition;if(!t)return 1;var e=t.camera;if(!e)return 1;var r=e.getModelViewProjection(i.tempMVP,this.transform.getWorldMatrix()).elements,n=Math.abs(r[15])||1,a=Math.sqrt(r[0]*r[0]+r[1]*r[1])/n,o=Math.sqrt(r[4]*r[4]+r[5]*r[5])/n,s=this.engine.canvas.getBoundingClientRect();return Math.max(1,Math.min(2e3,Math.max(s.width,s.height)/2*Math.max(a,o)*this.engine.pixelRatio))},r.buildPath=function(e,i){void 0===i&&(i=1),this.graphicsPath.clear();var r=i;switch(e.type){case em.Custom:for(var n,a=this.shapeAttributes,o=a.points,s=a.easingIns,u=a.easingOuts,h=iQ(a.shapes);!(n=h()).done;){var l=n.value,c=l.indexes,f=o[c[0].point];this.graphicsPath.moveTo(f.x,f.y);for(var d=1;d<c.length;d++){var p=c[d],m=c[d-1],v=o[p.point],y=o[m.point],g=u[m.easingOut],x=s[p.easingIn];this.graphicsPath.bezierCurveTo(g.x+y.x,g.y+y.y,x.x+v.x,x.y+v.y,v.x,v.y,void 0,r)}if(l.close){var b=c[0],T=c[c.length-1],S=o[b.point],E=o[T.point],C=u[T.easingOut],w=s[b.easingIn];this.graphicsPath.bezierCurveTo(C.x+E.x,C.y+E.y,w.x+S.x,w.y+S.y,S.x,S.y,void 0,r),this.graphicsPath.closePath()}}break;case em.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case em.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case em.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case em.Polygon:this.graphicsPath.polyStar(e.pointCount,e.radius,e.radius,e.roundness,e.roundness,t.StarType.Polygon)}},r.updateMaterials=function(){for(var t=0;t<this.fills.length;t++)this.updatePaintMaterial(this.fillMaterials[t],this.fills[t]);for(var e=0;e<this.strokes.length;e++)this.updatePaintMaterial(this.strokeMaterials[e],this.strokes[e])},r.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===ed.Solid)t.color=e.color;else if(e.type===ed.GradientLinear||e.type===ed.GradientAngular||e.type===ed.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===ed.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new e7(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new e7(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var a=e.textureTransform;t.setMatrix3("_TextureTransform",new ny().scale(a.scale.x,a.scale.y).rotate(a.rotation).translate(a.offset.x,a.offset.y).invert())}},r.updateGradientMaterial=function(t,e,i,r){for(var n,a=[],o=[],s=iQ(e.stops);!(n=s()).done;){var u=n.value,h=u.color;a.push(new ie(h.r,h.g,h.b,h.a)),o.push(u.time)}t.setVector4Array("_Colors",a),t.setFloats("_Stops",o),t.setInt("_StopsCount",o.length),t.setVector2("_StartPoint",i),t.setVector2("_EndPoint",r)},r.createMaterialFromRendererOptions=function(e){var i={shader:{vertex:"precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 uv0;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;void main(){vec4 pos=vec4(aPos.xyz,1.0);uv0=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}",fragment:"precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3 _TextureTransform;uniform float _ImageScalingFactor;uniform float _ImageOpacity;varying vec2 uv0;float calculateAngleRatio(vec2 v1,vec2 v2){float angle=atan(v2.y,v2.x)-atan(v1.y,v1.x);if(angle<0.0)angle+=2.0*PI;return angle/(2.0*PI);}vec2 applyTransform(mat3 m,vec2 uv){uv=uv-vec2(0.5,0.5);vec3 p=m*vec3(uv,1.0);p.xy=p.xy+vec2(0.5,0.5);return p.xy;}void main(){vec4 finalColor=vec4(1.0);if(_FillType==0.0){finalColor=_Color;}else if(_FillType==1.0||_FillType==2.0||_FillType==3.0){float t=0.0;if(_FillType==1.0){vec2 gradientVector=_EndPoint-_StartPoint;vec2 pixelVector=uv0-_StartPoint;float denom=max(dot(gradientVector,gradientVector),1e-6);t=clamp(dot(pixelVector,gradientVector)/denom,0.0,1.0);}else if(_FillType==2.0){float maxRadius=max(distance(_EndPoint,_StartPoint),0.001);t=clamp(distance(uv0,_StartPoint)/maxRadius,0.0,1.0);}else{vec2 center=_StartPoint;vec2 referenceVector=_EndPoint-center;vec2 targetVector=uv0-center;if(length(targetVector)>0.001){t=calculateAngleRatio(referenceVector,targetVector);}}if(_StopsCount>0){finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float localT=smoothstep(_Stops[i-1],_Stops[i],t);finalColor=mix(finalColor,_Colors[i],localT);}}}else if(_FillType==4.0){vec2 uv=uv0;float rSrc=_ImageSize.x/max(_ImageSize.y,1.0);float rDst=_DestSize.x/max(_DestSize.y,1.0);bool maskOutside=false;if(_ImageScaleMode==0){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(1.0,rSrc/rDst);}else{scale=vec2(rDst/rSrc,1.0);}uv=(uv-0.5)*scale+0.5;uv=clamp(uv,0.0,1.0);}else if(_ImageScaleMode==1){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(rSrc/rDst,1.0);}else{scale=vec2(1.0,rSrc/rDst);}uv=(uv-0.5)*scale+0.5;maskOutside=true;}else if(_ImageScaleMode==2){uv=applyTransform(_TextureTransform,uv0);maskOutside=true;}else if(_ImageScaleMode==3){float aspectFix=rDst/max(rSrc,1e-6);vec2 uvTile=(uv0-0.5)*vec2(aspectFix,1.0)+0.5;float s=max(abs(_ImageScalingFactor),1e-6);uv=fract(uvTile*s);}vec4 img=texture2D(_ImageTex,uv);if(maskOutside){if(uv.x<0.0||uv.x>1.0||uv.y<0.0||uv.y>1.0){img.a=0.0;}}img.a*=_ImageOpacity;finalColor=img;}finalColor.rgb*=finalColor.a;gl_FragColor=finalColor;}",glslVersion:t.GLSLVersion.GLSL1}},r=nw.create(this.engine,i),n=e.side,a=e.occlusion,o=e.blending,s=e.texture;r.blending=!0,r.depthTest=!0,r.depthMask=a,rY(r,o),rZ(r,n),r.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',r.setVector4("_TexOffset",new ie(0,0,1,1)),r.setTexture("_ImageTex",s);var u=rH(o),h=new ie;return h.x=e.occlusion?+e.transparentOcclusion:1,h.y=u,h.z=e.renderMode,r.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?r.enableMacro("ALPHA_CLIP"):r.disableMacro("ALPHA_CLIP"),r},r.fromData=function(t){e.prototype.fromData.call(this,t),this.shapeDirty=!0,t.mask&&this.maskManager.setMaskOptions(this.engine,t.mask);var i=null!=(r=t.renderer)?r:{};this.rendererOptions={renderMode:t$.MESH,blending:null!=(n=i.blending)?n:tX.ALPHA,texture:i.texture?this.engine.findObject(i.texture):this.engine.whiteTexture,occlusion:!!i.occlusion,transparentOcclusion:!!i.transparentOcclusion||this.maskManager.isMask,side:null!=(a=i.side)?a:tH.DOUBLE,mask:1},this.strokeCap=null!=(o=t.strokeCap)?o:ev.Butt,this.strokeWidth=null!=(s=t.strokeWidth)?s:1,this.strokeJoin=null!=(u=t.strokeJoin)?u:ey.Miter,this._strokeTrimPath=null,this._fillTrimPath=null,t.strokeTrimPath&&(this._strokeTrimPath=new hf,this._strokeTrimPath.fromData(t.strokeTrimPath)),t.fillTrimPath&&(this._fillTrimPath=new hf,this._fillTrimPath.fromData(t.fillTrimPath)),this.fills.length=0,this.fillMaterials.length=0;for(var r,n,a,o,s,u,h,l=iQ(t.fills);!(h=l()).done;){var c=h.value;this.fills.push(this.createPaint(c)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var f,d=iQ(t.strokes);!(f=d()).done;){var p=f.value;this.strokes.push(this.createPaint(p)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),t.type){case em.Custom:for(var m,v={type:em.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},y=iQ(t.points);!(m=y()).done;){var g=m.value;v.points.push(new e7(g.x,g.y))}for(var x,b=iQ(t.easingIns);!(x=b()).done;){var T=x.value;v.easingIns.push(new e7(T.x,T.y))}for(var S,E=iQ(t.easingOuts);!(S=E()).done;){var C=S.value;v.easingOuts.push(new e7(C.x,C.y))}v.shapes=t.shapes,this.shapeAttributes=v;break;case em.Ellipse:var w={type:em.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius};this.shapeAttributes=w;break;case em.Rectangle:var _={type:em.Rectangle,width:t.width,height:t.height,roundness:t.roundness};this.shapeAttributes=_;break;case em.Star:var M={type:em.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness};this.shapeAttributes=M;break;case em.Polygon:var A={type:em.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness};this.shapeAttributes=A}},r.createPaint=function(t){var e;switch(t.type){case ed.Solid:e={type:t.type,color:new ii().copyFrom(t.color)};break;case ed.GradientLinear:case ed.GradientAngular:case ed.GradientRadial:e={type:t.type,gradientStops:aF(t.gradientStops),startPoint:new e7().copyFrom(t.startPoint),endPoint:new e7().copyFrom(t.endPoint)};break;case ed.Texture:var i,r,n,a=ro({offset:{x:0,y:0},rotation:0,scale:{x:1,y:1}},null!=(i=t.textureTransform)?i:{});e={type:t.type,texture:this.engine.findObject(t.texture),scaleMode:t.scaleMode,scalingFactor:null!=(r=t.scalingFactor)?r:1,opacity:null!=(n=t.opacity)?n:1,textureTransform:{offset:new e7().copyFrom(a.offset),rotation:a.rotation,scale:new e7().copyFrom(a.scale)}}}return e},r.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},rk(i,[{key:"shape",get:function(){return this.shapeAttributes}},{key:"strokeTrimPath",get:function(){return this._strokeTrimPath}},{key:"fillTrimPath",get:function(){return this._fillTrimPath}}]),i}(nk),t.ShapeComponent.tempMVP=nm.fromIdentity(),t.ShapeComponent=eq([i1("ShapeComponent")],t.ShapeComponent);var hd=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(i4);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(i4),eq([i3(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=eq([i1(eS.BinaryAsset)],t.BinaryAsset);var hp=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=i2(e);if(r)for(var n,a=iQ(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:iP(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):i4.is(s)?i[o]={id:s.getInstanceId()}:iR(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=iQ(Object.keys(e.definition));!(u=h()).done;){var l=u.value,c=e.definition[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:iP(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):i4.is(c)?i[l]={id:c.getInstanceId()}:iR(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.definition=e;var r=i2(i),n=i.engine;if(r)for(var a,o=iQ(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];if(void 0!==u){var h=r[s].type;i[s]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.definition)},t.checkTypedArray=function(t){return eZ(t,Int8Array)||eZ(t,Uint8Array)||eZ(t,Uint8ClampedArray)||eZ(t,Int16Array)||eZ(t,Uint16Array)||eZ(t,Int32Array)||eZ(t,Uint32Array)||eZ(t,Float32Array)||eZ(t,Float64Array)||eZ(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(iR(t)&&1===Object.keys(t).length&&"id"in t&&iA(t.id))},t.checkGLTFNode=function(t){return iR(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return iV(t)||eZ(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(iP(e)){for(var o,s=[],u=iQ(e);!(o=u()).done;){var h=o.value;s.push(t.deserializeProperty(h,i,r+1,n,a))}return s}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(!iO(e))return e;c=n?new n:{};for(var c,f,d=iQ(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var n,a=iQ(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:iP(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):i4.is(s)?i[o]={id:s.getInstanceId()}:iR(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:iP(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):i4.is(a)?i[n]={id:a.getInstanceId()}:iR(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),hm=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(!r){console.warn("Object data with uuid: "+i+" not found.");return}switch(r.dataType){case eS.Material:e=nw.create(this.engine);break;case eS.Geometry:e=a6.create(this.engine);break;case eS.Texture:e=no.create(this.engine);break;default:var n=i0[r.dataType];n&&(e=new n(this.engine))}if(!e){console.warn("Constructor for DataType: "+r.dataType+" not found.");return}return e.setInstanceId(r.id),this.engine.addInstance(e),hp.deserialize(r,e),e},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),hv=function(){function t(){}return t.prototype.loadGUID=function(t){return eY(function(){return eK(this,function(t){return[2,void 0]})})()},t}();function hy(t,e){if(!t.includes(e))return t.push(e),!0}function hg(t){if(Number.isFinite(t))return[t4.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===t4.CONSTANT)return[t4.CONSTANT,t[1]];if("lines"===e)return[t4.LINE,t[1]];if(e===t4.LINE){var r=i.map(function(t){return[t5.LINE,t]});return[t4.BEZIER_CURVE,r]}return"curve"===e||e===t4.CURVE?[t4.BEZIER_CURVE,hF(i)]:t}}function hx(t,e){return Array.isArray(t)&&"random"===t[0]?[t4.CONSTANT,t[1][e]]:hg(t)}function hb(t){return t&&"color"===t[0]?hE(t[1],!0):[1,1,1,1]}function hT(t){return t&&"random"===t[0]?[t4.RANDOM,t[1]]:hg(t)}function hS(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=hE(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[t4.GRADIENT_COLOR,i]}}function hE(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eZ(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=hC(i)),i}function hC(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function hw(t,e){return Array.isArray(t)?t[0]===t4.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&hS(t[1],e):hS(t,e)}function h_(t){if(t){if(3===t.length)return[t4.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===t4.BEZIER_PATH||e===t4.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=hF(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[t4.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function hM(t){for(var e,i=iQ(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function hA(t){for(var e,i=iQ(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var hP=Math.cos,hI=Math.sin,hR=Math.PI/180,hO=180/Math.PI;function hV(t,e){return t?[t[0]-.5,.5-t[1]]:e?hN[e]:[0,0]}var hN=((eD={})[t0.PARTICLE_ORIGIN_CENTER]=[0,0],eD[t0.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eD[t0.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eD[t0.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eD[t0.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eD[t0.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eD[t0.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eD[t0.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eD[t0.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eD);function hF(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[t5.EASE_OUT,t]:e===n.length-1?[t5.EASE_IN,t]:[t5.EASE,t]})}var hL=new Map,hD=new Map;function hk(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tJ.null&&t.endBehavior===t6.destroy&&(t.endBehavior=t6.freeze)})}),t.version=tW["2_1"],t}function hB(t){for(var e,i=ro({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=iQ(i.images);!(e=r()).done;)e.value.id=iL();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=iL(),t.dataType=eS.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:iL(),dataType:eS.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:iL()}}));for(var a,o,s={},u={},h=iQ(t.compositions);!(o=h()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=t6.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tJ.particle&&t.content.filter&&delete t.content.filter});for(var e,r=iQ(t.items);!(e=r()).done;){var n=e.value;s[n.id]=iL(),n.oldId=n.id,n.id=s[n.id],u[n.id]=n}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],a=e.parentId.split("^")[1];e.parentId=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=ro({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:iL(),dataType:"TimelineAsset"},u=iQ(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:iL(),dataType:"ActivationPlayableAsset"};o.push(c);var f={id:iL(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==tJ.particle){var d={id:iL(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:iL(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===tJ.sprite||h.type===tJ.text){var m={id:iL(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:iL(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===tJ.composition){var y={id:iL(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:iL(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:iL(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],S=iQ(a);!(b=S()).done;){var E=b.value;T.push({id:E.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,w=iQ(a);!(C=w()).done;){var _=C.value;i.miscs.push(_)}for(var M,A=iQ(o);!(M=A()).done;){var P=M.value;i.miscs.push(P)}}(a,u,i)}();for(var l,c=iQ(i.items);!(l=c()).done;){var f=l.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tJ.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tJ.sprite){var g,x,b,T,S,E,C,w=f.content;w.renderer||(w.renderer={});var _=w.renderer,M=hV(_.anchor,_.particleOrigin),A=f.transform.size;_.anchor||void 0===_.particleOrigin||(f.transform.position.x+=-M[0]*(null!=(T=null==A?void 0:A.x)?T:1),f.transform.position.y+=-M[1]*(null!=(S=null==A?void 0:A.y)?S:1)),f.transform.anchor={x:M[0]*(null!=(E=null==A?void 0:A.x)?E:1),y:M[1]*(null!=(C=null==A?void 0:A.y)?C:1)}}}if(f.type===tJ.particle){var P=f.content;P.renderer||(P.renderer={});var I=P.renderer;P.renderer.anchor=hV(I.anchor,I.particleOrigin)}if(f.type===tJ.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var R=f.pn,O=t.plugins,V=void 0===O?[]:O;void 0!==R&&Number.isInteger(R)&&(f.pluginName=V[R])}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===tJ.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,i),(f.type===tJ.sprite||f.type===tJ.particle||f.type===tJ.mesh||f.type===tJ.skybox||f.type===tJ.light||"camera"===f.type||f.type===tJ.tree||f.type===tJ.interact||f.type===tJ.camera||f.type===tJ.text||f.type===tJ.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=iL(),f.content.item={id:f.id},f.dataType=eS.VFXItemData,f.components.push({id:f.content.id})),(f.type===tJ.null||f.type===tJ.composition)&&(f.components=[],f.dataType=eS.VFXItemData),f.type){case tJ.sprite:f.content.dataType=eS.SpriteComponent;break;case tJ.particle:f.content.dataType=eS.ParticleSystem;break;case tJ.mesh:f.content.dataType=eS.MeshComponent;break;case tJ.skybox:f.content.dataType=eS.SkyboxComponent;break;case tJ.light:f.content.dataType=eS.LightComponent;break;case"camera":f.content.dataType=eS.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tJ.tree:f.content.dataType=eS.TreeComponent;break;case tJ.interact:f.content.dataType=eS.InteractComponent;break;case tJ.camera:f.content.dataType=eS.CameraController;break;case tJ.text:f.content.dataType=eS.TextComponent;break;case tJ.spine:f.content.dataType=eS.SpineComponent}}return i.version=tW["3_0"],i}function hz(t){for(var e,i=iQ(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===eS.ShapeComponent&&r.type===em.Custom){(null==(n=r.shapes)?void 0:n.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var n,a,o=Array(r.easingIns.length),s=Array(r.easingOuts.length).fill(!1),u=iQ(r.shapes);!(a=u()).done;)for(var h,l=a.value,c=iQ(l.indexes);!(h=c()).done;){var f=h.value,d=r.points[f.point],p=r.easingIns[f.easingIn],m=r.easingOuts[f.easingOut];o[f.easingIn]||(p.x-=d.x,p.y-=d.y,o[f.easingIn]=!0),s[f.easingOut]||(m.x-=d.x,m.y-=d.y,s[f.easingOut]=!0)}}}return t.version=tW["3_2"],t}function hU(e){hL.clear(),hD.clear();for(var i,r=e.compositions,n=e.items,a=e.components,o=iQ(a);!(i=o()).done;){var s=i.value;hL.set(s.id,s)}for(var u,h=iQ(n);!(u=h()).done;){var l=u.value;hD.set(l.id,l)}for(var c,f=iQ(r);!(c=f()).done;)!function(e){for(var i,r=iQ(e.items);!(i=r()).done;){var n=i.value,a=hD.get(n.id);if(!a)return;if(a.type===tJ.sprite||a.type===tJ.particle||a.type===tJ.spine||a.type===tJ.text||a.type===tJ.richtext||a.type===tJ.video||a.type===tJ.shape){var o=hL.get(a.components[0].id);o&&function(e){var i=e.renderer,r=null==i?void 0:i.maskMode;r&&r!==t.MaskMode.NONE&&(r===t.MaskMode.MASK?(e.mask={isMask:!0},ek=e.id):(r===tY.OBSCURED||r===tY.REVERSE_OBSCURED)&&(e.mask={inverted:r===tY.REVERSE_OBSCURED,reference:{id:ek}}))}(o)}}}(c.value);return e.version=tW["3_3"],e}function hG(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=iQ(t.items);!(i=r()).done;){var n=i.value;if(n.type===tJ.sprite){var a=hL.get(n.components[0].id);if(a){var o,s=a.renderer.shape,u=void 0;u=Number.isInteger(s)?null==(o=t.shapes)?void 0:o[s]:s,a.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=iQ(t.compositions);!(h=f()).done;){var d=h.value,p=iL();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:iL(),dataType:"CompositionComponent",items:d.items,timelineAsset:d.timelineAsset,sceneBindings:d.sceneBindings,item:{id:d.id}};d.timelineAsset=void 0,d.sceneBindings=void 0,d.components=[{id:m.id}],t.components.push(m)}for(var v,y=iQ(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=c[x.refId])}}return t.version=tW["3_4"],t}function hW(t){for(var e,i={},r=iQ(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var a,o=iQ(t.compositions);!(a=o()).done;)for(var s,u=a.value,h=iQ(u.components);!(s=h()).done;)i[s.value.id].item.id=u.id;for(var l,c=iQ(t.components);!(l=c()).done;){var f=l.value;if(f.dataType===eS.SpriteComponent){var d=f.renderer.shape;if(null!=d&&!("aPoint"in d&&"index"in d)){var p=function(t,e){void 0===e&&(e="形状");for(var i=ud(t),r=i.index,n=void 0===r?[]:r,a=i.aPoint,o=void 0===a?[]:a,s=new Float32Array(o),u=[],h=[],l=0;l<s.length;l+=6)h.push(o[l+2],o[l+3]),u.push(s[l],s[l+1],0);var c=u.length/3,f=n.length,d=4*u.length,p=d+4*h.length,m=2*n.length,v={mode:eE.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:ew.UInt16,indexOffset:p,buffer:"",id:iL(),dataType:eS.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:e_.Position,offset:0,format:eC.Float32,dimension:3}),v.vertexData.channels.push({semantic:e_.Uv,offset:d,format:eC.Float32,dimension:2}),v.subMeshes.push({offset:0,indexCount:f,vertexCount:c});var y=new ArrayBuffer(p+m+(m%4==0?0:2)),g=new Float32Array(y);g.set(u,0),g.set(h,u.length),new Uint16Array(y,p).set(n,0);var x=new Uint8Array(y).slice(0,p+m);return v.binaryData=x,v}(d);f.geometry={id:p.id},t.geometries.push(p)}}if(f.dataType===eS.ShapeComponent){if(f.fills=[],f.fill){var m={type:ed.Solid,color:f.fill.color};f.fills.push(m)}if(delete f.fill,f.strokes=[],f.stroke){var v={type:ed.Solid,color:f.stroke.color};f.strokes.push(v),f.strokeWidth=f.stroke.width,f.strokeCap=f.stroke.cap,f.strokeJoin=f.stroke.join,delete f.stroke}}}return t.version=tW["3_5"],t}function hj(t){if(t.components)for(var e,i=iQ(t.components);!(e=i()).done;){var r,n=e.value;n.dataType===eS.RichTextComponent&&n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1),n.dataType!==eS.TextComponent&&(n.dataType!==eS.RichTextComponent||!n.options)||(r=n.options)&&void 0===r.TextVerticalAlign&&void 0===r.TextVerticalAlign&&(r.TextVerticalAlign=r.textBaseline),n.dataType===eS.TextComponent&&function(t){if(t&&t.textColor){var e,i=t.textColor;t.textColor=[i[0]/255,i[1]/255,i[2]/255,null!=(e=i[3])?e:1]}}(n.options)}return t.version=tW["3_6"],t}function hX(t){for(var e,i,r=[],n=iQ(t.items);!(i=n()).done;)!function(){var e=i.value;if(e.type===tJ.text&&e.transform){for(var n,a,o,s=t.components.find(function(t){return e.components[0].id===t.id}),u=e.transform.scale.x/(null!=(a=null==(n=s.options)?void 0:n.textWidth)?a:1),h=u/.0123,l=e.transform.scale.x,c=e.transform.scale.y,f=e.transform.scale.z,d=iQ(t.items);!(o=d()).done;){var p=o.value;p.parentId===e.id&&p.transform&&(p.transform.scale.x*=l/h,p.transform.scale.y*=c/h,p.transform.scale.z*=f/h)}e.transform.scale.x=h,e.transform.scale.y=h,e.transform.scale.z=h,r.push({item:e,scaleFactor:h,oldScaleX:l,oldScaleY:c,oldScaleZ:f})}}();r.length>0&&(null==(e=t.animations)?void 0:e.length)&&function(t,e){for(var i,r=new Map,n=new Map,a=iQ(t.items);!(i=a()).done;){var o=i.value;if(r.set(o.id,o),o.parentId){var s=n.get(o.parentId);s||(s=[],n.set(o.parentId,s)),s.push(o)}}for(var u,h=new Map,l=new Map,c=iQ(e);!(u=c()).done;){var f=u.value;h.set(f.item.id,f);var d=n.get(f.item.id);if(d)for(var p,m=iQ(d);!(p=m()).done;){var v=p.value;l.set(v.id,f)}}for(var y,g=new Map,x=iQ(t.components);!(y=x()).done;){var b=y.value;g.set(b.id,b)}for(var T,S=new Map,E=iQ(t.animations);!(T=E()).done;){var C=T.value;S.set(C.id,C)}for(var w,_=iQ(t.compositions);!(w=_()).done;){for(var M,A,P,I=w.value,R=void 0,O=void 0,V=iQ(I.components);!(P=V()).done;){var N=P.value,F=g.get(N.id);if((null==F?void 0:F.dataType)===eS.Animator?R=F:(null==F?void 0:F.dataType)===eS.CompositionComponent&&(O=F),R&&O)break}if(R){var L=void 0;if(O){var D=O.items;if(D){L=[];for(var k,B=iQ(D);!(k=B()).done;){var z=k.value,U=r.get(z.id);U&&!U.parentId&&L.push(U)}}}if((!L||0===L.length)&&I.children){L=[];for(var G,W=iQ(I.children);!(G=W()).done;){var j=G.value,X=r.get(j.id);X&&L.push(X)}}if(L&&0!==L.length){var H=R,Y=S.get(null==(M=H.graphAsset)?void 0:M.id);if(null==Y?void 0:null==(A=Y.graphDataSet)?void 0:A.resources)for(var Z,q=iQ(Y.graphDataSet.resources);!(Z=q()).done;){var K=Z.value,Q=S.get(K.id);if(null==Q?void 0:Q.scaleCurves)for(var J,$=iQ(Q.scaleCurves);!(J=$()).done;){var tt=J.value,te=function(t,e,i){var r=function(t){var e;a=null==(e=i.get(a.id))?void 0:e.find(function(e){return e.name===n[t]})};if(e){for(var n=e.split("/"),a=t.find(function(t){return t.name===n[0]}),o=1;o<n.length&&a;o++)r(o);return a}}(L,tt.path,n);if(te){var ti=h.get(te.id);if(ti){hZ(tt.keyFrames,ti.scaleFactor/ti.oldScaleX,ti.scaleFactor/ti.oldScaleY,ti.scaleFactor/ti.oldScaleZ);continue}var tr=l.get(te.id);tr&&hZ(tt.keyFrames,tr.oldScaleX/tr.scaleFactor,tr.oldScaleY/tr.scaleFactor,tr.oldScaleZ/tr.scaleFactor)}}}}}}}(t,r);for(var a,o=new Map,s=new Map,u=new Map,h=iQ(t.components);!(a=h()).done;){var l=a.value;u.set(l.id,l)}for(var c,f=iQ(t.items);!(c=f()).done;){var d=c.value;d.children=[],o.set(d.id,d)}for(var p,m=iQ(t.compositions);!(p=m()).done;){var v=p.value;v.children=[],ek=void 0;var y=v.items;Array.isArray(y)&&hY(y,o,u);for(var g,x=iQ(v.components);!(g=x()).done;){var b=g.value,T=u.get(b.id);if(T.dataType===eS.CompositionComponent){var S=null!=(E=T.items)?E:[];hY(S,o,u);for(var E,C,w=iQ(S);!(C=w()).done;){var _=C.value,M=o.get(_.id);void 0===M.parentId&&v.children.push({id:M.id})}delete T.items}}s.set(v.id,v)}for(var A,P=iQ(t.items);!(A=P()).done;){var I=A.value;if(I.parentId){var R=o.get(I.parentId);R&&R.children.push({id:I.id})}}return t.version=tW["3_7"],t}function hH(t){null!=t.miscs||(t.miscs=[]);for(var e,i=iQ(t.components);!(e=i()).done;){var r,n,a=e.value;if(a.dataType===eS.SpriteComponent&&!a.sprite){var o=a.splits;if(!o||!(o.length>1)){var s=null==o?void 0:o[0],u=s?[s[0],s[1],s[2],s[3]]:[0,0,1,1],h=null!=(n=null==s?void 0:s[4])?n:0,l={id:iL(),dataType:"Sprite",texture:null==(r=a.renderer)?void 0:r.texture,rect:u,rotation:h};t.miscs.push(l),a.sprite={id:l.id},delete a.splits,a.renderer&&delete a.renderer.texture}}}return t.version="3.8",t}function hY(t,e,i){for(var r,n=iQ(t);!(r=n()).done;){var a=r.value,o=e.get(a.id);if(o&&(o.type===tJ.sprite||o.type===tJ.particle||o.type===tJ.spine||o.type===tJ.text||o.type===tJ.richtext||o.type===tJ.video||o.type===tJ.shape||o.type===tJ.mesh)){var s=i.get(o.components[0].id);s&&function(t){var e,i,r,n=t.mask;n&&!n.references&&n.reference&&(t.mask={isMask:null!=(e=n.isMask)&&e,alphaMaskEnabled:null!=(i=n.alphaMaskEnabled)&&i,references:[{mask:n.reference,inverted:null!=(r=n.inverted)&&r}]})}(s)}}}function hZ(t,e,i,r){if(Array.isArray(t)&&t[0]===t4.VECTOR3_CURVE){var n=t[1];Array.isArray(n)&&3===n.length&&(hq(n[0],e),hq(n[1],i),hq(n[2],r))}}function hq(t,e){if(Array.isArray(t)&&t[0]===t4.BEZIER_CURVE&&Array.isArray(t[1]))for(var i,r=t[1],n=iQ(r);!(i=n()).done;){var a=i.value;if(Array.isArray(a)&&!(a.length<2)&&Array.isArray(a[1]))for(var o=a[1],s=1;s<o.length;s+=2)o[s]*=e}}function hK(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:h_(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:hg(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:hg(n.linearX),linearY:hg(n.linearY),linearZ:hg(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:hg(n.orbitalX),orbitalY:hg(n.orbitalY),orbitalZ:hg(n.orbitalZ),speedOverLifetime:hg(n.speedOverLifetime)};hA(a);var o={options:{startColor:hb(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=hg(s.x),u.y=hg(s.y),u.z=hg(s.z)):u.z=hg(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:hg(h.opacity)};h.color&&(l.color=hw(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:hg(c.size),x:hg(c.x),y:hg(c.y),z:hg(c.z)}),o}var hQ="2.10.0",hJ=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,h$=/^(\d+)\.(\d+)$/,h0=!1;function h1(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(function(t){var e=(t.playerVersion||{}).web,i=void 0===e?"":e;if(i){var r,n,a=null!=(r=hJ.exec(i))?r:[],o=null!=(n=hJ.exec(hQ))?n:[],s=a[1],u=a[2],h=o[1],l=o[2];return Number(h)<Number(s)||Number(h)===Number(s)&&Number(l)<Number(u)}return!1}(t)&&console.warn("The JSON need higher than "+(null==(d=t.playerVersion)?void 0:d.web)+" runtime version(current: "+hQ+"). Some features may not work as expected."),!(f=null==(c=(l=t).version)?void 0:c.split("."))||Number(f[0])>2||2===Number(f[0])&&Number(f[1])>=2||l.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tJ.mesh||t.type===tJ.light)&&(t.endBehavior=1===t.endBehavior?t6.destroy:t.endBehavior)})}),hJ.test(t.version)){var e,i,r,n,a,o,s,u;return h0=(null==(p=/^(\d+)/.exec(t.version))?void 0:p[0])==="0",hH(hX(hj(hW(hG(hU(hz(hB(hk((e=t,h2=tW["1_0"],n=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(h2=tW["1_3"]),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return h3(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:h2,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return h4(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u))))))))))}h0=!1;var h,l,c,f,d,p,m=h$.exec(t.version)||[],v=Number(m[1]),y=Number(m[2]);if(v)return(v<2||2===v&&y<4)&&((h=t).compositions.map(function(t){for(var e,i=iQ(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=iQ(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=h_(a):e[n]=hg(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=h),v<3&&(t=hB(hk(t))),v=Number((m=h$.exec(t.version)||[])[1]),y=Number(m[2]),v<4&&(y<2&&(t=hz(t)),y<3&&(t=hU(t)),y<4&&(t=hG(t)),y<5&&(t=hW(t)),y<6&&(t=hj(t)),y<7&&(t=hX(t)),y<8&&(t=hH(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var h2=tW["1_0"];function h3(t,e,i){var r=i[e];if("string"==typeof t)return{id:iL(),renderLevel:r,url:t};if(t.template)return{id:iL(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:iL(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:iL(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function h4(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:ro({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return h6(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var h5=[0,0,0,1];function h6(t,e){void 0===e&&(e={});var i=tJ.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tJ.plugin,m=t.pn,p=t.pluginName,f=t.content,c=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),l=t.transform||b(c.transform)):t.particle?(i=tJ.particle,l=b((c=t.particle).transform,h0,!0),f=function(t){var e=t.options,i=t.transform,r={type:tZ.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=ro({},t.shape,{type:tZ[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],h=o[2];0===s&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=hT(e.turbulenceX),r.turbulenceY=hT(e.turbulenceY),r.turbulenceZ=hT(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map(function(t){return hM(t)})),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map(function(t){return hM(t)})),l.rateOverTime&&(l.rateOverTime=hT(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:hT(e.startLifetime),start3DSize:!!e.start3DSize,startSize:hT(e.startSize),startSizeX:hT(e.startSizeX),startSizeY:hT(e.startSizeY),sizeAspect:hT(e.sizeAspect),maxCount:e.maxCount,startDelay:hT(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[t4.COLORS,t[1].map(function(t){return hE(t,e)})]:"gradient"===t[0]?hS(t[1],e):"color"===t[0]?[t4.RGBA_COLOR,hE(t[1],e)]:t}(e.startColor,!0),startRotationZ:hT(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=hT(e.startRotationX),c.options.startRotationY=hT(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:h_(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:hT(f.x),y:hT(f.y)}:c.sizeOverLifetime={size:hT(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?hg(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:hg(e.gravityModifier),startSpeed:hT(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:hT(d.linearX),linearY:hT(d.linearY),linearZ:hT(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:hT(d.orbitalX),orbitalY:hT(d.orbitalY),orbitalZ:hT(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:hg(d.forceCurve)},hA(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:hT(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=hg(m.y),c.rotationOverLifetime.x=hg(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:hg(v.opacity)};v.color&&(y.color=hw(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:hg(g.cycles),animationDelay:hx(g.animationDelay,0),animationDuration:hx(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:hT(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:hg(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&hw(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&hw(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:hT(x.opacityOverLifetime)}),c.trails&&hA(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(c)):t.sprite?(i=tJ.sprite,l=b((c=t.sprite).transform,!1,!0),s=hK(o=c,l),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tJ.null,l=b((c=t.cal).transform,!1,!0),f=hK(c,l)):t.ui?(i=tJ.interact,l=b((c=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tK.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&hb(i.previewColor),behavior:i.behavior||tQ.NOTIFY};break;case"drag":e={type:tK.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tK.MESSAGE}}return{options:e}}(c),l.scale=[c.options.width||1,c.options.height||1,1]):t.model&&(c=t.model,1===t.model.options.type&&(i=tJ.camera,l=b(c.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,a,o={path:h_(null==(a=t.transform)?void 0:a.path),linearX:hg(null==r?void 0:r.translateX),linearY:hg(null==r?void 0:r.translateY),linearZ:hg(null==r?void 0:r.translateZ)};hA(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:hg(null==s?void 0:s.rotateX),y:hg(null==s?void 0:s.rotateY),z:s.separateAxes?hg(null==s?void 0:s.rotateZ):hg(s.rotation)};hA(u),i.rotationOverLifetime=u}return i}(c))),null==(h=f.renderer)?void 0:h.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&hy(e.requires,"anchor")}if(c){var o,s,u,h,l,c,f,d,p,m,v,y,g=null==(v=c.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?t6.restart:t6.destroy:t6.restart:r||(null==c?void 0:null==(y=c.options)?void 0:y.endBehavior)||t6.destroy,c.options.renderLevel&&(d=c.options.renderLevel),isNaN(n)&&(n=c.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:l,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(hy(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,S,E,C,w,_,M,A,P=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=hP(a*hR/2),h=hP(o*hR/2),l=hP(s*hR/2),c=hI(a*hR/2),f=hI(o*hR/2),d=hI(s*hR/2),h5[0]=c*h*l+u*f*d,h5[1]=u*f*l-c*h*d,h5[2]=u*h*d+c*f*l,h5[3]=u*h*l-c*f*d,h5);r.rotation=(p=[],m=P[0],v=P[1],y=P[2],g=P[3],x=m+m,b=v+v,T=y+y,S=m*x,E=v*x,C=v*b,w=y*T,_=g*T,M=y*x-g*b,p[1]=Math.asin((A=-M)>1?1:A<-1?-1:A)*hO,.9999999>Math.abs(M)?(p[0]=Math.atan2(y*b+g*x,1-S-C)*hO,p[2]=Math.atan2(E+_,1-C-w)*hO):(p[0]=0,p[2]=Math.atan2(-(E-_),1-S-w)*hO),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var h8=((eB={})[tj.S]=[tj.S,tj.BPlus,tj.APlus],eB[tj.A]=[tj.A,tj.BPlus,tj.APlus],eB[tj.B]=[tj.B,tj.BPlus],eB);function h9(t,e){if(!t||!e)return!0;var i=h8[e];return!!i&&i.includes(t)}function h7(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function lt(t,e,i){return le.apply(this,arguments)}function le(){return(le=eY(function(t,e,i){var r,n;return eK(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,r2(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=h7(e,i)){if(iA(n)&&n!==r.src)return[2,r2(n)];if(eZ(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(tB=t.Scene||(t.Scene={})).isJSONObject=function(t){return iR(t)&&"jsonScene"in t},tB.isURL=function(t){return iR(t)&&"url"in t},tB.isWithOptions=function(t){return iR(t)&&"options"in t};var li=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},lr=1,ln=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new rq),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=lr++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=ro({},t,{useCompressedTexture:null==(e=t.useCompressedTexture)||e,useHevcVideo:null==(i=t.useHevcVideo)||i}),this.options.pluginData||(this.options.pluginData={});var e,i,r=this.options.timeout;this.timeout=void 0===r?10:r},i.loadScene=function(e,i){var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f,d,p,m;return eK(this,function(v){return a=iA(e)?e:r.id,o=performance.now(),s=[],l=null!=(h=null==(u=null==i?void 0:i.engine.gpuCapability)?void 0:u.detail.ktx2Support)&&h,c={},d=!1,p=new Promise(function(t,e){f=window.setTimeout(function(){d=!0,r.removeTimer(f),e(Error("Load time out: totalTime: "+(performance.now()-o).toFixed(4)+"ms "+s.join(" ")+", url: "+a+"."))},1e3*r.timeout),r.timers.push(f)}),m=eY(function(t,e){var i,r,n;return eK(this,function(a){switch(a.label){case 0:if(d)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,s.push("["+t+": "+n.toFixed(2)+"]"),c[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([p,eY(function(){var i,u,h,d,p,v,y,g,x,b,T,S,E,C,w;return eK(this,function(_){switch(_.label){case 0:if(!iA(e))return[3,2];return u=new URL(e,location.href).href,r.baseUrl=u,[4,m("loadJSON",function(){return r.loadJSON(u)})];case 1:return iA(n=_.sent())&&(n=JSON.parse(n)),[3,3];case 2:n=e,r.baseUrl=location.href,_.label=3;case 3:if(!t.Scene.isJSONObject(n))return[3,4];return i=ro({},n),[3,9];case 4:return[4,m("processJSON",function(){return r.processJSON(n)})];case 5:return i={timeInfos:c,url:e,storage:{},jsonScene:v=_.sent().jsonScene,bins:[],textureOptions:[],images:[],assets:r.assets},[4,m("plugin:onAssetsLoadStart",function(){return r.onPluginSceneLoadStart(i)})];case 6:return _.sent(),g=void 0===(y=v.bins)?[]:y,x=v.images,b=v.fonts,[4,Promise.all([m("processBins",function(){return r.processBins(g)}),m("processImages",function(){return r.processImages(x,l)}),m("processFontURL",function(){return r.processFontURL(b)})])];case 7:return S=(T=_.sent())[0],E=T[1],[4,m("processTextures",function(){return r.processTextures(E,S,v)})];case 8:C=_.sent(),(h=i.bins).push.apply(h,[].concat(S)),(d=i.textureOptions).push.apply(d,[].concat(C)),(p=i.images).push.apply(p,[].concat(E)),i.renderLevel=r.options.renderLevel,_.label=9;case 9:return w=performance.now()-o,i_.info("Load asset: totalTime: "+w.toFixed(4)+"ms "+s.join(" ")+", url: "+a+"."),window.clearTimeout(f),r.removeTimer(f),i.totalTime=w,i.startTime=o,i.timeInfos=c,[2,i]}})})()])]})})()},i.getAssets=function(){return this.assets},i.processJSON=function(t){return eY(function(){var e,i,r,n,a;return eK(this,function(o){for(r=iQ(void 0===(i=(e=h1(t)).plugins)?[]:i);!(n=r()).done;)if(!iB[a=n.value])throw Error("The plugin '"+a+"' not found."+ij(a));return[2,{jsonScene:e}]})})()},i.processBins=function(t){var e=this;return eY(function(){var i,r;return eK(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(eZ(n,ArrayBuffer))return n;if(h9(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return eY(function(){return eK(this,function(r){return[2,e.loadFontFamily(t,i.baseUrl)]})})()},i.processImages=function(e,i){void 0===i&&(i=!1);var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f;return eK(this,function(d){switch(d.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=n.disableWebP,u=n.disableAVIF,h=!!iB.ktx2,l=a&&i&&h,c=r.baseUrl,a&&i&&!h&&e.some(function(t){return"ktx2"in t&&t.ktx2})&&i_.warn("The plugin 'ktx2' is not found, unable to use compressed textures."+ij("ktx2")),[4,Promise.all(e.map(eY(function(e,i){var n,a,h,f,d,p,m,v,y,g,x,b,T,S,E,C,w,_,M,A;return eK(this,function(i){switch(i.label){case 0:if(n=e.url,a=e.webp,h=e.avif,f=e.ktx2,d=new URL(n,c).href,p=!s&&a?new URL(a,c).href:void 0,m=!u&&h?new URL(h,c).href:void 0,v=f&&l?new URL(f,c).href:void 0,y=e.id,!("template"in e))return[3,8];if(!(x=(g=e.template).background))return[3,7];b=h7(g,o),T=x.type===ex.video,S=x&&T?r8:r2,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,r7(b,S)];case 2:if(!eZ(E=i.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[y]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return x&&Array.isArray(b)&&o&&(o[x.name]=E.src),r.sourceFrom[y]={url:E.src,type:t.TextureSourceType.image},[4,lt(E,g,o)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw C=i.sent(),Error("Failed to load. Check the template or if the URL is "+(T?"video":"image")+" type, URL: "+b+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("ktx2"in e&&v)return r.sourceFrom[y]={url:v,type:t.TextureSourceType.compressed},[2,r.loadBins(v)];if(eZ(e,HTMLImageElement)||eZ(e,HTMLCanvasElement)||eZ(e,HTMLVideoElement)||eZ(e,no))return[2,e];i.label=9;case 9:if(!m)return[3,11];return[4,r0(d,m)];case 10:return A=i.sent(),[3,13];case 11:return[4,rJ(d,p)];case 12:A=i.sent(),i.label=13;case 13:return _=(w=A).url,M=w.image,r.sourceFrom[y]={url:_,type:t.TextureSourceType.image},[2,M]}})})))];case 1:return f=d.sent(),r.assignImagesToAssets(e,f),[2,f]}})})()},i.onPluginSceneLoadStart=function(t){var e=this;return eY(function(){return eK(this,function(i){switch(i.label){case 0:return[4,iG.notifyAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}})})()},i.processTextures=function(e,i,r){var n=this;return eY(function(){var a;return eK(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(eY(function(e,a){var o,s,u,h,l;return eK(this,function(c){switch(c.label){case 0:if(eZ(e,no))return[2,e];if(!("mipmaps"in e))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,ne(e,i,n.assets,r.bins)];case 2:return[2,c.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+c.sent()+".");case 4:if(o=e.source,s=e.id,h="",!iR(o))return[3,5];return u=n.assets[o.id],h=o.id,[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,r2(iD(o))];case 6:u=c.sent(),c.label=7;case 7:if(!u)return[3,9];return[4,function(t,e,i){return la.apply(this,arguments)}(u,n.sourceFrom[h],s)];case 8:return[2,(l=c.sent()).sourceType===t.TextureSourceType.compressed?l:ro({},l,e)];case 9:throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return eY(function(){return eK(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},i.loadBins=function(t){var e=this;return eY(function(){return eK(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e.loadFontFamily=function(t,i){return void 0===i&&(i=location.href),eY(function(){return eK(this,function(r){return t?[2,Promise.all(t.map(eY(function(t){var r,n,a;return eK(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];iE(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),i_.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},e.loadPrecomposition=function(t,i){return eY(function(){return eK(this,function(r){switch(r.label){case 0:return[4,new e(i).loadScene(t)];case 1:return[2,new li(r.sent(),i)]}})})()},e}();function la(){return(la=eY(function(e,i,r){var n,a,o,s,u;return eK(this,function(h){switch(h.label){case 0:if(n={id:r,dataType:eS.Texture},!eZ(e,no))return[3,1];return[2,ro({},e.source,n)];case 1:if(!(eZ(e,HTMLImageElement)||iV(e)))return[3,2];return[2,ro({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:rG.LINEAR,magFilter:rG.LINEAR},n)];case 2:if(!eZ(e,HTMLVideoElement))return[3,3];return[2,ro({sourceType:t.TextureSourceType.video,video:e,minFilter:rG.LINEAR,magFilter:rG.LINEAR},n)];case 3:if(!eZ(e,ArrayBuffer))return[3,10];if(!(a=nc.getLoader("ktx2")))return[3,8];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,a.loadFromBuffer(e)];case 5:return o=h.sent(),i_.info("Loading KTX2 texture."),[2,ro({sourceType:o.sourceType,type:o.type,target:o.target,internalFormat:o.internalFormat,format:o.format,mipmaps:o.mipmaps,minFilter:rG.LINEAR,magFilter:rG.LINEAR,sourceFrom:i},n)];case 6:throw s=h.sent(),Error("Failed to parse KTX2 from "+(null!=(u=null==i?void 0:i.url)?u:"buffer")+": "+(s.message||s));case 7:return[3,9];case 8:throw Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in e&&"height"in e&&"data"in e)return[2,ro({sourceType:t.TextureSourceType.data,data:e,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,minFilter:rG.NEAREST,magFilter:rG.NEAREST},n)];h.label=11;case 11:throw Error("Invalid texture options.")}})})).apply(this,arguments)}ln.fontCache=new Set;var lo=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var i=e.prototype;return i.assembleSceneLoadOptions=function(e,i){void 0===i&&(i={});var r=e;return t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(r=e.url),t.Scene.isWithOptions(e)&&(i=ro({},i,e.options))),{source:r,options:i}},i.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach(function(t){if(t.type===tJ.text||t.type===tJ.richtext){var r=e[t.name];null!=r&&t.components.forEach(function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);((null==n?void 0:n.dataType)===eS.TextComponent||(null==n?void 0:n.dataType)===eS.RichTextComponent)&&(n.options.text=r)})}})},i.prepareAssets=function(t,e){for(var i,r=iQ(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new hd(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=iQ(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},i.createShaderVariant=function(){for(var t,e=iQ(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];eZ(r,nw)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=iQ(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),ls=new it(1,1,1),lu=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new nH,this.viewportMatrix=nm.fromIdentity(),this.viewMatrix=nm.fromIdentity(),this.projectionMatrix=nm.fromIdentity(),this.viewProjectionMatrix=nm.fromIdentity(),this.inverseViewMatrix=nm.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?t3.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,l=e.rotation,c=void 0===l?[0,0,0]:l,f=new nv(c[0],c[1],c[2]),d=new rh().setFromEuler(f);this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===a?1:a,clipMode:s},this.transform.setPosition(h[0],h[1],h[2]),this.transform.setQuaternion(d.x,d.y,d.z,d.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new it(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,o=r.projectPoint(new it(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new it(-1,-1,a));return new it((s-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return ro({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,o=e.clipMode;this.projectionMatrix.perspective(i*e4,r,n,a,o===t3.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),ls),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:nm.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.worldToScreenPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new it,r=this.getViewProjectionMatrix();i.set(t.x,t.y,t.z),r.projectPoint(i,i);var n=this.engine.canvas.getBoundingClientRect(),a=n.width,o=n.height;return i.x=(i.x+1)*.5*a,i.y=(i.y+1)*.5*o,i.z=(i.z+1)*.5,i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new it,r=this.getInverseViewProjectionMatrix(),n=this.engine.canvas.getBoundingClientRect(),a=n.width,o=n.height,s=t.x/a*2-1,u=t.y/o*2-1,h=2*t.z-1;return i.set(s,u,h),r.projectPoint(i,i),i},rk(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.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),lh=function(){function t(){this.update=new lc,this.lateUpdate=new lf,this.preRender=new ld}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==rB.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==rB.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==rB.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==rB.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==rB.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==rB.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),ll=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),lc=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iQ(t);!(i=r()).done;)i.value.onUpdate(e)},e}(ll),lf=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iQ(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(ll),ld=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iQ(t);!(i=r()).done;)i.value.onPreRender()},e}(ll),lp=function(e){function i(i,r,n){(x=e.call(this)||this).engine=i,x.sceneTicking=new lh,x.speed=1,x.isEnded=!1,x.loaderData={},x.startTime=0,x.videos=[],x.postProcessingEnabled=!1,x.destroyed=!1,x.paused=!0,x.isEndCalled=!1,x._renderOrder=0,x._interactive=!0,x._textures=[];var a,o,s,u,h,l,c,f=null!=r?r:{},d=f.reusable,p=void 0!==d&&d,m=f.speed,v=f.baseRenderOrder,y=f.onItemMessage;x.engine.addComposition(sW(x));var g=null;if(n){x.createTexturesFromData(n.textureOptions);for(var x,b,T,S=iQ(Object.keys(n.assets));!(T=S()).done;){var E=T.value,C=n.assets[E];eZ(C,HTMLVideoElement)&&x.videos.push(C)}x.postProcessingEnabled=null!=(w=null==(b=n.jsonScene.renderSettings)?void 0:b.postProcessingEnabled)&&w,x.engine.renderLevel=n.renderLevel,p&&(n.consumed=!0),g=n.jsonScene.compositions[0];for(var w,_,M=iQ(n.jsonScene.compositions);!(_=M()).done;){var A=_.value;A.id===n.jsonScene.compositionId&&(g=A)}iS(g)}return x.root=new t.VFXItem(x.engine),x.root.name="root",x.root.composition=sW(x),x.root.setParent(x.engine.root),x.pluginRoot=new t.VFXItem(x.engine),x.pluginRoot.name="pluginRoot",x.pluginRoot.setParent(x.root),x.sceneRoot=new t.VFXItem(x.engine),x.sceneRoot.setParent(x.root),g&&x.sceneRoot.setInstanceId(g.id),iG.notifyCompositionCreating(sW(x),n),g&&x.sceneRoot.instantiatePreComposition(g,!1),x.sceneRoot.name="sceneRoot",x.rootComposition=null!=(a=x.sceneRoot.getComponent(t.CompositionComponent))?a:x.sceneRoot.addComponent(t.CompositionComponent),x.rootComposition.updateMode=t.UpdateModes.Manual,x.rootComposition.play(),x.sceneRoot.on("animationevent",function(t){x.emit("animationevent",t)}),x.sceneRoot.setParent(x.root),x.renderOrder=void 0===v?0:v,x.id=null!=(o=null==g?void 0:g.id)?o:iL(),x.startTime=null!=(s=null==g?void 0:g.startTime)?s:0,x.event=i.eventSystem,x.statistic={loadStart:null!=(u=null==n?void 0:n.startTime)?u:0,loadTime:null!=(h=null==n?void 0:n.totalTime)?h:0,compileTime:0,firstFrameTime:0},x.reusable=p,x.speed=void 0===m?1:m,x.name=null!=(l=null==g?void 0:g.name)?l:"New Composition",x.camera=new lu(x.name,ro({},null==g?void 0:g.camera,{aspect:x.width/x.height})),x.camera.engine=x.engine,x.url=null!=(c=null==n?void 0:n.url)?c:"",x.interactive=!0,y&&(x.onItemMessage=y),x.createRenderFrame(),iG.notifyCompositionCreated(sW(x),n),x}iY(i,e);var r=i.prototype;return r.getDuration=function(){return this.sceneRoot.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.sceneRoot.setVisible(t)},r.getSpeed=function(){return this.speed},r.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.setTime(this.time-this.startTime):this.setTime(0),this.resume()},r.pause=function(){this.paused=!0,this.emit("pause")},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},r.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},r.createRenderFrame=function(){this.renderFrame=new oC({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},r.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0)},r.addItem=function(t){t.setParent(this.sceneRoot)},r.getComponent=function(t){return this.sceneRoot.getComponent(t)},r.forwardTime=function(t){var e=1e3*t-1e3*this.time;this.update(e)},r.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},r.render=function(){this.renderContent()},r.renderContent=function(){this.renderer.renderRenderFrame(this.renderFrame)},r.update=function(t){if(!this.getPaused()){this.root.isDuringPlay||(this.root.awake(),this.root.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=(this.time-e)*1e3;this.rootComposition.setChildrenRenderOrder(0),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.sceneRoot.endBehavior===t6.destroy&&!this.reusable},r.updateCamera=function(){this.camera.updateMatrix()},r.updateCompositionTime=function(e){if(this.rootComposition.state===t.PlayState.Playing&&this.rootComposition.isActiveAndEnabled){var i=this.time+e-this.startTime;e<0&&i<0&&(i=0);var r=this.sceneRoot.duration,n=this.sceneRoot.endBehavior,a=!1;if(i>=r)switch(a=!0,n){case t6.restart:i%=r,this.restart();break;case t6.freeze:i=Math.min(r,i);case t6.forward:case t6.destroy:}this.rootComposition.tick(i+this.startTime-this.rootComposition.getTime()),this.isEnded!==a&&(a?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},r.createTexturesFromData=function(t){for(var e,i=iQ(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},r.getItemByName=function(t){return this.sceneRoot.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return n2((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.sceneRoot.hitTest(a,t,e,n,[],i,r),n},r.addInteractiveItem=function(t,e){if(e===tK.MESSAGE)return null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},r.removeInteractiveItem=function(t,e){e===tK.MESSAGE&&(null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},r.destroyItem=function(t){},r.lost=function(t){},r.restore=function(){},r.dispose=function(){var e=this;if(!this.destroyed){this.destroyed=!0;for(var i,r=iQ(this.textures);!(i=r()).done;)i.value.dispose();this._textures=[];for(var n,a=iQ(this.videos);!(n=a()).done;){var o=n.value;o.pause(),o.removeAttribute("src"),o.load()}this.videos=[],this.sceneRoot.dispose(),this.pluginRoot.dispose(),this.root.dispose(),this.renderFrame.dispose(),iG.notifyCompositionDestroy(this),this.update=function(){i_.error("Update disposed composition: "+e.name+".")},this.dispose=iM,this.renderer.engine.removeComposition(this),this.engine.env!==nB&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.sceneRoot.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.sceneRoot.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.sceneRoot.translate(t,e,i)},r.setPosition=function(t,e,i){this.sceneRoot.setPosition(t,e,i)},r.rotate=function(t,e,i){this.sceneRoot.rotate(t,e,i)},r.setRotation=function(t,e,i){this.sceneRoot.setRotation(t,e,i)},r.scale=function(t,e,i){this.sceneRoot.scale(t,e,i)},r.setScale=function(t,e,i){this.sceneRoot.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.reloadTexture=function(){var t=this;return eY(function(){return eK(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]}})})()},rk(i,[{key:"renderOrder",get:function(){return this._renderOrder},set:function(t){this._renderOrder=t}},{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=!!t}},{key:"width",get:function(){return this.engine.canvas.width}},{key:"height",get:function(){return this.engine.canvas.height}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"rootItem",get:function(){return this.sceneRoot}},{key:"transform",get:function(){return this.sceneRoot.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.sceneRoot.getDescendants()}},{key:"time",get:function(){return this.rootComposition.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),i}(nU),lm=new Int32Array(2),lv=new Float32Array(lm.buffer),ly=new Float64Array(lm.buffer),lg=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tz=ez||(ez={}))[tz.UTF8_BYTES=1]="UTF8_BYTES",tz[tz.UTF16_STRING=2]="UTF16_STRING";var lx=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return lm[0]=this.readInt32(t),lv[0]},e.readFloat64=function(t){return lm[lg?0:1]=this.readInt32(t),lm[lg?1:0]=this.readInt32(t+4),ly[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){lv[0]=e,this.writeInt32(t,lm[0])},e.writeFloat64=function(t,e){ly[0]=e,this.writeInt32(t,lm[lg?0:1]),this.writeInt32(t+4,lm[lg?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===ez.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),lb=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=lx.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(eZ(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=lx.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),lT=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new lS(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),lS=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=lT.createDataVector(t,this.data);return lT.createFBEffectsObjectData(t,e,i)},t}(),lE=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new lT).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new lC(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),lC=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=lE.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return lE.createFBEffectsPackageData(t,e)},t}(),lw=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new l_(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),l_=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return lw.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),lM=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new lA(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),lA=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return lM.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),lP=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new lM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new lI(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),lI=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=lP.createChannelsVector(t,t.createObjectOffsetList(this.channels));return lP.createFBVertexData(t,this.vertexCount,e)},t}(),lR=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new lP).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new lw).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new lO(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),lO=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=lR.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=lR.createBinaryDataVector(t,this.binaryData),s=lR.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=lR.createInverseBindMatricesVector(t,this.inverseBindMatrices);return lR.startFBGeometryData(t),lR.addId(t,e),lR.addName(t,i),lR.addVertexData(t,r),lR.addIndexFormat(t,this.indexFormat),lR.addIndexOffset(t,this.indexOffset),lR.addSubMeshes(t,n),lR.addMode(t,this.mode),lR.addBuffer(t,a),lR.addBinaryData(t,o),lR.addBoneNames(t,s),lR.addRootBoneName(t,u),lR.addInverseBindMatrices(t,h),lR.endFBGeometryData(t)},t}(),lV=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new lb(1),i=new lC,r=[],n=iQ(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===eS.Geometry&&(o=new lS("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,lE.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new lx(t),i=lE.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===eS.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new lb(1),i=new lO,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=t.rootBoneName,l=t.inverseBindMatrices,c=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===l?[]:l,i.binaryData=void 0===c?[]:c;var f=new lI;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=iQ(s.channels);!(d=p()).done;){var m=d.value,v=new lA(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=iQ(t.subMeshes);!(y=x()).done;){var b=y.value,T=new l_(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,lE.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new lx(t),o=lR.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var l,c=u.channels(h);if(c){var f={semantic:null!=(l=c.semantic())?l:"",offset:c.offset(),format:c.format(),dimension:c.dimension(),normalize:c.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:eS.Geometry}},t}(),lN=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=e9(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e,i=iQ(this.tickers);!(e=i()).done;)(0,e.value)(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},rk(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),lF=function(e){function i(i,r){var n,a,o,s,u,h,l;return(n=e.call(this)||this).name="NewEngine",n.speed=1,n.displayScale=1,n.offscreenMode=!1,n.renderErrors=new Set,n.assetManagers=[],n.env="",n.ticker=null,n.doNotHandleContextLost=!0,n.contextWasLost=!1,n._disposed=!1,n.textures=[],n.materials=[],n.geometries=[],n.meshes=[],n.renderPasses=[],n.framebuffers=[],n.renderbuffers=[],n.particleSystems=[],n._compositions=[],n.clearAction={stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]},n.canvas=i,n.env=null!=(a=null==r?void 0:r.env)?a:"",n.doNotHandleContextLost=null==(o=null==r?void 0:r.doNotHandleContextLost)||o,n.name=null!=(s=null==r?void 0:r.name)?s:n.name,n.pixelRatio=null!=(u=null==r?void 0:r.pixelRatio)?u:ih(),n.jsonSceneData={},n.objectInstance={},n.root=new t.VFXItem(sW(n)),n.root.name="root",n.whiteTexture=nh(sW(n)),n.transparentTexture=nl(sW(n)),(null==r?void 0:r.manualRender)||(n.ticker=new lN(null==r?void 0:r.fps),n.runRenderLoop(n.mainLoop.bind(sW(n)))),n.eventSystem=new sn(sW(n),null!=(h=null==r?void 0:r.notifyTouch)&&h),n.eventSystem.enabled=null!=(l=null==r?void 0:r.interactive)&&l,n.eventSystem.bindListeners(n.canvas),n.assetLoader=new hm(sW(n)),n.assetService=new lo(sW(n)),n.renderTargetPool=new oA(sW(n)),n.renderingData={currentFrame:{}},iG.notifyEngineCreated(sW(n)),n}iY(i,e);var r=i.prototype;return r.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},r.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},r.findEffectsObjectData=function(t){return this.jsonSceneData[t]},r.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},r.findObject=function(t){return iO(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},r.removeInstance=function(t){delete this.objectInstance[t]},r.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=i.items,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,h=i.animations,l=i.bins,c=void 0===l?[]:l,f=i.miscs,d=i.compositions,p=iQ(d);!(e=p()).done;){var m=e.value;this.addEffectsObjectData(m)}for(var v,y=iQ(void 0===n?[]:n);!(v=y()).done;){var g=v.value;h9(g.renderLevel,t.renderLevel)||(g.components=[],g.type=tJ.null),this.addEffectsObjectData(g)}for(var x,b=iQ(void 0===a?[]:a);!(x=b()).done;){var T=x.value;this.addEffectsObjectData(T)}for(var S,E=iQ(void 0===o?[]:o);!(S=E()).done;){var C=S.value;this.addEffectsObjectData(C)}for(var w,_=iQ(void 0===s?[]:s);!(w=_()).done;){var M=w.value;this.addEffectsObjectData(M)}for(var A,P=iQ(void 0===u?[]:u);!(A=P()).done;){var I=A.value;this.addEffectsObjectData(I)}for(var R,O=iQ(void 0===h?[]:h);!(R=O()).done;){var V=R.value;this.addEffectsObjectData(V)}for(var N,F=iQ(void 0===f?[]:f);!(N=F()).done;){var L=N.value;this.addEffectsObjectData(L)}for(var D=0;D<c.length;D++){var k=c[D],B=t.bins[D];if(k.dataType===eS.BinaryAsset)k.buffer=B,k.id&&this.addEffectsObjectData(k);else{var z=new lV;z.deserializeFromBinary(new Uint8Array(B));for(var U,G=iQ(z.exportObjectDatas);!(U=G()).done;){var W=U.value;this.addEffectsObjectData(W)}}}for(var j,X=iQ(void 0===r?[]:r);!(j=X()).done;){var H=j.value;this.addEffectsObjectData(H)}},r.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},r.mainLoop=function(t){if(!this.contextWasLost){var e=this.renderErrors;if(e.size>0){this.emit("rendererror",e.values().next().value),null==(i=this.ticker)||i.pause();return}t=Math.min(t,33)*this.speed;for(var i,r,n=this.compositions,a=!1,o=iQ(n);!(r=o()).done;){var s=r.value;if(s.textureOffloaded){a=!0,i_.error("Composition "+s.name+" texture offloaded, skip render.");continue}s.update(t)}if(a){this.emit("rendererror",Error("Play when texture offloaded.")),null==(u=this.ticker)||u.pause();return}this.emit("update",t);for(var u,h,l=iQ(n);!(h=l()).done;)h.value.sceneTicking.preRender.tick(0);this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var c,f=iQ(n);!(c=f()).done;)c.value.renderContent();this.emit("postrender"),this.renderTargetPool.flush()}},r.resize=function(){var t,e,i,r,n=this.canvas.parentElement;if(n){var a=this.getTargetSize(n);t=a[0],e=a[1],i=a[2],r=a[3]}else t=i=this.canvas.width,e=r=this.canvas.height;var o=t/e;if(t&&e){var s=document.documentElement.clientWidth;i>2*s&&i_.error("DPI overflowed, width "+i+" is more than 2x document width "+s+", see "+nz["DPI overflowed"]+".");var u=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>u||r>u)&&(i_.error("Container size overflowed "+i+"x"+r+", see "+nz["Container size overflowed"]+"."),o>1?(i=Math.round(u),r=Math.round(u/o)):(r=Math.round(u),i=Math.round(u*o))),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",i_.info("Resize engine "+this.name+" ["+i+","+r+","+t+","+e+"]."),this.setSize(i,r)}},r.setSize=function(t,e){var i;(this.getWidth()!==t||this.getHeight()!==e)&&(this.canvas.width=t,this.canvas.height=e,this.setViewport(0,0,t,e)),null==(i=this.compositions)||i.forEach(function(i){i.camera.aspect=t/e}),this.emit("resize",this)},r.createVertexBuffer=function(t,e){throw Error("The active rendering backend does not provide vertex buffers.")},r.createDynamicVertexBuffer=function(t,e){return this.createVertexBuffer(t,e)},r.createIndexBuffer=function(t,e){throw Error("The active rendering backend does not provide index buffers.")},r.updateDynamicVertexBuffer=function(t,e,i,r){throw Error("The active rendering backend cannot update vertex buffers.")},r.updateDynamicIndexBuffer=function(t,e,i){throw Error("The active rendering backend cannot update index buffers.")},r.releaseBuffer=function(t){return t.references--,0===t.references},r.bindBuffers=function(t,e,i){throw Error("The active rendering backend cannot bind geometry buffers.")},r.drawElementsType=function(t,e,i,r){throw Error("The active rendering backend cannot draw indexed primitives.")},r.drawArraysType=function(t,e,i,r){throw Error("The active rendering backend cannot draw primitives.")},r.addTexture=function(t){this.disposed||e1(this.textures,t)},r.removeTexture=function(t){this.disposed||e2(this.textures,t)},r.addMaterial=function(t){this.disposed||e1(this.materials,t)},r.removeMaterial=function(t){this.disposed||e2(this.materials,t)},r.addGeometry=function(t){this.disposed||e1(this.geometries,t)},r.removeGeometry=function(t){this.disposed||e2(this.geometries,t)},r.addParticleSystem=function(t){this.disposed||e1(this.particleSystems,t)},r.removeParticleSystem=function(t){this.disposed||e2(this.particleSystems,t)},r.addMesh=function(t){this.disposed||e1(this.meshes,t)},r.removeMesh=function(t){this.disposed||e2(this.meshes,t)},r.addRenderPass=function(t){this.disposed||e1(this.renderPasses,t)},r.removeRenderPass=function(t){this.disposed||e2(this.renderPasses,t)},r.addFramebuffer=function(t){this.disposed||e1(this.framebuffers,t)},r.removeFramebuffer=function(t){this.disposed||e2(this.framebuffers,t)},r.addRenderbuffer=function(t){this.disposed||e1(this.renderbuffers,t)},r.removeRenderbuffer=function(t){this.disposed||e2(this.renderbuffers,t)},r.addComposition=function(t){this.disposed||e1(this.compositions,t)},r.removeComposition=function(t){this.disposed||e2(this.compositions,t)},r.getWidth=function(){return 0},r.getHeight=function(){return 0},r.getShaderLibrary=function(){return null},r.bindSystemFramebuffer=function(){},r.setViewport=function(t,e,i,r){},r.clear=function(t){},r.setSampleAlphaToCoverage=function(t){},r.setBlending=function(t){},r.setDepthTest=function(t){},r.setStencilTest=function(t){},r.setScissorTest=function(t){},r.setScissor=function(t,e,i,r){},r.setCulling=function(t){},r.setPolygonOffsetFill=function(t){},r.blendColor=function(t,e,i,r){},r.blendFuncSeparate=function(t,e,i,r){},r.blendEquationSeparate=function(t,e){},r.colorMask=function(t,e,i,r){},r.depthMask=function(t){},r.depthFunc=function(t){},r.depthRange=function(t,e){},r.polygonOffset=function(t,e){},r.cullFace=function(t){},r.frontFace=function(t){},r.stencilMaskSeparate=function(t,e){},r.stencilFuncSeparate=function(t,e,i,r){},r.stencilOpSeparate=function(t,e,i,r){},r.dispose=function(){if(!this.disposed){this._disposed=!0,iG.notifyEngineDestroy(this);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&&i_.warn("Release GPU memory: "+t.join(", ")+"."),null==(e=this.ticker)||e.stop(),null==(i=this.eventSystem)||i.dispose();for(var e,i,r,n,a,o=iQ(this._compositions.slice());!(a=o()).done;)a.value.dispose();this.root.dispose(),null==(r=this.assetService)||r.dispose(),null==(n=this._graphics)||n.dispose(),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.assetManagers.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.particleSystems=[],this._compositions=[]}},r.getTargetSize=function(t){if(null==t)throw Error("Container is not an HTMLElement, see "+nz["Container is not an HTMLElement"]+".");var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),a=0,o=0;n?(a=parseInt(n.width,10),o=parseInt(n.height,10)):(a=t.clientWidth,o=t.clientHeight),r?a/o>r?e=(i=o*this.displayScale)*r:i=(e=a*this.displayScale)/r:(e=a,i=o);var s=this.pixelRatio,u=e,h=i;if(e=Math.round(e*s),i=Math.round(i*s),e<1||i<1){if(this.offscreenMode)e=i=u=h=1;else throw Error("Invalid container size "+e+"x"+i+", see "+nz["Invalid container size"]+".")}return[u,h,e,i]},rk(i,[{key:"compositions",get:function(){return this._compositions.sort(function(t,e){return t.getIndex()-e.getIndex()})}},{key:"graphics",get:function(){return this._graphics||(this._graphics=new oj(this)),this._graphics}},{key:"disposed",get:function(){return this._disposed}}]),i}(nU),lL={format:rG.RGBA,type:rG.UNSIGNED_BYTE,minFilter:rG.LINEAR,magFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE},lD=Symbol("dispose"),lk=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(lL).forEach(function(t){var i,r=null!=(i=e[t])?i:lL[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var l=this.engine;iS(l),h=no.create(l,o),this.textureCache[u]=h,this.textureRef[u]=1,h[lD]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[lD](),i.dispose=i[lD]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[lD](),i.dispose=i[lD]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),lB=function(){function t(){}return t.load=function(t,e,i){void 0===i&&(i={});var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f,d,p,m,v;return eK(this,function(y){switch(y.label){case 0:return s=performance.now(),u=null==(a=e.gpuCapability)?void 0:null==(n=a.detail)?void 0:n.asyncShaderCompile,h=e.compositions.length,l=new ln(i),e.assetManagers.push(l),[4,l.loadScene(t,e.renderer)];case 1:return c=y.sent(),e.clearResources(),iG.notifyAssetsLoadFinish(c,l.options,e),e.assetService.prepareAssets(c,c.assets),e.assetService.updateTextVariables(c,i.variables),(f=r.createComposition(c,e,i)).setIndex(h),d=performance.now(),[4,new Promise(function(t){var i;null==(i=e.getShaderLibrary())||i.compileAllShaders(function(){return t(null)})})];case 2:return y.sent(),p=performance.now()-d,null==(o=e.ticker)||o.start(),m=f.name,v=performance.now()-s,f.statistic.compileTime=p,f.statistic.firstFrameTime=v,i_.info("First frame ["+m+"]: "+v.toFixed(4)+"ms."),i_.info("Shader "+(u?"async":"sync")+" compile ["+m+"]: "+p.toFixed(4)+"ms."),[2,f]}})})()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=new lp(e,ro({},i),t);return e.env!==nB&&e.assetService.createShaderVariant(),r},t}(),lz=function(){function e(){}return e.instantiate=function(e,i){var r,n=e.scene,a=e.scene.jsonScene,o=e.options,s=i.engine;s.clearResources(),iG.notifyAssetsLoadFinish(n,o,s),s.assetService.prepareAssets(n,n.assets),s.assetService.updateTextVariables(n,o.variables),i.createTexturesFromData(n.textureOptions);for(var u,h=iQ(Object.keys(n.assets));!(u=h()).done;){var l=u.value,c=n.assets[l];eZ(c,HTMLVideoElement)&&i.videos.push(c)}var f=a.compositionId,d=a.compositions.find(function(t){return t.id===f});if(!d)throw Error('Composition with id "'+f+'" not found in JSONScene.');var p=new t.VFXItem(s);return p.instantiatePreComposition(d),p.getComponent(t.CompositionComponent).playOnStart=null==(r=o.autoplay)||r,p.getComponent(t.CompositionComponent).endBehavior=p.endBehavior,i.addItem(p),p},e}();iU("camera",o$),iU("text",u2),iU("sprite",sc),iU("particle",uY),iU("interact",ss),i_.info("Core version: 2.10.0.");var lU=((eU={})[rG.ONE]=eX.OneFactor,eU[rG.ZERO]=eX.ZeroFactor,eU[rG.SRC_COLOR]=eX.SrcColorFactor,eU[rG.SRC_ALPHA]=eX.SrcAlphaFactor,eU[rG.ONE_MINUS_SRC_COLOR]=eX.OneMinusSrcColorFactor,eU[rG.ONE_MINUS_SRC_ALPHA]=eX.OneMinusSrcAlphaFactor,eU[rG.DST_COLOR]=eX.DstColorFactor,eU[rG.DST_ALPHA]=eX.DstAlphaFactor,eU[rG.ONE_MINUS_DST_COLOR]=eX.OneMinusDstColorFactor,eU[rG.ONE_MINUS_DST_ALPHA]=eX.OneMinusDstAlphaFactor,eU),lG=((eG={})[rG.NEVER]=eX.NeverStencilFunc,eG[rG.EQUAL]=eX.EqualStencilFunc,eG[rG.LESS]=eX.LessStencilFunc,eG[rG.LEQUAL]=eX.LessEqualStencilFunc,eG[rG.ALWAYS]=eX.AlwaysStencilFunc,eG[rG.NOTEQUAL]=eX.NotEqualStencilFunc,eG[rG.GREATER]=eX.GreaterStencilFunc,eG[rG.GEQUAL]=eX.GreaterEqualStencilFunc,eG),lW=((eW={})[rG.KEEP]=eX.KeepStencilOp,eW[rG.ZERO]=eX.ZeroStencilOp,eW[rG.REPLACE]=eX.ReplaceStencilOp,eW[rG.INCR]=eX.IncrementStencilOp,eW[rG.DECR]=eX.DecrementStencilOp,eW[rG.INCR_WRAP]=eX.IncrementWrapStencilOp,eW[rG.DECR_WRAP]=eX.IncrementWrapStencilOp,eW[rG.INVERT]=eX.InvertStencilOp,eW),lj=((ej={})[rG.NEVER]=eX.NeverDepth,ej[rG.ALWAYS]=eX.AlwaysDepth,ej[rG.EQUAL]=eX.EqualDepth,ej[rG.LESS]=eX.LessDepth,ej[rG.LEQUAL]=eX.LessEqualDepth,ej[rG.GREATER]=eX.GreaterDepth,ej[rG.GEQUAL]=eX.GreaterEqualDepth,ej[rG.NOTEQUAL]=eX.NotEqualDepth,ej),lX=["uMaskTex","_MainTex","uColorOverLifetime","uColorOverTrail"],lH=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new eX.RawShaderMaterial,n.threeUniforms={},n.macrosDirty=!0;var n,a,o,s,u,h,l,c=null==r?void 0:r.shader,f=null!=(o=null==(a=i.gpuCapability)?void 0:a.level)?o:1;return n.shader=new t.Shader(i),n.shader.shaderData=ro({},c,{id:iL(),dataType:eS.Shader,vertex:null!=(s=null==c?void 0:c.vertex)?s:"",fragment:null!=(u=null==c?void 0:c.fragment)?u:""}),n.threeUniforms._MainTex=new eX.Uniform(null),n.threeUniforms.effects_ObjectToWorld=new eX.Uniform(new eX.Matrix4().identity()),n.threeUniforms.effects_MatrixInvV=new eX.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.threeUniforms.effects_MatrixVP=new eX.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.threeUniforms.effects_MatrixV=new eX.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new eX.RawShaderMaterial({vertexShader:ob.genFinalShaderCode({level:f,shaderType:t.ShaderType.vertex,shader:null!=(h=null==c?void 0:c.vertex)?h:"",macros:null==c?void 0:c.macros,removeVersion:!0}),fragmentShader:ob.genFinalShaderCode({level:f,shaderType:t.ShaderType.fragment,shader:null!=(l=null==c?void 0:c.fragment)?l:"",macros:null==c?void 0:c.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:eX.LessDepth,polygonOffsetFactor:eX.ZeroFactor,polygonOffsetUnits:eX.ZeroFactor,polygonOffset:!1,uniforms:n.threeUniforms}),1===f?n.material.glslVersion=eX.GLSL1:n.material.glslVersion=eX.GLSL3,n}iY(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;lX.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new eX.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new eX.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.threeUniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=iQ(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.threeUniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=iQ(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.threeUniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.threeUniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.threeUniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.threeUniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){var e=this.threeUniforms[t].value;return new ii(e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setUniform(t,new eX.Vector4(e.r,e.g,e.b,e.a))},r.getQuaternion=function(t){return this.threeUniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.threeUniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.threeUniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.threeUniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.threeUniforms[t]},r.setUniform=function(t,e){var i=new eX.Uniform(e);this.threeUniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(){this.destroyed||(this.material.dispose(),this.destroyed=!0,e.prototype.dispose.call(this))},rk(i,[{key:"blending",get:function(){return this.material.blending!==eX.NoBlending},set:function(t){this.material.blending=t?eX.CustomBlending:eX.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=lU[e],this.material.blendDst=lU[i],this.material.blendSrcAlpha=lU[r],this.material.blendDstAlpha=lU[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=lj[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=lG[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=lW[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=lW[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=lW[t[0]])}},{key:"culling",get:function(){return this.material.side!==eX.DoubleSide},set:function(t){this.material.side=t?eX.FrontSide:eX.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tH.FRONT?this.material.side=eX.FrontSide:t===tH.BACK&&(this.material.side=eX.BackSide)}},{key:"colorMask",get:function(){return this.material.colorWrite},set:function(t){this.material.colorWrite=t}}]),i}(nw);function lY(t,e){return e&&("object"==(e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)||"function"==typeof e)?e:sW(t)}var lZ=new WeakMap;function lq(t){t.flush();var e,i=lZ.get(t),r=t.getAttributeNames(),n=t.getIndexBuffer(),a=t.instanceCount>0;if(!i||!((e=i).indexBuffer===n&&e.instanced===a&&Object.keys(e.vertexBuffers).length===r.length&&r.every(function(i){return e.vertexBuffers[i]===t.getVertexBuffer(i)}))){null==i||i.resource.dispose();var o=a?new eX.InstancedBufferGeometry:new eX.BufferGeometry,s={};o.name=t.name,r.forEach(function(e){var i=t.getVertexBuffer(e),r=null==i?void 0:i.getBuffer(),n=null==r?void 0:r.resource;i&&eZ(n,eX.InterleavedBuffer)&&(s[e]=i,o.setAttribute(e,new eX.InterleavedBufferAttribute(n,i.getSize(),i.byteOffset/n.array.BYTES_PER_ELEMENT,i.normalized)))});var u=null==n?void 0:n.resource;eZ(u,eX.BufferAttribute)&&o.setIndex(u),i={vertexBuffers:s,indexBuffer:n,instanced:a,resource:o},lZ.set(t,i)}eZ(i.resource,eX.InstancedBufferGeometry)&&(i.resource.instanceCount=t.instanceCount);var h=t.getIndexBuffer()?t.getDrawStart()/nA(t.getIndexType()):t.getDrawStart();return i.resource.setDrawRange(h,t.getDrawCount()),i.resource}var lK=function(t){function e(e,i){if(!i)return lY(r);var r,n=i.material,a=i.geometry,o=i.priority;(r=t.call(this,e,i)||this).geometry=a,r.material=n;var s=lq(a);return a.mode===rG.LINES?r.mesh=new eX.LineSegments(s,n.material):r.mesh=new eX.Mesh(s,n.material),r.priority=void 0===o?0:o,r}iY(e,t);var i=e.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(t){this.material.dispose(),this.material=t,this.mesh.material=t.material},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},i.restore=function(){},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.mesh.geometry=lq(this.geometry),this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.dispose=function(e){this.destroyed||(this.mesh.clear(),this.destroyed=!0),t.prototype.dispose.call(this)},rk(e,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),e}(os),lQ=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(ro({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a.source={},a}iY(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.assembleOptions=function(e){var r=e.target,n=void 0===r?rG.TEXTURE_2D:r;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=t.TextureSourceType.none),ro({},e,{target:n,format:eX.RGBAFormat,type:eX.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose(),e.prototype.dispose.call(this)},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,h=i.sourceType,l=eX.UVMapping,c=i.format,f=void 0;if(this.sourceType=h,h===t.TextureSourceType.data){var d=e.data;f=new eX.DataTexture(d.data,d.width,d.height,c,n,l,a,o,u,s),this.width=d.width,this.height=d.height}else if(h===t.TextureSourceType.image){var p=e.image;f=new eX.Texture(p,l,a,o,u,s,c,n),this.width=p.width,this.height=p.height}else if(h===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});c=eX.RGBA_ASTC_4x4_Format,f=new eX.CompressedTexture(y,m,v,c,n,l,a,o,u,s),this.width=m,this.height=v}else if(h===t.TextureSourceType.video)f=new eX.VideoTexture(e.video,l,a,o,u,s,c,n);else if(h===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,S=null!=(b=g.height)?b:0;f=new eX.FramebufferTexture(T,S,c),this.width=T,this.height=S}}else h===t.TextureSourceType.none&&((f=new eX.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=eX.MirroredRepeatWrapping,f.wrapT=eX.MirroredRepeatWrapping,this.width=this.height=1);if(this.source=e,f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===rG.LINEAR?eX.LinearFilter:eX.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case rG.MIRRORED_REPEAT:return eX.MirroredRepeatWrapping;case rG.REPEAT:return eX.RepeatWrapping;default:return eX.ClampToEdgeWrapping}},i}(no),lJ=function(t){function e(e,i,r){return t.call(this,e,i,r)}return iY(e,t),e.prototype.renderContent=function(){var t=this.renderer;this.renderFrame.renderPasses[0].meshes.length=0;for(var e,i=this.sceneRoot.getDescendants(),r=iQ(i);!(e=r()).done;)for(var n,a=e.value.getComponents(nk),o=iQ(a);!(n=o()).done;){var s=n.value;s.isActiveAndEnabled&&s.render(t)}},e}(lp);lJ.shape={};var l$=function(t){function e(e){return t.call(this,e)}iY(e,t);var i=e.prototype;return i.getWidth=function(){return this.engine.canvas.width},i.getHeight=function(){return this.engine.canvas.height},i.drawGeometry=function(t,e,i,r){},e}(oO),l0=function(t){function e(e){var i;return(i=t.call(this)||this).resource=e,i}return iY(e,t),rk(e,[{key:"underlyingResource",get:function(){return this.resource}}]),e}(nM),l1=function(e){function i(t,i){var r;return(r=e.call(this,t.canvas,i)||this).renderer=new l$(sW(r)),r.gpuCapability=new oI(t),r}iY(i,e);var r=i.prototype;return r.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},r.createVertexBuffer=function(t,e){var i=l2(t,e.type),r=e.byteStride>0?e.byteStride/i.BYTES_PER_ELEMENT:1;return l3(e.instanceDivisor>0?new eX.InstancedInterleavedBuffer(i,r,e.instanceDivisor):new eX.InterleavedBuffer(i,r),i.byteLength)},r.createDynamicVertexBuffer=function(t,e){return this.createVertexBuffer(t,e)},r.createIndexBuffer=function(t){var e=function(t){if(eZ(t,Uint16Array)||eZ(t,Uint32Array))return t;for(var e=0;e<t.length;e++)if(t[e]>=65535)return new Uint32Array(t);return new Uint16Array(t)}(t),i=l3(new eX.BufferAttribute(e,1),e.byteLength);return i.is32Bits=eZ(e,Uint32Array),i},r.updateDynamicVertexBuffer=function(e,i,r,n){void 0===r&&(r=0);var a=l2(i,t.BufferDataType.Float);void 0!==n&&n<a.byteLength&&(a=new Uint8Array(a.buffer,a.byteOffset,n));var o=e.resource;if(o){if(r<0||r+a.byteLength>e.capacity)throw RangeError("Buffer update is out of range.");var s=o.array,u=r/s.BYTES_PER_ELEMENT;if(!Number.isInteger(u))throw RangeError("Buffer update is not aligned.");s.set(a,u),o.updateRange.offset=u,o.updateRange.count=a.length,o.needsUpdate=!0}},r.updateDynamicIndexBuffer=function(t,e,i){void 0===i&&(i=0);var r=t.is32Bits?eZ(e,Uint32Array)?e:new Uint32Array(e):eZ(e,Uint16Array)?e:new Uint16Array(e),n=t.resource;if(n){if(i<0||i+r.byteLength>t.capacity)throw RangeError("Buffer update is out of range.");var a=n.array,o=i/a.BYTES_PER_ELEMENT;if(!Number.isInteger(o))throw RangeError("Buffer update is not aligned.");a.set(r,o),n.updateRange.offset=o,n.updateRange.count=r.length,n.needsUpdate=!0}},r.releaseBuffer=function(t){return t.references--,0===t.references&&(t.resource=void 0,t.capacity=0,!0)},r.removeGeometry=function(t){var i;null==(i=lZ.get(t))||i.resource.dispose(),lZ.delete(t),e.prototype.removeGeometry.call(this,t)},i}(lF);function l2(t,e){if("number"==typeof t)return nR(e,t/nA(e));if(Array.isArray(t)){var i=nR(e,t.length);return i.set(t),i}if(eZ(t,ArrayBuffer)){var r=t.byteLength/nA(e),n=nR(e,r);return new Uint8Array(n.buffer).set(new Uint8Array(t)),n}return eZ(t,DataView)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function l3(t,e){var i=new l0(t);return i.capacity=e,i.references=1,i}var l4=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.engine=new l1(e),r.assetService=new lo(r.engine),r.width=n,r.height=a,r.camera=o,r}iY(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return eY(function(){var r,n,a,o,s,u,h,l,c,f,d,p;return eK(this,function(m){switch(m.label){case 0:return iS(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),r=performance.now(),n=[],a=[],s=null==(o=null==e?void 0:e.autoplay)||o,u=i.baseCompositionIndex,iP(t)?(h=n).push.apply(h,[].concat(t)):n.push(t),[4,Promise.all(n.map(eY(function(t,r){var n,o,h,l,c,f,d;return eK(this,function(p){switch(p.label){case 0:return o=(n=i.assetService.assembleSceneLoadOptions(t,ro({autoplay:s},e))).source,[4,(l=new ln(h=n.options)).loadScene(o,i.renderer)];case 1:return c=p.sent(),(f=i.engine).clearResources(),iG.notifyAssetsLoadFinish(c,l.options,f),i.assetService.prepareAssets(c,l.getAssets()),i.assetService.updateTextVariables(c,l.options.variables),d=i.createComposition(c,h),i.baseCompositionIndex+=1,d.setIndex(u+r),a[r]=d,[2]}})})))];case 1:for(m.sent(),l=0;l<a.length;l++)s?a[l].play():a[l].pause();for(c=a.map(function(t){return t.name}),f=performance.now()-r,d=iQ(a);!(p=d()).done;)p.value.statistic.firstFrameTime=f;return i_.info("First frame ["+c+"]: "+f.toFixed(4)+"ms."),[2,iP(t)?a:a[0]]}})})()},i.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=new lJ(this.engine,ro({},e,{onItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),t);return r.on("end",function(){i.dispatchEvent({type:"end",composition:r})}),this.renderer.engine.setOptions({threeCamera:this.camera,threeGroup:this,composition:r}),this.compositions.push(r),r},i.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},i.resume=function(){this.dispatchEvent({type:"resume"}),this.compositions.forEach(function(t){t.resume()})},i.update=function(t){this.compositions.forEach(function(e){e.update(t),e.render()})},rk(e,[{key:"renderer",get:function(){return this.engine.renderer}},{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(eX.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){this.isActiveAndEnabled||this.threeMesh.clear(),t.prototype.dispose.call(this)},i.fromData=function(e){if(t.prototype.fromData.call(this,e),!this.threeMesh){var i=lq(this.geometry);this.geometry.mode===rG.LINES?this.threeMesh=new eX.LineSegments(i,this.material.material):this.threeMesh=new eX.Mesh(i,this.material.material)}},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.threeMesh.geometry=lq(this.geometry),this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},rk(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=eq([i1(eS.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){(r=t.call(this,e,i)||this).isDirty=!0;var r,n=oL.getCanvasAndContext(1,1);if(r.canvas=n.canvas,r.context=n.context,!i)return lY(r);var a=i.options;return r.updateWithOptions(a),r.updateTexture(),r}iY(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture(),this.releaseTextCanvas()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(),this.material.setColor("_Color",new ii(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=eq([i1(eS.TextComponent)],t.ThreeTextComponent),ik(t.ThreeTextComponent,[u$]),no.create=function(t,e){return new lQ(t,void 0,e)},no.createWithData=function(t,e,i){return new lQ(t,e,i)},nw.create=function(t,e){return new lH(t,e)},os.create=function(t,e){return new lK(t,e)};var l5="2.10.0";i_.info("THREEJS plugin version: "+l5+"."),t.ATLAS_SIZE=512,t.ActivationMixerPlayable=sb,t.ActivationPlayable=sT,t.AndNode=rb,t.Animatable=ru,t.AnimationClipNode=rs,t.AnimationEvent=sy,t.ApplyAdditiveNode=rg,t.Asset=hd,t.AssetLoader=hm,t.AssetManager=ln,t.AssetService=lo,t.BYTES_TYPE_MAP=oa,t.Behaviour=rz,t.BezierCurve=aR,t.BezierCurvePath=ab,t.BezierCurveQuat=aT,t.BezierDataMap=at,t.BezierEasing=ao,t.BezierLengthData=n9,t.BezierMap=n7,t.BezierPath=an,t.BezierQuat=aa,t.BlendNode=rx,t.BoolValueNode=rr,t.BoundingBoxInfo=nD,t.Buffer=nO,t.CONSTANT_MAP_BLEND=lU,t.CONSTANT_MAP_DEPTH=lj,t.CONSTANT_MAP_STENCIL_FUNC=lG,t.CONSTANT_MAP_STENCIL_OP=lW,t.COPY_FRAGMENT_SHADER="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n",t.COPY_MESH_SHADER_ID="effects-internal-copy-mesh",t.COPY_VERTEX_SHADER="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",t.Camera=lu,t.CameraVFXItemLoader=o$,t.Circle=aJ,t.ColorCurve=aL,t.ColorPlayable=sv,t.ColorPropertyMixerPlayable=sC,t.Component=rB,t.ComponentTimePlayable=uH,t.ComponentTimePlayableAsset=uX,t.ComponentTimeTrack=uG,t.Composition=lp,t.ConstBoolNode=rC,t.ConstFloatNode=rE,t.ConstraintTarget=oZ,t.ControlParameterBoolNode=r_,t.ControlParameterFloatNode=rw,t.ControlParameterTriggerNode=rM,t.DEFAULT_FONTS=["serif","sans-serif","monospace","courier"],t.DEFAULT_FPS=60,t.DataBuffer=nM,t.Database=hv,t.Deferred=function(){var t=this;this.promise=new Promise(function(e,i){t.resolve=e,t.reject=i})},t.Downloader=rq,t.DrawObjectPass=a4,t.EFFECTS_COPY_MESH_NAME="effects-internal-copy",t.EVENT_TYPE_CLICK=st,t.EVENT_TYPE_TOUCH_END=sr,t.EVENT_TYPE_TOUCH_MOVE=si,t.EVENT_TYPE_TOUCH_START=se,t.EffectComponentTimeTrack=uj,t.EffectsObject=i4,t.EffectsPackage=lV,t.Ellipse=aW,t.Engine=lF,t.EventEmitter=nU,t.EventSystem=sn,t.Float16ArrayWrapper=nZ,t.FloatComparisonNode=rR,t.FloatComparisonNodeData=rI,t.FloatPropertyMixerPlayable=sw,t.FloatValueNode=ri,t.Framebuffer=a0,t.GPUCapability=oI,t.Geometry=a6,t.GlobalUniforms=o_,t.GlyphAtlas=oD,t.GradientValue=ay,t.GraphInstance=rL,t.GraphNode=i9,t.GraphNodeData=i7,t.Graphics=oj,t.HELP_LINK=nz,t.InputEvent=o2,t.InputEventKey=o4,t.InputEventMouse=o5,t.InputEventMouseButton=o6,t.InputEventMouseMotion=o8,t.InputEventScreenDrag=o7,t.InputEventScreenTouch=o9,t.InputEventWithModifiers=o3,t.InteractLoader=ss,t.InteractMesh=sh,t.InvalidIndex=-1,t.LayerBlendNode=rA,t.LineSegments=ag,t.LinearValue=av,t.MaskProcessor=n_,t.MaskableGraphic=oq,t.Material=nw,t.MaterialDataBlock=nd,t.MaterialState=nE,t.Mesh=os,t.NodeTransform=rm,t.NotNode=rS,t.NotifyEvent=sg,t.OrNode=rT,t.PLAYER_OPTIONS_ENV_EDITOR=nB,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=uw,t.ParticleBehaviourPlayableAsset=u_,t.ParticleLoader=uY,t.ParticleMesh=uA,t.ParticleMixerPlayable=s_,t.ParticleSystemRenderer=uP,t.ParticleTrack=sG,t.PassTextureCache=lk,t.PathSegments=ax,t.Playable=sf,t.PlayableAsset=sp,t.PlayableOutput=sd,t.Plugin=iX,t.PluginSystem=iG,t.PointerEventData=nN,t.PolyStar=aQ,t.Polygon=a$,t.Pose=rv,t.PoseNode=rt,t.Precomposition=li,t.PrecompositionManager=lz,t.PropertyClipPlayable=sS,t.PropertyTrack=sU,t.REFERENCE_CURVE=28,t.RENDER_PREFER_LOOKUP_TEXTURE=oV,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=ad,t.RandomValue=ap,t.RandomVectorValue=am,t.RaycastResult=nF,t.Rectangle=aj,t.ReferenceCurve=aV,t.RenderFrame=oC,t.RenderPass=a3,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=a1,t.RenderTargetPool=oA,t.Renderbuffer=oM,t.Renderer=oO,t.RendererComponent=nk,t.RuntimeClip=sz,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.SceneLoader=lB,t.SerializationHelper=hp,t.ShaderFactory=ob,t.ShaderVariant=nS,t.SpriteColorMixerPlayable=sM,t.SpriteComponentTimeTrack=uW,t.SpriteLoader=sc,t.SpritePropertyMixerPlayable=sA,t.StateMachineNode=rO,t.StateNode=rV,t.StaticValue=af,t.SubCompositionClipPlayable=sP,t.SubCompositionMixerPlayable=sI,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oN,t.TEXTURE_UNIFORM_MAP=lX,t.TextCache=ok,t.TextComponentBase=u$,t.TextLayout=uQ,t.TextLoader=u2,t.TextStyle=uJ,t.Texture=no,t.TextureFactory=nf,t.ThreeComposition=lJ,t.ThreeDisplayObject=l4,t.ThreeEngine=l1,t.ThreeMaterial=lH,t.ThreeTexture=lQ,t.Ticker=lN,t.TimelineClip=sB,t.TimelineInstance=uz,t.TrackMixerPlayable=sx,t.Transform=nH,t.TransformMixerPlayable=sF,t.TransformPlayable=sN,t.TransitionNode=rN,t.Triangle=aX,t.TrimPath=hf,t.ValueGetter=ac,t.ValueNode=re,t.Vector2Curve=aI,t.Vector2PropertyMixerPlayable=sk,t.Vector3Curve=aP,t.Vector3PropertyMixerPlayable=sD,t.Vector4Curve=aA,t.Vector4PropertyMixerPlayable=sL,t.VertexBuffer=nV,t.addByOrder=ib,t.addItem=e1,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=ik,t.assertExist=iS,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=iD,t.breakOpportunityAfter=uK,t.buildBezierData=ar,t.buildEasingCurve=as,t.buildLine=aU,t.calculateTranslation=nQ,t.canUseBOM=il,t.canvasPool=oL,t.closePointEps=1e-4,t.colorGradingFrag=op,t.colorStopsFromGradient=io,t.colorToArr=ir,t.combineImageTemplate=lt,t.createGLContext=function(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r},t.createKeyFrameMeta=aw,t.createShape=s4,t.createTypedArray=nR,t.createValueGetter=aF,t.curveEps=1e-4,t.decimalEqual=n4,t.deserializeMipmapTexture=ne,t.earcut=uc,t.effectsClass=i1,t.effectsClassStore=i0,t.enlargeBuffer=e3,t.ensureFixedNumber=hg,t.ensureVec3=nJ,t.extractMinAndMax=n6,t.gaussianDownHFrag=om,t.gaussianDownVFrag=ov,t.gaussianUpFrag=oy,t.generateEmptyTexture=nl,t.generateEmptyTypedArray=function(t){return nR(t,0)},t.generateGUID=iL,t.generateHalfFloatTexture=ns,t.generateWhiteTexture=nh,t.getBackgroundImage=h7,t.getBytesPerElement=nA,t.getClass=function(t){return i0[t]},t.getColorFromGradientStops=ia,t.getConfig=function(t){return oF[t]},t.getControlPoints=au,t.getDataByteLength=nI,t.getDataType=nP,t.getDefaultTextureFactory=function(){return eR||(eR=new nf),eR},t.getGeometryByShape=ud,t.getGeometryTriangles=uf,t.getKeyFrameMetaByRawValue=aC,t.getMergedStore=i2,t.getNodeDataClass=function(t){return i6[t]},t.getParticleMeshShader=function(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===nB]],h=e.detail,l=aw(),c=aw(),f=h.maxVertexUniforms>0,d=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,p=0,m=0;f&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(u.push(["SPEED_OVER_LIFETIME",!0]),m|=2,aC(l,d));var v=o.textureSheetAnimation;v&&v.animate&&(u.push(["USE_SPRITE",!0]),m|=4);var y=o.colorOverLifetime;y&&y.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&aC(l,g);var x=o.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==x?void 0:x[r])&&(aC(l,x[r]),i=1,m|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==x?void 0:x[n])&&(aC(l,x[n]),o=1,m|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==x?void 0:x.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),a&&(null==x?void 0:x.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),o.sizeOverLifetime){var b=o.sizeOverLifetime;b.separateAxes?(aC(l,b.x),u.push(["SIZE_Y_BY_LIFE",1]),m|=16384,aC(l,b.y)):aC(l,b.size)}if(o.rotationOverLifetime){var T=o.rotationOverLifetime;T.z&&(aC(l,null==T?void 0:T.z),m|=32768,u.push(["ROT_Z_LIFETIME",1])),T.separateAxes&&(T.x&&(aC(l,T.x),m|=65536,u.push(["ROT_X_LIFETIME",1])),T.y&&(aC(l,T.y),m|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==T?void 0:T.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=262144)}aC(l,null==x?void 0:x.gravityOverLifetime),(null==x?void 0:x.forceTarget)&&(u.push(["FINAL_TARGET",!0]),m|=524288,aC(l,x.forceCurve));var S=h.halfFloatTexture;S&&c.max&&(m|=1048576);var E=h.maxVertexUniforms,C=l.max+l.curves.length-32>E;oF[oV]&&(C=!0),C&&S&&f&&(p=1);var w={fragment:ol,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+oc,shared:!0,cacheId:["-p:",s,m,l.index,l.max,c.index,c.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",c.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",c.max]),{shader:w,vertex:l.index,fragment:c.index}},t.getPixelRatio=ih,t.getPluginUsageInfo=ij,t.getPreMultiAlpha=rH,t.getStandardComposition=h4,t.getStandardImage=h3,t.getStandardItem=h6,t.getStandardJSON=h1,t.getTextureSize=ow,t.glContext=rG,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return eC.Float32;case WebGLRenderingContext.SHORT:return eC.Int16;case WebGLRenderingContext.BYTE:return eC.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return eC.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return eC.UInt8;default:return eC.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=eY(function(){return eK(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){iA(t)&&(t=ir(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i},t.imageDataFromGradient=ig,t.initErrors=rU,t.initGLContext=rj,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=is,t.isAlipayMiniApp=iv,t.isAndroid=id,t.isArray=iP,t.isBreakChar=uZ,t.isCJKLike=uq,t.isCanvas=iV,t.isFunction=iI,t.isIOS=ic,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return iv()||iy()},t.isObject=iR,t.isOpenHarmony=ip,t.isPlainObject=iO,t.isPowerOfTwo=function(t){return(t&t-1)==0&&0!==t},t.isSafeFontFamily=iC,t.isSimulatorCellPhone=im,t.isString=iA,t.isUniformStruct=np,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&np(t[0])},t.isValidFontFamily=iE,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=iy,t.itemFrag=oh,t.itemVert=ou,t.loadAVIFOptional=r0,t.loadBinary=r4,t.loadBlob=function(t){return r6.apply(this,arguments)},t.loadImage=r2,t.loadMedia=r7,t.loadVideo=r8,t.loadWebPOptional=rJ,t.logger=i_,t.math=nT,t.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}},t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.nodeDataClass=i8,t.noop=iM,t.normalizeColor=hC,t.numberToFix=n5,t.oldBezierKeyFramesToNew=aO,t.parsePercent=iu,t.particleFrag=ol,t.particleOriginTranslateMap=n1,t.particleUniformTypeMap=uM,t.particleVert=oc,t.passRenderLevel=h9,t.pluginLoaderMap=iB,t.randomInRange=iN,t.registerPlugin=iU,t.removeItem=e2,t.rotateVec2=up,t.screenMeshVert=od,t.serialize=function(t,e){return i3(t,e)},t.setBlendMode=rY,t.setConfig=function(t,e){return oF[t]=e},t.setDefaultTextureFactory=function(t){eR=t},t.setMaskMode=function(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[rG.ALWAYS,rG.ALWAYS],e.stencilOpZPass=[rG.REPLACE,rG.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[rG.EQUAL,rG.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[rG.NOTEQUAL,rG.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}},t.setRayFromCamera=n2,t.setSideMode=rZ,t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new eX.Uniform(i)},t.sortByOrder=ix,t.spec=iq,t.textureLoaderRegistry=nc,t.thresholdFrag=og,t.throwDestroyedError=iF,t.toBufferView=function(t){return Array.isArray(t)?new Float32Array(t):eZ(t,ArrayBuffer)?new Uint8Array(t):t},t.trailVert=of,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=n3,t.unregisterPlugin=function(t){delete iB[t];var e=iz.findIndex(function(e){return e.name===t});-1!==e&&iz.splice(e,1)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=n$,t.vecMulCombine=n0,t.version=l5,t.vertexFormatType2GLType=function(t){switch(t){case eC.Float32:return WebGLRenderingContext.FLOAT;case eC.Int16:return WebGLRenderingContext.SHORT;case eC.Int8:return WebGLRenderingContext.BYTE;case eC.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case eC.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
6
|
+
* Version: v2.10.1
|
|
7
|
+
*/function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,S,E,C,w,_,M,A,P,I,R,O,V,N,F,L,D,k,B,z,U,G,W,j,X,H,Y,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tl,tc,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tS,tE,tC,tw,t_,tM,tA,tP,tI,tR,tO,tV,tN,tF,tL,tD,tk,tB,tz,tU,tG,tW,tj,tX,tH,tY,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,el,ec,ef,ed,ep,em,ev,ey,eg,ex,eb,eT,eS,eE,eC,ew,e_,eM,eA,eP,eI,eR,eO,eV,eN,eF,eL,eD,ek,eB,ez,eU,eG,eW,ej,eX=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function eH(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function eY(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){eH(a,r,n,o,s,"next",t)}function s(t){eH(a,r,n,o,s,"throw",t)}o(void 0)})}}function eZ(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):eZ(t,e)}function eq(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function eK(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var eQ=new Uint8Array(16),eJ=[],e$=0;e$<256;++e$)eJ.push((e$+256).toString(16).slice(1));var e0={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function e1(t,e){return t.includes(e)||t.push(e),t}function e2(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function e3(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}var e4=Math.PI/180,e5=180/Math.PI;function e6(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var e8=function(t,e,i){return(1-i)*t+i*e};function e9(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}var e7=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.angle=function(){return Math.atan2(-this.y,-this.x)+Math.PI},e.rotateAround=function(t,e){var i=Math.cos(e),r=Math.sin(e),n=this.x-t.x,a=this.y-t.y;return this.x=n*i-a*r+t.x,this.y=n*r+a*i+t.y,this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();e7.ONE=new e7(1,1),e7.ZERO=new e7(0,0);var it=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new e7(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)},e.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},e.setFromMatrixColumn=function(t,e){return this.setFromArray(t.elements,4*e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();it.X=new it(1,0,0),it.Y=new it(0,1,0),it.Z=new it(0,0,1),it.ONE=new it(1,1,1),it.ZERO=new it(0,0,0);var ie=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new it(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();ie.ONE=new ie(1,1,1,1),ie.ZERO=new ie(0,0,0,0);var ii=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,h=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,h=o):a>=3&&a<=4?(u=o,h=n):a>=4&&a<=5?(s=o,h=n):a>=5&&a<=6&&(s=n,h=o);var l=i-n;return this.set(s+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):eZ(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):eZ(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):eZ(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):eZ(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new ie(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,h=0;return 0!==a&&(h=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,h,a,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*Math.min(Math.max(this.r,0),1))),r=t.ToHex(Math.round(255*Math.min(Math.max(this.g,0),1))),n=t.ToHex(Math.round(255*Math.min(Math.max(this.b,0),1))),a=t.ToHex(Math.round(255*Math.min(Math.max(this.a,0),1)));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)},t.linearToGamma=function(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function ir(t,e){var i=[0,0,0,0];if(iA(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eZ(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function ia(t,e,i){if(0===t.length)return[0,0,0,0];if(e<=t[0].time)r=t[0].color.toArray();else if(e>=t[t.length-1].time)r=t[t.length-1].color.toArray();else{r=t[t.length-1].color.toArray();for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.time<=e&&e<=o.time){r=is(a.color.toArray(),o.color.toArray(),(e-a.time)/(o.time-a.time));break}}}return i?r.map(function(t){return t/255}):r}function io(t){var e=[];return eZ(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({time:iu(i),color:new ii(r,n,a,o)})}):Object.keys(t).forEach(function(i){var r=t[i],n=new ii().setFromArray(ir(r));e.push({time:iu(i),color:n})}),e=e.sort(function(t,e){return t.time-e.time})}function is(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function iu(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function ih(){return"object"==typeof window?Math.min(2,window.devicePixelRatio||1):1}ii.BLACK=new ii(0,0,0,1),ii.BLUE=new ii(0,0,1,1),ii.CLEAR=new ii(0,0,0,0),ii.CYAN=new ii(0,1,1,1),ii.GRAY=new ii(.5,.5,.5,1),ii.GREEN=new ii(0,1,0,1),ii.MAGENTA=new ii(1,0,1,1),ii.RED=new ii(1,0,0,1),ii.WHITE=new ii(1,1,1,1),ii.YELLOW=new ii(1,.92,.016,1);var il="undefined"!=typeof window;function ic(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function id(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ip(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function im(){return id()||ip()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function iv(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function iy(){return"miniprogram"===window.__wxjs_environment}function ig(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=io(t);if(r.length)for(var n=0;n<128;n++){var a=n/127;if(a<=r[0].time)i.set(r[0].color.toArray(),4*n);else if(a>=r[r.length-1].time)i.set(r[r.length-1].color.toArray(),4*n);else for(var o=0;o<r.length-1;o++){var s=r[o],u=r[o+1];if(s.time<=a&&u.time>a){var h=is(s.color.toArray(),u.color.toArray(),(a-s.time)/(u.time-s.time));i.set(h,4*n);break}}}return e}function ix(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var a,o,s=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>s.priority&&h>=u;)h--;for(;e[u].priority<=s.priority&&u<h;)u++}else{for(;e[h].priority<s.priority&&h>=u;)h--;for(;e[u].priority>=s.priority&&u<h;)u++}a=[e[h],e[u]],e[u]=a[0],e[h]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)iT(t,r,e);return t}function ib(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&iT(t,t.length-1,i)),t}function iT(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function iS(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function iE(t){return iC(t)||!im()}function iC(t){return/^[^\d.][\w-]*$/.test(t)}function iw(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var i_={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(iw(t),[r])),null==tG||tG("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(iw(t))),null==tG||tG("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(iw(t))),null==tG||tG("warn",t,r)},register:function(t){t&&iI(t)&&(tG=t)}};function iM(){}function iA(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var iP=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function iI(t){return"[object Function]"===Object.prototype.toString.call(t)}function iR(t){return"[object Object]"===Object.prototype.toString.call(t)}function iO(t){if(null===t||"object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function iV(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function iN(t,e){return t+Math.random()*(e-t)}function iF(){throw Error("Destroyed item cannot be used again.")}function iL(){return(function(t,e,i){if(e0.randomUUID&&!t)return e0.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tU&&!(tU="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tU(eQ)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eJ[n[r+0]]+eJ[n[r+1]]+eJ[n[r+2]]+eJ[n[r+3]]+"-"+eJ[n[r+4]]+eJ[n[r+5]]+"-"+eJ[n[r+6]]+eJ[n[r+7]]+"-"+eJ[n[r+8]]+eJ[n[r+9]]+"-"+eJ[n[r+10]]+eJ[n[r+11]]+eJ[n[r+12]]+eJ[n[r+13]]+eJ[n[r+14]]+eJ[n[r+15]]})().replace(/-/g,"")}function iD(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var h=new Uint8Array(s);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function ik(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var iB={},iz=[];function iU(t,e){iB[t]&&i_.error("Duplicate registration for plugin "+t+"."),iB[t]=e;var i=new e;i.name=t,iz.push(i),iz.sort(function(t,e){return t.order-e.order})}var iG=function(){function t(){}return t.getPlugins=function(){return iz},t.notifyCompositionCreating=function(t,e){iz.forEach(function(i){return i.onCompositionCreating(t,e)})},t.notifyCompositionCreated=function(t,e){iz.forEach(function(i){return i.onCompositionCreated(t,e)})},t.notifyCompositionDestroy=function(t){iz.forEach(function(e){return e.onCompositionDestroy(t)})},t.notifyEngineCreated=function(t){iz.forEach(function(e){return e.onEngineCreated(t)})},t.notifyEngineDestroy=function(t){iz.forEach(function(e){return e.onEngineDestroy(t)})},t.notifyAssetsLoadStart=function(t,e){return eY(function(){return eK(this,function(i){return[2,Promise.all(iz.map(function(i){return i.onAssetsLoadStart(t,e)}))]})})()},t.notifyAssetsLoadFinish=function(t,e,i){iz.forEach(function(r){return r.onAssetsLoadFinish(t,e,i)})},t}(),iW={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",ffd:"@galacean/effects-plugin-ffd",ktx2:"@galacean/effects-plugin-ktx2",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function ij(t){var e=iW[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var iX=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return eY(function(){return eK(this,function(t){return[2]})})()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreating=function(t,e){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},e.onEngineCreated=function(t){},e.onEngineDestroy=function(t){},t}();function iH(t,e){return(iH=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function iY(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&&iH(t,e)}(n=tW||(tW={}))["1_0"]="1.0",n["1_1"]="1.1",n["1_2"]="1.2",n["1_3"]="1.3",n["1_5"]="1.5",n["1_8"]="1.8",n["2_0"]="2.0",n["2_1"]="2.1",n["2_2"]="2.2",n["2_3"]="2.3",n["2_4"]="2.4",n["3_0"]="3.0",n["3_1"]="3.1",n["3_2"]="3.2",n["3_3"]="3.3",n["3_4"]="3.4",n["3_5"]="3.5",n["3_6"]="3.6",n["3_7"]="3.7",n["3_8"]="3.8",n.LATEST="3.8",(a=tj||(tj={})).S="S",a.APlus="A+",a.A="A",a.BPlus="B+",a.B="B",(o=tX||(tX={}))[o.ALPHA=0]="ALPHA",o[o.ADD=1]="ADD",o[o.MULTIPLY=2]="MULTIPLY",o[o.BRIGHTNESS=3]="BRIGHTNESS",o[o.SUBTRACTION=4]="SUBTRACTION",o[o.STRONG_LIGHT=5]="STRONG_LIGHT",o[o.WEAK_LIGHT=6]="WEAK_LIGHT",o[o.SUPERPOSITION=7]="SUPERPOSITION",(s=tH||(tH={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tY||(tY={}))[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(h=tZ||(tZ={}))[h.NONE=0]="NONE",h[h.SPHERE=1]="SPHERE",h[h.CONE=2]="CONE",h[h.HEMISPHERE=3]="HEMISPHERE",h[h.CIRCLE=4]="CIRCLE",h[h.DONUT=5]="DONUT",h[h.RECTANGLE=6]="RECTANGLE",h[h.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",h[h.EDGE=8]="EDGE",h[h.TEXTURE=9]="TEXTURE",(l=tq||(tq={}))[l.GYROSCOPE=0]="GYROSCOPE",l[l.SPINE=1]="SPINE",(c=tK||(tK={}))[c.CLICK=0]="CLICK",c[c.MESSAGE=1]="MESSAGE",c[c.DRAG=2]="DRAG",(f=tQ||(tQ={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(d=tJ||(tJ={})).base="0",d.sprite="1",d.particle="2",d.null="3",d.interact="4",d.plugin="5",d.camera="6",d.composition="7",d.spine="spine",d.mesh="mesh",d.tree="tree",d.text="text",d.light="light",d.skybox="skybox",d.effect="effect",d.shape="shape",d.postProcessVolume="postProcessVolume",d.node="node",d.video="video",d.audio="audio",d.richtext="richtext",(p=t$||(t$={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=t0||(t0={}))[m.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",m[m.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",m[m.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",m[m.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",m[m.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",m[m.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",m[m.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",m[m.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",m[m.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=t1||(t1={})).Opaque="Opaque",v.Transparent="Transparent",(y=t2||(t2={})).Both="Both",y.Back="Back",y.Front="Front",(g=t3||(t3={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=t4||(t4={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",x[x.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",x[x.COLOR_CURVE=24]="COLOR_CURVE",x[x.VECTOR4_CURVE=25]="VECTOR4_CURVE",x[x.VECTOR2_CURVE=26]="VECTOR2_CURVE",x[x.VECTOR3_CURVE=27]="VECTOR3_CURVE",x[x.REFERENCE_CURVE=28]="REFERENCE_CURVE",(b=t5||(t5={}))[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",(T=t6||(t6={}))[T.destroy=0]="destroy",T[T.restart=5]="restart",T[T.forward=2]="forward",T[T.freeze=4]="freeze",(S=t8||(t8={}))[S.none=0]="none",S[S.removeParticle=1]="removeParticle",(E=t9||(t9={}))[E.RANDOM=0]="RANDOM",E[E.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",E[E.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",E[E.UNIFORM_BURST=3]="UNIFORM_BURST",(C=t7||(t7={})).point="point",C.spot="spot",C.directional="directional",C.ambient="ambient",(w=et||(et={}))[w.box=2]="box",w[w.sphere=3]="sphere",(_=ee||(ee={})).orthographic="orthographic",_.perspective="perspective",(M=ei||(ei={})).unlit="unlit",M.pbr="pbr",M.hair="hair",(A=er||(er={}))[A.opaque=100]="opaque",A[A.masked=101]="masked",A[A.translucent=102]="translucent",A[A.additive=103]="additive",(P=en||(en={})).none="none",P.uv="uv",P.normal="normal",P.basecolor="basecolor",P.alpha="alpha",P.metallic="metallic",P.roughness="roughness",P.ao="ao",P.emissive="emissive",P.diffuse="diffuse",(I=ea||(ea={}))[I.visible=0]="visible",I[I.display=1]="display",I[I.clip=2]="clip",I[I.ellipsis=3]="ellipsis",(R=eo||(eo={}))[R.autoWidth=0]="autoWidth",R[R.autoHeight=1]="autoHeight",R[R.fixed=2]="fixed",(O=es||(es={}))[O.top=0]="top",O[O.middle=1]="middle",O[O.bottom=2]="bottom",(V=eu||(eu={}))[V.left=0]="left",V[V.middle=1]="middle",V[V.right=2]="right",(N=eh||(eh={}))[N.top=0]="top",N[N.middle=1]="middle",N[N.bottom=2]="bottom",(F=el||(el={})).normal="normal",F.bold="bold",F.lighter="lighter",(L=ec||(ec={})).normal="normal",L.italic="italic",L.oblique="oblique";var iZ={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(D=ef||(ef={}))[D.None=0]="None",D[D.Rotate90=1]="Rotate90",(k=ed||(ed={}))[k.Solid=0]="Solid",k[k.GradientLinear=1]="GradientLinear",k[k.GradientRadial=2]="GradientRadial",k[k.GradientAngular=3]="GradientAngular",k[k.Texture=4]="Texture",(B=ep||(ep={}))[B.Fill=0]="Fill",B[B.Fit=1]="Fit",B[B.Crop=2]="Crop",B[B.Tile=3]="Tile",(z=em||(em={}))[z.Custom=0]="Custom",z[z.Rectangle=1]="Rectangle",z[z.Ellipse=2]="Ellipse",z[z.Polygon=3]="Polygon",z[z.Star=4]="Star",(U=ev||(ev={}))[U.Butt=0]="Butt",U[U.Round=1]="Round",U[U.Square=2]="Square",(G=ey||(ey={}))[G.Round=0]="Round",G[G.Bevel=1]="Bevel",G[G.Miter=2]="Miter",(W=eg||(eg={})).AnimationClipNodeData="AnimationClipNodeData",W.BlendNodeData="BlendNodeData",W.ApplyAdditiveNodeData="ApplyAdditiveNodeData",W.LayerBlendNodeData="LayerBlendNodeData",W.StateMachineNodeData="StateMachineNodeData",W.TransitionNodeData="TransitionNodeData",W.StateNodeData="StateNodeData",W.ConstFloatNodeData="ConstFloatNodeData",W.ConstBoolNodeData="ConstBoolNodeData",W.ControlParameterBoolNodeData="ControlParameterBoolNodeData",W.ControlParameterFloatNodeData="ControlParameterFloatNodeData",W.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",W.NotNodeData="NotNodeData",W.AndNodeData="AndNodeData",W.OrNodeData="OrNodeData",W.EqualNodeData="EqualNodeData",W.GreaterNodeData="GreaterNodeData",W.LessNodeData="LessNodeData",(j=ex||(ex={})).video="video",j.image="image",(X=eb||(eb={})).video="video",X.audio="audio",(H=eT||(eT={})).L30="hev1.1.0.L30.B0",H.L60="hev1.1.0.L60.B0",H.L63="hev1.1.0.L63.B0",H.L90="hev1.1.0.L90.B0",H.L93="hev1.1.0.L93.B0",H.L120="hev1.1.0.L120.B0",H.L150="hev1.1.0.L150.B0",H.L180="hev1.1.0.L180.B0",(Y=eS||(eS={})).VFXItemData="VFXItemData",Y.Material="Material",Y.Shader="Shader",Y.Geometry="Geometry",Y.Texture="Texture",Y.Image="Image",Y.AnimationClip="AnimationClip",Y.BinaryAsset="BinaryAsset",Y.Sprite="Sprite",Y.TrackAsset="TrackAsset",Y.TimelineAsset="TimelineAsset",Y.ObjectBindingTrack="ObjectBindingTrack",Y.TransformTrack="TransformTrack",Y.SpriteColorTrack="SpriteColorTrack",Y.ActivationTrack="ActivationTrack",Y.SubCompositionTrack="SubCompositionTrack",Y.FloatPropertyTrack="FloatPropertyTrack",Y.ColorPropertyTrack="ColorPropertyTrack",Y.Vector2PropertyTrack="Vector2PropertyTrack",Y.Vector3PropertyTrack="Vector3PropertyTrack",Y.Vector4PropertyTrack="Vector4PropertyTrack",Y.SpritePropertyTrack="SpritePropertyTrack",Y.TransformPlayableAsset="TransformPlayableAsset",Y.SpriteColorPlayableAsset="SpriteColorPlayableAsset",Y.ActivationPlayableAsset="ActivationPlayableAsset",Y.SubCompositionPlayableAsset="SubCompositionPlayableAsset",Y.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",Y.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",Y.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",Y.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",Y.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",Y.SpritePropertyPlayableAsset="SpritePropertyPlayableAsset",Y.MeshComponent="MeshComponent",Y.SkyboxComponent="SkyboxComponent",Y.LightComponent="LightComponent",Y.CameraComponent="CameraComponent",Y.ModelPluginComponent="ModelPluginComponent",Y.TreeComponent="TreeComponent",Y.AnimationComponent="AnimationComponent",Y.SpineComponent="SpineComponent",Y.VideoComponent="VideoComponent",Y.AudioComponent="AudioComponent",Y.RichTextComponent="RichTextComponent",Y.OrientationComponent="OrientationComponent",Y.ShapeComponent="ShapeComponent",Y.SpriteComponent="SpriteComponent",Y.ParticleSystem="ParticleSystem",Y.InteractComponent="InteractComponent",Y.CameraController="CameraController",Y.PostProcessVolume="PostProcessVolume",Y.EffectComponent="EffectComponent",Y.TextComponent="TextComponent",Y.AnimationGraphAsset="AnimationGraphAsset",Y.CompositionComponent="CompositionComponent",Y.FFDComponent="FFDComponent",Y.FrameComponent="FrameComponent",Y.Animator="Animator",Y.DomContentComponent="DomContentComponent",Y.UIControl="UIControl",Y.Control="Control",Y.Container="Container",Y.HBoxContainer="HBoxContainer",Y.VBoxContainer="VBoxContainer",Y.GridContainer="GridContainer",Y.PanelContainer="PanelContainer",Y.MarginContainer="MarginContainer",Y.CenterContainer="CenterContainer",Y.AspectRatioContainer="AspectRatioContainer",Y.ScrollContainer="ScrollContainer",Y.HScrollBar="HScrollBar",Y.VScrollBar="VScrollBar",Y.HSeparator="HSeparator",Y.VSeparator="VSeparator",Y.Label="Label",Y.LineEdit="LineEdit",Y.TextEdit="TextEdit",Y.PopupPanel="PopupPanel",Y.PopupMenu="PopupMenu",Y.MenuButton="MenuButton",Y.OptionButton="OptionButton",Y.ColorPicker="ColorPicker",Y.ColorPickerButton="ColorPickerButton",Y.TextureRect="TextureRect",Y.NinePatchRect="NinePatchRect",Y.ColorRect="ColorRect",Y.Panel="Panel",Y.ProgressBar="ProgressBar",Y.Button="Button",Y.Checkbox="Checkbox",Y.CheckButton="CheckButton",Y.HSlider="HSlider",Y.VSlider="VSlider",Y.TimelineClip="TimelineClip",(Z=eE||(eE={}))[Z.POINTS=0]="POINTS",Z[Z.LINES=1]="LINES",Z[Z.LINE_LOOP=2]="LINE_LOOP",Z[Z.LINE_STRIP=3]="LINE_STRIP",Z[Z.TRIANGLES=4]="TRIANGLES",Z[Z.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",Z[Z.TRIANGLE_FAN=6]="TRIANGLE_FAN",(q=eC||(eC={}))[q.Float16=0]="Float16",q[q.Float32=1]="Float32",q[q.Int8=2]="Int8",q[q.Int16=3]="Int16",q[q.Int32=4]="Int32",q[q.UInt8=5]="UInt8",q[q.UInt16=6]="UInt16",q[q.UInt32=7]="UInt32",(K=ew||(ew={}))[K.None=-1]="None",K[K.UInt8=0]="UInt8",K[K.UInt16=1]="UInt16",K[K.UInt32=2]="UInt32",(Q=e_||(e_={})).Position="POSITION",Q.Uv="TEXCOORD0",Q.Uv2="TEXCOORD1",Q.Normal="NORMAL",Q.Tangent="TANGENT",Q.Color="COLOR",Q.Joints="JOINTS",Q.Weights="WEIGHTS",Q.PositionBS0="POSITION_BS0",Q.PositionBS1="POSITION_BS1",Q.PositionBS2="POSITION_BS2",Q.PositionBS3="POSITION_BS3",Q.PositionBS4="POSITION_BS4",Q.PositionBS5="POSITION_BS5",Q.PositionBS6="POSITION_BS6",Q.PositionBS7="POSITION_BS7",Q.NormalBS0="NORMAL_BS0",Q.NormalBS1="NORMAL_BS1",Q.NormalBS2="NORMAL_BS2",Q.NormalBS3="NORMAL_BS3",Q.TangentBS0="TANGENT_BS0",Q.TangentBS1="TANGENT_BS1",Q.TangentBS2="TANGENT_BS2",Q.TangentBS3="TANGENT_BS3";var iq=Object.freeze({__proto__:null,LATEST_VERSION:tW.LATEST,get RenderLevel(){return tj},get BlendingMode(){return tX},get SideMode(){return tH},get ObscuredMode(){return tY},get ParticleEmitterShapeType(){return tZ},get PluginType(){return tq},get InteractType(){return tK},get InteractBehavior(){return tQ},get ItemType(){return tJ},get RenderMode(){return t$},get ParticleOrigin(){return t0},get RenderType(){return t1},get RenderFace(){return t2},get CameraClipMode(){return t3},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 t4},get BezierKeyframeType(){return t5},get JSONSceneVersion(){return tW},get EndBehavior(){return t6},get ParticleInteractionBehavior(){return t8},get ShapeArcMode(){return t9},get LightType(){return t7},get ModelBoundingType(){return et},get CameraType(){return ee},get MaterialType(){return ei},get MaterialBlending(){return er},get RenderMode3D(){return en},get TextOverflow(){return ea},get TextSizeMode(){return eo},get TextBaseline(){return es},get TextAlignment(){return eu},get TextVerticalAlign(){return eh},get TextWeight(){return el},get FontStyle(){return ec},BuiltinObjectGUID:iZ,get SpriteRotation(){return ef},get FillType(){return ed},get TexturePaintScaleMode(){return ep},get ShapePrimitiveType(){return em},get LineCap(){return ev},get LineJoin(){return ey},get NodeDataType(){return eg},get BackgroundType(){return ex},get MultimediaType(){return eb},get HevcVideoCodec(){return eT},get DataType(){return eS},get GeometryType(){return eE},get VertexFormatType(){return eC},get IndexFormatType(){return ew},get VertexBufferSemantic(){return e_}});function iK(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function iQ(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return iK(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return iK(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var iJ=new Map,i$=new Map,i0={};function i1(t){return function(e,i){i0[t]&&console.warn("Class "+t+" is already registered."),i0[t]=e}}function i2(t){var e=t.constructor;if(i$.get(e))return i$.get(e);var i={};i$.set(e,i);for(var r=t,n=e;n;){var a=iJ.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function i3(t,e){return function(i,r){var n,a=(n=i.constructor,iJ.get(n)||iJ.set(n,{}),iJ.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var i4=function(){function t(t){this.engine=t,this.guid=iL(),this.definition={},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){void 0!==t.id&&this.setInstanceId(t.id)},e.dispose=function(){this.engine.removeInstance(this.guid)},t.is=function(e){return eZ(e,t)&&"guid"in e},t}(),i5=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),i6={};function i8(t){return function(e,i){i6[t]&&console.warn("NodeData Class "+t+" is already registered."),i6[t]=e}}var i9=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw Error("Node still initialized!");this.lastUpdateID=-1},t}(),i7=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i.asset=this,i},t}(),rt=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.previousTime=0,e.currentTime=0,e}iY(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(i9),re=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.setValue=function(t){},e}(i9),ri=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(re),rr=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(re);t.AnimationGraphAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.nodeDatas=[],e.graphDataSet=new i5,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=-1,e}return iY(e,t),e.prototype.fromData=function(t){var i=t.nodeDatas;this.rootNodeIndex=t.rootNodeIndex,this.controlParameterIDs=t.controlParameterIDs;for(var r=t.controlParameterIDs.length,n=0;n<r;n++)this.parameterLookupMap.set(t.controlParameterIDs[n],n);this.nodeDatas=[];for(var a=0;a<i.length;a++)this.nodeDatas[a]=e.createNodeData(i[a].type),this.nodeDatas[a].load(i[a]);this.graphDataSet=new i5,this.graphDataSet.resources=[];for(var o,s=iQ(t.graphDataSet.resources);!(o=s()).done;){var u=o.value,h=this.engine.findObject(u);this.graphDataSet.resources.push(h)}},e.createNodeData=function(t){var e=i6[t];if(e)return new e;throw Error("Unknown node type: "+t+".")},e}(i4),t.AnimationGraphAsset=eq([i1("AnimationGraphAsset")],t.AnimationGraphAsset),(J=eM||(eM={}))[J.Active=0]="Active",J[J.Inactive=1]="Inactive";var rn=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),ra=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t]):null},t}();function ro(){return(ro=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}t.AnimationClipNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rs,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=ro({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(i7),t.AnimationClipNodeData=eq([i8(eg.AnimationClipNodeData)],t.AnimationClipNodeData);var rs=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.animation=null,e.animatable=null,e}iY(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=e9(this.currentTime,0,1),this.sampleEvents(t);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.sampleEvents=function(t){if(this.animatable&&0!==this.animatable.events.length)for(var e,i=this.previousTime*this.duration,r=this.currentTime*this.duration,n=iQ(this.animatable.events);!(e=n()).done;){var a=e.value,o=a.data.startTime;(this.previousTime<=this.currentTime?i<o&&o<=r:o>i||o<=r)&&(a.currentTime=r,a.deltaTime=t.deltaTime,t.activeEvents.push(a))}},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new ru(e.skeleton,this.animation))},e}(rt);($=eA||(eA={}))[$.Position=0]="Position",$[$.Scale=1]="Scale",$[$.Rotation=2]="Rotation",$[$.Euler=3]="Euler";var ru=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=iQ(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,o=iQ(e.scaleCurves);!(a=o()).done;){var s=a.value;this.addTransformCurveInfo(s,1)}for(var u,h=iQ(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=iQ(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=iQ(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=iQ(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}for(var b,T=iQ(this.animationClip.events);!(b=T()).done;){var S=b.value;this.events.push({data:S,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=e9(t,0,this.animationClip.duration),n=iQ(this.transformCurveInfos);!(i=n()).done;){var a=i.value,o=a.curve.keyFrames.getValue(r),s=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:s.position.copyFrom(o);break;case 1:s.scale.copyFrom(o);break;case 2:s.rotation.copyFrom(o);break;case 3:s.euler.copyFrom(o)}}for(var u,h=iQ(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=iQ(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),rh=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],o=e[5],s=e[9],u=e[2],h=e[6],l=e[10],c=i+o+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>l){var d=2*Math.sqrt(1+i-o-l);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>l){var p=2*Math.sqrt(1+o-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(e9(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=e.x,s=e.y,u=e.z,h=e.w;return this.x=i*h+a*o+r*u-n*s,this.y=r*h+a*s+n*o-i*u,this.z=n*h+a*u+i*s-r*o,this.w=a*h-i*o-r*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(s),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,f=Math.sin(e*l)/h;return this.w=a*c+this.w*f,this.x=i*c+this.x*f,this.y=r*c+this.y*f,this.z=n*c+this.z*f,this},e.slerpQuaternions=function(t,e,i){return this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,a=this.w,o=t.x,s=t.y,u=t.z,h=a*o+r*u-n*s,l=a*s+n*o-i*u,c=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=h*a+-(f*i)+-(l*n)- -(c*r),d.y=l*a+-(f*r)+-(c*i)- -(h*n),d.z=c*a+-(f*n)+-(h*r)- -(l*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(it.ZERO,this,it.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();rh.tempVec0=new it;var rl=new rh,rc=function(){},rf=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(rc),rd=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=rl.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(rc),rp=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var o=t.parentSpaceTransforms[a],s=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=o.position,l=s.position,c=u.position;n.blendVector3(h,l,i,c);var f=o.rotation,d=s.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=o.scale,v=s.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=o.euler,x=s.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var S=t.floatPropertyValues[T],E=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(S,E,i)}for(var C=0;C<t.colorPropertyValues.length;C++){var w=t.colorPropertyValues[C],_=e.colorPropertyValues[C],M=r.colorPropertyValues[C];n.blendColor(w,_,i,M)}},t}();rp.normalBlendFunction=new rf,rp.additiveBlendFunction=new rd;var rm=function(){function t(t){this.position=new it,this.rotation=new rh,this.scale=new it,this.euler=new it,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),rv=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=iQ(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push(new rm().copyFrom(r))}for(var n,a=iQ(t.defaultFloatPropertyValues);!(n=a()).done;){var o=n.value;this.floatPropertyValues.push(o)}for(var s,u=iQ(t.defaultColorPropertyValues);!(s=u()).done;){var h=s.value;this.colorPropertyValues.push(new ii().copyFrom(h))}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),ry=function(t){this.pose=new rv(t)};t.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rg,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(i7),t.ApplyAdditiveNodeData=eq([i8(eg.ApplyAdditiveNodeData)],t.ApplyAdditiveNodeData);var rg=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new ry(e.skeleton),this.additiveNodeResult=new ry(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){rp.additiveBlend(t,e,i,r)},e}(rt);t.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rx,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(i7),t.BlendNodeData=eq([i8(eg.BlendNodeData)],t.BlendNodeData);var rx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.source0=null,e.source1=null,e.inputParameterValueNode=null,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new ry(e.skeleton),this.source1Result=new ry(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){rp.localBlend(t,e,i,r)},e}(rt);t.AndNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(rb,t),r=iQ(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(i7),t.AndNodeData=eq([i8(eg.AndNodeData)],t.AndNodeData);var rb=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=iQ(this.conditionNodes);!(e=i()).done;)if(!e.value.getValue(t)){this.result=!1;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(rr);t.OrNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(rT,t),r=iQ(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(i7),t.OrNodeData=eq([i8(eg.OrNodeData)],t.OrNodeData);var rT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=iQ(this.conditionNodes);!(e=i()).done;)if(e.value.getValue(t)){this.result=!0;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=iQ(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(rr);t.NotNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rS,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(i7),t.NotNodeData=eq([i8(eg.NotNodeData)],t.NotNodeData);var rS=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.result=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(rr);t.ConstFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rE,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ConstFloatNodeData=eq([i8(eg.ConstFloatNodeData)],t.ConstFloatNodeData);var rE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}return iY(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(ri);t.ConstBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rC,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ConstBoolNodeData=eq([i8(eg.ConstBoolNodeData)],t.ConstBoolNodeData);var rC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}return iY(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(rr);t.ControlParameterFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rw,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ControlParameterFloatNodeData=eq([i8(eg.ControlParameterFloatNodeData)],t.ControlParameterFloatNodeData);var rw=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(ri);t.ControlParameterBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(r_,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(i7),t.ControlParameterBoolNodeData=eq([i8(eg.ControlParameterBoolNodeData)],t.ControlParameterBoolNodeData);var r_=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(rr);t.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rM,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(i7),t.ControlParameterTriggerNodeData=eq([i8(eg.ControlParameterTriggerNodeData)],t.ControlParameterTriggerNodeData);var rM=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}iY(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(rr);t.LayerBlendNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNodeIndex=-1,e.layerDatas=[],e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rA,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=iQ(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:-1,e.layerDatas)for(var i,r,n=iQ(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(ro({inputNodeIndex:-1,weightValueNodeIndex:-1},a))}},e}(i7),t.LayerBlendNodeData=eq([i8(eg.LayerBlendNodeData)],t.LayerBlendNodeData);var rA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseLayerNode=null,e.layers=[],e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new ry(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var i,r,n=iQ(this.layers);!(r=n()).done;){var a,o,s=r.value;null==(a=s.inputNode)||a.initialize(e),null==(o=s.weightValueNode)||o.initialize(e)}},i.shutdownInternal=function(e){null==(i=this.baseLayerNode)||i.shutdown(e);for(var i,r,n=iQ(this.layers);!(r=n()).done;){var a,o,s=r.value;null==(a=s.inputNode)||a.shutdown(e),null==(o=s.weightValueNode)||o.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()&&(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e)),e},i.updateLayers=function(t,e){for(var i,r=iQ(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var a=n.weightValueNode.getValue(t);rp.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(rt);t.EqualNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rP,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(i7),t.EqualNodeData=eq([i8(eg.EqualNodeData)],t.EqualNodeData);var rP=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(rr),rI=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}return iY(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(i7);(tt=eP||(eP={}))[tt.GreaterThan=0]="GreaterThan",tt[tt.LessThan=1]="LessThan";var rR=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}iY(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(rr);t.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rR,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rI),t.GreaterNodeData=eq([i8(eg.GreaterNodeData)],t.GreaterNodeData),t.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rR,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rI),t.LessNodeData=eq([i8(eg.LessNodeData)],t.LessNodeData),t.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(rO,t),r=iQ(this.stateDatas);!(e=r()).done;){var n=e.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(a);for(var o,s=iQ(n.transitionDatas);!(o=s()).done;){var u=o.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(i7),t.StateMachineNodeData=eq([i8(eg.StateMachineNodeData)],t.StateMachineNodeData);var rO=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.states=[],e.activeTransition=null,e.activeStateIndex=-1,e}iY(e,t);var i=e.prototype;return i.getCurrentStateName=function(){return this.states[this.activeStateIndex].stateNode.getNodeData().stateName},i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===eM.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=-1,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(-1===o.targetStateIndex)throw Error("Invalid target state index.");if(!this.states[o.targetStateIndex].stateNode.isTransitioning()){var s=!1;if(o.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>o.transitionNode.exitTime&&(s=!0)}else null!==o.conditionNode&&o.conditionNode.getValue(t)&&(s=!0);if(s){r=a;break}}}if(-1!==r){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.getNodeData().defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=-1,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=iQ(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=iQ(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(rt);t.TransitionState=void 0,(te=t.TransitionState||(t.TransitionState={}))[te.None=0]="None",te[te.TransitioningIn=1]="TransitioningIn",te[te.TransitioningOut=2]="TransitioningOut",t.StateNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rV,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex,this.stateName=e.stateName},e}(i7),t.StateNodeData=eq([i8(eg.StateNodeData)],t.StateNodeData);var rV=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}iY(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(rt);t.SourceType=void 0,(ti=t.SourceType||(t.SourceType={}))[ti.State=0]="State",ti[ti.Transition=1]="Transition",ti[ti.CachedPose=2]="CachedPose",t.TransitionNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=-1,e}iY(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rN,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(i7),t.TransitionNodeData=eq([i8(eg.TransitionNodeData)],t.TransitionNodeData);var rN=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.hasExitTime=!1,t.exitTime=.75,t.transitionLength=0,t.transitionProgress=0,t.blendWeight=0,t.sourceNode=null,t.sourceType=0,t.blendedDuration=0,t}iY(i,e);var r=i.prototype;return r.evaluate=function(t,e){iS(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=e9(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=eM.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult);if(this.registerPoseTasksAndUpdateRootMotion(i,n,e),this.blendedDuration=e8(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var a=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+a)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),e},r.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},r.getProgressPercentage=function(){return this.transitionProgress},r.getSourceType=function(){return this.sourceType},r.isSourceATransition=function(){return 1===this.sourceType},r.isSourceAState=function(){return 0===this.sourceType},r.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.getSourceStateNode=function(){return this.sourceNode},r.getSourceTransitionNode=function(){return this.sourceNode},r.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},r.initializeInternal=function(t){e.prototype.initializeInternal.call(this,t),this.sourceNodeResult=new ry(t.skeleton),this.targetNodeResult=new ry(t.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},r.shutdownInternal=function(i){this.targetNode.setTransitioningState(t.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(i),this.sourceNode.shutdown(i),this.sourceNode=null),e.prototype.shutdownInternal.call(this,i)},r.endSourceTransition=function(e){var i,r=this.getSourceTransitionNode().targetNode;null==(i=this.sourceNode)||i.shutdown(e),this.sourceNode=r,this.sourceType=0,this.getSourceStateNode().setTransitioningState(t.TransitionState.TransitioningOut)},r.initializeTargetStateAndUpdateTransition=function(t,e,i){this.markNodeActive(t);var r=this.targetNodeResult;return 0===this.sourceType&&this.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),r=this.targetNode.evaluate(t,r),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,r,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=e8(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},r.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=e9(this.blendWeight,0,1))},r.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;rp.localBlend(t.pose,e.pose,r,i.pose)},i}(rt);(tr=eI||(eI={}))[tr.Float=0]="Float",tr[tr.Color=1]="Color";var rF=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=iQ(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,o=iQ(e.rotation);!(a=o()).done;){var s=a.value;this.addReferenceTransform(s)}for(var u,h=iQ(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=iQ(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new rm(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n,a=t+e+i;if(void 0===this.pathToObjectIndex.get(a)){var o=this.findTarget(t);if(o){(n="VFXItem"===e?o:o.getComponent(i0[e]))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=n,l=0;l<s.length-1;l++){var c=h[s[l]];void 0===c&&console.error("The "+s[l]+" property of "+h+" was not found."),h=c}var f={target:n,propertyPath:i,directTarget:h,propertyName:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(new ii().copyFrom(h[u])),this.pathToObjectIndex.set(a,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=iQ(i);!(e=n()).done;){var a=e.value,o=r.find(a);if(!o)return null;r=o}return r},t}(),rL=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new rn;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=iQ(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var o,s=iQ(a.positionCurves);!(o=s()).done;){var u=o.value;r.position.push(u.path)}for(var h,l=iQ(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=iQ(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=iQ(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=iQ(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,S=iQ(a.colorCurves);!(T=S()).done;){var E=T.value;r.colors.push(E)}}}this.skeleton=new rF(e,r),this.result=new ry(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var C=new ra;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var w=0;w<t.nodeDatas.length;w++)C.nodes[w]||t.nodeDatas[w].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.activeEvents.length=0,this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];eZ(i,rM)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.getStateMachineNode=function(t){for(var e,i=null,r=iQ(this.nodes);!(e=r()).done;){var n=e.value;eZ(n,rO)&&n.getNodeData().machineName===t&&(i=n)}return i},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),-1)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);-1!==i&&this.nodes[i].setValue(e)},t}();function rD(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rk(t,e,i){return e&&rD(t.prototype,e),i&&rD(t,i),t}var rB=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}iY(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onPreRender=function(){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.onParentChanged=function(){},i.onOrderInParentChanged=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&e2(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},rk(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this.enabled!==t){var e;this._enabled=t,(null==(e=this.item)?void 0:e.isDuringPlay)&&this.item.isActive&&(t?this.isEnableCalled||(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}}]),e}(i4);eq([i3(void 0,void 0)],rB.prototype,"item",void 0),eq([i3(void 0,void 0)],rB.prototype,"_enabled",void 0);var rz=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(rB);t.Animator=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.graphInstance=null,e.graphAsset=null,e}iY(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graphInstance&&this.graphInstance.setBool(t,e)},i.setFloat=function(t,e){this.graphInstance&&this.graphInstance.setFloat(t,e)},i.setTrigger=function(t){this.graphInstance&&this.graphInstance.setTrigger(t)},i.resetTrigger=function(t){this.graphInstance&&this.graphInstance.resetTrigger(t)},i.getStateMachineNode=function(t){var e=null;return this.graphInstance&&(e=this.graphInstance.getStateMachineNode(t)),e},i.onStart=function(){this.graphAsset&&(this.graphInstance=new rL(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graphInstance){for(var e=this.graphInstance.evaluateGraph(t/1e3),i=this.graphInstance.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,o=e.pose.parentSpaceTransforms[r].scale,s=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(o.x,o.y,o.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(s.x,s.y,s.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graphInstance.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.propertyName;l.directTarget[c]=e.pose.floatPropertyValues[h],eZ(l.target,rB)&&l.target.onApplyAnimationProperties()}for(var f=this.graphInstance.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.propertyName;p.directTarget[m]=e.pose.colorPropertyValues[d],eZ(p.target,rB)&&p.target.onApplyAnimationProperties()}for(var v,y=iQ(this.graphInstance.activeEvents);!(v=y()).done;){var g=v.value;g.data.event.onEvent(this.item,g)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(rB),t.Animator=eq([i1("Animator")],t.Animator),t.ShaderType=void 0,(tn=t.ShaderType||(t.ShaderType={}))[tn.vertex=0]="vertex",tn[tn.fragment=1]="fragment",t.MaskMode=void 0,(ta=t.MaskMode||(t.MaskMode={}))[ta.NONE=0]="NONE",ta[ta.MASK=1]="MASK",ta[ta.OBSCURED=2]="OBSCURED",ta[ta.REVERSE_OBSCURED=3]="REVERSE_OBSCURED";var rU=[],rG={},rW="WebGL Constants not in global, please check your environment";function rj(){"function"==typeof WebGL2RenderingContext?rX(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(rX(WebGLRenderingContext),rX(WebGLRenderingContext.prototype)):il?rU.push(ic()?"iOS16 lockdown mode, WebGL Constants not in global":rW):rU.push(rW),rU.length||"HALF_FLOAT"in rG||(rG.HALF_FLOAT=5131)}function rX(t){for(var e in t)/^[A-Z_]/.test(e)&&(rG[e]=t[e])}function rH(t){switch(t){case tX.ALPHA:case tX.ADD:case tX.SUBTRACTION:case tX.STRONG_LIGHT:case tX.WEAK_LIGHT:return 1;case tX.SUPERPOSITION:return 2;case tX.BRIGHTNESS:return 3;case tX.MULTIPLY:return 0;default:return 1}}function rY(t,e){switch(e){case void 0:case tX.ALPHA:t.blendFunction=[rG.ONE,rG.ONE_MINUS_SRC_ALPHA,rG.ONE,rG.ONE_MINUS_SRC_ALPHA];break;case tX.ADD:t.blendFunction=[rG.ONE,rG.ONE,rG.ONE,rG.ONE];break;case tX.SUBTRACTION:t.blendFunction=[rG.ONE,rG.ONE,rG.ZERO,rG.ONE],t.blendEquation=[rG.FUNC_REVERSE_SUBTRACT,rG.FUNC_REVERSE_SUBTRACT];break;case tX.SUPERPOSITION:t.blendFunction=[rG.ONE,rG.ONE,rG.ONE,rG.ONE];break;case tX.MULTIPLY:t.blendFunction=[rG.DST_COLOR,rG.ONE_MINUS_SRC_ALPHA,rG.DST_COLOR,rG.ONE_MINUS_SRC_ALPHA];break;case tX.BRIGHTNESS:t.blendFunction=[rG.ONE,rG.ONE_MINUS_SRC_ALPHA,rG.ONE,rG.ONE_MINUS_SRC_ALPHA];break;case tX.STRONG_LIGHT:t.blendFunction=[rG.DST_COLOR,rG.DST_ALPHA,rG.ZERO,rG.ONE];break;case tX.WEAK_LIGHT:t.blendFunction=[rG.DST_COLOR,rG.ZERO,rG.ZERO,rG.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function rZ(t,e){e===tH.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rG.CW,t.cullFace=e===tH.BACK?rG.BACK:rG.FRONT)}rU.length||rj(),t.TextureLoadAction=void 0,(to=t.TextureLoadAction||(t.TextureLoadAction={}))[to.whatever=0]="whatever",to[to.clear=2]="clear",t.TextureSourceType=void 0,(ts=t.TextureSourceType||(t.TextureSourceType={}))[ts.none=0]="none",ts[ts.data=1]="data",ts[ts.image=2]="image",ts[ts.compressed=3]="compressed",ts[ts.video=4]="video",ts[ts.canvas=5]="canvas",ts[ts.framebuffer=6]="framebuffer",ts[ts.mipmaps=7]="mipmaps";var rq=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.downloadText=function(t,e,i){this.download(t,"text",e,i)},e.download=function(e,i,r,n){var a=this;if(void 0===i&&(i="json"),!this.start(e,r,n)){var o=new XMLHttpRequest,s=function(){a.finish(e,o.status,o.response)};o.responseType=i,o.addEventListener("load",function(){200==o.status||0==o.status&&t.trustXHRStatusZero?a.finish(e,200,o.response):s()}),o.addEventListener("error",s),o.open("GET",e,!0),o.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var a=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],o=a.length-1,s=n.length;o<s;o+=2)n[o].apply(null,a)},t}();rq.trustXHRStatusZero=!1;var rK=!1,rQ=!1;function rJ(t,e){return r$.apply(this,arguments)}function r$(){return(r$=eY(function(t,e){return eK(this,function(i){switch(i.label){case 0:if(!(rK||!e))return[3,2];return[4,r2(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,r2(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rK=!0,[4,r2(t)];case 6:return[2]}})})).apply(this,arguments)}function r0(t,e){return r1.apply(this,arguments)}function r1(){return(r1=eY(function(t,e){return eK(this,function(i){switch(i.label){case 0:if(!(rQ||!e))return[3,2];return[4,r2(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,r2(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rQ=!0,[4,r2(t)];case 6:return[2]}})})).apply(this,arguments)}function r2(t){return r3.apply(this,arguments)}function r3(){return(r3=eY(function(t){var e,i;return eK(this,function(r){if(e="",eZ(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else eZ(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function r4(t){return r5.apply(this,arguments)}function r5(){return(r5=eY(function(t){return eK(this,function(e){return[2,new Promise(function(e,i){new rq().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function r6(){return(r6=eY(function(t){return eK(this,function(e){return[2,new Promise(function(e,i){new rq().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function r8(t){return r9.apply(this,arguments)}function r9(){return(r9=eY(function(t){var e;return eK(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,e.autoplay=!1,id()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=!1,n=function(){r||(r=!0,o(),t(e))},a=function(){r||(r=!0,o(),i("Load video fail."))},o=function(){e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",n),e.removeEventListener("error",a)};e.addEventListener("loadeddata",n),e.addEventListener("canplay",n),e.addEventListener("error",a),e.play().catch(function(t){console.warn("Autoplay blocked:",t)})})]})})).apply(this,arguments)}function r7(t,e){return nt.apply(this,arguments)}function nt(){return(nt=eY(function(t,e){return eK(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function ne(t,e,i){return ni.apply(this,arguments)}function ni(){return(ni=eY(function(e,i,r,n){var a,o,s,u,h,l,c;return eK(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:nr(t,i)}))}))];case 1:return s=f.sent(),[2,ro({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,h=e.target,[4,Promise.all(u.map(function(t){return nr(t,i)}))];case 3:return l=f.sent(),c=n[u[0][1][0]].url,[2,ro({keepImageSource:!1},e,{mipmaps:l,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:h,bin:c,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function nr(t,e){return nn.apply(this,arguments)}function nn(){return(nn=eY(function(t,e){var i,r,n,a,o;return eK(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,r2(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var na=1,no=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+na++,i}iY(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?rG.TEXTURE_2D:i,n=e.format,a=void 0===n?rG.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),ro({minFilter:rG.NEAREST,magFilter:rG.NEAREST,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,target:r,format:rG.RGBA,internalFormat:a,type:rG.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return eY(function(){var a,o;return eK(this,function(s){switch(s.label){case 0:return[4,r2(e)];case 1:return a=s.sent(),(o=i.create(r,ro({sourceType:t.TextureSourceType.image,image:a,target:rG.TEXTURE_2D,id:iL(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return eY(function(){var a,o;return eK(this,function(s){switch(s.label){case 0:return[4,r8(e)];case 1:return a=s.sent(),(o=i.create(r,ro({sourceType:t.TextureSourceType.video,video:a,id:iL(),flipY:!0},n))).initialize(),[2,o]}})})()},rk(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(i4);function ns(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?rG.RGBA:3===o?rG.RGB:2===o?rG.LUMINANCE_ALPHA:rG.LUMINANCE,no.createWithData(t,{data:e,width:i,height:r},{type:rG.HALF_FLOAT,format:n,internalFormat:a,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE})}var nu={type:rG.UNSIGNED_BYTE,format:rG.RGBA,internalFormat:rG.RGBA,wrapS:rG.MIRRORED_REPEAT,wrapT:rG.MIRRORED_REPEAT,minFilter:rG.NEAREST,magFilter:rG.NEAREST};function nh(e){return no.create(e,ro({id:iZ.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},nu))}function nl(e){return no.create(e,ro({id:iZ.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},nu))}var nc=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){if(this.loaders.has(t)){console.warn('TextureLoader for type "'+t+'" is already registered, skipping.');return}this.loaders.set(t,e)},e.unregister=function(t){var e=this.instances.get(t);e&&(e.dispose(),this.instances.delete(t)),this.loaders.delete(t)},e.getLoader=function(t){if(this.instances.has(t))return this.instances.get(t);var e=this.loaders.get(t);if(!e)return console.error('TextureLoader for type "'+t+'" is not registered.'),null;var i=e();return this.instances.set(t,i),i},e.has=function(t){return this.loaders.has(t)},e.getRegisteredTypes=function(){return Array.from(this.loaders.keys())},e.dispose=function(){this.instances.forEach(function(t){return t.dispose()}),this.instances.clear(),this.loaders.clear()},t}()),nf=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return eY(function(){var i,r;return eK(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},i.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,a=e.url;return r===rG.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:iA(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,l=e.urls;return o?s.length>0:u===rG.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return iA(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,S,E,C,w;return eK(this,function(_){switch(_.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,h=e.mipmaps,l=e.urls,c=e.maps,!(a===rG.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=_.sent(),[2,ro({},i,{cube:f,target:rG.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:ro({},o),target:rG.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,r2(s)];case 3:return d=_.sent(),[2,ro({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:rG.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,r8(s)];case 5:return p=_.sent(),[2,ro({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,14];return[4,r4(s)];case 7:if(m=_.sent(),!(v=nc.getLoader("ktx2")))return[3,12];_.label=8;case 8:return _.trys.push([8,10,,11]),[4,v.loadFromBuffer(m)];case 9:if((y=_.sent()).sourceType===t.TextureSourceType.compressed)return[2,ro({sourceType:y.sourceType,type:y.type,target:y.target,internalFormat:y.internalFormat,format:y.format,mipmaps:y.mipmaps,minFilter:rG.LINEAR,magFilter:rG.LINEAR,sourceFrom:e},i)];return[3,11];case 10:throw g=_.sent(),Error("Failed to parse KTX2 from "+(null!=(x=null==e?void 0:e.url)?x:"buffer")+": "+(g.message||g));case 11:return[3,13];case 12:throw Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:if(n!==t.TextureSourceType.mipmaps)return[3,23];if(!u)return[3,19];return[4,r4(u)];case 15:if(b=_.sent(),S=(T=null!=a?a:rG.TEXTURE_2D)===rG.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),a!==rG.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(h.map(function(t){return r.loadMipmapImages(t,b)}))];case 16:return E=_.sent(),[3,18];case 17:E=r.loadMipmapImages(h,b),_.label=18;case 18:return[2,ro({},i,{mipmaps:E,target:T,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:S,target:T,type:t.TextureSourceType.mipmaps}})];case 19:if(!(a===rG.TEXTURE_2D||!a))return[3,21];return[4,Promise.all(l.map(function(t){return r2(t)}))];case 20:return C=_.sent(),[2,ro({},i,{mipmaps:C,target:rG.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:l.slice(),target:rG.TEXTURE_2D}})];case 21:if(a!==rG.TEXTURE_CUBE_MAP)return[3,23];return[4,Promise.all(c.map(function(t){return r.loadCubeMap(t)}))];case 22:return w=_.sent(),[2,ro({},i,{mipmaps:w,target:rG.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:c.map(function(t){return ro({},t)}),target:rG.TEXTURE_CUBE_MAP}})];case 23:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return eY(function(){return eK(this,function(i){return[2,Promise.all(t.map(function(t){return r2(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return eY(function(){return eK(this,function(e){return[2,Promise.all(t.map(function(t){return r2(t)}))]})})()},e}(),nd=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function np(t){return"object"==typeof t&&t&&void 0===t.length&&eZ(t,no)}var nm=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),o=1-n,s=r.x,u=r.y,h=r.z,l=o*s,c=o*u;return this.set(l*s+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*s,0,l*h+a*u,c*h-a*s,o*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(it.ZERO,t,it.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),0===o.lengthSquared()&&(o.z=1),o.normalize(),n.crossVectors(r,o),0===n.lengthSquared()&&(1===Math.abs(r.z)?o.x+=1e-4:o.z+=1e-4,o.normalize(),n.crossVectors(r,o)),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[4]=a.x,s[8]=o.x,s[1]=n.y,s[5]=a.y,s[9]=o.y,s[2]=n.z,s[6]=a.z,s[10]=o.z,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[4],s=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],S=r[4],E=r[8],C=r[12],w=r[1],_=r[5],M=r[9],A=r[13],P=r[2],I=r[6],R=r[10],O=r[14],V=r[3],N=r[7],F=r[11],L=r[15];return n[0]=a*T+o*w+s*P+u*V,n[4]=a*S+o*_+s*I+u*N,n[8]=a*E+o*M+s*R+u*F,n[12]=a*C+o*A+s*O+u*L,n[1]=h*T+l*w+c*P+f*V,n[5]=h*S+l*_+c*I+f*N,n[9]=h*E+l*M+c*R+f*F,n[13]=h*C+l*A+c*O+f*L,n[2]=d*T+p*w+m*P+v*V,n[6]=d*S+p*_+m*I+v*N,n[10]=d*E+p*M+m*R+v*F,n[14]=d*C+p*A+m*O+v*L,n[3]=y*T+g*w+x*P+b*V,n[7]=y*S+g*_+x*I+b*N,n[11]=y*E+g*M+x*R+b*F,n[15]=y*C+g*A+x*O+b*L,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],o=t[5],s=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*s*l-r*u*l-n*o*c+i*u*c+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*c+n*a*c-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*l-e*o*f-n*a*l+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*l+e*o*c+r*a*l-i*a*c+i*s*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],o=t[5],s=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*s*f-o*m*f-l*s*v+o*c*v,g=d*c*u-h*m*u-d*s*f+a*m*f+h*s*v-a*c*v,x=h*p*u-d*l*u+d*o*f-a*p*f-h*o*v+a*l*v,b=d*l*s-h*p*s-d*o*c+a*p*c+h*o*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var S=1/T;return t[0]=y*S,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*S,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*S,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*S,t[4]=g*S,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*S,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*S,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*S,t[8]=x*S,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*S,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*S,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*S,t[12]=b*S,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*S,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*S,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*S,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=it.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,S=u*d,E=u*p,C=i.x,w=i.y,_=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+E)*C,n[2]=(y-S)*C,n[3]=0,n[4]=(v-E)*w,n[5]=(1-(m+b))*w,n[6]=(x+T)*w,n[7]=0,n[8]=(y+S)*_,n[9]=(x-T)*_,n[10]=(1-(m+g))*_,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,n[15]=1,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();if(0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14],r.x=o,r.y=s,r.z=u,1e-8>Math.abs(o)||1e-8>Math.abs(s)||1e-8>Math.abs(u))return i.set(0,0,0,1),this;var h=t.tempMat0;h.copyFrom(this);var l=1/o,c=1/s,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),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.extractRotation=function(e){var i=t.tempVec0,r=e.elements,n=this.elements,a=1/i.set(r[0],r[1],r[2]).length(),o=1/i.set(r[4],r[5],r[6]).length(),s=1/i.set(r[8],r[9],r[10]).length();return n[0]=r[0]*a,n[1]=r[1]*a,n[2]=r[2]*a,n[3]=0,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[7]=0,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},e.setPosition=function(t){return this.elements[12]=t.x,this.elements[13]=t.y,this.elements[14]=t.z,this},e.getTransform=function(){var t=new it,e=new rh,i=new it;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),h=-(e+t)*o,l=-(i+r)*s,c=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!e6(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return new t().perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,o,l,p,r,s,c,m,n,u,f,v)},t}();nm.IDENTITY=new nm(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),nm.ZERO=new nm(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),nm.tempVec0=new it,nm.tempVec1=new it,nm.tempVec2=new it,nm.tempMat0=new nm,(tu=eO||(eO={}))[tu.XYZ=0]="XYZ",tu[tu.XZY=1]="XZY",tu[tu.YXZ=2]="YXZ",tu[tu.YZX=3]="YZX",tu[tu.ZXY=4]="ZXY",tu[tu.ZYX=5]="ZYX";var nv=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case eO.XYZ:this.y=Math.asin(e9(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case eO.YXZ:this.x=Math.asin(-e9(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case eO.ZXY:this.x=Math.asin(e9(l,-1,1)),.9999999>Math.abs(l)?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case eO.ZYX:this.y=Math.asin(-e9(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case eO.YZX:this.z=Math.asin(e9(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case eO.XZY:this.z=Math.asin(-e9(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(l,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=e5,this.y*=e5,this.z*=e5,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,o;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new rh;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,a=Math.cos(e*e4*.5),o=Math.cos(i*e4*.5),s=Math.cos(r*e4*.5),u=Math.sin(e*e4*.5),h=Math.sin(i*e4*.5),l=Math.sin(r*e4*.5);switch(n){case eO.XYZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eO.YXZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eO.ZXY:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eO.ZYX:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eO.YZX:t.set(u*o*s+a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s-u*h*l);break;case eO.XZY:t.set(u*o*s-a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s+u*h*l);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,a=this.order,o=Math.cos(i*e4),s=Math.sin(i*e4),u=Math.cos(r*e4),h=Math.sin(r*e4),l=Math.cos(n*e4),c=Math.sin(n*e4);if(a===eO.XYZ){var f=o*l,d=o*c,p=s*l,m=s*c;e[0]=u*l,e[4]=-u*c,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-s*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=o*u}else if(a===eO.YXZ){var v=u*l,y=u*c,g=h*l,x=h*c;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*c,e[5]=o*l,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===eO.ZXY){var b=u*l,T=u*c,S=h*l,E=h*c;e[0]=b-E*s,e[4]=-o*c,e[8]=S+T*s,e[1]=T+S*s,e[5]=o*l,e[9]=E-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===eO.ZYX){var C=o*l,w=o*c,_=s*l,M=s*c;e[0]=u*l,e[4]=_*h-w,e[8]=C*h+M,e[1]=u*c,e[5]=M*h+C,e[9]=w*h-_,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===eO.YZX){var A=o*u,P=o*h,I=s*u,R=s*h;e[0]=u*l,e[4]=R-A*c,e[8]=I*c+P,e[1]=c,e[5]=o*l,e[9]=-s*l,e[2]=-h*l,e[6]=P*c+I,e[10]=A-R*c}else if(a===eO.XZY){var O=o*u,V=o*h,N=s*u,F=s*h;e[0]=u*l,e[4]=-c,e[8]=h*l,e[1]=O*c+F,e[5]=o*l,e[9]=V*c-N,e[2]=N*c-V,e[6]=s*l,e[10]=F*c+O}else console.error("toMatrix4: Invalid order "+a);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();nv.DEFAULT_ORDER=eO.ZYX,nv.tempQuat0=new rh,nv.tempMat0=new nm;var ny=function(){function t(t,e,i,r,n,a,o,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=o,h[1]=e,h[4]=n,h[7]=s,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=o,h[5]=s,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,o=i+i,s=r+r,u=e*a,h=e*o,l=e*s,c=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],o=r[6],s=r[1],u=r[4],h=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*h,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[3],s=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],S=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*S,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*S,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*S,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8];return e*(a*h-u*o)+n*(u*r-i*h)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8],l=h*a-u*o,c=u*r-h*i,f=o*i-a*r,d=e*l+n*c+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=c*p,t[4]=(h*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!e6(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h){return new t(e,n,s,i,a,u,r,o,h)},t}(),ng=function(){function t(t,e){void 0===t&&(t=it.ZERO),void 0===e&&(e=it.X),this.origin=new it,this.direction=new it,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new it;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.distanceToPlane=function(t){var e=t.normal,i=e.dot(this.direction);if(0===i)return e.dot(this.origin)+t.distance===0?0:null;var r=-(this.origin.dot(e)+t.distance)/i;return r>=0?r:null},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,S=b.y,E=b.z,C=1/d,w=1/p,_=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),w>=0?(n=(g-l)*w,a=(S-l)*w):(n=(S-l)*w,a=(g-l)*w),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),_>=0?(o=(x-c)*_,s=(E-c)*_):(o=(E-c)*_,s=(x-c)*_),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new it).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){if(!(e.radius<0)){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),h=t.tempVec1.subtractVectors(s,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();ng.tempVec0=new it,ng.tempVec1=new it,ng.tempVec2=new it,ng.tempVec3=new it;var nx=function(){function t(t,e){void 0===t&&(t=new it(1/0,1/0,1/0)),void 0===e&&(e=new it(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var h=t[s],l=t[s+1],c=t[s+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>o&&(o=c)}return this.min.set(e,i,r),this.max.set(n,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new it),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new it),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new it),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(e){var i=t.tempVec0;return this.clampPoint(e.center,i),i.distanceSquared(e.center)<=e.radius*e.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new it),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new it),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new it),this.isEmpty())return[];var i=[];return i[0]=new it(this.min.x,this.min.y,this.min.z),i[1]=new it(this.min.x,this.min.y,this.max.z),i[2]=new it(this.min.x,this.max.y,this.min.z),i[3]=new it(this.min.x,this.max.y,this.max.z),i[4]=new it(this.max.x,this.min.y,this.min.z),i[5]=new it(this.max.x,this.min.y,this.max.z),i[6]=new it(this.max.x,this.max.y,this.min.z),i[7]=new it(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(t.tempVec0).length(),e)},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}();nx.tempVec0=new it;var nb=function(){function t(t,e){void 0===t&&(t=it.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(e,i){var r=this.center;void 0!==i?r.copyFrom(i):t.tempBox.setFromPoints(e).getCenter(r);for(var n=0,a=0;a<e.length;a++)n=Math.max(n,r.distanceSquared(e[a]));return this.radius=Math.sqrt(n),this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new it),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new nx),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(e){if(this.isEmpty())return this.set(e,0);var i=t.tempVec0.subtractVectors(e,this.center),r=i.lengthSquared();if(r>this.radius*this.radius){var n=Math.sqrt(r),a=(n-this.radius)*.5;this.center.add(i.multiply(a/n)),this.radius+=a}return this},e.union=function(e){if(e.isEmpty())return this;if(this.isEmpty())return this.copyFrom(e);if(this.center.equals(e.center))this.radius=Math.max(this.radius,e.radius);else{var i=t.tempVec0,r=t.tempVec1.subtractVectors(e.center,this.center).setLength(e.radius);this.expandByPoint(i.copyFrom(e.center).add(r)),this.expandByPoint(i.copyFrom(e.center).subtract(r))}return this},e.intersect=function(t){if(this.isEmpty()||t.isEmpty())return this.makeEmpty();var e=this.center.distance(t.center);return e>this.radius+t.radius?this.makeEmpty():this.radius>=e+t.radius?this.copyFrom(t):t.radius>=e+this.radius?this:this.radius<=t.radius?this:this.copyFrom(t)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}();nb.tempBox=new nx,nb.tempVec0=new it,nb.tempVec1=new it;var nT=Object.freeze({__proto__:null,get EulerOrder(){return eO},Euler:nv,Quaternion:rh,Vector2:e7,Vector3:it,Vector4:ie,Matrix3:ny,Matrix4:nm,Ray:ng,PI2:2*Math.PI,DEG2RAD:e4,RAD2DEG:e5,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:e6,damp:function(t,e,i,r){return e8(t,e,1-Math.exp(-i*r))},lerp:e8,degToRad:function(t){return t*e4},radToDeg:function(t){return t*e5},clamp:e9,Color:ii,Box3:nx,Sphere:nb});t.ShaderCompileResultStatus=void 0,(th=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[th.noShader=0]="noShader",th[th.success=1]="success",th[th.fail=2]="fail",th[th.compiling=3]="compiling",t.GLSLVersion=void 0,(tl=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",tl.GLSL3="300 es";var nS=function(t){function e(e,i,r){var n;return(n=t.call(this,e)||this).source=i,n.key=r,n}return iY(e,t),e.prototype.initialize=function(){},e}(i4);t.Shader=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=iQ(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(i4),t.Shader=eq([i1(eS.Shader)],t.Shader);var nE=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[rG.ONE,rG.ONE_MINUS_SRC_ALPHA,rG.ONE,rG.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[rG.FUNC_ADD,rG.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=rG.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[rG.ALWAYS,rG.ALWAYS],this.stencilOpFail=[rG.KEEP,rG.KEEP],this.stencilOpZFail=[rG.KEEP,rG.KEEP],this.stencilOpZPass=[rG.KEEP,rG.KEEP],this.culling=!1,this.frontFace=rG.CCW,this.cullFace=rG.FRONT},e.apply=function(t){if(t.setSampleAlphaToCoverage(this.sampleAlphaToCoverage),t.setBlending(this.blending),t.setDepthTest(this.depthTest),t.setStencilTest(this.stencilTest),t.setCulling(this.culling),t.setPolygonOffsetFill(this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(rG.BACK,this.stencilMask[1]),t.stencilMaskSeparate(rG.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(rG.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(rG.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(rG.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(rG.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}();t.MaterialRenderType=void 0,(tc=t.MaterialRenderType||(t.MaterialRenderType={}))[tc.normal=0]="normal",tc[tc.transformFeedback=1]="transformFeedback";var nC=1,nw=function(e){function i(i,r){var n;if((n=e.call(this,i)||this).stringTags={},n.enabledMacros={},n.destroyed=!1,n.initialized=!1,n.shaderDirty=!0,n.floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirty=!0,n.macrosDirty=!0,n.materialState=new nE,r){var a=r.name,o=void 0===a?"Material"+nC++:a,s=r.renderType,u=r.shader;n.name=o,n.renderType=void 0===s?0:s,n.shaderSource=u,n.props=r,n._shader=new t.Shader(i),n._shader.shaderData=ro({},r.shader,{id:iL(),dataType:eS.Shader})}else n.name="Material"+nC++,n.renderType=0;return n}iY(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!iI(i.initialize)){i_.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this._shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.materialState.apply(t)},r.use=function(t,e){var i=t.engine,r=this.shaderVariant;if(r.bind(),this.setupStates(i),e){for(var n,a,o=iQ(e.uniforms);!(a=o()).done;)n=a.value,this.checkUniform(n);for(var s,u=iQ(e.samplers);!(s=u()).done;)n=s.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=iQ(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=iQ(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;iS(r);var n=i.create(r,e);return n.materialState=Object.assign(new nE,n.materialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new ie(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],a=0;a<t.matrixArrays[e].length;a+=16){for(var o=nm.fromIdentity(),s=0;s<16;s++)o.elements[s]=t.matrixArrays[e][a+s];n.push(o)}this.setMatrixArray(e,n)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=ro({},t);void 0!==t.stringTags.RenderType&&(this.blending=t.stringTags.RenderType===t1.Transparent),void 0!==t.floats.ZTest&&(this.depthTest=0!==t.floats.ZTest),void 0!==t.floats.ZWrite&&(this.depthMask=0!==t.floats.ZWrite);var a=t.stringTags.RenderFace;for(i in a===t2.Front?(this.culling=!0,this.cullFace=rG.BACK):a===t2.Back?(this.culling=!0,this.cullFace=rG.FRONT):this.culling=!1,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var o=n.vector4s[i];this.setVector4(i,new ie(o.x,o.y,o.z,o.w))}for(i in n.colors){var s=n.colors[i];this.setColor(i,new ii(s.r,s.g,s.b,s.a))}for(i in n.textures){var u=n.textures[i],h=this.engine.findObject(u.texture);this.setTexture(i,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(i+"_ST",new ie(c.x,c.y,l.x,l.y))}if(t.shader){var f=this.engine.findObject(t.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.definition;for(var e in this._shader&&(t.shader=this._shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=eS.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var o=t.textures[a],s=this.getVector4(a+"_ST");s&&(o.scale={x:s.x,y:s.y},o.offset={x:s.z,y:s.w},delete t.vector4s[a+"_ST"])}return t},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(){var t;this.destroyed||(null==(t=this.shaderVariant)||t.dispose(),this.textures={},this.shaderSource=null,this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=iF,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),e.prototype.dispose.call(this))},rk(i,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",get:function(){return this.materialState.blending},set:function(t){void 0!==t&&this.materialState.setBlending(t)}},{key:"blendColor",get:function(){return this.materialState.blendColor},set:function(t){t&&this.materialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.materialState.blendFunctionParameters},set:function(t){t&&this.materialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.materialState.blendEquationParameters},set:function(t){t&&this.materialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.materialState.depthTest},set:function(t){void 0!==t&&this.materialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.materialState.depthMask},set:function(t){void 0!==t&&this.materialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.materialState.depthRange},set:function(t){t&&this.materialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.materialState.depthFunc},set:function(t){void 0!==t&&this.materialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.materialState.polygonOffsetFill},set:function(t){void 0!==t&&this.materialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.materialState.polygonOffset},set:function(t){t&&this.materialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.materialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.materialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.materialState.colorMask[0]},set:function(t){this.materialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.materialState.stencilTest},set:function(t){void 0!==t&&this.materialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.materialState.stencilMask},set:function(t){t&&this.materialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.materialState.stencilRef},set:function(t){t&&this.materialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.materialState.stencilFunc},set:function(t){t&&this.materialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.materialState.stencilOpFail},set:function(t){t&&this.materialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.materialState.stencilOpZFail},set:function(t){t&&this.materialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.materialState.stencilOpZPass},set:function(t){t&&this.materialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.materialState.culling},set:function(t){void 0!==t&&this.materialState.setCulling(t)}},{key:"frontFace",get:function(){return this.materialState.frontFace},set:function(t){void 0!==t&&this.materialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.materialState.cullFace},set:function(t){void 0!==t&&this.materialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(i4);nw.create=function(t,e){return new nw(t,e)};var n_=function(){function e(){this.alphaMaskEnabled=!1,this.isMask=!1,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpFail=[0,0],this.prevStencilOpZFail=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.references,a=void 0===n?[]:n,o=e.alphaMaskEnabled;if(this.alphaMaskEnabled=void 0!==o&&o,this.isMask=r,this.maskReferences=[],!r&&0!==a.length)for(var s,u=new Map,h=iQ(a);!(s=h()).done;){var l,c=s.value,f=c.mask;if(f){var d=t.findObject(f);if(!d){console.warn("Mask reference not found: "+JSON.stringify(f)+". Skipping.");continue}var p=null!=(l=c.inverted)&&l,m=u.get(d);if(void 0!==m){m!==p&&console.warn("Same maskable referenced with conflicting inverted flags; keeping the first occurrence.");continue}if(this.maskReferences.length>=254){console.warn("Maximum of 254 mask references exceeded. Additional masks will be ignored.");break}u.set(d,p),this.maskReferences.push({maskable:d,inverted:p})}}},i.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some(function(e){return e.maskable===t})){if(this.maskReferences.length>=254){console.warn("Maximum of 254 mask references exceeded. Additional masks will be ignored.");return}this.maskReferences.push({maskable:t,inverted:e})}},i.removeMaskReference=function(t){var e=this.maskReferences.findIndex(function(e){return e.maskable===t});-1!==e&&this.maskReferences.splice(e,1)},i.clearMaskReferences=function(){this.maskReferences=[]},i.getMaskReferences=function(){return this.maskReferences.slice()},i.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=[],a=iQ(r);!(i=a()).done;){var o=i.value,s=this.maskReferences.length;this.addMaskReference(o,!1),this.maskReferences.length>s&&n.push(o)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var u,h=[],l=[],c=iQ(this.maskReferences);!(u=c()).done;){var f=u.value;f.inverted?l.push(f):h.push(f)}for(var d=0;d<h.length;d++)h[d].maskable.drawStencilMask(d);for(var p,m=h.length,v=iQ(l);!(p=v()).done;)p.value.maskable.drawStencilMask(m);this.expectedStencilValue=m}for(var y,g=iQ(e.materials);!(y=g()).done;){var x=y.value;this.setupMaskedMaterial(x)}for(var b,T=iQ(n);!(b=T()).done;){var S=b.value;this.removeMaskReference(S)}},i.drawGeometryMask=function(t,e,i,r,n,a){void 0===a&&(a=0);var o=r.colorMask,s=r.stencilTest;this.copyStencilArrayValue(this.prevStencilFunc,r.stencilFunc),this.copyStencilArrayValue(this.prevStencilOpFail,r.stencilOpFail),this.copyStencilArrayValue(this.prevStencilOpZFail,r.stencilOpZFail),this.copyStencilArrayValue(this.prevStencilOpZPass,r.stencilOpZPass),this.copyStencilArrayValue(this.prevStencilRef,r.stencilRef),this.copyStencilArrayValue(this.prevStencilMask,r.stencilMask),this.setupMaskMaterial(r,n),t.drawGeometry(e,i,r,a),r.colorMask=o,r.stencilTest=s,r.stencilFunc=this.prevStencilFunc,r.stencilOpFail=this.prevStencilOpFail,r.stencilOpZFail=this.prevStencilOpZFail,r.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},i.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[rG.EQUAL,rG.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpFail=[rG.KEEP,rG.KEEP],t.stencilOpZFail=[rG.KEEP,rG.KEEP],t.stencilOpZPass=[rG.INCR,rG.INCR],t.colorMask=!1},i.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[rG.EQUAL,rG.EQUAL],t.stencilOpZPass=[rG.KEEP,rG.KEEP]):t.stencilTest=!1},i.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},rk(e,[{key:"maskable",get:function(){return this.maskReferences.length>0?this.maskReferences[0].maskable:null},set:function(t){this.maskReferences=[],t&&this.maskReferences.push({maskable:t,inverted:!1})}}]),e}();t.BufferUsage=void 0,(tf=t.BufferUsage||(t.BufferUsage={}))[tf.Stream=35040]="Stream",tf[tf.Static=35044]="Static",tf[tf.Dynamic=35048]="Dynamic",t.BufferDataType=void 0,(td=t.BufferDataType||(t.BufferDataType={}))[td.Byte=5120]="Byte",td[td.UnsignedByte=5121]="UnsignedByte",td[td.Short=5122]="Short",td[td.UnsignedShort=5123]="UnsignedShort",td[td.Int=5124]="Int",td[td.UnsignedInt=5125]="UnsignedInt",td[td.Float=5126]="Float";var nM=function(){function t(){this.references=0,this.capacity=0,this.is32Bits=!1}return rk(t,[{key:"underlyingResource",get:function(){return null}}]),t}();function nA(t){switch(t){case 5120:case 5121:return 1;case 5122:case 5123:return 2;case 5124:case 5125:case 5126:return 4;default:return 0}}function nP(t){return eZ(t,Int8Array)?5120:eZ(t,Uint8Array)?5121:eZ(t,Int16Array)?5122:eZ(t,Uint16Array)?5123:eZ(t,Int32Array)?5124:eZ(t,Uint32Array)?5125:5126}function nI(t){return Array.isArray(t)?t.length*Float32Array.BYTES_PER_ELEMENT:t.byteLength}function nR(t,e){switch(t){case 5120:return new Int8Array(e);case 5121:return new Uint8Array(e);case 5122:return new Int16Array(e);case 5123:return new Uint16Array(e);case 5124:return new Int32Array(e);case 5125:return new Uint32Array(e);default:return new Float32Array(e)}}var nO=function(){function e(t,e,i,r,n,a,o,s,u){void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=!1),void 0===o&&(o=!1),this.engine=t,this.isAlreadyOwned=!1,this._isDisposed=!1,this.updatable=i,this.instanced=a,this.divisor=s||1,this.label=u,this.byteStride=o?r:r*Float32Array.BYTES_PER_ELEMENT,eZ(e,nM)?this.buffer=e:this.data=e,n||this.create()}var i=e.prototype;return i.isUpdatable=function(){return this.updatable},i.getData=function(){return this.data},i.getBuffer=function(){return this.buffer},i.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},i.createVertexBuffer=function(t,e,i,r,n,a,o){void 0===a&&(a=!1);var s=a?e:e*Float32Array.BYTES_PER_ELEMENT,u=r?a?r:r*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new nV(this.engine,this,t,{size:i,stride:u,offset:s,instanced:void 0===n?this.instanced:n,useBytes:!0,divisor:null!=o?o:this.divisor})},i.create=function(t){if((t||!this.buffer)&&(t=null!=t?t:this.data)){var e=this.getDataBufferOptions(t);this.buffer?this.updatable&&(this.engine.updateDynamicVertexBuffer(this.buffer,t),this.data=t):(this.buffer=this.updatable?this.engine.createDynamicVertexBuffer(t,e):this.engine.createVertexBuffer(t,e),this.updatable&&(this.data=t))}},i.update=function(t){this.create(t)},i.updateDirectly=function(t,e,i,r){void 0===r&&(r=!1),this.buffer&&this.updatable&&(this.engine.updateDynamicVertexBuffer(this.buffer,t,r?e:e*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),0===e&&void 0===i?this.data=t:this.data=void 0)},i.rebuild=function(){if(!this.data){if(!this.buffer)return;var t=this.buffer.capacity;if(t>0){var e=this.getDataBufferOptions();this.buffer=this.updatable?this.engine.createDynamicVertexBuffer(t,e):this.engine.createVertexBuffer(t,e)}else this.buffer=void 0;return}this.buffer=void 0,this.create(this.data)},i.increaseReferences=function(){if(this.buffer){if(!this.isAlreadyOwned){this.isAlreadyOwned=!0;return}this.buffer.references++}},i.dispose=function(){this.buffer&&this.engine.releaseBuffer(this.buffer)&&(this.data=void 0,this.buffer=void 0,this._isDisposed=!0)},i.getDataBufferOptions=function(e){return{usage:this.updatable?t.BufferUsage.Dynamic:t.BufferUsage.Static,type:e?nP(e):t.BufferDataType.Float,byteStride:this.byteStride,instanceDivisor:this.instanced?this.divisor:0,label:this.label}},rk(e,[{key:"isDisposed",get:function(){return this._isDisposed}},{key:"capacity",get:function(){var t,e;return null!=(e=null==(t=this.buffer)?void 0:t.capacity)?e:this.data?nI(this.data):0}}]),e}(),nV=function(){function t(e,i,r,n){void 0===n&&(n={}),this._isDisposed=!1,this.engine=e,this.kind=r,eZ(i,nO)?(this.buffer=i,this.ownsBuffer=null!=(a=n.takeBufferOwnership)&&a):(this.buffer=new nO(e,i,null!=(o=n.updatable)&&o,null!=(s=n.stride)?s:0,null!=(u=n.postponeInternalCreation)&&u,null!=(h=n.instanced)&&h,null!=(l=n.useBytes)&&l,n.divisor,n.label),this.ownsBuffer=!0);var a,o,s,u,h,l,c,f,d,p,m,v,y,g=this.getData();this.type=null!=(c=n.type)?c:g?nP(g):t.FLOAT;var x=nA(this.type),b=null!=(f=n.useBytes)&&f,T=null!=(d=n.stride)?d:0,S=null!=(p=n.offset)?p:0;b?(this.size=n.size||(T?T/x:0),this.byteStride=T||this.buffer.byteStride||this.size*x,this.byteOffset=S):(this.size=n.size||T,this.byteStride=T?T*x:this.buffer.byteStride||this.size*x,this.byteOffset=S*x),this.normalized=null!=(m=n.normalized)&&m,this.instanced=null!=(v=n.instanced)&&v,this._instanceDivisor=this.instanced?null!=(y=n.divisor)?y:1:0}var e=t.prototype;return e.getKind=function(){return this.kind},e.isUpdatable=function(){return this.buffer.isUpdatable()},e.getData=function(){return this.buffer.getData()},e.getBuffer=function(){return this.buffer.getBuffer()},e.getWrapperBuffer=function(){return this.buffer},e.getStrideSize=function(){return this.byteStride/nA(this.type)},e.getOffset=function(){return this.byteOffset/nA(this.type)},e.getSize=function(t){return void 0===t&&(t=!1),t?this.size*nA(this.type):this.size},e.getIsInstanced=function(){return this.instanced},e.getInstanceDivisor=function(){return this._instanceDivisor},e.create=function(t){this.buffer.create(t)},e.update=function(t){this.buffer.update(t)},e.updateDirectly=function(t,e,i){void 0===i&&(i=!1),this.buffer.updateDirectly(t,e,void 0,i)},e.rebuild=function(){this.buffer.rebuild()},e.dispose=function(){this.ownsBuffer&&this.buffer.dispose(),this._isDisposed=!0},rk(t,[{key:"isDisposed",get:function(){return this._isDisposed}},{key:"instanceDivisor",get:function(){return this._instanceDivisor},set:function(t){this._instanceDivisor=t,this.instanced=0!==t}}]),t}();nV.PositionKind="aPos",nV.NormalKind="aNormal",nV.TangentKind="aTangent",nV.UVKind="aUV",nV.UV2Kind="aUV2",nV.UV3Kind="aUV3",nV.UV4Kind="aUV4",nV.UV5Kind="aUV5",nV.UV6Kind="aUV6",nV.ColorKind="aColor",nV.JointsKind="aJoints",nV.WeightsKind="aWeights",nV.BYTE=t.BufferDataType.Byte,nV.UNSIGNED_BYTE=t.BufferDataType.UnsignedByte,nV.SHORT=t.BufferDataType.Short,nV.UNSIGNED_SHORT=t.BufferDataType.UnsignedShort,nV.INT=t.BufferDataType.Int,nV.UNSIGNED_INT=t.BufferDataType.UnsignedInt,nV.FLOAT=t.BufferDataType.Float,t.HitTestType=void 0,(tp=t.HitTestType||(t.HitTestType={}))[tp.triangle=1]="triangle",tp[tp.box=2]="box",tp[tp.sphere=3]="sphere",tp[tp.custom=4]="custom";var nN=function(){this.position=new e7,this.delta=new e7,this.pointerCurrentRaycast=new nF},nF=function(){this.point=null,this.item=null},nL=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new it),this.vectorsWorld.push(new it);for(var n=0;n<3;n++)this.directions.push(new it);this.minimum=new it,this.maximum=new it,this.minimumWorld=new it,this.maximumWorld=new it,this.center=new it,this.centerWorld=new it,this.extendSize=new it,this.extendSizeWorld=new it,this.worldMatrix=i||nm.fromIdentity(),this.reConstruct(t,e,i)}var e=t.prototype;return e.reConstruct=function(e,i,r){var n=e.x,a=e.y,o=e.z,s=i.x,u=i.y,h=i.z;this.minimum.set(n,a,o),this.maximum.set(s,u,h),this.vectors[0].set(n,a,o),this.vectors[1].set(s,u,h),this.vectors[2].set(s,a,o),this.vectors[3].set(n,u,o),this.vectors[4].set(n,a,h),this.vectors[5].set(s,u,o),this.vectors[6].set(n,u,h),this.vectors[7].set(s,a,h);var l=t.tempVector0,c=t.tempVector1;l.copyFrom(i).add(e),this.center.copyFrom(l).scale(.5),c.copyFrom(i).subtract(e),this.extendSize.copyFrom(c).scale(.5),this.worldMatrix=r||nm.fromIdentity(),this.update(this.worldMatrix)},e.update=function(e){var i=this.minimumWorld,r=this.maximumWorld,n=this.vectorsWorld,a=this.vectors;if(e.isIdentity()){i.copyFrom(this.minimum),r.copyFrom(this.maximum);for(var o=0;o<8;o++)n[o].copyFrom(a[o]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var s=0;s<8;s++){e.transformPoint(a[s],n[s]);var u=n[s];i.x=Math.min(i.x,u.x),i.y=Math.min(i.y,u.y),i.z=Math.min(i.z,u.z),r.x=Math.max(r.x,u.x),r.y=Math.max(r.y,u.y),r.z=Math.max(r.z,u.z)}var h=t.tempVector0,l=t.tempVector1;h.copyFrom(r).subtract(i),this.extendSizeWorld.copyFrom(h).scale(.5),l.copyFrom(r).add(i),this.centerWorld.copyFrom(l).scale(.5)}var c=e.elements;this.directions[0].set(c[0],c[1],c[2]),this.directions[1].set(c[4],c[5],c[6]),this.directions[2].set(c[8],c[9],c[10]),this.worldMatrix=e},e.scale=function(e){var i=t.tempVector0;i.copyFrom(this.maximum).subtract(this.minimum);var r=i.length();i.scale(1/r),i.scale(r*e*.5);var n=t.tempVector1,a=t.tempVector2;return n.copyFrom(this.center).subtract(i),a.copyFrom(this.center).add(i),this.reConstruct(n,a,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld;return!(i.x-t.x<-.000001)&&!(-.000001>t.x-e.x)&&!(i.y-t.y<-.000001)&&!(-.000001>t.y-e.y)&&!(i.z-t.z<-.000001)&&!(-.000001>t.z-e.z)},e.intersectsBox=function(t){return this.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.intersectsMinMax=function(t,e){var i=this.minimumWorld,r=this.maximumWorld;return!(r.x<t.x)&&!(i.x>e.x)&&!(r.y<t.y)&&!(i.y>e.y)&&!(r.z<t.z)&&!(i.z>e.z)},t.intersects=function(t,e){return t.intersectsMinMax(e.minimumWorld,e.maximumWorld)},t}();nL.tempVector0=new it,nL.tempVector1=new it,nL.tempVector2=new it;var nD=function(){function e(){this.boundingBox=new nL(new it,new it),this.triangles=[],this.worldMatrix=new nm,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var o=3*e[a],s=3*e[a+1],u=3*e[a+2],h={x:t[o],y:t[o+1],z:t[o+2]},l={x:t[s],y:t[s+1],z:t[s+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var i=e.prototype;return i.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},i.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},i.getBoundingBoxTriangle=function(e){for(var i,r=-Number.MAX_VALUE,n=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=Number.MAX_VALUE,s=iQ(this.boundingBoxTriangle.area);!(i=s()).done;){var u=i.value;r=Math.max(u.p0.x,u.p1.x,u.p2.x,r),n=Math.max(u.p0.y,u.p1.y,u.p2.y,n),a=Math.min(u.p0.x,u.p1.x,u.p2.x,a),o=Math.min(u.p0.y,u.p1.y,u.p2.y,o)}var h=[],l=new it(a,n,0),c=new it(r,n,0),f=new it(r,o,0),d=new it(a,o,0);return h.push({p0:l,p1:c,p2:f}),h.push({p0:l,p1:f,p2:d}),this.applyWorldMatrix(h),{type:t.HitTestType.triangle,area:h}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,n=[],a=iQ(this.triangles);!(r=a()).done;){var o=r.value;n.push({p0:o.p0,p1:o.p1,p2:o.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxTriangle={type:t.HitTestType.triangle,area:n}},i.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData(nV.PositionKind),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=iQ(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount){var s=e.BYTES_PER_ELEMENT,u=o.offset/s,h=u+o.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new it),t.p1=e.worldMatrix.transformPoint(t.p1,new it),t.p2=e.worldMatrix.transformPoint(t.p2,new it)}),t},e}(),nk=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e.frameClipMasks=[],e.maskManager=new n_,e._priority=0,e.boundingBoxInfo=new nD,e}iY(e,t);var i=e.prototype;return i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},i.onParentChanged=function(){this.frameClipMasks=[]},i.getBoundingBoxInfo=function(){return this.boundingBoxInfo},i.render=function(t){},rk(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(rB);eq([i3(void 0,void 0)],nk.prototype,"materials",void 0),eq([i3(void 0,void 0)],nk.prototype,"_priority",void 0);var nB="editor",nz={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b","Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT"},nU=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}},nG=new rh,nW=new it,nj=new it,nX=1,nH=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new it(0,0,0),this.quat=new rh(0,0,0,1),this.rotation=new nv(0,0,0),this.scale=new it(1,1,1),this.anchor=new it(0,0,0),this.size=new e7(1,1),this.children=[],this.worldMatrix=nm.fromIdentity(),this.localMatrix=nm.fromIdentity(),this.localMatrix2D=ny.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix2D:!1,worldMatrix:!1,worldTRS:!1},this.worldTRSCache={position:new it(0,0,0),quat:new rh(0,0,0,1),scale:new it(1,1,1)},this.eventEmitter=new nU,this.name="transform_"+nX++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.on=function(t,e,i){this.eventEmitter.on(t,e,i)},e.off=function(t,e){this.eventEmitter.off(t,e)},e.onParentTransformChanged=function(t,e){},e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(eZ(i,it)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)eZ(o,rh)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var h=e?-1:1;eZ(r,nv)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(eZ(n,it)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(eZ(u,e7)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){e1(this.children,t)},e.removeChild=function(t){e2(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new nv)},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.worldMatrix=!0,this.dirtyFlags.localMatrix2D=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix2D=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getMatrix2D=function(){var t,e,i;return this.updateLocalMatrix(),this.dirtyFlags.localMatrix2D&&(t=this.localMatrix2D,e=this.localMatrix.elements,(i=t.elements)[0]=e[0],i[1]=e[1],i[2]=0,i[3]=e[4],i[4]=e[5],i[5]=0,i[6]=e[12],i[7]=e[13],i[8]=1,this.dirtyFlags.localMatrix2D=!1),this.localMatrix2D},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix()),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return this.dirtyFlags.worldMatrix&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldTRS=!0,this.dirtyFlags.worldMatrix=!1),this.worldMatrix},e.getWorldScale=function(){return this.updateTRSCache(),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.setWorldPosition=function(t,e,i){var r=this.getParentMatrix();r?(nW.set(0,0,0),nG.set(0,0,0,1),nj.set(1,1,1),r.decompose(nW,nG,nj),nW.set(t-nW.x,e-nW.y,i-nW.z),nG.invert(),nW.applyQuaternion(nG),nW.x=0!==nj.x?nW.x/nj.x:0,nW.y=0!==nj.y?nW.y/nj.y:0,nW.z=0!==nj.z?nW.z/nj.z:0,this.setPosition(nW.x,nW.y,nW.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new nv)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),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.worldMatrix=!0,this.dirtyFlags.localMatrix2D=!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={};e.position=new it().copyFrom(t.position),t.quat?e.quat=new rh(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new nv(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=new it().copyFrom(t.scale),t.size&&(e.size=new e7().copyFrom(t.size)),t.anchor&&(e.anchor=new e7().copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldTRS){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldTRS=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.worldMatrixDirty=!0}),this.eventEmitter.emit("changed",this)},t.getRotation=function(t,e){var i=nG.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},rk(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){if(this.parent!==t&&this!==t){var e=this.parent;this.parent&&this.parent.removeChild(this),t&&t.addChild(this),this.parent=t,this.worldMatrixDirty=!0,this.onParentTransformChanged(e,t)}}},{key:"worldMatrixDirty",get:function(){return this.dirtyFlags.worldMatrix},set:function(t){this.dirtyFlags.worldMatrix!==t&&(this.dirtyFlags.worldMatrix=t,this.dispatchValueChange())}}]),t}();t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new nH,r.time=-1,r.duration=0,r.endBehavior=t6.forward,r.type=tJ.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new nU,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}iY(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,i,r=iQ(this.components);!(i=r()).done;){var n=i.value;if(eZ(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=iQ(this.components);!(e=r()).done;){var n=e.value;eZ(n,t)&&i.push(n)}return i},r.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},r.setParent=function(t){t!==this&&this.parent!==t&&(this.parent&&e2(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),this.onParentChanged(),!this.isDuringPlay&&t.isDuringPlay&&(this.awake(),this.beginPlay()))},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.setActive=function(t){!!t!==this.active&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=iQ(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new nH({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new nv(t,e,i),n=rh.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.engine.canvas.getBoundingClientRect(),s=o.width,u=o.height;this.transform.setPosition((2*t/s-1)*n,(1-2*e/u)*a,i)}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.engine.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.hitTest=function(e,r,n,a,o,s,u){if(!this.isActive)return!1;var h=!1,l=null==u?void 0:u.maxCount,c=this.getHitTestParams(s);if(c){var f=c.clipMasks,d=!0;if(f.length>0&&!function(t,e){for(var i,r=iQ(e);!(i=r()).done;){var n=i.value.item;if(n.isActive&&n.transform.getValid()){var a=n.transform,o=a.getWorldMatrix(),s=a.size.x,u=a.size.y,h=new it(-.5*s,.5*u,0).applyMatrix(o),l=new it(-.5*s,-.5*u,0).applyMatrix(o),c=new it(.5*s,.5*u,0).applyMatrix(o),f=new it(.5*s,-.5*u,0).applyMatrix(o),d={p0:h,p1:l,p2:c},p={p0:c,p1:l,p2:f};if(!t.intersectTriangle(d)&&!t.intersectTriangle(p))return!1}}return!0}(e,f)&&(d=!1),d){var p=!1,m=new it;if(c.type===t.HitTestType.triangle){for(var v=c.triangles,y=c.backfaceCulling,g=0;g<v.length;g++)if(e.intersectTriangle(v[g],m,y)){p=!0,o.push(m);break}}else if(c.type===t.HitTestType.box){var x=c.center,b=c.size,T=x.clone().addScaledVector(b,.5),S=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:S},m)&&(p=!0,o.push(m))}else if(c.type===t.HitTestType.sphere){var E=c.center,C=c.radius;e.intersectSphere({center:E,radius:C},m)&&(p=!0,o.push(m))}else if(c.type===t.HitTestType.custom){var w=c.collect(e,new e7(r,n));w&&w.length>0&&(w.forEach(function(t){o.push(t)}),p=!0)}if(p){var _,M,A={id:this.getInstanceId(),name:this.name,position:o[o.length-1],parentId:this.parentId,hitPositions:o,behavior:c.behavior,item:this,composition:this.composition};if(a.push(A),h=!0,null==u?void 0:null==(M=u.stop)?void 0:M.call(u,A))return!0}}}for(var P,I=iQ(this.children);!(P=I()).done;){var R,O=P.value;if(void 0!==l&&a.length>=l)break;(null==u||null==(R=u.skip)||!R.call(u,O))&&O.hitTest(e,r,n,a,o,s,u)&&(h=!0)}return i.isComposition(this)&&h&&this!==(null==(_=this.composition)?void 0:_.sceneRoot)&&a.push({id:this.getInstanceId(),name:this.name,position:o[o.length-1],parentId:this.parentId,hitPositions:o,behavior:tQ.NONE,item:this,composition:this.composition}),h},r.getCurrentPosition=function(){var t=new it;return this.transform.assignWorldTRS(t),t},r.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.refreshGUIDRecursive();var e=this.engine.findObject({id:this.definition.id});return e.refreshGUIDRecursive(),this.refreshGUIDRecursive(t),this.composition&&e.setParent(this.composition.sceneRoot),e},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=iQ(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.awake=function(){for(var t,e=iQ(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=iQ(this.children);!(r=n()).done;)r.value.awake()},r.onActiveChanged=function(){this.isDuringPlay&&this.composition&&(this.active?this.isEnabled||this.onEnable():this.isEnabled&&this.onDisable())},r.onEnable=function(){this.isEnabled=!0;for(var t,e=iQ(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=iQ(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=iQ(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.onParentChanged=function(){for(var t,e=iQ(this.components);!(t=e()).done;)t.value.onParentChanged();for(var i,r=iQ(this.children);!(i=r()).done;)i.value.onParentChanged()},r.onOrderInParentChanged=function(){for(var t,e=iQ(this.components);!(t=e()).done;)t.value.onOrderInParentChanged()},r.setRendererComponentOrder=function(t){for(var e,i=iQ(this.components);!(e=i()).done;){var r=e.value;eZ(r,nk)&&(r.priority=t)}},r.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.id,n=t.name,a=t.parentId,o=t.endBehavior,s=t.transform,u=t.duration,h=void 0===u?0:u,l=t.visible;if(this.type=t.type,this.props=t,this.id=r.toString(),this.parentId=a,this.components.length=0,i.isComposition(this)){var c=this.definition.content.options.refId,f=this.engine.findEffectsObjectData(c);if(!f)throw Error("Referenced precomposition with Id: "+c+" does not exist.");this.instantiatePreComposition(f)}if(this.name=n,this.duration=h,this.endBehavior=o,s&&this.transform.fromData(s),this.transform.name=this.name,this.transform.engine=this.engine,t.content||(t.content={options:{}}),h<0)throw Error("Item duration can't be less than 0, see "+nz["Item duration can't be less than 0"]+".");if(t.components)for(var d,p=iQ(t.components);!(d=p()).done;){var m=d.value,v=this.engine.findObject(m);this.components.push(v)}for(var y,g,x=iQ(null!=(y=t.children)?y:[]);!(g=x()).done;){var b=g.value;this.engine.findObject(b).setParent(this)}this.setVisible(void 0===l||l)},r.toData=function(){if(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=eS.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="sceneRoot"&&(this.definition.parentId=null==(i=this.parent)?void 0:i.guid),!this.definition.components){this.definition.components=[];for(var e,i,r,n=iQ(this.components);!(r=n()).done;){var a=r.value;eZ(a,t.EffectComponent)&&this.definition.components.push(a)}}this.definition.content={}},r.dispose=function(){this.composition&&this.composition.destroyItem(this);for(var t,i=iQ(this.components.slice());!(t=i()).done;)t.value.dispose();this.components=[],this._composition=null,this.transform.setValid(!1),this.resetChildrenParent(),e.prototype.dispose.call(this)},r.resetChildrenParent=function(){for(var t,e,i=iQ(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&e2(null==(t=this.parent)?void 0:t.children,this)},r.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i=this.getInstanceId();this.setInstanceId(t.id);for(var r,n=iQ(t.components);!(r=n()).done;){var a=r.value,o=this.engine.findObject(a);o.item=this,this.components.push(o)}for(var s,u,h=iQ(null!=(s=t.children)?s:[]);!(u=h()).done;){var l=u.value;this.engine.findObject(l).setParent(this)}if(e){for(var c,f=iQ(this.components);!(c=f()).done;)c.value.setInstanceId(iL());for(var d,p=iQ(this.children);!(d=p()).done;)d.value.refreshGUIDRecursive()}this.setInstanceId(i)},r.refreshGUIDRecursive=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:iL();this.setInstanceId(e);for(var i,r,n=iQ(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:iL();o.setInstanceId(s)}for(var u,h=iQ(this.children);!(u=h()).done;)u.value.refreshGUIDRecursive(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=iQ(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=iQ(this.children);!(n=a()).done;)n.value.gatherPreviousObjectID(t)},r.getDescendantsInternal=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var r=0;r<this.children.length;r++){var n=this.children[r];(!i||i(n))&&t.push(n),e||n.getDescendantsInternal(t,!1,i)}},i.isComposition=function(t){return t.type===tJ.composition},i.isSprite=function(t){return t.type===tJ.sprite},i.isParticle=function(t){return t.type===tJ.particle},i.isNull=function(t){return t.type===tJ.null},i.isTree=function(t){return t.type===tJ.tree},i.isCamera=function(t){return t.type===tJ.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},rk(i,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=iQ(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{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){this.listIndex=t,this.isManuallySetRenderOrder=!0,this.setRendererComponentOrder(t)}},{key:"orderInParent",get:function(){var t,e;return null!=(e=null==(t=this.parent)?void 0:t.children.indexOf(this))?e:-1},set:function(t){var e=null==(n=this.parent)?void 0:n.children,i=null!=(a=null==e?void 0:e.indexOf(this))?a:-1;if(e&&-1!==i){var r=Math.max(0,Math.min(Math.trunc(t),e.length-1));if(i!==r){e.splice(i,1),e.splice(r,0,this);for(var n,a,o,s=iQ(e);!(o=s()).done;)o.value.onOrderInParentChanged()}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),i}(i4),t.VFXItem=eq([i1(eS.VFXItemData)],t.VFXItem),t.Item=void 0,(tm=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tm.isComposition=function(t){return t.type===tJ.composition},tm.isParticle=function(t){return t.type===tJ.particle},tm.isNull=function(t){return t.type===tJ.null};var nY=(ty=new Int32Array((tv=new Float32Array(1)).buffer),function(t){tv[0]=t;var e=ty[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),nZ=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=nY(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=nY(t[i])},t}(),nq=new nv,nK=new nm;function nQ(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,l);var c=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new it;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(s):e.getIntegrateValue(0,r,n):0});nq.setFromArray(v).negate(),nK.setFromEuler(nq);var y=nK.transformPoint(p);t.addVectors(d,y)}if(c.enabled){var g=c.asMovement,x=c.x,b=c.y,T=c.z;if(x){var S=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+S}if(b){var E=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+E}if(T){var C=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function nJ(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function n$(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function n0(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var n1=((eV={})[t0.PARTICLE_ORIGIN_CENTER]=[0,0],eV[t0.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eV[t0.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eV[t0.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eV[t0.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eV[t0.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eV[t0.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eV[t0.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eV[t0.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eV);function n2(t,e,i){var r=i.position,n=new it(t,e,0),a=new it;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new ng(r,a)}function n3(t,e,i){var r=t.x,n=t.y,a=t.z,o=new it(r-e,n+i,a),s=new it(r-e,n-i,a),u=new it(r+e,n-i,a),h=new it(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function n4(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function n5(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function n6(t,e,i,r,n){void 0===r&&(r=null);var a=new it(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new it(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);n||(n=3);for(var s=e,u=e*n;s<e+i;s++,u+=n){var h=t[u],l=t[u+1],c=t[u+2];a.x=Math.min(a.x,h),a.y=Math.min(a.y,l),a.z=Math.min(a.z,c),o.x=Math.max(o.x,h),o.y=Math.max(o.y,l),o.z=Math.max(o.z,c)}return r&&(a.x-=a.x*r.x+r.y,a.y-=a.y*r.x+r.y,a.z-=a.z*r.x+r.y,o.x+=o.x*r.x+r.y,o.y+=o.y*r.x+r.y,o.z+=o.z*r.x+r.y),{minimum:a,maximum:o}}var n8={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex;return new e7(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===t5.LINE?0:i===t5.EASE_OUT?0:i===t5.EASE_IN?2:i===t5.EASE?2:i===t5.HOLD&&r===t5.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===t5.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===t5.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[t5.EASE,t5.EASE_IN,t5.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[t5.EASE,t5.EASE_OUT,t5.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===t5.HOLD&&[t5.HOLD,t5.LINE_OUT,t5.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===t5.HOLD&&[t5.HOLD,t5.LINE,t5.EASE_IN].includes(i)}},n9=function(t,e){this.points=t,this.totalLength=e},n7={},at={};function ae(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function ai(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}function ar(t,e,i,r){var n=n5(e.x-t.x,3)+"_"+n5(e.y-t.y,3)+"_"+n5(e.z-t.z,3)+"&"+(n5(i.x-t.x,3)+"_"+n5(i.y-t.y,3))+"_"+n5(i.z-t.z,3)+"&"+(n5(r.x-t.x,3)+"_"+n5(r.y-t.y,3))+"_"+n5(r.z-t.z,3);if(at[n])return{data:at[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new it,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==o&&(u+=Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2)+Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new n9(a,s);return at[n]=f,{data:f,interval:new it(t.x,t.y,t.z)}}var an=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=ar(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(n4(1-t,0))return e.points[299].point.clone().add(this.interval);if(n4(e.totalLength,0))return this.p1.clone();var i=new it,r=n5(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(n4(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=n5(e.points[a].partialLength,5)):s<0&&a>0?(n-=n5(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),aa=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new rh,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):n4(1-t,0)?this.temp.copyFrom(this.p2):(ah.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),ao=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new e7,this.control2=new e7,this.weighted=!1,this.isConstant=!1,this.mSampleValues=Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),ae(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,o=a*a,s=n*n;return o*a*t+e*o*n*3+i*a*s*3+s*n*r},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=ae(.1*t,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,a=ai(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=ai(e,i,r);if(0===a)break;var o=ae(e,i,r)-t;e-=o/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=ae(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,(this.control1.x!==this.control1.y||this.control2.x!==this.control2.y)&&this.calcSampleValues()},t}();function as(t,e){var i,r,n,a=au(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;iS(u),iS(h);var l=h.x-o.x,c=h.y-o.y,f=n5((s.x-o.x)/l,5),d=n5((u.x-o.x)/l,5);n4(c,0)?i=r=NaN:(i=n5((s.y-o.y)/c,5),r=n5((u.y-o.y)/c,5)),f<0&&(f=0),d<0&&(d=0),f>1&&(f=1),d>1&&(d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return n7[p]?n=n7[p]:(n=n4(c,0)?new ao:new ao(f,i,d,r),n7[p]=n),{points:[o,s,u,h],timeInterval:l,valueInterval:c,curve:n}}function au(t,e,i){var r=t[1],n=n8.isHoldOutKeyframe(t),a=n8.isHoldInKeyframe(e),o=!a&&n8.isRightSideEase(t),s=!n&&n8.isLeftSideEase(e);if(o&&!s&&!a){var u=new e7(r[r.length-4],r[r.length-3]),h=new e7(r[r.length-2],r[r.length-1]),l=n8.getPointInCurve(e),c=new e7(l.x,l.y),f=new e7(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:h,p2:f,p3:c}}if(!o&&s&&!n){var d=e[1],p=n8.getPointInCurve(t),m=new e7(p.x,p.y),v=new e7(d[0],d[1]),y=new e7(d[2],d[3]),g=new e7(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new e7(r[r.length-4],r[r.length-3]),p1:new e7(r[r.length-2],r[r.length-1]),p2:new e7(x[0],x[1]),p3:new e7(x[2],x[3])}}var b=n8.getPointInCurve(t),T=n8.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var S=new e7((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),E=new e7((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"line",p0:b,p1:S,p2:E,p3:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var ah=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=h,t.z=l,t.w=c;return}if(s!==c||n!==u||a!==h||o!==l){var f=1-r,d=n*u+a*h+o*l+s*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,o=o*f+l*g,s=s*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),al="not_implement",ac=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(al)},e.getIntegrateValue=function(t,e,i){throw Error(al)},e.getIntegrateByTime=function(t,e){throw Error(al)},e.getValue=function(t){throw Error(al)},e.getMaxTime=function(){throw Error(al)},e.toUniform=function(t){throw Error(al)},e.map=function(t){throw Error(al)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(al)},t.getAllData=function(t,e){for(var i=new(e?nZ:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),af=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(ac),ad=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(ac),ap=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(ac),am=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(ac),av=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return aE(e,0,this.xCoord,this.min,this.max)-aE(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(ac),ay=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=io(t)},i.getStops=function(){return this.stops},i.getValue=function(t){var e=this.stops;if(0===e.length)return[0,0,0,0];if(t<=e[0].time)return e[0].color.toArray();var i=e.length-1;if(t>=e[i].time)return e[i].color.toArray();for(var r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.time<=t&&a.time>t){var o=(t-n.time)/(a.time-n.time);return is(n.color.toArray(),a.color.toArray(),o,!0)}}return e[i].color.toArray()},e}(ac),ag=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?aE:aS,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,s[1],u[1]);r+=a(l,h,l,s[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(ac),ax=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(ac),ab=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=new it(i[n][0],i[n][1],i[n][2]),u=new it(i[n+1][0],i[n+1][1],i[n+1][2]),h=new it(r[2*n][0],r[2*n][1],r[2*n][2]),l=new it(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=as(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new an(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=n5(t,5),i=0,r=new it,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=this.curveSegments[n[s]].timeStart,h=this.curveSegments[n[s]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=n5((e-r.x)/n,4);return e9(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(ac),aT=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=rh.fromArray(i[n]),u=rh.fromArray(i[n+1]),h=rh.fromArray(r[2*n]),l=rh.fromArray(r[2*n+1]),c=as(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new aa(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=n5(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],h=s[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=n5((e-r.x)/n,4);return e9(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(ac);function aS(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function aE(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function aC(t,e){if(e){var i=e[0],r=e[1];if(i===t4.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===t4.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===t4.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function aw(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function a_(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(a_=function(){return!!t})()}function aM(t,e,i){return(aM=a_()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&iH(n,i.prototype),n}).apply(null,arguments)}var aA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new ie,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aF(t[0]),this.yCurve=aF(t[1]),this.zCurve=aF(t[2]),this.wCurve=aF(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(ac),aP=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new it,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aF(t[0]),this.yCurve=aF(t[1]),this.zCurve=aF(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(ac),aI=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new e7,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aF(t[0]),this.yCurve=aF(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(ac);t.TangentMode=void 0,(tg=t.TangentMode||(t.TangentMode={}))[tg.Cubic=0]="Cubic",tg[tg.Linear=1]="Linear",tg[tg.Constant=2]="Constant",t.WeightedMode=void 0,(tx=t.WeightedMode||(t.WeightedMode={}))[tx.None=0]="None",tx[tx.In=1]="In",tx[tx.Out=2]="Out",tx[tx.Both=3]="Both";var aR=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=aO(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=function(t,e){var i,r,n,a=new e7(t.time,t.value),o=new e7,s=new e7,u=new e7,h=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,l=2===t.tangentMode,c=(h?t.outWeight:1)*(e.time-t.time)/3;o.x=t.time+c,o.y=t.value+c*(l?0:t.outSlope);var f=(h?e.inWeight:1)*(e.time-t.time)/3;s.x=e.time-f,s.y=e.value-f*(l?0:e.inSlope),u.x=e.time,u.y=l?t.value:e.value,iS(s),iS(u);var d=u.x-a.x,p=u.y-a.y,m=n5((o.x-a.x)/d,5),v=n5((s.x-a.x)/d,5);n4(p,0)?i=r=NaN:(i=n5((o.y-a.y)/p,5),r=n5((s.y-a.y)/p,5)),m<0&&(m=0),v<0&&(v=0),m>1&&(m=1),v>1&&(v=1);var y=("bez_"+m+"_"+i+"_"+v+"_"+r).replace(/\./g,"p");return n7[y]?n=n7[y]:(n=n4(p,0)?new ao:h?new ao(m,i,v,r):new ao(i,r),n7[y]=n),{points:[a,o,s,u],timeInterval:d,valueInterval:p,curve:n}}(e[i],e[i+1]),n=r.points,a=r.curve,o=r.timeInterval,s=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:o,valueInterval:s,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var o=this.curveInfos[r],s=o.points[0],u=o.timeInterval,h=o.valueInterval,l=(t-s.x)/u,c=0;c=1===this.keyFrames[r].tangentMode?l:o.curve.getValue(l),e=s.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var h=u*s/n,l=r.y+a*i.curve.getValue(h);0===u||20===u?o+=l:u%2==1?o+=4*l:o+=2*l}return s/3*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(ac);function aO(t){for(var e=[],i=[],r={x:0,y:0},n=0;n<t.length;n++){var a=t[n],o=au(a,n+1<t.length?t[n+1]:t[n],!0),s=o.p0,u=o.p1,h=o.p2,l=o.p3,c=o.type;iS(h),iS(l);var f={leftControl:r,value:s,rightControl:u,tangentMode:"line"===c?1:0};a[0]===t5.HOLD&&(f.tangentMode=2),i.push(f),r=h}for(var d=function(t,e){return(e.y-t.y)/(e.x-t.x+1e-6)},p=0;p<i.length;p++){var m=i[p].leftControl,v=i[p].value,y=i[p].rightControl,g=0,x=0;p>0&&(g=d(m,v)),p<i.length-1&&(x=d(v,y));var b={time:v.x,value:v.y,inSlope:g,outSlope:x,inWeight:0,outWeight:0,tangentMode:i[p].tangentMode,weightedMode:3};e.push(b),p>0&&(b.inWeight=(v.x-m.x)/((v.x-i[p-1].value.x)/3)),p+1<i.length&&(b.outWeight=(y.x-v.x)/((i[p+1].value.x-v.x)/3))}return e}var aV=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyframes=t},i.getValue=function(t){var e=this.keyframes;if(0!==e.length){for(var i=e[0][1],r=0;r<e.length;r++)if(e[r][0]<=(null!=t?t:0))i=e[r][1];else break;return i}},e}(ac),aN=((eN={})[t4.RANDOM]=function(t){return eZ(t[0],Array)?new am(t):new ap(t)},eN[t4.CONSTANT]=function(t){return new af(t)},eN[t4.CONSTANT_VEC2]=function(t){return new af(t)},eN[t4.CONSTANT_VEC3]=function(t){return new af(t)},eN[t4.CONSTANT_VEC4]=function(t){return new af(t)},eN[t4.RGBA_COLOR]=function(t){return new af(t)},eN[t4.COLORS]=function(t){return new ad(t.map(function(t){return ir(t,!1)}))},eN[t4.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new av([t[0][1],t[1][1]]):new ag(t)},eN[t4.GRADIENT_COLOR]=function(t){return new ay(t)},eN[t4.LINEAR_PATH]=function(t){return new ax(t)},eN[t4.BEZIER_CURVE]=function(t){return 1===t.length?new af(t[0][1][1]):new aR(t)},eN[t4.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new af(aM(it,[].concat(t[1][0]))):new ab(t)},eN[t4.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new af(aM(rh,[].concat(t[1][0]))):new aT(t)},eN[t4.COLOR_CURVE]=function(t){return new aL(t)},eN[t4.VECTOR4_CURVE]=function(t){return new aA(t)},eN[t4.VECTOR2_CURVE]=function(t){return new aI(t)},eN[27]=function(t){return new aP(t)},eN[28]=function(t){return new aV(t)},eN);function aF(t){if(!t||!isNaN(+t))return new af(t||0);if(eZ(t,ac))return t;if(iI(aN[t[0]]))return aN[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nz["ValueType: 21/22 is not supported"]+".")}var aL=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new ii,e}iY(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=aF(t[0]),this.gCurve=aF(t[1]),this.bCurve=aF(t[2]),this.aCurve=aF(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(ac),aD=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},rk(t,null,[{key:"shared",get:function(){return ak.x=0,ak.y=0,ak}}]),t}(),ak=new aD;function aB(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(l,c),s.push(f,d),2}function az(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);s&&l<c?l+=2*Math.PI:!s&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.sqrt(u*u+h*h),m=(15*Math.abs(d)*Math.sqrt(p)/Math.PI>>0)+1,v=d/m;if(f+=v,s){o.push(t,e),o.push(i,r);for(var y=1,g=f;y<m;y++,g+=v)o.push(t,e),o.push(t+Math.sin(g)*p,e+Math.cos(g)*p);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var x=1,b=f;x<m;x++,b+=v)o.push(t+Math.sin(b)*p,e+Math.cos(b)*p),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*m}function aU(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var l=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var o=t[r],s=t[r+1];i+=(o-n)*(s+a),n=o,a=s}return i<0?-1:1}(t);i&&(l*=-1),h=(h-.5)*l+.5}var c=new aD(t[0],t[1]),f=new aD(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(c.x-f.x)&&1e-4>Math.abs(c.y-f.y);if(r){t=t.slice(),d&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));var p=(c.x+f.x)*.5,m=(f.y+c.y)*.5;t.unshift(p,m),t.push(p,m)}var v=t.length/2,y=t.length,g=n.length/2,x=e.width/2,b=x*x,T=e.miterLimit*e.miterLimit,S=t[0],E=t[1],C=t[2],w=t[3],_=0,M=0,A=-(E-w),P=S-C,I=0,R=0,O=Math.sqrt(A*A+P*P)+1e-6;A/=O,P/=O,A*=x,P*=x;var V=h,N=(1-V)*2,F=2*V;r||(e.cap===ev.Round?y+=az(S-A*(N-F)*.5,E-P*(N-F)*.5,S-A*N,E-P*N,S+A*F,E+P*F,n,!0)+2:e.cap===ev.Square&&(y+=aB(S,E,A,P,N,F,!0,n))),n.push(S-A*N,E-P*N),n.push(S+A*F,E+P*F);for(var L=1;L<v-1;++L){S=t[(L-1)*2],E=t[(L-1)*2+1],C=t[2*L],w=t[2*L+1],_=t[(L+1)*2],M=t[(L+1)*2+1],O=Math.sqrt((A=-(E-w))*A+(P=S-C)*P)+1e-6,A/=O,P/=O,A*=x,P*=x,O=Math.sqrt((I=-(w-M))*I+(R=C-_)*R)+1e-6,I/=O,R/=O,I*=x,R*=x;var D=C-S,k=E-w,B=C-_,z=M-w,U=D*B+k*z,G=k*B-z*D,W=G<0;if(Math.abs(G)<.001*Math.abs(U)){n.push(C-A*N,w-P*N),n.push(C+A*F,w+P*F),U>=0&&(e.join===ey.Round?y+=az(C,w,C-A*N,w-P*N,C-I*N,w-R*N,n,!1)+4:y+=2,n.push(C-I*F,w-R*F),n.push(C+I*N,w+R*N));continue}var j=(-A+S)*(-P+w)-(-A+C)*(-P+E),X=(-I+_)*(-R+w)-(-I+C)*(-R+M),H=(D*X-B*j)/G,Y=(z*j-k*X)/G,Z=(H-C)*(H-C)+(Y-w)*(Y-w),q=C+(H-C)*N,K=w+(Y-w)*N,Q=C-(H-C)*F,J=w-(Y-w)*F,$=W?N:F;Z<=Math.min(D*D+k*k,B*B+z*z)+$*$*b?e.join===ey.Bevel||Z/b>T?(W?(n.push(q,K),n.push(C+A*F,w+P*F),n.push(q,K),n.push(C+I*F,w+R*F)):(n.push(C-A*N,w-P*N),n.push(Q,J),n.push(C-I*N,w-R*N),n.push(Q,J)),y+=2):e.join===ey.Round?W?(n.push(q,K),n.push(C+A*F,w+P*F),y+=az(C,w,C+A*F,w+P*F,C+I*F,w+R*F,n,!0)+4,n.push(q,K),n.push(C+I*F,w+R*F)):(n.push(C-A*N,w-P*N),n.push(Q,J),y+=az(C,w,C-A*N,w-P*N,C-I*N,w-R*N,n,!1)+4,n.push(C-I*N,w-R*N),n.push(Q,J)):(n.push(q,K),n.push(Q,J)):(n.push(C-A*N,w-P*N),n.push(C+A*F,w+P*F),e.join===ey.Round?W?y+=az(C,w,C+A*F,w+P*F,C+I*F,w+R*F,n,!0)+2:y+=az(C,w,C-A*N,w-P*N,C-I*N,w-R*N,n,!1)+2:e.join===ey.Miter&&Z/b<=T&&(W?(n.push(Q,J),n.push(Q,J)):(n.push(q,K),n.push(q,K)),y+=2),n.push(C-I*N,w-R*N),n.push(C+I*F,w+R*F),y+=2)}S=t[(v-2)*2],E=t[(v-2)*2+1],C=t[(v-1)*2],O=Math.sqrt((A=-(E-(w=t[(v-1)*2+1])))*A+(P=S-C)*P)+1e-6,A/=O,P/=O,A*=x,P*=x,n.push(C-A*N,w-P*N),n.push(C+A*F,w+P*F),r||(e.cap===ev.Round?y+=az(C-A*(N-F)*.5,w-P*(N-F)*.5,C-A*N,w-P*N,C+A*F,w+P*F,n,!1)+2:e.cap===ev.Square&&(y+=aB(C,w,A,P,N,F,!1,n)));for(var tt=g;tt<y+g-2;++tt)S=n[2*tt],E=n[2*tt+1],C=n[(tt+1)*2],w=n[(tt+1)*2+1],_=n[(tt+2)*2],1e-8>Math.abs(S*(w-(M=n[(tt+2)*2+1]))+C*(M-E)+_*(E-w))||s.push(tt,tt+1,tt+2)}}var aG=function(){},aW=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}iY(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,o=r-a,s=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(o*o)+c*c/(s*s)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t,e){var i=this.x,r=this.y,n=this.halfWidth,a=this.halfHeight;if(!(n>=0&&a>=0))return t;var o=Math.ceil(Math.sqrt((null!=e?e:1)*(n+a))),s=8*o+0+0;if(0===s)return t;if(0===o)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,t[5]=t[7]=r-0,t;var u=0,h=4*o+0+2,l=h,c=s,f=0+n,d=0,p=i+f,m=i-f,v=r+0;t[u++]=p,t[u++]=v,t[--h]=v,t[--h]=m;for(var y=1;y<o;y++){var g=Math.PI/2*(y/o),x=0+Math.cos(g)*n,b=0+Math.sin(g)*a,T=i+x,S=i-x,E=r+b,C=r-b;t[u++]=T,t[u++]=E,t[--h]=E,t[--h]=S,t[l++]=S,t[l++]=C,t[--c]=C,t[--c]=T}f=0,d=0+a,p=i+f,m=i-f,v=r+d;var w=r-d;return t[u++]=p,t[u++]=v,t[--c]=w,t[--c]=p,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(aG),aj=function(t){function e(e,i,r,n,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(o=t.call(this)||this).x=e,o.y=i,o.width=r,o.height=n,o.roundness=a,o}iY(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t,e){var i,r=this.width/2,n=this.height/2,a=this.x+r,o=this.y+n,s=i=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,n)),u=r-s,h=n-i;if(s>=0&&i>=0&&u>=0&&h>=0){var l=Math.ceil(Math.sqrt((null!=e?e:1)*(s+i))),c=8*l+(u?4:0)+(h?4:0);if(0!==c){if(0===l){t[0]=t[6]=a+u,t[1]=t[3]=o+h,t[2]=t[4]=a-u,t[5]=t[7]=o-h;return}var f=0,d=4*l+(u?2:0)+2,p=d,m=c,v=u+s,y=h,g=a+v,x=a-v,b=o+y;if(t[f++]=g,t[f++]=b,t[--d]=b,t[--d]=x,h){var T=o-y;t[p++]=x,t[p++]=T,t[--m]=T,t[--m]=g}for(var S=1;S<l;S++){var E=Math.PI/2*(S/l),C=u+Math.cos(E)*s,w=h+Math.sin(E)*i,_=a+C,M=a-C,A=o+w,P=o-w;t[f++]=_,t[f++]=A,t[--d]=A,t[--d]=M,t[p++]=M,t[p++]=P,t[--m]=P,t[--m]=_}v=u,y=h+i,g=a+v,x=a-v,b=o+y;var I=o-y;t[f++]=g,t[f++]=b,t[--m]=I,t[--m]=g,u&&(t[f++]=x,t[f++]=b,t[--m]=I,t[--m]=x)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(aG),aX=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).x=e,s.y=i,s.x2=r,s.y2=n,s.x3=a,s.y3=o,s}iY(e,t);var i=e.prototype;return i.contains=function(t,e){var i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),r=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=r<0&&0!==i&&0!==r)return!1;var n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return 0===n||n<0==i+r<=0},i.clone=function(){return new e(this.x,this.y,this.x2,this.y2,this.x3,this.y3)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getBounds=function(t){t=t||new aj;var e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),r=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=r,t.width=i-e,t.height=n-r,t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t,e){t[0]=this.x,t[1]=this.y,t[2]=this.x2,t[3]=this.y2,t[4]=this.x3,t[5]=this.y3},i.triangulate=function(t,e,i,r,n){var a=0;e[(i*=2)+0]=t[0],e[i+a+1]=t[1],e[i+(a+=2)]=t[2],e[i+a+1]=t[3],e[i+(a+=2)]=t[4],e[i+a+1]=t[5];var o=i/2;r[n++]=o,r[n++]=o+1,r[n++]=o+2},e}(aG);function aH(t,e,i,r,n,a,o,s,u,h,l,c){var f=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/(null!=l?l:1);return function t(e,i,r,n,a,o,s,u,h,l,c,f,d,p){if(void 0===d&&(d=0),void 0===p&&(p=1),!(c>8)){var m=(e+r)/2,v=(i+n)/2,y=(r+a)/2,g=(n+o)/2,x=(a+s)/2,b=(o+u)/2,T=(m+y)/2,S=(v+g)/2,E=(y+x)/2,C=(g+b)/2,w=(T+E)/2,_=(S+C)/2,M=(d+p)/2;if(c>0){var A=s-e,P=u-i,I=Math.abs((r-s)*P-(n-u)*A),R=Math.abs((a-s)*P-(o-u)*A);if(I>11920929e-14&&R>11920929e-14){if((I+R)*(I+R)<=l*(A*A+P*P)){h.push(w,_),null==f||f.push(M);return}}else if(I>11920929e-14){if(I*I<=l*(A*A+P*P)){h.push(w,_),null==f||f.push(M);return}}else if(R>11920929e-14){if(R*R<=l*(A*A+P*P)){h.push(w,_),null==f||f.push(M);return}}else if((A=w-(e+s)/2)*A+(P=_-(i+u)/2)*P<=l){h.push(w,_),null==f||f.push(M);return}}t(e,i,m,v,T,S,w,_,h,l,c+1,f,d,M),t(w,_,E,C,x,b,s,u,h,l,c+1,f,M,p)}}(e,i,r,n,a,o,s,u,t,f*=f,0,c),t.push(s,u),null==c||c.push(1),t}var aY="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},aZ={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function s(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function l(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function c(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=K(t),t.a.c=t.c,m(t,K(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=K(e),e.a.c=e.c,m(e,K(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,K(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var S,E=4*1e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function _(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function M(t,e){c(t.a),t.c=!1,t.a=e,e.i=t}function A(t){var e=t.a.a;do t=tl(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),M(t,e),t=tl(t)),t}function P(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function I(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function R(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,_(t)}function O(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){R(t);break}M(r,n=d(e.c.b,n.b))}e.c!==n&&(l(K(n),n),l(e,n)),R(t),e=r.a,t=r}return e}function V(t,e,i,r,n,a){var o=!0;do P(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(l(K(i),i),l(K(n),i)),r.f=e.f-i.f,r.d=I(t,r.f),e.b=!0,!o&&D(t,e)&&(C(i,n),_(e),c(n)),o=!1,e=r,n=i;e.b=!0,a&&B(t,e)}function N(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function F(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,N(t,e.a,r,[.5,.5,0,0],!1),l(e,i)}function L(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function D(t,r){var a=th(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,h=a.d,c=a.e,d=a.c,p=d[u];h[p]=h[a.a],d[h[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(c[h[p>>1]],c[h[p]])?to(a,p):ts(a,p)),c[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;F(t,K(s),o)}}else f(s.b),l(o,K(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tl(r).b=r.b=!0,f(o.b),l(K(s),o)}return!0}function k(t,h){var c=th(h),d=h.a,p=c.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,S=y,E=m,C=g,w=v;if(i(S,E)||(b=S,S=E,E=b),i(C,w)||(b=C,C=w,w=b),i(S,C)||(b=S,S=C,C=b,b=E,E=w,w=b),i(C,E)?i(E,w)?(0>(b=r(S,C,E))+(T=r(C,E,w))&&(b=-b,T=-T),x.b=u(b,C.b,T,E.b)):(0>(b=n(S,C,E))+(T=-n(S,w,E))&&(b=-b,T=-T),x.b=u(b,C.b,T,w.b)):x.b=(C.b+E.b)/2,a(S,E)||(b=S,S=E,E=b),a(C,w)||(b=C,C=w,w=b),a(S,C)||(b=S,S=C,C=b,b=E,E=w,w=b),a(C,E)?a(E,w)?(0>(b=o(S,C,E))+(T=o(C,E,w))&&(b=-b,T=-T),x.a=u(b,C.a,T,E.a)):(0>(b=s(S,C,E))+(T=-s(S,w,E))&&(b=-b,T=-T),x.a=u(b,C.a,T,w.a)):x.a=(C.a+E.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),S=i(m,v)?m:v,i(S,x)&&(x.b=S.b,x.a=S.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),l(p.b,d),d=th(h=A(h)).a,O(t,th(h),c),V(t,h,K(d),d,d,!0),!0;if(y===t.a){f(p.b),l(d.e,K(p)),v=(m=c=h).a.b.a;do m=tl(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,c.a=K(p),p=O(t,c,null),V(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tl(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=c.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),l(K(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,L(d,m,y,p,0),L(d,v,g,p,2),N(t,d,x,p,!0),tl(h).b=h.b=c.b=!0,!1}function B(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tl(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=th(a=e),h=a.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){a=!1;break t}tl(a).b=a.b=!0,p=f(h),l(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,h.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),l(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(_(r),c(s),s=(r=th(e)).a):e.c&&(_(e),c(o),o=(e=tl(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)D(t,e);else if(k(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),_(e),c(o),e=tl(r))}}function z(t,e){var i=new tu,r=h(t.b);r.a.b=E,r.a.a=e,r.b.a.b=-E,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function U(t){this.a=new W,this.b=t,this.c=w}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new W(i,e.a,e),e.a.c=t,e.a=t}function W(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function j(){this.d=X,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var X=0;function H(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case X:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function K(t){return t.b.e}function Q(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[s],n[h])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[s])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tl(t){return t.e.a.b}(S=j.prototype).x=function(){H(this,X)},S.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:Y(this,100900);return}Y(this,100901)},S.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(this,100900)}return!1},S.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},S.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Y(this,100900)}},S.C=function(t,e){var i=!1,r=[0,0,0];H(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?l(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},S.u=function(t){H(this,X),this.d=1,this.b=new Q,this.c=t},S.t=function(){H(this,1),this.d=2,this.q=null},S.v=function(){H(this,2),this.d=1},S.w=function(){H(this,1),this.d=X;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,h=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])h[0]=0,h[1]=0,h[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>o&&(o=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=o&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<h[v]?1:-1,h=a.e;h!==a;h=h.e)h.b=h.g[o],h.a=v*h.g[s];if(u){for(h=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do h+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,a=(h=this.b.b).h;a!==h;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(F(this,o,a),c(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),c(o)),(a===u||a===u.b)&&(u=u.h),c(a));for(this.e=h=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(h,a);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)to(t,e);t.h=!0}(t.b)}(h),this.f=new U(this),z(this,-E),z(this,E);null!==(h=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,h))break;u=te(this.e),F(this,h.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var h=o.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=h.a).a,s)||e(u.b.a,s)||(f(u.b),h.c&&(c(u.c),h.c=!1),l(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?M(v,m):(u=o,(h=P(o,h,m)).f=tl(h).f+h.a.f,h.d=I(u,h.f)),t(o,s)):V(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=A(o.i))).a,(u=O(r,u,null)).c===h){var h=u,u=h.c,p=th(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,o),e(m.a,r.a)&&(l(K(u),m),u=th(o=A(o)).a,O(r,th(o),p),y=!0),e(v.a,r.a)&&(l(h,K(v)),h=O(r,p,null),y=!0),y?V(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?K(v):m,V(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,B(r,o))}else V(r,o,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,_(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,a=(h=this.b).a.b;a!==h.a;a=u)u=a.b,(a=a.a).e.e===a&&(C(a.c,a),c(a));if(!this.n){if(h=this.b,this.m)for(a=h.b.h;a!==h.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:c(a);else for(a=h.a.b;a!==h.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,a=!1,o=-1,s=h.a.d;s!==h.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(h=this.b).a.b;a!==h.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,K(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,K(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},aY.libtess={GluTesselator:j,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},j.prototype.gluDeleteTess=j.prototype.x,j.prototype.gluTessProperty=j.prototype.B,j.prototype.gluGetTessProperty=j.prototype.y,j.prototype.gluTessNormal=j.prototype.A,j.prototype.gluTessCallback=j.prototype.z,j.prototype.gluTessVertex=j.prototype.C,j.prototype.gluTessBeginPolygon=j.prototype.u,j.prototype.gluTessBeginContour=j.prototype.t,j.prototype.gluTessEndContour=j.prototype.v,j.prototype.gluTessEndPolygon=j.prototype.w,t.exports=aY.libtess}(aZ);var aq=((tb=new aZ.exports.GluTesselator).gluTessCallback(aZ.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==aZ.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tb.gluTessCallback(aZ.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tb);function aK(t){aq.gluTessNormal(0,0,1);var e=[];aq.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){aq.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];aq.gluTessVertex(a,a)}aq.gluTessEndContour()}return aq.gluTessEndPolygon(),e}t.StarType=void 0,(tT=t.StarType||(t.StarType={}))[tT.Star=0]="Star",tT[tT.Polygon=1]="Polygon";var aQ=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).pointCount=e,s.outerRadius=i,s.innerRadius=r,s.outerRoundness=n,s.innerRoundness=a,s.starType=o,s.v=[],s.in=[],s.out=[],s}iY(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t,e){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var i=null!=e?e:1,r=0;r<this.v.length-2;r+=2)aH(t,this.v[r],this.v[r+1],this.out[r],this.out[r+1],this.in[r+2],this.in[r+3],this.v[r+2],this.v[r+3],void 0,i);var n=this.v.length-1;aH(t,this.v[n-1],this.v[n],this.out[n-1],this.out[n],this.in[0],this.in[1],this.v[0],this.v[1],void 0,i)},i.triangulate=function(t,e,i,r,n){for(var a=aK([t]),o=e.length/2,s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,o=!0,s=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*s/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=o?s:u,i=o?h:l,r=o?c:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,o=!o,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),o=-(.5*Math.PI);for(t=0;t<e;t++){var s=r*Math.cos(o),u=r*Math.sin(o),h=0===s&&0===u?0:u/Math.sqrt(s*s+u*u),l=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),c=2*t;this.v[c]=s,this.v[c+1]=u,this.in[c]=s+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=s-h*a*n*1,this.out[c+1]=u-l*a*n*1,o+=1*i}},e}(aG),aJ=function(t){function e(e,i,r){var n;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),(n=t.call(this)||this).x=e,n.y=i,n.radius=r,n}iY(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.radius)},i.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i},i.strokeContains=function(t,e,i,r){if(void 0===r&&(r=.5),0===this.radius)return!1;var n=this.x-t,a=this.y-e,o=this.radius,s=(1-r)*i,u=Math.sqrt(n*n+a*a);return u<=o+s&&u>o-(i-s)},i.getBounds=function(t){return t||(t=new aj),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t,e){var i=this.x,r=this.y,n=this.radius,a=this.radius;if(!(n<=0)){var o=Math.ceil(Math.sqrt((null!=e?e:1)*(n+a))),s=8*o+0+0;if(0!==s){if(0===o){t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,t[5]=t[7]=r-0;return}var u=0,h=4*o+0+2,l=h,c=s,f=0+n,d=0,p=i+f,m=i-f,v=r+0;t[u++]=p,t[u++]=v,t[--h]=v,t[--h]=m;for(var y=1;y<o;y++){var g=Math.PI/2*(y/o),x=0+Math.cos(g)*n,b=0+Math.sin(g)*a,T=i+x,S=i-x,E=r+b,C=r-b;t[u++]=T,t[u++]=E,t[--h]=E,t[--h]=S,t[l++]=S,t[l++]=C,t[--c]=C,t[--c]=T}f=0,d=0+a,p=i+f,m=i-f,v=r+d;var w=r-d;t[u++]=p,t[u++]=v,t[--c]=w,t[--c]=p}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(aG),a$=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}iY(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];s>e!=h>e&&t<(e-s)/(h-s)*(u-o)+o&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t,e){for(var i=0;i<this.points.length;i++)t[i]=this.points[i]},i.triangulate=function(t,e,i,r,n){var a=aK([t]),o=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw Error("Invalid points array");if(2===t.length){e.push(t[0],t[1],t[0],t[1],t[0],t[1]);return}var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],o=t[0],s=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>o&&(o=h,s=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},rk(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(aG);t.UpdateModes=void 0,(tS=t.UpdateModes||(t.UpdateModes={}))[tS.EveryUpdate=0]="EveryUpdate",tS[tS.Manual=1]="Manual",t.CompositionComponent=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.items=[],i.state=t.PlayState.Stopped,i.updateMode=0,i.playOnStart=!1,i.endBehavior=t6.forward,i.time=0,i.lastTime=0,i.sceneBindings=[],i.timelineAsset=null,i._timelineInstance=null,i.nestedCompositions=[],i}iY(i,e);var r=i.prototype;return r.onStart=function(){this.playOnStart&&this.play()},r.pause=function(){this.state=t.PlayState.Paused;for(var e,i=iQ(this.nestedCompositions);!(e=i()).done;)e.value.pause()},r.play=function(){this.state=t.PlayState.Playing;for(var e,i=iQ(this.nestedCompositions);!(e=i()).done;)e.value.play()},r.stop=function(){this.state=t.PlayState.Stopped,this.time=0,this.lastTime=0;for(var e,i=iQ(this.nestedCompositions);!(e=i()).done;)e.value.stop()},r.getTime=function(){return this.time},r.setTime=function(t){this.time=t},r.onUpdate=function(e){this.state===t.PlayState.Playing&&0===this.updateMode&&this.tick(e/1e3)},r.tick=function(t){if(this.timelineInstance){var e=this.time;if(n4(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case t6.forward:break;case t6.freeze:e=this.item.duration;break;case t6.restart:e%=this.item.duration;break;case t6.destroy:this.item.dispose();return}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},r.onEnable=function(){this.item.getDescendants(!1,function(t){return t.setActive(!0),!1})},r.onDisable=function(){this.item.getDescendants(!1,function(t){return t.setActive(!1),!1})},r.onDestroy=function(){this.item.getDescendants().forEach(function(t){return t.dispose()})},r.setChildrenRenderOrder=function(e){if(!this.timelineInstance)return e;var r=[];this.collectChildren(this.item,r);for(var n,a=new Set,o=iQ(this.timelineInstance.masterTrackInstances);!(n=o()).done;){var s=n.value;eZ(s.boundObject,t.VFXItem)&&a.add(s.boundObject)}for(var u=[],h=0;h<r.length;h++)a.has(r[h])&&u.push(h);for(var l,c=[],f=iQ(this.timelineInstance.masterTrackInstances);!(l=f()).done;){var d=l.value;eZ(d.boundObject,t.VFXItem)&&c.push(d.boundObject)}for(var p=0;p<u.length&&p<c.length;p++)r[u[p]]=c[p];for(var m,v=iQ(r);!(m=v()).done;){var y=m.value,g=e++;y.isManuallySetRenderOrder||y.setRendererComponentOrder(g);var x=y.getComponent(i);x&&(e=x.setChildrenRenderOrder(e))}return e},r.collectChildren=function(e,i){for(var r,n=iQ(e.children);!(r=n()).done;){var a=r.value;i.push(a),t.VFXItem.isComposition(a)||this.collectChildren(a,i)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this._timelineInstance=null},rk(i,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new uz(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var e,r=iQ(this._timelineInstance.masterTrackInstances);!(e=r()).done;){var n=e.value.boundObject;if(eZ(n,t.VFXItem)&&t.VFXItem.isComposition(n)){var a=n.getComponent(i);a.updateMode=1,this.nestedCompositions.push(a)}}}return this._timelineInstance}}]),i}(rB),eq([i3(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),eq([i3(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),eq([i3(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=eq([i1("CompositionComponent")],t.CompositionComponent),t.FilterMode=void 0,(tE=t.FilterMode||(t.FilterMode={}))[tE.Nearest=0]="Nearest",tE[tE.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tC=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tC.RGBA32=0]="RGBA32",tC[tC.RGBAHalf=1]="RGBAHalf";var a0=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rk(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}();t.RenderPassAttachmentStorageType=void 0,(tw=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[tw.none=0]="none",tw[tw.color=1]="color",tw[tw.stencil_8_opaque=2]="stencil_8_opaque",tw[tw.depth_16_opaque=3]="depth_16_opaque",tw[tw.depth_stencil_opaque=4]="depth_stencil_opaque",tw[tw.depth_16_texture=5]="depth_16_texture",tw[tw.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(t_=t.TextureStoreAction||(t.TextureStoreAction={}))[t_.store=0]="store",t_[t_.clear=2]="clear";var a1=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(eZ(r,no))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,h=r.internalFormat,l=r.format,c=void 0===l?rG.RGBA:l,f=r.type,d=void 0===f?rG.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:c,type:d,internalFormat:h||c,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=no.create(e,ro({},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)},rk(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,(tM=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tM.force=0]="force",tM[tM.keep=1]="keep",tM[tM.keepExternal=2]="keepExternal",tM[tM.destroy=0]="destroy";var a2=1,a3=function(){function e(t){this.priority=0,this.name="RenderPass"+a2++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var i=e.prototype;return i.addMesh=function(t){ib(this.meshes,t)},i.removeMesh=function(t){e2(this.meshes,t)},i.configure=function(t){},i.execute=function(t){},i.onCameraCleanup=function(t){},i.getViewport=function(){var t,e=null==(t=this.framebuffer)?void 0:t.viewport;if(e)return e;var i=this.renderer;return i?[0,0,i.getWidth(),i.getHeight()]:[0,0,0,0]},i.dispose=function(e){if(!this.disposed){var i=(null==e?void 0:e.meshes)||void 0;i!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(i)}),this.meshes.length=0,this.disposed=!0}},rk(e,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),e}(),a4=function(e){function i(t){var i;return(i=e.call(this,t)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}iY(i,e);var r=i.prototype;return r.setup=function(t){this.useRenderTarget=t},r.configure=function(e){this.useRenderTarget&&(this.framebuffer=e.getTemporaryRT("DrawObjectPass",e.getWidth(),e.getHeight(),16,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf),e.setFramebuffer(this.framebuffer))},r.execute=function(e){this.useRenderTarget&&e.clear({colorAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear}),this.meshes.sort(function(t,e){return t.priority-e.priority}),e.renderMeshes(this.meshes)},r.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},i}(a3),a5=1,a6=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).name="",n.subMeshes=[],n.mode=4,n.instanceCount=0,n.vertexBuffers={},n.indices=new Uint16Array(0),n.drawCount=0,n.drawStart=0,n.skin={},n.disposed=!1,n.initialized=!1,n.bufferUsage=t.BufferUsage.Static,a9(i)&&(n.vertexArrayObjects={}),r&&n.processProps(r),n}iY(i,e);var r=i.prototype;return r.isDisposed=function(){return this.disposed},r.getOptions=function(){return this.options?ro({},this.options):void 0},r.getVertexBuffer=function(t){return this.vertexBuffers[t]},r.getVertexBuffers=function(){return this.vertexBuffers},r.setVerticesBuffer=function(t,e){void 0===e&&(e=!0);var i=t.getKind(),r=this.vertexBuffers[i];r&&e&&r.dispose(),t.ownsBuffer&&t.buffer.increaseReferences(),this.vertexBuffers[i]=t,this.disposeVertexArrayObjects()},r.getAttributeBuffer=function(t){var e;return null==(e=this.vertexBuffers[t])?void 0:e.getWrapperBuffer()},r.getAttributeData=function(t){var e;return null==(e=this.vertexBuffers[t])?void 0:e.getData()},r.setAttributeData=function(t,e){var i=this.vertexBuffers[t];i&&(i.update(e),this.disposeVertexArrayObjects())},r.setAttributeSubData=function(t,e,i){var r=this.vertexBuffers[t];if(r){var n=r.getWrapperBuffer(),a=n.byteStride>0?Math.ceil(i.byteLength/n.byteStride):0;n.updateDirectly(i,e,a),this.disposeVertexArrayObjects()}},r.getAttributeStride=function(t){var e,i;return null!=(i=null==(e=this.vertexBuffers[t])?void 0:e.byteStride)?i:0},r.getAttributeNames=function(){return Object.keys(this.vertexBuffers)},r.getIndexBuffer=function(){return this.indexBuffer},r.getIndexData=function(){return this.indices},r.getIndexType=function(){var e;return(null==(e=this.indexBuffer)?void 0:e.is32Bits)||ot(this.indices)?t.BufferDataType.UnsignedInt:t.BufferDataType.UnsignedShort},r.setIndexData=function(t){if(!a7(t))throw TypeError("Index data must use a supported integer array.");this.indices=Array.isArray(t)?ot(t)?new Uint32Array(t):new Uint16Array(t):t,this.releaseIndexBuffer(),this.disposeVertexArrayObjects(),this.initialized&&this.createIndexBuffer()},r.setIndexSubData=function(t,e){var i=this.indices;if(t<0||t+e.length>i.length)throw RangeError("Buffer '"+this.name+"##index' update is out of range.");if(i.set(e,t),this.indexBuffer){var r=i.slice(t,t+e.length);this.engine.updateDynamicIndexBuffer(this.indexBuffer,r,t*(this.indexBuffer.is32Bits?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT)),this.disposeVertexArrayObjects()}},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 this.skin},r.bind=function(t){var e,i,r,n,a=this.vertexArrayObjects,o=this.engine;if(!a||!a9(o)){o.bindBuffers(this.vertexBuffers,null!=(e=this.indexBuffer)?e:null,t);return}var s=a[t.key];!s&&(s=o.recordVertexArrayObject(this.vertexBuffers,null!=(i=this.indexBuffer)?i:null,t))&&(a[t.key]=s),s?o.bindVertexArrayObject(s,null!=(r=this.indexBuffer)?r:null):o.bindBuffers(this.vertexBuffers,null!=(n=this.indexBuffer)?n:null,t)},r.releaseVertexArrayObject=function(t){var e=this.vertexArrayObjects;if(e){var i=e[t];i&&a8(this.engine)&&this.engine.releaseVertexArrayObject(i),delete e[t]}},r.initialize=function(){this.initialized||this.disposed||(this.forEachVertexBuffer(function(t){t.create()}),this.createIndexBuffer(),this.engine.addGeometry(this),this.initialized=!0,this.options=void 0)},r.flush=function(){this.disposed||(this.initialize(),this.forEachVertexBuffer(function(t){return t.create()}))},r.restore=function(){this.initialized&&!this.disposed&&(this.vertexArrayObjects&&(this.vertexArrayObjects={}),this.forEachVertexBuffer(function(t){return t.rebuild()}),this.indices.length>0&&(this.indexBuffer=void 0,this.createIndexBuffer()))},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.subMeshes=t.subMeshes,t.buffer?n=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(t.buffer)):t.binaryData&&(n=t.binaryData),n){var i=t.vertexData.vertexCount,r={name:t.name,mode:4,attributes:{}};if(t.vertexData.channels.some(function(t){return!!t.semantic}))t.vertexData.channels.forEach(function(t){var e,a=null!=(e=on[t.semantic])?e:t.semantic;r.attributes[a]={type:or(t.format),size:t.dimension,data:oi(t,n,i),normalize:t.normalize}});else{var n,a,o=t.vertexData.channels[0],s=t.vertexData.channels[1],u=t.vertexData.channels[2];r.attributes=((a={})[nV.PositionKind]=oe(o,n,i,3),a[nV.UVKind]=oe(s,n,i,2),a[nV.NormalKind]=oe(u,n,i,3),a)}if(t.indexFormat!==ew.None){var h=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,a=e.byteLength-i;switch(t){case ew.UInt16:return new Uint16Array(r,n,a/Uint16Array.BYTES_PER_ELEMENT);case ew.UInt32:return new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT);default:throw Error("Unsupported index format: "+t+".")}}(t.indexFormat,n,t.indexOffset);r.indices={data:h},r.drawCount=h.length}else r.drawCount=i;this.processProps(r),this.skin={boneNames:t.boneNames,rootBoneName:t.rootBoneName,inverseBindMatrices:t.inverseBindMatrices}}},r.dispose=function(){var t=this;this.disposed||(this.disposeVertexArrayObjects(),Object.keys(this.vertexBuffers).forEach(function(e){return t.vertexBuffers[e].dispose()}),this.releaseIndexBuffer(),this.vertexBuffers={},this.indices=new Uint16Array(0),this.options=void 0,this.drawStart=0,this.drawCount=0,this.initialized&&this.engine.removeGeometry(this),this.initialized=!1,this.disposed=!0,e.prototype.dispose.call(this))},r.processProps=function(e){var i,r,n,a,o,s,u=this;this.releaseCurrentBuffers();var h=null!=(i=e.bufferUsage)?i:t.BufferUsage.Static,l={},c={},f={};if(Object.keys(e.attributes).forEach(function(t){var i,r,n=e.attributes[t],a="dataSource"in n?n.dataSource:t;c[a]=Math.max(null!=(i=c[a])?i:0,null!=(r=n.instanceDivisor)?r:0)}),Object.keys(e.attributes).forEach(function(i){var r,n,a=e.attributes[i];if(!("dataSource"in a)){var o,s=ArrayBuffer.isView(o=a.data)&&!eZ(o,DataView)?a.data:void 0,d=null!=(r=a.type)?r:s?nP(s):t.BufferDataType.Float,p=nA(d),m=a.stride||a.size*p,v=null!=s?s:nR(d,0);if(0===v.length&&e.maxVertex&&e.maxVertex>0){var y=m/p;v=nR(d,Math.ceil(e.maxVertex*y))}var g=null!=(n=c[i])?n:0;f[i]=d,l[i]=new nO(u.engine,v,h!==t.BufferUsage.Static,m,!1,g>0,!0,g,i)}}),Object.keys(e.attributes).forEach(function(i){var r,n,a,o,s,h=e.attributes[i],c="dataSource"in h?h.dataSource:i,d=l[c];if(!d)throw Error("Attribute '"+i+"' references missing data source '"+c+"'.");var p=null!=(n=null!=(r=h.type)?r:f[c])?n:t.BufferDataType.Float,m=h.stride||d.byteStride,v=null!=(a=h.instanceDivisor)?a:0,y=new nV(u.engine,d,i,{size:h.size,type:p,stride:m,offset:null!=(o=h.offset)?o:0,normalized:null!=(s=h.normalize)&&s,instanced:v>0,divisor:v,useBytes:!0,takeBufferOwnership:!0});u.setVerticesBuffer(y)}),this.name=null!=(r=e.name)?r:"effectsGeometry:"+a5++,this.drawStart=null!=(n=e.drawStart)?n:0,this.drawCount=null!=(a=e.drawCount)?a:0,this.mode=null!=(o=e.mode)?o:4,this.instanceCount=null!=(s=e.instanceCount)?s:0,this.bufferUsage=h,this.options=e,e.indices){var d=e.indices.data;if(!a7(d))throw TypeError("Index data must use a supported integer array.");this.indices=Array.isArray(d)?ot(d)?new Uint32Array(d):new Uint16Array(d):d}this.disposeVertexArrayObjects()},r.releaseCurrentBuffers=function(){var t=this,e=this.initialized;this.disposeVertexArrayObjects(),Object.keys(this.vertexBuffers).forEach(function(e){return t.vertexBuffers[e].dispose()}),this.releaseIndexBuffer(),this.vertexBuffers={},this.indices=new Uint16Array(0),e&&(this.engine.removeGeometry(this),this.initialized=!1)},r.disposeVertexArrayObjects=function(){var t=this,e=this.vertexArrayObjects;e&&(Object.keys(e).forEach(function(i){var r=e[i];r&&a8(t.engine)&&t.engine.releaseVertexArrayObject(r)}),this.vertexArrayObjects={})},r.createIndexBuffer=function(){var t=this.indices;0===t.length||this.indexBuffer||(this.indexBuffer=this.engine.createIndexBuffer(t,{usage:this.bufferUsage,type:this.getIndexType(),byteStride:0,instanceDivisor:0,label:""+this.name+"##index"}))},r.releaseIndexBuffer=function(){this.indexBuffer&&(this.engine.releaseBuffer(this.indexBuffer),this.indexBuffer=void 0)},r.forEachVertexBuffer=function(t){var e=this,i=new Set;Object.keys(this.vertexBuffers).forEach(function(r){var n=e.vertexBuffers[r].getWrapperBuffer();i.has(n)||(i.add(n),t(n))})},rk(i,[{key:"isInitialized",get:function(){return this.initialized}}]),i}(i4);function a8(t){return"function"==typeof t.recordVertexArrayObject&&"function"==typeof t.bindVertexArrayObject&&"function"==typeof t.releaseVertexArrayObject}function a9(t){var e;return(null==(e=t.gpuCapability)?void 0:e.detail.vertexArrayObject)===!0&&a8(t)}function a7(t){return Array.isArray(t)||eZ(t,Int32Array)||eZ(t,Uint16Array)||eZ(t,Uint32Array)}function ot(t){if(eZ(t,Uint32Array))return!0;if(eZ(t,Uint16Array))return!1;for(var e=0;e<t.length;e++)if(t[e]>=65535)return!0;return!1}function oe(t,e,i,r){return{type:or(t.format),size:r,data:oi(t,e,i),normalize:t.normalize}}function oi(t,e,i){var r=e.buffer,n=e.byteOffset+t.offset,a=t.dimension*i;switch(t.format){case eC.Float32:return new Float32Array(r,n,a);case eC.Int16:return new Int16Array(r,n,a);case eC.Int8:return new Int8Array(r,n,a);case eC.UInt16:return new Uint16Array(r,n,a);case eC.UInt8:return new Uint8Array(r,n,a);default:throw Error("Unsupported vertex format: "+t.format+".")}}function or(e){switch(e){case eC.Float32:return t.BufferDataType.Float;case eC.Int16:return t.BufferDataType.Short;case eC.Int8:return t.BufferDataType.Byte;case eC.UInt16:return t.BufferDataType.UnsignedShort;case eC.UInt8:return t.BufferDataType.UnsignedByte;default:throw Error("Unsupported vertex format: "+e+".")}}a6.create=function(t,e){return new a6(t,e)};var on={POSITION:nV.PositionKind,TEXCOORD0:nV.UVKind,TEXCOORD_0:nV.UVKind,TEXCOORD1:nV.UV2Kind,NORMAL:nV.NormalKind,TANGENT:nV.TangentKind,COLOR:nV.ColorKind,JOINTS:nV.JointsKind,JOINTS_0:nV.JointsKind,WEIGHTS:nV.WeightsKind,WEIGHTS_0:nV.WeightsKind,POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},oa=((eF={})[t.BufferDataType.Float]=4,eF[t.BufferDataType.Int]=4,eF[t.BufferDataType.UnsignedInt]=4,eF[t.BufferDataType.Short]=2,eF[t.BufferDataType.UnsignedShort]=2,eF[t.BufferDataType.Byte]=1,eF[t.BufferDataType.UnsignedByte]=1,eF),oo=1,os=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,h=void 0===u?nm.fromIdentity():u;r.id="Mesh"+oo++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=h}else r.id="Mesh"+oo++,r.name="<unnamed>",r.worldMatrix=nm.fromIdentity(),r._priority=0;return r}iY(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(),this.material=e},r.restore=function(){},r.dispose=function(i){this.destroyed||((null==i?void 0:i.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose(),(null==i?void 0:i.material)!==t.DestroyOptions.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),e.prototype.dispose.call(this))},rk(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(nk),ou="precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;void main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}}",oh="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",ol="#version 100\nprecision mediump float;\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\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#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",oc="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;vec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;}}",of="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;void 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;}",od="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",op="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",om="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);}",ov="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);}",oy="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);}",og="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",ox={},ob=function(){function e(){}return e.registerInclude=function(t,e){ox[t]&&i_.warn('The "'+t+'" shader include already exist.'),ox[t]=e},e.unRegisterInclude=function(t){delete ox[t]},e.unRegisterAllIncludes=function(){Object.keys(ox).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),h=e.genShaderVersion(r),l=e.parseIncludes(a),c=e.isVersion300(l);return(l=e.removeWebGLVersion(l),2!==r||c||(l=e.convertTo300(l,n===t.ShaderType.fragment)),s)?u+l:h+u+l},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=ox[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),oT=function(e){function i(i,r){void 0===r&&(r=4),(n=e.call(this,i)||this).tempRTs=[],n.iterationCount=r;var n,a=n.renderer.engine;return n.thresholdMaterial=nw.create(a,{shader:{vertex:od,fragment:og,glslVersion:t.GLSLVersion.GLSL1}}),n.thresholdMaterial.blending=!1,n.thresholdMaterial.depthTest=!1,n.thresholdMaterial.culling=!1,n.downSampleHMaterial=nw.create(a,{shader:{vertex:od,fragment:om,glslVersion:t.GLSLVersion.GLSL1}}),n.downSampleHMaterial.blending=!1,n.downSampleHMaterial.depthTest=!1,n.downSampleHMaterial.culling=!1,n.downSampleVMaterial=nw.create(a,{shader:{vertex:od,fragment:ov,glslVersion:t.GLSLVersion.GLSL1}}),n.downSampleVMaterial.blending=!1,n.downSampleVMaterial.depthTest=!1,n.downSampleVMaterial.culling=!1,n.upSampleMaterial=nw.create(a,{shader:{vertex:od,fragment:oy,glslVersion:t.GLSLVersion.GLSL1}}),n.upSampleMaterial.blending=!1,n.upSampleMaterial.depthTest=!1,n.upSampleMaterial.culling=!1,n.priority=5e3,n.name="BloomPass",n}iY(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},r.execute=function(e){var i,r,n,a=e.getWidth(),o=e.getHeight(),s=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.thresholdRT=e.getTemporaryRT("_BloomThreshold",a,o,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",s),e.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var u=this.thresholdRT.getColorTextures()[0],h=0;h<this.iterationCount;h++){var l=Math.floor(a/Math.pow(2,h+1)),c=Math.floor(o/Math.pow(2,h+1)),f=e.getTemporaryRT("_BloomDownH"+h,l,c,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",ow(u)),e.blit(u,f,this.downSampleHMaterial);var d=e.getTemporaryRT("_BloomDownV"+h,l,c,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",ow(f.getColorTextures()[0])),e.blit(f.getColorTextures()[0],d,this.downSampleVMaterial),e.releaseTemporaryRT(f),this.tempRTs.push(d),u=d.getColorTextures()[0]}e.releaseTemporaryRT(this.thresholdRT);for(var p=this.iterationCount-1;p>0;p--){var m=Math.floor(a/Math.pow(2,p-1)),v=Math.floor(o/Math.pow(2,p-1)),y=e.getTemporaryRT("_BloomUp"+p,m,v,0,t.FilterMode.Linear,t.RenderTextureFormat.RGBAHalf),g=this.tempRTs[p-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",g),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",ow(g)),e.blit(u,y,this.upSampleMaterial),u=y.getColorTextures()[0],this.tempRTs.push(y)}e.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},r.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},r.dispose=function(t){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),e.prototype.dispose.call(this,t)},i}(a3),oS=function(e){function i(i,r){n=e.call(this,i)||this;var n,a,o="PostProcess",s=n.renderer.engine;n.sceneTextureHandle=r||new a1(s);var u=a6.create(s,{name:o,mode:rG.TRIANGLE_STRIP,attributes:((a={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])},a),drawCount:4}),h=nw.create(s,{name:o,shader:{vertex:od,fragment:op,glslVersion:t.GLSLVersion.GLSL1}});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=os.create(s,{name:o,geometry:u,material:h,priority:0}),n.priority=5e3,n.name="ToneMappingPass",n}iY(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=ro({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=ro({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=ro({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=ro({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,a.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*a.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*a.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new e7(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new it(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(a3),oE=1,oC=function(){function e(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=t.globalVolume,a=t.postProcessingEnabled,o=void 0!==a&&a,s=i.engine;if(n&&(this.globalVolume=n),this.postProcessingEnabled=o,this.globalUniforms=new o_,this.renderer=i,o&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");this.drawObjectPass=new a4(i);var u=[this.drawObjectPass];if(this.setRenderPasses(u),o){var h=new a1(s),l=new oT(i,7);l.sceneTextureHandle=h,this.addRenderPass(l);var c=new oS(i,h);this.addRenderPass(c)}this.name="RenderFrame"+oE++,this.camera=e,this.editorTransform=ie.fromArray(void 0===r?[1,1,0,0]:r)}var i=e.prototype;return i.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){var i=(null==e?void 0:e.passes)?e.passes:void 0;i!==t.DestroyOptions.keep&&this.renderPasses.forEach(function(t){t.dispose(i)}),this.renderPasses.length=0,this.disposed=!0},i.setRenderPasses=function(t){this.renderPasses=t.slice()},i.addRenderPass=function(t){this.renderPasses.push(t)},i.removeRenderPass=function(t){e2(this.renderPasses,t)},rk(e,[{key:"isDisposed",get:function(){return this.disposed}}]),e}();function ow(t){return t?new e7(t.getWidth(),t.getHeight()):new e7}var o_=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},oM=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return rk(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),oA=function(){function e(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var i=e.prototype;return i.flush=function(t,e){void 0===t&&(t=!1),void 0===e&&(e=-1),this.currentFrame++;for(var i=e>=0?e:this.maxUnusedFrames,r=0;r<this.temporaryRTs.length;r++){var n=this.temporaryRTs[r];!n.isOccupied&&(t||this.currentFrame-n.lastFrameReleased>i)&&(n.RT.dispose(),this.temporaryRTs.splice(r--,1))}},i.get=function(e,i,r,n,a,o){void 0===n&&(n=0),void 0===a&&(a=t.FilterMode.Linear),void 0===o&&(o=t.RenderTextureFormat.RGBA32);for(var s,u,h,l=i+"_"+r+"_"+n+"_"+a+"_"+o,c=iQ(this.temporaryRTs);!(h=c()).done;){var f=h.value;if(!f.isOccupied&&f.descriptionHash===l)return f.isOccupied=!0,f.RT.name=e,f.RT}var d=t.RenderPassAttachmentStorageType.none;a===t.FilterMode.Linear?s=rG.LINEAR:a===t.FilterMode.Nearest&&(s=rG.NEAREST),o===t.RenderTextureFormat.RGBA32?u=rG.UNSIGNED_BYTE:o===t.RenderTextureFormat.RGBAHalf&&(u=rG.HALF_FLOAT),0===n?d=t.RenderPassAttachmentStorageType.none:16===n?d=t.RenderPassAttachmentStorageType.depth_stencil_opaque:24===n&&(d=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var p=no.create(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:rG.RGBA,format:rG.RGBA,type:u}),m={RT:a0.create({name:e,storeAction:{},viewport:[0,0,i,r],attachments:[p],depthStencilAttachment:{storageType:d}},this.engine.renderer),lastFrameReleased:0,descriptionHash:l,isOccupied:!0};return this.temporaryRTs.push(m),m.RT},i.release=function(t){for(var e,i=iQ(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},i.dispose=function(){for(var t,e=iQ(this.temporaryRTs);!(t=e()).done;)t.value.RT.dispose()},e}(),oP="function"==typeof WebGL2RenderingContext,oI=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},e.setupCapability=function(t){var e,i,r=oP&&eZ(t,WebGL2RenderingContext)?2:1,n=2===r,a=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),s=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),n&&!s&&(s=oR(t,t.HALF_FLOAT)),n&&!u&&(u=oR(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=n||t.getExtension("OES_texture_float")?t.FLOAT:0,l=n?WebGL2RenderingContext.HALF_FLOAT:(null==(i=t.getExtension("OES_texture_half_float"))?void 0:i.HALF_FLOAT_OES)||0;this.compressTextureCapabilityList=new Map([["WEBGL_compressed_texture_astc",!!t.getExtension("WEBGL_compressed_texture_astc")],["WEBKIT_WEBGL_compressed_texture_astc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_astc")],["WEBGL_compressed_texture_etc",!!t.getExtension("WEBGL_compressed_texture_etc")],["WEBKIT_WEBGL_compressed_texture_etc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_etc")],["WEBGL_compressed_texture_etc1",!!t.getExtension("WEBGL_compressed_texture_etc1")],["WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["WEBKIT_WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["EXT_sRGB",!!t.getExtension("EXT_sRGB")]]);var c={floatTexture:h,halfFloatTexture:l,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:s,floatLinear:u,maxTextureAnisotropy:a?t.getParameter(a.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),vertexArrayObject:n||!!this.vaoExt,ktx2Support:!!((e=this.compressTextureCapabilityList).get("WEBGL_compressed_texture_astc")||e.get("WEBKIT_WEBGL_compressed_texture_astc")),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!o,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=c,a&&(this.textureMaxAnisotropyExt=a.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},rk(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function oR(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.CompressTextureCapabilityType=void 0,(tA=t.CompressTextureCapabilityType||(t.CompressTextureCapabilityType={})).astc="WEBGL_compressed_texture_astc",tA.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",tA.etc="WEBGL_compressed_texture_etc",tA.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",tA.etc1="WEBGL_compressed_texture_etc1",tA.pvrtc="WEBGL_compressed_texture_pvrtc",tA.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",tA.sRGB="EXT_sRGB";var oO=function(){function t(t){this.engine=t,this.currentFramebuffer=null,this.disposed=!1,this.blitGeometry=null,this.blitMaterial=null}var e=t.prototype;return e.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},e.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},e.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},e.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},e.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},e.getFramebuffer=function(){return this.currentFramebuffer},e.setFramebuffer=function(t){t?(this.currentFramebuffer=t,this.currentFramebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.currentFramebuffer=null,this.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},e.setViewport=function(t,e,i,r){this.engine.setViewport(t,e,i,r)},e.clear=function(t){this.engine.clear(t)},e.getWidth=function(){return this.engine.getWidth()},e.getHeight=function(){return this.engine.getHeight()},e.getShaderLibrary=function(){return this.engine.getShaderLibrary()},e.renderRenderFrame=function(t){var e=t.renderPasses;if(this.disposed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(r=t.renderer.engine.getShaderLibrary())||r.compileAllShaders(),t.setup(),this.setFramebuffer(null);var i=t.camera;this.renderingData.currentFrame=t,this.renderingData.currentCamera=i,this.setGlobalMatrix("effects_MatrixInvV",i.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",i.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",i.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",i.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",i.position),ix(e);for(var r,n,a=iQ(e);!(n=a()).done;){var o=n.value;this.renderRenderPass(o)}for(var s,u=iQ(e);!(s=u()).done;)s.value.onCameraCleanup(this)},e.renderRenderPass=function(t){this.renderingData.currentPass=t,t.configure(this),t.execute(this)},e.renderMeshes=function(t){for(var e,i=iQ(t);!(e=i()).done;)e.value.render(this)},e.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush(),i.setMatrix("effects_ObjectToWorld",e);try{i.use(this,this.renderingData.currentFrame.globalUniforms)}catch(t){console.error(t),this.engine.renderErrors.add(t);return}var n=t.getIndexBuffer(),a=t.getDrawStart(),o=t.getDrawCount(),s=t.subMeshes;if(s.length>0){var u,h=s[r];a=h.offset,o=n?null!=(u=h.indexCount)?u:0:h.vertexCount}if(!(o<=0)){t.bind(i.shaderVariant);var l=t.instanceCount||void 0;n?this.engine.drawElementsType(t.mode,a,o,l):this.engine.drawArraysType(t.mode,a,o,l)}}},e.getTemporaryRT=function(t,e,i,r,n,a){return this.engine.renderTargetPool.get(t,e,i,r,n,a)},e.releaseTemporaryRT=function(t){this.engine.renderTargetPool.release(t)},e.blit=function(t,e,i){if(!this.blitGeometry){var r;this.blitGeometry=a6.create(this.engine,{mode:rG.TRIANGLE_STRIP,attributes:((r={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])},r),drawCount:4})}this.blitMaterial||(this.blitMaterial=nw.create(this.engine,{shader:{vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos, 0.0, 1.0);\n vTex = (aPos + vec2(1.0)) / 2.0;\n}",fragment:"\nprecision mediump float;\nvarying vec2 vTex;\nuniform sampler2D _MainTex;\nvoid main(){\n gl_FragColor = texture2D(_MainTex, vTex);\n}"}}),this.blitMaterial.blending=!1,this.blitMaterial.depthTest=!1,this.blitMaterial.culling=!1);var n=i||this.blitMaterial;n.setTexture("_MainTex",t);var a=this.currentFramebuffer;if(e){var o=e.viewport,s=o[0],u=o[1],h=o[2],l=o[3];this.setFramebuffer(e),this.setViewport(s,u,h,l)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,nm.IDENTITY,n),this.setFramebuffer(a)},e.dispose=function(){var t,e;this.disposed||(null==(t=this.blitGeometry)||t.dispose(),this.blitGeometry=null,null==(e=this.blitMaterial)||e.dispose(),this.blitMaterial=null,this.disposed=!0)},e.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},t.create=function(e){return new t(e)},rk(t,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),t}(),oV="lookup_texture",oN="offscreen_canvas",oF={},oL=new(function(){function t(){this._maxCachedCount=16,this._canvasPool=Object.create(null),this._cachedCanvasAndContexts=[]}var e=t.prototype;return e.dispose=function(){this.clear()},e.clear=function(){for(var t,e=this,i=iQ(Object.keys(this._canvasPool));!(t=i()).done;){var r=t.value;this._canvasPool[r].forEach(function(t){var i=t.canvas;return e.destroyCanvas(i)}),delete this._canvasPool[r]}this._cachedCanvasAndContexts.length=0},e.getCanvasAndContext=function(t,e){var i=this.getKey(t,e),r=this._canvasPool[i];if(r&&0!==r.length){var n=r.pop();return iS(n),e2(this._cachedCanvasAndContexts,n),0===r.length&&delete this._canvasPool[i],n}return this.createCanvasAndContext(t,e)},e.releaseCanvasAndContext=function(t){var e=t.canvas,i=e.width,r=e.height,n=this.getKey(i,r);this.resetCanvasAndContext(t),this._canvasPool[n]||(this._canvasPool[n]=[]),e1(this._canvasPool[n],t),e2(this._cachedCanvasAndContexts,t),this._cachedCanvasAndContexts.push(t),this.getCachedCount()>this._maxCachedCount&&this.cleanUnusedCachedCanvasPool()},e.createCanvasAndContext=function(t,e){var i,r=(void 0===t&&(t=1),void 0===e&&(e=1),i=oF[oN]?window._createOffscreenCanvas(10,10):document.createElement("canvas")).getContext("2d",{willReadFrequently:!0});return iS(r),i.width=t,i.height=e,{canvas:i,context:r}},e.resetCanvasAndContext=function(t){var e=t.canvas,i=t.context;"resetTransform"in i&&"function"==typeof i.resetTransform?i.resetTransform():i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,e.width,e.height)},e.getKey=function(t,e){return(t<<17)+(e<<1)},e.getCachedCount=function(){return this._cachedCanvasAndContexts.length},e.cleanUnusedCachedCanvasPool=function(){for(var t=Math.max(1,Math.ceil(this._cachedCanvasAndContexts.length/2)),e=0;e<t;e++){var i=this._cachedCanvasAndContexts.shift();iS(i);var r=i.canvas,n=r.width,a=r.height,o=this.getKey(n,a),s=this._canvasPool[o];s&&(e2(s,i),0===s.length&&delete this._canvasPool[o]),this.destroyCanvas(i.canvas)}},e.destroyCanvas=function(t){"remove"in t&&"function"==typeof t.remove&&t.remove()},t}()),oD=function(){function e(e,i,r,n,a,o){this.engine=e,this.scaledFontString=i,this.glyphs=new Map,this.currentX=0,this.currentY=0,this.full=!1,this.dirty=!0,this.resolution=o,this.canvas=document.createElement("canvas"),this.canvas.width=Math.ceil(512*o),this.canvas.height=Math.ceil(512*o);var s=this.canvas.getContext("2d",{willReadFrequently:!1});if(!s)throw Error("GlyphAtlas: failed to get 2d context");this.ctx=s,s.font=i,s.textBaseline="alphabetic",s.fillStyle="#ffffff",this.paddingPx=4*o,this.italicScale="italic"===a||"oblique"===a?2:1,this.baselinePx=this.paddingPx+r,this.cellHPx=Math.ceil(r+n+2*this.paddingPx),this.lineHeight=this.cellHPx/o,this.texture=no.create(e,{sourceType:t.TextureSourceType.image,image:this.canvas,target:rG.TEXTURE_2D,flipY:!0,magFilter:rG.LINEAR,minFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,premultiplyAlpha:!0}),this.texture.initialize()}var i=e.prototype;return i.ensureChar=function(t){var e=this.glyphs.get(t);if(e)return e;if(this.full)return null;var i=this.ctx;i.font=this.scaledFontString;var r=i.measureText(t).width,n=Math.max(1,Math.ceil(r*this.italicScale))+2*this.paddingPx,a=this.cellHPx;if(this.currentX+n>this.canvas.width&&(this.currentX=0,this.currentY+=a),this.currentY+a>this.canvas.height)return this.full=!0,console.warn('GlyphAtlas full, dropping char "'+t+'"'),null;var o=this.currentX,s=this.currentY;i.fillText(t,o+this.paddingPx,s+this.baselinePx),this.currentX+=n,this.dirty=!0;var u={px:o,py:s,pw:n,ph:a,advance:r/this.resolution,paddingLeft:this.paddingPx/this.resolution};return this.glyphs.set(t,u),u},i.uploadIfDirty=function(){this.dirty&&(this.texture.updateSource({sourceType:t.TextureSourceType.image,image:this.canvas,target:rG.TEXTURE_2D,flipY:!0,magFilter:rG.LINEAR,minFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,premultiplyAlpha:!0}),this.dirty=!1)},i.dispose=function(){this.texture.dispose(),this.glyphs.clear()},e}(),ok=function(){function t(t){this.engine=t,this.atlases=new Map,this.resolution=t.pixelRatio}var e=t.prototype;return e.getAtlas=function(t,e,i,r){var n=this.engine.pixelRatio;n!==this.resolution&&(this.clear(),this.resolution=n);var a=r+"|"+i+"|"+t+"|"+e+"|"+n,o=this.atlases.get(a);if(o)return o;var s=r+" "+i+" "+t*n+"px "+e,u=oL.getCanvasAndContext(1,1),h=u.context,l=.8*t*n,c=.2*t*n;h.font=s;var f=h.measureText("|\xc9q\xc5M");l=f.actualBoundingBoxAscent||l,c=f.actualBoundingBoxDescent||c,oL.releaseCanvasAndContext(u);var d=new oD(this.engine,s,l,c,r,n);return this.atlases.set(a,d),d},e.uploadDirty=function(){for(var t,e=iQ(this.atlases.values());!(t=e()).done;)t.value.uploadIfDirty()},e.dispose=function(){this.clear()},e.clear=function(){for(var t,e=iQ(this.atlases.values());!(t=e()).done;)t.value.dispose();this.atlases.clear()},t}(),oB={u0:0,v0:0,u1:1,v1:1},oz="aDrawSourceSize",oU="aSourceRect",oG="aMargins",oW="aOptions",oj=function(){function t(t){var e,i;this.engine=t,this.lineShape=new a$,this.bezierShape=new a$,this.triangleShape=new aX,this.rectangleShape=new aj,this.circleShape=new aJ,this.buildPoints=[],this.vertices=[],this.colors=[],this.uvs=[],this.indices=[],this.ninePatchDrawSourceSizes=[],this.ninePatchSourceRects=[],this.ninePatchMargins=[],this.ninePatchOptions=[],this.lineStyle={width:1,alignment:.5,cap:ev.Butt,join:ey.Miter,miterLimit:10},this.currentBatchType="colored",this.currentBatchTexture=null,this.transformStack=[],this.currentTransform=ny.fromIdentity(),this.clipStack=[],this.logicalWidth=1,this.logicalHeight=1,this.geometry=a6.create(this.engine,{attributes:((e={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array([-.5,.5,-.5,-.5,.5,.5,.5,-.5])},e[nV.ColorKind]={type:rG.FLOAT,size:4,data:new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},e[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},e),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),this.ninePatchGeometry=a6.create(this.engine,{attributes:((i={})[nV.PositionKind]={type:rG.FLOAT,size:2,data:new Float32Array(8)},i[nV.ColorKind]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[nV.UVKind]={type:rG.FLOAT,size:2,data:new Float32Array(8)},i[oz]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[oU]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[oG]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i[oW]={type:rG.FLOAT,size:4,data:new Float32Array(16)},i),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),this.coloredMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n varying vec4 vColor;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n void main() {\n vec4 color = vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.coloredMaterial.depthTest=!1,this.coloredMaterial.depthMask=!1,this.coloredMaterial.blending=!0,this.texturedMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n vec4 color = texture2D(uMainTexture, vUV) * vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.texturedMaterial.depthTest=!1,this.texturedMaterial.depthMask=!1,this.texturedMaterial.blending=!0,this.ninePatchMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n attribute vec4 aDrawSourceSize;\n attribute vec4 aSourceRect;\n attribute vec4 aMargins;\n attribute vec4 aOptions;\n varying vec4 vColor;\n varying vec2 vUV;\n varying vec4 vDrawSourceSize;\n varying vec4 vSourceRect;\n varying vec4 vMargins;\n varying vec4 vOptions;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n vDrawSourceSize = aDrawSourceSize;\n vSourceRect = aSourceRect;\n vMargins = aMargins;\n vOptions = aOptions;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n varying vec4 vDrawSourceSize;\n varying vec4 vSourceRect;\n varying vec4 vMargins;\n varying vec4 vOptions;\n uniform sampler2D uMainTexture;\n\n float mapNinePatchAxis(\n float pixel,\n float drawSize,\n float sourceSize,\n float marginBegin,\n float marginEnd,\n float repeatMode,\n inout float drawCenter\n ) {\n if (pixel < marginBegin) {\n return pixel / sourceSize;\n } else if (pixel >= drawSize - marginEnd) {\n return (sourceSize - (drawSize - pixel)) / sourceSize;\n } else {\n if (vOptions.z < 0.5) {\n drawCenter -= 1.0;\n }\n\n if (repeatMode < 0.5) {\n float ratio = (pixel - marginBegin) / (drawSize - marginBegin - marginEnd);\n return (marginBegin + ratio * (sourceSize - marginBegin - marginEnd)) / sourceSize;\n } else if (repeatMode < 1.5) {\n float offset = mod(pixel - marginBegin, sourceSize - marginBegin - marginEnd);\n return (marginBegin + offset) / sourceSize;\n } else {\n float drawArea = drawSize - marginBegin - marginEnd;\n float sourceArea = sourceSize - marginBegin - marginEnd;\n float scale = max(1.0, floor(drawArea / max(sourceArea, 0.0000001) + 0.5));\n float ratio = mod((pixel - marginBegin) / drawArea * scale, 1.0);\n return (marginBegin + ratio * sourceArea) / sourceSize;\n }\n }\n }\n\n void main() {\n vec2 pixel = vec2(vUV.x, 1.0 - vUV.y) * vDrawSourceSize.xy;\n float drawCenter = 2.0;\n vec2 sourceUV = vec2(\n mapNinePatchAxis(\n pixel.x, vDrawSourceSize.x, vDrawSourceSize.z,\n vMargins.x, vMargins.z, vOptions.x, drawCenter\n ),\n mapNinePatchAxis(\n pixel.y, vDrawSourceSize.y, vDrawSourceSize.w,\n vMargins.y, vMargins.w, vOptions.y, drawCenter\n )\n );\n\n if (drawCenter < 0.5) {\n discard;\n }\n\n vec2 uv = vec2(\n vSourceRect.x + sourceUV.x * vSourceRect.z,\n vSourceRect.y - sourceUV.y * vSourceRect.w\n );\n vec4 color = texture2D(uMainTexture, uv) * vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.ninePatchMaterial.depthTest=!1,this.ninePatchMaterial.depthMask=!1,this.ninePatchMaterial.blending=!0,this.textMaterial=nw.create(this.engine,{shader:{vertex:"precision highp float;\n attribute vec2 aPos;\n attribute vec4 aColor;\n attribute vec2 aUV;\n varying vec4 vColor;\n varying vec2 vUV;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n vUV = aUV;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision highp float;\n varying vec4 vColor;\n varying vec2 vUV;\n uniform sampler2D uMainTexture;\n void main() {\n vec4 textureColor = texture2D(uMainTexture, vUV);\n float alpha = textureColor.a * vColor.a;\n vec3 rgb = textureColor.rgb * vColor.rgb * vColor.a;\n gl_FragColor = vec4(rgb, alpha);\n }"}}),this.textMaterial.depthTest=!1,this.textMaterial.depthMask=!1,this.textMaterial.blending=!0,this.textCache=new ok(t)}var e=t.prototype;return e.begin=function(){this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.uvs.length=0,this.ninePatchDrawSourceSizes.length=0,this.ninePatchSourceRects.length=0,this.ninePatchMargins.length=0,this.ninePatchOptions.length=0,this.transformStack=[],this.currentTransform=ny.fromIdentity(),this.clipStack=[],this.currentBatchType="colored",this.currentBatchTexture=null,this.engine.setScissorTest(!1);var t=this.engine.canvas.getBoundingClientRect(),e=t.width||this.engine.canvas.width/this.engine.pixelRatio||1,i=t.height||this.engine.canvas.height/this.engine.pixelRatio||1;this.logicalWidth=e,this.logicalHeight=i;var r=new nm(2/e,0,0,0,0,-2/i,0,0,0,0,-1,0,-1,1,0,1);this.coloredMaterial.setMatrix("effects_MatrixVP",r),this.texturedMaterial.setMatrix("effects_MatrixVP",r),this.textMaterial.setMatrix("effects_MatrixVP",r),this.ninePatchMaterial.setMatrix("effects_MatrixVP",r)},e.pushTransform=function(t){this.transformStack.push(this.currentTransform.clone()),this.currentTransform=this.currentTransform.multiply(t)},e.popTransform=function(){var t=this.transformStack.pop();if(!t){console.warn("Render2D: 变换栈为空,无法弹出");return}this.currentTransform=t},e.pushClipRect=function(t,e,i,r){for(var n,a=this.currentTransform.elements,o=1/0,s=1/0,u=-1/0,h=-1/0,l=iQ([[t,e],[t+i,e],[t,e+r],[t+i,e+r]]);!(n=l()).done;){var c=n.value,f=a[0]*c[0]+a[3]*c[1]+a[6],d=a[1]*c[0]+a[4]*c[1]+a[7];o=Math.min(o,f),s=Math.min(s,d),u=Math.max(u,f),h=Math.max(h,d)}var p=this.clipStack[this.clipStack.length-1];p&&(o=Math.max(o,p.x),s=Math.max(s,p.y),u=Math.min(u,p.x+p.width),h=Math.min(h,p.y+p.height));var m={x:o,y:s,width:Math.max(0,u-o),height:Math.max(0,h-s)};this.clipStack.push(m),this.clipRectsEqual(p,m)||(this.flushBatch(),this.applyClipRect(m))},e.popClipRect=function(){var t=this.clipStack.pop();if(!t){console.warn("Graphics: clip stack is empty.");return}var e=this.clipStack[this.clipStack.length-1];this.clipRectsEqual(t,e)||(this.flushBatch(),e?this.applyClipRect(e):this.engine.setScissorTest(!1))},e.end=function(){this.flushBatch(),this.clipStack=[],this.engine.setScissorTest(!1)},e.ensureBatch=function(t,e){void 0===e&&(e=null),!(this.currentBatchType===t&&("colored"===t||this.currentBatchTexture===e))&&this.currentVertexCount>0&&this.flushBatch(),this.currentBatchType=t,this.currentBatchTexture=e},e.applyClipRect=function(t){var e=this.engine.canvas.width,i=this.engine.canvas.height,r=e/this.logicalWidth,n=i/this.logicalHeight,a=Math.max(0,Math.min(e,Math.floor(t.x*r))),o=Math.max(0,Math.min(i,Math.floor(t.y*n))),s=Math.max(a,Math.min(e,Math.ceil((t.x+t.width)*r))),u=Math.max(o,Math.min(i,Math.ceil((t.y+t.height)*n)));this.engine.setScissorTest(!0),this.engine.setScissor(a,i-u,s-a,u-o)},e.clipRectsEqual=function(t,e){return t&&e?t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height:t===e},e.flushBatch=function(){if(0!==this.currentVertexCount&&0!==this.currentIndexCount){this.textCache.uploadDirty();var t=new Float32Array(this.vertices),e=new Float32Array(this.colors),i=new Float32Array(this.uvs),r=new Uint16Array(this.indices),n="ninePatch"===this.currentBatchType?this.ninePatchGeometry:this.geometry;if(this.updateAttributeData(n,nV.PositionKind,t,2),this.updateAttributeData(n,nV.ColorKind,e,4),this.updateAttributeData(n,nV.UVKind,i,2),"ninePatch"===this.currentBatchType&&(this.updateAttributeData(n,oz,new Float32Array(this.ninePatchDrawSourceSizes),4),this.updateAttributeData(n,oU,new Float32Array(this.ninePatchSourceRects),4),this.updateAttributeData(n,oG,new Float32Array(this.ninePatchMargins),4),this.updateAttributeData(n,oW,new Float32Array(this.ninePatchOptions),4)),n.setIndexData(r),n.setDrawCount(this.currentIndexCount),"textured"===this.currentBatchType||"text"===this.currentBatchType||"ninePatch"===this.currentBatchType){a="text"===this.currentBatchType?this.textMaterial:"ninePatch"===this.currentBatchType?this.ninePatchMaterial:this.texturedMaterial;var a,o,s=null!=(o=this.currentBatchTexture)?o:this.engine.whiteTexture;a.setTexture("uMainTexture",s)}else a=this.coloredMaterial;this.engine.renderer.drawGeometry(n,nm.IDENTITY,a),this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.uvs.length=0,this.ninePatchDrawSourceSizes.length=0,this.ninePatchSourceRects.length=0,this.ninePatchMargins.length=0,this.ninePatchOptions.length=0}},e.updateAttributeData=function(t,e,i,r){var n,a=null==(n=t.getVertexBuffer(e))?void 0:n.getBuffer();if(a&&i.byteLength>a.capacity){t.setVerticesBuffer(new nV(this.engine,i,e,{updatable:!0,size:r}));return}t.setAttributeData(e,i)},e.drawLines=function(t,e,i){if(void 0===e&&(e=ii.WHITE),void 0===i&&(i=1),!t||t.length<4||t.length%2!=0){console.warn("drawLines: 至少需要2个点(4个数值),且数组长度必须为偶数");return}var r=t.length/2,n=t[0]===t[t.length-2]&&t[1]===t[t.length-1],a=n?r-1:r,o=this.lineShape.points;o.length=0;for(var s=0;s<a;s++)o.push(t[2*s],t[2*s+1]);this.ensureBatch("colored"),this.buildShapeLine(this.lineShape,e,i,n)},e.drawLine=function(t,e,i,r,n,a){void 0===n&&(n=ii.WHITE),void 0===a&&(a=1);var o=this.lineShape.points;o.length=0,o.push(t,e,i,r),this.ensureBatch("colored"),this.buildShapeLine(this.lineShape,n,a,!1)},e.drawBezier=function(t,e,i,r,n,a,o,s,u,h){void 0===u&&(u=ii.WHITE),void 0===h&&(h=1);var l=this.bezierShape.points;l.length=0,l.push(t,e),aH(l,t,e,i,r,n,a,o,s),this.ensureBatch("colored"),this.buildShapeLine(this.bezierShape,u,h,!1)},e.drawTriangle=function(t,e,i,r,n,a,o,s){void 0===o&&(o=ii.WHITE),void 0===s&&(s=1),this.setTriangleShape(t,e,i,r,n,a),this.ensureBatch("colored"),this.buildShapeLine(this.triangleShape,o,s,!0)},e.drawRectangle=function(t,e,i,r,n,a){void 0===n&&(n=ii.WHITE),void 0===a&&(a=1),this.setRectangleShape(t,e,i,r,0),this.ensureBatch("colored"),this.buildShapeLine(this.rectangleShape,n,a,!0)},e.drawCircle=function(t,e,i,r,n){void 0===r&&(r=ii.WHITE),void 0===n&&(n=1),this.setCircleShape(t,e,i),this.ensureBatch("colored"),this.buildShapeLine(this.circleShape,r,n,!0)},e.fillTriangle=function(t,e,i,r,n,a,o){void 0===o&&(o=ii.WHITE),this.setTriangleShape(t,e,i,r,n,a),this.ensureBatch("colored"),this.buildShape(this.triangleShape,o)},e.fillRectangle=function(t,e,i,r,n){void 0===n&&(n=ii.WHITE),this.ensureBatch("colored"),this.pushQuad(t,e,i,r,n)},e.fillCircle=function(t,e,i,r){void 0===r&&(r=ii.WHITE),this.setCircleShape(t,e,i),this.ensureBatch("colored"),this.buildShape(this.circleShape,r)},e.drawTexture=function(t,e,i,r,n,a,o){void 0===a&&(a=oB),void 0===o&&(o=ii.WHITE),this.ensureBatch("textured",n),this.pushQuad(t,e,i,r,o,a)},e.drawNinePatch=function(t,e,i,r,n,a,o){if(void 0===o&&(o=ii.WHITE),!(i<=0)&&!(r<=0)&&!(a.sourceWidth<=0)&&!(a.sourceHeight<=0)){this.ensureBatch("ninePatch",n);var s,u,h,l=a.sourceX/n.width,c=1-a.sourceY/n.height,f=a.sourceWidth/n.width,d=a.sourceHeight/n.height,p=null!=(s=a.horizontalMode)?s:0,m=null!=(u=a.verticalMode)?u:0,v=Number(null==(h=a.drawCenter)||h);this.pushQuad(t,e,i,r,o,oB);for(var y=0;y<4;y++)this.ninePatchDrawSourceSizes.push(i,r,a.sourceWidth,a.sourceHeight),this.ninePatchSourceRects.push(l,c,f,d),this.ninePatchMargins.push(a.marginLeft,a.marginTop,a.marginRight,a.marginBottom),this.ninePatchOptions.push(p,m,v,0)}},e.drawText=function(t,e,i,r,n,a,o,s){if(void 0===n&&(n=ii.WHITE),void 0===a&&(a="sans-serif"),void 0===o&&(o="normal"),void 0===s&&(s="normal"),i){var u=this.textCache.getAtlas(r,a,o,s);this.ensureBatch("text",u.texture);for(var h=u.lineHeight,l=t,c=Array.from(i),f=0;f<c.length;f++){var d=u.ensureChar(c[f]);if(d){var p=u.canvas.width,m=u.canvas.height,v=d.px/p,y=(d.px+d.pw)/p,g=1-(d.py+d.ph)/m,x=1-d.py/m;this.pushQuad(l-d.paddingLeft,e,d.pw/u.resolution,h,n,{u0:v,v0:g,u1:y,v1:x}),l+=d.advance}}}},e.measureText=function(t,e,i,r,n){void 0===i&&(i="sans-serif"),void 0===r&&(r="normal"),void 0===n&&(n="normal");for(var a,o=this.textCache.getAtlas(e,i,r,n),s=Array.from(t),u=[],h=0,l=iQ(s);!(a=l()).done;){var c,f,d=a.value,p=null!=(f=null==(c=o.ensureChar(d))?void 0:c.advance)?f:0;u.push(p),h+=p}return{width:h,lineHeight:o.lineHeight,advances:u}},e.dispose=function(){this.geometry.dispose(),this.ninePatchGeometry.dispose(),this.coloredMaterial.dispose(),this.texturedMaterial.dispose(),this.textMaterial.dispose(),this.ninePatchMaterial.dispose(),this.textCache.dispose()},e.buildShape=function(t,e){var i=this.buildPoints,r=this.indices.length,n=this.vertices.length/2;i.length=0,t.build(i,this.getScreenScale()),t.triangulate(i,this.vertices,n,this.indices,r),this.applyTransformAndColor(n,this.vertices.length/2-n,e)},e.buildShapeLine=function(t,e,i,r){void 0===r&&(r=!1);var n=this.buildPoints;this.indices.length;var a=this.vertices.length/2;n.length=0,t.build(n,this.getScreenScale()),this.lineStyle.width=i,aU(n,this.lineStyle,!1,r,this.vertices,2,a,this.indices),this.applyTransformAndColor(a,this.vertices.length/2-a,e)},e.getScreenScale=function(){var t=this.currentTransform.elements,e=Math.hypot(t[0],t[1]),i=Math.hypot(t[3],t[4]);return Math.max(this.engine.canvas.width/this.logicalWidth*e,this.engine.canvas.height/this.logicalHeight*i,1)},e.setTriangleShape=function(t,e,i,r,n,a){this.triangleShape.x=t,this.triangleShape.y=e,this.triangleShape.x2=i,this.triangleShape.y2=r,this.triangleShape.x3=n,this.triangleShape.y3=a},e.setRectangleShape=function(t,e,i,r,n){this.rectangleShape.x=t,this.rectangleShape.y=e,this.rectangleShape.width=i,this.rectangleShape.height=r,this.rectangleShape.roundness=n},e.setCircleShape=function(t,e,i){this.circleShape.x=t,this.circleShape.y=e,this.circleShape.radius=i},e.applyTransformAndColor=function(t,e,i){for(var r=0;r<e;r++){var n=(t+r)*2,a=(t+r)*4;this.applyTransform(this.vertices[n],this.vertices[n+1],this.vertices,n),this.colors[a]=i.r,this.colors[a+1]=i.g,this.colors[a+2]=i.b,this.colors[a+3]=i.a,this.uvs[n]=0,this.uvs[n+1]=0}},e.pushQuad=function(t,e,i,r,n,a){for(var o=this.vertices.length/2,s=[[t,e],[t+i,e],[t,e+r],[t+i,e+r]],u=a?a.u0:0,h=a?a.v0:0,l=a?a.u1:0,c=a?a.v1:0,f=[[u,c],[l,c],[u,h],[l,h]],d=0;d<4;d++){var p=(o+d)*2,m=(o+d)*4;this.applyTransform(s[d][0],s[d][1],this.vertices,p),this.colors[m]=n.r,this.colors[m+1]=n.g,this.colors[m+2]=n.b,this.colors[m+3]=n.a,this.uvs[p]=f[d][0],this.uvs[p+1]=f[d][1]}this.indices.push(o,o+1,o+2,o+2,o+1,o+3)},e.applyTransform=function(t,e,i,r){void 0===r&&(r=0);var n=this.currentTransform.elements;i[r]=n[0]*t+n[3]*e+n[6],i[r+1]=n[1]*t+n[4]*e+n[7]},rk(t,[{key:"currentVertexCount",get:function(){return this.vertices.length/2}},{key:"currentIndexCount",get:function(){return this.indices.length}}]),t}(),oX=function(t){function e(e){var i;return(i=t.call(this,e)||this).getHitTestParams=function(t){var e=i.transform.getWorldMatrix();i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:i.frameClipMasks}},i}iY(e,t);var i=e.prototype;return i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++){var i=this.materials[e];this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),i,t,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData(nV.PositionKind);if(t){var e=n6(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.mask;i&&this.maskManager.setMaskOptions(this.engine,i)},e}(nk);eq([i3(void 0,void 0)],oX.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}iY(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new ie;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(oX),t.EffectComponent=eq([i1(eS.EffectComponent)],t.EffectComponent);var oH=new it(0,0,0),oY=new it(0,0,0),oZ=function(){this.target=null,this.weight=1};t.PositionConstraint=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.positionAtRest=new it(0,0,0),e.positionOffset=new it(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}iY(e,t);var i=e.prototype;return i.onStart=function(){var t=this.item.transform.getWorldPosition();this.positionAtRest.copyFrom(t)},i.onUpdate=function(t){if(0!==this.targets.length){oH.set(0,0,0);for(var e,i=0,r=iQ(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var a=n.target.transform.getWorldPosition(),o=n.weight;oH.x+=a.x*o,oH.y+=a.y*o,oH.z+=a.z*o,i+=o}}i>0&&(oH.x/=i,oH.y/=i,oH.z/=i),oH.x+=this.positionOffset.x,oH.y+=this.positionOffset.y,oH.z+=this.positionOffset.z,oY.set(this.lerp(this.positionAtRest.x,oH.x,this.weight),this.lerp(this.positionAtRest.y,oH.y,this.weight),this.lerp(this.positionAtRest.z,oH.z,this.weight)),oH.copyFrom(this.item.transform.getWorldPosition());var s=this.constrainX?oY.x:oH.x,u=this.constrainY?oY.y:oH.y,h=this.constrainZ?oY.z:oH.z;this.item.transform.setWorldPosition(s,u,h)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new oZ;i.target=t,i.weight=Math.max(0,Math.min(1,e)),this.targets.push(i)},i.removeTarget=function(t){var e=this.targets.findIndex(function(e){return e.target===t});-1!==e&&this.targets.splice(e,1)},i.clearTargets=function(){this.targets=[]},i.setPositionOffset=function(t,e,i){this.positionOffset.set(t,e,i)},i.setWeight=function(t){this.weight=Math.max(0,Math.min(1,t))},i.lerp=function(t,e,i){return t+(e-t)*i},i.fromData=function(e){t.prototype.fromData.call(this,e),this.positionAtRest.copyFrom(e.positionAtRest),this.positionOffset.copyFrom(e.positionOffset),this.weight=e.weight,this.constrainX=e.constrainX,this.constrainY=e.constrainY,this.constrainZ=e.constrainZ,this.targets=[];for(var i,r=iQ(e.targets);!(i=r()).done;){var n=i.value,a=new oZ;a.target=this.engine.findObject(n.target),a.weight=n.weight,this.targets.push(a)}},e}(rB),t.PositionConstraint=eq([i1("PositionConstraint")],t.PositionConstraint),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return iY(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(rB),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),eq([i3(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=eq([i1(eS.PostProcessVolume)],t.PostProcessVolume);var oq=function(t){function e(e){(i=t.call(this,e)||this).visible=!0,i._color=new ii(1,1,1,1),i.getHitTestParams=function(t){var e=nm.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.boundingBoxInfo.setGeometry(i.geometry,e);var n,a=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===tH.FRONT,clipMasks:i.frameClipMasks}}},i.renderer={renderMode:t$.MESH,blending:tX.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:tH.DOUBLE,mask:0},i.defaultGeometry=a6.create(i.engine,{attributes:((r={})[nV.PositionKind]={type:rG.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},r[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},r),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),i.geometry=i.defaultGeometry;var i,r,n=nw.create(i.engine,{shader:{fragment:oh,vertex:ou,shared:!0}});return i.material=n,i.material.setColor("_Color",new ii(1,1,1,1)),i.configureMaterial(i.renderer),i}iY(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){eZ(t,ii)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return eY(function(){var i;return eK(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,no.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}})})()},i.onUpdate=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),(this.renderer.renderMode===t$.BILLBOARD||this.renderer.renderMode===t$.VERTICAL_BILLBOARD||this.renderer.renderMode===t$.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale)}},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t,this),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.materials[e],t,e)},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle(this.transform.size)},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData(nV.PositionKind);if(t){var e=n6(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.texture,a=this.material;a.blending=!0,a.depthTest=!0,a.depthMask=i,rY(a,r),rZ(a,e),a.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',a.setVector4("_TexOffset",new ie(0,0,1,1)),a.setTexture("_MainTex",n);var o=rH(r),s=new ie;return s.x=t.occlusion?+t.transparentOcclusion:1,s.y=o,s.z=t.renderMode,a.setVector4("_TexParams",s),0===s.x||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},i.draw=function(t){for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.materials[e],e)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,a,o=null!=(i=e.renderer)?i:{},s=e.mask;s&&this.maskManager.setMaskOptions(this.engine,s),this.renderer={renderMode:null!=(r=o.renderMode)?r:t$.MESH,blending:null!=(n=o.blending)?n:tX.ALPHA,texture:o.texture?this.engine.findObject(o.texture):this.engine.whiteTexture,occlusion:!!o.occlusion,transparentOcclusion:!!o.transparentOcclusion||this.maskManager.isMask,side:null!=(a=o.side)?a:tH.DOUBLE,mask:1},this.configureMaterial(this.renderer)},rk(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(nk);function oK(t,e,i){var r=t.elements;r[0]*=e,r[1]*=e,r[2]*=e,r[3]*=e,r[4]*=i,r[5]*=i,r[6]*=i,r[7]*=i}function oQ(t){return(oQ=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function oJ(t){var e="function"==typeof Map?new Map:void 0;return(oJ=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return aM(t,arguments,oQ(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),iH(i,t)})(t)}t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}iY(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",i*this.amountOfMotion),o.setFloat("_PosZ",r*this.amountOfMotion)}},i}(rB),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),eq([i3(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=eq([i1("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tP=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tP.Circular=0]="Circular",tP[tP.Linear=1]="Linear",t.FrameComponent=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.color=new ii(1,1,1,1),i.worldMatrix=new nm,i.getHitTestParams=function(e){if(e){var r=nm.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),n=function(t,e){return r.transformPoint(new it(t,e,0),new it)},a=n(-.5,.5),o=n(.5,.5),s=n(.5,-.5),u=n(-.5,-.5),h=i.getBorderWorldThickness(a,o),l=i.getBorderTriangles(a,o,s,u,h);return{type:t.HitTestType.triangle,triangles:l,clipMasks:i.frameClipMasks}}},i}iY(i,e);var r=i.prototype;return r.onAwake=function(){this.clipGeometry=a6.create(this.engine,{attributes:((t={})[nV.PositionKind]={type:rG.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},t[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},t),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6});var t,e=nw.create(this.engine,{shader:{fragment:"\n precision mediump float;\n\n uniform vec4 _Color;\n\n void main() {\n gl_FragColor = _Color;\n }\n ",vertex:"\n precision highp float;\n attribute vec3 aPos;\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n void main() {\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * vec4(aPos, 1.0);\n }\n ",shared:!0}});e.depthTest=!0,e.depthMask=!1,e.setColor("_Color",this.color),this.material=e},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},r.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),oK(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},r.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},r.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),oK(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},r.fromData=function(t){e.prototype.fromData.call(this,t),t.color&&this.color.copyFrom(t.color)},r.getBorderWorldThickness=function(t,e){var i,r=null==(i=this.item.composition)?void 0:i.camera;if(!r)return .05;var n=r.worldToScreenPoint(t),a=r.worldToScreenPoint(e),o=Math.hypot(a.x-n.x,a.y-n.y)/(Math.hypot(e.x-t.x,e.y-t.y)||1);return o>0?13.6/o:.05},r.getBorderTriangles=function(t,e,i,r,n){var a=e.clone().subtract(t).normalize(),o=t.clone().subtract(r).normalize(),s=function(t,e,i){return t.clone().addScaledVector(a,e).addScaledVector(o,i)},u=n/2,h=s(t,-u,u),l=s(e,u,u),c=s(i,u,-u),f=s(r,-u,-u),d=s(t,u,-u),p=s(e,-u,-u),m=s(i,-u,u),v=s(r,u,u),y=function(t,e,i,r){return[{p0:t,p1:e,p2:i},{p0:t,p1:i,p2:r}]};return[].concat(y(h,l,p,d),y(l,c,m,p),y(c,f,v,m),y(f,h,d,v))},r.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},r.setClipRectangleRecursive=function(t){for(var e,i=iQ(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(nk);n&&e1(n.frameClipMasks,this),this.setClipRectangleRecursive(r)}},i}(nk),t.FrameComponent=eq([i1("FrameComponent")],t.FrameComponent),t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}iY(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(rB),t.CameraController=eq([i1(eS.CameraController)],t.CameraController);var o$=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX));function o0(t,e){var i=t.elements;return new e7(i[0]*e.x+i[3]*e.y+i[6],i[1]*e.x+i[4]*e.y+i[7])}function o1(t,e){var i=t.elements;return new e7(i[0]*e.x+i[3]*e.y,i[1]*e.x+i[4]*e.y)}t.MouseButton=void 0,(tI=t.MouseButton||(t.MouseButton={}))[tI.None=0]="None",tI[tI.Left=1]="Left",tI[tI.Right=2]="Right",tI[tI.Middle=3]="Middle",tI[tI.WheelUp=4]="WheelUp",tI[tI.WheelDown=5]="WheelDown",tI[tI.WheelLeft=6]="WheelLeft",tI[tI.WheelRight=7]="WheelRight",tI[tI.Xbutton1=8]="Xbutton1",tI[tI.Xbutton2=9]="Xbutton2",t.MouseButtonMask=void 0,(tR=t.MouseButtonMask||(t.MouseButtonMask={}))[tR.None=0]="None",tR[tR.Left=1]="Left",tR[tR.Right=2]="Right",tR[tR.Middle=4]="Middle",tR[tR.Xbutton1=128]="Xbutton1",tR[tR.Xbutton2=256]="Xbutton2",t.KeyLocation=void 0,(tO=t.KeyLocation||(t.KeyLocation={}))[tO.Unspecified=0]="Unspecified",tO[tO.Left=1]="Left",tO[tO.Right=2]="Right";var o2=function(){function t(){this.device=0,this.pressed=!1,this.canceled=!1,this._accepted=!1}var e=t.prototype;return e.accept=function(){this._accepted=!0},e.clearAccepted=function(){this._accepted=!1},e.isAccepted=function(){return this._accepted},e.isPressed=function(){return this.pressed&&!this.canceled},e.isReleased=function(){return!this.pressed&&!this.canceled},e.isCanceled=function(){return this.canceled},e.isEcho=function(){return!1},e.xformedBy=function(t){return this},t}();o2.deviceIdEmulation=-1,o2.deviceIdInternal=-2,o2.deviceIdKeyboard=16,o2.deviceIdMouse=32;var o3=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.commandOrControlAutoremap=!1,e.shiftPressed=!1,e.altPressed=!1,e.metaPressed=!1,e.ctrlPressed=!1,e}return iY(e,t),e.prototype.copyModifiersTo=function(t){t.device=this.device,t.pressed=this.pressed,t.canceled=this.canceled,t.commandOrControlAutoremap=this.commandOrControlAutoremap,t.shiftPressed=this.shiftPressed,t.altPressed=this.altPressed,t.metaPressed=this.metaPressed,t.ctrlPressed=this.ctrlPressed},e}(oJ(o2)),o4=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.keycode="",i.physicalKeycode="",i.keyLabel="",i.unicode=0,i.location=t.KeyLocation.Unspecified,i.echo=!1,i}return iY(i,e),i.prototype.isEcho=function(){return this.echo},i}(o3),o5=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.buttonMask=t.MouseButtonMask.None,i.position=new e7,i.globalPosition=new e7,i}return iY(i,e),i.prototype.copyMouseTo=function(t){this.copyModifiersTo(t),t.buttonMask=this.buttonMask,t.position.copyFrom(this.position),t.globalPosition.copyFrom(this.globalPosition)},i}(o3),o6=function(e){function i(){var i;return i=e.apply(this,arguments)||this,i.factor=1,i.buttonIndex=t.MouseButton.None,i.doubleClick=!1,i}return iY(i,e),i.prototype.xformedBy=function(t){var e=new i;return this.copyMouseTo(e),e.position.copyFrom(o0(t,this.position)),e.factor=this.factor,e.buttonIndex=this.buttonIndex,e.doubleClick=this.doubleClick,e},i}(o5),o8=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.tilt=new e7,e.pressure=0,e.relative=new e7,e.screenRelative=new e7,e.velocity=new e7,e.screenVelocity=new e7,e.penInverted=!1,e}return iY(e,t),e.prototype.xformedBy=function(t){var i=new e;return this.copyMouseTo(i),i.position.copyFrom(o0(t,this.position)),i.tilt.copyFrom(this.tilt),i.pressure=this.pressure,i.relative.copyFrom(o1(t,this.relative)),i.screenRelative.copyFrom(this.screenRelative),i.velocity.copyFrom(o1(t,this.velocity)),i.screenVelocity.copyFrom(this.screenVelocity),i.penInverted=this.penInverted,i},e}(o5),o9=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.index=0,e.position=new e7,e.doubleTap=!1,e}return iY(e,t),e.prototype.xformedBy=function(t){var i=new e;return i.device=this.device,i.pressed=this.pressed,i.canceled=this.canceled,i.index=this.index,i.position.copyFrom(o0(t,this.position)),i.doubleTap=this.doubleTap,i},e}(oJ(o2)),o7=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.index=0,e.position=new e7,e.relative=new e7,e.screenRelative=new e7,e.velocity=new e7,e.screenVelocity=new e7,e.pressure=0,e.tilt=new e7,e.penInverted=!1,e}return iY(e,t),e.prototype.xformedBy=function(t){var i=new e;return i.device=this.device,i.pressed=this.pressed,i.canceled=this.canceled,i.index=this.index,i.position.copyFrom(o0(t,this.position)),i.relative.copyFrom(o1(t,this.relative)),i.screenRelative.copyFrom(this.screenRelative),i.velocity.copyFrom(o1(t,this.velocity)),i.screenVelocity.copyFrom(this.screenVelocity),i.pressure=this.pressure,i.tilt.copyFrom(this.tilt),i.penInverted=this.penInverted,i},e}(oJ(o2)),st="click",se="touchstart",si="touchmove",sr="touchend";t.PointerEventType=void 0,(tV=t.PointerEventType||(t.PointerEventType={}))[tV.PointerDown=0]="PointerDown",tV[tV.PointerUp=1]="PointerUp",tV[tV.PointerMove=2]="PointerMove";var sn=function(e){function i(i,r){var n;return void 0===r&&(r=!1),(n=e.call(this)||this).engine=i,n.allowPropagation=r,n.skipPointerMovePicking=!0,n.emulateMouseFromTouch=!0,n.emulateTouchFromMouse=!1,n._enabled=!0,n.handlers={},n.nativeHandlers=[],n.target=null,n.mouseState=null,n.mouseButtonMask=t.MouseButtonMask.None,n.touchStates=new Map,n.mouseFromTouchIndex=null,n.touchFromMousePressed=!1,n.addedTabIndex=!1,n.addedOutlineStyle=!1,n.onNativeWheel=function(e){if(n.enabled&&n.target){var i=n.getCanvasPosition(e.clientX,e.clientY),r=!1;0!==e.deltaY&&(r=n.pushWheelButton(e.deltaY<0?t.MouseButton.WheelUp:t.MouseButton.WheelDown,so(e.deltaY,e.deltaMode),i,e)||r),0!==e.deltaX&&(r=n.pushWheelButton(e.deltaX<0?t.MouseButton.WheelLeft:t.MouseButton.WheelRight,so(e.deltaX,e.deltaMode),i,e)||r),n.consumeNativeEvent(e,r)}},n.onNativeKeyDown=function(t){n.handleNativeKey(t,!0)},n.onNativeKeyUp=function(t){n.handleNativeKey(t,!1)},n.onNativeMouseDown=function(t){n.handleNativeMouseDown(t)},n.onNativeMouseMove=function(t){if(n.enabled&&n.target){var e,i=n.getCanvasPosition(t.clientX,t.clientY),r=null!=(e=n.mouseState)?e:n.createPointerState(i);n.mouseState=r;var a=new e7(i.x-r.last.x,i.y-r.last.y),o=n.getVelocity(r,i),s=n.pushNativeMouseMotion(t,i,a,o);if(r.inputHandled||(r.inputHandled=s),!s&&(!r.pressed||!r.inputHandled)){var u=n.createPointerEvent(t,i,r,o);n.dispatchEvent(si,u)}n.updatePointerState(r,i),n.consumeNativeEvent(t,s)}},n.onNativeMouseUp=function(t){if(n.enabled&&n.target){n.setMouseButtonPressed(t.button,!1);var e=n.getCanvasPosition(t.clientX,t.clientY),i=n.mouseState;if(null==i?void 0:i.pressed){var r=n.pushNativeMouseButton(t,e,!1),a=n.createPointerEvent(t,e,i);!i.inputHandled&&!r&&n.isClick(i,e)&&n.dispatchEvent(st,a),r||i.inputHandled||n.dispatchEvent(sr,a),n.mouseState=null,n.consumeNativeEvent(t,r||i.inputHandled||!n.allowPropagation)}}},n.onNativeTouchStart=function(t){if(n.enabled){n.focusTarget();for(var e,i=iQ(Array.from(t.changedTouches));!(e=i()).done;){var r=e.value,a=n.getCanvasPosition(r.clientX,r.clientY),o=n.createPointerState(a);n.touchStates.set(r.identifier,o),o.pressed=!0;var s=n.pushNativeScreenTouch(r.identifier,a,!0,!1,!1);if(o.inputHandled=s,!s){var u=n.createPointerEvent(t,a,o);n.dispatchEvent(se,u)}n.consumeNativeEvent(t,s)}n.preventTouchDefaults(t)}},n.onNativeTouchMove=function(t){if(n.enabled){for(var e,i=iQ(Array.from(t.changedTouches));!(e=i()).done;){var r,a=e.value,o=n.getCanvasPosition(a.clientX,a.clientY),s=null!=(r=n.touchStates.get(a.identifier))?r:n.createPointerState(o);n.touchStates.set(a.identifier,s);var u=new e7(o.x-s.last.x,o.y-s.last.y),h=n.getVelocity(s,o),l=n.pushNativeScreenDrag(a.identifier,o,u,h);if(s.inputHandled||(s.inputHandled=l),!l&&!s.inputHandled){var c=n.createPointerEvent(t,o,s,h);n.dispatchEvent(si,c)}n.updatePointerState(s,o),n.consumeNativeEvent(t,l)}n.preventTouchDefaults(t)}},n.onNativeTouchEnd=function(t){n.handleNativeTouchEnd(t,!1)},n.onNativeTouchCancel=function(t){n.handleNativeTouchEnd(t,!0)},n.onCanvasFocus=function(){n.emit("canvasFocus")},n.onCanvasBlur=function(){n.emit("canvasBlur")},n}iY(i,e);var r=i.prototype;return r.bindListeners=function(t){this.unbindListeners(),this.target=t,t&&"undefined"!=typeof window&&(t.hasAttribute("tabindex")||(t.tabIndex=0,this.addedTabIndex=!0),t.style.outline||(t.style.outline="none",this.addedOutlineStyle=!0),this.addNativeHandler(t,"mousedown",this.onNativeMouseDown),this.addNativeHandler(t,"mouseup",this.onNativeMouseUp),this.addNativeHandler(window,"mouseup",this.onNativeMouseUp),this.addNativeHandler(window,"pointermove",this.onNativeMouseMove),this.addNativeHandler(t,"touchstart",this.onNativeTouchStart,{passive:!1}),this.addNativeHandler(t,"touchmove",this.onNativeTouchMove,{passive:!1}),this.addNativeHandler(t,"touchend",this.onNativeTouchEnd,{passive:!1}),this.addNativeHandler(t,"touchcancel",this.onNativeTouchCancel,{passive:!1}),this.addNativeHandler(t,"wheel",this.onNativeWheel,{passive:!1}),this.addNativeHandler(t,"keydown",this.onNativeKeyDown),this.addNativeHandler(t,"keyup",this.onNativeKeyUp),this.addNativeHandler(t,"focus",this.onCanvasFocus),this.addNativeHandler(t,"blur",this.onCanvasBlur))},r.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.slice().forEach(function(t){return t(e)}),t===st?this.onClick(e):t===se?this.onPointerDown(e):t===sr?this.onPointerUp(e):t===si&&this.onPointerMove(e)},r.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),e1(i,e),function(){e2(i,e)}},r.removeEventListener=function(t,e){var i=this.handlers[t];i&&e2(i,e)},r.dispose=function(){this.resetInputState(),this.handlers={},this.unbindListeners(),this.target=null},r.handleNativeMouseDown=function(t){if(this.enabled&&this.target){this.setMouseButtonPressed(t.button,!0);var e=this.getCanvasPosition(t.clientX,t.clientY);this.focusTarget();var i=this.createPointerState(e);this.mouseState=i,i.pressed=!0;var r=this.pushNativeMouseButton(t,e,!0);if(i.inputHandled=r,!r){var n=this.createPointerEvent(t,e,i);this.dispatchEvent(se,n)}this.consumeNativeEvent(t,r)}},r.handleNativeKey=function(e,i){if(this.enabled){var r,n,a,o=new o4;o.device=o2.deviceIdKeyboard,o.pressed=i,o.echo=i&&e.repeat,o.keycode=e.key,o.physicalKeycode=e.code,o.keyLabel=e.key,o.unicode=1===(n=Array.from(e.key)).length&&null!=(r=n[0].codePointAt(0))?r:0,o.location=1===(a=e.location)?t.KeyLocation.Left:2===a?t.KeyLocation.Right:t.KeyLocation.Unspecified,o.shiftPressed=e.shiftKey,o.altPressed=e.altKey,o.metaPressed=e.metaKey,o.ctrlPressed=e.ctrlKey,this.consumeNativeEvent(e,this.pushInput(o))}},r.handleNativeTouchEnd=function(t,e){if(this.enabled){for(var i,r=iQ(Array.from(t.changedTouches));!(i=r()).done;){var n=i.value,a=this.getCanvasPosition(n.clientX,n.clientY),o=this.touchStates.get(n.identifier);if(null==o?void 0:o.pressed){var s=this.pushNativeScreenTouch(n.identifier,a,!1,e,!1),u=this.createPointerEvent(t,a,o);!e&&!o.inputHandled&&!s&&this.isClick(o,a)&&this.dispatchEvent(st,u),s||e||o.inputHandled||this.dispatchEvent(sr,u),this.touchStates.delete(n.identifier),this.consumeNativeEvent(t,s||o.inputHandled||!this.allowPropagation)}}this.preventTouchDefaults(t)}},r.pushNativeMouseButton=function(e,i,r){var n=!1,a=sa(e.button);return r&&this.emulateTouchFromMouse&&a===t.MouseButton.Left&&(this.touchFromMousePressed=!0),this.touchFromMousePressed&&a===t.MouseButton.Left&&(n=this.pushScreenTouch(0,i,r,!1,e.detail>1,o2.deviceIdEmulation),r||(this.touchFromMousePressed=!1)),this.pushMouseButton(e,i,r)||n},r.pushNativeMouseMotion=function(e,i,r,n){var a=!1;return this.touchFromMousePressed&&(this.mouseButtonMask&t.MouseButtonMask.Left)!=0&&(a=this.pushScreenDrag(0,i,r,n,o2.deviceIdEmulation)),this.pushMouseMotion(e,i,r,n)||a},r.pushNativeScreenTouch=function(t,e,i,r,n){var a=!1,o=!1;return i&&this.emulateMouseFromTouch&&null===this.mouseFromTouchIndex?(this.mouseFromTouchIndex=t,o=!0):i||this.mouseFromTouchIndex!==t||(o=!0,this.mouseFromTouchIndex=null),o&&(a=this.pushEmulatedMouseButton(e,i,r,n)),this.pushScreenTouch(t,e,i,r,n,0)||a},r.pushNativeScreenDrag=function(t,e,i,r){var n=!1;return this.emulateMouseFromTouch&&this.mouseFromTouchIndex===t&&(n=this.pushEmulatedMouseMotion(e,i,r)),this.pushScreenDrag(t,e,i,r,0)||n},r.pushEmulatedMouseButton=function(e,i,r,n){var a=new o6;return a.device=o2.deviceIdEmulation,a.position.copyFrom(e),a.globalPosition.copyFrom(e),a.buttonIndex=t.MouseButton.Left,a.buttonMask=i?t.MouseButtonMask.Left:t.MouseButtonMask.None,a.pressed=i,a.canceled=r,a.doubleClick=n,this.pushInput(a)},r.pushEmulatedMouseMotion=function(e,i,r){var n=new o8;return n.device=o2.deviceIdEmulation,n.position.copyFrom(e),n.globalPosition.copyFrom(e),n.buttonMask=t.MouseButtonMask.Left,n.pressed=!0,n.relative.copyFrom(i),n.screenRelative.copyFrom(i),n.velocity.copyFrom(r),n.screenVelocity.copyFrom(r),this.pushInput(n)},r.pushMouseButton=function(t,e,i){var r=new o6;return this.copyMouseFields(r,t,e),r.device=o2.deviceIdMouse,r.buttonIndex=sa(t.button),r.buttonMask=this.mouseButtonMask,r.pressed=i,r.doubleClick=t.detail>1,this.pushInput(r)},r.setMouseButtonPressed=function(e,i){var r=function(e){switch(e){case t.MouseButton.Left:return t.MouseButtonMask.Left;case t.MouseButton.Right:return t.MouseButtonMask.Right;case t.MouseButton.Middle:return t.MouseButtonMask.Middle;case t.MouseButton.Xbutton1:return t.MouseButtonMask.Xbutton1;case t.MouseButton.Xbutton2:return t.MouseButtonMask.Xbutton2;default:return t.MouseButtonMask.None}}(sa(e));i?this.mouseButtonMask|=r:this.mouseButtonMask&=~r},r.pushWheelButton=function(t,e,i,r){var n=new o6;return this.copyMouseFields(n,r,i),n.device=o2.deviceIdMouse,n.buttonIndex=t,n.buttonMask=this.mouseButtonMask,n.factor=e,n.pressed=!0,this.pushInput(n)},r.pushMouseMotion=function(e,i,r,n){var a=new o8;return this.copyMouseFields(a,e,i),a.device=o2.deviceIdMouse,a.buttonMask=this.mouseButtonMask,a.pressed=this.mouseButtonMask!==t.MouseButtonMask.None,a.relative.copyFrom(r),a.screenRelative.copyFrom(r),a.velocity.copyFrom(n),a.screenVelocity.copyFrom(n),"pressure"in e&&(a.pressure=e.pressure,a.tilt.set(e.tiltX,e.tiltY)),this.pushInput(a)},r.pushScreenTouch=function(t,e,i,r,n,a){var o=new o9;return o.index=t,o.device=a,o.position.copyFrom(e),o.pressed=i,o.canceled=r,o.doubleTap=n,this.pushInput(o)},r.pushScreenDrag=function(t,e,i,r,n){var a=new o7;return a.index=t,a.device=n,a.position.copyFrom(e),a.relative.copyFrom(i),a.screenRelative.copyFrom(i),a.velocity.copyFrom(r),a.screenVelocity.copyFrom(r),a.pressed=!0,this.pushInput(a)},r.copyMouseFields=function(t,e,i){t.position.copyFrom(i),t.globalPosition.copyFrom(i),t.shiftPressed=e.shiftKey,t.altPressed=e.altKey,t.metaPressed=e.metaKey,t.ctrlPressed=e.ctrlKey},r.onClick=function(t){for(var e,i=[],r=iQ(this.engine.compositions);!(e=r()).done;){var n=e.value;i.push.apply(i,[].concat(n.hitTest(t.x,t.y)))}for(var a,o=iQ(i);!(a=o()).done;){var s=a.value,u=s.item.composition;if(u){var h=ro({},s,{compositionId:u.id,compositionName:u.name});s.item.emit("click",s),u.emit("click",h),this.engine.emit("click",h)}}},r.onPointerDown=function(t){this.handlePointerEvent(t,0)},r.onPointerUp=function(t){this.handlePointerEvent(t,1)},r.onPointerMove=function(t){this.handlePointerEvent(t,2)},r.handlePointerEvent=function(t,e){var i=null;if(!(2===e&&this.skipPointerMovePicking))for(var r,n=iQ(this.engine.compositions);!(r=n()).done;){var a=r.value.hitTest(t.x,t.y);a.length>0&&(i=a[a.length-1])}var o=new nN;o.position.x=(t.x+1)/2*t.width,o.position.y=(t.y+1)/2*t.height,o.delta.x=t.vx*t.width,o.delta.y=t.vy*t.height,i&&(o.pointerCurrentRaycast.point=i.position,o.pointerCurrentRaycast.item=i.item);var s=0===e?"pointerdown":1===e?"pointerup":"pointermove";if(i){var u=i.item,h=u.composition;u.emit(s,o),h.emit(s,o),this.engine.emit(s,o)}},r.createPointerState=function(t){return{start:t.clone(),last:t.clone(),lastTime:performance.now(),inputHandled:!1,pressed:!1}},r.updatePointerState=function(t,e){t.last.copyFrom(e),t.lastTime=performance.now()},r.getVelocity=function(t,e){var i=Math.max(performance.now()-t.lastTime,1);return new e7((e.x-t.last.x)/i,(e.y-t.last.y)/i)},r.isClick=function(t,e){return Math.abs(e.x-t.start.x)+Math.abs(e.y-t.start.y)<4},r.createPointerEvent=function(t,e,i,r){void 0===r&&(r=new e7);var n,a,o=this.target,s=null==o?void 0:o.getBoundingClientRect(),u=(null==s?void 0:s.width)||1,h=(null==s?void 0:s.height)||1;return{x:e.x/u*2-1,y:1-e.y/h*2,vx:r.x/u*2,vy:-r.y/h*2,ts:performance.now(),dx:(e.x-i.start.x)/u*2,dy:-(e.y-i.start.y)/h*2,width:null!=(n=null==o?void 0:o.width)?n:0,height:null!=(a=null==o?void 0:o.height)?a:0,origin:t}},r.getCanvasPosition=function(t,e){var i,r=null==(i=this.target)?void 0:i.getBoundingClientRect();return r?new e7(t-r.left,e-r.top):new e7},r.consumeNativeEvent=function(t,e){e&&!this.allowPropagation&&(t.cancelable&&t.preventDefault(),t.stopPropagation())},r.pushInput=function(t){return t.clearAccepted(),this.emit("input",t),t.isAccepted()},r.preventTouchDefaults=function(t){t.cancelable&&t.preventDefault()},r.focusTarget=function(){var t;null==(t=this.target)||t.focus()},r.resetInputState=function(){this.mouseState=null,this.mouseButtonMask=t.MouseButtonMask.None,this.touchStates.clear(),this.mouseFromTouchIndex=null,this.touchFromMousePressed=!1},r.addNativeHandler=function(t,e,i,r){t.addEventListener(e,i,r),this.nativeHandlers.push({target:t,name:e,handler:i,options:r})},r.unbindListeners=function(){for(var t,e=iQ(this.nativeHandlers);!(t=e()).done;){var i=t.value;i.target.removeEventListener(i.name,i.handler,i.options)}this.nativeHandlers=[],this.addedTabIndex&&this.target&&this.target.removeAttribute("tabindex"),this.addedOutlineStyle&&this.target&&this.target.style.removeProperty("outline"),this.addedTabIndex=!1,this.addedOutlineStyle=!1},rk(i,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(this._enabled=t)}}]),i}(nU);function sa(e){switch(e){case 0:return t.MouseButton.Left;case 1:return t.MouseButton.Middle;case 2:return t.MouseButton.Right;case 3:return t.MouseButton.Xbutton1;case 4:return t.MouseButton.Xbutton2;default:return t.MouseButton.None}}function so(t,e){var i=Math.abs(t);return 1===e?i/3:2===e?i:i/100}var ss=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX)),su=1,sh=function(){function e(t,e,i){this.transform=e,this.engine=i,this.color=t.options.previewColor;var r=this.createMaterial(),n=this.createGeometry();this.mesh=this.createMesh(n,r),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new it,n=new rh,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(){var e=[["ENV_EDITOR",this.engine.env===nB]],i=aF(this.color).getValue(0),r={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPos;\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\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(aPos.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}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:t.GLSLVersion.GLSL1,macros:e}},n=nw.create(this.engine,r);return n.blending=!0,n.depthTest=!1,n.setVector4("uPos",new ie(0,0,0,0)),n.setVector2("uSize",new e7(1,1)),n.setVector4("uColor",new ie(i[0]/255,i[1]/255,i[2]/255,i[3])),n.setQuaternion("uQuat",new rh(0,0,0,0)),n},i.createGeometry=function(){var t,e=new Uint16Array([0,1,1,2,2,3,3,0]);return a6.create(this.engine,{attributes:((t={})[nV.PositionKind]={size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])},t),drawCount:e.length,indices:{data:e},mode:rG.LINES,maxVertex:4})},i.createMesh=function(t,e){return os.create(this.engine,{name:"Interact_preview"+su++,priority:0,worldMatrix:nm.fromIdentity(),geometry:t,material:e})},e}();function sl(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.speed=25,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.invalidBorderRange=0,t.invalidByBorderRange=!1,t.duringPlay=!1,t._interactive=!0,t.lastTime=-1,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i,clipMasks:t.frameClipMasks}}},t}iY(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.engine.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===tK.CLICK&&(this.clickable=!0,r&&t===nB&&(this.previewContent=new sh(this.item.props.content,this.transform,this.engine))),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this);var t=this.interactData.options.type,i=this.item.engine.env;if(t===tK.CLICK)this.clickable=!0;else if(t===tK.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==nB||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,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,sl(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,o=n.fov,s=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(h),c=this.dragRange,f=c.dxRange,d=c.dyRange,p=a[0]-this.dragRatio[0]*(u*l),m=a[1]-this.dragRatio[1]*(s*l),v=f[0],y=f[1],g=d[0],x=d[1];p=e9(p,v,y),m=e9(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new it(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={touchstart:function(t){if(n.canInteract()&&(n.invalidByBorderRange=n.checkInvalidBorderRange({x:t.x,y:t.y}),!n.invalidByBorderRange)){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.invalidByBorderRange||(n.handleDragMove(r,t),n.bouncingArg=t)},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!sl(e,3)&&e&&(e.vx*=n.speed,e.vy*=n.speed,n.dragEvent=ro({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=n3(it.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tK.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},r.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i,r,n,a,o=0,s=0,u=0,h=0;if("number"==typeof e?(o=e,s=e,u=e,h=e):iP(e)&&(o=void 0===(i=e[0])?0:i,s=void 0===(r=e[1])?0:r,u=void 0===(n=e[2])?0:n,h=void 0===(a=e[3])?0:a),t.x<h-1||t.x>1-s||t.y<o-1||t.y>1-u)return!0}return!1},rk(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(nk),t.InteractComponent=eq([i1(eS.InteractComponent)],t.InteractComponent);var sc=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return iY(e,t),e}(oJ(iX));t.SpriteRotation=void 0,(tN=t.SpriteRotation||(t.SpriteRotation={}))[tN.None=0]="None",tN[tN.Rotate90=1]="Rotate90",t.Sprite=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).rect=[0,0,1,1],r.rotation=0,i&&r.fromData(i),r}return iY(e,t),e.prototype.fromData=function(e){var i,r;t.prototype.fromData.call(this,e),this.texture=e.texture?this.engine.findObject(e.texture):this.engine.whiteTexture,this.rect=null!=(i=e.rect)?i:[0,0,1,1],this.rotation=null!=(r=e.rotation)?r:0},e}(i4),t.Sprite=eq([i1("Sprite")],t.Sprite);var sf=function(){function t(){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0}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.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),sd=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),sp=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(i4);t.PlayState=void 0,(tF=t.PlayState||(t.PlayState={}))[tF.Playing=0]="Playing",tF[tF.Paused=1]="Paused",tF[tF.Stopped=2]="Stopped";var sm=[1,1,1,1],sv=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}iY(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(eZ(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(o=this.activeComponent)?void 0:o.material;var o,s,u=null==(s=this.activeMaterial)?void 0:s.getColor("_Color");u&&(this.startColor=u.toArray())}var h=n$(sm,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,f=this.colorOverLifetime;f&&(h=ia(f,l,!0),i=!0),c&&(h[3]*=c.getValue(l),i=!0),i&&(n0(this.renderColor,h,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getColor("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=aF(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===t4.GRADIENT_COLOR&&(this.colorOverLifetime=io(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(oq)},i}(sf),sy=function(){function t(){}return t.prototype.onEvent=function(t,e){},t}(),sg=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.onEvent=function(t,e){t.emit("animationevent",e)},e}(oJ(sy));t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e.events=[],e}iY(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=e9(e,0,this.duration),n=iQ(this.positionCurves);!(i=n()).done;){var a=i.value,o=a.keyFrames.getValue(r),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,h=iQ(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=iQ(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=iQ(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),S=this.findTarget(t,b.path);null==S||S.transform.setScale(T.x,T.y,T.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=iQ(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:aF(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var o,s=iQ(t.rotationCurves);!(o=s()).done;){var u=o.value,h={path:u.path,keyFrames:aF(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=iQ(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:aF(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=iQ(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:aF(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=iQ(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:aF(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var S,E=iQ(t.colorCurves);!(S=E()).done;){var C=S.value,w={path:C.path,keyFrames:aF(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,w.keyFrames.getMaxTime()),this.colorCurves.push(w)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var _,M=iQ(t.events);!(_=M()).done;){var A,P=_.value,I={name:P.name,startTime:P.startTime,duration:null!=(A=P.duration)?A:0,event:new sg};this.events.push(I)}},i.findTarget=function(t,e){for(var i,r=t,n=e.split("."),a=iQ(n);!(i=a()).done;){for(var o,s=i.value,u=!1,h=iQ(r.children);!(o=h()).done;){var l=o.value;if(l.name===s){r=l,u=!0;break}}if(!u)return}return r},e}(i4),t.AnimationClip=eq([i1(eS.AnimationClip)],t.AnimationClip);var sx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}iY(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=iQ(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(eZ(t,sf)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t){this.clipWeights[i]=e;return}}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(sf),sb=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(eZ(i,t.VFXItem)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sx),sT=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eZ(i,t.VFXItem)&&(i.time=this.time)},i}(sf),sS=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(sf),sE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyPath="",e.propertyName="",e}iY(e,t);var i=e.prototype;return i.evaluate=function(t){var e=t.output.getUserData();if(e){this.directTarget||this.preparePath(e);var i=!1;if(this.propertyValue=this.directTarget[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var a=this.getClipPlayable(r);if(!eZ(a,sS)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=a.value;this.addWeightedValue(o,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,eZ(e,rB)&&e.onApplyAnimationProperties())}}},i.preparePath=function(t){for(var e=this.propertyPath.split("."),i=t,r=0;r<e.length-1;r++){var n=i[e[r]];void 0===n&&console.error("The "+e[r]+" property of "+t+" was not found"),i=n}e.length>0&&(this.propertyName=e[e.length-1]),this.directTarget=i},e}(sx),sC=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(sE),sw=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(sE),s_=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.evaluate=function(t){},e}(sx),sM=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.evaluate=function(t){},e}(sx),sA=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){for(var i=0;i<this.clipPlayables.length;i++)if(this.getClipWeight(i)>0){var r=this.getClipPlayable(i);eZ(r,sS)&&r.value&&(e.sprite=r.value);break}}},e}(sx),sP=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();eZ(i,t.CompositionComponent)&&i.tick(this.getTime()-i.getTime())},i}(sf),sI=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(eZ(i,t.CompositionComponent)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},i}(sx),sR=function(){function t(){this.hasContribution=!1,this.hasPosition=!1,this.hasRotation=!1,this.hasScale=!1,this.appliedPosition=!1,this.appliedRotation=!1,this.appliedScale=!1,this.outPos=new it,this.outRot=new nv,this.outScale=new it(1,1,1),this.weightedRot=new nv}var e=t.prototype;return e.captureBasePose=function(t){this.ensureBasePose(t)},e.getBasePosition=function(){var t;return null==(t=this.basePose)?void 0:t.position},e.resetFrame=function(){this.hasContribution=!1,this.hasPosition=!1,this.hasRotation=!1,this.hasScale=!1},e.addContribution=function(t,e,i){if(!(i<=0)){if(this.ensureBasePose(t),!this.hasContribution){var r=this.basePose;this.outPos.copyFrom(r.position),this.outRot.copyFrom(r.rotation),this.outScale.copyFrom(r.scale),this.hasContribution=!0}e.hasPosition&&(this.hasPosition=!0,this.outPos.x+=e.position.x*i,this.outPos.y+=e.position.y*i,this.outPos.z+=e.position.z*i),e.hasRotation&&(this.hasRotation=!0,this.weightedRot.set(e.rotation.x*i,e.rotation.y*i,e.rotation.z*i,e.rotation.order),this.outRot.addEulers(this.outRot,this.weightedRot)),e.hasScale&&(this.hasScale=!0,this.outScale.x*=Math.pow(e.scale.x,i),this.outScale.y*=Math.pow(e.scale.y,i),this.outScale.z*=Math.pow(e.scale.z,i))}},e.flush=function(t){var e=this.basePose;e&&(this.hasContribution||this.appliedPosition||this.appliedRotation||this.appliedScale)&&(this.hasPosition?(t.transform.setPosition(this.outPos.x,this.outPos.y,this.outPos.z),this.appliedPosition=!0):this.appliedPosition&&(t.transform.setPosition(e.position.x,e.position.y,e.position.z),this.appliedPosition=!1),this.hasRotation?(t.transform.setRotation(this.outRot.x,this.outRot.y,this.outRot.z),this.appliedRotation=!0):this.appliedRotation&&(t.transform.setRotation(e.rotation.x,e.rotation.y,e.rotation.z),this.appliedRotation=!1),this.hasScale?(t.transform.setScale(this.outScale.x,this.outScale.y,this.outScale.z),this.appliedScale=!0):this.appliedScale&&(t.transform.setScale(e.scale.x,e.scale.y,e.scale.z),this.appliedScale=!1))},e.dispose=function(){this.basePose=void 0,this.boundInstanceId=void 0,this.appliedPosition=!1,this.appliedRotation=!1,this.appliedScale=!1,this.resetFrame()},e.ensureBasePose=function(t){if(!this.basePose||this.boundInstanceId!==t.getInstanceId()){var e=t.transform.scale;this.basePose={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new it(e.x,e.y,e.x)},this.boundInstanceId=t.getInstanceId(),this.appliedPosition=!1,this.appliedRotation=!1,this.appliedScale=!1}},t}(),sO=new nv,sV=new it,sN=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.started=!1,t.contribution={hasPosition:!1,position:new it,hasRotation:!1,rotation:new nv,hasScale:!1,scale:new it(1,1,1)},t}iY(i,e);var r=i.prototype;return r.start=function(){var t,e=this.data.positionOverLifetime,i=this.data.rotationOverLifetime,r=this.data.sizeOverLifetime;if(e&&0!==Object.keys(e).length){this.positionOverLifetime=e,e.path&&(this.pathGetter=aF(e.path));var n=e.linearX||e.linearY||e.linearZ;n&&(this.linearVelOverLifetime={x:e.linearX&&aF(e.linearX),y:e.linearY&&aF(e.linearY),z:e.linearZ&&aF(e.linearZ),asMovement:e.asMovement,enabled:!!n});var a=e.orbitalX||e.orbitalY||e.orbitalZ;a&&(this.orbitalVelOverLifetime={x:e.orbitalX&&aF(e.orbitalX),y:e.orbitalY&&aF(e.orbitalY),z:e.orbitalZ&&aF(e.orbitalZ),center:nJ(e.orbCenter),asRotation:e.asRotation,enabled:!!a}),this.speedOverLifetime=e.speedOverLifetime&&aF(e.speedOverLifetime)}if(r&&(r.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=aF(r.x||1),this.sizeYOverLifetime=aF(r.y||1),this.sizeZOverLifetime=aF(r.z||1)):this.sizeXOverLifetime=aF(r.size||1)),i&&(this.rotationOverLifetime={asRotation:i.asRotation,separateAxes:i.separateAxes,z:aF(i.z||0)},i.separateAxes)){var o=this.rotationOverLifetime;o.x=aF(i.x||0),o.y=aF(i.y||0)}this.gravity=it.fromArray((null==e?void 0:e.gravity)||[]),this.gravityModifier=aF(null!=(t=null==e?void 0:e.gravityOverLifetime)?t:0),this.direction=(null==e?void 0:e.direction)?it.fromArray(e.direction).normalize():new it,this.startSpeed=(null==e?void 0:e.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){this.ensureStarted();var i=e.output.getUserData();!this.originalTransform&&eZ(i,t.VFXItem)&&this.captureOriginalTransform(i)},r.getContribution=function(t){return this.ensureStarted(),this.sampleAnimation(t),this.contribution},r.ensureStarted=function(){this.started||(this.start(),this.started=!0)},r.sampleAnimation=function(t){var e,i=this,r=this.contribution;r.hasPosition=!1,r.hasRotation=!1,r.hasScale=!1;var n=this.getDuration();if(!(n<=0)){var a=this.time/n;if(a=a<0?0:a,this.sizeXOverLifetime?(r.hasScale=!0,r.scale.x=this.sizeXOverLifetime.getValue(a),this.sizeSeparateAxes?(r.scale.y=this.sizeYOverLifetime.getValue(a),r.scale.z=this.sizeZOverLifetime.getValue(a)):r.scale.z=r.scale.y=r.scale.x):r.hasScale=!1,this.rotationOverLifetime){r.hasRotation=!0;var o=function(t){return i.rotationOverLifetime.asRotation?t.getValue(a):t.getIntegrateValue(0,a,n)},s=o(this.rotationOverLifetime.z),u=this.rotationOverLifetime.separateAxes;sO.x=u?o(this.rotationOverLifetime.x):0,sO.y=u?o(this.rotationOverLifetime.y):0,sO.z=s,r.rotation.copyFrom(sO)}else r.hasRotation=!1;this.positionOverLifetime?(r.hasPosition=!0,(null==(e=this.orbitalVelOverLifetime)?void 0:e.enabled)&&t?(nQ(r.position,this,this.gravity,this.time,n,t,this.velocity),this.pathGetter&&r.position.add(this.pathGetter.getValue(a)),r.position.subtract(t)):(sV.set(0,0,0),nQ(r.position,this,this.gravity,this.time,n,sV,this.velocity),this.pathGetter&&r.position.add(this.pathGetter.getValue(a)))):r.hasPosition=!1}},r.captureOriginalTransform=function(t){var e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new it(e.x,e.y,e.x)},this.pathGetter&&(this.originalTransform.path=this.pathGetter)},i}(sf);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new sN;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(sp),t.TransformPlayableAsset=eq([i1(eS.TransformPlayableAsset)],t.TransformPlayableAsset);var sF=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.clipMixer=new sR,t}iY(i,e);var r=i.prototype;return r.dispose=function(){this.clipMixer.dispose(),e.prototype.dispose.call(this)},r.evaluate=function(e){var i=e.output.getUserData();if(eZ(i,t.VFXItem)){this.clipMixer.captureBasePose(i),this.clipMixer.resetFrame();for(var r=0;r<this.clipPlayables.length;r++){var n=this.clipWeights[r];if(n&&!(n<=0)){var a=this.clipPlayables[r];eZ(a,sN)&&this.clipMixer.addContribution(i,a.getContribution(this.clipMixer.getBasePosition()),n)}}this.clipMixer.flush(i)}},i}(sx),sL=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(sE),sD=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e},e}(sE),sk=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(sE),sB=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===t6.restart?e%=i:this.endBehavior===t6.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}iY(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new sx},i.createOutput=function(){return new sd},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=iQ(this.clips);!(e=r()).done;){var n=e.value;i.push(n)}return this.compileClips(i,t)},i.compileClips=function(t,e){for(var i,r=this.createTrackMixer(),n=iQ(t);!(i=n()).done;){var a=i.value,o=this.createClipPlayable(a);o.setDuration(a.duration);var s=new sz(a,o,r);e.push(s),r.clipPlayables.push(o),r.setClipWeight(o,0)}return r},i.createPlayable=function(){return new sf},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new sB;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=iQ(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t){return t.asset.createPlayable()},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=iQ(this.children);!(i=r()).done;)i.value.parent=this},e}(sp),eq([i3(sB,void 0)],t.TrackAsset.prototype,"clips",void 0),eq([i3(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=eq([i1(eS.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tL=t.TrackType||(t.TrackType={}))[tL.MasterTrack=0]="MasterTrack",tL[tL.ObjectTrack=1]="ObjectTrack";var sz=function(){function e(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,a=!1;e>=i.start+i.duration&&i.endBehavior===t6.destroy?(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==t.PlayState.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var o=i.toLocalTime(e);this.playable.setTime(o),n&&this.playable.getPlayState()===t.PlayState.Playing&&this.playable.pause()},rk(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),e}();t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sb},e}(t.TrackAsset),t.ActivationTrack=eq([i1(eS.ActivationTrack)],t.ActivationTrack);var sU=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}return iY(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);eq([i3(void 0,void 0)],sU.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sw;return t.propertyPath=this.path,t},e}(sU),t.FloatPropertyTrack=eq([i1(eS.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sM},e}(t.TrackAsset),t.SpriteColorTrack=eq([i1(eS.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}iY(i,e);var r=i.prototype;return r.updateAnimatedObject=function(e){if(!eZ(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(t.CompositionComponent)},r.createTrackMixer=function(){return new sI},i}(t.TrackAsset),t.SubCompositionTrack=eq([i1(eS.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sF},e}(t.TrackAsset),t.TransformTrack=eq([i1(eS.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.updateAnimatedObject=function(t){if(!eZ(t,nk))throw Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(t.TrackAsset),eq([i3(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=eq([i1("MaterialTrack")],t.MaterialTrack);var sG=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new s_},e}(t.TrackAsset);function sW(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sL;return t.propertyPath=this.path,t},e}(sU),t.Vector4PropertyTrack=eq([i1(eS.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector3PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sD;return t.propertyPath=this.path,t},e}(sU),t.Vector3PropertyTrack=eq([i1(eS.Vector3PropertyTrack)],t.Vector3PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sk;return t.propertyPath=this.path,t},e}(sU),t.Vector2PropertyTrack=eq([i1(eS.Vector2PropertyTrack)],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){var t=new sC;return t.propertyPath=this.path,t},e}(sU),t.ColorPropertyTrack=eq([i1(eS.ColorPropertyTrack)],t.ColorPropertyTrack),t.SpritePropertyTrack=function(e){function i(){return e.apply(this,arguments)}iY(i,e);var r=i.prototype;return r.createTrackMixer=function(){return new sA},r.updateAnimatedObject=function(e){return e.getComponent(t.SpriteComponent)},i}(sU),t.SpritePropertyTrack=eq([i1("SpritePropertyTrack")],t.SpritePropertyTrack);var sj=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=new it(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*e4),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(iN(0,1)),direction:n.normalize()}},t}();function sX(t,e,i){if(e===t9.RANDOM)t=iN(0,t);else if(e===t9.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===t9.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===t9.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var sH=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=new it(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),sY=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=iN(-this._d,this._d),i=iN(-this._h,this._h);return{direction:new it(0,0,1),position:new it(e,i,0)}},t}(),sZ=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=new it(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new it;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),sq=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===t9.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):iN(0,1);return{direction:new it(0,1,0),position:new it(this._d*(e-.5),0,0)}},t}(),sK=new nm,sQ=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=iN(0,2*Math.PI),n=sX(this.arc,this.arcMode,t)*e4,a=sK.setFromRotationZ(n),o=new it(Math.cos(r),Math.sin(r),0),s=new it(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),sJ=new nm,s$=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return iN(-90,90)},e.generate=function(t){var e=sX(this.arc,this.arcMode,t)*e4,i=this.getHorizontalAngle()*e4,r=this.radius,n=new it(Math.cos(i),0,Math.sin(i)),a=sJ.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),s0=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.getHorizontalAngle=function(){return iN(0,90)},e}(s$),s1=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=e9(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(sX(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new it(r,n,0);return{position:new it(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),s2=function(){function t(){}return t.prototype.generate=function(){return{position:new it,direction:new it}},t}(),s3=((eL={})[tZ.NONE]=s2,eL[tZ.CONE]=sj,eL[tZ.SPHERE]=s$,eL[tZ.HEMISPHERE]=s0,eL[tZ.CIRCLE]=sH,eL[tZ.DONUT]=sQ,eL[tZ.RECTANGLE]=sY,eL[tZ.EDGE]=sq,eL[tZ.RECTANGLE_EDGE]=sZ,eL[tZ.TEXTURE]=s1,eL);function s4(t){if(!t)return new s2;var e=ro({radius:1,arc:360,angle:0,arcMode:t9.RANDOM},t),i=t.type,r=s3[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tZ.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=it.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function s5(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=us(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=us(a,t[a],t[a+1],o);return o&&ue(o,o.next)&&(uu(o),o=o.next),o}function s6(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ue(r,r.next)||0===ut(r.prev,r,r.next))){if(uu(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function s8(t,e){return t.x-e.x}function s9(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function s7(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function ut(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ue(t,e){return t.x===e.x&&t.y===e.y}function ui(t,e,i,r){var n=un(ut(t,e,i)),a=un(ut(t,e,r)),o=un(ut(i,r,t)),s=un(ut(i,r,e));return!!(n!==a&&o!==s||0===n&&ur(t,i,e)||0===a&&ur(t,r,e)||0===o&&ur(i,t,r)||0===s&&ur(i,e,r))}function ur(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function un(t){return t>0?1:t<0?-1:0}function ua(t,e){return 0>ut(t.prev,t,t.next)?ut(t,e,t.next)>=0&&ut(t,t.prev,e)>=0:0>ut(t,e,t.prev)||0>ut(t,t.next,e)}function uo(t,e){var i=new uh(t.i,t.x,t.y),r=new uh(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function us(t,e,i,r){var n=new uh(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function uu(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 uh(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ul=0;function uc(t,e,i,r){i=i||2,ul=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=s5(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,o,s,u,h=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=s5(t,o,s,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(s8),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var h=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=o&&h>u){if(u=h,h===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var l,c=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&s7(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(l=Math.abs(s-a.y)/(o-a.x),ua(a,t)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>ut(i.prev,i,r.prev)&&0>ut(r.next,i,i.next))))&&(n=a,p=l)),a=a.next;while(a!==c);return n}(t,e)){var i=uo(e,t);s6(e,e.next),s6(i,i.next)}})(h[n],i),i=s6(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=s9(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,o,s,u,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<h&&(s++,r=r.nextZ);e++);for(u=h;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(o>1)}(n)}(e,n,a,o);for(var u,h,l=e;e.prev!==e.next;){if(u=e.prev,h=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(ut(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,h=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,l=s9(o,s,e,i,r),c=s9(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=l&&d&&d.z<=c;){if(f!==t.prev&&f!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ut(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ut(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ut(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&s7(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ut(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(ut(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(s7(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&ut(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+ul),i.push(e.i/r+ul),i.push(h.i/r+ul),uu(e),e=h.next,l=h.next;continue}if((e=h)===l){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ue(n,a)&&ui(n,r,r.next,a)&&ua(n,a)&&ua(a,n)&&(e.push(n.i/i+ul),e.push(r.i/i+ul),e.push(a.i/i+ul),uu(r),uu(r.next),r=t=a),r=r.next}while(r!==t);return s6(r)}(s6(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,h,l=s.next.next;l!==s.prev;){if(s.i!==l.i&&(u=s,h=l,u.next.i!==h.i&&u.prev.i!==h.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ui(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(ua(u,h)&&ua(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(ut(u.prev,u,h.prev)||ut(u,h.prev,h))||ue(u,h)&&ut(u.prev,u,u.next)>0&&ut(h.prev,h,h.next)>0))){var c=uo(s,l);s=s6(s,s.next),c=s6(c,c.next),t(s,i,r,n,a,o),t(c,i,r,n,a,o);return}l=l.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(s6(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,l),p}function uf(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,h=0;h<o.length;h++)u+=o[h].length-1;var l,c=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(l=d[4])?d[3]:d[2],g=l?d[2]:d[3]);for(var x=[0,0],b=0===l?0:-Math.PI/2,T=0;T<o.length;T++)for(var S=o[T],E=s[T],C=s[T+1]||s[0],w=[0,0],_=0;_<S.length-1;_++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1]})(w,S[_],E,C,E[4],E[5],C[2],C[3]),i=w[0],r=w[1],c[p++]=i/2,c[p++]=r/2,d?(x[0]=i,x[1]=r,up(x,x,b),c[p++]=m+(x[0]+1)/2*y,c[p++]=v+(x[1]+1)/2*g):(c[p++]=(i+1)/2,c[p++]=(r+1)/2),p+=2;var M=uc(Array.from(c),null,6,void 0===f?0:f);return{aPoint:c,index:new Uint16Array(M)}}function ud(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[t4.SHAPE_POINTS,t.p],s:[t4.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[t4.SHAPE_POINTS,t.g.p],s:[t4.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=uf(n[u],{indexBase:a,uvTransform:e});a+=h.aPoint.length/5,r.push(h),o+=h.aPoint.length,s+=h.index.length}if(1===r.length)return r[0];for(var l=new Float32Array(o),c=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];l.set(m.aPoint,d),d+=m.aPoint.length,c.set(m.index,p),p+=m.index.length}return{aPoint:l,index:c}}function up(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var um=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=eZ(r,ac)?r:aF(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),uv=function(t){this.content=t},uy=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new uv(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new uv(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),ug=new it,ux=new it,ub=function(){function e(e,i){var r,n=this;this.pointStart=[],this.attributeData=new Map;var a=i.colorOverLifetime,o=i.colorOverTrail,s=i.maxTrailCount,u=i.opacityOverLifetime,h=void 0===u?aF(1):u,l=i.widthOverTrail,c=i.name,f=i.occlusion,d=i.blending,p=i.texture,m=i.transparentOcclusion,v=i.minimumVertexDistance,y=i.lifetime,g=i.matrix,x=e.gpuCapability,b=x.detail,T=x.level,S=Math.max(i.pointCountPerTrail,2),E=aw(),C=b.maxVertexTextures>0,w=(null!=e?e:{}).env,_={},M=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===nB]],A=s>64,P=0;a&&(M.push(["COLOR_OVER_LIFETIME",!0]),P|=1,_.uColorOverLifetime=no.createWithData(e,ig(a))),o&&(M.push(["COLOR_OVER_TRAIL",!0]),P|=4,_.uColorOverTrail=no.createWithData(e,ig(o))),A?(M.push(["ATTR_TRAIL_START",1]),P|=8):_.uTrailStart=new Float32Array(s),_.uOpacityOverLifetimeValue=h.toUniform(E);var I=l.toUniform(E);M.push(["VERT_CURVE_VALUE_COUNT",E.index],["VERT_MAX_KEY_FRAME_COUNT",E.max]),_.uVCurveValues=ac.getAllData(E);var R={shader:{vertex:of,fragment:ol,macros:M,glslVersion:1===T?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+P+"+"+E.index+"+"+E.max}},O=S*s*2,V=(S-1)*s,N=Float32Array.BYTES_PER_ELEMENT,F=12*N,L={attributes:((r={})[nV.ColorKind]={size:4,stride:F,data:new Float32Array(12*O)},r.aSeed={size:1,stride:F,offset:4*N,dataSource:nV.ColorKind},r.aInfo={size:3,stride:F,offset:5*N,dataSource:nV.ColorKind},r[nV.PositionKind]={size:4,stride:F,offset:8*N,dataSource:nV.ColorKind},r.aTime={size:1,data:new Float32Array(O)},r.aDir={size:3,data:new Float32Array(3*O)},r),indices:{data:new Uint16Array(6*O)},drawCount:6*V,name:"trail#"+c,bufferUsage:rG.DYNAMIC_DRAW};if(A)L.attributes.aTrailStart={size:1,data:new Float32Array(O)};else{var D=new Float32Array(O);L.attributes.aTrailStartIndex={size:1,data:D};for(var k=0;k<s;k++)for(var B=2*S,z=k*B,U=0;U<B;U++)D[z+U]=k}var G=rH(d),W=nw.create(e,R);W.blending=!0,W.depthMask=f,W.depthTest=!0,rY(W,d);var j=this.mesh=os.create(e,{name:"MTrail_"+c,material:W,geometry:a6.create(e,L)}),X=null!=p?p:no.createWithData(e);Object.keys(_).map(function(t){var e=_[t];if(eZ(e,no))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new ie(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,ie.fromArray(e))}),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",ie.fromArray(I)),W.setVector2("uTexOffset",new e7(0,0)),W.setVector4("uTextureMap",new ie(0,0,1,1)),W.setVector4("uParams",new ie(0,S-1,0,0)),W.setTexture("uMaskTex",X),W.setVector4("uColorParams",new ie(p?1:0,+G,0,+(f&&!m))),this.maxTrailCount=s,this.pointCountPerTrail=S,this.checkVertexDistance=v>0,this.minimumVertexDistance=Math.pow(v||.001,2),this.useAttributeTrailStart=A,this.lifetime=y,g&&(this.mesh.worldMatrix=g),this.geometry=j.firstGeometry(),this.geometry.getAttributeNames().forEach(function(t){var e=n.geometry.getVertexBuffer(t),i=n.geometry.getAttributeData(t);e&&eZ(i,Float32Array)&&n.attributeData.set(e.getWrapperBuffer(),i)}),this.trailCursors=new Uint16Array(s)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,ug);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=uC(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),this.setAttributeSubData("aDir",6*c,v),this.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,this.setAttributeSubData(nV.ColorKind,24*c,g),u>=0){var b=new Float32Array(uC(this.getTrailPosition(t,h,ux),l,e)),T=(t*n+u)*6;this.setAttributeSubData("aDir",T,b),this.setAttributeSubData("aDir",T+3,b);var S=t*n*2,E=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),C=(t*o+(r-1)%o)*6;a.setIndexSubData(C,E)}r=++this.trailCursors[t];var w=this.mesh.material,_=w.getVector4("uParams"),M=p[2];if(this.useAttributeTrailStart){for(var A=2*n,P=new Float32Array(A),I=0;I<A;I++)P[I]=M;this.setAttributeSubData("aTrailStart",t*P.length,P)}else{var R=w.getFloats("uTrailStart");void 0!=R&&(R[t]=M,w.setFloats("uTrailStart",R))}_&&(_.y=Math.max(_.y,r-1)-Math.max(0,r-n),w.setVector4("uParams",_))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.getAttributeData(nV.ColorKind);return i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();iS(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){for(var e=this.getAttributeData("aTime"),i=0;i<e.length;i++)e[i]-=t;this.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();iS(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},i.getAttributeData=function(t){var e=this.geometry.getVertexBuffer(t),i=e&&this.attributeData.get(e.getWrapperBuffer());return iS(i),i},i.setAttributeData=function(t,e){var i=this.geometry.getVertexBuffer(t);iS(i),this.attributeData.set(i.getWrapperBuffer(),e),this.geometry.setAttributeData(t,e)},i.setAttributeSubData=function(t,e,i){this.getAttributeData(t).set(i,e),this.geometry.setAttributeSubData(t,e,i)},i.rebuild=function(){!this.geometry.isInitialized||this.geometry.isDisposed()||this.attributeData.forEach(function(t,e){e.getData()||e.update(t)})},rk(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}(),uT=new it,uS=new it,uE=new it;function uC(t,e,i){return t||i?(t?i?(uS.subtractVectors(e,t).normalize(),uS.subtractVectors(i,e),uE.copyFrom(uS).normalize(),uT.addVectors(uS,uE)):uT.subtractVectors(e,t):uT.subtractVectors(i,e),uT.normalize().toArray()):[0,0,0]}var uw=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.particleSystem=null,t}iY(i,e);var r=i.prototype;return r.getParticleSystem=function(e){if(this.particleSystem)return this.particleSystem;var i=e.output.getUserData();return eZ(i,t.VFXItem)?(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem):null},r.processFrame=function(t){var e=this.getParticleSystem(t);if(e){for(this.time>=0&&this.time<e.time&&e.reset();e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},i}(sf),u_=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new uw},e}(sp),uM={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"},uA=function(){function e(e,i){var r,n,a,o,s,u,h,l,c,f=this;this.particleCount=0,this.cachedRotationVector3=new it,this.cachedRotationMatrix=new ny,this.cachedLinearMove=new it,this.tempMatrix3=new ny,this.attributeData=new Map,this.VERT_MAX_KEY_FRAME_COUNT=0;var d=(null!=e?e:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,b=i.sprite,T=i.gravityModifier,S=i.maxCount,E=i.textureFlip,C=i.useSprite,w=i.name,_=i.gravity,M=i.forceTarget,A=i.side,P=i.occlusion,I=i.anchor,R=i.blending,O=i.transparentOcclusion,V=i.renderMode,N=void 0===V?0:V,F=i.diffuse,L=void 0===F?no.createWithData(e):F,D=e.gpuCapability.detail,k=D.halfFloatTexture,B=D.maxVertexUniforms,z=[["RENDER_MODE",+N],["ENV_EDITOR",d===nB]],U=e.gpuCapability.level,G=aw(),W=aw(),j=B>0,X={},H=0,Y=0;if(this.useSprite=C,j&&z.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(z.push(["SPEED_OVER_LIFETIME",!0]),Y|=2,X.uSpeedLifetimeValue=p.toUniform(G)),(null==b?void 0:b.animate)&&(z.push(["USE_SPRITE",!0]),Y|=4,X.uFSprite=X.uSprite=new Float32Array([b.col,b.row,b.total,b.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(z.push(["COLOR_OVER_LIFETIME",!0]),Y|=16,X.uColorOverLifetime=eZ(m.color,no)?m.color:no.createWithData(e,ig(m.color))),(null==m?void 0:m.opacity)?X.uOpacityOverLifetimeValue=m.opacity.toUniform(G):X.uOpacityOverLifetimeValue=aF(1).toUniform(G),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(X["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(G),i=1,Y|=1<<7+e,v.enabled=!0),z.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(X["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(G),r=1,Y|=1<<10+e,l=!0,y.enabled=!0),z.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(z.push(["AS_LINEAR_MOVEMENT",!0]),Y|=32),l&&((null==y?void 0:y.asRotation)&&(z.push(["AS_ORBITAL_MOVEMENT",!0]),Y|=64),X.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),X.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(G),(null==g?void 0:g.separateAxes)&&(z.push(["SIZE_Y_BY_LIFE",1]),Y|=16384,X.uSizeYByLifetimeValue=null==g?void 0:null==(c=g.y)?void 0:c.toUniform(G)),(null==x?void 0:x.z)&&(X.uRZByLifeTimeValue=x.z.toUniform(G),Y|=32768,z.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(X.uRXByLifeTimeValue=x.x.toUniform(G),Y|=65536,z.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(X.uRYByLifeTimeValue=x.y.toUniform(G),Y|=131072,z.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(z.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Y|=262144),X.uGravityModifierValue=T.toUniform(G),M&&(z.push(["FINAL_TARGET",!0]),Y|=524288,X.uFinalTarget=new Float32Array(M.target||[0,0,0]),X.uForceCurve=M.curve.toUniform(G)),k&&W.max?(Y|=1048576,X.uFCurveValueTexture=ns(e,ac.getAllData(W,!0),W.index,1)):X.uFCurveValues=ac.getAllData(W),G.max+G.curves.length-32>B&&k&&j){var Z=ns(e,ac.getAllData(G,!0),G.index,1);X.uVCurveValueTexture=Z,H=1}else X.uVCurveValues=ac.getAllData(G);var q=["-p:",N,Y,G.index,G.max,W.index,W.max].join("+");z.push(["VERT_CURVE_VALUE_COUNT",G.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",G.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]),this.VERT_MAX_KEY_FRAME_COUNT=G.max;var K={fragment:ol,vertex:"#define LOOKUP_TEXTURE_CURVE "+H+"\n"+oc,glslVersion:1===U?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:q,macros:z,name:"particle#"+w},Q=rH(R);X.uTexOffset=new Float32Array(L?[1/L.getWidth(),1/L.getHeight()]:[0,0]),X.uMaskTex=L,X.uColorParams=new Float32Array([L?1:0,+Q,0,+(!!P&&!O)]),X.uParams=[0,0,0,0],X.uAcceleration=[(null==_?void 0:_[0])||0,(null==_?void 0:_[1])||0,(null==_?void 0:_[2])||0,0];var J=nw.create(e,{shader:K});J.blending=!0,J.depthTest=!0,J.depthMask=!!P,rY(J,R),rZ(J,A),Object.keys(X).map(function(t){var e=X[t];if(eZ(e,no)){J.setTexture(t,e);return}var i=[];switch(uM[t]){case"vec4":J.setVector4(t,ie.fromArray(e));break;case"vec3":J.setVector3(t,it.fromArray(e));break;case"vec2":J.setVector2(t,e7.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new ie(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}J.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),J.setVector3("emissionColor",new it(0,0,0)),J.setFloat("emissionIntensity",0);var $=a6.create(e,(r=4*S,n=this.useSprite,a="particle#"+w,u=12*(s=Float32Array.BYTES_PER_ELEMENT),(o={})[nV.PositionKind]={size:3,offset:0,stride:u,data:new Float32Array(0)},o.aVel={size:3,offset:3*s,stride:u,dataSource:nV.PositionKind},o.aDirX={size:3,offset:6*s,stride:u,dataSource:nV.PositionKind},o.aDirY={size:3,offset:9*s,stride:u,dataSource:nV.PositionKind},o.aRot={size:3,offset:0,stride:8*s,data:new Float32Array(0)},o.aSeed={size:1,offset:3*s,stride:8*s,dataSource:"aRot"},o[nV.ColorKind]={size:4,offset:4*s,stride:8*s,dataSource:"aRot"},o.aOffset={size:4,stride:4*s,data:new Float32Array(0)},o.aTranslation={size:3,data:new Float32Array(0)},o.aLinearMove={size:3,data:new Float32Array(0)},o.aRotation0={size:3,offset:0,stride:9*s,data:new Float32Array(0)},o.aRotation1={size:3,offset:3*s,stride:9*s,dataSource:"aRotation0"},o.aRotation2={size:3,offset:6*s,stride:9*s,dataSource:"aRotation0"},h=o,n&&(h.aSprite={size:3,stride:3*s,data:new Float32Array(0)}),{attributes:h,indices:{data:new Uint16Array(r/4*6)},name:a,maxVertex:r,bufferUsage:t.BufferUsage.Dynamic})),tt=os.create(e,{name:"MParticle_"+w,material:J,geometry:$});this.anchor=I,this.mesh=tt,this.geometry=tt.firstGeometry(),this.geometry.getAttributeNames().forEach(function(t){var e=f.geometry.getVertexBuffer(t),i=f.geometry.getAttributeData(t);e&&eZ(i,Float32Array)&&f.attributeData.set(e.getWrapperBuffer(),i)}),this.forceTarget=M,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=T,this.rotationOverLifetime=x,this.maxCount=S,this.maxParticleBufferCount=S,this.textureOffsets=E?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.getAttributeData("aRot"),i=32*t+4;return[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.particleCount=0,this.geometry.setDrawCount(0)},i.onUpdate=function(t){var e=Math.ceil(this.getAttributeData(nV.PositionKind).length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this,r=this.maxCount;if(t<r){var n,a=t+1,o=4*a,s=this.geometry,u=a>this.maxParticleBufferCount,h=1;this.particleCount>300?h=(this.particleCount+100)/this.particleCount:this.particleCount>100?h=1.4:this.particleCount>0&&(h=2);var l={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},c=this.useSprite;c&&(l.aSprite=new Float32Array(12));var f=new it,d=new rh,p=new it(1,1,1);e.transform.assignWorldTRS(f,d,p);var m=nH.getRotation(d,new nv),v=f.toArray(),y=m.toArray(),g=this.textureOffsets,x=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,S=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random();c&&(n=e.sprite);for(var w=0;w<4;w++){var _=2*w,M=3*w,A=4*w,P=12*w,I=8*w;l.aPos.set(v,P),T.fill(l.aPos,P+3),l.aRot.set(y,I),l.aRot[I+3]=C,l.aRot.set(S,I+4),c&&l.aSprite.set(n,M);var R=e.uv||b;if(R){var O=c?1-g[_+1]:g[_+1];x[0]=R[0]+g[_]*R[2],x[1]=R[1]+O*R[3]}l.aOffset.set(x,A);for(var V=w+w,N=(E[V]-this.anchor.x)*p.x,F=(E[V+1]-this.anchor.y)*p.y,L=0;L<3;L++)l.aPos[P+6+L]=e.dirX.getElement(L)*N,l.aPos[P+9+L]=e.dirY.getElement(L)*F}var D=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(u){var k=e3(s.getIndexData(),6*a,6*r,h);k.set(D,6*t),s.setIndexData(k),this.maxParticleBufferCount=k.length/6}else s.setIndexSubData(6*t,D);Object.keys(l).forEach(function(e){var n=l[e],a=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(u){var c=e3(i.getAttributeData(e),o*a,4*r*a,h);c.set(n,n.length*t),i.setAttributeData(e,c)}else i.setAttributeSubData(e,n.length*t,n)}),this.particleCount=Math.max(a,this.particleCount),s.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.getAttributeData("aTranslation"),n=this.getAttributeData("aVel"),a=this.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=e/1e3*o,S=e/1e3*s,E=e/1e3*u;r[b]+=T,r[b+1]+=S,r[b+2]+=E,r[b+3]+=T,r[b+4]+=S,r[b+5]+=E,r[b+6]+=T,r[b+7]+=S,r[b+8]+=E,r[b+9]+=T,r[b+10]+=S,r[b+11]+=E}}this.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.getAttributeData("aRotation0"),r=this.getAttributeData("aOffset"),n=this.getAttributeData("aRot"),a=this.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=e9((o-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(eZ(this.rotationOverLifetime.x,ap)?c.x+=this.rotationOverLifetime.x.getValue(h,f):c.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(eZ(this.rotationOverLifetime.y,ap)?c.y+=this.rotationOverLifetime.y.getValue(h,f):c.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(eZ(this.rotationOverLifetime.z,ap)?c.z+=this.rotationOverLifetime.z.getValue(h,f):c.z+=this.rotationOverLifetime.z.getValue(h))):s.setZero(),0===c.dot(c)&&s.identity();var d=Math.PI/180,p=c.x*d,m=c.y*d,v=c.z*d,y=Math.sin(p),g=Math.sin(m),x=Math.sin(v),b=Math.cos(p),T=Math.cos(m),S=Math.cos(v);s.set(S,-x,0,x,S,0,0,0,1),s.multiply(this.tempMatrix3.set(T,0,g,0,1,0,-g,0,T)),s.multiply(this.tempMatrix3.set(1,0,0,0,b,-y,0,y,b));var E=9*u,C=s.elements;i.set(C,E),u+4<=t&&(i.set(C,E+9),i.set(C,E+18),i.set(C,E+27))}this.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.getAttributeData("aLinearMove"),r=this.getAttributeData("aOffset"),n=this.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var s=0;s<t;s+=4){var u=a-r[4*s+2],h=r[4*s+3],l=u/h,c=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(eZ(this.linearVelOverLifetime.x,ap)?o.x=this.linearVelOverLifetime.x.getValue(l,c):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(eZ(this.linearVelOverLifetime.y,ap)?o.y=this.linearVelOverLifetime.y.getValue(l,c):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(eZ(this.linearVelOverLifetime.z,ap)?o.z=this.linearVelOverLifetime.z.getValue(l,c):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(eZ(this.linearVelOverLifetime.x,ap)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(eZ(this.linearVelOverLifetime.y,ap)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(eZ(this.linearVelOverLifetime.z,ap)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.setAttributeData("aLinearMove",i)},i.getAttributeData=function(t){var e=this.geometry.getVertexBuffer(t),i=e&&this.attributeData.get(e.getWrapperBuffer());return iS(i),i},i.setAttributeData=function(t,e){var i=this.geometry.getVertexBuffer(t);iS(i),this.attributeData.set(i.getWrapperBuffer(),e),this.geometry.setAttributeData(t,e)},i.setAttributeSubData=function(t,e,i){this.getAttributeData(t).set(i,e),this.geometry.setAttributeSubData(t,e,i)},i.rebuild=function(){!this.geometry.isInitialized||this.geometry.isDisposed()||this.attributeData.forEach(function(t,e){e.getData()||e.update(t)})},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),uP=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="ParticleSystemRenderer",i}iY(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new ie;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e,i=iQ(this.meshes);!(e=i()).done;)e.value.render(t)},i.setup=function(t,e){void 0===e&&(e=null),this.meshes=[],this.materials=[],this.particleMesh=new uA(this.engine,t),e&&(this.trailMesh=new ub(this.engine,e)),this.meshes.push(this.particleMesh.mesh),this.materials.push(this.particleMesh.mesh.material),this.trailMesh&&(this.meshes.push(this.trailMesh.mesh),this.materials.push(this.trailMesh.mesh.material))},i.rebuild=function(){var t;this.particleMesh.rebuild(),null==(t=this.trailMesh)||t.rebuild()},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(nk);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).particleMeshProps=null,n.trailMeshProps=null,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,clipMasks:n.renderer.frameClipMasks,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===t8.removeParticle,ray:t})}}},i.addParticleSystem(sW(n)),n.maskManager=new n_,r&&n.fromData(r),n}iY(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===t4.CONSTANT_VEC3?e.add(r[1]):t=aF(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new uy(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1},r.onStart=function(){var t=this;this.particleMeshProps&&(this.renderer=this.item.addComponent(uP),this.renderer.setup(this.particleMeshProps,this.trailMeshProps),this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes,this.startEmit(),this.initEmitterTransform(),this.item.on("click",function(){var e;if((null==(e=t.interaction)?void 0:e.behavior)===t8.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}}))},r.onUpdate=function(t){this.frozen||this.update(t)},r.simulate=function(t){this.update(1e3*t),this.frozen=!0},r.update=function(t){var e=this;if(this.started){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(!this.ended){var c=this.item.duration,f=this.lifetime;if(u<c){var d=1/a.rateOverTime.getValue(f),p=Math.floor((u-this.lastEmitTime)/d),m=d/p,v=r.maxCount;this.updateEmitterTransform(u);for(var y=function(){var t=o.first;return e.emissionStopped||o.length===v&&t&&t.content[0]-n>u},g=0;g<p&&g<v&&!y();g++){var x=this.createPoint(f);x.delay+=i+g*m,this.addParticle(x,v),this.lastEmitTime=u}for(var b=a.bursts,T=(null==b?void 0:b.length)-1,S=0;T>=0&&S<v&&!y();T--){var E=b[T],C=!E.disabled&&E.getGeneratorOptions(u,f);if(C){var w=[0,0,0],_=a.burstOffsets[T],M=_&&_[C.cycleIndex]||w;E.once&&this.removeBurst(T);for(var A=0;A<C.count&&S<v&&!y();A++){var P,I=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:A,burstCount:C.count}));I.delay+=i,S++,(P=I.transform).translate.apply(P,[].concat(M)),this.addParticle(I,v)}}}}else this.options.looping?(l(),this.loopStartTime=i-c,this.lastEmitTime-=c,this.time-=c,a.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=c,t[2]-=c,t[3]&&(t[3].delay-=c)}),this.renderer.minusTimeForLoop(c)):(this.ended=!0,this.item.endBehavior===t6.freeze&&(this.frozen=!0))}l()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=iQ(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(t){return t.dispose()})},r.rebuild=function(){var t;null==(t=this.renderer)||t.rebuild()},r.dispose=function(){this.engine.removeParticleSystem(this),e.prototype.dispose.call(this)},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new it,o=!1;if(r&&r.content)do{var s=r.content,u=s[0];s[2];var h=s[3];if(u>this.timePassed){var l=this.getPointPosition(h),c=t.ray,f=!1;c&&(f=!!c.intersectSphere({center:l,radius:t.radius},a)),f&&(this.clickedPoint=r,n.push(l),t.multiple||(o=!0))}}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&o.subtract(c)}n.addTrailPoint(t,o,{color:s,lifetime:l,size:h,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.time-n,u=new it,h=it.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var l=nQ(new it,this.options,h,s,r,u,i);if(o){var c=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;l.x=l.x*d+c[0]*f,l.y=l.y*d+c[1]*f,l.z=l.z*d+c[2]*f}return l},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),h=a.particleFollowParent?nm.IDENTITY:this.transform.getWorldMatrix(),l=t.position,c=new nH({position:h.transformPoint(l,new it),valid:!0}),f=t.direction;if(f=h.transformNormal(f,uI).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)uF.setElement(d,a.turbulence[d].getValue(o));uL.setFromVector3(uF.negate()),uk.setFromEuler(uL).transformNormal(f).normalize()}s.alignSpeedDirection?(uN.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=it.Z.clone(),h.transformNormal(this.upDirectionWorld)),uV.crossVectors(uN,this.upDirectionWorld).normalize(),uV.isZero()&&uV.set(1,0,0)):(uV.set(1,0,0),uN.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=uD)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?uO.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?uO.set(0,0,a.startRotation.getValue(o)):uO.set(0,0,0),c.setRotation(uO.x,uO.y,uO.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)uR.x=a.startSizeX.getValue(o),uR.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);uR.x=v,uR.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new it;this.transform.assignWorldTRS(void 0,void 0,x),uR.x*=x.x,uR.y*=x.y}return c.setScale(uR.x,uR.y,1),{size:uR,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:uN,dirX:uV,transform:c}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&eZ(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t;var i,r,n,a,o,s,u,h,l,c,f,d,p,m,v=t.options,y=t.positionOverLifetime,g=void 0===y?{}:y,x=t.shape,b=null==g?void 0:g.gravityOverLifetime,T=nJ(null==g?void 0:g.gravity),S=t.textureSheetAnimation,E=S?{animationDelay:aF(S.animationDelay||0),animationDuration:aF(S.animationDuration||1),cycles:aF(S.cycles||1),animate:S.animate,col:S.col,row:S.row,total:S.total||S.col*S.row}:void 0,C=!!(x&&x.turbulenceX||(null==x?void 0:x.turbulenceY)||(null==x?void 0:x.turbulenceZ));C&&(n=[aF(null!=(a=x.turbulenceX)?a:0),aF(null!=(o=x.turbulenceY)?o:0),aF(null!=(s=x.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=s4(x),this.emission={rateOverTime:aF(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=eZ(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new um(t)})},this.textureSheetAnimation=E;var w=t.renderer||{},_=t.rotationOverLifetime;_&&((h={}).asRotation=!!_.asRotation,h.z=_.z?aF(_.z):aF(0),_.separateAxes&&(h.x=_.x&&aF(_.x),h.y=_.y&&aF(_.y))),(null==g?void 0:g.forceTarget)&&(l={target:g.target||[0,0,0],curve:aF(g.forceCurve||[t4.LINE,[[0,0],[1,1]]])});var M={x:g.linearX&&aF(g.linearX||0),y:g.linearY&&aF(g.linearY||0),z:g.linearZ&&aF(g.linearZ||0),asMovement:g.asMovement},A={x:g.orbitalX&&aF(g.orbitalX),y:g.orbitalY&&aF(g.orbitalY),z:g.orbitalZ&&aF(g.orbitalZ),center:g.orbCenter,asRotation:g.asRotation},P=t.sizeOverLifetime||{},I=t.colorOverLifetime,R=(null==P?void 0:P.separateAxes)?{separateAxes:!0,x:aF(P.x),y:aF(P.y)}:{separateAxes:!1,x:aF(("size"in P?P.size:P.x)||1)};w.anchor=w.anchor||[0,0];var O=e7.fromArray(w.anchor);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:aF(v.startLifetime),startDelay:aF(v.startDelay||0),startSpeed:aF(g.startSpeed||0),startColor:aF(v.startColor),looping:null!=(c=v.looping)&&c,maxCount:null!=(f=v.maxCount)?f:0,gravityModifier:aF(b||0),gravity:T,start3DSize:!!v.start3DSize,startTurbulence:C,turbulence:n,speedOverLifetime:g.speedOverLifetime&&aF(g.speedOverLifetime),linearVelOverLifetime:M,orbitalVelOverLifetime:A,forceTarget:l},v.startRotationZ&&(this.options.startRotation=aF(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=aF(v.startRotationX||0),this.options.startRotationY=aF(v.startRotationY||0),this.options.startRotationZ=aF(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=aF(v.startSizeX),this.options.startSizeY=aF(v.startSizeY)):(this.options.startSize=aF(v.startSize),this.options.sizeAspect=aF(v.sizeAspect||1)),t.mask&&this.maskManager.setMaskOptions(this.engine,t.mask);var V={name:this.name,matrix:nm.IDENTITY,shaderCachePrefix:"",renderMode:w.renderMode||t$.BILLBOARD,side:w.side||tH.DOUBLE,gravity:T,blending:w.blending||tX.ALPHA,rotationOverLifetime:h,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!w.occlusion,transparentOcclusion:!!w.transparentOcclusion,maxCount:v.maxCount,forceTarget:l,diffuse:w.texture?this.engine.findObject(w.texture):void 0,sizeOverLifetime:R,anchor:O};if(I){var N=I.color,F=I.opacity;V.colorOverLifetime={},F&&(V.colorOverLifetime.opacity=aF(I.opacity)),N&&(N[0]===t4.GRADIENT_COLOR?V.colorOverLifetime.color=I.color[1]:N[0]===t4.RGBA_COLOR?V.colorOverLifetime.color=no.createWithData(this.engine,{data:new Uint8Array(N[1]),width:1,height:1}):eZ(N,no)&&(V.colorOverLifetime.color=N))}var L=[],D=[0,0,1,1];if(t.splits){var k=t.splits[0];D=(d=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(E&&!E.animate)for(var B=d?E.row:E.col,z=d?E.col:E.row,U=E.total||B*z,G=0,W=0;W<B;W++)for(var j=0;j<z&&G<U;j++,G++)L.push([W*D[2]/B+D[0],j*D[3]/z+D[1],D[2]/B,D[3]/z]);else L.push(D);this.uvs=L,V.textureFlip=d;var X=t.trails;X&&(this.trails={lifetime:aF(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},p={name:"Trail",matrix:nm.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:aF(X.opacityOverLifetime||1),widthOverTrail:aF(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion},X.colorOverLifetime&&X.colorOverLifetime[0]===t4.GRADIENT_COLOR&&(p.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===t4.GRADIENT_COLOR&&(p.colorOverTrail=X.colorOverTrail[1])),this.particleMeshProps=V,p&&(this.trailMeshProps=p);var H=t.interaction;H&&(this.interaction={multiple:H.multiple,radius:null!=(m=H.radius)?m:.4,behavior:H.behavior}),this.item.getHitTestParams=this.getHitTestParams},rk(i,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),i}(rB),t.ParticleSystem=eq([i1(eS.ParticleSystem)],t.ParticleSystem);var uI=new it,uR=new e7,uO=new nv,uV=new it,uN=new it,uF=new it,uL=new nv,uD=[0,0,0],uk=new nm;t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.create=function(e,i){var r=i[this.getInstanceId()];if(eZ(r,t.VFXItem))for(var n,a=iQ(this.getChildTracks());!(n=a()).done;){var o=n.value;if(eZ(o,t.ActivationTrack)){if(r.getComponent(t.ParticleSystem))for(var s,u=e.createTrack(sG,this,"ParticleTrack"),h=iQ(o.getClips());!(s=h()).done;){var l=s.value,c=u.createClip(u_);c.start=l.start,c.duration=l.duration,c.endBehavior=l.endBehavior}if(r.getComponent(t.SpriteComponent))for(var f,d=e.createTrack(uW,this,"SpriteComponentTimeTrack"),p=iQ(o.getClips());!(f=p()).done;){var m=f.value,v=d.createClip(uX);v.start=m.start,v.duration=m.duration,v.endBehavior=m.endBehavior}if(r.getComponent(t.EffectComponent))for(var y,g=e.createTrack(uj,this,"EffectComponentTimeTrack"),x=iQ(o.getClips());!(y=x()).done;){var b=y.value,T=g.createClip(uX);T.start=b.start,T.duration=b.duration,T.endBehavior=b.endBehavior}break}}},i}(t.TrackAsset),t.ObjectBindingTrack=eq([i1(eS.ObjectBindingTrack)],t.ObjectBindingTrack),t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new sT},e}(sp),t.ActivationPlayableAsset=eq([i1(eS.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=eq([i1(eS.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=eq([i1(eS.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SpritePropertyPlayableAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.curveData=[28,[]],e}iY(e,t);var i=e.prototype;return i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i=e.curveData[1],r=[],n=0;n<i.length;n++){var a=i[n],o=a[0],s=a[1];r.push([o,this.engine.findObject(s)])}this.curveData[1]=r},i.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),t.SpritePropertyPlayableAsset=eq([i1("SpritePropertyPlayableAsset")],t.SpritePropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new sP},e}(sp),t.SubCompositionPlayableAsset=eq([i1(eS.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=eq([i1(eS.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector3ropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.Vector3ropertyPlayableAsset.prototype,"curveData",void 0),t.Vector3ropertyPlayableAsset=eq([i1(eS.Vector3PropertyPlayableAsset)],t.Vector3ropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){var t=new sS;return t.curve=aF(this.curveData),t.value=t.curve.getValue(0),t},e}(sp),eq([i3(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=eq([i1(eS.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset);var uB=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i,this.mixer.trackInstance=this}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.tracks=[],e.cacheFlattenedTracks=null,e}iY(e,t);var i=e.prototype;return i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=iQ(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=iQ(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},rk(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=iQ(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(i4),eq([i3(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=eq([i1(eS.TimelineAsset)],t.TimelineAsset);var uz=function(){function e(e,i){this.masterTrackInstances=[],this.clips=[];for(var r,n={},a=iQ(i);!(r=a()).done;){var o=r.value;n[o.key.getInstanceId()]=o.value}for(var s,u=iQ(e.tracks);!(s=u()).done;){var h=s.value;eZ(h,t.ObjectBindingTrack)&&h.create(e,n)}this.compileTracks(e.flattenedTracks,i)}var i=e.prototype;return i.evaluate=function(t,e){for(var i,r=iQ(this.clips);!(i=r()).done;)i.value.evaluateAt(t);for(var n,a=iQ(this.masterTrackInstances);!(n=a()).done;){var o=n.value;this.tickTrack(o,e)}},i.compileTracks=function(t,e){for(var i,r={},n=iQ(t);!(i=n()).done;){var a=i.value,o=a.createPlayableGraph(this.clips),s=a.createOutput(),u=new uB(a,o,s);r[a.getInstanceId()]=u,a.parent||this.masterTrackInstances.push(u)}for(var h,l=iQ(t);!(h=l()).done;)for(var c,f=h.value,d=r[f.getInstanceId()],p=iQ(f.getChildTracks());!(c=p()).done;){var m=r[c.value.getInstanceId()];d.addChild(m)}for(var v,y=iQ(e);!(v=y()).done;){var g=v.value;r[g.key.getInstanceId()].boundObject=g.value}for(var x,b=iQ(this.masterTrackInstances);!(x=b()).done;){var T=x.value;this.updateTrackAnimatedObject(T)}},i.tickTrack=function(e,i){var r=e.output.context;r.deltaTime=i,e.output.setUserData(e.boundObject);for(var n,a=iQ(e.mixer.clipPlayables);!(n=a()).done;){var o=n.value;o.getPlayState()===t.PlayState.Playing&&o.processFrame(r)}e.mixer.evaluate(r);for(var s,u=iQ(e.children);!(s=u()).done;){var h=s.value;this.tickTrack(h,i)}},i.updateTrackAnimatedObject=function(t){for(var e,i=iQ(t.children);!(e=i()).done;){var r=e.value;if(!r.boundObject){var n=r.trackAsset.updateAnimatedObject(t.boundObject);r.boundObject=n}this.updateTrackAnimatedObject(r)}},e}(),uU=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new sv;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(sp),t.SpriteColorPlayableAsset=eq([i1(eS.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset);var uG=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createTrackMixer=function(){return new sx},e}(t.TrackAsset),uW=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.updateAnimatedObject=function(e){return e.getComponent(t.SpriteComponent)},i}(uG),uj=function(e){function i(){return e.apply(this,arguments)}return iY(i,e),i.prototype.updateAnimatedObject=function(e){return e.getComponent(t.EffectComponent)},i}(uG),uX=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.createPlayable=function(){return new uH},e}(sp),uH=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(sf);t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).time=0,r.duration=1,r.name="MSprite"+uU++,i&&r.fromData(i),r}iY(i,e);var r=i.prototype;return r.onUpdate=function(i){var r=this;e.prototype.onUpdate.call(this,i);var n=this.time,a=this.duration,o=this.textureSheetAnimation,s=null==(l=null==o?void 0:o.loop)||l;n>a&&s&&(n%=a);var u=Math.min(Math.max(n/a,0),1),h=this.renderer.texture.source.video;if(h&&(0===n?h.pause():h.play().catch(function(t){r.engine.renderErrors.add(t)}),this.renderer.texture.uploadCurrentVideoFrame()),o){var l,c,f,d,p,m=o.total||o.row*o.col,v=this.sprite,y=null!=(f=null==v?void 0:v.rect)?f:[0,0,1,1],g=(null!=(d=null==v?void 0:v.rotation)?d:t.SpriteRotation.None)===t.SpriteRotation.Rotate90,x=y[0],b=y[1],T=g?y[3]:y[2],S=g?y[2]:y[3],E=g?1/o.row*T:1/o.col*T,C=g?1/o.col*S:1/o.row*S;if(o.animate){var w=Math.round(u*(m-1)),_=Math.floor(w/o.col),M=w-_*o.col;p=g?[E*_,C*(o.col-M)]:[E*M,C*(1+_)]}else p=[0,C];null==(c=this.material.getVector4("_TexOffset"))||c.setFromArray([x+p[0],S+b-p[1],E,C])}this.time=n+i/1e3},r.onDisable=function(){e.prototype.onDisable.call(this),this.time=0},r.onDestroy=function(){var e=this.renderer.texture.source;e.sourceType===t.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())},r.updateGeometry=function(e){var i=this.sprite,r=null!=(C=null==i?void 0:i.rotation)?C:t.SpriteRotation.None,n=null!=(w=null==i?void 0:i.rect)?w:[0,0,1,1],a=this.textureSheetAnimation?[0,0,1,1]:[n[0],n[1],n[2],n[3]],o=a[0],s=a[1],u=a[2],h=a[3],l=r===t.SpriteRotation.Rotate90,c=l?h:u,f=l?u:h,d=l?-Math.PI/2:0,p=e.getAttributeData(nV.UVKind),m=e.getAttributeData(nV.PositionKind),v=e.getIndexData(),y=[0,0];if(p&&m&&v){for(var g=p.length/2,x=0;x<g;x++){var b=3*x,T=2*x,S=m[b],E=m[b+1];y[0]=S,y[1]=E,up(y,y,d),p[T]=(y[0]+.5)*c+o,p[T+1]=(y[1]+.5)*f+s}this.updateAttributeData(nV.PositionKind,m.slice(),3),this.updateAttributeData(nV.UVKind,p.slice(),2),this.geometry.setIndexData(v.slice()),this.geometry.setDrawCount(v.length)}this.geometry.subMeshes.length=0;for(var C,w,_,M=iQ(e.subMeshes);!(_=M()).done;){var A=_.value;this.geometry.subMeshes.push({offset:A.offset,indexCount:A.indexCount,vertexCount:A.vertexCount})}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),t.sprite){var i,r=this.engine.findObject(t.sprite);r&&this.applySpriteToRenderer(r)}this.textureSheetAnimation=t.textureSheetAnimation;var n=t.geometry?this.engine.findObject(t.geometry):this.defaultGeometry,a=t.splits;a&&a.length>1?this.updateGeometryFromMultiSplit(a):this.updateGeometry(n),this.interaction=t.interaction;var o=t.options.startColor||[1,1,1,1];this.material.setColor("_Color",new ii().setFromArray(o)),this.duration=null!=(i=t.duration)?i:this.item.duration},r.applySpriteToRenderer=function(t){this._sprite=t,this.renderer.texture=t.texture,this.material.setTexture("_MainTex",t.texture)},r.updateGeometryFromMultiSplit=function(t){for(var e=this.defaultGeometry,i=[],r=[],n=[],a=0;a<2;a++)for(var o=0;o<2;o++){var s=(2*o+a)*4,u=t[2*o+a],h=u[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],l=((a+a+1)/2-1)/2,c=((o+o+1)/2-1)/2,f=u[0],d=u[1],p=u[4]?u[3]:u[2],m=u[4]?u[2]:u[3],v=[-.25+l,.25+c,-.25+l,-.25+c,.25+l,.25+c,.25+l,-.25+c];i.push(h[0]*p+f,h[1]*m+d,h[2]*p+f,h[3]*m+d,h[4]*p+f,h[5]*m+d,h[6]*p+f,h[7]*m+d),n.push(1*v[0],1*v[1],0,1*v[2],1*v[3],0,1*v[4],1*v[5],0,1*v[6],1*v[7],0),r.push(s,1+s,2+s,2+s,1+s,3+s)}this.updateAttributeData(nV.PositionKind,new Float32Array(n),3),e.setIndexData(new Uint16Array(r)),this.updateAttributeData(nV.UVKind,new Float32Array(i),2),e.setDrawCount(r.length)},r.updateAttributeData=function(t,e,i){var r=this.geometry.getVertexBuffer(t),n=null==r?void 0:r.getBuffer();if(!r||n&&e.byteLength>n.capacity){this.geometry.setVerticesBuffer(new nV(this.engine,e,t,{updatable:!0,size:i}));return}this.geometry.setAttributeData(t,e)},rk(i,[{key:"sprite",get:function(){return this._sprite},set:function(t){this.applySpriteToRenderer(t),this.updateGeometry(this.geometry)}}]),i}(oq),t.SpriteComponent=eq([i1(eS.SpriteComponent)],t.SpriteComponent);var uY=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX));function uZ(t){return" "===t||" "===t||"\xa0"===t}function uq(t){var e,i=null!=(e=t.codePointAt(0))?e:0;return i>=13312&&i<=19903||i>=19968&&i<=40959||i>=63744&&i<=64255||i>=131072&&i<=195103||i>=12352&&i<=12447||i>=12448&&i<=12543||i>=12784&&i<=12799||i>=44032&&i<=55215}function uK(t){return uZ(t)?"swallow":!!uq(t)&&"keep"}var uQ=function(){function t(t){this.width=0,this.height=0,this.autoResize=eo.fixed,this.keepWordIntact=!0,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?ea.clip:r,a=t.textVerticalAlign,o=void 0===a?eh.top:a,s=t.textAlign,u=void 0===s?eu.left:s,h=t.letterSpace,l=t.fontSize,c=t.lineHeight,f=t.autoResize,d=void 0===f?eo.fixed:f,p=t.keepWordIntact;this.letterSpace=void 0===h?0:h,this.overflow=n,this.textVerticalAlign=o,this.textAlign=u,this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.autoResize=d,this.keepWordIntact=void 0===p||p,this.lineHeight=void 0===c?l:c},e.getOffsetY=function(t,e,i,r,n){var a=(i-r)/3,o=void 0!==n?n:i*(e-1),s=0;switch(this.textVerticalAlign){case eh.top:s=r+a;break;case eh.middle:s=(this.height-o+r)/2;break;case eh.bottom:s=this.height-o-a}return s},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case eu.left:i=0;break;case eu.middle:i=(this.width-e)/2;break;case eu.right:i=this.width-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),uJ=function(){function t(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0,this.update(t)}return t.prototype.update=function(t){var e,i,r,n,a,o,s,u=t.textColor,h=t.fontSize,l=t.outline,c=t.shadow,f=t.fontWeight,d=t.fontStyle,p=t.fontFamily;this.textColor=[].concat(void 0===u?[1,1,1,1]:u),this.textWeight=void 0===f?"normal":f,this.fontStyle=void 0===d?"normal":d,this.fontFamily=void 0===p?"sans-serif":p,this.fontSize=void 0===h?40:h,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,l&&(null!=(e=l.outlineWidth)?e:0)>0&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=l.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=l.outlineWidth)?r:0),this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,c&&(this.hasShadow=!0,this.shadowBlur=null!=(n=c.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(a=c.shadowColor)?a:[0,0,0,1]),this.shadowOffsetX=null!=(o=c.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(s=c.shadowOffsetY)?s:0),this.fontOffset=0,this.fontStyle!==ec.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),u$=function(){function t(){this.isDirty=!0,this.maxLineWidth=0,this.ALPHA_FIX_VALUE=1/255}var e=t.prototype;return e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextVerticalAlign=function(t){this.textLayout.textVerticalAlign!==t&&(this.textLayout.textVerticalAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。本次调用将转调用 setTextVerticalAlign。"),this.setTextVerticalAlign(t)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(!iE(t)){console.warn("Risky font family, ignored:",t);return}this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=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.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontFamily,n=e.textWeight,a=e.fontStyle,o=""+(t||i).toString()+"px ";return["serif","sans-serif","monospace","courier"].includes(r)?o+=r:o+='"'+r+'"',n!==el.normal&&(o=n+" "+o),a!==ec.normal&&(o=a+" "+o),o},e.setupOutline=function(t){void 0===t&&(t=1);var e=this.context,i=this.textStyle,r=i.outlineColor,n=i.outlineWidth,a=r[0],o=r[1],s=r[2],u=r[3];e&&(e.strokeStyle="rgba("+255*a+", "+255*o+", "+255*s+", "+u+")",e.lineWidth=2*n/t)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.shadowColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=e.fontScale,s=i[0],u=i[1],h=i[2],l=i[3];t&&(t.shadowColor="rgba("+255*s+", "+255*u+", "+255*h+", "+l+")",t.shadowBlur=r*o,t.shadowOffsetX=n*o,t.shadowOffsetY=-a*o)},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.releaseTextCanvas=function(){this.canvas&&this.context&&(oL.releaseCanvasAndContext({canvas:this.canvas,context:this.context}),this.canvas=void 0,this.context=null)},e.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var a=this.context,o=Math.max(1,t),s=Math.max(1,e);a.save(),this.canvas.width=o,this.canvas.height=s,a.setTransform(1,0,0,1,0,0),i||(a.translate(0,s),a.scale(1,-1)),a.clearRect(0,0,o,s),a.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(a),a.restore();var u=a.getImageData(0,0,o,s),h=no.createWithData(this.engine,{data:new Uint8Array(u.data),width:u.width,height:u.height},{flipY:i,magFilter:rG.LINEAR,minFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=h,this.material.setTexture("_MainTex",h)}},e.initTextBase=function(t){this.engine=t;var e=oL.getCanvasAndContext(1,1);this.canvas=e.canvas,this.context=e.context},t}(),u0=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,u1=0;t.TextComponent=function(t){function e(e){(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+u1++;var i,r=oL.getCanvasAndContext(1,1);i.canvas=r.canvas,i.context=r.context;var n=i.getDefaultProps().options;return i.updateWithOptions(n),i}iY(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=iQ(this.materials);!(i=r()).done;){var n=i.value,a=this.transform.size.x,o=this.transform.size.y,s=this.getTextureExpandScale(),u=s[0],h=s[1];a*=u,o*=h,n.setVector2("_Size",new e7(a,o))}},i.render=function(t){this.maskManager.drawStencilMask(t,this),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.material)},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture(),this.releaseTextCanvas()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.resetState(),this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new ii(1,1,1,1))},i.resetState=function(){this.disposeTextTexture(),this.isDirty=!0,this.lineCount=0,this.maxLineWidth=0},i.updateWithOptions=function(t){this.textStyle?this.textStyle.update(t):this.textStyle=new uJ(t),this.textLayout?this.textLayout.update(t):this.textLayout=new uQ(t),this.text=t.text.toString()},i.getLineCount=function(t){var e=this.context,i=this.textLayout,r=i.letterSpace,n=i.overflow;this.maxLineWidth=0;var a=this.textLayout.width+this.textStyle.fontOffset,o=1,s=0,u=0,h=Array.from(t);if(e&&(e.font=this.getFontDesc(this.textStyle.fontSize)),n===ea.display){for(var l,c=iQ(h);!(l=c()).done;){var f,d,p=l.value,m=null!=(d=null==e?void 0:null==(f=e.measureText(p))?void 0:f.width)?d:0;"\n"===p?(o++,s=0,u=0):(u>0&&(s+=r),s+=m,u++,this.maxLineWidth=Math.max(this.maxLineWidth,s))}return o}if(this.textLayout.keepWordIntact)for(var v,y=0,g=0,x=iQ(h);!(v=x()).done;){var b,T,S=v.value,E=null!=(T=null==e?void 0:null==(b=e.measureText(S))?void 0:b.width)?T:0;if("\n"===S){o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0,y=0,g=0;continue}s+(u>0?r:0)+E>a&&u>0&&(o++,g>1?(this.maxLineWidth=Math.max(this.maxLineWidth,y),s-=y,u-=g):(this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),y=0,g=0),u>0&&(s+=r),s+=E,u++,!1!==uK(S)&&(y=s,g=u)}else for(var C=0;C<h.length;C++){var w,_,M=h[C],A=null!=(_=null==e?void 0:null==(w=e.measureText(M))?void 0:w.width)?_:0;u>0&&(s+=r),(s+A>a&&C>0||"\n"===M)&&(o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),"\n"!==M&&(s+=A,u++)}return this.maxLineWidth=Math.max(this.maxLineWidth,s),o},i.setLineHeight=function(t){var e=Math.max(this.textStyle.fontSize,t);this.textLayout.lineHeight!==e&&(this.textLayout.lineHeight=e,this.isDirty=!0)},i.updateTexture=function(t){var e=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var i=this.textStyle,r=this.textLayout,n=i.fontScale;r.autoResize===eo.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):r.autoResize===eo.autoHeight?(this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):this.lineCount=this.getLineCount(this.text);var a=r.width+i.fontOffset,o=r.height,s=i.fontSize,u=r.lineHeight;i.fontDesc=this.getFontDesc(s);var h=Array.from(this.text||""),l=this.getEffectPadding(),c=l.padL,f=l.padR,d=l.padT,p=l.padB,m=(c|f|d|p)!=0,v=this.engine.gpuCapability.detail.maxTextureSize/2,y=m?a+c+f:a,g=m?o+d+p:o;n=Math.min(n,v/Math.max(y,g,1));var x=Math.ceil(y*n),b=Math.ceil(g*n),T=m?c:0,S=m?t?d:p:0;this.effectScaleX=a>0?x/(a*n):1,this.effectScaleY=o>0?b/(o*n):1,this.transform.setSize(.0123044998279225*a,.0123044998279225*o),this.renderToTexture(x,b,t,function(t){t.scale(n,n),e.maxLineWidth>a&&r.overflow===ea.display?t.font=e.getFontDesc(s*a/e.maxLineWidth):t.font=i.fontDesc;var o=i.textColor,l=o[0],c=o[1],f=o[2],d=o[3];t.fillStyle="rgba("+255*l+", "+255*c+", "+255*f+", "+d+")";var p=[],m=0,v=r.getOffsetY(i,e.lineCount,u,s),y=[],g=[];if(r.keepWordIntact)for(var x=-1,b=!1,E=0;E<h.length;E++){var C=h[E],w=t.measureText(C);if("\n"===C){p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1,b=!1;continue}if(m+(y.length>0?r.letterSpace:0)+w.width>a&&y.length>0){if(x>0){var _=b?x:x+1,M=y.slice(0,_),A=g.slice(0,_),P=M.length>0?A[A.length-1]+t.measureText(M[M.length-1]).width:0;p.push({y:v,width:P,chars:M,charOffsetX:A}),v+=u,y=y.slice(x+1),m=0,g=[];for(var I=0;I<y.length;I++)I>0&&(m+=r.letterSpace),g.push(m),m+=t.measureText(y[I]).width;x=-1,b=!1}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1,b=!1}y.length>0&&(m+=r.letterSpace),g.push(m),y.push(C),m+=w.width;var R=uK(C);!1!==R&&(x=y.length-1,b="swallow"===R)}else for(var O=0;O<h.length;O++){var V=h[O],N=t.measureText(V);y.length>0&&(m+=r.letterSpace),(m+N.width>a&&O>0||"\n"===V)&&(p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[]),"\n"!==V&&(y.push(V),g.push(m),m+=N.width)}y.length>0&&p.push({y:v,width:m,chars:y,charOffsetX:g});var F=i.isOutlined&&i.outlineWidth>0;F&&(i.hasShadow&&e.setupShadow(),e.setupOutline(n),p.forEach(function(e){var n=S+e.y,a=e.chars.join("");if(a.length>0&&u0.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.strokeText(a,T+s+o,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=T+u+e.charOffsetX[h];t.strokeText(l,c,n)}}),i.hasShadow&&(t.shadowColor="transparent")),!F&&i.hasShadow&&e.setupShadow(),p.forEach(function(e){var n=S+e.y,a=e.chars.join("");if(a.length>0&&u0.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.fillText(a,T+s+o,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=T+u+e.charOffsetX[h];t.fillText(l,c,n)}}),i.hasShadow&&(t.shadowColor="transparent")}),this.isDirty=!1}},i.renderText=function(t){this.updateTexture()},i.getTextureExpandScale=function(){return[this.effectScaleX,this.effectScaleY]},i.getEffectPadding=function(){var t=this.textStyle,e=(t.isOutlined&&t.outlineWidth>0?Math.ceil(2*t.outlineWidth):0)+(t.hasShadow&&(t.shadowBlur>0||0!==t.shadowOffsetX||0!==t.shadowOffsetY)?Math.ceil(Math.abs(t.shadowOffsetX)+Math.abs(t.shadowOffsetY)+t.shadowBlur):0);return{padL:e,padR:e,padT:e,padB:e}},i.setAutoResize=function(t){this.textLayout.autoResize!==t&&(this.textLayout.autoResize=t,this.isDirty=!0)},i.setTextWidth=function(t){var e=Math.max(0,Number(t)||0),i=this.textLayout;i.width!==e&&(i.autoResize===eo.autoWidth&&(i.autoResize=eo.autoHeight),i.width=e,this.isDirty=!0)},i.setTextHeight=function(t){var e=Math.max(0,Number(t)||0);if(0!==e){var i=this.textLayout;i.height!==e&&(i.height=e,this.isDirty=!0)}},i.setFontSize=function(t){var e=Math.max(1,Number(t)||1);this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.isDirty=!0)},i.setOutlineWidth=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},i.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},i.setShadowBlur=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},i.setShadowColor=function(t){var e=null!=t?t:[0,0,0,1];this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},i.setShadowOffsetX=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},i.setShadowOffsetY=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},i.getTextWidth=function(){var t,e,i,r=this.context;if(!r)return null!=(e=null==(t=this.textLayout)?void 0:t.width)?e:0;var n=(null!=(i=this.text)?i:"").toString(),a=this.textLayout,o=this.textStyle;r.font=this.getFontDesc(o.fontSize);for(var s=0,u=0,h=0;h<n.length;h++){var l=n[h];if("\n"===l){s=Math.max(s,u),u=0;continue}u+=(a.letterSpace||0)+r.measureText(l).width}return Math.max(0,Math.ceil((s=Math.max(s,u))-(o.fontOffset||0)-1e-4)+2)},i.getDefaultProps=function(){return{id:"default-id-"+Math.random().toString(36).substr(2,9),item:{id:"default-item-"+Math.random().toString(36).substr(2,9)},dataType:eS.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:el.normal,letterSpace:0,textAlign:eu.middle,fontStyle:ec.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(oq),t.TextComponent=eq([i1(eS.TextComponent)],t.TextComponent),ik(t.TextComponent,[u$]);var u2=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(oJ(iX));function u3(t,e,i){return Math.max(e,Math.min(i,t))}function u4(t,e){return t.x===e.x&&t.y===e.y}function u5(t){return new e7(t.x,t.y)}function u6(t,e){var i=Math.hypot(t,e);return i<=Number.EPSILON?new e7(1,0):new e7(t/i,e/i)}function u8(t,e){var i=1-e,r=i*i,n=e*e,a=r*i,o=3*r*e,s=3*i*n,u=n*e;return new e7(a*t[0].x+o*t[1].x+s*t[2].x+u*t[3].x,a*t[0].y+o*t[1].y+s*t[2].y+u*t[3].y)}function u9(t,e){var i,r,n,a,o,s,u,h,l,c,f,d,p=new e7((i=t[0].x)+(t[1].x-i)*e,(r=t[0].y)+(t[1].y-r)*e),m=new e7((n=t[1].x)+(t[2].x-n)*e,(a=t[1].y)+(t[2].y-a)*e),v=new e7((o=t[2].x)+(t[3].x-o)*e,(s=t[2].y)+(t[3].y-s)*e),y=new e7((u=p.x)+(m.x-u)*e,(h=p.y)+(m.y-h)*e),g=new e7((l=m.x)+(v.x-l)*e,(c=m.y)+(v.y-c)*e),x=new e7((f=y.x)+(g.x-f)*e,(d=y.y)+(g.y-d)*e);return[[u5(t[0]),p,y,x],[x,g,v,u5(t[3])]]}function u7(t,e){t.push({action:"moveTo",data:[e]})}function ht(t,e){t.push({action:"lineTo",data:[e]})}function he(t){t.push({action:"closePath",data:[]})}var hi=new it;function hr(t,e,i,r){if(0===t.length)return t.push(u5(i)),r;var n=t[t.length-1],a=Math.hypot(i.x-n.x,i.y-n.y);if(a<=Number.EPSILON)return r;var o=t.length-1;return t.push(u5(i)),r+=a,e.push({distance:r,pointIndex:o,tValue:1,type:"line"}),r}function hn(t,e,i,r){return 0===e.length||t.length<2||i<=Number.EPSILON?null:{points:t,segments:e,closePath:r}}function ha(t,e){for(var i=t[e].pointIndex,r=e+1;r<t.length&&t[r].pointIndex===i;)r++;return r}function ho(t,e){return[t[e],t[e+1]]}function hs(t,e){return[t[e],t[e+1],t[e+2],t[e+3]]}var hu=function(){function t(t,e,i,r){this.segments=t,this.points=e,this.contourLength=i,this.contourClosed=r}var e=t.prototype;return e.length=function(){return this.contourLength},e.isClosed=function(){return this.contourClosed},e.getPosTan=function(t){if(0===this.segments.length)return{pos:new e7,tan:new e7(1,0)};var e,i,r,n,a,o,s=u3(t,0,this.contourLength),u=this.findSegment(s),h=this.segments[u],l=u>0?this.segments[u-1].distance:0,c=h.distance-l,f=c<=Number.EPSILON?0:(s-l)/c;if("line"===h.type)return{pos:[new e7((i=(e=ho(this.points,h.pointIndex))[0].x)+(e[1].x-i)*f,(r=e[0].y)+(e[1].y-r)*f),new e7((n=e[0].x)+(e[1].x-n)*f,(a=e[0].y)+(e[1].y-a)*f)][0],tan:u6(e[1].x-e[0].x,e[1].y-e[0].y)};var d=u>0?this.segments[u-1]:void 0,p=(o=d&&d.pointIndex===h.pointIndex?d.tValue:0)+(h.tValue-o)*f;return function(t,e){if(e<=0){var i=u4(t[0],t[1])?u4(t[1],t[2])?t[3]:t[2]:t[1];return{pos:new e7(t[0].x,t[0].y),tan:u6(i.x-t[0].x,i.y-t[0].y)}}if(e>=1){var r=u4(t[3],t[2])?u4(t[2],t[1])?t[0]:t[1]:t[2];return{pos:new e7(t[3].x,t[3].y),tan:u6(t[3].x-r.x,t[3].y-r.y)}}var n=u8(t,Math.max(0,e-1e-4)),a=u8(t,Math.min(1,e+1e-4));return{pos:u8(t,e),tan:u6(a.x-n.x,a.y-n.y)}}(hs(this.points,h.pointIndex),p)},e.getSegment=function(t,e,i,r){var n=u3(t,0,this.contourLength),a=u3(e,0,this.contourLength);if(!(n>=a)&&0!==this.segments.length){var o=this.findSegment(n),s=this.findSegment(a),u=this.segments[o],h=this.segments[s],l=this.computeT(o,n),c=this.computeT(s,a);if(1-l<Number.EPSILON&&o<s&&(o++,u=this.segments[o],l=0),u.pointIndex===h.pointIndex){this.extractSegment(o,l,c,i,r);return}this.extractSegment(o,l,1,i,r);for(var f=ha(this.segments,o);f<this.segments.length&&this.segments[f].pointIndex!==h.pointIndex;)this.extractWholeSegment(f,i),f=ha(this.segments,f);this.extractSegment(s,0,c,i,!1)}},e.warp=function(t){var e=this.getPosTan(t.x);return new e7(e.pos.x-e.tan.y*t.y,e.pos.y+e.tan.x*t.y)},e.dump=function(){console.log("ContourMeasure",{length:this.contourLength,points:this.points.length,segments:this.segments.length,isClosed:this.contourClosed})},e.findSegment=function(t){for(var e=0,i=this.segments.length-1;e<i;){var r=e+i>>1;this.segments[r].distance<t?e=r+1:i=r}return e},e.computeT=function(t,e){var i=this.segments[t],r=t>0?this.segments[t-1]:void 0,n=r?r.distance:0,a=r&&r.pointIndex===i.pointIndex?r.tValue:0,o=i.distance<=n?0:(e-n)/(i.distance-n);return u3(a+(i.tValue-a)*o,a,i.tValue)},e.extractWholeSegment=function(t,e){var i=this.segments[t];if("line"===i.type){var r=ho(this.points,i.pointIndex)[1];e.lineTo(r.x,r.y);return}var n=hs(this.points,i.pointIndex),a=n[1],o=n[2],s=n[3];e.bezierCurveTo(a.x,a.y,o.x,o.y,s.x,s.y,i.smoothness,i.scale)},e.extractSegment=function(t,e,i,r,n){var a=this.segments[t];if("line"===a.type){var o,s,u,h,l=ho(this.points,a.pointIndex),c=l[0],f=l[1],d=new e7((o=c.x)+(f.x-o)*e,(s=c.y)+(f.y-s)*e),p=new e7((u=c.x)+(f.x-u)*i,(h=c.y)+(f.y-h)*i);n&&r.moveTo(d.x,d.y),r.lineTo(p.x,p.y);return}var m=function(t,e,i){if(e<=0&&i>=1)return t.map(u5);var r=u3(e,0,1),n=u3(i,r,1),a=t.map(u5);return r>0&&(a=u9(a,r)[1]),n<1&&(a=u9(a,r>=1?0:(n-r)/(1-r))[0]),a}(hs(this.points,a.pointIndex),e,i);n&&r.moveTo(m[0].x,m[0].y),r.bezierCurveTo(m[1].x,m[1].y,m[2].x,m[2].y,m[3].x,m[3].y,a.smoothness,a.scale)},t}(),hh=function(){function t(t,e){void 0===e&&(e=1),this.contourPath=[],this.cursor=0,this.screenScale=1,this.rewind(t,e)}var e=t.prototype;return e.rewind=function(t,e){var i,r;void 0===e&&(e=1),this.contourPath=(i=e,null!=(r=function(t){for(var e,i=[],r=iQ(t.instructions);!(e=r()).done;){var n=e.value,a=n.data;switch(n.action){case"moveTo":u7(i,new e7(a[0],a[1]));break;case"lineTo":ht(i,new e7(a[0],a[1]));break;case"bezierCurveTo":!function(t,e,i,r,n,a){t.push({action:"bezierCurveTo",data:[e,i,r],smoothness:n,scale:a})}(i,new e7(a[0],a[1]),new e7(a[2],a[3]),new e7(a[4],a[5]),a[6],a[7]);break;case"closePath":he(i);break;default:return null}}return i}(t))?r:function(t,e){for(var i,r=[],n=iQ(t.shapePrimitives);!(i=n()).done;)!function(){var t,n=i.value,a=n.shape,o=n.transform;!function(t,e,i){if(!(e.length<2)){u7(t,new e7(e[0],e[1]));for(var r=2;r<e.length;r+=2)ht(t,new e7(e[r],e[r+1]));i&&he(t)}}(r,function(t,e){if(!e)return t.slice();for(var i=Array(t.length),r=0;r<t.length;r+=2){hi.set(t[r],t[r+1],0);var n=e.transformPoint(hi,hi);i[r]=n.x,i[r+1]=n.y}return i}(eZ(a,a$)?a.points.slice():(t=[],a.build(t,e),t),o),!eZ(a,a$)||a.closePath)}();return r}(t.shapePath,i)),this.screenScale=e,this.cursor=0},e.tryNext=function(){var e=function(t,e,i,r){for(var n=[],a=[],o=0,s=null,u=!1,h=function(){if(0===n.length){var t=null!=s?s:new e7(0,0);n.push(u5(t)),s=u5(t)}},l=e;l<t.length;l++){var c=t[l];switch(c.action){case"moveTo":var f=hn(n,a,o,u);if(f)return{contour:f,nextIndex:l};n=[],a=[],o=0,s=u5(c.data[0]),u=!1,n.push(u5(s));break;case"lineTo":h(),o=hr(n,a,c.data[0],o);break;case"bezierCurveTo":h();var d,p=n[n.length-1],m=n.length-1,v=c.data,y=v[0],g=v[1],x=v[2],b=function(t,e,i,r,n,a,o,s){var u=[],h=[];aH(u,r[0].x,r[0].y,r[1].x,r[1].y,r[2].x,r[2].y,r[3].x,r[3].y,null!=o?o:a,null!=s?s:n,h);for(var l=[],c=r[0],f=0;f<h.length;f++){var d=h[f],p=2*f,m=d>=1?r[3]:new e7(u[p],u[p+1]),v=Math.hypot(m.x-c.x,m.y-c.y);v>Number.EPSILON&&(i+=v,l.push({distance:i,pointIndex:e,tValue:d,type:"cubic",smoothness:o,scale:s}),c=m)}return 0===l.length||t.push(u5(r[1]),u5(r[2]),u5(r[3])),{distance:i,segments:l}}(n,m,o,[u5(p),u5(y),u5(g),u5(x)],i,r,c.smoothness,c.scale);o=b.distance,(d=a).push.apply(d,[].concat(b.segments));break;case"closePath":n.length>0&&s&&(o=hr(n,a,s,o),u=!0);var T=hn(n,a,o,u);if(T)return{contour:T,nextIndex:l+1};n=[],a=[],o=0,s=null,u=!1}}return{contour:hn(n,a,o,u),nextIndex:t.length}}(this.contourPath,this.cursor,this.screenScale,t.defaultTolerance);this.cursor=e.nextIndex;var i=e.contour?function(t){if(t.points.length<2||0===t.segments.length)return null;var e=t.segments[t.segments.length-1].distance;return e<=Number.EPSILON?null:{points:t.points,segments:t.segments,contourLength:e,contourClosed:t.closePath}}(e.contour):null;return i?new hu(i.segments,i.points,i.contourLength,i.contourClosed):null},e.next=function(){for(;this.cursor<this.contourPath.length;){var t=this.tryNext();if(t)return t}return null},e.toArray=function(){for(var t,e=this.cursor,i=[];t=this.next();)i.push(t);return this.cursor=e,i},t}();hh.defaultTolerance=.5;var hl=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=iQ(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"lineTo":this.lineTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4]);break;case"circle":this.circle(a[0],a[1],a[2],a[3]);break;case"polyStar":this.polyStar(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"rect":this.rect(a[0],a[1],a[2],a[3],a[4]);break;case"triangle":this.triangle(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o,s){this.ensurePoly();var u=this.currentPoly;return aH(u.points,u.lastX,u.lastY,t,e,i,r,n,a,o,s),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.lineTo=function(t,e){this.ensurePoly();var i=this.currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new aW(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new aJ(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new aQ(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new aj(t,e,i,r,n),a),this},e.triangle=function(t,e,i,r,n,a,o){return this.drawShape(new aX(t,e,i,r,n,a),o),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new a$).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new a$,this.currentPoly.points.push(0,0))},t}(),hc=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o,s){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,o,s]}),this.dirty=!0,this},e.lineTo=function(t,e){return this.instructions.push({action:"lineTo",data:[t,e]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.circle=function(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.triangle=function(t,e,i,r,n,a,o){return this.instructions.push({action:"triangle",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,o){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},rk(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new hl(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();t.TrimPathMode=void 0,(tD=t.TrimPathMode||(t.TrimPathMode={}))[tD.Synchronized=0]="Synchronized",tD[tD.Sequential=1]="Sequential";var hf=function(){function t(){this.start=0,this.end=1,this.offset=0,this.mode=0,this.trimmedGraphicsPath=new hc}var e=t.prototype;return e.clone=function(){var e=new t;return e.start=this.start,e.end=this.end,e.offset=this.offset,e.mode=this.mode,e},e.createTrimmedPath=function(t,e){if(this.isIdentity())return t;var i=new hh(t,e).toArray();return this.trimmedGraphicsPath.clear(),0===i.length||(1===this.mode?this.applySequentialTrimPath(i,this.trimmedGraphicsPath):this.applySynchronizedTrimPath(i,this.trimmedGraphicsPath)),this.trimmedGraphicsPath},e.isIdentity=function(){return 0===this.start&&1===this.end},e.fromData=function(t){this.start=t.start,this.end=t.end,this.offset=t.offset,this.mode=t.mode},e.normalizeTrimOffset=function(){return(this.offset%1+1)%1},e.applySequentialTrimPath=function(t,e){for(var i,r=0,n=iQ(t);!(i=n()).done;)r+=i.value.length();if(!(r<=0)){var a=this.normalizeTrimOffset(),o=r*(this.start+a),s=r*(this.end+a);if(s<o){var u=o;o=s,s=u}o>r&&(o-=r,s-=r);for(var h=[],l=0;s>0;){var c=l%t.length,f=t[c].length();o<f?(h.push({contourIndex:c,startLength:o,endLength:s}),s-=f,o=0):(o-=f,s-=f),l++}for(var d=-1,p=0;p<h.length;p++){var m=h[p],v=t[m.contourIndex],y=v.length();v.getSegment(m.startLength,m.endLength,e,d!==m.contourIndex||!v.isClosed()),0===m.startLength&&m.endLength-m.startLength>=y&&v.isClosed()&&e.closePath(),d=m.contourIndex}}},e.applySynchronizedTrimPath=function(t,e){for(var i,r=this.normalizeTrimOffset(),n=iQ(t);!(i=n()).done;){var a=i.value,o=a.length(),s=o*(this.start+r),u=o*(this.end+r);if(u<s){var h=s;s=u,u=h}for(s>=o&&(s-=o,u-=o),a.getSegment(s,u,e,!0);u>o;)s=0,u-=o,a.getSegment(s,u,e,!a.isClosed());0===this.start&&1===this.end&&a.isClosed()&&e.closePath()}},t}();t.TexturePaintScaleMode=void 0,(tk=t.TexturePaintScaleMode||(t.TexturePaintScaleMode={}))[tk.Fill=0]="Fill",tk[tk.Fit=1]="Fit",tk[tk.Crop=2]="Crop",tk[tk.Tile=3]="Tile",t.ShapeComponent=function(e){function i(t){(i=e.call(this,t)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new hc,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:ev.Butt,join:ey.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=ev.Butt,i.strokeJoin=ey.Miter,i.strokes=[],i._strokeTrimPath=null,i._fillTrimPath=null,i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=nm.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===tH.FRONT,clipMasks:i.frameClipMasks}}},i.rendererOptions={renderMode:t$.MESH,blending:tX.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:tH.DOUBLE,mask:0};var i,r,n={type:ed.Solid,color:new ii(1,1,1,1)};i.strokes.push(n);var a={type:ed.Solid,color:new ii(1,1,1,1)};return i.fills.push(a),i.shapeAttributes={type:em.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=a6.create(i.engine,{attributes:((r={})[nV.PositionKind]={type:rG.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},r[nV.UVKind]={size:2,offset:0,type:rG.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])},r),indices:{data:new Uint16Array([0,1,2,2,1,3])},mode:rG.TRIANGLES,drawCount:6,bufferUsage:rG.DYNAMIC_DRAW}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}iY(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){if(this.shapeDirty){var e,i,r,n,a=this.computeScreenScale();this.buildPath(this.shapeAttributes,a);var o=null!=(r=null==(e=this._fillTrimPath)?void 0:e.createTrimmedPath(this.graphicsPath,a))?r:this.graphicsPath,s=null!=(n=null==(i=this._strokeTrimPath)?void 0:i.createTrimmedPath(this.graphicsPath,a))?n:this.graphicsPath;this.buildGeometryFromPath(o.shapePath,s.shapePath,a),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},r.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=0;e<this.fillMaterials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],t,0);for(var i=0;i<this.strokeMaterials.length;i++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],t,1)}},r.draw=function(t){for(var e=0;e<this.fillMaterials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],0);for(var i=0;i<this.strokeMaterials.length;i++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],1)},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},r.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData(nV.PositionKind);if(t){var e=n6(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},r.buildGeometryFromPath=function(t,e,i){var r=[],n=[];if(this.fills.length>0)for(var a,o=iQ(t.shapePrimitives);!(a=o()).done;){var s=a.value.shape,u=[],h=n.length,l=r.length/2;s.build(u,i),s.triangulate(u,r,l,n,h)}var c=n.length;if(this.strokes.length>0)for(var f,d=iQ(e.shapePrimitives);!(f=d()).done;){var p=f.value.shape,m=[];n.length;var v=r.length/2,y=this.strokeAttributes;y.cap=this.strokeCap,y.join=this.strokeJoin,y.width=this.strokeWidth;var g=!0;this._strokeTrimPath&&!this._strokeTrimPath.isIdentity()?g=!1:eZ(p,a$)&&(g=p.closePath),p.build(m,i),aU(m,y,!1,g,r,2,v,n)}var x=n.length-c,b=r.length/2,T=this.geometry.getAttributeData(nV.PositionKind),S=this.geometry.getAttributeData(nV.UVKind),E=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!S||S.length<2*b)&&(S=new Float32Array(2*b)),(!E||E.length<n.length)&&(E=new Uint16Array(n.length));for(var C=Number.MAX_VALUE,w=Number.MAX_VALUE,_=Number.MIN_VALUE,M=Number.MIN_VALUE,A=0;A<b;A++){var P=3*A,I=2*A,R=r[I],O=r[I+1];T[P]=R,T[P+1]=O,T[P+2]=0,C=Math.min(C,R),w=Math.min(w,O),_=Math.max(_,R),M=Math.max(M,O)}for(var V=_-C,N=M-w,F=0;F<b;F++){var L=3*F,D=2*F;S[D]=(T[L]-C)/V,S[D+1]=(T[L+1]-w)/N}E.set(n),this.updateAttributeData(nV.PositionKind,T,3),this.updateAttributeData(nV.UVKind,S,2),this.geometry.setIndexData(E),this.geometry.setDrawCount(n.length);var k=this.geometry.subMeshes[0],B=this.geometry.subMeshes[1];k.indexCount=c,B.offset=2*c,B.indexCount=x},r.updateAttributeData=function(t,e,i){var r,n=null==(r=this.geometry.getVertexBuffer(t))?void 0:r.getBuffer();if(n&&e.byteLength>n.capacity){this.geometry.setVerticesBuffer(new nV(this.engine,e,t,{updatable:!0,size:i}));return}this.geometry.setAttributeData(t,e)},r.computeScreenScale=function(){var t=this.item.composition;if(!t)return 1;var e=t.camera;if(!e)return 1;var r=e.getModelViewProjection(i.tempMVP,this.transform.getWorldMatrix()).elements,n=Math.abs(r[15])||1,a=Math.sqrt(r[0]*r[0]+r[1]*r[1])/n,o=Math.sqrt(r[4]*r[4]+r[5]*r[5])/n,s=this.engine.canvas.getBoundingClientRect();return Math.max(1,Math.min(2e3,Math.max(s.width,s.height)/2*Math.max(a,o)*this.engine.pixelRatio))},r.buildPath=function(e,i){void 0===i&&(i=1),this.graphicsPath.clear();var r=i;switch(e.type){case em.Custom:for(var n,a=this.shapeAttributes,o=a.points,s=a.easingIns,u=a.easingOuts,h=iQ(a.shapes);!(n=h()).done;){var l=n.value,c=l.indexes,f=o[c[0].point];this.graphicsPath.moveTo(f.x,f.y);for(var d=1;d<c.length;d++){var p=c[d],m=c[d-1],v=o[p.point],y=o[m.point],g=u[m.easingOut],x=s[p.easingIn];this.graphicsPath.bezierCurveTo(g.x+y.x,g.y+y.y,x.x+v.x,x.y+v.y,v.x,v.y,void 0,r)}if(l.close){var b=c[0],T=c[c.length-1],S=o[b.point],E=o[T.point],C=u[T.easingOut],w=s[b.easingIn];this.graphicsPath.bezierCurveTo(C.x+E.x,C.y+E.y,w.x+S.x,w.y+S.y,S.x,S.y,void 0,r),this.graphicsPath.closePath()}}break;case em.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case em.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case em.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case em.Polygon:this.graphicsPath.polyStar(e.pointCount,e.radius,e.radius,e.roundness,e.roundness,t.StarType.Polygon)}},r.updateMaterials=function(){for(var t=0;t<this.fills.length;t++)this.updatePaintMaterial(this.fillMaterials[t],this.fills[t]);for(var e=0;e<this.strokes.length;e++)this.updatePaintMaterial(this.strokeMaterials[e],this.strokes[e])},r.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===ed.Solid)t.color=e.color;else if(e.type===ed.GradientLinear||e.type===ed.GradientAngular||e.type===ed.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===ed.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new e7(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new e7(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var a=e.textureTransform;t.setMatrix3("_TextureTransform",new ny().scale(a.scale.x,a.scale.y).rotate(a.rotation).translate(a.offset.x,a.offset.y).invert())}},r.updateGradientMaterial=function(t,e,i,r){for(var n,a=[],o=[],s=iQ(e.stops);!(n=s()).done;){var u=n.value,h=u.color;a.push(new ie(h.r,h.g,h.b,h.a)),o.push(u.time)}t.setVector4Array("_Colors",a),t.setFloats("_Stops",o),t.setInt("_StopsCount",o.length),t.setVector2("_StartPoint",i),t.setVector2("_EndPoint",r)},r.createMaterialFromRendererOptions=function(e){var i={shader:{vertex:"precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 uv0;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;void main(){vec4 pos=vec4(aPos.xyz,1.0);uv0=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}",fragment:"precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3 _TextureTransform;uniform float _ImageScalingFactor;uniform float _ImageOpacity;varying vec2 uv0;float calculateAngleRatio(vec2 v1,vec2 v2){float angle=atan(v2.y,v2.x)-atan(v1.y,v1.x);if(angle<0.0)angle+=2.0*PI;return angle/(2.0*PI);}vec2 applyTransform(mat3 m,vec2 uv){uv=uv-vec2(0.5,0.5);vec3 p=m*vec3(uv,1.0);p.xy=p.xy+vec2(0.5,0.5);return p.xy;}void main(){vec4 finalColor=vec4(1.0);if(_FillType==0.0){finalColor=_Color;}else if(_FillType==1.0||_FillType==2.0||_FillType==3.0){float t=0.0;if(_FillType==1.0){vec2 gradientVector=_EndPoint-_StartPoint;vec2 pixelVector=uv0-_StartPoint;float denom=max(dot(gradientVector,gradientVector),1e-6);t=clamp(dot(pixelVector,gradientVector)/denom,0.0,1.0);}else if(_FillType==2.0){float maxRadius=max(distance(_EndPoint,_StartPoint),0.001);t=clamp(distance(uv0,_StartPoint)/maxRadius,0.0,1.0);}else{vec2 center=_StartPoint;vec2 referenceVector=_EndPoint-center;vec2 targetVector=uv0-center;if(length(targetVector)>0.001){t=calculateAngleRatio(referenceVector,targetVector);}}if(_StopsCount>0){finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float localT=smoothstep(_Stops[i-1],_Stops[i],t);finalColor=mix(finalColor,_Colors[i],localT);}}}else if(_FillType==4.0){vec2 uv=uv0;float rSrc=_ImageSize.x/max(_ImageSize.y,1.0);float rDst=_DestSize.x/max(_DestSize.y,1.0);bool maskOutside=false;if(_ImageScaleMode==0){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(1.0,rSrc/rDst);}else{scale=vec2(rDst/rSrc,1.0);}uv=(uv-0.5)*scale+0.5;uv=clamp(uv,0.0,1.0);}else if(_ImageScaleMode==1){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(rSrc/rDst,1.0);}else{scale=vec2(1.0,rSrc/rDst);}uv=(uv-0.5)*scale+0.5;maskOutside=true;}else if(_ImageScaleMode==2){uv=applyTransform(_TextureTransform,uv0);maskOutside=true;}else if(_ImageScaleMode==3){float aspectFix=rDst/max(rSrc,1e-6);vec2 uvTile=(uv0-0.5)*vec2(aspectFix,1.0)+0.5;float s=max(abs(_ImageScalingFactor),1e-6);uv=fract(uvTile*s);}vec4 img=texture2D(_ImageTex,uv);if(maskOutside){if(uv.x<0.0||uv.x>1.0||uv.y<0.0||uv.y>1.0){img.a=0.0;}}img.a*=_ImageOpacity;finalColor=img;}finalColor.rgb*=finalColor.a;gl_FragColor=finalColor;}",glslVersion:t.GLSLVersion.GLSL1}},r=nw.create(this.engine,i),n=e.side,a=e.occlusion,o=e.blending,s=e.texture;r.blending=!0,r.depthTest=!0,r.depthMask=a,rY(r,o),rZ(r,n),r.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',r.setVector4("_TexOffset",new ie(0,0,1,1)),r.setTexture("_ImageTex",s);var u=rH(o),h=new ie;return h.x=e.occlusion?+e.transparentOcclusion:1,h.y=u,h.z=e.renderMode,r.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?r.enableMacro("ALPHA_CLIP"):r.disableMacro("ALPHA_CLIP"),r},r.fromData=function(t){e.prototype.fromData.call(this,t),this.shapeDirty=!0,t.mask&&this.maskManager.setMaskOptions(this.engine,t.mask);var i=null!=(r=t.renderer)?r:{};this.rendererOptions={renderMode:t$.MESH,blending:null!=(n=i.blending)?n:tX.ALPHA,texture:i.texture?this.engine.findObject(i.texture):this.engine.whiteTexture,occlusion:!!i.occlusion,transparentOcclusion:!!i.transparentOcclusion||this.maskManager.isMask,side:null!=(a=i.side)?a:tH.DOUBLE,mask:1},this.strokeCap=null!=(o=t.strokeCap)?o:ev.Butt,this.strokeWidth=null!=(s=t.strokeWidth)?s:1,this.strokeJoin=null!=(u=t.strokeJoin)?u:ey.Miter,this._strokeTrimPath=null,this._fillTrimPath=null,t.strokeTrimPath&&(this._strokeTrimPath=new hf,this._strokeTrimPath.fromData(t.strokeTrimPath)),t.fillTrimPath&&(this._fillTrimPath=new hf,this._fillTrimPath.fromData(t.fillTrimPath)),this.fills.length=0,this.fillMaterials.length=0;for(var r,n,a,o,s,u,h,l=iQ(t.fills);!(h=l()).done;){var c=h.value;this.fills.push(this.createPaint(c)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var f,d=iQ(t.strokes);!(f=d()).done;){var p=f.value;this.strokes.push(this.createPaint(p)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),t.type){case em.Custom:for(var m,v={type:em.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},y=iQ(t.points);!(m=y()).done;){var g=m.value;v.points.push(new e7(g.x,g.y))}for(var x,b=iQ(t.easingIns);!(x=b()).done;){var T=x.value;v.easingIns.push(new e7(T.x,T.y))}for(var S,E=iQ(t.easingOuts);!(S=E()).done;){var C=S.value;v.easingOuts.push(new e7(C.x,C.y))}v.shapes=t.shapes,this.shapeAttributes=v;break;case em.Ellipse:var w={type:em.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius};this.shapeAttributes=w;break;case em.Rectangle:var _={type:em.Rectangle,width:t.width,height:t.height,roundness:t.roundness};this.shapeAttributes=_;break;case em.Star:var M={type:em.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness};this.shapeAttributes=M;break;case em.Polygon:var A={type:em.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness};this.shapeAttributes=A}},r.createPaint=function(t){var e;switch(t.type){case ed.Solid:e={type:t.type,color:new ii().copyFrom(t.color)};break;case ed.GradientLinear:case ed.GradientAngular:case ed.GradientRadial:e={type:t.type,gradientStops:aF(t.gradientStops),startPoint:new e7().copyFrom(t.startPoint),endPoint:new e7().copyFrom(t.endPoint)};break;case ed.Texture:var i,r,n,a=ro({offset:{x:0,y:0},rotation:0,scale:{x:1,y:1}},null!=(i=t.textureTransform)?i:{});e={type:t.type,texture:this.engine.findObject(t.texture),scaleMode:t.scaleMode,scalingFactor:null!=(r=t.scalingFactor)?r:1,opacity:null!=(n=t.opacity)?n:1,textureTransform:{offset:new e7().copyFrom(a.offset),rotation:a.rotation,scale:new e7().copyFrom(a.scale)}}}return e},r.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},rk(i,[{key:"shape",get:function(){return this.shapeAttributes}},{key:"strokeTrimPath",get:function(){return this._strokeTrimPath}},{key:"fillTrimPath",get:function(){return this._fillTrimPath}}]),i}(nk),t.ShapeComponent.tempMVP=nm.fromIdentity(),t.ShapeComponent=eq([i1("ShapeComponent")],t.ShapeComponent);var hd=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(i4);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e}(i4),eq([i3(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=eq([i1(eS.BinaryAsset)],t.BinaryAsset);var hp=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=i2(e);if(r)for(var n,a=iQ(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:iP(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):i4.is(s)?i[o]={id:s.getInstanceId()}:iR(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=iQ(Object.keys(e.definition));!(u=h()).done;){var l=u.value,c=e.definition[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:iP(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):i4.is(c)?i[l]={id:c.getInstanceId()}:iR(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.definition=e;var r=i2(i),n=i.engine;if(r)for(var a,o=iQ(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];if(void 0!==u){var h=r[s].type;i[s]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.definition)},t.checkTypedArray=function(t){return eZ(t,Int8Array)||eZ(t,Uint8Array)||eZ(t,Uint8ClampedArray)||eZ(t,Int16Array)||eZ(t,Uint16Array)||eZ(t,Int32Array)||eZ(t,Uint32Array)||eZ(t,Float32Array)||eZ(t,Float64Array)||eZ(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(iR(t)&&1===Object.keys(t).length&&"id"in t&&iA(t.id))},t.checkGLTFNode=function(t){return iR(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return iV(t)||eZ(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(iP(e)){for(var o,s=[],u=iQ(e);!(o=u()).done;){var h=o.value;s.push(t.deserializeProperty(h,i,r+1,n,a))}return s}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(!iO(e))return e;c=n?new n:{};for(var c,f,d=iQ(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var n,a=iQ(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:iP(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):i4.is(s)?i[o]={id:s.getInstanceId()}:iR(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:iP(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):i4.is(a)?i[n]={id:a.getInstanceId()}:iR(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),hm=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(!r){console.warn("Object data with uuid: "+i+" not found.");return}switch(r.dataType){case eS.Material:e=nw.create(this.engine);break;case eS.Geometry:e=a6.create(this.engine);break;case eS.Texture:e=no.create(this.engine);break;default:var n=i0[r.dataType];n&&(e=new n(this.engine))}if(!e){console.warn("Constructor for DataType: "+r.dataType+" not found.");return}return e.setInstanceId(r.id),this.engine.addInstance(e),hp.deserialize(r,e),e},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),hv=function(){function t(){}return t.prototype.loadGUID=function(t){return eY(function(){return eK(this,function(t){return[2,void 0]})})()},t}();function hy(t,e){if(!t.includes(e))return t.push(e),!0}function hg(t){if(Number.isFinite(t))return[t4.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===t4.CONSTANT)return[t4.CONSTANT,t[1]];if("lines"===e)return[t4.LINE,t[1]];if(e===t4.LINE){var r=i.map(function(t){return[t5.LINE,t]});return[t4.BEZIER_CURVE,r]}return"curve"===e||e===t4.CURVE?[t4.BEZIER_CURVE,hF(i)]:t}}function hx(t,e){return Array.isArray(t)&&"random"===t[0]?[t4.CONSTANT,t[1][e]]:hg(t)}function hb(t){return t&&"color"===t[0]?hE(t[1],!0):[1,1,1,1]}function hT(t){return t&&"random"===t[0]?[t4.RANDOM,t[1]]:hg(t)}function hS(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=hE(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[t4.GRADIENT_COLOR,i]}}function hE(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else eZ(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=hC(i)),i}function hC(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function hw(t,e){return Array.isArray(t)?t[0]===t4.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&hS(t[1],e):hS(t,e)}function h_(t){if(t){if(3===t.length)return[t4.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===t4.BEZIER_PATH||e===t4.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=hF(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[t4.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function hM(t){for(var e,i=iQ(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function hA(t){for(var e,i=iQ(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var hP=Math.cos,hI=Math.sin,hR=Math.PI/180,hO=180/Math.PI;function hV(t,e){return t?[t[0]-.5,.5-t[1]]:e?hN[e]:[0,0]}var hN=((eD={})[t0.PARTICLE_ORIGIN_CENTER]=[0,0],eD[t0.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eD[t0.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eD[t0.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eD[t0.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eD[t0.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eD[t0.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eD[t0.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eD[t0.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eD);function hF(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[t5.EASE_OUT,t]:e===n.length-1?[t5.EASE_IN,t]:[t5.EASE,t]})}var hL=new Map,hD=new Map;function hk(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tJ.null&&t.endBehavior===t6.destroy&&(t.endBehavior=t6.freeze)})}),t.version=tW["2_1"],t}function hB(t){for(var e,i=ro({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=iQ(i.images);!(e=r()).done;)e.value.id=iL();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=iL(),t.dataType=eS.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:iL(),dataType:eS.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:iL()}}));for(var a,o,s={},u={},h=iQ(t.compositions);!(o=h()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=t6.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tJ.particle&&t.content.filter&&delete t.content.filter});for(var e,r=iQ(t.items);!(e=r()).done;){var n=e.value;s[n.id]=iL(),n.oldId=n.id,n.id=s[n.id],u[n.id]=n}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],a=e.parentId.split("^")[1];e.parentId=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=ro({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:iL(),dataType:"TimelineAsset"},u=iQ(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:iL(),dataType:"ActivationPlayableAsset"};o.push(c);var f={id:iL(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==tJ.particle){var d={id:iL(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:iL(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===tJ.sprite||h.type===tJ.text){var m={id:iL(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:iL(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===tJ.composition){var y={id:iL(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:iL(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:iL(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],S=iQ(a);!(b=S()).done;){var E=b.value;T.push({id:E.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,w=iQ(a);!(C=w()).done;){var _=C.value;i.miscs.push(_)}for(var M,A=iQ(o);!(M=A()).done;){var P=M.value;i.miscs.push(P)}}(a,u,i)}();for(var l,c=iQ(i.items);!(l=c()).done;){var f=l.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tJ.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tJ.sprite){var g,x,b,T,S,E,C,w=f.content;w.renderer||(w.renderer={});var _=w.renderer,M=hV(_.anchor,_.particleOrigin),A=f.transform.size;_.anchor||void 0===_.particleOrigin||(f.transform.position.x+=-M[0]*(null!=(T=null==A?void 0:A.x)?T:1),f.transform.position.y+=-M[1]*(null!=(S=null==A?void 0:A.y)?S:1)),f.transform.anchor={x:M[0]*(null!=(E=null==A?void 0:A.x)?E:1),y:M[1]*(null!=(C=null==A?void 0:A.y)?C:1)}}}if(f.type===tJ.particle){var P=f.content;P.renderer||(P.renderer={});var I=P.renderer;P.renderer.anchor=hV(I.anchor,I.particleOrigin)}if(f.type===tJ.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var R=f.pn,O=t.plugins,V=void 0===O?[]:O;void 0!==R&&Number.isInteger(R)&&(f.pluginName=V[R])}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===tJ.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,i),(f.type===tJ.sprite||f.type===tJ.particle||f.type===tJ.mesh||f.type===tJ.skybox||f.type===tJ.light||"camera"===f.type||f.type===tJ.tree||f.type===tJ.interact||f.type===tJ.camera||f.type===tJ.text||f.type===tJ.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=iL(),f.content.item={id:f.id},f.dataType=eS.VFXItemData,f.components.push({id:f.content.id})),(f.type===tJ.null||f.type===tJ.composition)&&(f.components=[],f.dataType=eS.VFXItemData),f.type){case tJ.sprite:f.content.dataType=eS.SpriteComponent;break;case tJ.particle:f.content.dataType=eS.ParticleSystem;break;case tJ.mesh:f.content.dataType=eS.MeshComponent;break;case tJ.skybox:f.content.dataType=eS.SkyboxComponent;break;case tJ.light:f.content.dataType=eS.LightComponent;break;case"camera":f.content.dataType=eS.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tJ.tree:f.content.dataType=eS.TreeComponent;break;case tJ.interact:f.content.dataType=eS.InteractComponent;break;case tJ.camera:f.content.dataType=eS.CameraController;break;case tJ.text:f.content.dataType=eS.TextComponent;break;case tJ.spine:f.content.dataType=eS.SpineComponent}}return i.version=tW["3_0"],i}function hz(t){for(var e,i=iQ(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===eS.ShapeComponent&&r.type===em.Custom){(null==(n=r.shapes)?void 0:n.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var n,a,o=Array(r.easingIns.length),s=Array(r.easingOuts.length).fill(!1),u=iQ(r.shapes);!(a=u()).done;)for(var h,l=a.value,c=iQ(l.indexes);!(h=c()).done;){var f=h.value,d=r.points[f.point],p=r.easingIns[f.easingIn],m=r.easingOuts[f.easingOut];o[f.easingIn]||(p.x-=d.x,p.y-=d.y,o[f.easingIn]=!0),s[f.easingOut]||(m.x-=d.x,m.y-=d.y,s[f.easingOut]=!0)}}}return t.version=tW["3_2"],t}function hU(e){hL.clear(),hD.clear();for(var i,r=e.compositions,n=e.items,a=e.components,o=iQ(a);!(i=o()).done;){var s=i.value;hL.set(s.id,s)}for(var u,h=iQ(n);!(u=h()).done;){var l=u.value;hD.set(l.id,l)}for(var c,f=iQ(r);!(c=f()).done;)!function(e){for(var i,r=iQ(e.items);!(i=r()).done;){var n=i.value,a=hD.get(n.id);if(!a)return;if(a.type===tJ.sprite||a.type===tJ.particle||a.type===tJ.spine||a.type===tJ.text||a.type===tJ.richtext||a.type===tJ.video||a.type===tJ.shape){var o=hL.get(a.components[0].id);o&&function(e){var i=e.renderer,r=null==i?void 0:i.maskMode;r&&r!==t.MaskMode.NONE&&(r===t.MaskMode.MASK?(e.mask={isMask:!0},ek=e.id):(r===tY.OBSCURED||r===tY.REVERSE_OBSCURED)&&(e.mask={inverted:r===tY.REVERSE_OBSCURED,reference:{id:ek}}))}(o)}}}(c.value);return e.version=tW["3_3"],e}function hG(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=iQ(t.items);!(i=r()).done;){var n=i.value;if(n.type===tJ.sprite){var a=hL.get(n.components[0].id);if(a){var o,s=a.renderer.shape,u=void 0;u=Number.isInteger(s)?null==(o=t.shapes)?void 0:o[s]:s,a.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=iQ(t.compositions);!(h=f()).done;){var d=h.value,p=iL();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:iL(),dataType:"CompositionComponent",items:d.items,timelineAsset:d.timelineAsset,sceneBindings:d.sceneBindings,item:{id:d.id}};d.timelineAsset=void 0,d.sceneBindings=void 0,d.components=[{id:m.id}],t.components.push(m)}for(var v,y=iQ(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=c[x.refId])}}return t.version=tW["3_4"],t}function hW(t){for(var e,i={},r=iQ(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var a,o=iQ(t.compositions);!(a=o()).done;)for(var s,u=a.value,h=iQ(u.components);!(s=h()).done;)i[s.value.id].item.id=u.id;for(var l,c=iQ(t.components);!(l=c()).done;){var f=l.value;if(f.dataType===eS.SpriteComponent){var d=f.renderer.shape;if(null!=d&&!("aPoint"in d&&"index"in d)){var p=function(t,e){void 0===e&&(e="形状");for(var i=ud(t),r=i.index,n=void 0===r?[]:r,a=i.aPoint,o=void 0===a?[]:a,s=new Float32Array(o),u=[],h=[],l=0;l<s.length;l+=6)h.push(o[l+2],o[l+3]),u.push(s[l],s[l+1],0);var c=u.length/3,f=n.length,d=4*u.length,p=d+4*h.length,m=2*n.length,v={mode:eE.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:ew.UInt16,indexOffset:p,buffer:"",id:iL(),dataType:eS.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:e_.Position,offset:0,format:eC.Float32,dimension:3}),v.vertexData.channels.push({semantic:e_.Uv,offset:d,format:eC.Float32,dimension:2}),v.subMeshes.push({offset:0,indexCount:f,vertexCount:c});var y=new ArrayBuffer(p+m+(m%4==0?0:2)),g=new Float32Array(y);g.set(u,0),g.set(h,u.length),new Uint16Array(y,p).set(n,0);var x=new Uint8Array(y).slice(0,p+m);return v.binaryData=x,v}(d);f.geometry={id:p.id},t.geometries.push(p)}}if(f.dataType===eS.ShapeComponent){if(f.fills=[],f.fill){var m={type:ed.Solid,color:f.fill.color};f.fills.push(m)}if(delete f.fill,f.strokes=[],f.stroke){var v={type:ed.Solid,color:f.stroke.color};f.strokes.push(v),f.strokeWidth=f.stroke.width,f.strokeCap=f.stroke.cap,f.strokeJoin=f.stroke.join,delete f.stroke}}}return t.version=tW["3_5"],t}function hj(t){if(t.components)for(var e,i=iQ(t.components);!(e=i()).done;){var r,n=e.value;n.dataType===eS.RichTextComponent&&n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1),n.dataType!==eS.TextComponent&&(n.dataType!==eS.RichTextComponent||!n.options)||(r=n.options)&&void 0===r.TextVerticalAlign&&void 0===r.TextVerticalAlign&&(r.TextVerticalAlign=r.textBaseline),n.dataType===eS.TextComponent&&function(t){if(t&&t.textColor){var e,i=t.textColor;t.textColor=[i[0]/255,i[1]/255,i[2]/255,null!=(e=i[3])?e:1]}}(n.options)}return t.version=tW["3_6"],t}function hX(t){for(var e,i,r=[],n=iQ(t.items);!(i=n()).done;)!function(){var e=i.value;if(e.type===tJ.text&&e.transform){for(var n,a,o,s=t.components.find(function(t){return e.components[0].id===t.id}),u=e.transform.scale.x/(null!=(a=null==(n=s.options)?void 0:n.textWidth)?a:1),h=u/.0123,l=e.transform.scale.x,c=e.transform.scale.y,f=e.transform.scale.z,d=iQ(t.items);!(o=d()).done;){var p=o.value;p.parentId===e.id&&p.transform&&(p.transform.scale.x*=l/h,p.transform.scale.y*=c/h,p.transform.scale.z*=f/h)}e.transform.scale.x=h,e.transform.scale.y=h,e.transform.scale.z=h,r.push({item:e,scaleFactor:h,oldScaleX:l,oldScaleY:c,oldScaleZ:f})}}();r.length>0&&(null==(e=t.animations)?void 0:e.length)&&function(t,e){for(var i,r=new Map,n=new Map,a=iQ(t.items);!(i=a()).done;){var o=i.value;if(r.set(o.id,o),o.parentId){var s=n.get(o.parentId);s||(s=[],n.set(o.parentId,s)),s.push(o)}}for(var u,h=new Map,l=new Map,c=iQ(e);!(u=c()).done;){var f=u.value;h.set(f.item.id,f);var d=n.get(f.item.id);if(d)for(var p,m=iQ(d);!(p=m()).done;){var v=p.value;l.set(v.id,f)}}for(var y,g=new Map,x=iQ(t.components);!(y=x()).done;){var b=y.value;g.set(b.id,b)}for(var T,S=new Map,E=iQ(t.animations);!(T=E()).done;){var C=T.value;S.set(C.id,C)}for(var w,_=iQ(t.compositions);!(w=_()).done;){for(var M,A,P,I=w.value,R=void 0,O=void 0,V=iQ(I.components);!(P=V()).done;){var N=P.value,F=g.get(N.id);if((null==F?void 0:F.dataType)===eS.Animator?R=F:(null==F?void 0:F.dataType)===eS.CompositionComponent&&(O=F),R&&O)break}if(R){var L=void 0;if(O){var D=O.items;if(D){L=[];for(var k,B=iQ(D);!(k=B()).done;){var z=k.value,U=r.get(z.id);U&&!U.parentId&&L.push(U)}}}if((!L||0===L.length)&&I.children){L=[];for(var G,W=iQ(I.children);!(G=W()).done;){var j=G.value,X=r.get(j.id);X&&L.push(X)}}if(L&&0!==L.length){var H=R,Y=S.get(null==(M=H.graphAsset)?void 0:M.id);if(null==Y?void 0:null==(A=Y.graphDataSet)?void 0:A.resources)for(var Z,q=iQ(Y.graphDataSet.resources);!(Z=q()).done;){var K=Z.value,Q=S.get(K.id);if(null==Q?void 0:Q.scaleCurves)for(var J,$=iQ(Q.scaleCurves);!(J=$()).done;){var tt=J.value,te=function(t,e,i){var r=function(t){var e;a=null==(e=i.get(a.id))?void 0:e.find(function(e){return e.name===n[t]})};if(e){for(var n=e.split("/"),a=t.find(function(t){return t.name===n[0]}),o=1;o<n.length&&a;o++)r(o);return a}}(L,tt.path,n);if(te){var ti=h.get(te.id);if(ti){hZ(tt.keyFrames,ti.scaleFactor/ti.oldScaleX,ti.scaleFactor/ti.oldScaleY,ti.scaleFactor/ti.oldScaleZ);continue}var tr=l.get(te.id);tr&&hZ(tt.keyFrames,tr.oldScaleX/tr.scaleFactor,tr.oldScaleY/tr.scaleFactor,tr.oldScaleZ/tr.scaleFactor)}}}}}}}(t,r);for(var a,o=new Map,s=new Map,u=new Map,h=iQ(t.components);!(a=h()).done;){var l=a.value;u.set(l.id,l)}for(var c,f=iQ(t.items);!(c=f()).done;){var d=c.value;d.children=[],o.set(d.id,d)}for(var p,m=iQ(t.compositions);!(p=m()).done;){var v=p.value;v.children=[],ek=void 0;var y=v.items;Array.isArray(y)&&hY(y,o,u);for(var g,x=iQ(v.components);!(g=x()).done;){var b=g.value,T=u.get(b.id);if(T.dataType===eS.CompositionComponent){var S=null!=(E=T.items)?E:[];hY(S,o,u);for(var E,C,w=iQ(S);!(C=w()).done;){var _=C.value,M=o.get(_.id);void 0===M.parentId&&v.children.push({id:M.id})}delete T.items}}s.set(v.id,v)}for(var A,P=iQ(t.items);!(A=P()).done;){var I=A.value;if(I.parentId){var R=o.get(I.parentId);R&&R.children.push({id:I.id})}}return t.version=tW["3_7"],t}function hH(t){null!=t.miscs||(t.miscs=[]);for(var e,i=iQ(t.components);!(e=i()).done;){var r,n,a=e.value;if(a.dataType===eS.SpriteComponent&&!a.sprite){var o=a.splits;if(!o||!(o.length>1)){var s=null==o?void 0:o[0],u=s?[s[0],s[1],s[2],s[3]]:[0,0,1,1],h=null!=(n=null==s?void 0:s[4])?n:0,l={id:iL(),dataType:"Sprite",texture:null==(r=a.renderer)?void 0:r.texture,rect:u,rotation:h};t.miscs.push(l),a.sprite={id:l.id},delete a.splits,a.renderer&&delete a.renderer.texture}}}return t.version="3.8",t}function hY(t,e,i){for(var r,n=iQ(t);!(r=n()).done;){var a=r.value,o=e.get(a.id);if(o&&(o.type===tJ.sprite||o.type===tJ.particle||o.type===tJ.spine||o.type===tJ.text||o.type===tJ.richtext||o.type===tJ.video||o.type===tJ.shape||o.type===tJ.mesh)){var s=i.get(o.components[0].id);s&&function(t){var e,i,r,n=t.mask;n&&!n.references&&n.reference&&(t.mask={isMask:null!=(e=n.isMask)&&e,alphaMaskEnabled:null!=(i=n.alphaMaskEnabled)&&i,references:[{mask:n.reference,inverted:null!=(r=n.inverted)&&r}]})}(s)}}}function hZ(t,e,i,r){if(Array.isArray(t)&&t[0]===t4.VECTOR3_CURVE){var n=t[1];Array.isArray(n)&&3===n.length&&(hq(n[0],e),hq(n[1],i),hq(n[2],r))}}function hq(t,e){if(Array.isArray(t)&&t[0]===t4.BEZIER_CURVE&&Array.isArray(t[1]))for(var i,r=t[1],n=iQ(r);!(i=n()).done;){var a=i.value;if(Array.isArray(a)&&!(a.length<2)&&Array.isArray(a[1]))for(var o=a[1],s=1;s<o.length;s+=2)o[s]*=e}}function hK(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:h_(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:hg(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:hg(n.linearX),linearY:hg(n.linearY),linearZ:hg(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:hg(n.orbitalX),orbitalY:hg(n.orbitalY),orbitalZ:hg(n.orbitalZ),speedOverLifetime:hg(n.speedOverLifetime)};hA(a);var o={options:{startColor:hb(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=hg(s.x),u.y=hg(s.y),u.z=hg(s.z)):u.z=hg(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:hg(h.opacity)};h.color&&(l.color=hw(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:hg(c.size),x:hg(c.x),y:hg(c.y),z:hg(c.z)}),o}var hQ="2.10.1",hJ=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,h$=/^(\d+)\.(\d+)$/,h0=!1;function h1(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(function(t){var e=(t.playerVersion||{}).web,i=void 0===e?"":e;if(i){var r,n,a=null!=(r=hJ.exec(i))?r:[],o=null!=(n=hJ.exec(hQ))?n:[],s=a[1],u=a[2],h=o[1],l=o[2];return Number(h)<Number(s)||Number(h)===Number(s)&&Number(l)<Number(u)}return!1}(t)&&console.warn("The JSON need higher than "+(null==(d=t.playerVersion)?void 0:d.web)+" runtime version(current: "+hQ+"). Some features may not work as expected."),!(f=null==(c=(l=t).version)?void 0:c.split("."))||Number(f[0])>2||2===Number(f[0])&&Number(f[1])>=2||l.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tJ.mesh||t.type===tJ.light)&&(t.endBehavior=1===t.endBehavior?t6.destroy:t.endBehavior)})}),hJ.test(t.version)){var e,i,r,n,a,o,s,u;return h0=(null==(p=/^(\d+)/.exec(t.version))?void 0:p[0])==="0",hH(hX(hj(hW(hG(hU(hz(hB(hk((e=t,h2=tW["1_0"],n=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(h2=tW["1_3"]),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return h3(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:h2,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return h4(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u))))))))))}h0=!1;var h,l,c,f,d,p,m=h$.exec(t.version)||[],v=Number(m[1]),y=Number(m[2]);if(v)return(v<2||2===v&&y<4)&&((h=t).compositions.map(function(t){for(var e,i=iQ(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=iQ(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=h_(a):e[n]=hg(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=h),v<3&&(t=hB(hk(t))),v=Number((m=h$.exec(t.version)||[])[1]),y=Number(m[2]),v<4&&(y<2&&(t=hz(t)),y<3&&(t=hU(t)),y<4&&(t=hG(t)),y<5&&(t=hW(t)),y<6&&(t=hj(t)),y<7&&(t=hX(t)),y<8&&(t=hH(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var h2=tW["1_0"];function h3(t,e,i){var r=i[e];if("string"==typeof t)return{id:iL(),renderLevel:r,url:t};if(t.template)return{id:iL(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:iL(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:iL(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function h4(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:ro({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return h6(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var h5=[0,0,0,1];function h6(t,e){void 0===e&&(e={});var i=tJ.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tJ.plugin,m=t.pn,p=t.pluginName,f=t.content,c=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),l=t.transform||b(c.transform)):t.particle?(i=tJ.particle,l=b((c=t.particle).transform,h0,!0),f=function(t){var e=t.options,i=t.transform,r={type:tZ.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=ro({},t.shape,{type:tZ[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],h=o[2];0===s&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=hT(e.turbulenceX),r.turbulenceY=hT(e.turbulenceY),r.turbulenceZ=hT(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map(function(t){return hM(t)})),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map(function(t){return hM(t)})),l.rateOverTime&&(l.rateOverTime=hT(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:hT(e.startLifetime),start3DSize:!!e.start3DSize,startSize:hT(e.startSize),startSizeX:hT(e.startSizeX),startSizeY:hT(e.startSizeY),sizeAspect:hT(e.sizeAspect),maxCount:e.maxCount,startDelay:hT(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[t4.COLORS,t[1].map(function(t){return hE(t,e)})]:"gradient"===t[0]?hS(t[1],e):"color"===t[0]?[t4.RGBA_COLOR,hE(t[1],e)]:t}(e.startColor,!0),startRotationZ:hT(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=hT(e.startRotationX),c.options.startRotationY=hT(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:h_(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:hT(f.x),y:hT(f.y)}:c.sizeOverLifetime={size:hT(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?hg(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:hg(e.gravityModifier),startSpeed:hT(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:hT(d.linearX),linearY:hT(d.linearY),linearZ:hT(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:hT(d.orbitalX),orbitalY:hT(d.orbitalY),orbitalZ:hT(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:hg(d.forceCurve)},hA(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:hT(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=hg(m.y),c.rotationOverLifetime.x=hg(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:hg(v.opacity)};v.color&&(y.color=hw(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:hg(g.cycles),animationDelay:hx(g.animationDelay,0),animationDuration:hx(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:hT(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:hg(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&hw(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&hw(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:hT(x.opacityOverLifetime)}),c.trails&&hA(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(c)):t.sprite?(i=tJ.sprite,l=b((c=t.sprite).transform,!1,!0),s=hK(o=c,l),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tJ.null,l=b((c=t.cal).transform,!1,!0),f=hK(c,l)):t.ui?(i=tJ.interact,l=b((c=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tK.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&hb(i.previewColor),behavior:i.behavior||tQ.NOTIFY};break;case"drag":e={type:tK.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tK.MESSAGE}}return{options:e}}(c),l.scale=[c.options.width||1,c.options.height||1,1]):t.model&&(c=t.model,1===t.model.options.type&&(i=tJ.camera,l=b(c.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,a,o={path:h_(null==(a=t.transform)?void 0:a.path),linearX:hg(null==r?void 0:r.translateX),linearY:hg(null==r?void 0:r.translateY),linearZ:hg(null==r?void 0:r.translateZ)};hA(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:hg(null==s?void 0:s.rotateX),y:hg(null==s?void 0:s.rotateY),z:s.separateAxes?hg(null==s?void 0:s.rotateZ):hg(s.rotation)};hA(u),i.rotationOverLifetime=u}return i}(c))),null==(h=f.renderer)?void 0:h.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&hy(e.requires,"anchor")}if(c){var o,s,u,h,l,c,f,d,p,m,v,y,g=null==(v=c.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?t6.restart:t6.destroy:t6.restart:r||(null==c?void 0:null==(y=c.options)?void 0:y.endBehavior)||t6.destroy,c.options.renderLevel&&(d=c.options.renderLevel),isNaN(n)&&(n=c.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:l,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(hy(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,S,E,C,w,_,M,A,P=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=hP(a*hR/2),h=hP(o*hR/2),l=hP(s*hR/2),c=hI(a*hR/2),f=hI(o*hR/2),d=hI(s*hR/2),h5[0]=c*h*l+u*f*d,h5[1]=u*f*l-c*h*d,h5[2]=u*h*d+c*f*l,h5[3]=u*h*l-c*f*d,h5);r.rotation=(p=[],m=P[0],v=P[1],y=P[2],g=P[3],x=m+m,b=v+v,T=y+y,S=m*x,E=v*x,C=v*b,w=y*T,_=g*T,M=y*x-g*b,p[1]=Math.asin((A=-M)>1?1:A<-1?-1:A)*hO,.9999999>Math.abs(M)?(p[0]=Math.atan2(y*b+g*x,1-S-C)*hO,p[2]=Math.atan2(E+_,1-C-w)*hO):(p[0]=0,p[2]=Math.atan2(-(E-_),1-S-w)*hO),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var h8=((eB={})[tj.S]=[tj.S,tj.BPlus,tj.APlus],eB[tj.A]=[tj.A,tj.BPlus,tj.APlus],eB[tj.B]=[tj.B,tj.BPlus],eB);function h9(t,e){if(!t||!e)return!0;var i=h8[e];return!!i&&i.includes(t)}function h7(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function lt(t,e,i){return le.apply(this,arguments)}function le(){return(le=eY(function(t,e,i){var r,n;return eK(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,r2(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=h7(e,i)){if(iA(n)&&n!==r.src)return[2,r2(n)];if(eZ(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(tB=t.Scene||(t.Scene={})).isJSONObject=function(t){return iR(t)&&"jsonScene"in t},tB.isURL=function(t){return iR(t)&&"url"in t},tB.isWithOptions=function(t){return iR(t)&&"options"in t};var li=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},lr=1,ln=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new rq),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=lr++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=ro({},t,{useCompressedTexture:null==(e=t.useCompressedTexture)||e,useHevcVideo:null==(i=t.useHevcVideo)||i}),this.options.pluginData||(this.options.pluginData={});var e,i,r=this.options.timeout;this.timeout=void 0===r?10:r},i.loadScene=function(e,i){var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f,d,p,m;return eK(this,function(v){return a=iA(e)?e:r.id,o=performance.now(),s=[],l=null!=(h=null==(u=null==i?void 0:i.engine.gpuCapability)?void 0:u.detail.ktx2Support)&&h,c={},d=!1,p=new Promise(function(t,e){f=window.setTimeout(function(){d=!0,r.removeTimer(f),e(Error("Load time out: totalTime: "+(performance.now()-o).toFixed(4)+"ms "+s.join(" ")+", url: "+a+"."))},1e3*r.timeout),r.timers.push(f)}),m=eY(function(t,e){var i,r,n;return eK(this,function(a){switch(a.label){case 0:if(d)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,s.push("["+t+": "+n.toFixed(2)+"]"),c[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([p,eY(function(){var i,u,h,d,p,v,y,g,x,b,T,S,E,C,w;return eK(this,function(_){switch(_.label){case 0:if(!iA(e))return[3,2];return u=new URL(e,location.href).href,r.baseUrl=u,[4,m("loadJSON",function(){return r.loadJSON(u)})];case 1:return iA(n=_.sent())&&(n=JSON.parse(n)),[3,3];case 2:n=e,r.baseUrl=location.href,_.label=3;case 3:if(!t.Scene.isJSONObject(n))return[3,4];return i=ro({},n),[3,9];case 4:return[4,m("processJSON",function(){return r.processJSON(n)})];case 5:return i={timeInfos:c,url:e,storage:{},jsonScene:v=_.sent().jsonScene,bins:[],textureOptions:[],images:[],assets:r.assets},[4,m("plugin:onAssetsLoadStart",function(){return r.onPluginSceneLoadStart(i)})];case 6:return _.sent(),g=void 0===(y=v.bins)?[]:y,x=v.images,b=v.fonts,[4,Promise.all([m("processBins",function(){return r.processBins(g)}),m("processImages",function(){return r.processImages(x,l)}),m("processFontURL",function(){return r.processFontURL(b)})])];case 7:return S=(T=_.sent())[0],E=T[1],[4,m("processTextures",function(){return r.processTextures(E,S,v)})];case 8:C=_.sent(),(h=i.bins).push.apply(h,[].concat(S)),(d=i.textureOptions).push.apply(d,[].concat(C)),(p=i.images).push.apply(p,[].concat(E)),i.renderLevel=r.options.renderLevel,_.label=9;case 9:return w=performance.now()-o,i_.info("Load asset: totalTime: "+w.toFixed(4)+"ms "+s.join(" ")+", url: "+a+"."),window.clearTimeout(f),r.removeTimer(f),i.totalTime=w,i.startTime=o,i.timeInfos=c,[2,i]}})})()])]})})()},i.getAssets=function(){return this.assets},i.processJSON=function(t){return eY(function(){var e,i,r,n,a;return eK(this,function(o){for(r=iQ(void 0===(i=(e=h1(t)).plugins)?[]:i);!(n=r()).done;)if(!iB[a=n.value])throw Error("The plugin '"+a+"' not found."+ij(a));return[2,{jsonScene:e}]})})()},i.processBins=function(t){var e=this;return eY(function(){var i,r;return eK(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(eZ(n,ArrayBuffer))return n;if(h9(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return eY(function(){return eK(this,function(r){return[2,e.loadFontFamily(t,i.baseUrl)]})})()},i.processImages=function(e,i){void 0===i&&(i=!1);var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f;return eK(this,function(d){switch(d.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=n.disableWebP,u=n.disableAVIF,h=!!iB.ktx2,l=a&&i&&h,c=r.baseUrl,a&&i&&!h&&e.some(function(t){return"ktx2"in t&&t.ktx2})&&i_.warn("The plugin 'ktx2' is not found, unable to use compressed textures."+ij("ktx2")),[4,Promise.all(e.map(eY(function(e,i){var n,a,h,f,d,p,m,v,y,g,x,b,T,S,E,C,w,_,M,A;return eK(this,function(i){switch(i.label){case 0:if(n=e.url,a=e.webp,h=e.avif,f=e.ktx2,d=new URL(n,c).href,p=!s&&a?new URL(a,c).href:void 0,m=!u&&h?new URL(h,c).href:void 0,v=f&&l?new URL(f,c).href:void 0,y=e.id,!("template"in e))return[3,8];if(!(x=(g=e.template).background))return[3,7];b=h7(g,o),T=x.type===ex.video,S=x&&T?r8:r2,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,r7(b,S)];case 2:if(!eZ(E=i.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[y]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return x&&Array.isArray(b)&&o&&(o[x.name]=E.src),r.sourceFrom[y]={url:E.src,type:t.TextureSourceType.image},[4,lt(E,g,o)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw C=i.sent(),Error("Failed to load. Check the template or if the URL is "+(T?"video":"image")+" type, URL: "+b+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("ktx2"in e&&v)return r.sourceFrom[y]={url:v,type:t.TextureSourceType.compressed},[2,r.loadBins(v)];if(eZ(e,HTMLImageElement)||eZ(e,HTMLCanvasElement)||eZ(e,HTMLVideoElement)||eZ(e,no))return[2,e];i.label=9;case 9:if(!m)return[3,11];return[4,r0(d,m)];case 10:return A=i.sent(),[3,13];case 11:return[4,rJ(d,p)];case 12:A=i.sent(),i.label=13;case 13:return _=(w=A).url,M=w.image,r.sourceFrom[y]={url:_,type:t.TextureSourceType.image},[2,M]}})})))];case 1:return f=d.sent(),r.assignImagesToAssets(e,f),[2,f]}})})()},i.onPluginSceneLoadStart=function(t){var e=this;return eY(function(){return eK(this,function(i){switch(i.label){case 0:return[4,iG.notifyAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}})})()},i.processTextures=function(e,i,r){var n=this;return eY(function(){var a;return eK(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(eY(function(e,a){var o,s,u,h,l;return eK(this,function(c){switch(c.label){case 0:if(eZ(e,no))return[2,e];if(!("mipmaps"in e))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,ne(e,i,n.assets,r.bins)];case 2:return[2,c.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+c.sent()+".");case 4:if(o=e.source,s=e.id,h="",!iR(o))return[3,5];return u=n.assets[o.id],h=o.id,[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,r2(iD(o))];case 6:u=c.sent(),c.label=7;case 7:if(!u)return[3,9];return[4,function(t,e,i){return la.apply(this,arguments)}(u,n.sourceFrom[h],s)];case 8:return[2,(l=c.sent()).sourceType===t.TextureSourceType.compressed?l:ro({},l,e)];case 9:throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return eY(function(){return eK(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},i.loadBins=function(t){var e=this;return eY(function(){return eK(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e.loadFontFamily=function(t,i){return void 0===i&&(i=location.href),eY(function(){return eK(this,function(r){return t?[2,Promise.all(t.map(eY(function(t){var r,n,a;return eK(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];iE(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),i_.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},e.loadPrecomposition=function(t,i){return eY(function(){return eK(this,function(r){switch(r.label){case 0:return[4,new e(i).loadScene(t)];case 1:return[2,new li(r.sent(),i)]}})})()},e}();function la(){return(la=eY(function(e,i,r){var n,a,o,s,u;return eK(this,function(h){switch(h.label){case 0:if(n={id:r,dataType:eS.Texture},!eZ(e,no))return[3,1];return[2,ro({},e.source,n)];case 1:if(!(eZ(e,HTMLImageElement)||iV(e)))return[3,2];return[2,ro({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:rG.LINEAR,magFilter:rG.LINEAR},n)];case 2:if(!eZ(e,HTMLVideoElement))return[3,3];return[2,ro({sourceType:t.TextureSourceType.video,video:e,minFilter:rG.LINEAR,magFilter:rG.LINEAR},n)];case 3:if(!eZ(e,ArrayBuffer))return[3,10];if(!(a=nc.getLoader("ktx2")))return[3,8];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,a.loadFromBuffer(e)];case 5:return o=h.sent(),i_.info("Loading KTX2 texture."),[2,ro({sourceType:o.sourceType,type:o.type,target:o.target,internalFormat:o.internalFormat,format:o.format,mipmaps:o.mipmaps,minFilter:rG.LINEAR,magFilter:rG.LINEAR,sourceFrom:i},n)];case 6:throw s=h.sent(),Error("Failed to parse KTX2 from "+(null!=(u=null==i?void 0:i.url)?u:"buffer")+": "+(s.message||s));case 7:return[3,9];case 8:throw Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in e&&"height"in e&&"data"in e)return[2,ro({sourceType:t.TextureSourceType.data,data:e,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE,minFilter:rG.NEAREST,magFilter:rG.NEAREST},n)];h.label=11;case 11:throw Error("Invalid texture options.")}})})).apply(this,arguments)}ln.fontCache=new Set;var lo=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var i=e.prototype;return i.assembleSceneLoadOptions=function(e,i){void 0===i&&(i={});var r=e;return t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(r=e.url),t.Scene.isWithOptions(e)&&(i=ro({},i,e.options))),{source:r,options:i}},i.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach(function(t){if(t.type===tJ.text||t.type===tJ.richtext){var r=e[t.name];null!=r&&t.components.forEach(function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);((null==n?void 0:n.dataType)===eS.TextComponent||(null==n?void 0:n.dataType)===eS.RichTextComponent)&&(n.options.text=r)})}})},i.prepareAssets=function(t,e){for(var i,r=iQ(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new hd(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=iQ(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},i.createShaderVariant=function(){for(var t,e=iQ(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];eZ(r,nw)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=iQ(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),ls=new it(1,1,1),lu=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new nH,this.viewportMatrix=nm.fromIdentity(),this.viewMatrix=nm.fromIdentity(),this.projectionMatrix=nm.fromIdentity(),this.viewProjectionMatrix=nm.fromIdentity(),this.inverseViewMatrix=nm.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?t3.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,l=e.rotation,c=void 0===l?[0,0,0]:l,f=new nv(c[0],c[1],c[2]),d=new rh().setFromEuler(f);this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===a?1:a,clipMode:s},this.transform.setPosition(h[0],h[1],h[2]),this.transform.setQuaternion(d.x,d.y,d.z,d.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new it(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,o=r.projectPoint(new it(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new it(-1,-1,a));return new it((s-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return ro({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,o=e.clipMode;this.projectionMatrix.perspective(i*e4,r,n,a,o===t3.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),ls),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:nm.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.worldToScreenPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new it,r=this.getViewProjectionMatrix();i.set(t.x,t.y,t.z),r.projectPoint(i,i);var n=this.engine.canvas.getBoundingClientRect(),a=n.width,o=n.height;return i.x=(i.x+1)*.5*a,i.y=(i.y+1)*.5*o,i.z=(i.z+1)*.5,i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new it,r=this.getInverseViewProjectionMatrix(),n=this.engine.canvas.getBoundingClientRect(),a=n.width,o=n.height,s=t.x/a*2-1,u=t.y/o*2-1,h=2*t.z-1;return i.set(s,u,h),r.projectPoint(i,i),i},rk(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.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),lh=function(){function t(){this.update=new lc,this.lateUpdate=new lf,this.preRender=new ld}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==rB.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==rB.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==rB.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==rB.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==rB.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==rB.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),ll=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),lc=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iQ(t);!(i=r()).done;)i.value.onUpdate(e)},e}(ll),lf=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iQ(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(ll),ld=function(t){function e(){return t.apply(this,arguments)}return iY(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=iQ(t);!(i=r()).done;)i.value.onPreRender()},e}(ll),lp=function(e){function i(i,r,n){(x=e.call(this)||this).engine=i,x.sceneTicking=new lh,x.speed=1,x.isEnded=!1,x.loaderData={},x.startTime=0,x.videos=[],x.postProcessingEnabled=!1,x.destroyed=!1,x.paused=!0,x.isEndCalled=!1,x._renderOrder=0,x._interactive=!0,x._textures=[];var a,o,s,u,h,l,c,f=null!=r?r:{},d=f.reusable,p=void 0!==d&&d,m=f.speed,v=f.baseRenderOrder,y=f.onItemMessage;x.engine.addComposition(sW(x));var g=null;if(n){x.createTexturesFromData(n.textureOptions);for(var x,b,T,S=iQ(Object.keys(n.assets));!(T=S()).done;){var E=T.value,C=n.assets[E];eZ(C,HTMLVideoElement)&&x.videos.push(C)}x.postProcessingEnabled=null!=(w=null==(b=n.jsonScene.renderSettings)?void 0:b.postProcessingEnabled)&&w,x.engine.renderLevel=n.renderLevel,p&&(n.consumed=!0),g=n.jsonScene.compositions[0];for(var w,_,M=iQ(n.jsonScene.compositions);!(_=M()).done;){var A=_.value;A.id===n.jsonScene.compositionId&&(g=A)}iS(g)}return x.root=new t.VFXItem(x.engine),x.root.name="root",x.root.composition=sW(x),x.root.setParent(x.engine.root),x.pluginRoot=new t.VFXItem(x.engine),x.pluginRoot.name="pluginRoot",x.pluginRoot.setParent(x.root),x.sceneRoot=new t.VFXItem(x.engine),x.sceneRoot.setParent(x.root),g&&x.sceneRoot.setInstanceId(g.id),iG.notifyCompositionCreating(sW(x),n),g&&x.sceneRoot.instantiatePreComposition(g,!1),x.sceneRoot.name="sceneRoot",x.rootComposition=null!=(a=x.sceneRoot.getComponent(t.CompositionComponent))?a:x.sceneRoot.addComponent(t.CompositionComponent),x.rootComposition.updateMode=t.UpdateModes.Manual,x.rootComposition.play(),x.sceneRoot.on("animationevent",function(t){x.emit("animationevent",t)}),x.sceneRoot.setParent(x.root),x.renderOrder=void 0===v?0:v,x.id=null!=(o=null==g?void 0:g.id)?o:iL(),x.startTime=null!=(s=null==g?void 0:g.startTime)?s:0,x.event=i.eventSystem,x.statistic={loadStart:null!=(u=null==n?void 0:n.startTime)?u:0,loadTime:null!=(h=null==n?void 0:n.totalTime)?h:0,compileTime:0,firstFrameTime:0},x.reusable=p,x.speed=void 0===m?1:m,x.name=null!=(l=null==g?void 0:g.name)?l:"New Composition",x.camera=new lu(x.name,ro({},null==g?void 0:g.camera,{aspect:x.width/x.height})),x.camera.engine=x.engine,x.url=null!=(c=null==n?void 0:n.url)?c:"",x.interactive=!0,y&&(x.onItemMessage=y),x.createRenderFrame(),iG.notifyCompositionCreated(sW(x),n),x}iY(i,e);var r=i.prototype;return r.getDuration=function(){return this.sceneRoot.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.sceneRoot.setVisible(t)},r.getSpeed=function(){return this.speed},r.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.setTime(this.time-this.startTime):this.setTime(0),this.resume()},r.pause=function(){this.paused=!0,this.emit("pause")},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},r.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},r.createRenderFrame=function(){this.renderFrame=new oC({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},r.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0)},r.addItem=function(t){t.setParent(this.sceneRoot)},r.getComponent=function(t){return this.sceneRoot.getComponent(t)},r.forwardTime=function(t){var e=1e3*t-1e3*this.time;this.update(e)},r.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},r.render=function(){this.renderContent()},r.renderContent=function(){this.renderer.renderRenderFrame(this.renderFrame)},r.update=function(t){if(!this.getPaused()){this.root.isDuringPlay||(this.root.awake(),this.root.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=(this.time-e)*1e3;this.rootComposition.setChildrenRenderOrder(0),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.sceneRoot.endBehavior===t6.destroy&&!this.reusable},r.updateCamera=function(){this.camera.updateMatrix()},r.updateCompositionTime=function(e){if(this.rootComposition.state===t.PlayState.Playing&&this.rootComposition.isActiveAndEnabled){var i=this.time+e-this.startTime;e<0&&i<0&&(i=0);var r=this.sceneRoot.duration,n=this.sceneRoot.endBehavior,a=!1;if(i>=r)switch(a=!0,n){case t6.restart:i%=r,this.restart();break;case t6.freeze:i=Math.min(r,i);case t6.forward:case t6.destroy:}this.rootComposition.tick(i+this.startTime-this.rootComposition.getTime()),this.isEnded!==a&&(a?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},r.createTexturesFromData=function(t){for(var e,i=iQ(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},r.getItemByName=function(t){return this.sceneRoot.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return n2((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.sceneRoot.hitTest(a,t,e,n,[],i,r),n},r.addInteractiveItem=function(t,e){if(e===tK.MESSAGE)return null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},r.removeInteractiveItem=function(t,e){e===tK.MESSAGE&&(null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},r.destroyItem=function(t){},r.lost=function(t){},r.restore=function(){},r.dispose=function(){var e=this;if(!this.destroyed){this.destroyed=!0;for(var i,r=iQ(this.textures);!(i=r()).done;)i.value.dispose();this._textures=[];for(var n,a=iQ(this.videos);!(n=a()).done;){var o=n.value;o.pause(),o.removeAttribute("src"),o.load()}this.videos=[],this.sceneRoot.dispose(),this.pluginRoot.dispose(),this.root.dispose(),this.renderFrame.dispose(),iG.notifyCompositionDestroy(this),this.update=function(){i_.error("Update disposed composition: "+e.name+".")},this.dispose=iM,this.renderer.engine.removeComposition(this),this.engine.env!==nB&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.sceneRoot.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.sceneRoot.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.sceneRoot.translate(t,e,i)},r.setPosition=function(t,e,i){this.sceneRoot.setPosition(t,e,i)},r.rotate=function(t,e,i){this.sceneRoot.rotate(t,e,i)},r.setRotation=function(t,e,i){this.sceneRoot.setRotation(t,e,i)},r.scale=function(t,e,i){this.sceneRoot.scale(t,e,i)},r.setScale=function(t,e,i){this.sceneRoot.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.reloadTexture=function(){var t=this;return eY(function(){return eK(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]}})})()},rk(i,[{key:"renderOrder",get:function(){return this._renderOrder},set:function(t){this._renderOrder=t}},{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=!!t}},{key:"width",get:function(){return this.engine.canvas.width}},{key:"height",get:function(){return this.engine.canvas.height}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"rootItem",get:function(){return this.sceneRoot}},{key:"transform",get:function(){return this.sceneRoot.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.sceneRoot.getDescendants()}},{key:"time",get:function(){return this.rootComposition.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),i}(nU),lm=new Int32Array(2),lv=new Float32Array(lm.buffer),ly=new Float64Array(lm.buffer),lg=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tz=ez||(ez={}))[tz.UTF8_BYTES=1]="UTF8_BYTES",tz[tz.UTF16_STRING=2]="UTF16_STRING";var lx=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return lm[0]=this.readInt32(t),lv[0]},e.readFloat64=function(t){return lm[lg?0:1]=this.readInt32(t),lm[lg?1:0]=this.readInt32(t+4),ly[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){lv[0]=e,this.writeInt32(t,lm[0])},e.writeFloat64=function(t,e){ly[0]=e,this.writeInt32(t,lm[lg?0:1]),this.writeInt32(t+4,lm[lg?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===ez.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),lb=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=lx.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(eZ(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=lx.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),lT=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new lS(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),lS=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=lT.createDataVector(t,this.data);return lT.createFBEffectsObjectData(t,e,i)},t}(),lE=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new lT).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new lC(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),lC=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=lE.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return lE.createFBEffectsPackageData(t,e)},t}(),lw=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new l_(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),l_=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return lw.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),lM=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new lA(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),lA=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return lM.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),lP=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new lM).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new lI(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),lI=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=lP.createChannelsVector(t,t.createObjectOffsetList(this.channels));return lP.createFBVertexData(t,this.vertexCount,e)},t}(),lR=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new lP).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new lw).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new lO(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),lO=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=lR.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=lR.createBinaryDataVector(t,this.binaryData),s=lR.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=lR.createInverseBindMatricesVector(t,this.inverseBindMatrices);return lR.startFBGeometryData(t),lR.addId(t,e),lR.addName(t,i),lR.addVertexData(t,r),lR.addIndexFormat(t,this.indexFormat),lR.addIndexOffset(t,this.indexOffset),lR.addSubMeshes(t,n),lR.addMode(t,this.mode),lR.addBuffer(t,a),lR.addBinaryData(t,o),lR.addBoneNames(t,s),lR.addRootBoneName(t,u),lR.addInverseBindMatrices(t,h),lR.endFBGeometryData(t)},t}(),lV=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new lb(1),i=new lC,r=[],n=iQ(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===eS.Geometry&&(o=new lS("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,lE.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new lx(t),i=lE.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===eS.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new lb(1),i=new lO,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=t.rootBoneName,l=t.inverseBindMatrices,c=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===l?[]:l,i.binaryData=void 0===c?[]:c;var f=new lI;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=iQ(s.channels);!(d=p()).done;){var m=d.value,v=new lA(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=iQ(t.subMeshes);!(y=x()).done;){var b=y.value,T=new l_(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,lE.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new lx(t),o=lR.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var l,c=u.channels(h);if(c){var f={semantic:null!=(l=c.semantic())?l:"",offset:c.offset(),format:c.format(),dimension:c.dimension(),normalize:c.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:eS.Geometry}},t}(),lN=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=e9(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e,i=iQ(this.tickers);!(e=i()).done;)(0,e.value)(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},rk(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),lF=function(e){function i(i,r){var n,a,o,s,u,h,l,c;return(n=e.call(this)||this).name="NewEngine",n.speed=1,n.displayScale=1,n.offscreenMode=!1,n.renderErrors=new Set,n.assetManagers=[],n.env="",n.ticker=null,n.doNotHandleContextLost=!0,n.contextWasLost=!1,n._disposed=!1,n.textures=[],n.materials=[],n.geometries=[],n.meshes=[],n.renderPasses=[],n.framebuffers=[],n.renderbuffers=[],n.particleSystems=[],n._compositions=[],n.clearAction={stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]},n.canvas=i,n.env=null!=(a=null==r?void 0:r.env)?a:"",n.ownsCanvas=null==(o=null==r?void 0:r.ownsCanvas)||o,n.doNotHandleContextLost=null==(s=null==r?void 0:r.doNotHandleContextLost)||s,n.name=null!=(u=null==r?void 0:r.name)?u:n.name,n.pixelRatio=null!=(h=null==r?void 0:r.pixelRatio)?h:ih(),n.jsonSceneData={},n.objectInstance={},n.root=new t.VFXItem(sW(n)),n.root.name="root",n.whiteTexture=nh(sW(n)),n.transparentTexture=nl(sW(n)),(null==r?void 0:r.manualRender)||(n.ticker=new lN(null==r?void 0:r.fps),n.runRenderLoop(n.mainLoop.bind(sW(n)))),n.eventSystem=new sn(sW(n),null!=(l=null==r?void 0:r.notifyTouch)&&l),n.eventSystem.enabled=null!=(c=null==r?void 0:r.interactive)&&c,n.eventSystem.bindListeners(n.canvas),n.assetLoader=new hm(sW(n)),n.assetService=new lo(sW(n)),n.renderTargetPool=new oA(sW(n)),n.renderingData={currentFrame:{}},iG.notifyEngineCreated(sW(n)),n}iY(i,e);var r=i.prototype;return r.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},r.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},r.findEffectsObjectData=function(t){return this.jsonSceneData[t]},r.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},r.findObject=function(t){return iO(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},r.removeInstance=function(t){delete this.objectInstance[t]},r.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=i.items,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,h=i.animations,l=i.bins,c=void 0===l?[]:l,f=i.miscs,d=i.compositions,p=iQ(d);!(e=p()).done;){var m=e.value;this.addEffectsObjectData(m)}for(var v,y=iQ(void 0===n?[]:n);!(v=y()).done;){var g=v.value;h9(g.renderLevel,t.renderLevel)||(g.components=[],g.type=tJ.null),this.addEffectsObjectData(g)}for(var x,b=iQ(void 0===a?[]:a);!(x=b()).done;){var T=x.value;this.addEffectsObjectData(T)}for(var S,E=iQ(void 0===o?[]:o);!(S=E()).done;){var C=S.value;this.addEffectsObjectData(C)}for(var w,_=iQ(void 0===s?[]:s);!(w=_()).done;){var M=w.value;this.addEffectsObjectData(M)}for(var A,P=iQ(void 0===u?[]:u);!(A=P()).done;){var I=A.value;this.addEffectsObjectData(I)}for(var R,O=iQ(void 0===h?[]:h);!(R=O()).done;){var V=R.value;this.addEffectsObjectData(V)}for(var N,F=iQ(void 0===f?[]:f);!(N=F()).done;){var L=N.value;this.addEffectsObjectData(L)}for(var D=0;D<c.length;D++){var k=c[D],B=t.bins[D];if(k.dataType===eS.BinaryAsset)k.buffer=B,k.id&&this.addEffectsObjectData(k);else{var z=new lV;z.deserializeFromBinary(new Uint8Array(B));for(var U,G=iQ(z.exportObjectDatas);!(U=G()).done;){var W=U.value;this.addEffectsObjectData(W)}}}for(var j,X=iQ(void 0===r?[]:r);!(j=X()).done;){var H=j.value;this.addEffectsObjectData(H)}},r.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},r.mainLoop=function(t){if(!this.contextWasLost){var e=this.renderErrors;if(e.size>0){this.emit("rendererror",e.values().next().value),null==(i=this.ticker)||i.pause();return}t=Math.min(t,33)*this.speed;for(var i,r,n=this.compositions,a=!1,o=iQ(n);!(r=o()).done;){var s=r.value;if(s.textureOffloaded){a=!0,i_.error("Composition "+s.name+" texture offloaded, skip render.");continue}s.update(t)}if(a){this.emit("rendererror",Error("Play when texture offloaded.")),null==(u=this.ticker)||u.pause();return}this.emit("update",t);for(var u,h,l=iQ(n);!(h=l()).done;)h.value.sceneTicking.preRender.tick(0);this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var c,f=iQ(n);!(c=f()).done;)c.value.renderContent();this.emit("postrender"),this.renderTargetPool.flush()}},r.resize=function(){var t,e,i,r,n=this.canvas.parentElement;if(n){var a=this.getTargetSize(n);t=a[0],e=a[1],i=a[2],r=a[3]}else t=i=this.canvas.width,e=r=this.canvas.height;var o=t/e;if(t&&e){var s=document.documentElement.clientWidth;i>2*s&&i_.error("DPI overflowed, width "+i+" is more than 2x document width "+s+", see "+nz["DPI overflowed"]+".");var u=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>u||r>u)&&(i_.error("Container size overflowed "+i+"x"+r+", see "+nz["Container size overflowed"]+"."),o>1?(i=Math.round(u),r=Math.round(u/o)):(r=Math.round(u),i=Math.round(u*o))),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",i_.info("Resize engine "+this.name+" ["+i+","+r+","+t+","+e+"]."),this.setSize(i,r)}},r.setSize=function(t,e){var i;(this.getWidth()!==t||this.getHeight()!==e)&&(this.canvas.width=t,this.canvas.height=e,this.setViewport(0,0,t,e)),null==(i=this.compositions)||i.forEach(function(i){i.camera.aspect=t/e}),this.emit("resize",this)},r.createVertexBuffer=function(t,e){throw Error("The active rendering backend does not provide vertex buffers.")},r.createDynamicVertexBuffer=function(t,e){return this.createVertexBuffer(t,e)},r.createIndexBuffer=function(t,e){throw Error("The active rendering backend does not provide index buffers.")},r.updateDynamicVertexBuffer=function(t,e,i,r){throw Error("The active rendering backend cannot update vertex buffers.")},r.updateDynamicIndexBuffer=function(t,e,i){throw Error("The active rendering backend cannot update index buffers.")},r.releaseBuffer=function(t){return t.references--,0===t.references},r.bindBuffers=function(t,e,i){throw Error("The active rendering backend cannot bind geometry buffers.")},r.drawElementsType=function(t,e,i,r){throw Error("The active rendering backend cannot draw indexed primitives.")},r.drawArraysType=function(t,e,i,r){throw Error("The active rendering backend cannot draw primitives.")},r.addTexture=function(t){this.disposed||e1(this.textures,t)},r.removeTexture=function(t){this.disposed||e2(this.textures,t)},r.addMaterial=function(t){this.disposed||e1(this.materials,t)},r.removeMaterial=function(t){this.disposed||e2(this.materials,t)},r.addGeometry=function(t){this.disposed||e1(this.geometries,t)},r.removeGeometry=function(t){this.disposed||e2(this.geometries,t)},r.addParticleSystem=function(t){this.disposed||e1(this.particleSystems,t)},r.removeParticleSystem=function(t){this.disposed||e2(this.particleSystems,t)},r.addMesh=function(t){this.disposed||e1(this.meshes,t)},r.removeMesh=function(t){this.disposed||e2(this.meshes,t)},r.addRenderPass=function(t){this.disposed||e1(this.renderPasses,t)},r.removeRenderPass=function(t){this.disposed||e2(this.renderPasses,t)},r.addFramebuffer=function(t){this.disposed||e1(this.framebuffers,t)},r.removeFramebuffer=function(t){this.disposed||e2(this.framebuffers,t)},r.addRenderbuffer=function(t){this.disposed||e1(this.renderbuffers,t)},r.removeRenderbuffer=function(t){this.disposed||e2(this.renderbuffers,t)},r.addComposition=function(t){this.disposed||e1(this.compositions,t)},r.removeComposition=function(t){this.disposed||e2(this.compositions,t)},r.getWidth=function(){return 0},r.getHeight=function(){return 0},r.getShaderLibrary=function(){return null},r.bindSystemFramebuffer=function(){},r.setViewport=function(t,e,i,r){},r.clear=function(t){},r.setSampleAlphaToCoverage=function(t){},r.setBlending=function(t){},r.setDepthTest=function(t){},r.setStencilTest=function(t){},r.setScissorTest=function(t){},r.setScissor=function(t,e,i,r){},r.setCulling=function(t){},r.setPolygonOffsetFill=function(t){},r.blendColor=function(t,e,i,r){},r.blendFuncSeparate=function(t,e,i,r){},r.blendEquationSeparate=function(t,e){},r.colorMask=function(t,e,i,r){},r.depthMask=function(t){},r.depthFunc=function(t){},r.depthRange=function(t,e){},r.polygonOffset=function(t,e){},r.cullFace=function(t){},r.frontFace=function(t){},r.stencilMaskSeparate=function(t,e){},r.stencilFuncSeparate=function(t,e,i,r){},r.stencilOpSeparate=function(t,e,i,r){},r.dispose=function(){if(!this.disposed){this._disposed=!0,iG.notifyEngineDestroy(this);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&&i_.warn("Release GPU memory: "+t.join(", ")+"."),null==(e=this.ticker)||e.stop(),null==(i=this.eventSystem)||i.dispose();for(var e,i,r,n,a,o=iQ(this._compositions.slice());!(a=o()).done;)a.value.dispose();this.root.dispose(),null==(r=this.assetService)||r.dispose(),null==(n=this._graphics)||n.dispose(),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.assetManagers.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.particleSystems=[],this._compositions=[]}},r.getTargetSize=function(t){if(null==t)throw Error("Container is not an HTMLElement, see "+nz["Container is not an HTMLElement"]+".");var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),a=0,o=0;n?(a=parseInt(n.width,10),o=parseInt(n.height,10)):(a=t.clientWidth,o=t.clientHeight),r?a/o>r?e=(i=o*this.displayScale)*r:i=(e=a*this.displayScale)/r:(e=a,i=o);var s=this.pixelRatio,u=e,h=i;if(e=Math.round(e*s),i=Math.round(i*s),e<1||i<1){if(this.offscreenMode)e=i=u=h=1;else throw Error("Invalid container size "+e+"x"+i+", see "+nz["Invalid container size"]+".")}return[u,h,e,i]},rk(i,[{key:"compositions",get:function(){return this._compositions.sort(function(t,e){return t.getIndex()-e.getIndex()})}},{key:"graphics",get:function(){return this._graphics||(this._graphics=new oj(this)),this._graphics}},{key:"disposed",get:function(){return this._disposed}}]),i}(nU),lL={format:rG.RGBA,type:rG.UNSIGNED_BYTE,minFilter:rG.LINEAR,magFilter:rG.LINEAR,wrapS:rG.CLAMP_TO_EDGE,wrapT:rG.CLAMP_TO_EDGE},lD=Symbol("dispose"),lk=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(lL).forEach(function(t){var i,r=null!=(i=e[t])?i:lL[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var l=this.engine;iS(l),h=no.create(l,o),this.textureCache[u]=h,this.textureRef[u]=1,h[lD]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[lD](),i.dispose=i[lD]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[lD](),i.dispose=i[lD]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),lB=function(){function t(){}return t.load=function(t,e,i){void 0===i&&(i={});var r=this;return eY(function(){var n,a,o,s,u,h,l,c,f,d,p,m,v;return eK(this,function(y){switch(y.label){case 0:return s=performance.now(),u=null==(a=e.gpuCapability)?void 0:null==(n=a.detail)?void 0:n.asyncShaderCompile,h=e.compositions.length,l=new ln(i),e.assetManagers.push(l),[4,l.loadScene(t,e.renderer)];case 1:return c=y.sent(),e.clearResources(),iG.notifyAssetsLoadFinish(c,l.options,e),e.assetService.prepareAssets(c,c.assets),e.assetService.updateTextVariables(c,i.variables),(f=r.createComposition(c,e,i)).setIndex(h),d=performance.now(),[4,new Promise(function(t){var i;null==(i=e.getShaderLibrary())||i.compileAllShaders(function(){return t(null)})})];case 2:return y.sent(),p=performance.now()-d,null==(o=e.ticker)||o.start(),m=f.name,v=performance.now()-s,f.statistic.compileTime=p,f.statistic.firstFrameTime=v,i_.info("First frame ["+m+"]: "+v.toFixed(4)+"ms."),i_.info("Shader "+(u?"async":"sync")+" compile ["+m+"]: "+p.toFixed(4)+"ms."),[2,f]}})})()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=new lp(e,ro({},i),t);return e.env!==nB&&e.assetService.createShaderVariant(),r},t}(),lz=function(){function e(){}return e.instantiate=function(e,i){var r,n=e.scene,a=e.scene.jsonScene,o=e.options,s=i.engine;s.clearResources(),iG.notifyAssetsLoadFinish(n,o,s),s.assetService.prepareAssets(n,n.assets),s.assetService.updateTextVariables(n,o.variables),i.createTexturesFromData(n.textureOptions);for(var u,h=iQ(Object.keys(n.assets));!(u=h()).done;){var l=u.value,c=n.assets[l];eZ(c,HTMLVideoElement)&&i.videos.push(c)}var f=a.compositionId,d=a.compositions.find(function(t){return t.id===f});if(!d)throw Error('Composition with id "'+f+'" not found in JSONScene.');var p=new t.VFXItem(s);return p.instantiatePreComposition(d),p.getComponent(t.CompositionComponent).playOnStart=null==(r=o.autoplay)||r,p.getComponent(t.CompositionComponent).endBehavior=p.endBehavior,i.addItem(p),p},e}();iU("camera",o$),iU("text",u2),iU("sprite",sc),iU("particle",uY),iU("interact",ss),i_.info("Core version: 2.10.1.");var lU=((eU={})[rG.ONE]=eX.OneFactor,eU[rG.ZERO]=eX.ZeroFactor,eU[rG.SRC_COLOR]=eX.SrcColorFactor,eU[rG.SRC_ALPHA]=eX.SrcAlphaFactor,eU[rG.ONE_MINUS_SRC_COLOR]=eX.OneMinusSrcColorFactor,eU[rG.ONE_MINUS_SRC_ALPHA]=eX.OneMinusSrcAlphaFactor,eU[rG.DST_COLOR]=eX.DstColorFactor,eU[rG.DST_ALPHA]=eX.DstAlphaFactor,eU[rG.ONE_MINUS_DST_COLOR]=eX.OneMinusDstColorFactor,eU[rG.ONE_MINUS_DST_ALPHA]=eX.OneMinusDstAlphaFactor,eU),lG=((eG={})[rG.NEVER]=eX.NeverStencilFunc,eG[rG.EQUAL]=eX.EqualStencilFunc,eG[rG.LESS]=eX.LessStencilFunc,eG[rG.LEQUAL]=eX.LessEqualStencilFunc,eG[rG.ALWAYS]=eX.AlwaysStencilFunc,eG[rG.NOTEQUAL]=eX.NotEqualStencilFunc,eG[rG.GREATER]=eX.GreaterStencilFunc,eG[rG.GEQUAL]=eX.GreaterEqualStencilFunc,eG),lW=((eW={})[rG.KEEP]=eX.KeepStencilOp,eW[rG.ZERO]=eX.ZeroStencilOp,eW[rG.REPLACE]=eX.ReplaceStencilOp,eW[rG.INCR]=eX.IncrementStencilOp,eW[rG.DECR]=eX.DecrementStencilOp,eW[rG.INCR_WRAP]=eX.IncrementWrapStencilOp,eW[rG.DECR_WRAP]=eX.IncrementWrapStencilOp,eW[rG.INVERT]=eX.InvertStencilOp,eW),lj=((ej={})[rG.NEVER]=eX.NeverDepth,ej[rG.ALWAYS]=eX.AlwaysDepth,ej[rG.EQUAL]=eX.EqualDepth,ej[rG.LESS]=eX.LessDepth,ej[rG.LEQUAL]=eX.LessEqualDepth,ej[rG.GREATER]=eX.GreaterDepth,ej[rG.GEQUAL]=eX.GreaterEqualDepth,ej[rG.NOTEQUAL]=eX.NotEqualDepth,ej),lX=["uMaskTex","_MainTex","uColorOverLifetime","uColorOverTrail"],lH=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new eX.RawShaderMaterial,n.threeUniforms={},n.macrosDirty=!0;var n,a,o,s,u,h,l,c=null==r?void 0:r.shader,f=null!=(o=null==(a=i.gpuCapability)?void 0:a.level)?o:1;return n.shader=new t.Shader(i),n.shader.shaderData=ro({},c,{id:iL(),dataType:eS.Shader,vertex:null!=(s=null==c?void 0:c.vertex)?s:"",fragment:null!=(u=null==c?void 0:c.fragment)?u:""}),n.threeUniforms._MainTex=new eX.Uniform(null),n.threeUniforms.effects_ObjectToWorld=new eX.Uniform(new eX.Matrix4().identity()),n.threeUniforms.effects_MatrixInvV=new eX.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.threeUniforms.effects_MatrixVP=new eX.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.threeUniforms.effects_MatrixV=new eX.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new eX.RawShaderMaterial({vertexShader:ob.genFinalShaderCode({level:f,shaderType:t.ShaderType.vertex,shader:null!=(h=null==c?void 0:c.vertex)?h:"",macros:null==c?void 0:c.macros,removeVersion:!0}),fragmentShader:ob.genFinalShaderCode({level:f,shaderType:t.ShaderType.fragment,shader:null!=(l=null==c?void 0:c.fragment)?l:"",macros:null==c?void 0:c.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:eX.LessDepth,polygonOffsetFactor:eX.ZeroFactor,polygonOffsetUnits:eX.ZeroFactor,polygonOffset:!1,uniforms:n.threeUniforms}),1===f?n.material.glslVersion=eX.GLSL1:n.material.glslVersion=eX.GLSL3,n}iY(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;lX.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new eX.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new eX.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.threeUniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=iQ(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.threeUniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=iQ(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.threeUniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.threeUniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.threeUniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.threeUniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){var e=this.threeUniforms[t].value;return new ii(e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setUniform(t,new eX.Vector4(e.r,e.g,e.b,e.a))},r.getQuaternion=function(t){return this.threeUniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.threeUniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.threeUniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.threeUniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.threeUniforms[t]},r.setUniform=function(t,e){var i=new eX.Uniform(e);this.threeUniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(){this.destroyed||(this.material.dispose(),this.destroyed=!0,e.prototype.dispose.call(this))},rk(i,[{key:"blending",get:function(){return this.material.blending!==eX.NoBlending},set:function(t){this.material.blending=t?eX.CustomBlending:eX.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=lU[e],this.material.blendDst=lU[i],this.material.blendSrcAlpha=lU[r],this.material.blendDstAlpha=lU[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=lj[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=lG[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=lW[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=lW[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=lW[t[0]])}},{key:"culling",get:function(){return this.material.side!==eX.DoubleSide},set:function(t){this.material.side=t?eX.FrontSide:eX.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tH.FRONT?this.material.side=eX.FrontSide:t===tH.BACK&&(this.material.side=eX.BackSide)}},{key:"colorMask",get:function(){return this.material.colorWrite},set:function(t){this.material.colorWrite=t}}]),i}(nw);function lY(t,e){return e&&("object"==(e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)||"function"==typeof e)?e:sW(t)}var lZ=new WeakMap;function lq(t){t.flush();var e,i=lZ.get(t),r=t.getAttributeNames(),n=t.getIndexBuffer(),a=t.instanceCount>0;if(!i||!((e=i).indexBuffer===n&&e.instanced===a&&Object.keys(e.vertexBuffers).length===r.length&&r.every(function(i){return e.vertexBuffers[i]===t.getVertexBuffer(i)}))){null==i||i.resource.dispose();var o=a?new eX.InstancedBufferGeometry:new eX.BufferGeometry,s={};o.name=t.name,r.forEach(function(e){var i=t.getVertexBuffer(e),r=null==i?void 0:i.getBuffer(),n=null==r?void 0:r.resource;i&&eZ(n,eX.InterleavedBuffer)&&(s[e]=i,o.setAttribute(e,new eX.InterleavedBufferAttribute(n,i.getSize(),i.byteOffset/n.array.BYTES_PER_ELEMENT,i.normalized)))});var u=null==n?void 0:n.resource;eZ(u,eX.BufferAttribute)&&o.setIndex(u),i={vertexBuffers:s,indexBuffer:n,instanced:a,resource:o},lZ.set(t,i)}eZ(i.resource,eX.InstancedBufferGeometry)&&(i.resource.instanceCount=t.instanceCount);var h=t.getIndexBuffer()?t.getDrawStart()/nA(t.getIndexType()):t.getDrawStart();return i.resource.setDrawRange(h,t.getDrawCount()),i.resource}var lK=function(t){function e(e,i){if(!i)return lY(r);var r,n=i.material,a=i.geometry,o=i.priority;(r=t.call(this,e,i)||this).geometry=a,r.material=n;var s=lq(a);return a.mode===rG.LINES?r.mesh=new eX.LineSegments(s,n.material):r.mesh=new eX.Mesh(s,n.material),r.priority=void 0===o?0:o,r}iY(e,t);var i=e.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(t){this.material.dispose(),this.material=t,this.mesh.material=t.material},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},i.restore=function(){},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.mesh.geometry=lq(this.geometry),this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.dispose=function(e){this.destroyed||(this.mesh.clear(),this.destroyed=!0),t.prototype.dispose.call(this)},rk(e,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),e}(os),lQ=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(ro({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a.source={},a}iY(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.assembleOptions=function(e){var r=e.target,n=void 0===r?rG.TEXTURE_2D:r;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=t.TextureSourceType.none),ro({},e,{target:n,format:eX.RGBAFormat,type:eX.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose(),e.prototype.dispose.call(this)},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,h=i.sourceType,l=eX.UVMapping,c=i.format,f=void 0;if(this.sourceType=h,h===t.TextureSourceType.data){var d=e.data;f=new eX.DataTexture(d.data,d.width,d.height,c,n,l,a,o,u,s),this.width=d.width,this.height=d.height}else if(h===t.TextureSourceType.image){var p=e.image;f=new eX.Texture(p,l,a,o,u,s,c,n),this.width=p.width,this.height=p.height}else if(h===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});c=eX.RGBA_ASTC_4x4_Format,f=new eX.CompressedTexture(y,m,v,c,n,l,a,o,u,s),this.width=m,this.height=v}else if(h===t.TextureSourceType.video)f=new eX.VideoTexture(e.video,l,a,o,u,s,c,n);else if(h===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,S=null!=(b=g.height)?b:0;f=new eX.FramebufferTexture(T,S,c),this.width=T,this.height=S}}else h===t.TextureSourceType.none&&((f=new eX.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=eX.MirroredRepeatWrapping,f.wrapT=eX.MirroredRepeatWrapping,this.width=this.height=1);if(this.source=e,f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===rG.LINEAR?eX.LinearFilter:eX.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case rG.MIRRORED_REPEAT:return eX.MirroredRepeatWrapping;case rG.REPEAT:return eX.RepeatWrapping;default:return eX.ClampToEdgeWrapping}},i}(no),lJ=function(t){function e(e,i,r){return t.call(this,e,i,r)}return iY(e,t),e.prototype.renderContent=function(){var t=this.renderer;this.renderFrame.renderPasses[0].meshes.length=0;for(var e,i=this.sceneRoot.getDescendants(),r=iQ(i);!(e=r()).done;)for(var n,a=e.value.getComponents(nk),o=iQ(a);!(n=o()).done;){var s=n.value;s.isActiveAndEnabled&&s.render(t)}},e}(lp);lJ.shape={};var l$=function(t){function e(e){return t.call(this,e)}iY(e,t);var i=e.prototype;return i.getWidth=function(){return this.engine.canvas.width},i.getHeight=function(){return this.engine.canvas.height},i.drawGeometry=function(t,e,i,r){},e}(oO),l0=function(t){function e(e){var i;return(i=t.call(this)||this).resource=e,i}return iY(e,t),rk(e,[{key:"underlyingResource",get:function(){return this.resource}}]),e}(nM),l1=function(e){function i(t,i){var r;return(r=e.call(this,t.canvas,i)||this).renderer=new l$(sW(r)),r.gpuCapability=new oI(t),r}iY(i,e);var r=i.prototype;return r.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},r.createVertexBuffer=function(t,e){var i=l2(t,e.type),r=e.byteStride>0?e.byteStride/i.BYTES_PER_ELEMENT:1;return l3(e.instanceDivisor>0?new eX.InstancedInterleavedBuffer(i,r,e.instanceDivisor):new eX.InterleavedBuffer(i,r),i.byteLength)},r.createDynamicVertexBuffer=function(t,e){return this.createVertexBuffer(t,e)},r.createIndexBuffer=function(t){var e=function(t){if(eZ(t,Uint16Array)||eZ(t,Uint32Array))return t;for(var e=0;e<t.length;e++)if(t[e]>=65535)return new Uint32Array(t);return new Uint16Array(t)}(t),i=l3(new eX.BufferAttribute(e,1),e.byteLength);return i.is32Bits=eZ(e,Uint32Array),i},r.updateDynamicVertexBuffer=function(e,i,r,n){void 0===r&&(r=0);var a=l2(i,t.BufferDataType.Float);void 0!==n&&n<a.byteLength&&(a=new Uint8Array(a.buffer,a.byteOffset,n));var o=e.resource;if(o){if(r<0||r+a.byteLength>e.capacity)throw RangeError("Buffer update is out of range.");var s=o.array,u=r/s.BYTES_PER_ELEMENT;if(!Number.isInteger(u))throw RangeError("Buffer update is not aligned.");s.set(a,u),o.updateRange.offset=u,o.updateRange.count=a.length,o.needsUpdate=!0}},r.updateDynamicIndexBuffer=function(t,e,i){void 0===i&&(i=0);var r=t.is32Bits?eZ(e,Uint32Array)?e:new Uint32Array(e):eZ(e,Uint16Array)?e:new Uint16Array(e),n=t.resource;if(n){if(i<0||i+r.byteLength>t.capacity)throw RangeError("Buffer update is out of range.");var a=n.array,o=i/a.BYTES_PER_ELEMENT;if(!Number.isInteger(o))throw RangeError("Buffer update is not aligned.");a.set(r,o),n.updateRange.offset=o,n.updateRange.count=r.length,n.needsUpdate=!0}},r.releaseBuffer=function(t){return t.references--,0===t.references&&(t.resource=void 0,t.capacity=0,!0)},r.removeGeometry=function(t){var i;null==(i=lZ.get(t))||i.resource.dispose(),lZ.delete(t),e.prototype.removeGeometry.call(this,t)},i}(lF);function l2(t,e){if("number"==typeof t)return nR(e,t/nA(e));if(Array.isArray(t)){var i=nR(e,t.length);return i.set(t),i}if(eZ(t,ArrayBuffer)){var r=t.byteLength/nA(e),n=nR(e,r);return new Uint8Array(n.buffer).set(new Uint8Array(t)),n}return eZ(t,DataView)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function l3(t,e){var i=new l0(t);return i.capacity=e,i.references=1,i}var l4=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.engine=new l1(e),r.assetService=new lo(r.engine),r.width=n,r.height=a,r.camera=o,r}iY(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return eY(function(){var r,n,a,o,s,u,h,l,c,f,d,p;return eK(this,function(m){switch(m.label){case 0:return iS(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),r=performance.now(),n=[],a=[],s=null==(o=null==e?void 0:e.autoplay)||o,u=i.baseCompositionIndex,iP(t)?(h=n).push.apply(h,[].concat(t)):n.push(t),[4,Promise.all(n.map(eY(function(t,r){var n,o,h,l,c,f,d;return eK(this,function(p){switch(p.label){case 0:return o=(n=i.assetService.assembleSceneLoadOptions(t,ro({autoplay:s},e))).source,[4,(l=new ln(h=n.options)).loadScene(o,i.renderer)];case 1:return c=p.sent(),(f=i.engine).clearResources(),iG.notifyAssetsLoadFinish(c,l.options,f),i.assetService.prepareAssets(c,l.getAssets()),i.assetService.updateTextVariables(c,l.options.variables),d=i.createComposition(c,h),i.baseCompositionIndex+=1,d.setIndex(u+r),a[r]=d,[2]}})})))];case 1:for(m.sent(),l=0;l<a.length;l++)s?a[l].play():a[l].pause();for(c=a.map(function(t){return t.name}),f=performance.now()-r,d=iQ(a);!(p=d()).done;)p.value.statistic.firstFrameTime=f;return i_.info("First frame ["+c+"]: "+f.toFixed(4)+"ms."),[2,iP(t)?a:a[0]]}})})()},i.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=new lJ(this.engine,ro({},e,{onItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),t);return r.on("end",function(){i.dispatchEvent({type:"end",composition:r})}),this.renderer.engine.setOptions({threeCamera:this.camera,threeGroup:this,composition:r}),this.compositions.push(r),r},i.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},i.resume=function(){this.dispatchEvent({type:"resume"}),this.compositions.forEach(function(t){t.resume()})},i.update=function(t){this.compositions.forEach(function(e){e.update(t),e.render()})},rk(e,[{key:"renderer",get:function(){return this.engine.renderer}},{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(eX.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}iY(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){this.isActiveAndEnabled||this.threeMesh.clear(),t.prototype.dispose.call(this)},i.fromData=function(e){if(t.prototype.fromData.call(this,e),!this.threeMesh){var i=lq(this.geometry);this.geometry.mode===rG.LINES?this.threeMesh=new eX.LineSegments(i,this.material.material):this.threeMesh=new eX.Mesh(i,this.material.material)}},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.threeMesh.geometry=lq(this.geometry),this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},rk(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=eq([i1(eS.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){(r=t.call(this,e,i)||this).isDirty=!0;var r,n=oL.getCanvasAndContext(1,1);if(r.canvas=n.canvas,r.context=n.context,!i)return lY(r);var a=i.options;return r.updateWithOptions(a),r.updateTexture(),r}iY(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture(),this.releaseTextCanvas()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(),this.material.setColor("_Color",new ii(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=eq([i1(eS.TextComponent)],t.ThreeTextComponent),ik(t.ThreeTextComponent,[u$]),no.create=function(t,e){return new lQ(t,void 0,e)},no.createWithData=function(t,e,i){return new lQ(t,e,i)},nw.create=function(t,e){return new lH(t,e)},os.create=function(t,e){return new lK(t,e)};var l5="2.10.1";i_.info("THREEJS plugin version: "+l5+"."),t.ATLAS_SIZE=512,t.ActivationMixerPlayable=sb,t.ActivationPlayable=sT,t.AndNode=rb,t.Animatable=ru,t.AnimationClipNode=rs,t.AnimationEvent=sy,t.ApplyAdditiveNode=rg,t.Asset=hd,t.AssetLoader=hm,t.AssetManager=ln,t.AssetService=lo,t.BYTES_TYPE_MAP=oa,t.Behaviour=rz,t.BezierCurve=aR,t.BezierCurvePath=ab,t.BezierCurveQuat=aT,t.BezierDataMap=at,t.BezierEasing=ao,t.BezierLengthData=n9,t.BezierMap=n7,t.BezierPath=an,t.BezierQuat=aa,t.BlendNode=rx,t.BoolValueNode=rr,t.BoundingBoxInfo=nD,t.Buffer=nO,t.CONSTANT_MAP_BLEND=lU,t.CONSTANT_MAP_DEPTH=lj,t.CONSTANT_MAP_STENCIL_FUNC=lG,t.CONSTANT_MAP_STENCIL_OP=lW,t.COPY_FRAGMENT_SHADER="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n",t.COPY_MESH_SHADER_ID="effects-internal-copy-mesh",t.COPY_VERTEX_SHADER="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",t.Camera=lu,t.CameraVFXItemLoader=o$,t.Circle=aJ,t.ColorCurve=aL,t.ColorPlayable=sv,t.ColorPropertyMixerPlayable=sC,t.Component=rB,t.ComponentTimePlayable=uH,t.ComponentTimePlayableAsset=uX,t.ComponentTimeTrack=uG,t.Composition=lp,t.ConstBoolNode=rC,t.ConstFloatNode=rE,t.ConstraintTarget=oZ,t.ControlParameterBoolNode=r_,t.ControlParameterFloatNode=rw,t.ControlParameterTriggerNode=rM,t.DEFAULT_FONTS=["serif","sans-serif","monospace","courier"],t.DEFAULT_FPS=60,t.DataBuffer=nM,t.Database=hv,t.Deferred=function(){var t=this;this.promise=new Promise(function(e,i){t.resolve=e,t.reject=i})},t.Downloader=rq,t.DrawObjectPass=a4,t.EFFECTS_COPY_MESH_NAME="effects-internal-copy",t.EVENT_TYPE_CLICK=st,t.EVENT_TYPE_TOUCH_END=sr,t.EVENT_TYPE_TOUCH_MOVE=si,t.EVENT_TYPE_TOUCH_START=se,t.EffectComponentTimeTrack=uj,t.EffectsObject=i4,t.EffectsPackage=lV,t.Ellipse=aW,t.Engine=lF,t.EventEmitter=nU,t.EventSystem=sn,t.Float16ArrayWrapper=nZ,t.FloatComparisonNode=rR,t.FloatComparisonNodeData=rI,t.FloatPropertyMixerPlayable=sw,t.FloatValueNode=ri,t.Framebuffer=a0,t.GPUCapability=oI,t.Geometry=a6,t.GlobalUniforms=o_,t.GlyphAtlas=oD,t.GradientValue=ay,t.GraphInstance=rL,t.GraphNode=i9,t.GraphNodeData=i7,t.Graphics=oj,t.HELP_LINK=nz,t.InputEvent=o2,t.InputEventKey=o4,t.InputEventMouse=o5,t.InputEventMouseButton=o6,t.InputEventMouseMotion=o8,t.InputEventScreenDrag=o7,t.InputEventScreenTouch=o9,t.InputEventWithModifiers=o3,t.InteractLoader=ss,t.InteractMesh=sh,t.InvalidIndex=-1,t.LayerBlendNode=rA,t.LineSegments=ag,t.LinearValue=av,t.MaskProcessor=n_,t.MaskableGraphic=oq,t.Material=nw,t.MaterialDataBlock=nd,t.MaterialState=nE,t.Mesh=os,t.NodeTransform=rm,t.NotNode=rS,t.NotifyEvent=sg,t.OrNode=rT,t.PLAYER_OPTIONS_ENV_EDITOR=nB,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=uw,t.ParticleBehaviourPlayableAsset=u_,t.ParticleLoader=uY,t.ParticleMesh=uA,t.ParticleMixerPlayable=s_,t.ParticleSystemRenderer=uP,t.ParticleTrack=sG,t.PassTextureCache=lk,t.PathSegments=ax,t.Playable=sf,t.PlayableAsset=sp,t.PlayableOutput=sd,t.Plugin=iX,t.PluginSystem=iG,t.PointerEventData=nN,t.PolyStar=aQ,t.Polygon=a$,t.Pose=rv,t.PoseNode=rt,t.Precomposition=li,t.PrecompositionManager=lz,t.PropertyClipPlayable=sS,t.PropertyTrack=sU,t.REFERENCE_CURVE=28,t.RENDER_PREFER_LOOKUP_TEXTURE=oV,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=ad,t.RandomValue=ap,t.RandomVectorValue=am,t.RaycastResult=nF,t.Rectangle=aj,t.ReferenceCurve=aV,t.RenderFrame=oC,t.RenderPass=a3,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=a1,t.RenderTargetPool=oA,t.Renderbuffer=oM,t.Renderer=oO,t.RendererComponent=nk,t.RuntimeClip=sz,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.SceneLoader=lB,t.SerializationHelper=hp,t.ShaderFactory=ob,t.ShaderVariant=nS,t.SpriteColorMixerPlayable=sM,t.SpriteComponentTimeTrack=uW,t.SpriteLoader=sc,t.SpritePropertyMixerPlayable=sA,t.StateMachineNode=rO,t.StateNode=rV,t.StaticValue=af,t.SubCompositionClipPlayable=sP,t.SubCompositionMixerPlayable=sI,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oN,t.TEXTURE_UNIFORM_MAP=lX,t.TextCache=ok,t.TextComponentBase=u$,t.TextLayout=uQ,t.TextLoader=u2,t.TextStyle=uJ,t.Texture=no,t.TextureFactory=nf,t.ThreeComposition=lJ,t.ThreeDisplayObject=l4,t.ThreeEngine=l1,t.ThreeMaterial=lH,t.ThreeTexture=lQ,t.Ticker=lN,t.TimelineClip=sB,t.TimelineInstance=uz,t.TrackMixerPlayable=sx,t.Transform=nH,t.TransformMixerPlayable=sF,t.TransformPlayable=sN,t.TransitionNode=rN,t.Triangle=aX,t.TrimPath=hf,t.ValueGetter=ac,t.ValueNode=re,t.Vector2Curve=aI,t.Vector2PropertyMixerPlayable=sk,t.Vector3Curve=aP,t.Vector3PropertyMixerPlayable=sD,t.Vector4Curve=aA,t.Vector4PropertyMixerPlayable=sL,t.VertexBuffer=nV,t.addByOrder=ib,t.addItem=e1,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=ik,t.assertExist=iS,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=iD,t.breakOpportunityAfter=uK,t.buildBezierData=ar,t.buildEasingCurve=as,t.buildLine=aU,t.calculateTranslation=nQ,t.canUseBOM=il,t.canvasPool=oL,t.closePointEps=1e-4,t.colorGradingFrag=op,t.colorStopsFromGradient=io,t.colorToArr=ir,t.combineImageTemplate=lt,t.createGLContext=function(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r},t.createKeyFrameMeta=aw,t.createShape=s4,t.createTypedArray=nR,t.createValueGetter=aF,t.curveEps=1e-4,t.decimalEqual=n4,t.deserializeMipmapTexture=ne,t.earcut=uc,t.effectsClass=i1,t.effectsClassStore=i0,t.enlargeBuffer=e3,t.ensureFixedNumber=hg,t.ensureVec3=nJ,t.extractMinAndMax=n6,t.gaussianDownHFrag=om,t.gaussianDownVFrag=ov,t.gaussianUpFrag=oy,t.generateEmptyTexture=nl,t.generateEmptyTypedArray=function(t){return nR(t,0)},t.generateGUID=iL,t.generateHalfFloatTexture=ns,t.generateWhiteTexture=nh,t.getBackgroundImage=h7,t.getBytesPerElement=nA,t.getClass=function(t){return i0[t]},t.getColorFromGradientStops=ia,t.getConfig=function(t){return oF[t]},t.getControlPoints=au,t.getDataByteLength=nI,t.getDataType=nP,t.getDefaultTextureFactory=function(){return eR||(eR=new nf),eR},t.getGeometryByShape=ud,t.getGeometryTriangles=uf,t.getKeyFrameMetaByRawValue=aC,t.getMergedStore=i2,t.getNodeDataClass=function(t){return i6[t]},t.getParticleMeshShader=function(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===nB]],h=e.detail,l=aw(),c=aw(),f=h.maxVertexUniforms>0,d=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,p=0,m=0;f&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(u.push(["SPEED_OVER_LIFETIME",!0]),m|=2,aC(l,d));var v=o.textureSheetAnimation;v&&v.animate&&(u.push(["USE_SPRITE",!0]),m|=4);var y=o.colorOverLifetime;y&&y.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&aC(l,g);var x=o.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==x?void 0:x[r])&&(aC(l,x[r]),i=1,m|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==x?void 0:x[n])&&(aC(l,x[n]),o=1,m|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==x?void 0:x.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),a&&(null==x?void 0:x.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),o.sizeOverLifetime){var b=o.sizeOverLifetime;b.separateAxes?(aC(l,b.x),u.push(["SIZE_Y_BY_LIFE",1]),m|=16384,aC(l,b.y)):aC(l,b.size)}if(o.rotationOverLifetime){var T=o.rotationOverLifetime;T.z&&(aC(l,null==T?void 0:T.z),m|=32768,u.push(["ROT_Z_LIFETIME",1])),T.separateAxes&&(T.x&&(aC(l,T.x),m|=65536,u.push(["ROT_X_LIFETIME",1])),T.y&&(aC(l,T.y),m|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==T?void 0:T.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=262144)}aC(l,null==x?void 0:x.gravityOverLifetime),(null==x?void 0:x.forceTarget)&&(u.push(["FINAL_TARGET",!0]),m|=524288,aC(l,x.forceCurve));var S=h.halfFloatTexture;S&&c.max&&(m|=1048576);var E=h.maxVertexUniforms,C=l.max+l.curves.length-32>E;oF[oV]&&(C=!0),C&&S&&f&&(p=1);var w={fragment:ol,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+oc,shared:!0,cacheId:["-p:",s,m,l.index,l.max,c.index,c.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",c.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",c.max]),{shader:w,vertex:l.index,fragment:c.index}},t.getPixelRatio=ih,t.getPluginUsageInfo=ij,t.getPreMultiAlpha=rH,t.getStandardComposition=h4,t.getStandardImage=h3,t.getStandardItem=h6,t.getStandardJSON=h1,t.getTextureSize=ow,t.glContext=rG,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return eC.Float32;case WebGLRenderingContext.SHORT:return eC.Int16;case WebGLRenderingContext.BYTE:return eC.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return eC.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return eC.UInt8;default:return eC.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=eY(function(){return eK(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){iA(t)&&(t=ir(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i},t.imageDataFromGradient=ig,t.initErrors=rU,t.initGLContext=rj,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=is,t.isAlipayMiniApp=iv,t.isAndroid=id,t.isArray=iP,t.isBreakChar=uZ,t.isCJKLike=uq,t.isCanvas=iV,t.isFunction=iI,t.isIOS=ic,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return iv()||iy()},t.isObject=iR,t.isOpenHarmony=ip,t.isPlainObject=iO,t.isPowerOfTwo=function(t){return(t&t-1)==0&&0!==t},t.isSafeFontFamily=iC,t.isSimulatorCellPhone=im,t.isString=iA,t.isUniformStruct=np,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&np(t[0])},t.isValidFontFamily=iE,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=iy,t.itemFrag=oh,t.itemVert=ou,t.loadAVIFOptional=r0,t.loadBinary=r4,t.loadBlob=function(t){return r6.apply(this,arguments)},t.loadImage=r2,t.loadMedia=r7,t.loadVideo=r8,t.loadWebPOptional=rJ,t.logger=i_,t.math=nT,t.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}},t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.nodeDataClass=i8,t.noop=iM,t.normalizeColor=hC,t.numberToFix=n5,t.oldBezierKeyFramesToNew=aO,t.parsePercent=iu,t.particleFrag=ol,t.particleOriginTranslateMap=n1,t.particleUniformTypeMap=uM,t.particleVert=oc,t.passRenderLevel=h9,t.pluginLoaderMap=iB,t.randomInRange=iN,t.registerPlugin=iU,t.removeItem=e2,t.rotateVec2=up,t.screenMeshVert=od,t.serialize=function(t,e){return i3(t,e)},t.setBlendMode=rY,t.setConfig=function(t,e){return oF[t]=e},t.setDefaultTextureFactory=function(t){eR=t},t.setMaskMode=function(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[rG.ALWAYS,rG.ALWAYS],e.stencilOpZPass=[rG.REPLACE,rG.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[rG.EQUAL,rG.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[rG.NOTEQUAL,rG.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}},t.setRayFromCamera=n2,t.setSideMode=rZ,t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new eX.Uniform(i)},t.sortByOrder=ix,t.spec=iq,t.textureLoaderRegistry=nc,t.thresholdFrag=og,t.throwDestroyedError=iF,t.toBufferView=function(t){return Array.isArray(t)?new Float32Array(t):eZ(t,ArrayBuffer)?new Uint8Array(t):t},t.trailVert=of,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=n3,t.unregisterPlugin=function(t){delete iB[t];var e=iz.findIndex(function(e){return e.name===t});-1!==e&&iz.splice(e,1)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=n$,t.vecMulCombine=n0,t.version=l5,t.vertexFormatType2GLType=function(t){switch(t){case eC.Float32:return WebGLRenderingContext.FLOAT;case eC.Int16:return WebGLRenderingContext.SHORT;case eC.Int8:return WebGLRenderingContext.BYTE;case eC.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case eC.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
8
8
|
//# sourceMappingURL=index.min.js.map
|