@galacean/effects 2.9.1 → 2.9.2

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/alipay.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/alipay");function i(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){return void i(t)}s.done?e(u):Promise.resolve(u).then(r,n)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function s(t){i(o,n,a,s,u,"next",t)}function u(t){i(o,n,a,s,u,"throw",t)}s(void 0)}))}}function n(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):n(t,e)}function a(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 o(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 new 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=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],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;var s=new Uint8Array(16);function u(){if(!t&&!(t=void 0!==e.crypto&&e.crypto.getRandomValues&&e.crypto.getRandomValues.bind(e.crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(s)}for(var h=[],l=0;l<256;++l)h.push((l+256).toString(16).slice(1));var c={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function f(t,e,i){if(c.randomUUID&&!e&&!t)return c.randomUUID();var r=(t=t||{}).random||(t.rng||u)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),h[t[e+0]]+h[t[e+1]]+h[t[e+2]]+h[t[e+3]]+"-"+h[t[e+4]]+h[t[e+5]]+"-"+h[t[e+6]]+h[t[e+7]]+"-"+h[t[e+8]]+h[t[e+9]]+"-"+h[t[e+10]]+h[t[e+11]]+h[t[e+12]]+h[t[e+13]]+h[t[e+14]]+h[t[e+15]]}(r)}function d(t,e){return t.includes(e)||t.push(e),t}function p(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function m(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 v=2*Math.PI,y=Math.PI/180,g=180/Math.PI,x=1e-6;function b(t,e){return Math.abs(t-e)<x||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var T=function(t,e,i){return(1-i)*t+i*e};function E(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,a=Math.min(r,n),o=Math.max(r,n);return Math.min(Math.max(t,a),o)}var _=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):n(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):n(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):n(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):n(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=x,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();_.ONE=new _(1,1),_.ZERO=new _(0,0);var S=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):n(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):n(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):n(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):n(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=x,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new _(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();S.X=new S(1,0,0),S.Y=new S(0,1,0),S.Z=new S(0,0,1),S.ONE=new S(1,1,1),S.ZERO=new S(0,0,0);var C=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):n(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):n(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):n(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):n(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=x,e=this,i=e.x,r=e.y,n=e.z,a=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(a)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new S(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}();C.ONE=new C(1,1,1,1),C.ZERO=new C(0,0,0,0);var w=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):n(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):n(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):n(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):n(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 C(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,a=e.a,o=Math.max(i,r,n),s=Math.min(i,r,n),u=o-s,h=0,l=0;return 0!==o&&(l=u/o),o!=s&&(o==i?(h=(r-n)/u,r<n&&(h+=6)):o==r?h=(n-i)/u+2:o==n&&(h=(i-r)/u+4),h*=60),new t(h,l,o,a)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function A(t,e){var i=[0,0,0,0];if(it(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var a=+r[4];i=[+r[1],+r[2],+r[3],isNaN(a)?255:255*a]}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 n(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function M(t,e,i){if(0===t.length)return[0,0,0,0];var r;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 n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.time<=e&&e<=o.time){r=I(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 P(t){var e=[];return n(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:R(i),color:new w(r,n,a,o)})})):Object.keys(t).forEach((function(i){var r=t[i],n=(new w).setFromArray(A(r));e.push({time:R(i),color:n})})),e=e.sort((function(t,e){return t.time-e.time}))}function I(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 R(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function O(){return"object"==typeof e.window?Math.min(2,e.window.devicePixelRatio||1):1}w.BLACK=new w(0,0,0,1),w.BLUE=new w(0,0,1,1),w.CLEAR=new w(0,0,0,0),w.CYAN=new w(0,1,1,1),w.GRAY=new w(.5,.5,.5,1),w.GREEN=new w(0,1,0,1),w.MAGENTA=new w(1,0,1,1),w.RED=new w(1,0,0,1),w.WHITE=new w(1,1,1,1),w.YELLOW=new w(1,.92,.016,1);var N,L=void 0!==e.window;function F(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function V(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function k(){return/\bOpenHarmony\b/.test(e.navigator.userAgent)}function D(){return V()||k()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function z(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function B(){return"miniprogram"===e.window.__wxjs_environment}function U(t){it(t)&&(t=A(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function G(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=P(t);if(n.length)for(var a=0;a<e;a++){var o=a/127;if(o<=n[0].time)r.set(n[0].color.toArray(),4*a);else if(o>=n[n.length-1].time)r.set(n[n.length-1].color.toArray(),4*a);else for(var s=0;s<n.length-1;s++){var u=n[s],h=n[s+1];if(u.time<=o&&h.time>o){var l=I(u.color.toArray(),h.color.toArray(),(o-u.time)/(h.time-u.time));r.set(l,4*a);break}}}return i}function j(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)W(t,r,e);return t}return H(t,e)}function X(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&W(t,t.length-1,i),t)}function W(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 H(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,a=t[i],o=i,s=r;o<s;){if(2===e){for(;t[s].priority>a.priority&&s>=o;)s--;for(;t[o].priority<=a.priority&&o<s;)o++}else{for(;t[s].priority<a.priority&&s>=o;)s--;for(;t[o].priority>=a.priority&&o<s;)o++}var u;u=[t[s],t[o]],t[o]=u[0],t[s]=u[1]}return n=[t[o],t[i]],t[i]=n[0],t[o]=n[1],H(t,e,i,o-1),H(t,e,s+1,r),t}function Y(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function Z(t){return q(t)||!D()}function q(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(N=exports.OrderType||(exports.OrderType={}))[N.none=1]="none",N[N.ascending=2]="ascending",N[N.descending=3]="descending";var K,Q="[Galacean Effects]";function J(t){return["%c"+Q,"color: #AA0100",""+t]}var $,tt={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(J(t),[i])),null==K||K("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(J(t))),null==K||K("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(J(t))),null==K||K("warn",t,i)},register:function(t){t&&nt(t)&&(K=t)}};function et(){}function it(t){return"string"==typeof t}exports.DestroyOptions=void 0,($=exports.DestroyOptions||(exports.DestroyOptions={}))[$.destroy=0]="destroy",$[$.keep=1]="keep",$[$.force=0]="force";var rt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function nt(t){return"[object Function]"===Object.prototype.toString.call(t)}function at(t){return"[object Object]"===Object.prototype.toString.call(t)}function ot(t){if(null===t||"object"!=typeof t)return!1;if("[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 st(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function ut(t){return 0==(t&t-1)&&0!==t}function ht(t,e){return t+Math.random()*(e-t)}function lt(){throw new Error("Destroyed item cannot be used again.")}function ct(){return f().replace(/-/g,"")}function ft(t,i,r){void 0===i&&(i="base64File"),void 0===r&&(r="");for(var n=t.split(",")[1]||t,a=e.atob(n),o=[],s=0;s<a.length;s+=512){for(var u=a.slice(s,s+512),h=new Array(u.length),l=0;l<u.length;l++)h[l]=u.charCodeAt(l);var c=new Uint8Array(h);o.push(c)}var f=new e.Blob(o,{type:r});return new File([f],i,{type:r})}function dt(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)}))}))}var pt={},mt=[];function vt(t,e){pt[t]&&tt.error("Duplicate registration for plugin "+t+"."),pt[t]=e;var i=new e;i.name=t,mt.push(i),mt.sort((function(t,e){return t.order-e.order}))}var yt=function(){function t(){}return t.getPlugins=function(){return mt},t.initializeComposition=function(t,e){mt.forEach((function(i){return i.onCompositionCreated(t,e)}))},t.destroyComposition=function(t){mt.forEach((function(e){return e.onCompositionDestroy(t)}))},t.onAssetsLoadStart=function(t,e){return r((function(){return o(this,(function(i){return[2,Promise.all(mt.map((function(i){return i.onAssetsLoadStart(t,e)})))]}))}))()},t.onAssetsLoadFinish=function(t,e,i){mt.forEach((function(r){return r.onAssetsLoadFinish(t,e,i)}))},t}(),gt={"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 xt(t){var e=gt[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 bt,Tt,Et,_t,St,Ct,wt,At,Mt,Pt,It,Rt,Ot,Nt,Lt=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return r((function(){return o(this,(function(t){return[2]}))}))()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},t}();function Ft(t,e){return Ft=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ft(t,e)}function Vt(t,e){if("function"!=typeof e&&null!==e)throw new 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&&Ft(t,e)}!function(t){t["1_0"]="1.0",t["1_1"]="1.1",t["1_2"]="1.2",t["1_3"]="1.3",t["1_5"]="1.5",t["1_8"]="1.8",t["2_0"]="2.0",t["2_1"]="2.1",t["2_2"]="2.2",t["2_3"]="2.3",t["2_4"]="2.4",t["3_0"]="3.0",t["3_1"]="3.1",t["3_2"]="3.2",t["3_3"]="3.3",t["3_4"]="3.4",t["3_5"]="3.5",t["3_6"]="3.6",t["3_7"]="3.7",t.LATEST="3.7"}(bt||(bt={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Tt||(Tt={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(Et||(Et={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(_t||(_t={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(St||(St={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(Ct||(Ct={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(wt||(wt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(At||(At={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Mt||(Mt={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox",t.effect="effect",t.shape="shape",t.postProcessVolume="postProcessVolume",t.node="node",t.video="video",t.audio="audio",t.richtext="richtext"}(Pt||(Pt={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(It||(It={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Rt||(Rt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(Ot||(Ot={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Nt||(Nt={}));var kt,Dt,zt,Bt,Ut,Gt,jt,Xt,Wt,Ht,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,ie=1,re=3,ne=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(kt||(kt={})),function(t){t[t.CONSTANT=0]="CONSTANT",t[t.CONSTANT_VEC2=1]="CONSTANT_VEC2",t[t.CONSTANT_VEC3=2]="CONSTANT_VEC3",t[t.CONSTANT_VEC4=3]="CONSTANT_VEC4",t[t.RANDOM=4]="RANDOM",t[t.LINE=5]="LINE",t[t.CURVE=6]="CURVE",t[t.BEZIER_PATH=7]="BEZIER_PATH",t[t.RGBA_COLOR=8]="RGBA_COLOR",t[t.GRADIENT_COLOR=9]="GRADIENT_COLOR",t[t.SHAPE_POINTS=10]="SHAPE_POINTS",t[t.SHAPE_SPLITS=11]="SHAPE_SPLITS",t[t.LINEAR_PATH=12]="LINEAR_PATH",t[t.COLORS=13]="COLORS",t[t.BINARY=20]="BINARY",t[t.BEZIER_CURVE=21]="BEZIER_CURVE",t[t.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",t[t.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",t[t.COLOR_CURVE=24]="COLOR_CURVE",t[t.VECTOR4_CURVE=25]="VECTOR4_CURVE",t[t.VECTOR2_CURVE=26]="VECTOR2_CURVE",t[t.VECTOR3_CURVE=27]="VECTOR3_CURVE"}(Dt||(Dt={})),function(t){t[t.AUTO=0]="AUTO",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.LINE=4]="LINE",t[t.HOLD=5]="HOLD",t[t.LINE_OUT=6]="LINE_OUT"}(zt||(zt={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(Bt||(Bt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ut||(Ut={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(Gt||(Gt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(jt||(jt={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Xt||(Xt={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Wt||(Wt={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ht||(Ht={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Yt||(Yt={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive",t.diffuse="diffuse"}(Zt||(Zt={})),function(t){t[t.visible=0]="visible",t[t.display=1]="display",t[t.clip=2]="clip",t[t.ellipsis=3]="ellipsis"}(qt||(qt={})),function(t){t[t.autoWidth=0]="autoWidth",t[t.autoHeight=1]="autoHeight",t[t.fixed=2]="fixed"}(Kt||(Kt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Qt||(Qt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Jt||(Jt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}($t||($t={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(te||(te={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ee||(ee={}));var ae,oe,se,ue,he,le,ce,fe,de,pe,me,ve,ye,ge,xe={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!function(t){t[t.Solid=0]="Solid",t[t.GradientLinear=1]="GradientLinear",t[t.GradientRadial=2]="GradientRadial",t[t.GradientAngular=3]="GradientAngular",t[t.Texture=4]="Texture"}(ae||(ae={})),function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(oe||(oe={})),function(t){t[t.Custom=0]="Custom",t[t.Rectangle=1]="Rectangle",t[t.Ellipse=2]="Ellipse",t[t.Polygon=3]="Polygon",t[t.Star=4]="Star"}(se||(se={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(ue||(ue={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(he||(he={})),function(t){t.AnimationClipNodeData="AnimationClipNodeData",t.BlendNodeData="BlendNodeData",t.ApplyAdditiveNodeData="ApplyAdditiveNodeData",t.LayerBlendNodeData="LayerBlendNodeData",t.StateMachineNodeData="StateMachineNodeData",t.TransitionNodeData="TransitionNodeData",t.StateNodeData="StateNodeData",t.ConstFloatNodeData="ConstFloatNodeData",t.ConstBoolNodeData="ConstBoolNodeData",t.ControlParameterBoolNodeData="ControlParameterBoolNodeData",t.ControlParameterFloatNodeData="ControlParameterFloatNodeData",t.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",t.NotNodeData="NotNodeData",t.AndNodeData="AndNodeData",t.OrNodeData="OrNodeData",t.EqualNodeData="EqualNodeData",t.GreaterNodeData="GreaterNodeData",t.LessNodeData="LessNodeData"}(le||(le={})),function(t){t.video="video",t.image="image"}(ce||(ce={})),function(t){t.video="video",t.audio="audio"}(fe||(fe={})),function(t){t.L30="hev1.1.0.L30.B0",t.L60="hev1.1.0.L60.B0",t.L63="hev1.1.0.L63.B0",t.L90="hev1.1.0.L90.B0",t.L93="hev1.1.0.L93.B0",t.L120="hev1.1.0.L120.B0",t.L150="hev1.1.0.L150.B0",t.L180="hev1.1.0.L180.B0"}(de||(de={})),function(t){t.VFXItemData="VFXItemData",t.Material="Material",t.Shader="Shader",t.Geometry="Geometry",t.Texture="Texture",t.Image="Image",t.AnimationClip="AnimationClip",t.BinaryAsset="BinaryAsset",t.TrackAsset="TrackAsset",t.TimelineAsset="TimelineAsset",t.ObjectBindingTrack="ObjectBindingTrack",t.TransformTrack="TransformTrack",t.SpriteColorTrack="SpriteColorTrack",t.ActivationTrack="ActivationTrack",t.SubCompositionTrack="SubCompositionTrack",t.FloatPropertyTrack="FloatPropertyTrack",t.ColorPropertyTrack="ColorPropertyTrack",t.Vector2PropertyTrack="Vector2PropertyTrack",t.Vector3PropertyTrack="Vector3PropertyTrack",t.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",t.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",t.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",t.MeshComponent="MeshComponent",t.SkyboxComponent="SkyboxComponent",t.LightComponent="LightComponent",t.CameraComponent="CameraComponent",t.ModelPluginComponent="ModelPluginComponent",t.TreeComponent="TreeComponent",t.AnimationComponent="AnimationComponent",t.SpineComponent="SpineComponent",t.VideoComponent="VideoComponent",t.AudioComponent="AudioComponent",t.RichTextComponent="RichTextComponent",t.OrientationComponent="OrientationComponent",t.ShapeComponent="ShapeComponent",t.SpriteComponent="SpriteComponent",t.ParticleSystem="ParticleSystem",t.InteractComponent="InteractComponent",t.CameraController="CameraController",t.PostProcessVolume="PostProcessVolume",t.EffectComponent="EffectComponent",t.TextComponent="TextComponent",t.AnimationGraphAsset="AnimationGraphAsset",t.CompositionComponent="CompositionComponent",t.FFDComponent="FFDComponent",t.FrameComponent="FrameComponent",t.Animator="Animator",t.TimelineClip="TimelineClip"}(pe||(pe={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(me||(me={})),function(t){t[t.Float16=0]="Float16",t[t.Float32=1]="Float32",t[t.Int8=2]="Int8",t[t.Int16=3]="Int16",t[t.Int32=4]="Int32",t[t.UInt8=5]="UInt8",t[t.UInt16=6]="UInt16",t[t.UInt32=7]="UInt32"}(ve||(ve={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(ye||(ye={})),function(t){t.Position="POSITION",t.Uv="TEXCOORD0",t.Uv2="TEXCOORD1",t.Normal="NORMAL",t.Tangent="TANGENT",t.Color="COLOR",t.Joints="JOINTS",t.Weights="WEIGHTS",t.PositionBS0="POSITION_BS0",t.PositionBS1="POSITION_BS1",t.PositionBS2="POSITION_BS2",t.PositionBS3="POSITION_BS3",t.PositionBS4="POSITION_BS4",t.PositionBS5="POSITION_BS5",t.PositionBS6="POSITION_BS6",t.PositionBS7="POSITION_BS7",t.NormalBS0="NORMAL_BS0",t.NormalBS1="NORMAL_BS1",t.NormalBS2="NORMAL_BS2",t.NormalBS3="NORMAL_BS3",t.TangentBS0="TANGENT_BS0",t.TangentBS1="TANGENT_BS1",t.TangentBS2="TANGENT_BS2",t.TangentBS3="TANGENT_BS3"}(ge||(ge={}));var be=bt.LATEST,Te=Object.freeze({__proto__:null,LATEST_VERSION:be,get RenderLevel(){return Tt},get BlendingMode(){return Et},get SideMode(){return _t},get ObscuredMode(){return St},get ParticleEmitterShapeType(){return Ct},get PluginType(){return wt},get InteractType(){return At},get InteractBehavior(){return Mt},get ItemType(){return Pt},get RenderMode(){return It},get ParticleOrigin(){return Rt},get RenderType(){return Ot},get RenderFace(){return Nt},get CameraClipMode(){return kt},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:ie,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:re,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:ne,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return Dt},get BezierKeyframeType(){return zt},get JSONSceneVersion(){return bt},get EndBehavior(){return Bt},get ParticleInteractionBehavior(){return Ut},get ShapeArcMode(){return Gt},get LightType(){return jt},get ModelBoundingType(){return Xt},get CameraType(){return Wt},get MaterialType(){return Ht},get MaterialBlending(){return Yt},get RenderMode3D(){return Zt},get TextOverflow(){return qt},get TextSizeMode(){return Kt},get TextBaseline(){return Qt},get TextAlignment(){return Jt},get TextVerticalAlign(){return $t},get TextWeight(){return te},get FontStyle(){return ee},BuiltinObjectGUID:xe,get FillType(){return ae},get TexturePaintScaleMode(){return oe},get ShapePrimitiveType(){return se},get LineCap(){return ue},get LineJoin(){return he},get NodeDataType(){return le},get BackgroundType(){return ce},get MultimediaType(){return fe},get HevcVideoCodec(){return de},get DataType(){return pe},get GeometryType(){return me},get VertexFormatType(){return ve},get IndexFormatType(){return ye},get VertexBufferSemantic(){return ge}});function Ee(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function _e(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 Ee(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ee(t,e):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 new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Se=new Map,Ce=new Map,we={};function Ae(t){return we[t]}function Me(t){return function(e,i){we[t]&&console.warn("Class "+t+" is already registered."),we[t]=e}}function Pe(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;Se.get(e)||Se.set(e,{});return Se.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function Ie(t){var e=t.constructor;if(Ce.get(e))return Ce.get(e);var i={};Ce.set(e,i);for(var r=t,n=e;n;){var a=Se.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}var Re=function(){function t(t){this.engine=t,this.guid=ct(),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 n(e,t)&&"guid"in e},t}(),Oe=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),Ne={};function Le(t){return function(e,i){Ne[t]&&console.warn("NodeData Class "+t+" is already registered."),Ne[t]=e}}function Fe(t){return Ne[t]}var Ve,ke=-1,De=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 new 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 new Error("Node still initialized!");this.lastUpdateID=-1},t}(),ze=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}(),Be=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}Vt(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}(De),Ue=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.setValue=function(t){},e}(De),Ge=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Ue),je=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Ue);exports.AnimationGraphAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new Oe,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=ke,e}return Vt(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,a=0;a<n;a++)this.parameterLookupMap.set(i.controlParameterIDs[a],a);this.nodeDatas=[];for(var o=0;o<r.length;o++)this.nodeDatas[o]=e.createNodeData(r[o].type),this.nodeDatas[o].load(r[o]);this.graphDataSet=new Oe,this.graphDataSet.resources=[];for(var s,u=_e(i.graphDataSet.resources);!(s=u()).done;){var h=s.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=Fe(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(Re),exports.AnimationGraphAsset=a([Me("AnimationGraphAsset")],exports.AnimationGraphAsset),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(Ve||(Ve={}));var Xe=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}(),We=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 He(){return He=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},He.apply(this,arguments)}exports.AnimationClipNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ze,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=He({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(ze),exports.AnimationClipNodeData=a([Le(le.AnimationClipNodeData)],exports.AnimationClipNodeData);var Ye,Ze=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}Vt(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=E(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=_e(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 qe(e.skeleton,this.animation))},e}(Be);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(Ye||(Ye={}));var qe=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=_e(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,o=_e(e.scaleCurves);!(a=o()).done;){var s=a.value;this.addTransformCurveInfo(s,1)}for(var u,h=_e(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=_e(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=_e(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=_e(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}for(var b,T=_e(this.animationClip.events);!(b=T()).done;){var E=b.value;this.events.push({data:E,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=E(t,0,this.animationClip.duration),n=_e(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=_e(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=_e(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}(),Ke=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.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(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(E(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var 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,r=i.x,n=i.y,a=i.z,o=i.w,s=o*t.w+r*t.x+n*t.y+a*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=o,this.x=r,this.y=n,this.z=a,this;var u=1-s*s;if(u<=Number.EPSILON){var h=1-e;return this.w=h*o+e*this.w,this.x=h*r+e*this.x,this.y=h*n+e*this.y,this.z=h*a+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,s),f=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this.w=o*f+this.w*d,this.x=r*f+this.x*d,this.y=n*f+this.y*d,this.z=a*f+this.z*d,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,a=i.z,o=i.w,s=t.x,u=t.y,h=t.z,l=o*s+n*h-a*u,c=o*u+a*s-r*h,f=o*h+r*u-n*s,d=-r*s-n*u-a*h,p=null!=e?e:t;return p.x=l*o+d*-r+c*-a-f*-n,p.y=c*o+d*-n+f*-r-l*-a,p.z=f*o+d*-a+l*-n-c*-r,p},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(S.ZERO,this,S.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}();Ke.tempVec0=new S;var Qe=new Ke,Je=function(){},$e=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Je),ti=function(t){function e(){return t.apply(this,arguments)}Vt(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=Qe.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}(Je),ei=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 E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var S=0;S<t.colorPropertyValues.length;S++){var C=t.colorPropertyValues[S],w=e.colorPropertyValues[S],A=r.colorPropertyValues[S];n.blendColor(C,w,i,A)}},t}();ei.normalBlendFunction=new $e,ei.additiveBlendFunction=new ti;var ii=function(){function t(t){this.position=new S,this.rotation=new Ke,this.scale=new S,this.euler=new S,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}(),ri=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=_e(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new ii).copyFrom(r))}for(var n,a=_e(t.defaultFloatPropertyValues);!(n=a()).done;){var o=n.value;this.floatPropertyValues.push(o)}for(var s,u=_e(t.defaultColorPropertyValues);!(s=u()).done;){var h=s.value;this.colorPropertyValues.push((new w).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}(),ni=function(t){this.pose=new ri(t)};exports.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ai,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}(ze),exports.ApplyAdditiveNodeData=a([Le(le.ApplyAdditiveNodeData)],exports.ApplyAdditiveNodeData);var ai=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}Vt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new ni(e.skeleton),this.additiveNodeResult=new ni(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){ei.additiveBlend(t,e,i,r)},e}(Be);exports.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(oi,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}(ze),exports.BlendNodeData=a([Le(le.BlendNodeData)],exports.BlendNodeData);var oi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}Vt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new ni(e.skeleton),this.source1Result=new ni(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){ei.localBlend(t,e,i,r)},e}(Be);exports.AndNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(si,t),r=_e(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}(ze),exports.AndNodeData=a([Le(le.AndNodeData)],exports.AndNodeData);var si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}Vt(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=_e(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=_e(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=_e(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(je);exports.OrNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(ui,t),r=_e(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}(ze),exports.OrNodeData=a([Le(le.OrNodeData)],exports.OrNodeData);var ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}Vt(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=_e(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=_e(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=_e(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(je);exports.NotNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(hi,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(ze),exports.NotNodeData=a([Le(le.NotNodeData)],exports.NotNodeData);var hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}Vt(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}(je);exports.ConstFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(li,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ConstFloatNodeData=a([Le(le.ConstFloatNodeData)],exports.ConstFloatNodeData);var li=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return Vt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Ge);exports.ConstBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ci,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ConstBoolNodeData=a([Le(le.ConstBoolNodeData)],exports.ConstBoolNodeData);var ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return Vt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(je);exports.ControlParameterFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(fi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ControlParameterFloatNodeData=a([Le(le.ControlParameterFloatNodeData)],exports.ControlParameterFloatNodeData);var fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Vt(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}(Ge);exports.ControlParameterBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(di,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ControlParameterBoolNodeData=a([Le(le.ControlParameterBoolNodeData)],exports.ControlParameterBoolNodeData);var di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Vt(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}(je);exports.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(pi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(ze),exports.ControlParameterTriggerNodeData=a([Le(le.ControlParameterTriggerNodeData)],exports.ControlParameterTriggerNodeData);var pi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Vt(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}(je);exports.LayerBlendNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=ke,e.layerDatas=[],e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(mi,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=_e(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){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:ke,e.layerDatas)for(var r,n=_e(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(He({inputNodeIndex:ke,weightValueNodeIndex:ke},a))}},e}(ze),exports.LayerBlendNodeData=a([Le(le.LayerBlendNodeData)],exports.LayerBlendNodeData);var mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}Vt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new ni(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=_e(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){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=_e(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):e},i.updateLayers=function(t,e){for(var i,r=_e(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);ei.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(Be);exports.EqualNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ke,e.comparandValueNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(yi,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}(ze),exports.EqualNodeData=a([Le(le.EqualNodeData)],exports.EqualNodeData);var vi,yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}Vt(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}(je),gi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ke,e.comparandValueNodeIndex=ke,e}return Vt(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(ze);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(vi||(vi={}));var xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}Vt(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}(je);exports.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(xi,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(gi),exports.GreaterNodeData=a([Le(le.GreaterNodeData)],exports.GreaterNodeData),exports.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(xi,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(gi),exports.LessNodeData=a([Le(le.LessNodeData)],exports.LessNodeData),exports.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Ti,t),r=_e(this.stateDatas);!(e=r()).done;){var n=e.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(a);for(var o,s=_e(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}(ze),exports.StateMachineNodeData=a([Le(le.StateMachineNodeData)],exports.StateMachineNodeData);var bi,Ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=ke,e}Vt(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===Ve.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=ke,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(o.targetStateIndex===ke)throw new 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(r!==ke){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=ke,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=_e(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=_e(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(Be);exports.TransitionState=void 0,(bi=exports.TransitionState||(exports.TransitionState={}))[bi.None=0]="None",bi[bi.TransitioningIn=1]="TransitioningIn",bi[bi.TransitioningOut=2]="TransitioningOut",exports.StateNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(_i,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}(ze),exports.StateNodeData=a([Le(le.StateNodeData)],exports.StateNodeData);var Ei,_i=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}Vt(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}(Be);exports.SourceType=void 0,(Ei=exports.SourceType||(exports.SourceType={}))[Ei.State=0]="State",Ei[Ei.Transition=1]="Transition",Ei[Ei.CachedPose=2]="CachedPose",exports.TransitionNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ci,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}(ze),exports.TransitionNodeData=a([Le(le.TransitionNodeData)],exports.TransitionNodeData);var Si,Ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}Vt(e,t);var i=e.prototype;return i.evaluate=function(t,e){Y(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=E(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=Ve.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),a=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,a),this.blendedDuration=T(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var o=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+o)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),a},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.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)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new ni(e.skeleton),this.targetNodeResult=new ni(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(exports.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(exports.TransitionState.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=T(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=E(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;ei.localBlend(t.pose,e.pose,r,i.pose)},e}(Be);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(Si||(Si={}));var wi=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=_e(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,o=_e(e.rotation);!(a=o()).done;){var s=a.value;this.addReferenceTransform(s)}for(var u,h=_e(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=_e(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 ii(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var a=this.findTarget(t);if(a){var o;(o="VFXItem"===e?a:a.getComponent(Ae(e)))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=o,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:o,propertyPath:i,directTarget:h,propertyName:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push((new w).copyFrom(h[u])),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=_e(i);!(e=n()).done;){var a=e.value,o=r.find(a);if(!o)return null;r=o}return r},t}(),Ai=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new Xe;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=_e(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var o,s=_e(a.positionCurves);!(o=s()).done;){var u=o.value;r.position.push(u.path)}for(var h,l=_e(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=_e(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=_e(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=_e(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=_e(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new wi(e,r),this.result=new ni(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var S=new We;S.nodes=this.nodes,S.nodeDatas=t.nodeDatas,S.dataSet=t.graphDataSet;for(var C=0;C<t.nodeDatas.length;C++)S.nodes[C]||t.nodeDatas[C].instantiate(S);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];n(i,pi)&&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=_e(this.nodes);!(e=r()).done;){var a=e.value;n(a,Ti)&&a.getNodeData().machineName===t&&(i=a)}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."),ke)},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);i!==ke&&this.nodes[i].setValue(e)},t}();function Mi(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 Pi(t,e,i){return e&&Mi(t.prototype,e),i&&Mi(t,i),t}var Ii=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}Vt(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.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&&p(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},Pi(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(Re);a([Pe()],Ii.prototype,"item",void 0),a([Pe()],Ii.prototype,"_enabled",void 0);var Ri,Oi,Ni=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Ii);function Li(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 new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}exports.Animator=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}Vt(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 Ai(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 a=e.pose.parentSpaceTransforms[r].position,o=e.pose.parentSpaceTransforms[r].rotation,s=e.pose.parentSpaceTransforms[r].scale,u=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(a.x,a.y,a.z),i[r].setScale(s.x,s.y,s.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(u.x,u.y,u.z):i[r].setQuaternion(o.x,o.y,o.z,o.w)}for(var h=this.graphInstance.skeleton.floatAnimatedObjects,l=0;l<h.length;l++){var c=h[l],f=c.propertyName;c.directTarget[f]=e.pose.floatPropertyValues[l],n(c.target,Ii)&&c.target.onApplyAnimationProperties()}for(var d=this.graphInstance.skeleton.colorAnimatedObjects,p=0;p<d.length;p++){var m=d[p],v=m.propertyName;m.directTarget[v]=e.pose.colorPropertyValues[p],n(m.target,Ii)&&m.target.onApplyAnimationProperties()}for(var y,g=_e(this.graphInstance.activeEvents);!(y=g()).done;){var x=y.value;x.data.event.onEvent(this.item,x)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(Ii),exports.Animator=a([Me("Animator")],exports.Animator),exports.ShaderType=void 0,(Ri=exports.ShaderType||(exports.ShaderType={}))[Ri.vertex=0]="vertex",Ri[Ri.fragment=1]="fragment",exports.MaskMode=void 0,(Oi=exports.MaskMode||(exports.MaskMode={}))[Oi.NONE=0]="NONE",Oi[Oi.MASK=1]="MASK",Oi[Oi.OBSCURED=2]="OBSCURED",Oi[Oi.REVERSE_OBSCURED=3]="REVERSE_OBSCURED";var Fi,Vi,ki=[],Di={},zi="WebGL Constants not in global, please check your environment";function Bi(){"function"==typeof e.WebGL2RenderingContext?Gi(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(Gi(e.WebGLRenderingContext),Gi(e.WebGLRenderingContext.prototype)):L?ki.push(F()?"iOS16 lockdown mode, WebGL Constants not in global":zi):ki.push(zi),ki.length||"HALF_FLOAT"in Di||(Di.HALF_FLOAT=5131)}function Ui(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Gi(t){for(var e in t)/^[A-Z_]/.test(e)&&(Di[e]=t[e])}function ji(t){switch(t){case ve.Float32:return e.WebGLRenderingContext.FLOAT;case ve.Int16:return e.WebGLRenderingContext.SHORT;case ve.Int8:return e.WebGLRenderingContext.BYTE;case ve.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case ve.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}function Xi(t){switch(t){case Et.ALPHA:case Et.ADD:case Et.SUBTRACTION:case Et.STRONG_LIGHT:case Et.WEAK_LIGHT:return 1;case Et.SUPERPOSITION:return 2;case Et.BRIGHTNESS:return 3;case Et.MULTIPLY:return 0;default:return 1}}function Wi(t,e){switch(e){case void 0:case Et.ALPHA:t.blendFunction=[Di.ONE,Di.ONE_MINUS_SRC_ALPHA,Di.ONE,Di.ONE_MINUS_SRC_ALPHA];break;case Et.ADD:t.blendFunction=[Di.ONE,Di.ONE,Di.ONE,Di.ONE];break;case Et.SUBTRACTION:t.blendFunction=[Di.ONE,Di.ONE,Di.ZERO,Di.ONE],t.blendEquation=[Di.FUNC_REVERSE_SUBTRACT,Di.FUNC_REVERSE_SUBTRACT];break;case Et.SUPERPOSITION:t.blendFunction=[Di.ONE,Di.ONE,Di.ONE,Di.ONE];break;case Et.MULTIPLY:t.blendFunction=[Di.DST_COLOR,Di.ONE_MINUS_SRC_ALPHA,Di.DST_COLOR,Di.ONE_MINUS_SRC_ALPHA];break;case Et.BRIGHTNESS:t.blendFunction=[Di.ONE,Di.ONE_MINUS_SRC_ALPHA,Di.ONE,Di.ONE_MINUS_SRC_ALPHA];break;case Et.STRONG_LIGHT:t.blendFunction=[Di.DST_COLOR,Di.DST_ALPHA,Di.ZERO,Di.ONE];break;case Et.WEAK_LIGHT:t.blendFunction=[Di.DST_COLOR,Di.ZERO,Di.ZERO,Di.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Hi(t,e){e===_t.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Di.CW,t.cullFace=e===_t.BACK?Di.BACK:Di.FRONT)}ki.length||Bi(),exports.TextureLoadAction=void 0,(Fi=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Fi.whatever=0]="whatever",Fi[Fi.clear=2]="clear",exports.TextureSourceType=void 0,(Vi=exports.TextureSourceType||(exports.TextureSourceType={}))[Vi.none=0]="none",Vi[Vi.data=1]="data",Vi[Vi.image=2]="image",Vi[Vi.compressed=3]="compressed",Vi[Vi.video=4]="video",Vi[Vi.canvas=5]="canvas",Vi[Vi.framebuffer=6]="framebuffer",Vi[Vi.mipmaps=7]="mipmaps";var Yi=function(){function t(){this.callbacks={}}var i=t.prototype;return i.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},i.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},i.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},i.downloadText=function(t,e,i){this.download(t,"text",e,i)},i.download=function(i,r,n,a){var o=this;if(void 0===r&&(r="json"),!this.start(i,n,a)){var s=new e.XMLHttpRequest,u=function(){o.finish(i,s.status,s.response)};s.responseType=r,s.addEventListener("load",(function(){200==s.status||0==s.status&&t.trustXHRStatusZero?o.finish(i,200,s.response):u()})),s.addEventListener("error",u),s.open("GET",i,!0),s.send()}},i.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},i.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}();Yi.trustXHRStatusZero=!1;var Zi=!1,qi=!1;function Ki(t,e){return Qi.apply(this,arguments)}function Qi(){return(Qi=r((function(t,e){return o(this,(function(i){switch(i.label){case 0:return!Zi&&e?[3,2]:[4,tr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,tr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Zi=!0,[4,tr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Ji(t,e){return $i.apply(this,arguments)}function $i(){return($i=r((function(t,e){return o(this,(function(i){switch(i.label){case 0:return!qi&&e?[3,2]:[4,tr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,tr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),qi=!0,[4,tr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function tr(t){return er.apply(this,arguments)}function er(){return(er=r((function(t){var i,r;return o(this,(function(a){if(i="",n(t,e.HTMLImageElement)){if(t.complete)return[2,t];i=t.src}else n(t,e.Blob)?(i=e.URL.createObjectURL(t),r=!0):"string"==typeof t&&(i=t);if(!i)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var a=new e.Image;/^data:/.test(i)||(a.crossOrigin="*"),a.onload=function(){return a.onload=null,r&&e.URL.revokeObjectURL(i),t(a)},a.onerror=function(t){return a.onerror=null,r&&e.URL.revokeObjectURL(i),n("Load image fail: "+i+", reason: "+JSON.stringify(t))},a.src=i}))]}))}))).apply(this,arguments)}function ir(t){return rr.apply(this,arguments)}function rr(){return(rr=r((function(t){return o(this,(function(e){return[2,new Promise((function(e,i){(new Yi).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function nr(){return(nr=r((function(t){return o(this,(function(e){return[2,new Promise((function(e,i){(new Yi).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function ar(t){return or.apply(this,arguments)}function or(){return(or=r((function(t){var i;return o(this,(function(r){return i=e.document.createElement("video"),"string"==typeof t?i.src=t:i.srcObject=t,i.crossOrigin="anonymous",i.muted=!0,i.autoplay=!1,V()&&i.setAttribute("renderer","standard"),i.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var r=!1,n=function(){r||(r=!0,o(),t(i))},a=function(){r||(r=!0,o(),e("Load video fail."))},o=function(){i.removeEventListener("loadeddata",n),i.removeEventListener("canplay",n),i.removeEventListener("error",a)};i.addEventListener("loadeddata",n),i.addEventListener("canplay",n),i.addEventListener("error",a),i.play().catch((function(t){console.warn("Autoplay blocked:",t)}))}))]}))}))).apply(this,arguments)}function sr(t,e){return ur.apply(this,arguments)}function ur(){return(ur=r((function(t,e){return o(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:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function hr(t,e,i){return lr.apply(this,arguments)}function lr(){return(lr=r((function(t,e,i,r){var n,a,s,u,h,l,c,f,d;return o(this,(function(o){switch(o.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,a=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:cr(t,e)})))})),[4,Promise.all(s)]);case 1:return u=o.sent(),[2,He({keepImageSource:!1},t,{mipmaps:u,sourceFrom:{target:a,type:exports.TextureSourceType.mipmaps}})];case 2:return h=t.mipmaps,l=t.target,c=h.map((function(t){return cr(t,e)})),[4,Promise.all(c)];case 3:return f=o.sent(),d=r[h[0][1][0]].url,[2,He({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:d,type:exports.TextureSourceType.mipmaps,mipmaps:h.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function cr(t,e){return fr.apply(this,arguments)}function fr(){return fr=r((function(t,i){var r,n,a,s,u;return o(this,(function(o){if(r=t[1],n=r[0],a=r[1],s=r[2],!(u=i[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,tr(new e.Blob([new Uint8Array(u,a,s)]))]}))})),fr.apply(this,arguments)}var dr=1,pr=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+dr++,i}Vt(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Di.TEXTURE_2D:e,r=t.format,n=void 0===r?Di.RGBA:r;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),He({minFilter:Di.NEAREST,magFilter:Di.NEAREST,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE,target:i,format:Di.RGBA,internalFormat:n,type:Di.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,n){return r((function(){var r,a;return o(this,(function(o){switch(o.label){case 0:return[4,tr(t)];case 1:return r=o.sent(),(a=e.create(i,He({sourceType:exports.TextureSourceType.image,image:r,target:Di.TEXTURE_2D,id:ct(),flipY:!0},n))).initialize(),[2,a]}}))}))()},e.fromVideo=function(t,i,n){return r((function(){var r,a;return o(this,(function(o){switch(o.label){case 0:return[4,ar(t)];case 1:return r=o.sent(),(a=e.create(i,He({sourceType:exports.TextureSourceType.video,video:r,id:ct(),flipY:!0},n))).initialize(),[2,a]}}))}))()},Pi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Re);function mr(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?Di.RGBA:3===o?Di.RGB:2===o?Di.LUMINANCE_ALPHA:Di.LUMINANCE,pr.createWithData(t,{data:e,width:i,height:r},{type:Di.HALF_FLOAT,format:n,internalFormat:a,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE})}var vr={type:Di.UNSIGNED_BYTE,format:Di.RGBA,internalFormat:Di.RGBA,wrapS:Di.MIRRORED_REPEAT,wrapT:Di.MIRRORED_REPEAT,minFilter:Di.NEAREST,magFilter:Di.NEAREST};function yr(t){return pr.create(t,He({id:xe.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},vr))}function gr(t){return pr.create(t,He({id:xe.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},vr))}var xr,br=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){this.loaders.has(t)?console.warn('TextureLoader for type "'+t+'" is already registered, skipping.'):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}()),Tr=function(){function t(){this.reloadPending={}}var i=t.prototype;return i.reload=function(t){var e=this;return r((function(){var i,r;return o(this,(function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},i.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var i=t.target,r=t.map,n=t.url;return i===Di.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:it(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var a=t.bin,o=t.mipmaps,s=t.target,u=t.maps,h=t.urls;return a?o.length>0:s===Di.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return it(t)&&t.length>0}))}}return!1},i.loadSource=function(t,e){var i=this;return r((function(){var r,n,a,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,S,C;return o(this,(function(o){switch(o.label){case 0:return r=t.type,n=t.target,a=t.map,s=t.url,u=t.bin,h=t.mipmaps,l=t.urls,c=t.maps,n!==Di.TEXTURE_CUBE_MAP||r===exports.TextureSourceType.mipmaps?[3,2]:[4,i.loadCubeMap(a)];case 1:return f=o.sent(),[2,He({},e,{cube:f,target:Di.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:He({},a),target:Di.TEXTURE_CUBE_MAP}})];case 2:return r!==exports.TextureSourceType.image?[3,4]:[4,tr(s)];case 3:return d=o.sent(),[2,He({},e,{image:d,sourceType:exports.TextureSourceType.image,sourceFrom:{type:r,url:s,target:Di.TEXTURE_2D}})];case 4:return r!==exports.TextureSourceType.video?[3,6]:[4,ar(s)];case 5:return p=o.sent(),[2,He({},e,{video:p,sourceType:exports.TextureSourceType.video})];case 6:return r!==exports.TextureSourceType.compressed?[3,14]:[4,ir(s)];case 7:if(m=o.sent(),!(v=br.getLoader("ktx2")))return[3,12];o.label=8;case 8:return o.trys.push([8,10,,11]),[4,v.loadFromBuffer(m)];case 9:return(y=o.sent()).sourceType===exports.TextureSourceType.compressed?[2,He({sourceType:y.sourceType,type:y.type,target:y.target,internalFormat:y.internalFormat,format:y.format,mipmaps:y.mipmaps,minFilter:Di.LINEAR,magFilter:Di.LINEAR,sourceFrom:t},e)]:[3,11];case 10:throw g=o.sent(),new Error("Failed to parse KTX2 from "+(null!=(x=null==t?void 0:t.url)?x:"buffer")+": "+(g.message||g));case 11:return[3,13];case 12:throw new Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:return r!==exports.TextureSourceType.mipmaps?[3,23]:u?[4,ir(u)]:[3,19];case 15:return b=o.sent(),T=null!=n?n:Di.TEXTURE_2D,E=T===Di.TEXTURE_2D?h.slice():h.map((function(t){return t.slice()})),n!==Di.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(h.map((function(t){return i.loadMipmapImages(t,b)})))];case 16:return _=o.sent(),[3,18];case 17:_=i.loadMipmapImages(h,b),o.label=18;case 18:return[2,He({},e,{mipmaps:_,target:T,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:E,target:T,type:exports.TextureSourceType.mipmaps}})];case 19:return n!==Di.TEXTURE_2D&&n?[3,21]:[4,Promise.all(l.map((function(t){return tr(t)})))];case 20:return S=o.sent(),[2,He({},e,{mipmaps:S,target:Di.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,urls:l.slice(),target:Di.TEXTURE_2D}})];case 21:return n!==Di.TEXTURE_CUBE_MAP?[3,23]:[4,Promise.all(c.map((function(t){return i.loadCubeMap(t)})))];case 22:return C=o.sent(),[2,He({},e,{mipmaps:C,target:Di.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,maps:c.map((function(t){return He({},t)})),target:Di.TEXTURE_CUBE_MAP}})];case 23:throw new Error("Invalid resource type: "+r+".")}}))}))()},i.loadMipmapImages=function(t,i){return r((function(){return o(this,(function(r){return[2,Promise.all(t.map((function(t){return tr(new e.Blob([new Uint8Array(i,t[0],t[1])]))})))]}))}))()},i.loadCubeMap=function(t){return r((function(){return o(this,(function(e){return[2,Promise.all(t.map((function(t){return tr(t)})))]}))}))()},t}();function Er(){return xr||(xr=new Tr),xr}var _r=function(){function t(t){this.destroyed=!1;var e=t.name,i=void 0===e?"defaultDataBlock":e;this.name=i}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 Sr(t){return"object"==typeof t&&t&&void 0===t.length&&n(t,pr)}var Cr,wr=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(S.ZERO,t,S.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},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],E=r[4],_=r[8],S=r[12],C=r[1],w=r[5],A=r[9],M=r[13],P=r[2],I=r[6],R=r[10],O=r[14],N=r[3],L=r[7],F=r[11],V=r[15];return n[0]=a*T+o*C+s*P+u*N,n[4]=a*E+o*w+s*I+u*L,n[8]=a*_+o*A+s*R+u*F,n[12]=a*S+o*M+s*O+u*V,n[1]=h*T+l*C+c*P+f*N,n[5]=h*E+l*w+c*I+f*L,n[9]=h*_+l*A+c*R+f*F,n[13]=h*S+l*M+c*O+f*V,n[2]=d*T+p*C+m*P+v*N,n[6]=d*E+p*w+m*I+v*L,n[10]=d*_+p*A+m*R+v*F,n[14]=d*S+p*M+m*O+v*V,n[3]=y*T+g*C+x*P+b*N,n[7]=y*E+g*w+x*I+b*L,n[11]=y*_+g*A+x*R+b*F,n[15]=y*S+g*M+x*O+b*V,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 E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=S.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,E=u*d,_=u*p,C=i.x,w=i.y,A=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*w,n[5]=(1-(m+b))*w,n[6]=(x+T)*w,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,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,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();this.determinant()<0&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];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),r.x=o,r.y=s,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new S,e=new Ke,i=new S;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(!b(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}();wr.IDENTITY=new wr(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),wr.ZERO=new wr(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),wr.tempVec0=new S,wr.tempVec1=new S,wr.tempVec2=new S,wr.tempMat0=new wr,function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(Cr||(Cr={}));var Ar=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 Cr.XYZ:this.y=Math.asin(E(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case Cr.YXZ:this.x=Math.asin(-E(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case Cr.ZXY:this.x=Math.asin(E(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case Cr.ZYX:this.y=Math.asin(-E(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case Cr.YZX:this.z=Math.asin(E(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case Cr.XZY:this.z=Math.asin(-E(n,-1,1)),Math.abs(n)<.9999999?(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*=g,this.y*=g,this.z*=g,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):(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):(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 Ke;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,i=e.x,r=e.y,n=e.z,a=e.order,o=Math.cos(i*y*.5),s=Math.cos(r*y*.5),u=Math.cos(n*y*.5),h=Math.sin(i*y*.5),l=Math.sin(r*y*.5),c=Math.sin(n*y*.5);switch(a){case Cr.XYZ:t.set(h*s*u+o*l*c,o*l*u-h*s*c,o*s*c+h*l*u,o*s*u-h*l*c);break;case Cr.YXZ:t.set(h*s*u+o*l*c,o*l*u-h*s*c,o*s*c-h*l*u,o*s*u+h*l*c);break;case Cr.ZXY:t.set(h*s*u-o*l*c,o*l*u+h*s*c,o*s*c+h*l*u,o*s*u-h*l*c);break;case Cr.ZYX:t.set(h*s*u-o*l*c,o*l*u+h*s*c,o*s*c-h*l*u,o*s*u+h*l*c);break;case Cr.YZX:t.set(h*s*u+o*l*c,o*l*u+h*s*c,o*s*c-h*l*u,o*s*u-h*l*c);break;case Cr.XZY:t.set(h*s*u-o*l*c,o*l*u-h*s*c,o*s*c+h*l*u,o*s*u+h*l*c);break;default:console.error("unknown euler order: "+a)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,a=i.z,o=i.order,s=Math.cos(r*y),u=Math.sin(r*y),h=Math.cos(n*y),l=Math.sin(n*y),c=Math.cos(a*y),f=Math.sin(a*y);if(o===Cr.XYZ){var d=s*c,p=s*f,m=u*c,v=u*f;e[0]=h*c,e[4]=-h*f,e[8]=l,e[1]=p+m*l,e[5]=d-v*l,e[9]=-u*h,e[2]=v-d*l,e[6]=m+p*l,e[10]=s*h}else if(o===Cr.YXZ){var g=h*c,x=h*f,b=l*c,T=l*f;e[0]=g+T*u,e[4]=b*u-x,e[8]=s*l,e[1]=s*f,e[5]=s*c,e[9]=-u,e[2]=x*u-b,e[6]=T+g*u,e[10]=s*h}else if(o===Cr.ZXY){var E=h*c,_=h*f,S=l*c,C=l*f;e[0]=E-C*u,e[4]=-s*f,e[8]=S+_*u,e[1]=_+S*u,e[5]=s*c,e[9]=C-E*u,e[2]=-s*l,e[6]=u,e[10]=s*h}else if(o===Cr.ZYX){var w=s*c,A=s*f,M=u*c,P=u*f;e[0]=h*c,e[4]=M*l-A,e[8]=w*l+P,e[1]=h*f,e[5]=P*l+w,e[9]=A*l-M,e[2]=-l,e[6]=u*h,e[10]=s*h}else if(o===Cr.YZX){var I=s*h,R=s*l,O=u*h,N=u*l;e[0]=h*c,e[4]=N-I*f,e[8]=O*f+R,e[1]=f,e[5]=s*c,e[9]=-u*c,e[2]=-l*c,e[6]=R*f+O,e[10]=I-N*f}else if(o===Cr.XZY){var L=s*h,F=s*l,V=u*h,k=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=L*f+k,e[5]=s*c,e[9]=F*f-V,e[2]=V*f-F,e[6]=u*c,e[10]=k*f+L}else console.error("toMatrix4: Invalid order "+o);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromArray(e,i,r)},t}();Ar.DEFAULT_ORDER=Cr.ZYX,Ar.tempQuat0=new Ke,Ar.tempMat0=new wr;var Mr=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){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},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],E=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],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(!b(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}(),Pr=function(){function t(t,e){void 0===t&&(t=S.ZERO),void 0===e&&(e=S.X),this.origin=new S,this.direction=new S,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 S;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,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,E=b.y,_=b.z,S=1/d,C=1/p,w=1/m;if(S>=0?(i=(y-h)*S,r=(T-h)*S):(i=(T-h)*S,r=(y-h)*S),C>=0?(n=(g-l)*C,a=(E-l)*C):(n=(E-l)*C,a=(g-l)*C),!(i>a||n>r||((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),w>=0?(o=(x-c)*w,s=(_-c)*w):(o=(_-c)*w,s=(x-c)*w),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 S).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),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}();Pr.tempVec0=new S,Pr.tempVec1=new S,Pr.tempVec2=new S,Pr.tempVec3=new S;var Ir,Rr,Or=function(){function t(t,e){void 0===t&&(t=new S(1/0,1/0,1/0)),void 0===e&&(e=new S(-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 S),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 S),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 S),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new S;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new S),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 S),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 S),this.isEmpty())return[];var i=[];return i[0]=new S(this.min.x,this.min.y,this.min.z),i[1]=new S(this.min.x,this.min.y,this.max.z),i[2]=new S(this.min.x,this.max.y,this.min.z),i[3]=new S(this.min.x,this.max.y,this.max.z),i[4]=new S(this.max.x,this.min.y,this.min.z),i[5]=new S(this.max.x,this.min.y,this.max.z),i[6]=new S(this.max.x,this.max.y,this.min.z),i[7]=new S(this.max.x,this.max.y,this.max.z),i.forEach((function(i){i.subtract(e),i.applyMatrix(t),i.add(e)})),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new S;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),Nr=function(){function t(t,e){void 0===t&&(t=S.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=(new Or).setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new S),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 Or),this.isEmpty()?(t.makeEmpty(),t):(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],a=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*a,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new S).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new S,i=new S;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=(new S).subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),Lr=Object.freeze({__proto__:null,get EulerOrder(){return Cr},Euler:Ar,Quaternion:Ke,Vector2:_,Vector3:S,Vector4:C,Matrix3:Mr,Matrix4:wr,Ray:Pr,PI2:v,DEG2RAD:y,RAD2DEG:g,NumberEpsilon:x,isZero:function(t){return isNaN(t)||Math.abs(t)<x},isEqual:b,damp:function(t,e,i,r){return T(t,e,1-Math.exp(-i*r))},lerp:T,degToRad:function(t){return t*y},radToDeg:function(t){return t*g},clamp:E,Color:w,Box3:Or,Sphere:Nr});exports.ShaderCompileResultStatus=void 0,(Ir=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[Ir.noShader=0]="noShader",Ir[Ir.success=1]="success",Ir[Ir.fail=2]="fail",Ir[Ir.compiling=3]="compiling",exports.GLSLVersion=void 0,(Rr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",Rr.GLSL3="300 es";var Fr=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return Vt(e,t),e.prototype.initialize=function(){},e}(Re);exports.Shader=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=_e(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}(Re),exports.Shader=a([Me(pe.Shader)],exports.Shader);var Vr,kr=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=[Di.ONE,Di.ONE_MINUS_SRC_ALPHA,Di.ONE,Di.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Di.FUNC_ADD,Di.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Di.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=[Di.ALWAYS,Di.ALWAYS],this.stencilOpFail=[Di.KEEP,Di.KEEP],this.stencilOpZFail=[Di.KEEP,Di.KEEP],this.stencilOpZPass=[Di.KEEP,Di.KEEP],this.culling=!1,this.frontFace=Di.CCW,this.cullFace=Di.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(Di.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Di.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Di.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Di.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Di.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Di.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[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}();exports.MaterialRenderType=void 0,(Vr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[Vr.normal=0]="normal",Vr[Vr.transformFeedback=1]="transformFeedback";var Dr=1,zr=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,r.floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.materialState=new kr,i){var n=i.name,a=void 0===n?"Material"+Dr++:n,o=i.renderType,s=void 0===o?0:o,u=i.shader;r.name=a,r.renderType=s,r.shaderSource=u,r.props=i,r._shader=new exports.Shader(e),r._shader.shaderData=He({},i.shader,{id:ct(),dataType:pe.Shader})}else r.name="Material"+Dr++,r.renderType=0;return r}Vt(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.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];nt(i.initialize)?i.initialize():tt.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this._shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.materialState.apply(t)},i.use=function(t,e){var i,r=t.engine,n=this.shaderVariant;if(n.bind(),this.setupStates(r),e){for(var a,o=_e(e.uniforms);!(a=o()).done;)i=a.value,this.checkUniform(i);for(var s,u=_e(e.samplers);!(s=u()).done;)i=s.value,this.samplers.includes(i)||(this.samplers.push(i),this.uniformDirty=!0)}if(this.uniformDirty&&(n.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(i in e.floats)n.setFloat(i,e.floats[i]);for(i in e.ints)n.setInt(i,e.ints[i]);for(i in e.vector4s)n.setVector4(i,e.vector4s[i]);for(i in e.vector3s)n.setVector3(i,e.vector3s[i]);for(i in e.matrices)n.setMatrix(i,e.matrices[i])}for(i in this.textures)this.textures[i].initialize();for(i in this.floats)n.setFloat(i,this.floats[i]);for(i in this.ints)n.setInt(i,this.ints[i]);for(i in this.floatArrays)n.setFloats(i,this.floatArrays[i]);for(i in this.textures)n.setTexture(i,this.textures[i]);for(i in this.vector2s)n.setVector2(i,this.vector2s[i]);for(i in this.vector3s)n.setVector3(i,this.vector3s[i]);for(i in this.vector4s)n.setVector4(i,this.vector4s[i]);for(i in this.colors)n.setColor(i,this.colors[i]);for(i in this.quaternions)n.setQuaternion(i,this.quaternions[i]);for(i in this.matrices)n.setMatrix(i,this.matrices[i]);for(i in this.matrice3s)n.setMatrix3(i,this.matrice3s[i]);for(i in this.vector4Arrays)n.setVector4Array(i,this.vector4Arrays[i]);for(i in this.matrixArrays)n.setMatrixArray(i,this.matrixArrays[i])},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=_e(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=_e(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;Y(r);var n=e.create(r,i);return n.materialState=Object.assign(new kr,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},i.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 C(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=wr.fromIdentity(),s=0;s<16;s++)o.elements[s]=t.matrixArrays[e][a+s];n.push(o)}this.setMatrixArray(e,n)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=He({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===Ot.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,a=e.stringTags.RenderFace;for(r in a===Nt.Front?(this.culling=!0,this.cullFace=Di.BACK):a===Nt.Back?(this.culling=!0,this.cullFace=Di.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var o=i.vector4s[r];this.setVector4(r,new C(o.x,o.y,o.z,o.w))}for(r in i.colors){var s=i.colors[r];this.setColor(r,new w(s.r,s.g,s.b,s.a))}for(r in i.textures){var u=i.textures[r],h=this.engine.findObject(u.texture);this.setTexture(r,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(r+"_ST",new C(c.x,c.y,l.x,l.y))}if(e.shader){var f=this.engine.findObject(e.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.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=pe.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},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(){var e;this.destroyed||(null==(e=this.shaderVariant)||e.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=lt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},Pi(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",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}}]),e}(Re);zr.create=function(t,e){return new zr(t,e)};var Br,Ur=function(){function t(){this.alphaMaskEnabled=!1,this.isMask=!1,this.inverted=!1,this.maskMode=exports.MaskMode.NONE,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:exports.TextureLoadAction.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.inverted,a=void 0!==n&&n,o=e.reference,s=e.alphaMaskEnabled,u=void 0!==s&&s;if(this.alphaMaskEnabled=u,this.isMask=r,this.inverted=a,this.maskReferences=[],r)this.maskMode=exports.MaskMode.MASK;else{this.maskMode=a?exports.MaskMode.REVERSE_OBSCURED:exports.MaskMode.OBSCURED;var h=t.findObject(o);h&&this.maskReferences.push({maskable:h,inverted:a})}},e.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some((function(e){return e.maskable===t}))){if(this.maskReferences.length>=255)return void console.warn("Maximum of 255 mask references exceeded. Additional masks will be ignored.");this.maskReferences.push({maskable:t,inverted:e})}},e.removeMaskReference=function(t){var e=this.maskReferences.findIndex((function(e){return e.maskable===t}));-1!==e&&this.maskReferences.splice(e,1)},e.clearMaskReferences=function(){this.maskReferences=[]},e.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=_e(r);!(i=n()).done;){var a=i.value;this.addMaskReference(a,!1)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var o,s=[],u=[],h=_e(this.maskReferences);!(o=h()).done;){var l=o.value;l.inverted?u.push(l):s.push(l)}for(var c=0;c<s.length;c++)s[c].maskable.drawStencilMask(c);for(var f,d=s.length,p=_e(u);!(f=p()).done;){f.value.maskable.drawStencilMask(d)}this.expectedStencilValue=d}for(var m,v=_e(e.materials);!(m=v()).done;){var y=m.value;this.setupMaskedMaterial(y)}for(var g,x=_e(r);!(g=x()).done;){var b=g.value;this.removeMaskReference(b)}},e.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.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.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},e.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[Di.EQUAL,Di.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpZPass=[Di.INCR,Di.INCR],t.colorMask=!1},e.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[Di.EQUAL,Di.EQUAL],t.stencilOpZPass=[Di.KEEP,Di.KEEP]):t.stencilTest=!1},e.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},Pi(t,[{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:this.maskMode===exports.MaskMode.REVERSE_OBSCURED})}}]),t}();exports.HitTestType=void 0,(Br=exports.HitTestType||(exports.HitTestType={}))[Br.triangle=1]="triangle",Br[Br.box=2]="box",Br[Br.sphere=3]="sphere",Br[Br.custom=4]="custom";var Gr=function(){this.position=new _,this.delta=new _,this.pointerCurrentRaycast=new jr},jr=function(){this.point=null,this.item=null},Xr=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new S),this.vectorsWorld.push(new S);for(var n=0;n<3;n++)this.directions.push(new S);this.minimum=new S,this.maximum=new S,this.minimumWorld=new S,this.maximumWorld=new S,this.center=new S,this.centerWorld=new S,this.extendSize=new S,this.extendSizeWorld=new S,this.worldMatrix=i||wr.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||wr.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);var n=r*e;i.scale(.5*n);var a=t.tempVector1,o=t.tempVector2;return a.copyFrom(this.center).subtract(i),o.copyFrom(this.center).add(i),this.reConstruct(a,o,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld,r=-1e-6;return!(i.x-t.x<r||r>t.x-e.x)&&(!(i.y-t.y<r||r>t.y-e.y)&&!(i.z-t.z<r||r>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}();Xr.tempVector0=new S,Xr.tempVector1=new S,Xr.tempVector2=new S;var Wr=function(){function t(){this.boundingBox=new Xr(new S,new S),this.triangles=[],this.worldMatrix=new wr,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 e=t.prototype;return e.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},e.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},e.getBoundingBoxTriangle=function(t){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=_e(this.boundingBoxTriangle.area);!(e=o()).done;){var s=e.value;i=Math.max(s.p0.x,s.p1.x,s.p2.x,i),r=Math.max(s.p0.y,s.p1.y,s.p2.y,r),n=Math.min(s.p0.x,s.p1.x,s.p2.x,n),a=Math.min(s.p0.y,s.p1.y,s.p2.y,a)}var u=[],h=new S(n,r,0),l=new S(i,r,0),c=new S(i,a,0),f=new S(n,a,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=_e(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxTriangle={type:exports.HitTestType.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=_e(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},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new S),t.p1=e.worldMatrix.transformPoint(t.p1,new S),t.p2=e.worldMatrix.transformPoint(t.p2,new S)})),t},t}(),Hr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e.frameClipMasks=[],e.maskManager=new Ur,e._priority=0,e.boundingBoxInfo=new Wr,e}Vt(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){},Pi(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}(Ii);a([Pe()],Hr.prototype,"materials",void 0),a([Pe()],Hr.prototype,"_priority",void 0);var Yr,Zr=6,qr="editor",Kr={"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"},Qr=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=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var a;null==(a=e.listeners[t])||a.forEach((function(i){var n=i.listener,a=i.options;n.apply(void 0,[].concat(r)),(null==a?void 0:a.once)&&e.off(t,n)}))},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map((function(t){return t.listener})))||[]}},Jr=new Ke,$r=new S,tn=new S,en=1,rn=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new S(0,0,0),this.quat=new Ke(0,0,0,1),this.rotation=new Ar(0,0,0),this.scale=new S(1,1,1),this.anchor=new S(0,0,0),this.size=new _(1,1),this.children=[],this.worldMatrix=wr.fromIdentity(),this.localMatrix=wr.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new S(0,0,0),quat:new Ke(0,0,0,1),scale:new S(1,1,1)},this.name="transform_"+en++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,a=t.scale,o=t.size,s=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(n(i,S)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)n(s,Ke)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var l=e?-1:1;n(r,Ar)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}a&&(n(a,S)?this.setScale(a.x,a.y,a.z):this.setScale(a[0],a[1],a[2])),o&&this.setSize(o.x,o.y),h&&(n(h,_)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){d(this.children,t)},e.removeChild=function(t){p(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Ar)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return 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?($r.set(0,0,0),Jr.set(0,0,0,1),tn.set(1,1,1),r.decompose($r,Jr,tn),$r.set(t-$r.x,e-$r.y,i-$r.z),Jr.invert(),$r.applyQuaternion(Jr),$r.x=0!==tn.x?$r.x/tn.x:0,$r.y=0!==tn.y?$r.y/tn.y:0,$r.z=0!==tn.z?$r.z/tn.z:0,this.setPosition($r.x,$r.y,$r.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Ar)},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.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new S).copyFrom(t.position),t.quat?e.quat=new Ke(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Ar(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new S).copyFrom(t.scale),t.size&&(e.size=(new _).copyFrom(t.size)),t.anchor&&(e.anchor=(new _).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var i=Jr.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},Pi(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}();exports.VFXItem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new rn,r.time=-1,r.duration=0,r.endBehavior=Bt.forward,r.type=Pt.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new Qr,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=_e(this.components);!(i=r()).done;){var a=i.value;if(n(a,t)){e=a;break}}return e},i.getComponents=function(t){for(var e,i=[],r=_e(this.components);!(e=r()).done;){var a=e.value;n(a,t)&&i.push(a)}return i},i.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},i.setParent=function(t){(t!==this||t)&&(this.parent&&p(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()))},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=_e(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new rn({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Ar(t,e,i),n=Ke.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(t,e,i)},i.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)}},i.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)}},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.hitTest=function(t,i,r,n,a,o,s){var u;if(!this.isActive)return!1;var h=!1,l=null==s?void 0:s.maxCount,c=this.getHitTestParams(o);if(c){var f=c.clipMasks,d=!0;if(f.length>0&&!function(t,e){for(var i,r=_e(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 S(-.5*s,.5*u,0).applyMatrix(o),l=new S(-.5*s,-.5*u,0).applyMatrix(o),c=new S(.5*s,.5*u,0).applyMatrix(o),f={p0:h,p1:l,p2:c},d={p0:c,p1:l,p2:new S(.5*s,-.5*u,0).applyMatrix(o)};if(!t.intersectTriangle(f)&&!t.intersectTriangle(d))return!1}}return!0}(t,f)&&(d=!1),d){var p=!1,m=new S;if(c.type===exports.HitTestType.triangle){for(var v=c.triangles,y=c.backfaceCulling,g=0;g<v.length;g++)if(t.intersectTriangle(v[g],m,y)){p=!0,a.push(m);break}}else if(c.type===exports.HitTestType.box){var x=c.center,b=c.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);t.intersectBox({min:T,max:E},m)&&(p=!0,a.push(m))}else if(c.type===exports.HitTestType.sphere){var C=c.center,w=c.radius;t.intersectSphere({center:C,radius:w},m)&&(p=!0,a.push(m))}else if(c.type===exports.HitTestType.custom){var A=c.collect(t,new _(i,r));A&&A.length>0&&(A.forEach((function(t){a.push(t)})),p=!0)}if(p){var M,P={id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:c.behavior,item:this,composition:this.composition};if(n.push(P),h=!0,null==s||null==(M=s.stop)?void 0:M.call(s,P))return!0}}}for(var I,R=_e(this.children);!(I=R()).done;){var O,N=I.value;if(void 0!==l&&n.length>=l)break;(null==s||null==(O=s.skip)?void 0:O.call(s,N))||N.hitTest(t,i,r,n,a,o,s)&&(h=!0)}return e.isComposition(this)&&h&&this!==(null==(u=this.composition)?void 0:u.rootItem)&&n.push({id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:Mt.NONE,item:this,composition:this.composition}),h},i.getCurrentPosition=function(){var t=new S;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,a=i[r];if(r++,a.name===t)return a;(n=i).push.apply(n,[].concat(a.children))}},i.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.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=_e(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=_e(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=_e(this.children);!(r=n()).done;){r.value.awake()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=_e(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=_e(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=_e(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.onParentChanged=function(){for(var t,e=_e(this.components);!(t=e()).done;){t.value.onParentChanged()}for(var i,r=_e(this.children);!(i=r()).done;){i.value.onParentChanged()}},i.setRendererComponentOrder=function(t){for(var e,i=_e(this.components);!(e=i()).done;){var r=e.value;n(r,Hr)&&(r.priority=t)}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r,n=i.id,a=i.name,o=i.parentId,s=i.endBehavior,u=i.transform,h=i.duration,l=void 0===h?0:h,c=i.visible,f=void 0===c||c;if(this.type=i.type,this.props=i,this.id=n.toString(),this.parentId=o,this.components.length=0,e.isComposition(this)){var d=this.definition.content.options.refId,p=this.engine.findEffectsObjectData(d);if(!p)throw new Error("Referenced precomposition with Id: "+d+" does not exist.");this.instantiatePreComposition(p)}if(this.name=a,this.duration=l,this.endBehavior=s,u&&this.transform.fromData(u),this.transform.name=this.name,this.transform.engine=this.engine,i.content||(i.content={options:{}}),l<0)throw new Error("Item duration can't be less than 0, see "+Kr["Item duration can't be less than 0"]+".");if(i.components)for(var m,v=_e(i.components);!(m=v()).done;){var y=m.value,g=this.engine.findObject(y);this.components.push(g)}for(var x,b=_e(null!=(r=i.children)?r:[]);!(x=b()).done;){var T=x.value;this.engine.findObject(T).setParent(this)}this.setVisible(f)},i.toData=function(){var t,e;(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=pe.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.definition.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.definition.components){this.definition.components=[];for(var i,r=_e(this.components);!(i=r()).done;){var a=i.value;n(a,exports.EffectComponent)&&this.definition.components.push(a)}}this.definition.content={}},i.dispose=function(){if(this.composition){this.composition.destroyItem(this);for(var e,i=_e(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}this.resetChildrenParent(),t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=_e(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&p(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i,r=this.getInstanceId();this.setInstanceId(t.id);for(var n,a=_e(t.components);!(n=a()).done;){var o=n.value,s=this.engine.findObject(o);s.item=this,this.components.push(s)}for(var u,h=_e(null!=(i=t.children)?i:[]);!(u=h()).done;){var l=u.value;this.engine.findObject(l).setParent(this)}if(e){for(var c,f=_e(this.components);!(c=f()).done;){c.value.setInstanceId(ct())}for(var d,p=_e(this.children);!(d=p()).done;){d.value.refreshGUIDRecursive()}}this.setInstanceId(r)},i.refreshGUIDRecursive=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:ct();this.setInstanceId(i);for(var r,n=_e(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:ct();o.setInstanceId(s)}for(var u,h=_e(this.children);!(u=h()).done;){u.value.refreshGUIDRecursive(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=_e(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=_e(this.children);!(n=a()).done;){n.value.gatherPreviousObjectID(t)}},i.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)}},e.isComposition=function(t){return t.type===Pt.composition},e.isSprite=function(t){return t.type===Pt.sprite},e.isParticle=function(t){return t.type===Pt.particle},e.isNull=function(t){return t.type===Pt.null},e.isTree=function(t){return t.type===Pt.tree},e.isCamera=function(t){return t.type===Pt.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},Pi(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=_e(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:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(Re),exports.VFXItem=a([Me(pe.VFXItemData)],exports.VFXItem),exports.Item=void 0,(Yr=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},Yr.isComposition=function(t){return t.type===Pt.composition},Yr.isParticle=function(t){return t.type===Pt.particle},Yr.isNull=function(t){return t.type===Pt.null};var nn,an,on=(nn=new Float32Array(1),an=new Int32Array(nn.buffer),function(t){nn[0]=t;var e=an[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?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),sn=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]=on(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=on(t[i])},t}();var un,hn=new Ar,ln=new wr;function cn(t,e,i,r,n,a,o){var s=t,u=r/n,h=r,l=e.speedOverLifetime;l&&(h=l.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;s.copyFrom(a),s.addScaledVector(o,h),s.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new S;d.center&&p.setFromArray(d.center);var m=s.clone().subtract(p),v=d.asRotation,y=["x","y","z"].map((function(t){var e=d[t];return e?v?e.getValue(u):e.getIntegrateValue(0,r,n):0}));hn.setFromArray(y).negate(),ln.setFromEuler(hn);var g=ln.transformPoint(m);s.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var _=x?b.getValue(u):b.getIntegrateValue(0,r,n);s.x=s.x+_}if(T){var C=x?T.getValue(u):T.getIntegrateValue(0,r,n);s.y=s.y+C}if(E){var w=x?E.getValue(u):E.getIntegrateValue(0,r,n);s.z=s.z+w}}return s}function fn(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function dn(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function pn(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 mn=((un={})[Rt.PARTICLE_ORIGIN_CENTER]=[0,0],un[Rt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],un[Rt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],un[Rt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],un[Rt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],un[Rt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],un[Rt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],un[Rt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],un[Rt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],un);function vn(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function yn(t,e,i){var r=i.position,n=new S(t,e,0),a=new S;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new Pr(r,a)}function gn(t,e,i){var r=t.x,n=t.y,a=t.z,o=new S(r-e,n+i,a),s=new S(r-e,n-i,a),u=new S(r+e,n-i,a),h=new S(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function xn(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function bn(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function Tn(t,e,i,r,n){void 0===r&&(r=null);var a=new S(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new S(-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 En={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,a=e[r],o=e[n];return new _(a,o)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===zt.LINE||i===zt.EASE_OUT?0:i===zt.EASE_IN||i===zt.EASE||i===zt.HOLD&&r===zt.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!==zt.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==zt.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[zt.EASE,zt.EASE_IN,zt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[zt.EASE,zt.EASE_OUT,zt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===zt.HOLD&&[zt.HOLD,zt.LINE_OUT,zt.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===zt.HOLD&&[zt.HOLD,zt.LINE,zt.EASE_IN].includes(i)}},_n=function(t,e){this.points=t,this.totalLength=e},Sn={},Cn={},wn=.1;function An(t,e){return 1-3*e+3*t}function Mn(t,e){return 3*e-6*t}function Pn(t){return 3*t}function In(t,e,i){return((An(e,i)*t+Mn(e,i))*t+Pn(e))*t}function Rn(t,e,i){return 3*An(e,i)*t*t+2*Mn(e,i)*t+Pn(e)}function On(t,e,i,r){var n=bn(e.x-t.x,3)+"_"+bn(e.y-t.y,3)+"_"+bn(e.z-t.z,3)+"&"+(bn(i.x-t.x,3)+"_"+bn(i.y-t.y,3)+"_"+bn(i.z-t.z,3))+"&"+(bn(r.x-t.x,3)+"_"+bn(r.y-t.y,3)+"_"+bn(r.z-t.z,3));if(Cn[n])return{data:Cn[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new S,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),u+=Math.pow(l.y-o.y,2),u+=Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new _n(a,s);return Cn[n]=f,{data:f,interval:new S(t.x,t.y,t.z)}}var Nn=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=On(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(xn(1-t,0))return e.points[299].point.clone().add(this.interval);if(xn(e.totalLength,0))return this.p1.clone();var i=new S,r=bn(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(xn(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+=bn(e.points[a].partialLength,5)):s<0&&a>0?(n-=bn(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),Ln=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new Ke,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):xn(1-t,0)?this.temp.copyFrom(this.p2):(Dn.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Fn=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new _,this.control2=new _,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new 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(),In(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 t*(o*a)+e*o*n*3+i*a*s*3+r*(s*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=In(t*wn,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+=wn;var n=i+(t-e[--r])/(e[r+1]-e[r])*wn,a=Rn(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=Rn(e,i,r);if(0===a)return e;e-=(In(e,i,r)-t)/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=In(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+wn,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 Vn(t,e){var i=kn(t,e,!0),r=i.p0,n=i.p1,a=i.p2,o=i.p3;Y(a),Y(o);var s,u,h=o.x-r.x,l=o.y-r.y,c=bn((n.x-r.x)/h,5),f=bn((a.x-r.x)/h,5);xn(l,0)?s=u=NaN:(s=bn((n.y-r.y)/l,5),u=bn((a.y-r.y)/l,5)),c<0&&(c=0),f<0&&(f=0),c>1&&(c=1),f>1&&(f=1);var d,p=("bez_"+c+"_"+s+"_"+f+"_"+u).replace(/\./g,"p");return Sn[p]?d=Sn[p]:(d=xn(l,0)?new Fn:new Fn(c,s,f,u),Sn[p]=d),{points:[r,n,a,o],timeInterval:h,valueInterval:l,curve:d}}function kn(t,e,i){var r=t[1],n=En.isHoldOutKeyframe(t),a=En.isHoldInKeyframe(e),o=!a&&En.isRightSideEase(t),s=!n&&En.isLeftSideEase(e);if(o&&!s&&!a){var u=new _(r[r.length-4],r[r.length-3]),h=new _(r[r.length-2],r[r.length-1]),l=En.getPointInCurve(e),c=new _(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new _(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!o&&s&&!n){var f=e[1],d=En.getPointInCurve(t),p=new _(d.x,d.y),m=new _(f[0],f[1]),v=new _(f[2],f[3]);return{type:"ease",p0:p,p1:new _(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(o&&s){var y=e[1];return{type:"ease",p0:new _(r[r.length-4],r[r.length-3]),p1:new _(r[r.length-2],r[r.length-1]),p2:new _(y[0],y[1]),p3:new _(y[2],y[3])}}var g=En.getPointInCurve(t),x=En.getPointInCurve(e);return n?x.y=g.y:a&&(g.y=x.y),i?{type:"line",p0:g,p1:new _((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new _((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}:{type:"line",p0:g,p1:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var Dn=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)return t.x=n,t.y=a,t.z=o,void(t.w=s);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);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}(),zn="not_implement",Bn=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(zn)},e.getIntegrateValue=function(t,e,i){throw new Error(zn)},e.getIntegrateByTime=function(t,e){throw new Error(zn)},e.getValue=function(t){throw new Error(zn)},e.getMaxTime=function(){throw new Error(zn)},e.toUniform=function(t){throw new Error(zn)},e.map=function(t){throw new Error(zn)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(zn)},t.getAllData=function(t,e){for(var i=new(e?sn: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}(),Un=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Bn),Gn=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Bn),jn=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(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}(Bn),Xn=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Bn),Wn=function(t){function e(){return t.apply(this,arguments)}Vt(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 Jn(e,0,this.xCoord,this.min,this.max)-Jn(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}(Bn),Hn=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=P(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 I(n.color.toArray(),a.color.toArray(),o,!0)}}return e[i].color.toArray()},e}(Bn),Yn=function(t){function e(){return t.apply(this,arguments)}Vt(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?Jn:Qn,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=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},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}(Bn),Zn=function(t){function e(){return t.apply(this,arguments)}Vt(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;if(0===o)s=(t-n[0])/(a[0]-n[0]);else s=($n(t,n,a)-n[1])/o;return 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}(Bn),qn=function(t){function e(){return t.apply(this,arguments)}Vt(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 S(i[n][0],i[n][1],i[n][2]),u=new S(i[n+1][0],i[n+1][1],i[n+1][2]),h=new S(r[2*n][0],r[2*n][1],r[2*n][2]),l=new S(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=Vn(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Nn(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=bn(t,5),i=0,r=new S,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 r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return r=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=bn((e-r.x)/n,4);return E(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Bn),Kn=function(t){function e(){return t.apply(this,arguments)}Vt(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=Ke.fromArray(i[n]),u=Ke.fromArray(i[n+1]),h=Ke.fromArray(r[2*n]),l=Ke.fromArray(r[2*n+1]),c=Vn(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Ln(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=bn(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=bn((e-r.x)/n,4);return E(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Bn);function Qn(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function Jn(t,e,i,r,n){var a=t*t,o=e*e;return(2*(a*t)*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function $n(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,h=u-2*s+o,l=u-s,c=-2*u+3*s;return(2*u-3*s+1)*e[1]+h*n+l*a+c*i[1]}function ta(t,e){if(e){var i=e[0],r=e[1];if(i===Dt.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===Dt.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===Dt.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 ea(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function ia(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ia=function(){return!!t})()}function ra(t,e,i){return ra=ia()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Ft(n,i.prototype),n},ra.apply(null,arguments)}var na,aa,oa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new C,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=pa(t[0]),this.yCurve=pa(t[1]),this.zCurve=pa(t[2]),this.wCurve=pa(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}(Bn),sa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new S,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=pa(t[0]),this.yCurve=pa(t[1]),this.zCurve=pa(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}(Bn),ua=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new _,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=pa(t[0]),this.yCurve=pa(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}(Bn);exports.TangentMode=void 0,(na=exports.TangentMode||(exports.TangentMode={}))[na.Cubic=0]="Cubic",na[na.Linear=1]="Linear",na[na.Constant=2]="Constant",exports.WeightedMode=void 0,(aa=exports.WeightedMode||(exports.WeightedMode={}))[aa.None=0]="None",aa[aa.In=1]="In",aa[aa.Out=2]="Out",aa[aa.Both=3]="Both";var ha=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=ca(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=la(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);o+=0===u||20===u?l:u%2==1?4*l:2*l}return o*=s/3},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}(Bn);function la(t,e){var i=new _(t.time,t.value),r=new _,n=new _,a=new _,o=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,s=2===t.tangentMode,u=(o?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(s?0:t.outSlope);var h=(o?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(s?0:e.inSlope),a.x=e.time,a.y=s?t.value:e.value,Y(n),Y(a);var l,c,f=a.x-i.x,d=a.y-i.y,p=bn((r.x-i.x)/f,5),m=bn((n.x-i.x)/f,5);xn(d,0)?l=c=NaN:(l=bn((r.y-i.y)/d,5),c=bn((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,a),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,a),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,a),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,a),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return Sn[y]?v=Sn[y]:(v=xn(d,0)?new Fn:o?new Fn(p,l,m,c):new Fn(l,c),Sn[y]=v),{points:[i,r,n,a],timeInterval:f,valueInterval:d,curve:v}}function ca(t){for(var e=t,i=[],r=[],n={x:0,y:0},a=0;a<e.length;a++){var o=e[a],s=kn(o,a+1<e.length?e[a+1]:e[a],!0),u=s.p0,h=s.p1,l=s.p2,c=s.p3,f=s.type;Y(l),Y(c);var d={leftControl:n,value:u,rightControl:h,tangentMode:"line"===f?1:0};o[0]===zt.HOLD&&(d.tangentMode=2),r.push(d),n=l}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+x)},m=0;m<r.length;m++){var v=r[m].leftControl,y=r[m].value,g=r[m].rightControl,b=0,T=0;m>0&&(b=p(v,y)),m<r.length-1&&(T=p(y,g));var E={time:y.x,value:y.y,inSlope:b,outSlope:T,inWeight:0,outWeight:0,tangentMode:r[m].tangentMode,weightedMode:3};i.push(E),m>0&&(E.inWeight=(y.x-v.x)/((y.x-r[m-1].value.x)/3)),m+1<r.length&&(E.outWeight=(g.x-y.x)/((r[m+1].value.x-y.x)/3))}return i}var fa,da=((fa={})[Dt.RANDOM]=function(t){return n(t[0],Array)?new Xn(t):new jn(t)},fa[Dt.CONSTANT]=function(t){return new Un(t)},fa[Dt.CONSTANT_VEC2]=function(t){return new Un(t)},fa[Dt.CONSTANT_VEC3]=function(t){return new Un(t)},fa[Dt.CONSTANT_VEC4]=function(t){return new Un(t)},fa[Dt.RGBA_COLOR]=function(t){return new Un(t)},fa[Dt.COLORS]=function(t){return new Gn(t.map((function(t){return A(t,!1)})))},fa[Dt.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Wn([t[0][1],t[1][1]]):new Yn(t)},fa[Dt.GRADIENT_COLOR]=function(t){return new Hn(t)},fa[Dt.LINEAR_PATH]=function(t){return new Zn(t)},fa[Dt.BEZIER_CURVE]=function(t){return 1===t.length?new Un(t[0][1][1]):new ha(t)},fa[Dt.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Un(ra(S,[].concat(t[1][0]))):new qn(t)},fa[Dt.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Un(ra(Ke,[].concat(t[1][0]))):new Kn(t)},fa[Dt.COLOR_CURVE]=function(t){return new ma(t)},fa[Dt.VECTOR4_CURVE]=function(t){return new oa(t)},fa[Dt.VECTOR2_CURVE]=function(t){return new ua(t)},fa[27]=function(t){return new sa(t)},fa);function pa(t){if(!t||!isNaN(+t))return new Un(t||0);if(n(t,Bn))return t;if(nt(da[t[0]]))return da[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Kr["ValueType: 21/22 is not supported"]+".")}var ma=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new w,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=pa(t[0]),this.gCurve=pa(t[1]),this.bCurve=pa(t[2]),this.aCurve=pa(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}(Bn),va=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},Pi(t,null,[{key:"shared",get:function(){return ya.x=0,ya.y=0,ya}}]),t}(),ya=new va,ga=1e-4,xa=1e-4;function ba(t,e,i,r,n,a,o,s){var u,h;o?(u=r,h=-i):(u=-r,h=i);var 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 Ta(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.abs(d),m=Math.sqrt(u*u+h*h),v=1+(15*p*Math.sqrt(m)/Math.PI>>0),y=d/v;if(f+=y,s){o.push(t,e),o.push(i,r);for(var g=1,x=f;g<v;g++,x+=y)o.push(t,e),o.push(t+Math.sin(x)*m,e+Math.cos(x)*m);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)o.push(t+Math.sin(T)*m,e+Math.cos(T)*m),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*v}function Ea(t,e,i,r,n,a,o,s,u){var h=ga;if(0!==t.length){var l=e,c=l.alignment;if(.5!==e.alignment){var f=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&&(f*=-1),c=(c-.5)*f+.5}var d=new va(t[0],t[1]),p=new va(t[t.length-2],t[t.length-1]),m=r,v=Math.abs(d.x-p.x)<h&&Math.abs(d.y-p.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var y=.5*(d.x+p.x),g=.5*(p.y+d.y);t.unshift(y,g),t.push(y,g)}var b=n,T=t.length/2,E=t.length,_=b.length/2,S=l.width/2,C=S*S,w=l.miterLimit*l.miterLimit,A=t[0],M=t[1],P=t[2],I=t[3],R=0,O=0,N=-(M-I),L=A-P,F=0,V=0,k=Math.sqrt(N*N+L*L)+x;N/=k,L/=k,N*=S,L*=S;var D=2*(1-c),z=2*c;m||(l.cap===ue.Round?E+=Ta(A-N*(D-z)*.5,M-L*(D-z)*.5,A-N*D,M-L*D,A+N*z,M+L*z,b,!0)+2:l.cap===ue.Square&&(E+=ba(A,M,N,L,D,z,!0,b))),b.push(A-N*D,M-L*D),b.push(A+N*z,M+L*z);for(var B=1;B<T-1;++B){A=t[2*(B-1)],M=t[2*(B-1)+1],P=t[2*B],I=t[2*B+1],R=t[2*(B+1)],O=t[2*(B+1)+1],N=-(M-I),L=A-P,N/=k=Math.sqrt(N*N+L*L)+x,L/=k,N*=S,L*=S,F=-(I-O),V=P-R,F/=k=Math.sqrt(F*F+V*V)+x,V/=k,F*=S,V*=S;var U=P-A,G=M-I,j=P-R,X=O-I,W=U*j+G*X,H=G*j-X*U,Y=H<0;if(Math.abs(H)<.001*Math.abs(W))b.push(P-N*D,I-L*D),b.push(P+N*z,I+L*z),W>=0&&(l.join===he.Round?E+=Ta(P,I,P-N*D,I-L*D,P-F*D,I-V*D,b,!1)+4:E+=2,b.push(P-F*z,I-V*z),b.push(P+F*D,I+V*D));else{var Z=(-N+A)*(-L+I)-(-N+P)*(-L+M),q=(-F+R)*(-V+I)-(-F+P)*(-V+O),K=(U*q-j*Z)/H,Q=(X*Z-G*q)/H,J=(K-P)*(K-P)+(Q-I)*(Q-I),$=P+(K-P)*D,tt=I+(Q-I)*D,et=P-(K-P)*z,it=I-(Q-I)*z,rt=Y?D:z;J<=Math.min(U*U+G*G,j*j+X*X)+rt*rt*C?l.join===he.Bevel||J/C>w?(Y?(b.push($,tt),b.push(P+N*z,I+L*z),b.push($,tt),b.push(P+F*z,I+V*z)):(b.push(P-N*D,I-L*D),b.push(et,it),b.push(P-F*D,I-V*D),b.push(et,it)),E+=2):l.join===he.Round?Y?(b.push($,tt),b.push(P+N*z,I+L*z),E+=Ta(P,I,P+N*z,I+L*z,P+F*z,I+V*z,b,!0)+4,b.push($,tt),b.push(P+F*z,I+V*z)):(b.push(P-N*D,I-L*D),b.push(et,it),E+=Ta(P,I,P-N*D,I-L*D,P-F*D,I-V*D,b,!1)+4,b.push(P-F*D,I-V*D),b.push(et,it)):(b.push($,tt),b.push(et,it)):(b.push(P-N*D,I-L*D),b.push(P+N*z,I+L*z),l.join===he.Round?E+=Y?Ta(P,I,P+N*z,I+L*z,P+F*z,I+V*z,b,!0)+2:Ta(P,I,P-N*D,I-L*D,P-F*D,I-V*D,b,!1)+2:l.join===he.Miter&&J/C<=w&&(Y?(b.push(et,it),b.push(et,it)):(b.push($,tt),b.push($,tt)),E+=2),b.push(P-F*D,I-V*D),b.push(P+F*z,I+V*z),E+=2)}}A=t[2*(T-2)],M=t[2*(T-2)+1],P=t[2*(T-1)],N=-(M-(I=t[2*(T-1)+1])),L=A-P,N/=k=Math.sqrt(N*N+L*L)+x,L/=k,N*=S,L*=S,b.push(P-N*D,I-L*D),b.push(P+N*z,I+L*z),m||(l.cap===ue.Round?E+=Ta(P-N*(D-z)*.5,I-L*(D-z)*.5,P-N*D,I-L*D,P+N*z,I+L*z,b,!1)+2:l.cap===ue.Square&&(E+=ba(P,I,N,L,D,z,!1,b)));for(var nt=_;nt<E+_-2;++nt)A=b[2*nt],M=b[2*nt+1],P=b[2*(nt+1)],I=b[2*(nt+1)+1],R=b[2*(nt+2)],O=b[2*(nt+2)+1],Math.abs(A*(I-O)+P*(O-M)+R*(M-I))<1e-8||s.push(nt,nt+1,nt+2)}}var _a=function(){},Sa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ca={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(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 a(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 o(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function s(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 u(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 h(t){return r(t.b.a,t.a)}function l(t){return r(t.a,t.b.a)}function c(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 f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function d(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,E(e.a,t.a)),e.d!==t.d&&(i=!0,_(e.d,t.d)),g(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,_(t.d,t.b.d)),t.c===t?E(t.a,null):(t.b.d.a=$(t),t.a.c=t.c,g(t,$(t)),i||b(t,t.d)),e.c===e?(E(e.a,null),_(e.d,null)):(t.d.a=$(e),e.a.c=e.c,g(e,$(e))),T(t)}function m(t){var e=y(t),i=e.b;return g(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,g(t.b,$(t.b)),g(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 v(t,e){var i=!1,r=y(t),n=r.b;return e.d!==t.d&&(i=!0,_(e.d,t.d)),g(r,t.e),g(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function y(t){var e=new J,i=new J,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 g(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new Q(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 T(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function E(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 _(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 S(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 C=4e150;function w(t,e){t.f+=e.f,t.b.f+=e.b.f}function A(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=a(i.b.a,e.a,i.a):0<=a(e.b.a,i.a,e.a):0>=a(i.b.a,t,i.a):i.b.a===t?0<=a(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function M(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function P(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function I(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(P(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function R(t,e,i){var r=new ct;return r.a=i,r.e=W(t.f,e.e,r),i.i=r}function O(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 N(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,M(t)}function L(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=ft(t),n=r.a;if(n.a!==e.a){if(!r.c){N(t);break}P(r,n=v(e.c.b,n.b))}e.c!==n&&(d($(n),n),d(e,n)),N(t),e=r.a,t=r}return e}function F(t,e,i,r,n,a){var o=!0;do{R(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=ft(e).a.b.c);(i=(r=ft(e)).a.b).a===n.a;)i.c!==n&&(d($(i),i),d($(n),i)),r.f=e.f-i.f,r.d=O(t,r.f),e.b=!0,!o&&z(t,e)&&(w(i,n),M(e),p(n)),o=!1,e=r,n=i;e.b=!0,a&&U(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function k(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),d(e,i)}function D(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function z(t,e){var n=ft(e),o=e.a,s=n.a;if(r(o.a,s.a)){if(0<a(s.b.a,o.a,s.a))return!1;if(i(o.a,s.a)){if(o.a!==s.a){n=t.e;var u=o.a.h;if(0<=u){var h=(n=n.b).d,l=n.e,c=n.c,f=c[u];h[f]=h[n.a],c[h[f]]=f,f<=--n.a&&(1>=f||r(l[h[f>>1]],l[h[f]])?ht(n,f):lt(n,f)),l[u]=null,c[u]=n.b,n.b=u}else for(n.c[-(u+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;k(t,$(s),o)}}else m(s.b),d(o,$(s)),e.b=n.b=!0}else{if(0>a(o.b.a,s.a,o.a))return!1;dt(e).b=e.b=!0,m(o.b),d($(s),o)}return!0}function B(t,e){var h=ft(e),l=e.a,f=h.a,p=l.a,v=f.a,y=l.b.a,g=f.b.a,x=new et;if(a(y,t.a,p),a(g,t.a,v),p===v||Math.min(p.a,y.a)>Math.max(v.a,g.a))return!1;if(r(p,v)){if(0<a(g,p,v))return!1}else if(0>a(y,v,p))return!1;var b,T,E=y,_=p,S=g,C=v;if(r(E,_)||(b=E,E=_,_=b),r(S,C)||(b=S,S=C,C=b),r(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),r(S,_)?r(_,C)?(0>(b=n(E,S,_))+(T=n(S,_,C))&&(b=-b,T=-T),x.b=c(b,S.b,T,_.b)):(0>(b=a(E,S,_))+(T=-a(E,C,_))&&(b=-b,T=-T),x.b=c(b,S.b,T,C.b)):x.b=(S.b+_.b)/2,o(E,_)||(b=E,E=_,_=b),o(S,C)||(b=S,S=C,C=b),o(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),o(S,_)?o(_,C)?(0>(b=s(E,S,_))+(T=s(S,_,C))&&(b=-b,T=-T),x.a=c(b,S.a,T,_.a)):(0>(b=u(E,S,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=c(b,S.a,T,C.a)):x.a=(S.a+_.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=r(p,v)?p:v,r(E,x)&&(x.b=E.b,x.a=E.a),i(x,p)||i(x,v))return z(t,e),!1;if(!i(y,t.a)&&0<=a(y,t.a,x)||!i(g,t.a)&&0>=a(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=I(e)).a,L(t,ft(e),h),F(t,e,$(l),l,l,!0),!0;if(y===t.a){m(f.b),d(l.e,$(f)),v=(p=h=e).a.b.a;do{p=dt(p)}while(p.a.b.a===v);return p=ft(e=p).a.b.c,h.a=$(f),F(t,e,(f=L(t,h,null)).c,l.b.c,p,!0),!0}return 0<=a(y,t.a,x)&&(dt(e).b=e.b=!0,m(l.b),l.a.b=t.a.b,l.a.a=t.a.a),0>=a(g,t.a,x)&&(e.b=h.b=!0,m(f.b),f.a.b=t.a.b,f.a.a=t.a.a),!1}return m(l.b),m(f.b),d($(f),l),l.a.b=x.b,l.a.a=x.a,l.a.h=rt(t.e,l.a),l=l.a,f=[0,0,0,0],x=[p.d,y.d,v.d,g.d],l.g[0]=l.g[1]=l.g[2]=0,D(l,p,y,f,0),D(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function U(t,e){for(var i=ft(e);;){for(;i.b;)e=i,i=ft(i);if(!e.b&&(i=e,null===(e=dt(e))||!e.b))break;e.b=!1;var n,o=e.a,s=i.a;if(n=o.b.a!==s.b.a)t:{var u=ft(n=e),h=n.a,l=u.a,c=void 0;if(r(h.b.a,l.b.a)){if(0>a(h.b.a,l.b.a,h.a)){n=!1;break t}dt(n).b=n.b=!0,c=m(h),d(l.b,c),c.d.c=n.d}else{if(0<a(l.b.a,h.b.a,l.a)){n=!1;break t}n.b=u.b=!0,c=m(l),d(h.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(M(i),p(s),s=(i=ft(e)).a):e.c&&(M(e),p(o),o=(e=dt(i)).a)),o.a!==s.a)if(o.b.a===s.b.a||e.c||i.c||o.b.a!==t.a&&s.b.a!==t.a)z(t,e);else if(B(t,e))break;o.a===s.a&&o.b.a===s.b.a&&(w(s,o),M(e),p(o),e=dt(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var o=e;(h=new ct).a=o.c.b;var s=(c=n.f).a;do{s=s.a}while(null!==s.b&&!c.c(c.b,h,s.b));var u=ft(c=s.b),h=c.a;s=u.a;if(0===a(h.b.a,o,h.a))i((h=c.a).a,o)||i(h.b.a,o)||(m(h.b),c.c&&(p(h.c),c.c=!1),d(o.c,h),G(n,o));else{var l=r(s.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(o.c.b,h.e):v(s.b.c.b,o.c).b,l.c?P(l,u):(h=n,(c=R(n,c,u)).f=dt(c).f+c.a.f,c.d=O(h,c.f)),G(n,o)):F(n,c,o.c,o.c,null,!0)}return}if(c=(h=ft(n=I(n.i))).a,(h=L(t,h,null)).c===c){h=(c=h).c,s=ft(n),u=n.a,l=s.a;var c,f=!1;u.b.a!==l.b.a&&B(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=I(n)).a,L(t,ft(n),s),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=L(t,s,null),f=!0),f?F(t,n,c.c,h,h,!0):(o=r(l.a,u.a)?$(l):u,F(t,n,o=v(c.c.b,o),o.c,o.c,!1),o.b.i.c=!0,U(t,n))}else F(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=C,r.a.a=e,r.b.a.b=-C,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=W(r=t.f,r.a,i),i.e=r}function X(t){this.a=new H,this.b=t,this.c=A}function W(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new H(i,e.a,e),e.a.c=t,e.a=t}function H(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=Z,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 Z=0;function q(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case Z:K(t,100151),t.u(null);break;case 1:K(t,100152),t.t()}else switch(t.d){case 2:K(t,100154),t.v();break;case 1:K(t,100153),t.w()}}function K(t,e){t.p&&t.p(e,t.c)}function Q(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function $(t){return t.b.e}function tt(){this.c=new et,this.a=new Q,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function et(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 it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new at}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=ot(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&&lt(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ut(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(st(t.b),e))return ut(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function at(){this.d=ot([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 ot(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 st(t){return t.e[t.d[1]]}function ut(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&&ht(t,1)),a}function ht(t,e){for(var i=t.d,n=t.e,a=t.c,o=e,s=i[o];;){var u=o<<1;u<t.a&&r(n[i[u+1]],n[i[u]])&&(u+=1);var h=i[u];if(u>t.a||r(n[s],n[h])){i[o]=s,a[s]=o;break}i[o]=h,a[h]=o,o=u}}function lt(t,e){for(var i=t.d,n=t.e,a=t.c,o=e,s=i[o];;){var u=o>>1,h=i[u];if(0===u||r(n[h],n[s])){i[o]=s,a[s]=o;break}i[o]=h,a[h]=o,o=u}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function ft(t){return t.e.c.b}function dt(t){return t.e.a.b}(e=Y.prototype).x=function(){q(this,Z)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void K(this,100900)}K(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:K(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];q(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&&K(this,100155),null===(i=this.q)?d(i=f(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){q(this,Z),this.d=1,this.b=new tt,this.c=t},e.t=function(){q(this,1),this.d=2,this.q=null},e.v=function(){q(this,2),this.d=1},e.w=function(){q(this,1),this.d=Z;var t=!1,e=[c=this.j[0],n=this.j[1],s=this.j[2]];if(0===c&&0===n&&0===s){for(var n=[-2e150,-2e150,-2e150],o=[2e150,2e150,2e150],s=[],u=[],c=(t=this.b.c).e;c!==t;c=c.e)for(var f=0;3>f;++f){var d=c.g[f];d<o[f]&&(o[f]=d,u[f]=c),d>n[f]&&(n[f]=d,s[f]=c)}if(c=0,n[1]-o[1]>n[0]-o[0]&&(c=1),n[2]-o[2]>n[c]-o[c]&&(c=2),o[c]>=n[c])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,o=u[c],s=s[c],u=[0,0,0],o=[o.g[0]-s.g[0],o.g[1]-s.g[1],o.g[2]-s.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-s.g[0],f[1]=c.g[1]-s.g[1],f[2]=c.g[2]-s.g[2],u[0]=o[1]*f[2]-o[2]*f[1],u[1]=o[2]*f[0]-o[0]*f[2],u[2]=o[0]*f[1]-o[1]*f[0],(d=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=d,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[S(o)]=1)}t=!0}for(u=S(e),c=this.b.c,n=(u+1)%3,s=(u+2)%3,u=0<e[u]?1:-1,e=c.e;e!==c;e=e.e)e.b=e.g[n],e.a=u*e.g[s];if(t){for(e=0,c=(t=this.b.a).b;c!==t;c=c.b)if(!(0>=(n=c.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,c=(e=this.b.b).h;c!==e;c=t)t=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(k(this,n,c),p(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==t&&n!==t.b||(t=t.h),p(n)),c!==t&&c!==t.b||(t=t.h),p(c));for(this.e=e=new it,c=(t=this.b.c).e;c!==t;c=c.e)c.h=rt(e,c);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ht(t,e);t.h=!0}(t.b)}(e),this.f=new X(this),j(this,-C),j(this,C);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=st(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=st(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),k(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,M(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,c=(e=this.b).a.b;c!==e.a;c=t)t=c.b,(c=c.a).e.e===c&&(w(c.c,c),p(c));if(!this.n){if(e=this.b,this.m)for(c=e.b.h;c!==e.b;c=t)t=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:p(c);else for(c=e.a.b;c!==e.a;c=t)if(t=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,s=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=a(n.a,n.b.a,n.e.b.a));)n=(s=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=a(c.b.a,c.a,c.c.b.a));)c=(s=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(s=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),c=t.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,c=!1,n=-1,s=e.a.d;s!==e.a;s=s.d)if(s.c){c||(this.h&&this.h(4,this.c),c=!0),u=s.a;do{t&&(n!==(o=u.b.d.c?0:1)&&(n=o,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==s.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(e=this.b).a.b;c!==e.a;c=t)if(t=c.b,!c.c){s=(n=c.a).e,u=void 0;do{s=(u=s).e,u.d=null,null===u.b.d&&(u.c===u?E(u.a,null):(u.a.c=u.c,g(u,$(u))),(o=u.b).c===o?E(o.a,null):(o.a.c=o.c,g(o,$(o))),T(u))}while(u!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Sa.libtess={GluTesselator:Y,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}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=Sa.libtess}(Ca);var wa=function(){var t=new Ca.exports.GluTesselator;return t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Ca.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function Aa(t){wa.gluTessNormal(0,0,1);var e=[];wa.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){wa.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];wa.gluTessVertex(a,a)}wa.gluTessEndContour()}return wa.gluTessEndPolygon(),e}var Ma=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var a=Array.isArray(i[0])?i[0]:i;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 n.points=a,n.closePath=!0,n}Vt(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=Aa([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 new Error("Invalid points array");if(2!==t.length){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)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},Pi(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(_a),Pa=8,Ia=1.1920929e-7;function Ra(t,e,i,r,n,a,o,s,u,h,l){var c=null!=l?l:1,f=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/c;return function(t,e,i,r,n,a,o,s,u,h){Oa(t,e,i,r,n,a,o,s,u,h,0),u.push(o,s)}(e,i,r,n,a,o,s,u,t,f*=f),t}function Oa(t,e,i,r,n,a,o,s,u,h,l){if(!(l>Pa)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(c+d)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(y+x)/2,E=(g+b)/2;if(l>0){var _=o-t,S=s-e,C=Math.abs((i-o)*S-(r-s)*_),w=Math.abs((n-o)*S-(a-s)*_);if(C>Ia&&w>Ia){if((C+w)*(C+w)<=h*(_*_+S*S))return void u.push(T,E)}else if(C>Ia){if(C*C<=h*(_*_+S*S))return void u.push(T,E)}else if(w>Ia){if(w*w<=h*(_*_+S*S))return void u.push(T,E)}else if((_=T-(t+o)/2)*_+(S=E-(e+s)/2)*S<=h)return void u.push(T,E)}Oa(t,e,c,f,y,g,T,E,u,h,l+1),Oa(T,E,x,b,m,v,o,s,u,h,l+1)}}var Na,La=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}Vt(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)<=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=null!=e?e:1,s=Math.ceil(Math.sqrt(o*(n+a))),u=8*s+0+0;if(0===u)return t;if(0===s)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 h=0,l=4*s+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<s;g++){var x=Math.PI/2*(g/s),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,S=r+T,C=r-T;t[h++]=E,t[h++]=S,t[--l]=S,t[--l]=_,t[c++]=_,t[c++]=C,t[--f]=C,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var w=r-p;return t[h++]=m,t[h++]=y,t[--f]=w,t[--f]=m,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}(_a);exports.StarType=void 0,(Na=exports.StarType||(exports.StarType={}))[Na.Star=0]="Star",Na[Na.Polygon=1]="Polygon";var Fa,Va=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}Vt(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)Ra(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;Ra(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=Aa([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++){i=o?h:l,r=o?c:f;var p=(e=o?s:u)*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}(_a),ka=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}Vt(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=null!=e?e:1,c=Math.ceil(Math.sqrt(l*(s+i))),f=8*c+(u?4:0)+(h?4:0);if(0!==f){if(0===c)return t[0]=t[6]=a+u,t[1]=t[3]=o+h,t[2]=t[4]=a-u,void(t[5]=t[7]=o-h);var d=0,p=4*c+(u?2:0)+2,m=p,v=f,y=u+s,g=h,x=a+y,b=a-y,T=o+g;if(t[d++]=x,t[d++]=T,t[--p]=T,t[--p]=b,h){var E=o-g;t[m++]=b,t[m++]=E,t[--v]=E,t[--v]=x}for(var _=1;_<c;_++){var S=Math.PI/2*(_/c),C=u+Math.cos(S)*s,w=h+Math.sin(S)*i,A=a+C,M=a-C,P=o+w,I=o-w;t[d++]=A,t[d++]=P,t[--p]=P,t[--p]=M,t[m++]=M,t[m++]=I,t[--v]=I,t[--v]=A}x=a+(y=u),b=a-y,T=o+(g=h+i);var R=o-g;t[d++]=x,t[d++]=T,t[--v]=R,t[--v]=x,u&&(t[d++]=b,t[d++]=T,t[--v]=R,t[--v]=b)}}},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}(_a),Da=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}Vt(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 ka;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)+a]=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}(_a),za=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}Vt(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)<=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 ka),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=null!=e?e:1,s=Math.ceil(Math.sqrt(o*(n+a))),u=8*s+0+0;if(0!==u){if(0===s)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,void(t[5]=t[7]=r-0);var h=0,l=4*s+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<s;g++){var x=Math.PI/2*(g/s),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,S=r+T,C=r-T;t[h++]=E,t[h++]=S,t[--l]=S,t[--l]=_,t[c++]=_,t[c++]=C,t[--f]=C,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var w=r-p;t[h++]=m,t[h++]=y,t[--f]=w,t[--f]=m}}},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}(_a),Ba=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=_e(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"lineTo":this.lineTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"circle":this.circle(n[0],n[1],n[2],n[3]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"triangle":this.triangle(n[0],n[1],n[2],n[3],n[4],n[5],n[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 Ra(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 La(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new za(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new Va(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new ka(t,e,i,r,n),a),this},e.triangle=function(t,e,i,r,n,a,o){return this.drawShape(new Da(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 Ma).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 Ma,this.currentPoly.points.push(0,0))},t}(),Ua=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},Pi(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new Ba(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();exports.UpdateModes=void 0,(Fa=exports.UpdateModes||(exports.UpdateModes={}))[Fa.EveryUpdate=0]="EveryUpdate",Fa[Fa.Manual=1]="Manual",exports.CompositionComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).items=[],e.state=exports.PlayState.Stopped,e.updateMode=0,e.playOnStart=!1,e.endBehavior=Bt.forward,e.time=0,e.lastTime=0,e.sceneBindings=[],e.timelineAsset=null,e._timelineInstance=null,e.nestedCompositions=[],e}Vt(e,t);var i=e.prototype;return i.onStart=function(){this.playOnStart&&this.play()},i.pause=function(){this.state=exports.PlayState.Paused;for(var t,e=_e(this.nestedCompositions);!(t=e()).done;){t.value.pause()}},i.play=function(){this.state=exports.PlayState.Playing;for(var t,e=_e(this.nestedCompositions);!(t=e()).done;){t.value.play()}},i.stop=function(){this.state=exports.PlayState.Stopped,this.time=0,this.lastTime=0;for(var t,e=_e(this.nestedCompositions);!(t=e()).done;){t.value.stop()}},i.getTime=function(){return this.time},i.setTime=function(t){this.time=t},i.onUpdate=function(t){this.state===exports.PlayState.Playing&&0===this.updateMode&&this.tick(t/1e3)},i.tick=function(t){if(this.timelineInstance){var e=this.time;if(xn(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case Bt.forward:break;case Bt.freeze:e=this.item.duration;break;case Bt.restart:e%=this.item.duration;break;case Bt.destroy:return void this.item.dispose()}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},i.onEnable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!0),!1}))},i.onDisable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!1),!1}))},i.onDestroy=function(){this.item.getDescendants().forEach((function(t){return t.dispose()}))},i.setChildrenRenderOrder=function(t){if(!this.timelineInstance)return t;var i=[];this.collectChildren(this.item,i);for(var r,a=new Set,o=_e(this.timelineInstance.masterTrackInstances);!(r=o()).done;){var s=r.value;n(s.boundObject,exports.VFXItem)&&a.add(s.boundObject)}for(var u=[],h=0;h<i.length;h++)a.has(i[h])&&u.push(h);for(var l,c=[],f=_e(this.timelineInstance.masterTrackInstances);!(l=f()).done;){var d=l.value;n(d.boundObject,exports.VFXItem)&&c.push(d.boundObject)}for(var p=0;p<u.length&&p<c.length;p++)i[u[p]]=c[p];for(var m,v=_e(i);!(m=v()).done;){var y=m.value,g=t++;y.isManuallySetRenderOrder||y.setRendererComponentOrder(g);var x=y.getComponent(e);x&&(t=x.setChildrenRenderOrder(t))}return t},i.collectChildren=function(t,e){for(var i,r=_e(t.children);!(i=r()).done;){var n=i.value;e.push(n),exports.VFXItem.isComposition(n)||this.collectChildren(n,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this._timelineInstance=null},Pi(e,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new ih(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var t,i=_e(this._timelineInstance.masterTrackInstances);!(t=i()).done;){var r=t.value.boundObject;if(n(r,exports.VFXItem)&&exports.VFXItem.isComposition(r)){var a=r.getComponent(e);a.updateMode=1,this.nestedCompositions.push(a)}}}return this._timelineInstance}}]),e}(Ii),a([Pe()],exports.CompositionComponent.prototype,"items",void 0),a([Pe()],exports.CompositionComponent.prototype,"sceneBindings",void 0),a([Pe()],exports.CompositionComponent.prototype,"timelineAsset",void 0),exports.CompositionComponent=a([Me("CompositionComponent")],exports.CompositionComponent);var Ga=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}Vt(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("aPos");if(t){var e=Tn(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}(Hr);a([Pe()],Ga.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}Vt(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 C;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}(Ga),exports.EffectComponent=a([Me(pe.EffectComponent)],exports.EffectComponent);var ja=new S(0,0,0),Xa=new S(0,0,0),Wa=function(){this.target=null,this.weight=1};exports.PositionConstraint=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).positionAtRest=new S(0,0,0),e.positionOffset=new S(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}Vt(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){ja.set(0,0,0);for(var e,i=0,r=_e(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var a=n.target.transform.getWorldPosition(),o=n.weight;ja.x+=a.x*o,ja.y+=a.y*o,ja.z+=a.z*o,i+=o}}i>0&&(ja.x/=i,ja.y/=i,ja.z/=i),ja.x+=this.positionOffset.x,ja.y+=this.positionOffset.y,ja.z+=this.positionOffset.z,Xa.set(this.lerp(this.positionAtRest.x,ja.x,this.weight),this.lerp(this.positionAtRest.y,ja.y,this.weight),this.lerp(this.positionAtRest.z,ja.z,this.weight)),ja.copyFrom(this.item.transform.getWorldPosition());var s=this.constrainX?Xa.x:ja.x,u=this.constrainY?Xa.y:ja.y,h=this.constrainZ?Xa.z:ja.z;this.item.transform.setWorldPosition(s,u,h)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new Wa;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=_e(e.targets);!(i=r()).done;){var n=i.value,a=new Wa;a.target=this.engine.findObject(n.target),a.weight=n.weight,this.targets.push(a)}},e}(Ii),exports.PositionConstraint=a([Me("PositionConstraint")],exports.PositionConstraint),exports.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 Vt(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(Ii),a([Pe()],exports.PostProcessVolume.prototype,"bloom",void 0),a([Pe()],exports.PostProcessVolume.prototype,"vignette",void 0),a([Pe()],exports.PostProcessVolume.prototype,"tonemapping",void 0),a([Pe()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=a([Me(pe.PostProcessVolume)],exports.PostProcessVolume);var Ha,Ya;exports.FilterMode=void 0,(Ha=exports.FilterMode||(exports.FilterMode={}))[Ha.Nearest=0]="Nearest",Ha[Ha.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Ya=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Ya.RGBA32=0]="RGBA32",Ya[Ya.RGBAHalf=1]="RGBAHalf";var Za,qa,Ka=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){},Pi(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}();exports.RenderPassAttachmentStorageType=void 0,(Za=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[Za.none=0]="none",Za[Za.color=1]="color",Za[Za.stencil_8_opaque=2]="stencil_8_opaque",Za[Za.depth_16_opaque=3]="depth_16_opaque",Za[Za.depth_stencil_opaque=4]="depth_stencil_opaque",Za[Za.depth_16_texture=5]="depth_16_texture",Za[Za.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(qa=exports.TextureStoreAction||(exports.TextureStoreAction={}))[qa.store=0]="store",qa[qa.clear=2]="clear";var Qa,Ja=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(n(i,pr))this.texture=i,this.externalTexture=!0;else if(i){var a=i.wrapT,o=i.wrapS,s=i.minFilter,u=i.magFilter,h=i.internalFormat,l=i.format,c=void 0===l?Di.RGBA:l,f=i.type,d=void 0===f?Di.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:r,format:c,type:d,internalFormat:h||c,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:e.name},this.texture=pr.create(t,He({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Pi(t,[{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}}]),t}();exports.RenderPassDestroyAttachmentType=void 0,(Qa=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[Qa.force=0]="force",Qa[Qa.keep=1]="keep",Qa[Qa.keepExternal=2]="keepExternal",Qa[Qa.destroy=0]="destroy";var $a,to=1,eo=function(){function t(t){this.priority=0,this.name="RenderPass"+to++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var e=t.prototype;return e.addMesh=function(t){X(this.meshes,t)},e.removeMesh=function(t){p(this.meshes,t)},e.configure=function(t){},e.execute=function(t){},e.onCameraCleanup=function(t){},e.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]},e.dispose=function(t){if(!this.disposed){var e=(null==t?void 0:t.meshes)||void 0;e!==exports.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0,this.disposed=!0}},Pi(t,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),t}(),io=function(t){function e(e){var i;return(i=t.call(this,e)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}Vt(e,t);var i=e.prototype;return i.setup=function(t){this.useRenderTarget=t},i.configure=function(t){this.useRenderTarget&&(this.framebuffer=t.getTemporaryRT("DrawObjectPass",t.getWidth(),t.getHeight(),16,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf),t.setFramebuffer(this.framebuffer))},i.execute=function(t){this.useRenderTarget&&t.clear({colorAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear}),this.meshes.sort((function(t,e){return t.priority-e.priority})),t.renderMeshes(this.meshes)},i.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},e}(eo),ro=(($a={})[Di.FLOAT]=Float32Array.BYTES_PER_ELEMENT,$a[Di.INT]=Int32Array.BYTES_PER_ELEMENT,$a[Di.SHORT]=Int16Array.BYTES_PER_ELEMENT,$a[Di.BYTE]=Int8Array.BYTES_PER_ELEMENT,$a),no=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}Vt(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(Re);function ao(t){return t===Di.INT?new Int32Array(0):t===Di.SHORT?new Int16Array(0):new Float32Array(0)}var oo=1,so=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=void 0===o?"<unnamed>":o,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?wr.fromIdentity():l;r.id="Mesh"+oo++,r.name=s,r.geometry=a,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+oo++,r.name="<unnamed>",r.worldMatrix=wr.fromIdentity(),r._priority=0;return r}Vt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==exports.DestroyOptions.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},Pi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Hr),uo="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);}}",ho="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;}",lo="#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",co="#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;}}",fo="#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;}",po="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",mo="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);}",vo="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);}",yo="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);}",go="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);}",xo="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);}",bo={},To=function(){function t(){}return t.registerInclude=function(t,e){bo[t]&&tt.warn('The "'+t+'" shader include already exist.'),bo[t]=e},t.unRegisterInclude=function(t){delete bo[t]},t.unRegisterAllIncludes=function(){Object.keys(bo).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,a=e.macros,o=e.removeVersion,s=t.genMacroString(i,a),u=t.genShaderVersion(i),h=t.parseIncludes(n),l=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==i||l||(h=t.convertTo300(h,r===exports.ShaderType.fragment)),o?s+h:u+s+h},t.convertTo300=function(e,i){if(e=(e=(e=e.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(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=bo[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.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":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.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)},t}(),Eo=function(t){function e(e,i){var r;void 0===i&&(i=4),(r=t.call(this,e)||this).tempRTs=[],r.iterationCount=i;var n=r.renderer.engine;return r.thresholdMaterial=zr.create(n,{shader:{vertex:po,fragment:xo,glslVersion:exports.GLSLVersion.GLSL1}}),r.thresholdMaterial.blending=!1,r.thresholdMaterial.depthTest=!1,r.thresholdMaterial.culling=!1,r.downSampleHMaterial=zr.create(n,{shader:{vertex:po,fragment:vo,glslVersion:exports.GLSLVersion.GLSL1}}),r.downSampleHMaterial.blending=!1,r.downSampleHMaterial.depthTest=!1,r.downSampleHMaterial.culling=!1,r.downSampleVMaterial=zr.create(n,{shader:{vertex:po,fragment:yo,glslVersion:exports.GLSLVersion.GLSL1}}),r.downSampleVMaterial.blending=!1,r.downSampleVMaterial.depthTest=!1,r.downSampleVMaterial.culling=!1,r.upSampleMaterial=zr.create(n,{shader:{vertex:po,fragment:go,glslVersion:exports.GLSLVersion.GLSL1}}),r.upSampleMaterial.blending=!1,r.upSampleMaterial.depthTest=!1,r.upSampleMaterial.culling=!1,r.priority=5e3,r.name="BloomPass",r}Vt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},i.execute=function(t){var e,i,r,n=t.getWidth(),a=t.getHeight(),o=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.thresholdRT=t.getTemporaryRT("_BloomThreshold",n,a,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",o),t.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var s=this.thresholdRT.getColorTextures()[0],u=0;u<this.iterationCount;u++){var h=Math.floor(n/Math.pow(2,u+1)),l=Math.floor(a/Math.pow(2,u+1)),c=t.getTemporaryRT("_BloomDownH"+u,h,l,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",wo(s)),t.blit(s,c,this.downSampleHMaterial);var f=t.getTemporaryRT("_BloomDownV"+u,h,l,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",wo(c.getColorTextures()[0])),t.blit(c.getColorTextures()[0],f,this.downSampleVMaterial),t.releaseTemporaryRT(c),this.tempRTs.push(f),s=f.getColorTextures()[0]}t.releaseTemporaryRT(this.thresholdRT);for(var d=this.iterationCount-1;d>0;d--){var p=Math.floor(n/Math.pow(2,d-1)),m=Math.floor(a/Math.pow(2,d-1)),v=t.getTemporaryRT("_BloomUp"+d,p,m,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf),y=this.tempRTs[d-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",y),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",wo(y)),t.blit(s,v,this.upSampleMaterial),s=v.getColorTextures()[0],this.tempRTs.push(v)}t.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},i.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},i.dispose=function(e){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),t.prototype.dispose.call(this,e)},e}(eo),_o=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e)||this).renderer.engine;r.sceneTextureHandle=i||new Ja(a);var o=no.create(a,{name:n,mode:Di.TRIANGLE_STRIP,attributes:{aPos:{type:Di.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=zr.create(a,{name:n,shader:{vertex:po,fragment:mo,glslVersion:exports.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=so.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r.name="ToneMappingPass",r}Vt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear});var e=t.renderingData.currentFrame.globalVolume,i=He({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=He({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=He({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),a=He({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new _(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new S(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),t.renderMeshes([this.screenMesh])},e}(eo),So=1,Co=function(){function t(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=void 0===r?[1,1,0,0]:r,a=t.globalVolume,o=t.postProcessingEnabled,s=void 0!==o&&o,u=i.engine;if(a&&(this.globalVolume=a),this.postProcessingEnabled=s,this.globalUniforms=new Mo,this.renderer=i,s&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");this.drawObjectPass=new io(i);var h=[this.drawObjectPass];if(this.setRenderPasses(h),s){var l=new Ja(u),c=new Eo(i,7);c.sceneTextureHandle=l,this.addRenderPass(c);var f=new _o(i,l);this.addRenderPass(f)}this.name="RenderFrame"+So++,this.camera=e,this.editorTransform=C.fromArray(n)}var e=t.prototype;return e.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){var e=(null==t?void 0:t.passes)?t.passes:void 0;e!==exports.DestroyOptions.keep&&this.renderPasses.forEach((function(t){t.dispose(e)})),this.renderPasses.length=0,this.disposed=!0},e.setRenderPasses=function(t){this.renderPasses=t.slice()},e.addRenderPass=function(t){this.renderPasses.push(t)},e.removeRenderPass=function(t){p(this.renderPasses,t)},Pi(t,[{key:"isDisposed",get:function(){return this.disposed}}]),t}();function wo(t){return t?new _(t.getWidth(),t.getHeight()):new _}var Ao,Mo=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Po=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 Pi(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Io=function(){function t(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var e=t.prototype;return e.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))}},e.get=function(t,e,i,r,n,a){void 0===r&&(r=0),void 0===n&&(n=exports.FilterMode.Linear),void 0===a&&(a=exports.RenderTextureFormat.RGBA32);for(var o,s,u,h=e+"_"+i+"_"+r+"_"+n+"_"+a,l=_e(this.temporaryRTs);!(o=l()).done;){var c=o.value;if(!c.isOccupied&&c.descriptionHash===h)return c.isOccupied=!0,c.RT.name=t,c.RT}var f=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?s=Di.LINEAR:n===exports.FilterMode.Nearest&&(s=Di.NEAREST),a===exports.RenderTextureFormat.RGBA32?u=Di.UNSIGNED_BYTE:a===exports.RenderTextureFormat.RGBAHalf&&(u=Di.HALF_FLOAT),0===r?f=exports.RenderPassAttachmentStorageType.none:16===r?f=exports.RenderPassAttachmentStorageType.depth_stencil_opaque:24===r&&(f=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var d=pr.create(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:Di.RGBA,format:Di.RGBA,type:u}),p={RT:Ka.create({name:t,storeAction:{},viewport:[0,0,e,i],attachments:[d],depthStencilAttachment:{storageType:f}},this.engine.renderer),lastFrameReleased:0,descriptionHash:h,isOccupied:!0};return this.temporaryRTs.push(p),p.RT},e.release=function(t){for(var e,i=_e(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},e.dispose=function(){for(var t,e=_e(this.temporaryRTs);!(t=e()).done;){t.value.RT.dispose()}},t}(),Ro="function"==typeof e.WebGL2RenderingContext,Oo=function(){function t(t){this.setupCapability(t)}var i=t.prototype;return i.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},i.setupCapability=function(t){var i,r=Ro&&n(t,e.WebGL2RenderingContext)?2:1,a=2===r,o=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),s=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=a?"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"),s&&(this.UNSIGNED_INT_24_8=s.UNSIGNED_INT_24_8_WEBGL),a&&!u&&(u=No(t,t.HALF_FLOAT)),a&&!h&&(h=No(t,t.FLOAT)),this.internalFormatDepth16=a?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=a?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var l=a||t.getExtension("OES_texture_float")?t.FLOAT:0,c=a?e.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 f,d,p={floatTexture:l,halfFloatTexture:c,maxSample:a?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:a?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:a?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:o?t.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:a||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:a||!!t.getExtension("ANGLE_instanced_arrays"),ktx2Support:(f=this.compressTextureCapabilityList,d=f.get("WEBGL_compressed_texture_astc")||f.get("WEBKIT_WEBGL_compressed_texture_astc"),!!d),drawBuffers:a||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:a||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:a||!!s,writableFragDepth:a||!!t.getExtension("EXT_frag_depth")};this.detail=p,o&&(this.textureMaxAnisotropyExt=o.TEXTURE_MAX_ANISOTROPY_EXT)},i.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw new 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+".")},i.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){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)}else if(e.length>1)throw new Error("Draw buffers not available.")},i.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},Pi(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function No(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}exports.CompressTextureCapabilityType=void 0,(Ao=exports.CompressTextureCapabilityType||(exports.CompressTextureCapabilityType={})).astc="WEBGL_compressed_texture_astc",Ao.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",Ao.etc="WEBGL_compressed_texture_etc",Ao.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",Ao.etc1="WEBGL_compressed_texture_etc1",Ao.pvrtc="WEBGL_compressed_texture_pvrtc",Ao.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",Ao.sRGB="EXT_sRGB";var Lo,Fo=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.viewport(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,i=t,r=i.renderPasses;if(this.disposed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.engine.getShaderLibrary())||e.compileAllShaders(),i.setup(),this.setFramebuffer(null);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),j(r);for(var a,o=_e(r);!(a=o()).done;){var s=a.value;this.renderRenderPass(s)}for(var u,h=_e(r);!(u=h()).done;){u.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=_e(t);!(e=i()).done;){e.value.render(this)}},e.drawGeometry=function(t,e,i,r){void 0===r&&(r=0),this.engine.drawGeometry(t,e,i,r)},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){this.blitGeometry||(this.blitGeometry=no.create(this.engine,{mode:Di.TRIANGLE_STRIP,attributes:{aPos:{type:Di.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4})),this.blitMaterial||(this.blitMaterial=zr.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 r=i||this.blitMaterial;r.setTexture("_MainTex",t);var n=this.currentFramebuffer;if(e){var a=e.viewport,o=a[0],s=a[1],u=a[2],h=a[3];this.setFramebuffer(e),this.setViewport(o,s,u,h)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,wr.IDENTITY,r),this.setFramebuffer(n)},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)},Pi(t,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),t}(),Vo=function(){function t(t){this.engine=t,this.graphicsPath=new Ua,this.vertices=[],this.colors=[],this.indices=[],this.lineStyle={width:1,alignment:.5,cap:ue.Butt,join:he.Miter,miterLimit:10},this.transformStack=[],this.currentTransform=Mr.fromIdentity(),this.geometry=no.create(this.engine,{attributes:{aPos:{type:Di.FLOAT,size:2,data:new Float32Array([-.5,.5,-.5,-.5,.5,.5,.5,-.5])},aColor:{type:Di.FLOAT,size:4,data:new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6}),this.material=zr.create(this.engine,{shader:{vertex:"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 mediump float;\n varying vec4 vColor;\n void main() {\n vec4 color = vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.material.depthTest=!1,this.material.depthMask=!1,this.material.blending=!0}var e=t.prototype;return e.begin=function(){this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.transformStack=[],this.currentTransform=Mr.fromIdentity();var t=this.engine.canvas.getBoundingClientRect(),e=t.width,i=t.height,r=new wr(2/e,0,0,0,0,2/i,0,0,0,0,-1,0,-1,-1,0,1);this.material.setMatrix("effects_MatrixVP",r)},e.pushTransform=function(t){this.transformStack.push(this.currentTransform.clone()),this.currentTransform=this.currentTransform.premultiply(t)},e.popTransform=function(){var t=this.transformStack.pop();t?this.currentTransform=t:console.warn("Render2D: 变换栈为空,无法弹出")},e.end=function(){if(0!==this.currentVertexCount&&0!==this.currentIndexCount){var t=new Float32Array(this.vertices),e=new Float32Array(this.colors),i=new Uint16Array(this.indices);this.geometry.setAttributeData("aPos",t),this.geometry.setAttributeData("aColor",e),this.geometry.setIndexData(i),this.geometry.setDrawCount(this.currentIndexCount),this.engine.renderer.drawGeometry(this.geometry,wr.IDENTITY,this.material)}},e.drawLines=function(t,e,i){if(void 0===e&&(e=w.WHITE),void 0===i&&(i=1),!t||t.length<4||t.length%2!=0)console.warn("drawLines: 至少需要2个点(4个数值), 且数组长度必须为偶数");else{var r=t.length/2,n=t[0]===t[t.length-2]&&t[1]===t[t.length-1],a=n?r-1:r;this.graphicsPath.clear(),this.graphicsPath.moveTo(t[0],t[1]);for(var o=1;o<a;o++)this.graphicsPath.lineTo(t[2*o],t[2*o+1]);this.buildShapeLine(this.graphicsPath.shapePath,e,i,n)}},e.drawLine=function(t,e,i,r,n,a){void 0===n&&(n=w.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.lineTo(i,r),this.buildShapeLine(this.graphicsPath.shapePath,n,a,closed)},e.drawBezier=function(t,e,i,r,n,a,o,s,u,h){void 0===u&&(u=w.WHITE),void 0===h&&(h=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.bezierCurveTo(i,r,n,a,o,s),this.buildShapeLine(this.graphicsPath.shapePath,u,h,!1)},e.drawTriangle=function(t,e,i,r,n,a,o,s){void 0===o&&(o=w.WHITE),void 0===s&&(s=1),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShapeLine(this.graphicsPath.shapePath,o,s,!0)},e.drawRectangle=function(t,e,i,r,n,a){void 0===n&&(n=w.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShapeLine(this.graphicsPath.shapePath,n,a,!0)},e.drawCircle=function(t,e,i,r,n){void 0===r&&(r=w.WHITE),void 0===n&&(n=1),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShapeLine(this.graphicsPath.shapePath,r,n,!0)},e.fillTriangle=function(t,e,i,r,n,a,o){void 0===o&&(o=w.WHITE),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShape(this.graphicsPath.shapePath,o)},e.fillRectangle=function(t,e,i,r,n){void 0===n&&(n=w.WHITE),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShape(this.graphicsPath.shapePath,n)},e.fillCircle=function(t,e,i,r){void 0===r&&(r=w.WHITE),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShape(this.graphicsPath.shapePath,r)},e.dispose=function(){this.geometry.dispose(),this.material.dispose()},e.buildShape=function(t,e){for(var i,r=_e(t.shapePrimitives);!(i=r()).done;){var n=i.value.shape,a=[],o=this.indices.length,s=this.vertices.length/2;n.build(a),n.triangulate(a,this.vertices,s,this.indices,o),this.applyTransformAndColor(s,this.vertices.length/2-s,e)}},e.buildShapeLine=function(t,e,i,r){void 0===r&&(r=!1);for(var n,a=_e(t.shapePrimitives);!(n=a()).done;){var o=n.value.shape,s=[];this.indices.length;var u=this.vertices.length/2;o.build(s),this.lineStyle.width=i,Ea(s,this.lineStyle,!1,r,this.vertices,0,0,this.indices),this.applyTransformAndColor(u,this.vertices.length/2-u,e)}},e.applyTransformAndColor=function(t,e,i){for(var r=0;r<e;r++){var n=2*(t+r),a=4*(t+r);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}},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]},Pi(t,[{key:"currentVertexCount",get:function(){return this.vertices.length/2}},{key:"currentIndexCount",get:function(){return this.indices.length}}]),t}(),ko=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i._color=new w(1,1,1,1),i.getHitTestParams=function(t){var e=wr.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===_t.FRONT,clipMasks:i.frameClipMasks}}},i.renderer={renderMode:It.MESH,blending:Et.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:_t.DOUBLE,mask:0},i.defaultGeometry=no.create(i.engine,{attributes:{aPos:{type:Di.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=zr.create(i.engine,{shader:{fragment:ho,vertex:uo,shared:!0}});return i.material=r,i.material.setColor("_Color",new w(1,1,1,1)),i.configureMaterial(i.renderer),i}Vt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){n(t,w)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return r((function(){var i;return o(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,pr.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!==It.BILLBOARD&&this.renderer.renderMode!==It.VERTICAL_BILLBOARD&&this.renderer.renderMode!==It.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("aPos");if(t){var e=Tn(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.maskManager.maskMode,o=this.material;o.blending=!0,o.depthTest=!0,o.depthMask=i,Wi(o,r),Hi(o,e),o.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',o.setVector4("_TexOffset",new C(0,0,1,1)),o.setTexture("_MainTex",n);var s=Xi(r),u=new C;return u.x=t.occlusion?+t.transparentOcclusion:1,u.y=s,u.z=t.renderMode,u.w=a,o.setVector4("_TexParams",u),0===u.x||this.maskManager.alphaMaskEnabled?o.enableMacro("ALPHA_CLIP"):o.disableMacro("ALPHA_CLIP"),o},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){var i;t.prototype.fromData.call(this,e);var 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:It.MESH,blending:null!=(n=o.blending)?n:Et.ALPHA,texture:o.texture?this.engine.findObject(o.texture):this.engine.whiteTexture,occlusion:!!o.occlusion,transparentOcclusion:!!o.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(a=o.side)?a:_t.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},Pi(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Hr);function Do(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 zo(t){return zo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},zo(t)}function Bo(t){var e="function"==typeof Map?new Map:void 0;return Bo=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new 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,r)}function r(){return ra(t,arguments,zo(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ft(r,t)},Bo(t)}exports.TexturePaintScaleMode=void 0,function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(exports.TexturePaintScaleMode||(exports.TexturePaintScaleMode={})),exports.ShapeComponent=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new Ua,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:ue.Butt,join:he.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=ue.Butt,i.strokeJoin=he.Miter,i.strokes=[],i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=wr.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===_t.FRONT,clipMasks:i.frameClipMasks}}},i.rendererOptions={renderMode:It.MESH,blending:Et.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:_t.DOUBLE,mask:0};var r={type:ae.Solid,color:new w(1,1,1,1)};i.strokes.push(r);var n={type:ae.Solid,color:new w(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:se.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=no.create(i.engine,{attributes:{aPos:{type:Di.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}Vt(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){if(this.shapeDirty){var e=this.computeScreenScale();this.buildPath(this.shapeAttributes,e),this.buildGeometryFromPath(this.graphicsPath.shapePath,e),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},i.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)}},i.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)},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("aPos");if(t){var e=Tn(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.buildGeometryFromPath=function(t,e){var i=t.shapePrimitives,r=[],n=[];if(this.fills.length>0)for(var a,o=_e(i);!(a=o()).done;){var s=a.value.shape,u=[],h=n.length,l=r.length/2;s.build(u,e),s.triangulate(u,r,l,n,h)}var c=n.length;if(this.strokes.length>0)for(var f,d=_e(i);!(f=d()).done;){var p=f.value.shape,m=[],v=this.strokeAttributes;v.cap=this.strokeCap,v.join=this.strokeJoin,v.width=this.strokeWidth;var y=!0;this.shapeAttributes.type===se.Custom&&(y=p.closePath),p.build(m,e),Ea(m,v,!1,y,r,0,0,n)}var g=n.length-c,x=r.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<n.length)&&(E=new Uint16Array(n.length));for(var _=Number.MAX_VALUE,S=Number.MAX_VALUE,C=Number.MIN_VALUE,w=Number.MIN_VALUE,A=0;A<x;A++){var M=3*A,P=2*A,I=r[P],R=r[P+1];b[M]=I,b[M+1]=R,b[M+2]=0,_=Math.min(_,I),S=Math.min(S,R),C=Math.max(C,I),w=Math.max(w,R)}for(var O=C-_,N=w-S,L=0;L<x;L++){var F=3*L,V=2*L;T[V]=(b[F]-_)/O,T[V+1]=(b[F+1]-S)/N}E.set(n),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(n.length);var k=this.geometry.subMeshes[0],D=this.geometry.subMeshes[1];k.indexCount=c,D.offset=2*c,D.indexCount=g},i.computeScreenScale=function(){var t=this.item.composition;if(!t)return 1;var i=t.camera;if(!i)return 1;var r=i.getModelViewProjection(e.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=Math.max(a,o),u=this.engine.canvas.getBoundingClientRect(),h=s*(Math.max(u.width,u.height)/2)*this.engine.pixelRatio;return Math.max(1,Math.min(2e3,h))},i.buildPath=function(t,e){void 0===e&&(e=1),this.graphicsPath.clear();var i=e;switch(t.type){case se.Custom:for(var r,n=this.shapeAttributes,a=n.points,o=n.easingIns,s=n.easingOuts,u=_e(n.shapes);!(r=u()).done;){var h=r.value,l=h.indexes,c=a[l[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var f=1;f<l.length;f++){var d=l[f],p=l[f-1],m=a[d.point],v=a[p.point],y=s[p.easingOut],g=o[d.easingIn];this.graphicsPath.bezierCurveTo(y.x+v.x,y.y+v.y,g.x+m.x,g.y+m.y,m.x,m.y,void 0,i)}if(h.close){var x=l[0],b=l[l.length-1],T=a[x.point],E=a[b.point],_=s[b.easingOut],S=o[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,S.x+T.x,S.y+T.y,T.x,T.y,void 0,i),this.graphicsPath.closePath()}}break;case se.Ellipse:var C=t;this.graphicsPath.ellipse(0,0,C.xRadius,C.yRadius);break;case se.Rectangle:var w=t;this.graphicsPath.rect(-w.width/2,-w.height/2,w.width,w.height,w.roundness);break;case se.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,exports.StarType.Star);break;case se.Polygon:var M=t;this.graphicsPath.polyStar(M.pointCount,M.radius,M.radius,M.roundness,M.roundness,exports.StarType.Polygon)}},i.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])},i.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===ae.Solid)t.color=e.color;else if(e.type===ae.GradientLinear||e.type===ae.GradientAngular||e.type===ae.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===ae.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new _(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new _(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 Mr).scale(a.scale.x,a.scale.y).rotate(a.rotation).translate(a.offset.x,a.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,a=[],o=[],s=_e(e.stops);!(n=s()).done;){var u=n.value,h=u.color;a.push(new C(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)},i.createMaterialFromRendererOptions=function(t){var e={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:exports.GLSLVersion.GLSL1}},i=zr.create(this.engine,e),r=t,n=r.side,a=r.occlusion,o=r.blending,s=r.texture,u=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=a,Wi(i,o),Hi(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new C(0,0,1,1)),i.setTexture("_ImageTex",s);var h=Xi(o),l=new C;return l.x=r.occlusion?+r.transparentOcclusion:1,l.y=h,l.z=r.renderMode,l.w=u,i.setVector4("_TexParams",l),0===l.x||this.maskManager.alphaMaskEnabled?i.enableMacro("ALPHA_CLIP"):i.disableMacro("ALPHA_CLIP"),i},i.fromData=function(e){var i;t.prototype.fromData.call(this,e),this.shapeDirty=!0,e.mask&&this.maskManager.setMaskOptions(this.engine,e.mask);var r,n,a,o,s,u=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:It.MESH,blending:null!=(r=u.blending)?r:Et.ALPHA,texture:u.texture?this.engine.findObject(u.texture):this.engine.whiteTexture,occlusion:!!u.occlusion,transparentOcclusion:!!u.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(n=u.side)?n:_t.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(a=e.strokeCap)?a:ue.Butt,this.strokeWidth=null!=(o=e.strokeWidth)?o:1,this.strokeJoin=null!=(s=e.strokeJoin)?s:he.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var h,l=_e(e.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=_e(e.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),e.type){case se.Custom:for(var m,v=e,y={type:se.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},g=_e(v.points);!(m=g()).done;){var x=m.value;y.points.push(new _(x.x,x.y))}for(var b,T=_e(v.easingIns);!(b=T()).done;){var E=b.value;y.easingIns.push(new _(E.x,E.y))}for(var S,C=_e(v.easingOuts);!(S=C()).done;){var w=S.value;y.easingOuts.push(new _(w.x,w.y))}y.shapes=v.shapes,this.shapeAttributes=y;break;case se.Ellipse:var A=e,M={type:se.Ellipse,xRadius:A.xRadius,yRadius:A.yRadius};this.shapeAttributes=M;break;case se.Rectangle:var P=e,I={type:se.Rectangle,width:P.width,height:P.height,roundness:P.roundness};this.shapeAttributes=I;break;case se.Star:var R=e,O={type:se.Star,pointCount:R.pointCount,innerRadius:R.innerRadius,outerRadius:R.outerRadius,innerRoundness:R.innerRoundness,outerRoundness:R.outerRoundness};this.shapeAttributes=O;break;case se.Polygon:var N=e,L={type:se.Polygon,pointCount:N.pointCount,radius:N.radius,roundness:N.roundness};this.shapeAttributes=L}},i.createPaint=function(t){var e;switch(t.type){case ae.Solid:e={type:t.type,color:(new w).copyFrom(t.color)};break;case ae.GradientLinear:case ae.GradientAngular:case ae.GradientRadial:e={type:t.type,gradientStops:pa(t.gradientStops),startPoint:(new _).copyFrom(t.startPoint),endPoint:(new _).copyFrom(t.endPoint)};break;case ae.Texture:var i,r,n,a=He({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 _).copyFrom(a.offset),rotation:a.rotation,scale:(new _).copyFrom(a.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},Pi(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Hr),exports.ShapeComponent.tempMVP=wr.fromIdentity(),exports.ShapeComponent=a([Me("ShapeComponent")],exports.ShapeComponent),exports.Fake3DComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}Vt(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},i.onUpdate=function(t){this.updateFake3D()},i.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)}},e}(Ii),a([Pe()],exports.Fake3DComponent.prototype,"loop",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),a([Pe()],exports.Fake3DComponent.prototype,"animationLength",void 0),a([Pe()],exports.Fake3DComponent.prototype,"mode",void 0),a([Pe()],exports.Fake3DComponent.prototype,"startPositionX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"startPositionY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),a([Pe()],exports.Fake3DComponent.prototype,"endPositionX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"endPositionY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),a([Pe()],exports.Fake3DComponent.prototype,"phaseX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"phaseY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=a([Me("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(Lo=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[Lo.Circular=0]="Circular",Lo[Lo.Linear=1]="Linear",exports.FrameComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).color=new w(1,1,1,1),e.worldMatrix=new wr,e.getHitTestParams=function(t){var i=wr.fromScale(e.transform.size.x,e.transform.size.y,1).premultiply(e.transform.getWorldMatrix());if(t){e.boundingBoxInfo.setGeometry(e.clipGeometry,i);var r=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:e.frameClipMasks}}},e}Vt(e,t);var i=e.prototype;return i.onAwake=function(){this.clipGeometry=no.create(this.engine,{attributes:{aPos:{type:Di.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6});var t=zr.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}});t.depthTest=!0,t.depthMask=!1,t.setColor("_Color",this.color),this.material=t},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),Do(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},i.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},i.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),Do(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.color&&this.color.copyFrom(e.color)},i.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},i.setClipRectangleRecursive=function(t){for(var e,i=_e(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(Hr);n&&d(n.frameClipMasks,this),this.setClipRectangleRecursive(r)}},e}(Hr),exports.FrameComponent=a([Me("FrameComponent")],exports.FrameComponent),exports.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}Vt(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}(Ii),exports.CameraController=a([Me(pe.CameraController)],exports.CameraController);var Uo,Go=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),jo="click",Xo="touchstart",Wo="touchmove",Ho="touchend";exports.PointerEventType=void 0,(Uo=exports.PointerEventType||(exports.PointerEventType={}))[Uo.PointerDown=0]="PointerDown",Uo[Uo.PointerUp=1]="PointerUp",Uo[Uo.PointerMove=2]="PointerMove";var Yo=function(){function t(t,e){void 0===e&&(e=!1),this.engine=t,this.allowPropagation=e,this.enabled=!0,this.skipPointerMovePicking=!0,this.handlers={},this.nativeHandlers={},this.target=null}var i=t.prototype;return i.bindListeners=function(t){var i,r,n,a,o,s=this;this.target=t,o=function(t){return t};var u,h="mousedown",l="mousemove",c="mouseup",f="mouseleave",d=function(t,i,r,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var u=0,h=0,l=e.performance.now();if(!s.target)return tt.warn("Trigger TouchEvent after EventSystem is disposed."),{x:i,y:r,vx:0,vy:h,dx:n,dy:o,ts:l,width:0,height:0,origin:t};var c=s.target,f=c.width,d=c.height;if(a){var p=l-a.ts;u=(n-a.dx)/p||0,h=(o-a.dy)/p||0,a={dx:n,dy:o,ts:l}}return{x:i,y:r,vx:u,vy:h,dx:n,dy:o,ts:l,width:f,height:d,origin:t}};D()&&(o=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},h="touchstart",l="touchmove",c="touchend",f="touchcancel"),this.nativeHandlers=((u={})[h]=function(t){if(s.enabled){var u=o(t),h=Zo(u);i=h.x,r=h.y,a=n={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:i,y:r},s.dispatchEvent(Xo,d(t,i,r))}},u[l]=function(t){if(n&&s.enabled){var e=Zo(o(t));i=e.x,r=e.y,s.dispatchEvent(Wo,d(t,i,r,i-n.x,r-n.y))}},u[c]=function(t){if(n&&s.enabled){!s.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var e=o(t),a=Zo(e),u=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY);i=a.x,r=a.y,u<4&&s.dispatchEvent(jo,d(t,i,r)),s.dispatchEvent(Ho,d(t,i,r,i-n.x,r-n.y))}n=0},u),this.nativeHandlers[f]=this.nativeHandlers[c],Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=s.target)||e.addEventListener(String(t),s.nativeHandlers[t])})),this.addEventListener(jo,this.onClick.bind(this)),this.addEventListener(Xo,this.onPointerDown.bind(this)),this.addEventListener(Ho,this.onPointerUp.bind(this)),this.addEventListener(Wo,this.onPointerMove.bind(this))},i.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},i.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),d(i,e),function(){p(i,e)}},i.removeEventListener=function(t,e){var i=this.handlers[t];i&&p(i,e)},i.onClick=function(t){for(var e,i=t.x,r=t.y,n=[],a=_e(this.engine.compositions);!(e=a()).done;){var o,s=e.value;(o=n).push.apply(o,[].concat(s.hitTest(i,r)))}for(var u,h=_e(n);!(u=h()).done;){var l=u.value,c=l.item.composition;if(c){var f=He({},l,{compositionId:c.id,compositionName:c.name});l.item.emit("click",l),c.emit("click",f),this.engine.emit("click",f)}}},i.onPointerDown=function(t){this.handlePointerEvent(t,0)},i.onPointerUp=function(t){this.handlePointerEvent(t,1)},i.onPointerMove=function(t){this.handlePointerEvent(t,2)},i.handlePointerEvent=function(t,e){var i=null,r=t.x,n=t.y,a=t.width,o=t.height;if(2!==e||!this.skipPointerMovePicking)for(var s,u=_e(this.engine.compositions);!(s=u()).done;){var h=s.value.hitTest(r,n);h.length>0&&(i=h[h.length-1])}var l=new Gr;l.position.x=(r+1)/2*a,l.position.y=(n+1)/2*o,l.delta.x=t.vx*a,l.delta.y=t.vy*o;var c=l.pointerCurrentRaycast;i&&(c.point=i.position,c.item=i.item);var f="pointerdown";switch(e){case 0:f="pointerdown";break;case 1:f="pointerup";break;case 2:f="pointermove"}if(i){var d=i.item,p=d.composition;d.emit(f,l),p.emit(f,l),this.engine.emit(f,l)}},i.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={})},t}();function Zo(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var qo=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),Ko=1,Qo=function(){function t(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 e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new S,n=new Ke,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)},e.createMaterial=function(){var t=[["ENV_EDITOR",this.engine.env===qr]],e=pa(this.color).getValue(0),i={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n}\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:exports.GLSLVersion.GLSL1,macros:t}},r=zr.create(this.engine,i);return r.blending=!0,r.depthTest=!1,r.setVector4("uPos",new C(0,0,0,0)),r.setVector2("uSize",new _(1,1)),r.setVector4("uColor",new C(e[0]/255,e[1]/255,e[2]/255,e[3])),r.setQuaternion("uQuat",new Ke(0,0,0,0)),r},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return no.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:Di.LINES,maxVertex:4})},e.createMesh=function(t,e){return so.create(this.engine,{name:"Interact_preview"+Ko++,priority:0,worldMatrix:wr.fromIdentity(),geometry:t,material:e})},t}();function Jo(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i,clipMasks:e.frameClipMasks}:void 0}},e}Vt(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===At.CLICK&&(this.clickable=!0,r&&t===qr&&(this.previewContent=new Qo(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},i.onDisable=function(){t.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())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.env;if(e===At.CLICK)this.clickable=!0;else if(e===At.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==qr||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},i.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,Jo(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.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=s*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=a[0]-this.dragRatio[0]*f,y=a[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=E(v,g,x),y=E(y,b,T),v!==g&&v!==x&&g!==x)null==(i=e.origin)||i.preventDefault();if(y!==b&&y!==T&&b!==T)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new S(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,a={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){r.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!Jo(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=He({},n)),n=null}}};Object.keys(a).forEach((function(t){i.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(a).forEach((function(t){i.removeEventListener(t,a[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=gn(S.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===At.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,a=0;if("number"==typeof e)i=e,r=e,n=e,a=e;else if(rt(e)){var o,s,u,h,l;i=void 0===(s=(o=e)[0])?0:s,r=void 0===(u=o[1])?0:u,n=void 0===(h=o[2])?0:h,a=void 0===(l=o[3])?0:l}if(t.x<a-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},Pi(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Hr),exports.InteractComponent=a([Me(pe.InteractComponent)],exports.InteractComponent);var $o,ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return Vt(e,t),e}(Bo(Lt)),es=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(){if(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}(),is=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}(),rs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Re);exports.PlayState=void 0,($o=exports.PlayState||(exports.PlayState={}))[$o.Playing=0]="Playing",$o[$o.Paused=1]="Paused",$o[$o.Stopped=2]="Stopped";var ns=[1,1,1,1],as=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}Vt(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(n(e,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var a=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");a&&(this.startColor=a.toArray())}var o,s,u,h=dn(ns,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,f=this.colorOverLifetime;if(f&&(h=M(f,l,!0),o=!0),c&&(h[3]*=c.getValue(l),o=!0),o)pn(this.renderColor,h,this.startColor),null==(u=this.activeMaterial)||null==(s=u.getColor("_Color"))||s.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=pa(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===Dt.GRADIENT_COLOR&&(this.colorOverLifetime=P(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(ko)},e}(es),os=function(){function t(){}return t.prototype.onEvent=function(t,e){},t}(),ss=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.onEvent=function(t,e){t.emit("animationevent",e)},e}(Bo(os));exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e.events=[],e}Vt(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=E(e,0,this.duration),n=_e(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=_e(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=_e(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=_e(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),_=this.findTarget(t,b.path);null==_||_.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=_e(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:pa(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var o,s=_e(t.rotationCurves);!(o=s()).done;){var u=o.value,h={path:u.path,keyFrames:pa(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=_e(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:pa(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=_e(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:pa(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=_e(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:pa(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=_e(t.colorCurves);!(E=_()).done;){var S=E.value,C={path:S.path,keyFrames:pa(S.keyFrames),property:S.property,className:S.className};e=Math.max(e,C.keyFrames.getMaxTime()),this.colorCurves.push(C)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var w,A=_e(t.events);!(w=A()).done;){var M,P=w.value,I={name:P.name,startTime:P.startTime,duration:null!=(M=P.duration)?M:0,event:new ss};this.events.push(I)}},i.findTarget=function(t,e){for(var i,r=t,n=_e(e.split("."));!(i=n()).done;){for(var a,o=i.value,s=!1,u=_e(r.children);!(a=u()).done;){var h=a.value;if(h.name===o){r=h,s=!0;break}}if(!s)return}return r},e}(Re),exports.AnimationClip=a([Me(pe.AnimationClip)],exports.AnimationClip);var us=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}Vt(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=_e(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(n(t,es)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}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}(es),hs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(n(e,exports.VFXItem)){for(var i=e,r=!1,a=0;a<this.clipPlayables.length;a++)if(this.getClipWeight(a)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(us),ls=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();n(e,exports.VFXItem)&&(e.time=this.time)},e}(es),cs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(es),fs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}Vt(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 a=this.getClipWeight(r);if(a>0){var o=this.getClipPlayable(r);if(!n(o,cs)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=o.value;this.addWeightedValue(s,a),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,n(e,Ii)&&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}(us),ds=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),ps=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(fs),ms=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){},e}(us),vs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){},e}(us),ys=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();n(e,exports.CompositionComponent)&&e.tick(this.getTime()-e.getTime())},e}(es),gs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(n(e,exports.CompositionComponent)){for(var i=e,r=!1,a=0;a<this.clipPlayables.length;a++)if(this.getClipWeight(a)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(us),xs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){},e}(us),bs=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),Ts=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),Es=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),_s=new Ar,Ss=new S(1,1,1),Cs=new S,ws=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new S(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=pa(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&pa(r.linearX),y:r.linearY&&pa(r.linearY),z:r.linearZ&&pa(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&pa(r.orbitalX),y:r.orbitalY&&pa(r.orbitalY),z:r.orbitalZ&&pa(r.orbitalZ),center:fn(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&pa(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=pa(a.x||1),this.sizeYOverLifetime=pa(a.y||1),this.sizeZOverLifetime=pa(a.z||1)):this.sizeXOverLifetime=pa(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:pa(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=pa(n.x||0),u.y=pa(n.y||0)}this.gravity=S.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=pa(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?S.fromArray(r.direction).normalize():new S,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();n(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=this.getDuration(),r=this.time/i;if(r=r<0?0:r,this.sizeXOverLifetime){Ss.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Ss.y=this.sizeYOverLifetime.getValue(r),Ss.z=this.sizeZOverLifetime.getValue(r)):Ss.z=Ss.y=Ss.x;var n=this.originalTransform.scale;e.transform.setScale(Ss.x*n.x,Ss.y*n.y,Ss.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;_s.x=s?a(this.rotationOverLifetime.x):0,_s.y=s?a(this.rotationOverLifetime.y):0,_s.z=o;var u=_s.addEulers(this.originalTransform.rotation,_s);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Cs;cn(h,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(h.x,h.y,h.z)}},e}(es);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new ws;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(rs),exports.TransformPlayableAsset=a([Me(pe.TransformPlayableAsset)],exports.TransformPlayableAsset);var As,Ms=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===Bt.restart?e%=i:this.endBehavior===Bt.freeze&&(e=Math.min(i,e))),e},t}();exports.TrackAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}Vt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new us},i.createOutput=function(){return new is},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=_e(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=_e(t);!(i=n()).done;){var a=i.value,o=this.createClipPlayable(a);o.setDuration(a.duration);var s=new Ps(a,o,r);e.push(s),r.clipPlayables.push(o),r.setClipWeight(o,0)}return r},i.createPlayable=function(){return new es},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 Ms;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=_e(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=_e(this.children);!(i=r()).done;){i.value.parent=this}},e}(rs),a([Pe(Ms)],exports.TrackAsset.prototype,"clips",void 0),a([Pe()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=a([Me(pe.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(As=exports.TrackType||(exports.TrackType={}))[As.MasterTrack=0]="MasterTrack",As[As.ObjectTrack=1]="ObjectTrack";var Ps=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1;t>=e.start+e.duration&&e.endBehavior===Bt.destroy?(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==exports.PlayState.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var a=e.toLocalTime(t);this.playable.setTime(a),r&&this.playable.getPlayState()===exports.PlayState.Playing&&this.playable.pause()},Pi(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}();exports.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new hs},e}(exports.TrackAsset),exports.ActivationTrack=a([Me(pe.ActivationTrack)],exports.ActivationTrack);var Is=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return Vt(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(exports.TrackAsset);a([Pe()],Is.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new ps;return t.propertyPath=this.path,t},e}(Is),exports.FloatPropertyTrack=a([Me(pe.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new vs},e}(exports.TrackAsset),exports.SpriteColorTrack=a([Me(pe.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!n(t,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(exports.CompositionComponent)},i.createTrackMixer=function(){return new gs},e}(exports.TrackAsset),exports.SubCompositionTrack=a([Me(pe.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new xs},e}(exports.TrackAsset),exports.TransformTrack=a([Me(pe.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.updateAnimatedObject=function(t){if(!n(t,Hr))throw new Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw new Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(exports.TrackAsset),a([Pe()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=a([Me("MaterialTrack")],exports.MaterialTrack);var Rs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new ms},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new bs;return t.propertyPath=this.path,t},e}(Is),exports.Vector4PropertyTrack=a([Me(pe.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector3PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new Ts;return t.propertyPath=this.path,t},e}(Is),exports.Vector3PropertyTrack=a([Me(pe.Vector3PropertyTrack)],exports.Vector3PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new Es;return t.propertyPath=this.path,t},e}(Is),exports.Vector2PropertyTrack=a([Me(pe.Vector2PropertyTrack)],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new ds;return t.propertyPath=this.path,t},e}(Is),exports.ColorPropertyTrack=a([Me(pe.ColorPropertyTrack)],exports.ColorPropertyTrack);var Os=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=Ns(this.arc,this.arcMode,t)*y,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new S(i,r,0),a=Math.tan(this.angle*y),o=n.clone().multiply(a);return o.z+=1,{position:n.multiply(ht(0,1)),direction:o.normalize()}},t}();function Ns(t,e,i){if(e===Gt.RANDOM)t=ht(0,t);else if(e===Gt.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===Gt.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===Gt.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var Ls,Fs=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=Ns(this.arc,this.arcMode,t)*y,i=new S(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),Vs=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=ht(-this._d,this._d),i=ht(-this._h,this._h);return{direction:new S(0,0,1),position:new S(e,i,0)}},t}(),ks=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=Ns(this.arc,this.arcMode,t)*y,i=new S(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new S;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}(),Ds=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Gt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):ht(0,1);return{direction:new S(0,1,0),position:new S(this._d*(e-.5),0,0)}},t}(),zs=new wr,Bs=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=ht(0,2*Math.PI),n=Ns(this.arc,this.arcMode,t)*y,a=zs.setFromRotationZ(n),o=new S(Math.cos(r),Math.sin(r),0),s=new S(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),Us=new wr,Gs=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 ht(-90,90)},e.generate=function(t){var e=Ns(this.arc,this.arcMode,t)*y,i=this.getHorizontalAngle()*y,r=this.radius,n=new S(Math.cos(i),0,Math.sin(i)),a=Us.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),js=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.getHorizontalAngle=function(){return ht(0,90)},e}(Gs),Xs=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=E(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(Ns(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,a=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,o=new S(n,a,0);return{position:new S(n*this.width,a*this.height,0),direction:o.normalize()}},t}(),Ws=function(){function t(){}return t.prototype.generate=function(){return{position:new S,direction:new S}},t}(),Hs=((Ls={})[Ct.NONE]=Ws,Ls[Ct.CONE]=Os,Ls[Ct.SPHERE]=Gs,Ls[Ct.HEMISPHERE]=js,Ls[Ct.CIRCLE]=Fs,Ls[Ct.DONUT]=Bs,Ls[Ct.RECTANGLE]=Vs,Ls[Ct.EDGE]=Ds,Ls[Ct.RECTANGLE_EDGE]=ks,Ls[Ct.TEXTURE]=Xs,Ls);function Ys(t){if(!t)return new Ws;var e=He({radius:1,arc:360,angle:0,arcMode:Gt.RANDOM},t),i=t.type,r=Hs[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==Ct.NONE){var a=t.alignSpeedDirection,o=t.upDirection,s=void 0===o?[0,0,1]:o;n.alignSpeedDirection=a,n.upDirection=S.fromArray(s).normalize()}return n}function Zs(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=fu(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=fu(a,t[a],t[a+1],o);return o&&ou(o,o.next)&&(du(o),o=o.next),o}function qs(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!ou(r,r.next)&&0!==au(r.prev,r,r.next))r=r.next;else{if(du(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Ks(t){var e=t.prev,i=t,r=t.next;if(au(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(ru(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&au(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Qs(t,e,i,r){var n=t.prev,a=t,o=t.next;if(au(n,a,o)>=0)return!1;for(var s=n.x<a.x?n.x<o.x?n.x:o.x:a.x<o.x?a.x:o.x,u=n.y<a.y?n.y<o.y?n.y:o.y:a.y<o.y?a.y:o.y,h=n.x>a.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,l=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,c=eu(s,u,e,i,r),f=eu(h,l,e,i,r),d=t.prevZ,p=t.nextZ;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&au(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&au(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&au(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&au(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Js(t,e){return t.x-e.x}function $s(t,e){if(e=function(t,e){var i,r=e,n=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o){if(o=s,s===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===o)return i;var u,h=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&ru(a<c?n:o,a,l,c,a<c?o:n,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(n-r.x),lu(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&tu(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=cu(e,t);qs(e,e.next),qs(i,i.next)}}function tu(t,e){return au(t.prev,t,e.prev)<0&&au(e.next,t,t.next)<0}function eu(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function iu(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}function ru(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 nu(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&su(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(lu(t,e)&&lu(e,t)&&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}(t,e)&&(au(t.prev,t,e.prev)||au(t,e.prev,e))||ou(t,e)&&au(t.prev,t,t.next)>0&&au(e.prev,e,e.next)>0)}function au(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ou(t,e){return t.x===e.x&&t.y===e.y}function su(t,e,i,r){var n=hu(au(t,e,i)),a=hu(au(t,e,r)),o=hu(au(i,r,t)),s=hu(au(i,r,e));return n!==a&&o!==s||(!(0!==n||!uu(t,i,e))||(!(0!==a||!uu(t,r,e))||(!(0!==o||!uu(i,t,r))||!(0!==s||!uu(i,e,r)))))}function uu(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 hu(t){return t>0?1:t<0?-1:0}function lu(t,e){return au(t.prev,t,t.next)<0?au(t,e,t.next)>=0&&au(t,t.prev,e)>=0:au(t,e,t.prev)<0||au(t,t.next,e)<0}function cu(t,e){var i=new pu(t.i,t.x,t.y),r=new pu(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 fu(t,e,i,r){var n=new pu(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 du(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 pu(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 mu=0;function vu(t,e,i,r){i=i||2,mu=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=Zs(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=[];for(n=0,a=e.length;n<a;n++)(o=Zs(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(iu(o));for(s.sort(Js),n=0;n<s.length;n++)$s(s[n],i),i=qs(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])<n&&(n=u),(h=t[m+1])<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return yu(d,p,i,n,a,l),p}function yu(t,e,i,r,n,a,o){if(t){!o&&a&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=eu(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)}(t,r,n,a);for(var s,u,h=t;t.prev!==t.next;)if(s=t.prev,u=t.next,a?Qs(t,r,n,a):Ks(t))e.push(s.i/i+mu),e.push(t.i/i+mu),e.push(u.i/i+mu),du(t),t=u.next,h=u.next;else if((t=u)===h){o?1===o?yu(t=gu(qs(t),e,i),e,i,r,n,a,2):2===o&&xu(t,e,i,r,n,a):yu(qs(t),e,i,r,n,a,1);break}}}function gu(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ou(n,a)&&su(n,r,r.next,a)&&lu(n,a)&&lu(a,n)&&(e.push(n.i/i+mu),e.push(r.i/i+mu),e.push(a.i/i+mu),du(r),du(r.next),r=t=a),r=r.next}while(r!==t);return qs(r)}function xu(t,e,i,r,n,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&nu(o,s)){var u=cu(o,s);return o=qs(o,o.next),u=qs(u,u.next),yu(o,e,i,r,n,a),void yu(u,e,i,r,n,a)}s=s.next}o=o.next}while(o!==t)}var bu=2;function Tu(t,e){for(var i=t.s,r=t.p,n=i[1],a=r[1],o=0,s=0;s<n.length;s++){o+=n[s].length-1}var u,h=new Float32Array(o*Zr),l=e.indexBase,c=void 0===l?0:l,f=e.uvTransform,d=0,p=0,m=0,v=1,y=1;f&&(p=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);for(var g=[0,0],x=0===u?0:-Math.PI/2,b=0;b<n.length;b++)for(var T=n[b],E=a[b],_=a[b+1]||a[0],S=T,C=[0,0],w=0;w<S.length-1;w++){Su(C,S[w],E,_,E[4],E[5],_[2],_[3]),M(C[0],C[1])}var A=vu(Array.from(h),null,Zr,c);return{aPoint:h,index:new Uint16Array(A)};function M(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,_u(g,g,x),h[d++]=p+(g[0]+1)/2*v,h[d++]=m+(g[1]+1)/2*y):(h[d++]=(t+1)/2,h[d++]=(e+1)/2),d+=bu}}function Eu(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[Dt.SHAPE_POINTS,t.p],s:[Dt.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[Dt.SHAPE_POINTS,t.g.p],s:[Dt.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,a=0,o=0,s=0;s<r.length;s++){var u=Tu(r[s],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),a+=u.aPoint.length,o+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(a),l=new Uint16Array(o),c=0,f=0,d=0;c<i[c];c++){var p=i[c];h.set(p.aPoint,f),f+=p.aPoint.length,l.set(p.index,d),d+=p.index.length}return{aPoint:h,index:l}}function _u(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}function Su(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;return t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1],t}var Cu=function(){function t(t){var e=t.time,i=t.interval,r=t.count,a=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=n(r,Bn)?r:pa(r),this.cycles=+a||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),wu=function(t){this.content=t},Au=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new wu(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))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 wu(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))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}(),Mu="lookup_texture",Pu="offscreen_canvas",Iu={};function Ru(t){return Iu[t]}var Ou=new S,Nu=new S,Lu=function(){function t(t,e){this.pointStart=[];var i=e.colorOverLifetime,r=e.colorOverTrail,a=e.maxTrailCount,o=e.opacityOverLifetime,s=void 0===o?pa(1):o,u=e.widthOverTrail,h=e.name,l=e.occlusion,c=e.blending,f=e.texture,d=e.transparentOcclusion,p=e.minimumVertexDistance,m=e.lifetime,v=e.matrix,y=t.gpuCapability,g=y.detail,x=y.level,b=Math.max(e.pointCountPerTrail,2),T={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},E=g.maxVertexTextures>0,S=(null!=t?t:{}).env,w={},A=[["ENABLE_VERTEX_TEXTURE",E],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",S===qr]],M=a>64,P=0;i&&(A.push(["COLOR_OVER_LIFETIME",!0]),P|=1,w.uColorOverLifetime=pr.createWithData(t,G(i))),r&&(A.push(["COLOR_OVER_TRAIL",!0]),P|=4,w.uColorOverTrail=pr.createWithData(t,G(r))),M?(A.push(["ATTR_TRAIL_START",1]),P|=8):w.uTrailStart=new Float32Array(a),w.uOpacityOverLifetimeValue=s.toUniform(T);var I=u.toUniform(T);A.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),w.uVCurveValues=Bn.getAllData(T);var R={shader:{vertex:fo,fragment:lo,macros:A,glslVersion:1===x?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+P+"+"+T.index+"+"+T.max}},O=b*a*2,N=(b-1)*a,L=Float32Array.BYTES_PER_ELEMENT,F=12*L,V={attributes:{aColor:{size:4,stride:F,data:new Float32Array(12*O)},aSeed:{size:1,stride:F,offset:4*L,dataSource:"aColor"},aInfo:{size:3,stride:F,offset:5*L,dataSource:"aColor"},aPos:{size:4,stride:F,offset:8*L,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(O)},aDir:{size:3,data:new Float32Array(3*O)}},indices:{data:new Uint16Array(6*O)},drawCount:6*N,name:"trail#"+h,bufferUsage:Di.DYNAMIC_DRAW};if(M)V.attributes.aTrailStart={size:1,data:new Float32Array(O)};else{var k=new Float32Array(O);V.attributes.aTrailStartIndex={size:1,data:k};for(var D=0;D<a;D++)for(var z=2*b,B=D*z,U=0;U<z;U++)k[B+U]=D}var j=Xi(c),X=zr.create(t,R);X.blending=!0,X.depthMask=l,X.depthTest=!0,Wi(X,c);var W=this.mesh=so.create(t,{name:"MTrail_"+h,material:X,geometry:no.create(t,V)}),H=null!=f?f:pr.createWithData(t);Object.keys(w).map((function(t){var e=w[t];if(n(e,pr))X.setTexture(t,e);else if("uTrailStart"===t)X.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var a=new C(e[r],e[r+1],e[r+2],e[r+3]);i.push(a)}X.setVector4Array(t,i)}else X.setVector4(t,C.fromArray(e))})),X.setFloat("uTime",0),X.setVector4("uWidthOverTrail",C.fromArray(I)),X.setVector2("uTexOffset",new _(0,0)),X.setVector4("uTextureMap",new C(0,0,1,1)),X.setVector4("uParams",new C(0,b-1,0,0)),X.setTexture("uMaskTex",H),X.setVector4("uColorParams",new C(f?1:0,+j,0,+(l&&!d))),this.maxTrailCount=a,this.pointCountPerTrail=b,this.checkVertexDistance=p>0,this.minimumVertexDistance=Math.pow(p||.001,2),this.useAttributeTrailStart=M,this.lifetime=m,v&&(this.mesh.worldMatrix=v),this.geometry=W.firstGeometry(),this.trailCursors=new Uint16Array(a)}var e=t.prototype;return e.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,Ou);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=Du(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=6*c,y=new Float32Array(6);y.set(f,0),y.set(f,3),a.setAttributeSubData("aDir",v,y),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var g=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,a.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,Nu),E=new Float32Array(Du(T,l,e)),_=6*(t*n+u);a.setAttributeSubData("aDir",_,E),a.setAttributeSubData("aDir",_+3,E);var S=t*n*2,C=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),w=6*(t*o+(r-1)%o);a.setIndexSubData(w,C)}r=++this.trailCursors[t];var A=this.mesh.material,M=A.getVector4("uParams"),P=p[2];if(this.useAttributeTrailStart){for(var I=2*n,R=new Float32Array(I),O=0;O<I;O++)R[O]=P;a.setAttributeSubData("aTrailStart",t*R.length,R)}else{var N=A.getFloats("uTrailStart");null!=N&&(N[t]=P,A.setFloats("uTrailStart",N))}M&&(M.y=Math.max(M.y,r-1)-Math.max(0,r-n),A.setVector4("uParams",M))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,a=this.geometry.getAttributeData("aColor");return Y(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();Y(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");Y(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();Y(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},Pi(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),Fu=new S,Vu=new S,ku=new S;function Du(t,e,i){var r=Fu;return t||i?(t?i?(Vu.subtractVectors(e,t).normalize(),Vu.subtractVectors(i,e),ku.copyFrom(Vu).normalize(),r.addVectors(Vu,ku)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var zu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).particleSystem=null,e}Vt(e,t);var i=e.prototype;return i.getParticleSystem=function(t){if(this.particleSystem)return this.particleSystem;var e=t.output.getUserData();return n(e,exports.VFXItem)?(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem):null},i.processFrame=function(t){var e=this.getParticleSystem(t);if(e){this.time>=0&&this.time<e.time&&e.reset();for(;e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},e}(es),Bu=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new zu},e}(rs),Uu={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"},Gu=function(){function t(t,e){this.particleCount=0,this.cachedRotationVector3=new S,this.cachedRotationMatrix=new Mr,this.cachedLinearMove=new S,this.tempMatrix3=new Mr,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,r,a=(null!=t?t:{}).env,o=e.speedOverLifetime,s=e.colorOverLifetime,u=e.linearVelOverLifetime,h=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,c=e.rotationOverLifetime,f=e.sprite,d=e.gravityModifier,p=e.maxCount,m=e.textureFlip,v=e.useSprite,y=e.name,g=e.gravity,x=e.forceTarget,b=e.side,T=e.occlusion,E=e.anchor,w=e.blending,A=e.transparentOcclusion,M=e.renderMode,P=void 0===M?0:M,I=e.diffuse,R=void 0===I?pr.createWithData(t):I,O=t.gpuCapability.detail,N=O.halfFloatTexture,L=O.maxVertexUniforms,F=[["RENDER_MODE",+P],["ENV_EDITOR",a===qr]],V=t.gpuCapability.level,k={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},D={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},z=L>0,B={},U=0,j=0;(this.useSprite=v,z&&F.push(["ENABLE_VERTEX_TEXTURE",!0]),o&&(F.push(["SPEED_OVER_LIFETIME",!0]),j|=2,B.uSpeedLifetimeValue=o.toUniform(k)),(null==f?void 0:f.animate)&&(F.push(["USE_SPRITE",!0]),j|=4,B.uFSprite=B.uSprite=new Float32Array([f.col,f.row,f.total,f.blend?1:0]),this.useSprite=!0),(null==s?void 0:s.color)&&(F.push(["COLOR_OVER_LIFETIME",!0]),j|=16,B.uColorOverLifetime=n(s.color,pr)?s.color:pr.createWithData(t,G(s.color))),(null==s?void 0:s.opacity)?B.uOpacityOverLifetimeValue=s.opacity.toUniform(k):B.uOpacityOverLifetimeValue=pa(1).toUniform(k),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==u?void 0:u[t])&&(B["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=u[t].toUniform(k),r=1,j|=1<<7+e,u.enabled=!0),F.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==h?void 0:h[t])&&(B["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(k),n=1,j|=1<<10+e,i=!0,h.enabled=!0),F.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==u?void 0:u.asMovement)&&(F.push(["AS_LINEAR_MOVEMENT",!0]),j|=32),i&&((null==h?void 0:h.asRotation)&&(F.push(["AS_ORBITAL_MOVEMENT",!0]),j|=64),B.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),B.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(k),null==l?void 0:l.separateAxes)&&(F.push(["SIZE_Y_BY_LIFE",1]),j|=16384,B.uSizeYByLifetimeValue=null==l||null==(r=l.y)?void 0:r.toUniform(k));if((null==c?void 0:c.z)&&(B.uRZByLifeTimeValue=c.z.toUniform(k),j|=32768,F.push(["ROT_Z_LIFETIME",1])),(null==c?void 0:c.x)&&(B.uRXByLifeTimeValue=c.x.toUniform(k),j|=65536,F.push(["ROT_X_LIFETIME",1])),(null==c?void 0:c.y)&&(B.uRYByLifeTimeValue=c.y.toUniform(k),j|=1<<17,F.push(["ROT_Y_LIFETIME",1])),(null==c?void 0:c.asRotation)&&(F.push(["ROT_LIFETIME_AS_MOVEMENT",1]),j|=1<<18),B.uGravityModifierValue=d.toUniform(k),x&&(F.push(["FINAL_TARGET",!0]),j|=1<<19,B.uFinalTarget=new Float32Array(x.target||[0,0,0]),B.uForceCurve=x.curve.toUniform(k)),N&&D.max?(j|=1<<20,B.uFCurveValueTexture=mr(t,Bn.getAllData(D,!0),D.index,1)):B.uFCurveValues=Bn.getAllData(D),k.max+k.curves.length-32>L&&N&&z){var X=mr(t,Bn.getAllData(k,!0),k.index,1);B.uVCurveValueTexture=X,U=1}else B.uVCurveValues=Bn.getAllData(k);var W=["-p:",P,j,k.index,k.max,D.index,D.max].join("+");F.push(["VERT_CURVE_VALUE_COUNT",k.index],["FRAG_CURVE_VALUE_COUNT",D.index],["VERT_MAX_KEY_FRAME_COUNT",k.max],["FRAG_MAX_KEY_FRAME_COUNT",D.max]),this.VERT_MAX_KEY_FRAME_COUNT=k.max;var H={shader:{fragment:lo,vertex:"#define LOOKUP_TEXTURE_CURVE "+U+"\n"+co,glslVersion:1===V?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:W,macros:F,name:"particle#"+y}},Y=Xi(w);B.uTexOffset=new Float32Array(R?[1/R.getWidth(),1/R.getHeight()]:[0,0]),B.uMaskTex=R,B.uColorParams=new Float32Array([R?1:0,+Y,0,+(!!T&&!A)]),B.uParams=[0,0,0,0],B.uAcceleration=[(null==g?void 0:g[0])||0,(null==g?void 0:g[1])||0,(null==g?void 0:g[2])||0,0];var Z=zr.create(t,H);Z.blending=!0,Z.depthTest=!0,Z.depthMask=!!T,Wi(Z,w),Hi(Z,b),Object.keys(B).map((function(t){var e=B[t];if(n(e,pr))Z.setTexture(t,e);else{var i=[];switch(Uu[t]){case"vec4":Z.setVector4(t,C.fromArray(e));break;case"vec3":Z.setVector3(t,S.fromArray(e));break;case"vec2":Z.setVector2(t,_.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var a=new C(e[r],e[r+1],e[r+2],e[r+3]);i.push(a)}Z.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),Z.setVector3("emissionColor",new S(0,0,0)),Z.setFloat("emissionIntensity",0);var q=no.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,a={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(a.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:a,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*p,this.useSprite,"particle#"+y)),K=so.create(t,{name:"MParticle_"+y,material:Z,geometry:q});this.anchor=E,this.mesh=K,this.geometry=K.firstGeometry(),this.forceTarget=x,this.sizeOverLifetime=l,this.speedOverLifetime=o,this.linearVelOverLifetime=u,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=d,this.rotationOverLifetime=c,this.maxCount=p,this.textureOffsets=m?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return Y(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,a=this.geometry,o=r>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(u.aSprite=new Float32Array(12));var l=new S,c=new Ke,f=new S(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=rn.getRotation(c,new Ar),v=l.toArray(),y=p.toArray(),g=this.textureOffsets,x=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,E=e.color,_=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random();h&&(d=e.sprite);for(var w=0;w<4;w++){var A=2*w,M=3*w,P=4*w,I=12*w,R=8*w;u.aPos.set(v,I),T.fill(u.aPos,I+3),u.aRot.set(y,R),u.aRot[R+3]=C,u.aRot.set(E,R+4),h&&u.aSprite.set(d,M);var O=e.uv||b;if(O){var N=h?1-g[A+1]:g[A+1];x[0]=O[0]+g[A]*O[2],x[1]=O[1]+N*O[3]}u.aOffset.set(x,P);for(var L=w+w,F=(_[L]-this.anchor.x)*f.x,V=(_[L+1]-this.anchor.y)*f.y,k=0;k<3;k++)u.aPos[I+6+k]=e.dirX.getElement(k)*F,u.aPos[I+9+k]=e.dirY.getElement(k)*V}var D=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(o){var z=m(a.getIndexData(),6*r,6*i,s);z.set(D,6*t),a.setIndexData(z),this.maxParticleBufferCount=z.length/6}else a.setIndexSubData(6*t,D);Object.keys(u).forEach((function(e){var r=u[e],h=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var l=a.getAttributeData(e);Y(l);var c=m(l,n*h,4*i*h,s);c.set(r,r.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),a.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,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=o*(e/1e3),E=s*(e/1e3),_=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),a=this.geometry.getAttributeData("aRot"),o=this.geometry.getAttributeData("aSeed"),s=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=E((s-r[4*h+2])/r[4*h+3],0,1),c=8*h,f=this.cachedRotationVector3.set(a[c],a[c+1],a[c+2]),d=o[8*h+3],p=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(n(this.rotationOverLifetime.x,jn)?p.x+=this.rotationOverLifetime.x.getValue(l,d):p.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(n(this.rotationOverLifetime.y,jn)?p.y+=this.rotationOverLifetime.y.getValue(l,d):p.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(n(this.rotationOverLifetime.z,jn)?p.z+=this.rotationOverLifetime.z.getValue(l,d):p.z+=this.rotationOverLifetime.z.getValue(l))):u.setZero(),0===p.dot(p)&&u.identity();var m=Math.PI/180,v=p.x*m,y=p.y*m,g=p.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),_=Math.cos(v),S=Math.cos(y),C=Math.cos(g);u.set(C,-T,0,T,C,0,0,0,1),u.multiply(this.tempMatrix3.set(S,0,b,0,1,0,-b,0,S)),u.multiply(this.tempMatrix3.set(1,0,0,0,_,-x,0,x,_));var w=9*h,A=u.elements;i.set(A,w),h+4<=t&&(i.set(A,w+9),i.set(A,w+18),i.set(A,w+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),a=this.geometry.getAttributeData("aSeed"),o=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=o-r[4*u+2],l=r[4*u+3],c=h/l,f=a[8*u+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(n(this.linearVelOverLifetime.x,jn)?s.x=this.linearVelOverLifetime.x.getValue(c,f):s.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(n(this.linearVelOverLifetime.y,jn)?s.y=this.linearVelOverLifetime.y.getValue(c,f):s.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(n(this.linearVelOverLifetime.z,jn)?s.z=this.linearVelOverLifetime.z.getValue(c,f):s.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(n(this.linearVelOverLifetime.x,jn)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(n(this.linearVelOverLifetime.y,jn)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(n(this.linearVelOverLifetime.z,jn)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*u;i[d]=s.x,i[d+1]=s.y,i[d+2]=s.z,i[d+3]=s.x,i[d+4]=s.y,i[d+5]=s.z,i[d+6]=s.x,i[d+7]=s.y,i[d+8]=s.z,i[d+9]=s.x,i[d+10]=s.y,i[d+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}();var ju=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="ParticleSystemRenderer",i}Vt(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 C;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=_e(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 Gu(this.engine,t),e&&(this.trailMesh=new Lu(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.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}(Hr);exports.ParticleSystem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).particleMeshProps=null,r.trailMeshProps=null,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:exports.HitTestType.custom,clipMasks:r.renderer.frameClipMasks,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ut.removeParticle,ray:t})}}},r.maskManager=new Ur,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.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]===Dt.CONSTANT_VEC3?e.add(r[1]):t=pa(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)}},i.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)}},i.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())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new Au((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1},i.onStart=function(){var t=this;this.particleMeshProps&&(this.renderer=this.item.addComponent(ju),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)===Ut.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}})))},i.onUpdate=function(t){this.frozen||this.update(t)},i.simulate=function(t){this.update(1e3*t),this.frozen=!0},i.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=p,v=d/p,y=i,g=r.maxCount;this.updateEmitterTransform(u);for(var x=function(){var t=o.first;return e.emissionStopped||o.length===g&&t&&t.content[0]-n>u},b=0;b<m&&b<g&&!x();b++){var T=this.createPoint(f);T.delay+=y+b*v,this.addParticle(T,g),this.lastEmitTime=u}for(var E=a.bursts,_=(null==E?void 0:E.length)-1,S=0;_>=0&&S<g&&!x();_--){var C=E[_],w=!C.disabled&&C.getGeneratorOptions(u,f);if(w){var A=a.burstOffsets[_],M=A&&A[w.cycleIndex]||[0,0,0];C.once&&this.removeBurst(_);for(var P=0;P<w.count&&S<g;P++){var I;if(x())break;var R=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:P,burstCount:w.count}));R.delay+=y,S++,(I=R.transform).translate.apply(I,[].concat(M)),this.addParticle(R,g)}}}}else if(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);else{this.ended=!0,this.item.endBehavior===Bt.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=_e(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose()}))},i.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},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new S,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}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.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})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=void 0===a?[]:a,s=this.options.forceTarget,u=this.time-n,h=new S,l=S.fromArray(o);e.assignWorldTRS(h);var c=cn(new S,this.options,l,u,r,h,i);if(s){var f=s.target||[0,0,0],d=s.curve.getValue(u/r),p=1-d;c.x=c.x*p+f[0]*d,c.y=c.y*p+f[1]*d,c.z=c.z*p+f[2]*d}return c},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),a=e.particleFollowParent?wr.IDENTITY:this.transform.getWorldMatrix(),o=t.position,s=a.transformPoint(o,new S),u=new rn({position:s,valid:!0}),h=t.direction;if(h=a.transformNormal(h,Xu).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)qu.setElement(l,e.turbulence[l].getValue(i));Ku.setFromVector3(qu.negate()),Ju.setFromEuler(Ku).transformNormal(h).normalize()}var c,f=Yu,d=Zu;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=S.Z.clone(),a.transformNormal(this.upDirectionWorld)),f.crossVectors(d,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),d.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Qu)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=Hu;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(i);3===v.length&&(v[3]=1);var y=Wu;if(e.start3DSize)y.x=e.startSizeX.getValue(i),y.y=e.startSizeY.getValue(i);else{var g=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new S;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return u.setScale(y.x,y.y,1),{size:y,vel:b,color:v,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:th(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:d,dirX:f,transform:u}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&n(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i;var r,a,o,s,u,h=i.options,l=i.positionOverLifetime,c=void 0===l?{}:l,f=i.shape,d=null==c?void 0:c.gravityOverLifetime,p=fn(null==c?void 0:c.gravity),m=i.textureSheetAnimation,v=m?{animationDelay:pa(m.animationDelay||0),animationDuration:pa(m.animationDuration||1),cycles:pa(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,y=!!(f&&f.turbulenceX||(null==f?void 0:f.turbulenceY)||(null==f?void 0:f.turbulenceZ));y&&(r=[pa(null!=(a=f.turbulenceX)?a:0),pa(null!=(o=f.turbulenceY)?o:0),pa(null!=(s=f.turbulenceZ)?s:0)]);this.name="ParticleSystem",this.shape=Ys(f),this.emission={rateOverTime:pa(i.emission.rateOverTime),burstOffsets:$u(null!=(u=i.emission.burstOffsets)?u:[]),bursts:(i.emission.bursts||[]).map((function(t){return new Cu(t)}))},this.textureSheetAnimation=v;var g,x,b=i.renderer||{},T=i.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?pa(T.z):pa(0),T.separateAxes&&(g.x=T.x&&pa(T.x),g.y=T.y&&pa(T.y))),(null==c?void 0:c.forceTarget)&&(x={target:c.target||[0,0,0],curve:pa(c.forceCurve||[Dt.LINE,[[0,0],[1,1]]])});var E={x:c.linearX&&pa(c.linearX||0),y:c.linearY&&pa(c.linearY||0),z:c.linearZ&&pa(c.linearZ||0),asMovement:c.asMovement},S={x:c.orbitalX&&pa(c.orbitalX),y:c.orbitalY&&pa(c.orbitalY),z:c.orbitalZ&&pa(c.orbitalZ),center:c.orbCenter,asRotation:c.asRotation},C=i.sizeOverLifetime||{},w=i.colorOverLifetime,A=(null==C?void 0:C.separateAxes)?{separateAxes:!0,x:pa(C.x),y:pa(C.y)}:{separateAxes:!1,x:pa(("size"in C?C.size:C.x)||1)};b.anchor=b.anchor||[0,0];var M,P,I=_.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:pa(h.startLifetime),startDelay:pa(h.startDelay||0),startSpeed:pa(c.startSpeed||0),startColor:pa(h.startColor),looping:null!=(M=h.looping)&&M,maxCount:null!=(P=h.maxCount)?P:0,gravityModifier:pa(d||0),gravity:p,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:r,speedOverLifetime:c.speedOverLifetime&&pa(c.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:S,forceTarget:x},h.startRotationZ&&(this.options.startRotation=pa(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=pa(h.startRotationX||0),this.options.startRotationY=pa(h.startRotationY||0),this.options.startRotationZ=pa(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=pa(h.startSizeX),this.options.startSizeY=pa(h.startSizeY)):(this.options.startSize=pa(h.startSize),this.options.sizeAspect=pa(h.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(this.engine,i.mask);var R={name:this.name,matrix:wr.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||It.BILLBOARD,side:b.side||_t.DOUBLE,gravity:p,blending:b.blending||Et.ALPHA,rotationOverLifetime:g,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:h.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:x,diffuse:b.texture?this.engine.findObject(b.texture):void 0,sizeOverLifetime:A,anchor:I};if(w){var O=w.color,N=w.opacity;R.colorOverLifetime={},N&&(R.colorOverLifetime.opacity=pa(w.opacity)),O&&(O[0]===Dt.GRADIENT_COLOR?R.colorOverLifetime.color=w.color[1]:O[0]===Dt.RGBA_COLOR?R.colorOverLifetime.color=pr.createWithData(this.engine,{data:new Uint8Array(O[1]),width:1,height:1}):n(O,pr)&&(R.colorOverLifetime.color=O))}var L,F=[],V=[0,0,1,1];if(i.splits){var k=i.splits[0];V=(L=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(v&&!v.animate)for(var D=L?v.row:v.col,z=L?v.col:v.row,B=v.total||D*z,U=0,G=0;G<D;G++)for(var j=0;j<z&&U<B;j++,U++)F.push([G*V[2]/D+V[0],j*V[3]/z+V[1],V[2]/D,V[3]/z]);else F.push(V);this.uvs=F,R.textureFlip=L;var X,W=i.trails;W&&(this.trails={lifetime:pa(W.lifetime),dieWithParticles:!1!==W.dieWithParticles,sizeAffectsWidth:!!W.sizeAffectsWidth,sizeAffectsLifetime:!!W.sizeAffectsLifetime,inheritParticleColor:!!W.inheritParticleColor,parentAffectsPosition:!!W.parentAffectsPosition},X={name:"Trail",matrix:wr.IDENTITY,minimumVertexDistance:W.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(W.maxPointPerTrail)||32,blending:W.blending,texture:W.texture?this.engine.findObject(W.texture):void 0,opacityOverLifetime:pa(W.opacityOverLifetime||1),widthOverTrail:pa(W.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!W.occlusion,transparentOcclusion:!!W.transparentOcclusion,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},W.colorOverLifetime&&W.colorOverLifetime[0]===Dt.GRADIENT_COLOR&&(X.colorOverLifetime=W.colorOverLifetime[1]),W.colorOverTrail&&W.colorOverTrail[0]===Dt.GRADIENT_COLOR&&(X.colorOverTrail=W.colorOverTrail[1])),this.particleMeshProps=R,X&&(this.trailMeshProps=X);var H,Y=i.interaction;Y&&(this.interaction={multiple:Y.multiple,radius:null!=(H=Y.radius)?H:.4,behavior:Y.behavior});this.item.getHitTestParams=this.getHitTestParams},Pi(e,[{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)}}]),e}(Ii),exports.ParticleSystem=a([Me(pe.ParticleSystem)],exports.ParticleSystem);var Xu=new S,Wu=new _,Hu=new Ar,Yu=new S,Zu=new S,qu=new S,Ku=new Ar,Qu=[0,0,0],Ju=new wr;function $u(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=n(t,Array),r=i?t[0]:t.index,a=e[r];a||(a=e[r]=[]),i?a.push(t.slice(1,4)):a.push([+t.x,+t.y,+t.z])})),e}function th(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(n(i,exports.VFXItem))for(var r,a=_e(this.getChildTracks());!(r=a()).done;){var o=r.value;if(n(o,exports.ActivationTrack)){if(i.getComponent(exports.ParticleSystem))for(var s,u=t.createTrack(Rs,this,"ParticleTrack"),h=_e(o.getClips());!(s=h()).done;){var l=s.value,c=u.createClip(Bu);c.start=l.start,c.duration=l.duration,c.endBehavior=l.endBehavior}if(i.getComponent(exports.SpriteComponent))for(var f,d=t.createTrack(oh,this,"SpriteComponentTimeTrack"),p=_e(o.getClips());!(f=p()).done;){var m=f.value,v=d.createClip(uh);v.start=m.start,v.duration=m.duration,v.endBehavior=m.endBehavior}if(i.getComponent(exports.EffectComponent))for(var y,g=t.createTrack(sh,this,"EffectComponentTimeTrack"),x=_e(o.getClips());!(y=x()).done;){var b=y.value,T=g.createClip(uh);T.start=b.start,T.duration=b.duration,T.endBehavior=b.endBehavior}break}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=a([Me(pe.ObjectBindingTrack)],exports.ObjectBindingTrack),exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new ls},e}(rs),exports.ActivationPlayableAsset=a([Me(pe.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=a([Me(pe.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=a([Me(pe.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new ys},e}(rs),exports.SubCompositionPlayableAsset=a([Me(pe.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=a([Me(pe.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector3ropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.Vector3ropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector3ropertyPlayableAsset=a([Me(pe.Vector3PropertyPlayableAsset)],exports.Vector3ropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=a([Me(pe.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset);var eh=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}();exports.TimelineAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}Vt(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=_e(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=_e(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},Pi(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=_e(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Re),a([Pe()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=a([Me(pe.TimelineAsset)],exports.TimelineAsset);var ih=function(){function t(t,e){this.masterTrackInstances=[],this.clips=[];for(var i,r={},a=_e(e);!(i=a()).done;){var o=i.value;r[o.key.getInstanceId()]=o.value}for(var s,u=_e(t.tracks);!(s=u()).done;){var h=s.value;n(h,exports.ObjectBindingTrack)&&h.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.evaluate=function(t,e){for(var i,r=_e(this.clips);!(i=r()).done;){i.value.evaluateAt(t)}for(var n,a=_e(this.masterTrackInstances);!(n=a()).done;){var o=n.value;this.tickTrack(o,e)}},e.compileTracks=function(t,e){for(var i,r=t,n={},a=_e(r);!(i=a()).done;){var o=i.value,s=o.createPlayableGraph(this.clips),u=o.createOutput(),h=new eh(o,s,u);n[o.getInstanceId()]=h,o.parent||this.masterTrackInstances.push(h)}for(var l,c=_e(r);!(l=c()).done;)for(var f,d=l.value,p=n[d.getInstanceId()],m=_e(d.getChildTracks());!(f=m()).done;){var v=n[f.value.getInstanceId()];p.addChild(v)}for(var y,g=_e(e);!(y=g()).done;){var x=y.value;n[x.key.getInstanceId()].boundObject=x.value}for(var b,T=_e(this.masterTrackInstances);!(b=T()).done;){var E=b.value;this.updateTrackAnimatedObject(E)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=_e(t.mixer.clipPlayables);!(r=n()).done;){var a=r.value;a.getPlayState()===exports.PlayState.Playing&&a.processFrame(i)}t.mixer.evaluate(i);for(var o,s=_e(t.children);!(o=s()).done;){var u=o.value;this.tickTrack(u,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=_e(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)}},t}(),rh=[[0,0,1,1,0]],nh=0;exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new as;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(rs),exports.SpriteColorPlayableAsset=a([Me(pe.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset);var ah=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new us},e}(exports.TrackAsset),oh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.SpriteComponent)},e}(ah),sh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.EffectComponent)},e}(ah),uh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new hh},e}(rs),hh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(es);exports.SpriteComponent=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=1,r.splits=rh,r.name="MSprite"+nh++,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.onUpdate=function(e){var i=this;t.prototype.onUpdate.call(this,e);var r,n=this.time,a=this.duration,o=this.textureSheetAnimation,s=null==(r=null==o?void 0:o.loop)||r;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){i.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),o){var l,c,f,d,p,m=o.total||o.row*o.col,v=0,y=0,g=1,x=1;if(this.splits){var b=this.splits[0];c=b[4],v=b[0],y=b[1],c?(g=b[3],x=b[2]):(g=b[2],x=b[3])}if(c?(f=1/o.row*g,d=1/o.col*x):(f=1/o.col*g,d=1/o.row*x),o.animate){var T=Math.round(u*(m-1)),E=Math.floor(T/o.col),_=T-E*o.col;p=c?[f*E,d*(o.col-_)]:[f*_,d*(1+E)]}else p=[0,d];null==(l=this.material.getVector4("_TexOffset"))||l.setFromArray([v+p[0],x+y-p[1],f,d])}this.time=n+e/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===exports.TextureSourceType.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.updateGeometry=function(t){var e=this.textureSheetAnimation?[0,0,1,1,this.splits[0][4]]:this.splits[0],i=e[0],r=e[1],n=Boolean(e[4]),a=n?e[3]:e[2],o=n?e[2]:e[3],s=n?-Math.PI/2:0,u=t.getAttributeData("aUV"),h=t.getAttributeData("aPos"),l=t.getIndexData(),c=[0,0];if(u&&h&&l){for(var f=u.length/2,d=0;d<f;d++){var p=3*d,m=2*d,v=h[p],y=h[p+1];c[0]=v,c[1]=y,_u(c,c,s),u[m]=(c[0]+.5)*a+i,u[m+1]=(c[1]+.5)*o+r}this.geometry.setAttributeData("aPos",h.slice()),this.geometry.setAttributeData("aUV",u.slice()),this.geometry.setIndexData(l.slice()),this.geometry.setDrawCount(l.length)}this.geometry.subMeshes.length=0;for(var g,x=_e(t.subMeshes);!(g=x()).done;){var b=g.value;this.geometry.subMeshes.push({offset:b.offset,indexCount:b.indexCount,vertexCount:b.vertexCount})}},i.updateGeometryFromMultiSplit=function(){for(var t=this.splits,e=this.textureSheetAnimation,i=this.defaultGeometry,r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],n=[],a=[],o=[],s=0;s<2;s++)for(var u=0;u<2;u++){var h=4*(2*u+s),l=e?[0,0,1,1,t[0][4]]:t[2*u+s],c=l[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],f=((s+s+1)/2-1)/2,d=((u+u+1)/2-1)/2,p=l[0],m=l[1],v=l[4]?l[3]:l[2],y=l[4]?l[2]:l[3],g=[r[0]/2+f,r[1]/2+d,r[2]/2+f,r[3]/2+d,r[4]/2+f,r[5]/2+d,r[6]/2+f,r[7]/2+d];n.push(c[0]*v+p,c[1]*y+m,c[2]*v+p,c[3]*y+m,c[4]*v+p,c[5]*y+m,c[6]*v+p,c[7]*y+m),o.push(1*g[0],1*g[1],0,1*g[2],1*g[3],0,1*g[4],1*g[5],0,1*g[6],1*g[7],0),a.push(h,1+h,2+h,2+h,1+h,3+h)}i.setAttributeData("aPos",new Float32Array(o)),i.setIndexData(new Uint16Array(a)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(a.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:rh,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var a=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(a):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var o,s=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new w).setFromArray(s)),this.duration=null!=(o=e.duration)?o:this.item.duration},e}(ko),exports.SpriteComponent=a([Me(pe.SpriteComponent)],exports.SpriteComponent);var lh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),ch=new(function(){function t(){this.elements=[]}var i=t.prototype;return i.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},i.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return Y(t),t}if(Ru(Pu))return e.window._createOffscreenCanvas(10,10);var i=e.document.createElement("canvas");return i.getContext("2d",{willReadFrequently:!0}),i},i.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?d(this.elements,t):t.remove()},t}()),fh=function(){function t(t){this.width=0,this.height=0,this.autoResize=Kt.fixed,this.keepWordIntact=!0,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,a=t.textOverflow,o=void 0===a?qt.clip:a,s=t.textVerticalAlign,u=void 0===s?$t.top:s,h=t.textAlign,l=void 0===h?Jt.left:h,c=t.letterSpace,f=void 0===c?0:c,d=t.fontSize,p=t.lineHeight,m=void 0===p?d:p,v=t.autoResize,y=void 0===v?Kt.fixed:v,g=t.keepWordIntact,x=void 0===g||g;this.letterSpace=f,this.overflow=o,this.textVerticalAlign=u,this.textAlign=l,this.width=n,this.height=i,this.autoResize=y,this.keepWordIntact=x,this.lineHeight=m},e.getOffsetY=function(t,e,i,r,n){var a=(i-r)/3,o=r,s=void 0!==n?n:i*(e-1),u=0;switch(this.textVerticalAlign){case $t.top:u=o+a;break;case $t.middle:u=(this.height-s+o)/2;break;case $t.bottom:u=this.height-s-a}return u},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case Jt.left:i=0;break;case Jt.middle:i=(this.width-e)/2;break;case Jt.right:i=this.width-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),dh=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=void 0===u?[1,1,1,1]:u,l=t.fontSize,c=void 0===l?40:l,f=t.outline,d=t.shadow,p=t.fontWeight,m=void 0===p?"normal":p,v=t.fontStyle,y=void 0===v?"normal":v,g=t.fontFamily,x=void 0===g?"sans-serif":g;(this.textColor=[].concat(h),this.textWeight=m,this.fontStyle=y,this.fontFamily=x,this.fontSize=c,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,f&&(null!=(e=f.outlineWidth)?e:0)>0)&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=f.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=f.outlineWidth)?r:0);(this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,d)&&(this.hasShadow=!0,this.shadowBlur=null!=(n=d.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(a=d.shadowColor)?a:[0,0,0,1]),this.shadowOffsetX=null!=(o=d.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(s=d.shadowOffsetY)?s:0);this.fontOffset=0,this.fontStyle!==ee.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),ph=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){Z(t)?this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("Risky font family, ignored:",t)},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!==te.normal&&(o=n+" "+o),a!==ee.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.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var a=this.context;a.save(),this.canvas.width=t,this.canvas.height=e,a.setTransform(1,0,0,1,0,0),i||(a.translate(0,e),a.scale(1,-1)),a.clearRect(0,0,t,e),a.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(a),a.restore();var o=a.getImageData(0,0,t,e),s=pr.createWithData(this.engine,{data:new Uint8Array(o.data),width:o.width,height:o.height},{flipY:i,magFilter:Di.LINEAR,minFilter:Di.LINEAR,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=s,this.material.setTexture("_MainTex",s)}},e.initTextBase=function(t){this.engine=t,this.canvas=ch.getCanvas(),ch.saveCanvas(this.canvas),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})},t}(),mh=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,vh=function(t){return" "===t||"\t"===t||" "===t},yh=0;exports.TextComponent=function(t){function e(e){var i;(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+yh++,i.canvas=ch.getCanvas(),ch.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0});var r=i.getDefaultProps().options;return i.updateWithOptions(r),i}Vt(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=_e(this.materials);!(i=r()).done;){var n=i.value,a=this.transform.size.x,o=this.transform.size.y,s=this.getTextureExpandScale();a*=s[0],o*=s[1],n.setVector2("_Size",new _(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()},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 w(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 dh(t),this.textLayout?this.textLayout.update(t):this.textLayout=new fh(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;if(e&&(e.font=this.getFontDesc(this.textStyle.fontSize)),n===qt.display){for(var h=0;h<t.length;h++){var l,c,f=t[h],d=null!=(c=null==e||null==(l=e.measureText(f))?void 0:l.width)?c:0;"\n"===f?(o++,s=0,u=0):(u>0&&(s+=r),s+=d,u++,this.maxLineWidth=Math.max(this.maxLineWidth,s))}return o}if(this.textLayout.keepWordIntact)for(var p=0,m=0,v=0;v<t.length;v++){var y,g,x=t[v],b=null!=(g=null==e||null==(y=e.measureText(x))?void 0:y.width)?g:0;if("\n"!==x)s+(u>0?r:0)+b>a&&u>0&&(o++,m>1?(this.maxLineWidth=Math.max(this.maxLineWidth,p),s-=p,u-=m):(this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),p=0,m=0),u>0&&(s+=r),s+=b,u++,vh(x)&&(p=s,m=u);else o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0,p=0,m=0}else for(var T=0;T<t.length;T++){var E,_,S=t[T],C=null!=(_=null==e||null==(E=e.measureText(S))?void 0:E.width)?_:0;u>0&&(s+=r),(s+C>a&&T>0||"\n"===S)&&(o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),"\n"!==S&&(s+=C,u++)}return this.maxLineWidth=Math.max(this.maxLineWidth,s),o},i.setLineHeight=function(t){var e=this.textStyle.fontSize,i=Math.max(e,t);this.textLayout.lineHeight!==i&&(this.textLayout.lineHeight=i,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===Kt.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):r.autoResize===Kt.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=0!=(c|f|d|p),v=this.engine.gpuCapability.detail.maxTextureSize/2,y=m?a+c+f:a,g=m?o+d+p:o,x=Math.max(y,g,1);n=Math.min(n,v/x);var b=Math.ceil(y*n),T=Math.ceil(g*n),E=m?c:0,_=m?t?d:p:0;this.effectScaleX=a>0?b/(a*n):1,this.effectScaleY=o>0?T/(o*n):1;var S=.0123044998279225;this.transform.setSize(a*S,o*S),this.renderToTexture(b,T,t,(function(t){t.scale(n,n),e.maxLineWidth>a&&r.overflow===qt.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=0;b<h.length;b++){var T=h[b],S=t.measureText(T);if("\n"!==T){if(m+(y.length>0?r.letterSpace:0)+S.width>a&&y.length>0)if(x>0){var C=y.slice(0,x),w=g.slice(0,x),A=C.length>0?w[w.length-1]+t.measureText(C[C.length-1]).width:0;p.push({y:v,width:A,chars:C,charOffsetX:w}),v+=u,y=y.slice(x+1),m=0,g=[];for(var M=0;M<y.length;M++)M>0&&(m+=r.letterSpace),g.push(m),m+=t.measureText(y[M]).width;x=-1}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1;y.length>0&&(m+=r.letterSpace),g.push(m),y.push(T),m+=S.width,vh(T)&&(x=y.length-1)}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1}else for(var P=0;P<h.length;P++){var I=h[P],R=t.measureText(I);y.length>0&&(m+=r.letterSpace),(m+R.width>a&&P>0||"\n"===I)&&(p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[]),"\n"!==I&&(y.push(I),g.push(m),m+=R.width)}y.length>0&&p.push({y:v,width:m,chars:y,charOffsetX:g});var O=i.isOutlined&&i.outlineWidth>0;O&&(i.hasShadow&&e.setupShadow(),e.setupOutline(n),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&mh.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.strokeText(a,E+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=E+u+e.charOffsetX[h];t.strokeText(l,c,n)}})),i.hasShadow&&(t.shadowColor="transparent")),!O&&i.hasShadow&&e.setupShadow(),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&mh.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.fillText(a,E+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=E+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===Kt.autoWidth&&(i.autoResize=Kt.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];"\n"!==l?(u+=a.letterSpace||0,u+=r.measureText(l).width):(s=Math.max(s,u),u=0)}s=Math.max(s,u);var c=Math.ceil(s-(o.fontOffset||0)-1e-4)+2;return Math.max(0,c)},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:pe.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:te.normal,letterSpace:0,textAlign:Jt.middle,fontStyle:ee.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(ko),exports.TextComponent=a([Me(pe.TextComponent)],exports.TextComponent),dt(exports.TextComponent,[ph]);var gh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),xh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Re);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Re),a([Pe()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=a([Me(pe.BinaryAsset)],exports.BinaryAsset);var bh=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=Ie(e);if(r)for(var n,a=_e(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:rt(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):Re.is(s)?i[o]={id:s.getInstanceId()}:at(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=_e(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:rt(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):Re.is(c)?i[l]={id:c.getInstanceId()}:at(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.definition=e;var r=Ie(i),n=i.engine;if(r)for(var a,o=_e(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 n(t,Int8Array)||n(t,Uint8Array)||n(t,Uint8ClampedArray)||n(t,Int16Array)||n(t,Uint16Array)||n(t,Int32Array)||n(t,Uint32Array)||n(t,Float32Array)||n(t,Float64Array)||n(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(at(t)&&1===Object.keys(t).length&&"id"in t&&it(t.id))},t.checkGLTFNode=function(t){return at(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return st(t)||n(t,e.HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),!(r>14)){if(rt(e)){for(var o,s=[],u=_e(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(ot(e)){var c;c=n?new n:{};for(var f,d=_e(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,a=_e(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:rt(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):Re.is(s)?i[o]={id:s.getInstanceId()}:at(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.");else{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:rt(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):Re.is(a)?i[n]={id:a.getInstanceId()}:at(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}}},t}(),Th=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){switch(r.dataType){case pe.Material:e=zr.create(this.engine);break;case pe.Geometry:e=no.create(this.engine);break;case pe.Texture:e=pr.create(this.engine);break;default:var n=Ae(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),bh.deserialize(r,e),e;console.warn("Constructor for DataType: "+r.dataType+" not found.")}else console.warn("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),Eh=function(){function t(){}return t.prototype.loadGUID=function(t){return r((function(){return o(this,(function(t){return[2,void 0]}))}))()},t}();function _h(t,e){if(!t.includes(e))return t.push(e),!0}function Sh(t){if(Number.isFinite(t))return[Dt.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===Dt.CONSTANT)return[Dt.CONSTANT,t[1]];if("lines"===e)return[Dt.LINE,t[1]];if(e===Dt.LINE){var r=i.map((function(t){return[zt.LINE,t]}));return[Dt.BEZIER_CURVE,r]}return"curve"===e||e===Dt.CURVE?[Dt.BEZIER_CURVE,Wh(i)]:t}}function Ch(t,e){return Array.isArray(t)&&"random"===t[0]?[Dt.CONSTANT,t[1][e]]:Sh(t)}function wh(t){return t&&"color"===t[0]?Ih(t[1],!0):[1,1,1,1]}function Ah(t,e){if(t)return"colors"===t[0]?[Dt.COLORS,t[1].map((function(t){return Ih(t,e)}))]:"gradient"===t[0]?Ph(t[1],e):"color"===t[0]?[Dt.RGBA_COLOR,Ih(t[1],e)]:t}function Mh(t){return t&&"random"===t[0]?[Dt.RANDOM,t[1]]:Sh(t)}function Ph(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach((function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),a=Ih(t[r],e);i.push([n,a[0],a[1],a[2],a[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[Dt.GRADIENT_COLOR,i]}}function Ih(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 a=+r[4];i=[+r[1],+r[2],+r[3],isNaN(a)?255:Math.round(255*a)]}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 n(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Rh(i)),i}function Rh(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Oh(t,e){return Array.isArray(t)?t[0]===Dt.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Ph(t[1],e):Ph(t,e)}function Nh(t){if(t){if(3===t.length)return[Dt.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Dt.BEZIER_PATH||e===Dt.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=Wh(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s?a.push(u):s<n.length-1?(a.push(u),a.push(u)):a.push(u)}}return[Dt.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function Lh(t){for(var e,i=_e(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function Fh(t){for(var e,i=_e(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var Vh,kh=Math.cos,Dh=Math.sin,zh=Math.PI/180,Bh=180/Math.PI;function Uh(t,e){return t?[t[0]-.5,.5-t[1]]:e?jh[e]:[0,0]}var Gh,jh=((Vh={})[Rt.PARTICLE_ORIGIN_CENTER]=[0,0],Vh[Rt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Vh[Rt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Vh[Rt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Vh[Rt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Vh[Rt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Vh[Rt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Vh[Rt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Vh[Rt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Vh);function Xh(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=o-n;return[[n+(o-n)/3,a+(t*=s)/3],[o-(o-n)/3,r[1]-(e*=s)/3]]}function Wh(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=Xh(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?[zt.EASE_OUT,t]:e===n.length-1?[zt.EASE_IN,t]:[zt.EASE,t]}))}var Hh=new Map,Yh=new Map;function Zh(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Pt.null&&t.endBehavior===Bt.destroy&&(t.endBehavior=Bt.freeze)}))})),t.version=bt["2_1"],t}function qh(t){for(var e,i,r,n=function(){var t=u.value;t.endBehavior!==re&&t.endBehavior!==ie||(t.endBehavior=Bt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===Pt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=_e(t.items);!(e=i()).done;){var r=e.value;h[r.id]=ct(),r.oldId=r.id,r.id=h[r.id],l[r.id]=r}t.items.forEach((function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=h[r]+"^"+n}else e.parentId=h[e.parentId];a.items.push(e),t.items[i]={id:e.id}}));var n=He({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:ct(),dataType:"TimelineAsset"},u=_e(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:ct(),dataType:"ActivationPlayableAsset"};o.push(c);var f={id:ct(),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!==Pt.particle){var d={id:ct(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:ct(),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===Pt.sprite||h.type===Pt.text){var m={id:ct(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:ct(),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===Pt.composition){var y={id:ct(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:ct(),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:ct(),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=[],E=_e(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var S,C=_e(a);!(S=C()).done;){var w=S.value;i.miscs.push(w)}for(var A,M=_e(o);!(A=M()).done;){var P=A.value;i.miscs.push(P)}}(n,l,a)},a=He({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),o=_e(a.images);!(i=o()).done;){i.value.id=ct()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=ct(),t.dataType=pe.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var s=a.textures.length;s<a.images.length;s++)a.textures.push({id:ct(),dataType:pe.Texture,source:{id:a.images[s].id},flipY:!0});t.bins&&(r=t.bins,a.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:ct()}})));for(var u,h={},l={},c=_e(t.compositions);!(u=c()).done;)n();for(var f,d=_e(a.items);!(f=d()).done;){var p=f.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:a.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var v=p.content.trails.texture;p.content.trails.texture={id:a.textures[v].id}}}if(p.transform){var y,g,x,b=[].concat(null!=(y=p.transform.position)?y:[0,0,0]),T=[].concat(null!=(g=p.transform.rotation)?g:[0,0,0]),E=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:T[0],y:T[1],z:T[2]},scale:{x:E[0],y:E[1],z:E[0]}}}),p.type===Pt.sprite&&(p.transform.size={x:E[0],y:E[1]},p.transform.scale={x:1,y:1,z:1}),p.type===Pt.sprite){var _=p.content;_.renderer||(_.renderer={});var S,C,w,A,M=_.renderer,P=Uh(M.anchor,M.particleOrigin),I=p.transform.size;if(!M.anchor&&void 0!==M.particleOrigin)p.transform.position.x+=-P[0]*(null!=(S=null==I?void 0:I.x)?S:1),p.transform.position.y+=-P[1]*(null!=(C=null==I?void 0:I.y)?C:1);p.transform.anchor={x:P[0]*(null!=(w=null==I?void 0:I.x)?w:1),y:P[1]*(null!=(A=null==I?void 0:I.y)?A:1)}}}if(p.type===Pt.particle){var R=p.content;R.renderer||(R.renderer={});var O=R.renderer;R.renderer.anchor=Uh(O.anchor,O.particleOrigin)}if(p.type===Pt.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var N=p.pn,L=t.plugins,F=void 0===L?[]:L;void 0!==N&&Number.isInteger(N)&&(p.pluginName=F[N])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=h[p.content.options.target]),p.type===Pt.spine&&t.spines&&0!==t.spines.length&&ul(t.spines[p.content.options.spine],p.content,a),p.type!==Pt.sprite&&p.type!==Pt.particle&&p.type!==Pt.mesh&&p.type!==Pt.skybox&&p.type!==Pt.light&&"camera"!==p.type&&p.type!==Pt.tree&&p.type!==Pt.interact&&p.type!==Pt.camera&&p.type!==Pt.text&&p.type!==Pt.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],a.components.push(p.content),p.content.id=ct(),p.content.item={id:p.id},p.dataType=pe.VFXItemData,p.components.push({id:p.content.id})),p.type!==Pt.null&&p.type!==Pt.composition||(p.components=[],p.dataType=pe.VFXItemData),p.type){case Pt.sprite:p.content.dataType=pe.SpriteComponent;break;case Pt.particle:p.content.dataType=pe.ParticleSystem;break;case Pt.mesh:p.content.dataType=pe.MeshComponent;break;case Pt.skybox:p.content.dataType=pe.SkyboxComponent;break;case Pt.light:p.content.dataType=pe.LightComponent;break;case"camera":p.content.dataType=pe.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case Pt.tree:p.content.dataType=pe.TreeComponent;break;case Pt.interact:p.content.dataType=pe.InteractComponent;break;case Pt.camera:p.content.dataType=pe.CameraController;break;case Pt.text:p.content.dataType=pe.TextComponent;break;case Pt.spine:p.content.dataType=pe.SpineComponent}}return a.version=bt["3_0"],a}function Kh(t){for(var e,i=_e(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.ShapeComponent){var n=r;if(n.type===se.Custom){var a,o=n;(null==(a=o.shapes)?void 0:a.length)>0&&o.shapes[0].fill&&(o.fill=o.shapes[0].fill);for(var s,u=new Array(o.easingIns.length),h=new Array(o.easingOuts.length).fill(!1),l=_e(o.shapes);!(s=l()).done;)for(var c,f=_e(s.value.indexes);!(c=f()).done;){var d=c.value,p=o.points[d.point],m=o.easingIns[d.easingIn],v=o.easingOuts[d.easingOut];u[d.easingIn]||(m.x-=p.x,m.y-=p.y,u[d.easingIn]=!0),h[d.easingOut]||(v.x-=p.x,v.y-=p.y,h[d.easingOut]=!0)}}}}return t.version=bt["3_2"],t}function Qh(t){Hh.clear(),Yh.clear();for(var e,i=t.compositions,r=t.items,n=_e(t.components);!(e=n()).done;){var a=e.value;Hh.set(a.id,a)}for(var o,s=_e(r);!(o=s()).done;){var u=o.value;Yh.set(u.id,u)}for(var h,l=_e(i);!(h=l()).done;){al(h.value)}return t.version=bt["3_3"],t}function Jh(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=_e(t.items);!(i=r()).done;){var n=i.value;if(n.type===Pt.sprite){var a=Hh.get(n.components[0].id);if(a){var o,s=a.renderer.shape,u=void 0;if(Number.isInteger(s))u=null==(o=t.shapes)?void 0:o[s];else u=s;a.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=_e(t.compositions);!(h=f()).done;){var d=h.value,p=ct();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:ct(),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=_e(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=bt["3_4"],t}function $h(t){for(var e,i={},r=_e(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var a,o=_e(t.compositions);!(a=o()).done;)for(var s,u=a.value,h=_e(u.components);!(s=h()).done;){i[s.value.id].item.id=u.id}for(var l,c=_e(t.components);!(l=c()).done;){var f=l.value;if(f.dataType===pe.SpriteComponent){var d=f,p=d.renderer.shape;if(!(null==p||"aPoint"in p&&"index"in p)){var m=nl(p);d.geometry={id:m.id},t.geometries.push(m)}}if(f.dataType===pe.ShapeComponent){var v=f;if(v.fills=[],v.fill){var y={type:ae.Solid,color:v.fill.color};v.fills.push(y)}if(delete v.fill,v.strokes=[],v.stroke){var g={type:ae.Solid,color:v.stroke.color};v.strokes.push(g),v.strokeWidth=v.stroke.width,v.strokeCap=v.stroke.cap,v.strokeJoin=v.stroke.join,delete v.stroke}}}return t.version=bt["3_5"],t}function tl(t){if(t.components)for(var e,i=_e(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}(r.dataType===pe.TextComponent||r.dataType===pe.RichTextComponent&&r.options)&&il(r.options),r.dataType===pe.TextComponent&&rl(r.options)}return t.version=bt["3_6"],t}function el(t){for(var e,i,r=function(){var e=i.value;if(e.type===Pt.text&&e.transform){for(var r,a,o,s=t.components.find((function(t){return e.components[0].id===t.id})),u=e.transform.scale.x/(null!=(a=null==(r=s.options)?void 0:r.textWidth)?a:1)/.0123,h=e.transform.scale.x,l=e.transform.scale.y,c=e.transform.scale.z,f=_e(t.items);!(o=f()).done;){var d=o.value;d.parentId===e.id&&d.transform&&(d.transform.scale.x*=h/u,d.transform.scale.y*=l/u,d.transform.scale.z*=c/u)}e.transform.scale.x=u,e.transform.scale.y=u,e.transform.scale.z=u,n.push({item:e,scaleFactor:u,oldScaleX:h,oldScaleY:l,oldScaleZ:c})}},n=[],a=_e(t.items);!(i=a()).done;)r();n.length>0&&(null==(e=t.animations)?void 0:e.length)&&function(t,e){for(var i,r=new Map,n=new Map,a=_e(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=_e(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=_e(d);!(p=m()).done;){var v=p.value;l.set(v.id,f)}}for(var y,g=new Map,x=_e(t.components);!(y=x()).done;){var b=y.value;g.set(b.id,b)}for(var T,E=new Map,_=_e(t.animations);!(T=_()).done;){var S=T.value;E.set(S.id,S)}for(var C,w=_e(t.compositions);!(C=w()).done;){for(var A,M,P,I=C.value,R=void 0,O=void 0,N=_e(I.components);!(P=N()).done;){var L=P.value,F=g.get(L.id);if((null==F?void 0:F.dataType)===pe.Animator?R=F:(null==F?void 0:F.dataType)===pe.CompositionComponent&&(O=F),R&&O)break}if(R){var V=void 0;if(O){var k=O.items;if(k){V=[];for(var D,z=_e(k);!(D=z()).done;){var B=D.value,U=r.get(B.id);U&&!U.parentId&&V.push(U)}}}if((!V||0===V.length)&&I.children){V=[];for(var G,j=_e(I.children);!(G=j()).done;){var X=G.value,W=r.get(X.id);W&&V.push(W)}}if(V&&0!==V.length){var H=R,Y=E.get(null==(A=H.graphAsset)?void 0:A.id);if(null==Y||null==(M=Y.graphDataSet)?void 0:M.resources)for(var Z,q=_e(Y.graphDataSet.resources);!(Z=q()).done;){var K=Z.value,Q=E.get(K.id);if(null==Q?void 0:Q.scaleCurves)for(var J,$=_e(Q.scaleCurves);!(J=$()).done;){var tt=J.value,et=hl(V,tt.path,n);if(et){var it=h.get(et.id);if(it)ll(tt.keyFrames,it.scaleFactor/it.oldScaleX,it.scaleFactor/it.oldScaleY,it.scaleFactor/it.oldScaleZ);else{var rt=l.get(et.id);rt&&ll(tt.keyFrames,rt.oldScaleX/rt.scaleFactor,rt.oldScaleY/rt.scaleFactor,rt.oldScaleZ/rt.scaleFactor)}}}}}}}}(t,n);for(var o,s=new Map,u=new Map,h=new Map,l=_e(t.components);!(o=l()).done;){var c=o.value;h.set(c.id,c)}for(var f,d=_e(t.items);!(f=d()).done;){var p=f.value;p.children=[],s.set(p.id,p)}for(var m,v=_e(t.compositions);!(m=v()).done;){var y=m.value;y.children=[];for(var g,x=_e(y.components);!(g=x()).done;){var b=g.value,T=h.get(b.id);if(T.dataType===pe.CompositionComponent){for(var E,_=T,S=_e(_.items);!(E=S()).done;){var C=E.value,w=s.get(C.id);void 0===w.parentId&&y.children.push({id:w.id})}delete _.items}}u.set(y.id,y)}for(var A,M=_e(t.items);!(A=M()).done;){var P=A.value;if(P.parentId){var I=s.get(P.parentId);I&&I.children.push({id:P.id})}}return t.version=bt["3_7"],t}function il(t){t&&void 0===t.TextVerticalAlign&&void 0===t.TextVerticalAlign&&(t.TextVerticalAlign=t.textBaseline)}function rl(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]}}function nl(t,e){void 0===e&&(e="形状");for(var i=Eu(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:me.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:ye.UInt16,indexOffset:p,buffer:"",id:ct(),dataType:pe.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:ge.Position,offset:0,format:ve.Float32,dimension:3}),v.vertexData.channels.push({semantic:ge.Uv,offset:d,format:ve.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}function al(t){for(var e,i=_e(t.items);!(e=i()).done;){var r=e.value,n=Yh.get(r.id);if(!n)return;if(n.type===Pt.sprite||n.type===Pt.particle||n.type===Pt.spine||n.type===Pt.text||n.type===Pt.richtext||n.type===Pt.video||n.type===Pt.shape){var a=Hh.get(n.components[0].id);a&&ol(a)}}}function ol(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==exports.MaskMode.NONE&&(i===exports.MaskMode.MASK?(t.mask={isMask:!0},Gh=t.id):i!==St.OBSCURED&&i!==St.REVERSE_OBSCURED||(t.mask={inverted:i===St.REVERSE_OBSCURED,reference:{id:Gh}}))}function sl(t){if(t)for(var e,i=_e(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?Nh(n):Sh(n):a||"object"!=typeof n||sl(n)}}function ul(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}}))}}function hl(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}}function ll(t,e,i,r){if(Array.isArray(t)&&t[0]===Dt.VECTOR3_CURVE){var n=t[1];Array.isArray(n)&&3===n.length&&(cl(n[0],e),cl(n[1],i),cl(n[2],r))}}function cl(t,e){if(Array.isArray(t)&&t[0]===Dt.BEZIER_CURVE&&Array.isArray(t[1]))for(var i,r=_e(t[1]);!(i=r()).done;){var n=i.value;if(Array.isArray(n)&&!(n.length<2)&&Array.isArray(n[1]))for(var a=n[1],o=1;o<a.length;o+=2)a[o]*=e}}function fl(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:Nh(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Sh(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Sh(n.linearX),linearY:Sh(n.linearY),linearZ:Sh(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Sh(n.orbitalX),orbitalY:Sh(n.orbitalY),orbitalZ:Sh(n.orbitalZ),speedOverLifetime:Sh(n.speedOverLifetime)};Fh(a);var o={options:{startColor:wh(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=Sh(s.x),u.y=Sh(s.y),u.z=Sh(s.z)):u.z=Sh(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:Sh(h.opacity)};h.color&&(l.color=Oh(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:Sh(c.size),x:Sh(c.x),y:Sh(c.y),z:Sh(c.z)}),o}var dl="2.9.1",pl=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,ml=/^(\d+)\.(\d+)$/,vl=!1;function yl(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,a,o=null!=(n=pl.exec(r))?n:[],s=null!=(a=pl.exec(dl))?a:[],u=o[1],h=o[2],l=s[1],c=s[2];return Number(l)<Number(u)||Number(l)===Number(u)&&Number(c)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+dl+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Pt.mesh&&t.type!==Pt.light||(t.endBehavior=1===t.endBehavior?Bt.destroy:t.endBehavior)}))}))}(t),pl.test(t.version))return vl="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),el(tl($h(Jh(Qh(Kh(qh(Zh(function(t){var e;gl=bt["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(gl=bt["1_3"]);var r,n=(t.requires||[]).slice(),a=t.images.map((function(e,i){return xl(e,i,t.imageTags||[])})),o=t.textures||a.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:gl,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return bl(t,{plugins:i,requires:n})})),images:a,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:o,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t)))))))));vl=!1;var r=ml.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]);if(n)return(n<2||2===n&&a<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=_e(t.items);!(e=i()).done;)sl(e.value.content)})),t}(t)),n<3&&(t=qh(Zh(t))),r=ml.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]),n<4&&(a<2&&(t=Kh(t)),a<3&&(t=Qh(t)),a<4&&(t=Jh(t)),a<5&&(t=$h(t)),a<6&&(t=tl(t)),a<7&&(t=el(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var gl=bt["1_0"];function xl(t,e,i){var r=i[e];if("string"==typeof t)return{id:ct(),renderLevel:r,url:t};if(t.template)return{id:ct(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:ct(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:ct(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function bl(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:He({clipMode:ne},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Sl(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 Tl,El=[0,0,0,1],_l=.5;function Sl(t,e){var i;void 0===e&&(e={});var r,n,a,o,s,u,h=Pt.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||Pt.plugin,u=t.pn,s=t.pluginName,a=t.content,n=t.content,isNaN(u)&&!s&&(s=a.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=Pt.particle,r=y((n=t.particle).transform,vl,!0),a=function(t){var e=t.options,i=t.transform,r={type:Ct.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=He({},t.shape,{type:Ct[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=Mh(e.turbulenceX),r.turbulenceY=Mh(e.turbulenceY),r.turbulenceZ=Mh(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return Lh(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return Lh(t)}))),l.rateOverTime&&(l.rateOverTime=Mh(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Mh(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Mh(e.startSize),startSizeX:Mh(e.startSizeX),startSizeY:Mh(e.startSizeY),sizeAspect:Mh(e.sizeAspect),maxCount:e.maxCount,startDelay:Mh(e.startDelay),startColor:Ah(e.startColor,!0),startRotationZ:Mh(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Mh(e.startRotationX),c.options.startRotationY=Mh(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:Nh(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Mh(f.x),y:Mh(f.y)}:c.sizeOverLifetime={size:Mh(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Sh(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Sh(e.gravityModifier),startSpeed:Mh(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Mh(d.linearX),linearY:Mh(d.linearY),linearZ:Mh(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Mh(d.orbitalX),orbitalY:Mh(d.orbitalY),orbitalZ:Mh(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Sh(d.forceCurve)},Fh(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Mh(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Sh(m.y),c.rotationOverLifetime.x=Sh(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Sh(v.opacity)};v.color&&(y.color=Oh(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Sh(g.cycles),animationDelay:Ch(g.animationDelay,0),animationDuration:Ch(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Mh(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Sh(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Oh(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Oh(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:Mh(x.opacityOverLifetime)}),c.trails&&Fh(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=Pt.sprite,a=function(t,e){var i=fl(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=y(n.transform,!1,!0))):t.cal?(h=Pt.null,a=fl(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=Pt.interact,r=y((n=t.ui).transform),a=function(t){var e,i=t.options;switch(i.type){case"click":e={type:At.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&wh(i.previewColor),behavior:i.behavior||Mt.NOTIFY};break;case"drag":e={type:At.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:At.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=Pt.camera,r=y(n.transform),a=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var a,o={path:Nh(null==(a=t.transform)?void 0:a.path),linearX:Sh(null==n?void 0:n.translateX),linearY:Sh(null==n?void 0:n.translateY),linearZ:Sh(null==n?void 0:n.translateZ)};Fh(o),r.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:Sh(null==s?void 0:s.rotateX),y:Sh(null==s?void 0:s.rotateY),z:s.separateAxes?Sh(null==s?void 0:s.rotateZ):Sh(s.rotation)};Fh(u),r.rotationOverLifetime=u}return r}(n))),null==(i=a.renderer)?void 0:i.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==_l&&f[1]==_l?delete a.renderer.anchor:e.requires&&_h(e.requires,"anchor")}if(n){var d,p,m=null==(d=n.options)?void 0:d.looping;if(m)l=Array.isArray(m)?m[1]?Bt.restart:Bt.destroy:Bt.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||Bt.destroy;n.options.renderLevel&&(o=n.options.renderLevel),isNaN(c)&&(c=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:c,id:t.id+"",transform:r,endBehavior:l,renderLevel:o,content:a};return s?e.plugins?(_h(e.plugins,s),v.pn=e.plugins.indexOf(s)):v.pluginName=s:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var a=(o=El,s=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=kh(s*zh/2),c=kh(u*zh/2),f=kh(h*zh/2),d=Dh(s*zh/2),p=Dh(u*zh/2),m=Dh(h*zh/2),o[0]=d*c*f+l*p*m,o[1]=l*p*f-d*c*m,o[2]=l*c*m+d*p*f,o[3]=l*c*f-d*p*m,o);r.rotation=function(t,e){var i,r,n,a=e[0],o=e[1],s=e[2],u=e[3],h=a+a,l=o+o,c=s+s,f=a*h,d=o*h,p=o*l,m=s*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=s*h-u*l,E=s*l+u*h,_=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Bh,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Bh,t[2]=Math.atan2(x,y)*Bh):(t[0]=0,t[2]=Math.atan2(-g,b)*Bh),t}([],a)}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}var o,s,u,h,l,c,f,d,p,m;return{}}}var Cl,wl=((Tl={})[Tt.S]=[Tt.S,Tt.BPlus,Tt.APlus],Tl[Tt.A]=[Tt.A,Tt.BPlus,Tt.APlus],Tl[Tt.B]=[Tt.B,Tt.BPlus],Tl);function Al(t,e){if(!t||!e)return!0;var i=wl[e];return!!i&&i.includes(t)}function Ml(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 Pl(t,e,i){return Il.apply(this,arguments)}function Il(){return(Il=r((function(t,i,r){var a,s;return o(this,(function(o){switch(o.label){case 0:return"string"!=typeof t?[3,2]:[4,tr(t)];case 1:return a=o.sent(),[3,3];case 2:a=t,o.label=3;case 3:if(!a)throw new Error("Image not provided.");if(!i)return[2,a];if(s=Ml(i,r)){if(it(s)&&s!==a.src)return[2,tr(s)];if(n(s,e.HTMLImageElement))return[2,s]}return[2,a]}}))}))).apply(this,arguments)}exports.Scene=void 0,(Cl=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return at(t)&&"jsonScene"in t},Cl.isURL=function(t){return at(t)&&"url"in t},Cl.isWithOptions=function(t){return at(t)&&"options"in t};var Rl=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},Ol=1,Nl=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Yi),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=Ol++,this.timers=[],this.updateOptions(t)}var i=t.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},i.loadScene=function(t,i){var n=this;return r((function(){var a,s,u,h,l,c,f,d,p,m,v,y,g;return o(this,(function(x){return s=it(t)?t:n.id,u=e.performance.now(),h=[],l=null==i?void 0:i.engine.gpuCapability,f=null!=(c=null==l?void 0:l.detail.ktx2Support)&&c,d={},m=!1,v=new Promise((function(t,i){p=e.window.setTimeout((function(){m=!0,n.removeTimer(p);var t=e.performance.now()-u;i(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+h.join(" ")+", url: "+s+"."))}),1e3*n.timeout),n.timers.push(p)})),y=r((function(t,i){var r,n,a,s;return o(this,(function(o){switch(o.label){case 0:if(m)return[3,4];r=e.performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i()];case 2:return n=o.sent(),a=e.performance.now()-r,h.push("["+t+": "+a.toFixed(2)+"]"),d[t]=a,[2,n];case 3:throw s=o.sent(),new Error("Load error in "+t+", "+s+".");case 4:throw new Error("Load canceled.")}}))})),g=r((function(){var i,r,l,c,m,v,g,x,b,T,E,_,S,C,w;return o(this,(function(o){switch(o.label){case 0:return it(t)?(r=new e.URL(t,e.location.href).href,n.baseUrl=r,[4,y("loadJSON",(function(){return n.loadJSON(r)}))]):[3,2];case 1:return it(a=o.sent())&&(a=JSON.parse(a)),[3,3];case 2:a=t,n.baseUrl=e.location.href,o.label=3;case 3:return exports.Scene.isJSONObject(a)?(i=He({},a),[3,9]):[3,4];case 4:return[4,y("processJSON",(function(){return n.processJSON(a)}))];case 5:return v=o.sent().jsonScene,i={timeInfos:d,url:t,storage:{},jsonScene:v,bins:[],textureOptions:[],images:[],assets:n.assets},[4,y("plugin:onAssetsLoadStart",(function(){return n.onPluginSceneLoadStart(i)}))];case 6:return o.sent(),g=v.bins,x=void 0===g?[]:g,b=v.images,T=v.fonts,[4,Promise.all([y("processBins",(function(){return n.processBins(x)})),y("processImages",(function(){return n.processImages(b,f)})),y("processFontURL",(function(){return n.processFontURL(T)}))])];case 7:return E=o.sent(),_=E[0],S=E[1],[4,y("processTextures",(function(){return n.processTextures(S,_,v)}))];case 8:C=o.sent(),(l=i.bins).push.apply(l,[].concat(_)),(c=i.textureOptions).push.apply(c,[].concat(C)),(m=i.images).push.apply(m,[].concat(S)),i.renderLevel=n.options.renderLevel,o.label=9;case 9:return w=e.performance.now()-u,tt.info("Load asset: totalTime: "+w.toFixed(4)+"ms "+h.join(" ")+", url: "+s+"."),e.window.clearTimeout(p),n.removeTimer(p),i.totalTime=w,i.startTime=u,i.timeInfos=d,[2,i]}}))})),[2,Promise.race([v,g()])]}))}))()},i.getAssets=function(){return this.assets},i.processJSON=function(t){return r((function(){var e,i,r,n,a;return o(this,(function(o){for(e=yl(t),i=e.plugins,r=_e(void 0===i?[]:i);!(n=r()).done;)if(a=n.value,!pt[a])throw new Error("The plugin '"+a+"' not found."+xt(a));return[2,{jsonScene:e}]}))}))()},i.processBins=function(t){var i=this;return r((function(){var r,a,s;return o(this,(function(o){return r=i.options.renderLevel,a=i.baseUrl,s=t.map((function(o){if(n(o,ArrayBuffer))return o;if(Al(o.renderLevel,r))return i.loadBins(new e.URL(o.url,a).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(s)]}))}))()},i.processFontURL=function(e){var i=this;return r((function(){return o(this,(function(r){return[2,t.loadFontFamily(e,i.baseUrl)]}))}))()},i.processImages=function(t,i){void 0===i&&(i=!1);var a=this;return r((function(){var s,u,h,l,c,f,d,p;return o(this,(function(m){switch(m.label){case 0:return s=a.options,u=s.useCompressedTexture,h=s.variables,l=s.disableWebP,c=s.disableAVIF,f=a.baseUrl,d=t.map(r((function(t,r){var s,d,p,m,v,y,g,x,b,T,E,_,S,C,w,A,M,P,I,R;return o(this,(function(r){switch(r.label){case 0:if(s=t.url,d=t.webp,p=t.avif,m=t.ktx2,v=new e.URL(s,f).href,y=!l&&d?new e.URL(d,f).href:void 0,g=!c&&p?new e.URL(p,f).href:void 0,x=m&&u&&i?new e.URL(m,f).href:void 0,b=t.id,!("template"in t))return[3,8];if(T=t.template,!(E=T.background))return[3,7];_=Ml(T,h),S=E.type===ce.video,C=E&&S?ar:tr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,sr(_,C)];case 2:return n(w=r.sent(),e.HTMLVideoElement)?(a.sourceFrom[b]={url:w.src,type:exports.TextureSourceType.video},[2,w]):[3,3];case 3:return E&&Array.isArray(_)&&h&&(h[E.name]=w.src),a.sourceFrom[b]={url:w.src,type:exports.TextureSourceType.image},[4,Pl(w,T,h)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw A=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(S?"video":"image")+" type, URL: "+_+", Error: "+(A.message||A)+".");case 7:return[3,9];case 8:if("ktx2"in t&&x)return a.sourceFrom[b]={url:x,type:exports.TextureSourceType.compressed},[2,a.loadBins(x)];if(n(t,e.HTMLImageElement)||n(t,e.HTMLCanvasElement)||n(t,e.HTMLVideoElement)||n(t,pr))return[2,t];r.label=9;case 9:return g?[4,Ji(v,g)]:[3,11];case 10:return R=r.sent(),[3,13];case 11:return[4,Ki(v,y)];case 12:R=r.sent(),r.label=13;case 13:return P=(M=R).url,I=M.image,a.sourceFrom[b]={url:P,type:exports.TextureSourceType.image},[2,I]}}))}))),[4,Promise.all(d)];case 1:return p=m.sent(),a.assignImagesToAssets(t,p),[2,p]}}))}))()},i.onPluginSceneLoadStart=function(t){var e=this;return r((function(){return o(this,(function(i){switch(i.label){case 0:return[4,yt.onAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}}))}))()},i.processTextures=function(t,e,i){var a=this;return r((function(){var s,u,h;return o(this,(function(l){return u=null!=(s=i.textures)?s:t.map((function(t,e){return{source:e}})),h=u.map(r((function(t,r){var s,u,h,l,c,f;return o(this,(function(o){switch(o.label){case 0:if(n(t,pr))return[2,t];if(!("mipmaps"in t))return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,hr(t,e,a.assets,i.bins)];case 2:return[2,o.sent()];case 3:throw s=o.sent(),new Error("Load texture "+r+" fails, error message: "+s+".");case 4:return u=t.source,h=t.id,c="",at(u)?(l=a.assets[u.id],c=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,tr(ft(u))];case 6:l=o.sent(),o.label=7;case 7:return l?[4,Ll(l,a.sourceFrom[c],h)]:[3,9];case 8:return[2,(f=o.sent()).sourceType===exports.TextureSourceType.compressed?f:He({},f,t)];case 9:throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(h)]}))}))()},i.loadJSON=function(t){var e=this;return r((function(){return o(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 r((function(){return o(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 e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(i,n){return void 0===n&&(n=e.location.href),r((function(){var a;return o(this,(function(s){return i?(a=i.map(r((function(i){var r,a,s;return o(this,(function(o){switch(o.label){case 0:if(!i.fontURL||t.fontCache.has(i.fontFamily))return[3,4];Z(i.fontFamily)||console.warn("Risky font family: "+i.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new e.URL(i.fontURL,n).href,[4,(s=new FontFace(null!=(a=i.fontFamily)?a:"","url("+r+")")).load()];case 2:return o.sent(),e.document.fonts.add(s),t.fontCache.add(i.fontFamily),[3,4];case 3:return o.sent(),tt.warn("Invalid font family or font source: "+JSON.stringify(i.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(a)]):[2]}))}))()},t.loadPrecomposition=function(e,i){return r((function(){var r;return o(this,(function(n){switch(n.label){case 0:return[4,new t(i).loadScene(e)];case 1:return r=n.sent(),[2,new Rl(r,i)]}}))}))()},t}();function Ll(t,e,i){return Fl.apply(this,arguments)}function Fl(){return(Fl=r((function(t,i,r){var a,s,u,h,l;return o(this,(function(o){switch(o.label){case 0:return a={id:r,dataType:pe.Texture},n(t,pr)?[2,He({},t.source,a)]:[3,1];case 1:return n(t,e.HTMLImageElement)||st(t)?[2,He({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:Di.LINEAR,magFilter:Di.LINEAR},a)]:[3,2];case 2:return n(t,e.HTMLVideoElement)?[2,He({sourceType:exports.TextureSourceType.video,video:t,minFilter:Di.LINEAR,magFilter:Di.LINEAR},a)]:[3,3];case 3:if(!n(t,ArrayBuffer))return[3,10];if(!(s=br.getLoader("ktx2")))return[3,8];o.label=4;case 4:return o.trys.push([4,6,,7]),[4,s.loadFromBuffer(t)];case 5:return u=o.sent(),tt.info("Loading KTX2 texture."),[2,He({sourceType:u.sourceType,type:u.type,target:u.target,internalFormat:u.internalFormat,format:u.format,mipmaps:u.mipmaps,minFilter:Di.LINEAR,magFilter:Di.LINEAR,sourceFrom:i},a)];case 6:throw h=o.sent(),new Error("Failed to parse KTX2 from "+(null!=(l=null==i?void 0:i.url)?l:"buffer")+": "+(h.message||h));case 7:return[3,9];case 8:throw new Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in t&&"height"in t&&"data"in t)return[2,He({sourceType:exports.TextureSourceType.data,data:t,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE,minFilter:Di.NEAREST,magFilter:Di.NEAREST},a)];o.label=11;case 11:throw new Error("Invalid texture options.")}}))}))).apply(this,arguments)}Nl.fontCache=new Set;var Vl=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(i=t.url),exports.Scene.isWithOptions(t)&&(e=He({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===Pt.text||t.type===Pt.richtext){var r=e[t.name];if(null==r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==pe.TextComponent&&(null==n?void 0:n.dataType)!==pe.RichTextComponent||(n.options.text=r)}))}}))},e.prepareAssets=function(t,e){for(var i,r=_e(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new xh(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=_e(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},e.createShaderVariant=function(){for(var t,e=_e(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];n(r,zr)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=_e(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),kl=new S(1,1,1),Dl=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new rn,this.viewportMatrix=wr.fromIdentity(),this.viewMatrix=wr.fromIdentity(),this.projectionMatrix=wr.fromIdentity(),this.viewProjectionMatrix=wr.fromIdentity(),this.inverseViewMatrix=wr.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,a=void 0===n?20:n,o=e.fov,s=void 0===o?60:o,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?kt.portrait:l,f=e.position,d=void 0===f?[0,0,8]:f,p=e.rotation,m=void 0===p?[0,0,0]:p,v=new Ar(m[0],m[1],m[2]),y=(new Ke).setFromEuler(v);this.options={near:r,far:a,fov:s,aspect:h,clipMode:c},this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.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 S(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 S(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new S(-1,-1,a)),l=h.x,c=h.y;return new S((s-l)/2,(u-c)/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 He({},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*y,r,n,a,o===kt.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),kl),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:wr.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 S,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=.5*(i.x+1)*a,i.y=.5*(i.y+1)*o,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new S,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},Pi(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}();function zl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Bl,Ul=function(){function t(){this.update=new jl,this.lateUpdate=new Xl,this.preRender=new Wl}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==Ii.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==Ii.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==Ii.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==Ii.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==Ii.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==Ii.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Gl=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}(),jl=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=_e(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(Gl),Xl=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=_e(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(Gl),Wl=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=_e(t);!(i=r()).done;){i.value.onPreRender()}},e}(Gl),Hl=function(t){function i(i,r,a){var o;(o=t.call(this)||this).engine=i,o.sceneTicking=new Ul,o.speed=1,o.isEnded=!1,o.loaderData={},o.startTime=0,o.videos=[],o.postProcessingEnabled=!1,o.destroyed=!1,o.paused=!0,o.isEndCalled=!1,o._textures=[];var s=null!=r?r:{},u=s.reusable,h=void 0!==u&&u,l=s.speed,c=void 0===l?1:l,f=s.baseRenderOrder,d=void 0===f?0:f,p=s.event,m=s.onItemMessage;o.engine.addComposition(zl(o));var v,y,g,x,b,T,E,_=null;if(a){var S,C;o.createTexturesFromData(a.textureOptions);for(var w,A=_e(Object.keys(a.assets));!(w=A()).done;){var M=w.value,P=a.assets[M];n(P,e.HTMLVideoElement)&&o.videos.push(P)}o.postProcessingEnabled=null!=(C=null==(S=a.jsonScene.renderSettings)?void 0:S.postProcessingEnabled)&&C,o.engine.renderLevel=a.renderLevel,h&&(a.consumed=!0),_=a.jsonScene.compositions[0];for(var I,R=_e(a.jsonScene.compositions);!(I=R()).done;){var O=I.value;O.id===a.jsonScene.compositionId&&(_=O)}Y(_)}return o.rootItem=new exports.VFXItem(o.engine),_&&(o.rootItem.setInstanceId(_.id),o.rootItem.instantiatePreComposition(_,!1)),o.rootItem.name="rootItem",o.rootItem.composition=zl(o),o.rootComposition=null!=(v=o.rootItem.getComponent(exports.CompositionComponent))?v:o.rootItem.addComponent(exports.CompositionComponent),o.rootComposition.updateMode=exports.UpdateModes.Manual,o.rootComposition.play(),o.rootItem.on("animationevent",(function(t){o.emit("animationevent",t)})),o.renderOrder=d,o.id=null!=(y=null==_?void 0:_.id)?y:ct(),o.startTime=null!=(g=null==_?void 0:_.startTime)?g:0,o.event=p,o.statistic={loadStart:null!=(x=null==a?void 0:a.startTime)?x:0,loadTime:null!=(b=null==a?void 0:a.totalTime)?b:0,compileTime:0,firstFrameTime:0},o.reusable=h,o.speed=c,o.name=null!=(T=null==_?void 0:_.name)?T:"New Composition",o.camera=new Dl(o.name,He({},null==_?void 0:_.camera,{aspect:o.width/o.height})),o.camera.engine=o.engine,o.url=null!=(E=null==a?void 0:a.url)?E:"",o.interactive=!0,m&&(o.onItemMessage=m),o.createRenderFrame(),yt.initializeComposition(zl(o),a),o}Vt(i,t);var a=i.prototype;return a.getDuration=function(){return this.rootItem.duration},a.restart=function(){this.reset(),this.forwardTime(this.startTime)},a.setIndex=function(t){this.renderOrder=t},a.getIndex=function(){return this.renderOrder},a.setSpeed=function(t){this.speed=t},a.setVisible=function(t){this.rootItem.setVisible(t)},a.getSpeed=function(){return this.speed},a.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},a.pause=function(){this.paused=!0,this.emit("pause")},a.getPaused=function(){return this.paused},a.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},a.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},a.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},a.createRenderFrame=function(){this.renderFrame=new Co({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},a.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)},a.addItem=function(t){t.setParent(this.rootItem)},a.getComponent=function(t){return this.rootItem.getComponent(t)},a.forwardTime=function(t){var e=1e3*t-1e3*this.time;this.update(e)},a.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},a.prepareRender=function(){},a.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.rootItem.awake(),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.rootComposition.setChildrenRenderOrder(0),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},a.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Bt.destroy&&!this.reusable},a.updateCamera=function(){this.camera.updateMatrix()},a.updateCompositionTime=function(t){if(this.rootComposition.state===exports.PlayState.Playing&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e>=i)switch(n=!0,r){case Bt.restart:e%=i,this.restart();break;case Bt.freeze:e=Math.min(i,e);case Bt.forward:case Bt.destroy:}this.rootComposition.tick(e+this.startTime-this.rootComposition.getTime()),this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},a.createTexturesFromData=function(t){for(var e,i=_e(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},a.getItemByName=function(t){return this.rootItem.find(t)},a.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return yn((t-i.z)/r,(e-i.w)/n,this.camera)},a.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},a.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.rootItem.hitTest(a,t,e,n,[],i,r),n},a.addInteractiveItem=function(t,e){if(e===At.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},a.removeInteractiveItem=function(t,e){e===At.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}))},a.destroyItem=function(t){},a.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},a.dispose=function(){var t=this;if(!this.destroyed){this.destroyed=!0;for(var e,i=_e(this.textures);!(e=i()).done;){e.value.dispose()}this._textures=[];for(var r,n=_e(this.videos);!(r=n()).done;){var a=r.value;a.pause(),a.removeAttribute("src"),a.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),yt.destroyComposition(this),this.update=function(){tt.error("Update disposed composition: "+t.name+".")},this.dispose=et,this.renderer.engine.removeComposition(this),this.engine.env!==qr&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},a.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},a.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},a.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},a.translate=function(t,e,i){this.rootItem.translate(t,e,i)},a.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},a.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},a.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},a.scale=function(t,e,i){this.rootItem.scale(t,e,i)},a.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},a.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},a.reloadTexture=function(){var t=this;return r((function(){return o(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},Pi(i,[{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:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootItem.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}(Qr),Yl=new Int32Array(2),Zl=new Float32Array(Yl.buffer),ql=new Float64Array(Yl.buffer),Kl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Bl||(Bl={}));var Ql=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var i=t.prototype;return i.clear=function(){this.position_=0},i.bytes=function(){return this.bytes_},i.position=function(){return this.position_},i.setPosition=function(t){this.position_=t},i.capacity=function(){return this.bytes_.length},i.readInt8=function(t){return this.readUint8(t)<<24>>24},i.readUint8=function(t){return this.bytes_[t]},i.readInt16=function(t){return this.readUint16(t)<<16>>16},i.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},i.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},i.readUint32=function(t){return this.readInt32(t)>>>0},i.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readFloat32=function(t){return Yl[0]=this.readInt32(t),Zl[0]},i.readFloat64=function(t){return Yl[Kl?0:1]=this.readInt32(t),Yl[Kl?1:0]=this.readInt32(t+4),ql[0]},i.writeInt8=function(t,e){this.bytes_[t]=e},i.writeUint8=function(t,e){this.bytes_[t]=e},i.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.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},i.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},i.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},i.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},i.writeFloat32=function(t,e){Zl[0]=e,this.writeInt32(t,Yl[0])},i.writeFloat64=function(t,e){ql[0]=e,this.writeInt32(t,Yl[Kl?0:1]),this.writeInt32(t+4,Yl[Kl?1:0])},i.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new 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},i.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},i.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},i.__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===Bl.UTF8_BYTES?r:this.text_decoder_.decode(r)},i.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},i.__indirect=function(t){return t+this.readInt32(t)},i.__vector=function(t){return t+this.readInt32(t)+4},i.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},i.__has_identifier=function(t){if(4!=t.length)throw new 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},i.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},i.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}(),Jl=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=Ql.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=1+~(this.bb.capacity()-this.space+i)&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 new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new 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 new 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=2*(i+2);this.addInt16(r);var n=0,a=this.space;t: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 t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var a=3;a>=0;a--)this.writeInt8(n.charCodeAt(a))}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 new 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){return null==t?0:(e=n(t,Uint8Array)?t: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());var e},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)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}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 new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=Ql.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),$l=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 tc(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}(),tc=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=$l.createDataVector(t,this.data);return $l.createFBEffectsObjectData(t,e,i)},t}(),ec=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 $l).__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 ic(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}(),ic=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=ec.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return ec.createFBEffectsPackageData(t,e)},t}(),rc=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 nc(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}(),nc=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 rc.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ac=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 oc(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}(),oc=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 ac.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sc=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 ac).__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 uc(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}(),uc=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=sc.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sc.createFBVertexData(t,this.vertexCount,e)},t}(),hc=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 sc).__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 rc).__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 lc(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}(),lc=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=hc.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=hc.createBinaryDataVector(t,this.binaryData),s=hc.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=hc.createInverseBindMatricesVector(t,this.inverseBindMatrices);return hc.startFBGeometryData(t),hc.addId(t,e),hc.addName(t,i),hc.addVertexData(t,r),hc.addIndexFormat(t,this.indexFormat),hc.addIndexOffset(t,this.indexOffset),hc.addSubMeshes(t,n),hc.addMode(t,this.mode),hc.addBuffer(t,a),hc.addBinaryData(t,o),hc.addBoneNames(t,s),hc.addRootBoneName(t,u),hc.addInverseBindMatrices(t,h),hc.endFBGeometryData(t)},t}(),cc=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 Jl(1),i=new ic,r=[],n=_e(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===pe.Geometry&&(o=new tc("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,ec.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new Ql(t),i=ec.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===pe.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new Jl(1),i=new lc,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=void 0===u?[]:u,l=t.rootBoneName,c=void 0===l?"":l,f=t.inverseBindMatrices,d=void 0===f?[]:f,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=h,i.rootBoneName=c,i.inverseBindMatrices=d,i.binaryData=m;var v=new uc;v.vertexCount=s.vertexCount,v.channels=[];for(var y,g=_e(s.channels);!(y=g()).done;){var x=y.value,b=x.semantic,T=x.offset,E=x.format,_=x.dimension,S=x.normalize,C=new oc(b,T,E,_,S);v.channels.push(C)}i.vertexData=v;for(var w,A=[],M=_e(t.subMeshes);!(w=M()).done;){var P=w.value,I=P.offset,R=P.indexCount,O=P.vertexCount,N=new nc(I,R,O);A.push(N)}return i.subMeshes=A,ec.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new Ql(t),i=hc.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var a=0;a<n.channelsLength();a++){var o=n.channels(a);if(o){var s,u={semantic:null!=(s=o.semantic())?s:"",offset:o.offset(),format:o.format(),dimension:o.dimension(),normalize:o.normalize()};r.channels.push(u)}}}for(var h=[],l=0;l<i.subMeshesLength();l++){var c=i.subMeshes(l);if(c){var f={offset:c.offset(),vertexCount:c.vertexCount(),indexCount:c.indexCount()};h.push(f)}}for(var d=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);d.push(m)}var v,y,g,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:h,mode:i.mode(),buffer:null!=(v=i.buffer())?v:"",boneNames:d,rootBoneName:null!=(y=i.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=i.binaryDataArray())?g:void 0,id:null!=(x=i.id())?x:"",dataType:pe.Geometry}},t}(),fc=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var i=t.prototype;return i.getFPS=function(){return this.targetFPS},i.setFPS=function(t){this.targetFPS=E(t,1,120),this.interval=Math.floor(1e3/t)-2},i.getPaused=function(){return this.paused},i.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var i=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},r=function(){t.intervalId=i(r),t.paused||t.tick()};r()}},i.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},i.pause=function(){this.paused=!0,this.dt=0},i.resume=function(){this.paused=!1,this.dt=0},i.tick=function(){if(!this.paused){var t=e.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 i,r=_e(this.tickers);!(i=r()).done;){var n=i.value;n(this.dt)}}}},i.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},Pi(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),dc=function(t){function i(e,i){var r,n,a,o,s,u;return(r=t.call(this)||this).name="NewEngine",r.speed=1,r.displayScale=1,r.offscreenMode=!1,r.renderErrors=new Set,r.compositions=[],r.assetManagers=[],r.env="",r.ticker=null,r._disposed=!1,r.textures=[],r.materials=[],r.geometries=[],r.meshes=[],r.renderPasses=[],r.clearAction={stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]},r.canvas=e,r.env=null!=(n=null==i?void 0:i.env)?n:"",r.name=null!=(a=null==i?void 0:i.name)?a:r.name,r.pixelRatio=null!=(o=null==i?void 0:i.pixelRatio)?o:O(),r.jsonSceneData={},r.objectInstance={},r.whiteTexture=yr(zl(r)),r.transparentTexture=gr(zl(r)),(null==i?void 0:i.manualRender)||(r.ticker=new fc(null==i?void 0:i.fps),r.runRenderLoop(r.mainLoop.bind(zl(r)))),r.eventSystem=new Yo(zl(r),null!=(s=null==i?void 0:i.notifyTouch)&&s),r.eventSystem.enabled=null!=(u=null==i?void 0:i.interactive)&&u,r.eventSystem.bindListeners(r.canvas),r.assetLoader=new Th(zl(r)),r.assetService=new Vl(zl(r)),r.renderTargetPool=new Io(zl(r)),r.renderingData={currentFrame:{}},r}Vt(i,t);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 ot(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=void 0===r?[]:r,a=i.items,o=void 0===a?[]:a,s=i.materials,u=void 0===s?[]:s,h=i.shaders,l=void 0===h?[]:h,c=i.geometries,f=void 0===c?[]:c,d=i.components,p=void 0===d?[]:d,m=i.animations,v=void 0===m?[]:m,y=i.bins,g=void 0===y?[]:y,x=i.miscs,b=void 0===x?[]:x,T=_e(i.compositions);!(e=T()).done;){var E=e.value;this.addEffectsObjectData(E)}for(var _,S=_e(o);!(_=S()).done;){var C=_.value;Al(C.renderLevel,t.renderLevel)||(C.components=[],C.type=Pt.null),this.addEffectsObjectData(C)}for(var w,A=_e(u);!(w=A()).done;){var M=w.value;this.addEffectsObjectData(M)}for(var P,I=_e(l);!(P=I()).done;){var R=P.value;this.addEffectsObjectData(R)}for(var O,N=_e(f);!(O=N()).done;){var L=O.value;this.addEffectsObjectData(L)}for(var F,V=_e(p);!(F=V()).done;){var k=F.value;this.addEffectsObjectData(k)}for(var D,z=_e(v);!(D=z()).done;){var B=D.value;this.addEffectsObjectData(B)}for(var U,G=_e(b);!(U=G()).done;){var j=U.value;this.addEffectsObjectData(j)}for(var X=0;X<g.length;X++){var W=g[X],H=t.bins[X];if(W.dataType===pe.BinaryAsset)W.buffer=H,W.id&&this.addEffectsObjectData(W);else{var Y=new cc;Y.deserializeFromBinary(new Uint8Array(H));for(var Z,q=_e(Y.exportObjectDatas);!(Z=q()).done;){var K=Z.value;this.addEffectsObjectData(K)}}}for(var Q,J=_e(n);!(Q=J()).done;){var $=Q.value;this.addEffectsObjectData($)}},r.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},r.mainLoop=function(t){var e,i=this.renderErrors;if(i.size>0)return this.emit("rendererror",i.values().next().value),void(null==(e=this.ticker)||e.pause());t=Math.min(t,33)*this.speed;var r=this.compositions;r.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var n,a,o=!1,s=_e(r);!(n=s()).done;){var u=n.value;u.textureOffloaded?(o=!0,tt.error("Composition "+u.name+" texture offloaded, skip render.")):u.update(t)}if(o)return this.emit("rendererror",new Error("Play when texture offloaded.")),void(null==(a=this.ticker)||a.pause());for(var h,l=_e(r);!(h=l()).done;){h.value.sceneTicking.preRender.tick(0)}this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var c,f=_e(r);!(c=f()).done;){var d=c.value;this.renderer.renderRenderFrame(d.renderFrame)}this.renderTargetPool.flush()},r.resize=function(){var t,i,r,n,a=this.canvas.parentElement;if(a){var o=this.getTargetSize(a);t=o[0],i=o[1],r=o[2],n=o[3]}else t=r=this.canvas.width,i=n=this.canvas.height;var s=t/i;if(t&&i){var u=e.document.documentElement.clientWidth;r>2*u&&tt.error("DPI overflowed, width "+r+" is more than 2x document width "+u+", see "+Kr["DPI overflowed"]+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(r>h||n>h)&&(tt.error("Container size overflowed "+r+"x"+n+", see "+Kr["Container size overflowed"]+"."),s>1?(r=Math.round(h),n=Math.round(h/s)):(n=Math.round(h),r=Math.round(h*s))),this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",tt.info("Resize engine "+this.name+" ["+r+","+n+","+t+","+i+"]."),this.setSize(r,n)}},r.setSize=function(t,e){var i;this.getWidth()===t&&this.getHeight()===e||(this.canvas.width=t,this.canvas.height=e,this.viewport(0,0,t,e)),null==(i=this.compositions)||i.forEach((function(i){i.camera.aspect=t/e})),this.emit("resize",this)},r.getTargetSize=function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Kr["Container is not an HTMLElement"]+".");var i,r,n=this.displayAspect,a=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),o=0,s=0;(a?(o=parseInt(a.width,10),s=parseInt(a.height,10)):(o=t.clientWidth,s=t.clientHeight),n)?o/s>n?i=(r=s*this.displayScale)*n:r=(i=o*this.displayScale)/n:(i=o,r=s);var u=this.pixelRatio,h=i,l=r;if(i=Math.round(i*u),r=Math.round(r*u),i<1||r<1){if(!this.offscreenMode)throw new Error("Invalid container size "+i+"x"+r+", see "+Kr["Invalid container size"]+".");i=r=h=l=1}return[h,l,i,r]},r.addTexture=function(t){this.disposed||d(this.textures,t)},r.removeTexture=function(t){this.disposed||p(this.textures,t)},r.addMaterial=function(t){this.disposed||d(this.materials,t)},r.removeMaterial=function(t){this.disposed||p(this.materials,t)},r.addGeometry=function(t){this.disposed||d(this.geometries,t)},r.removeGeometry=function(t){this.disposed||p(this.geometries,t)},r.addMesh=function(t){this.disposed||d(this.meshes,t)},r.removeMesh=function(t){this.disposed||p(this.meshes,t)},r.addRenderPass=function(t){this.disposed||d(this.renderPasses,t)},r.removeRenderPass=function(t){this.disposed||p(this.renderPasses,t)},r.addComposition=function(t){this.disposed||d(this.compositions,t)},r.removeComposition=function(t){this.disposed||p(this.compositions,t)},r.getWidth=function(){return 0},r.getHeight=function(){return 0},r.getShaderLibrary=function(){return null},r.bindSystemFramebuffer=function(){},r.viewport=function(t,e,i,r){},r.clear=function(t){},r.drawGeometry=function(t,e,i,r){},r.setSampleAlphaToCoverage=function(t){},r.setBlending=function(t){},r.setDepthTest=function(t){},r.setStencilTest=function(t){},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(){var t,e,i;if(!this.disposed){this._disposed=!0;var r=[];this.renderPasses.length>0&&r.push("Pass "+this.renderPasses.length),this.meshes.length>0&&r.push("Mesh "+this.meshes.length),this.geometries.length>0&&r.push("Geom "+this.geometries.length),this.textures.length>0&&r.push("Tex "+this.textures.length),r.length>0&&tt.warn("Release GPU memory: "+r.join(", ")+"."),null==(t=this.ticker)||t.stop(),null==(e=this.eventSystem)||e.dispose(),null==(i=this.assetService)||i.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.compositions.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.compositions=[]}},Pi(i,[{key:"disposed",get:function(){return this._disposed}}]),i}(Qr),pc={format:Di.RGBA,type:Di.UNSIGNED_BYTE,minFilter:Di.LINEAR,magFilter:Di.LINEAR,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE},mc=Symbol("dispose"),vc=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,i=t.width,r=t.height,n=t.name,a={sourceType:exports.TextureSourceType.framebuffer,data:{width:i,height:r},name:n},o=[n];Object.getOwnPropertyNames(pc).forEach((function(e){var i,r=null!=(i=t[e])?i:pc[e];a[e]=r,o.push(e,r)}));var s=o.join(":"),u=this.textureCache[s];if(u)this.textureRef[s]++;else{var h=this.engine;Y(h),u=pr.create(h,a),this.textureCache[s]=u,this.textureRef[s]=1,u[mc]=u.dispose,u.dispose=function(){return e.removeTexture(s)}}return u},e.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[mc](),i.dispose=i[mc]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var i=t.textureCache[e];i[mc](),i.dispose=i[mc]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),yc=function(){function t(){}return t.load=function(t,i,n){void 0===n&&(n={});var a=this;return r((function(){var r,s,u,h,l,c,f,d,p,m,v,y,g;return o(this,(function(o){switch(o.label){case 0:return h=e.performance.now(),l=null==(s=i.gpuCapability)||null==(r=s.detail)?void 0:r.asyncShaderCompile,c=i.compositions.length,f=new Nl(n),i.assetManagers.push(f),[4,f.loadScene(t,i.renderer)];case 1:return d=o.sent(),i.clearResources(),yt.onAssetsLoadFinish(d,f.options,i),i.assetService.prepareAssets(d,d.assets),i.assetService.updateTextVariables(d,n.variables),(p=a.createComposition(d,i,n)).setIndex(c),m=e.performance.now(),[4,new Promise((function(t){var e;null==(e=i.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:return o.sent(),v=e.performance.now()-m,null==(u=i.ticker)||u.start(),y=p.name,g=e.performance.now()-h,p.statistic.compileTime=v,p.statistic.firstFrameTime=g,tt.info("First frame ["+y+"]: "+g.toFixed(4)+"ms."),tt.info("Shader "+(l?"async":"sync")+" compile ["+y+"]: "+v.toFixed(4)+"ms."),[2,p]}}))}))()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=new Hl(e,He({},i,{event:e.eventSystem}),t);return e.env!==qr&&e.assetService.createShaderVariant(),r},t}(),gc=function(){function t(){}return t.instantiate=function(t,i){var r=t.scene,a=t.scene.jsonScene,o=t.options,s=i.engine;s.clearResources(),yt.onAssetsLoadFinish(r,o,s),s.assetService.prepareAssets(r,r.assets),s.assetService.updateTextVariables(r,o.variables),i.createTexturesFromData(r.textureOptions);for(var u,h=_e(Object.keys(r.assets));!(u=h()).done;){var l=u.value,c=r.assets[l];n(c,e.HTMLVideoElement)&&i.videos.push(c)}var f=a.compositionId,d=a.compositions.find((function(t){return t.id===f}));if(!d)throw new Error('Composition with id "'+f+'" not found in JSONScene.');var p,m=new exports.VFXItem(s);return m.instantiatePreComposition(d),m.getComponent(exports.CompositionComponent).playOnStart=null==(p=o.autoplay)||p,m.getComponent(exports.CompositionComponent).endBehavior=0,i.addItem(m),m},t}();vt("camera",Go),vt("text",gh),vt("sprite",ts),vt("particle",lh),vt("interact",qo);function xc(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}tt.info("Core version: 2.9.1.");var bc,Tc,Ec=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,a=e.target,o=void 0===a?Di.ARRAY_BUFFER:a,s=e.type,u=void 0===s?Di.FLOAT:s,h=e.usage,l=void 0===h?Di.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=_c[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(u);this.target=o,this.type=u,this.usage=l,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=c,r?this.bufferData(r):n&&this.bufferData(c*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.engine.gl.createBuffer();return xc(e,t),e},e.bind=function(){this.engine.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.engine){this.byteLength=e;var i=this.engine.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.engine){var i=this.engine.gl,r=this.target,n=t*this.bytesPerElement,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.engine.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Ui(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},Pi(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),_c=((bc={})[Di.INT]=Int32Array,bc[Di.FLOAT]=Float32Array,bc[Di.SHORT]=Int16Array,bc[Di.BYTE]=Int8Array,bc[Di.UNSIGNED_BYTE]=Uint8Array,bc[Di.UNSIGNED_INT]=Uint32Array,bc[Di.UNSIGNED_SHORT]=Uint16Array,bc);var Sc=((Tc={})[Uint8Array.BYTES_PER_ELEMENT]=Di.UNSIGNED_BYTE,Tc[Uint16Array.BYTES_PER_ELEMENT]=Di.UNSIGNED_SHORT,Tc[Uint32Array.BYTES_PER_ELEMENT]=Di.UNSIGNED_INT,Tc),Cc=1,wc=function(t){function i(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}Vt(i,t);var r=i.prototype;return r.getOptions=function(){return He({},this.options)},r.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;Y(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new Ec(t.engine,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},r.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},r.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},r.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},r.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,a=e+i.length;if(r.data.length<a){var o=new i.constructor(a);o.set(r.data),r.data=o,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var s=this.dirtyFlags[t];void 0!==s.start&&(s.start=Math.min(s.start,n)),void 0!==s.end&&(s.end=Math.max(s.end,a-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},r.getIndexData=function(){return this.indices},r.setIndexData=function(t){(n(t,Uint8Array)||n(t,Uint16Array)||n(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},r.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var a=new e.constructor(n);a.set(this.indices),this.indices=a,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var o=this.dirtyFlags.index;void 0!==o.start&&(o.start=Math.min(o.start,r)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},r.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*ro[n]},r.getAttributeNames=function(){return this.attributesName},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.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},r.createIndicesBuffer=function(t){var e=Sc[t.BYTES_PER_ELEMENT],i={data:t,target:Di.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new Ec(this.engine,i)},r.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var a,o,s=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,o=r;else{var u=e[n].dataSource;a=t.buffers[u],o=i[u].data}if((s.dirty||s.discard)&&a&&o){if(s.discard)a.bufferData(o);else if(void 0!==s.start&&void 0!==s.end){var h=s.start*o.BYTES_PER_ELEMENT+o.byteOffset,l=s.end-s.start+1,c=new o.constructor(o.buffer,h,l);a.bufferSubData(s.start,c)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)})),this.indicesReleasable}},r.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,a=e.drawCount,o=e.mode,s=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+Cc++:u,l=e.bufferUsage,c=void 0===l?Di.STATIC_DRAW:l;this.name=h;var f={},d=[],p={},m={},v={},y=c;this.drawStart=r,void 0!==a&&(this.drawCount=a),this.mode=isNaN(o)?Di.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,a=i.stride,o=i.offset,s=i.normalize,u=i.type,h=void 0===u?Di.FLOAT:u,l=i.releasable,c=i.data;if(!h||"dataSource"in i||c||(c=ao(h)),c){var g=n(c,Float32Array)?Di.FLOAT:Di.INT;f[t]={data:c,usage:y,target:Di.ARRAY_BUFFER,name:t},p[t]={size:r,stride:a,offset:o,type:null!=h?h:g,normalize:!!s,dataSource:t},v[t]=null!=l&&l,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(p[t]={size:r,stride:a,offset:o,type:h,dataSource:x,normalize:!!s})}d.push(t)})),m.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=!0===(null==s?void 0:s.releasable),this.bufferProps=f,this.attributes=p,this.attributesName=d,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},r.fromData=function(i){var r,n=this;if(t.prototype.fromData.call(this,i),this.subMeshes=i.subMeshes,i.buffer?r=new Uint8Array(function(t){for(var i=e.atob(t),r=new Uint8Array(i.length),n=0;n<i.length;n++)r[n]=i.charCodeAt(n);var a=r.buffer;return a}(i.buffer)):i.binaryData&&(r=i.binaryData),r){var a=i.vertexData.vertexCount;if(this.hasSemantic(i)){var o={mode:Di.TRIANGLES,attributes:{}};if(i.vertexData.channels.forEach((function(t){var e,i=null!=(e=Ac[t.semantic])?e:t.semantic,s=n.createVertexTypedArray(t,r,a);o.attributes[i]={type:ji(t.format),size:t.dimension,data:s,normalize:t.normalize}})),i.indexFormat!==ye.None){var s=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset);o.indices={data:s},o.drawCount=s.length}else o.drawCount=a;this.processProps(o)}else{var u=i.vertexData.channels[0],h=i.vertexData.channels[1],l=i.vertexData.channels[2],c=this.createVertexTypedArray(u,r,a),f=this.createVertexTypedArray(h,r,a),d=this.createVertexTypedArray(l,r,a),p=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset),m={mode:Di.TRIANGLES,attributes:{aPos:{type:ji(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:ji(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:ji(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:i.boneNames,rootBoneName:i.rootBoneName,inverseBindMatrices:i.inverseBindMatrices}}},r.dispose=function(){var e,i=this;(this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized)&&(Object.keys(this.buffers).forEach((function(t){i.buffers[t].dispose()})),this.buffers={},null==(e=this.indicesBuffer)||e.dispose(),Object.keys(this.vaos).forEach((function(t){var e;null==(e=i.vaos[t])||e.dispose(),i.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&this.engine.removeGeometry(this));this.destroyed=!0,t.prototype.dispose.call(this)},r.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case ve.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},r.createIndexTypedArray=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,a=e.byteLength-i;switch(t){case ye.UInt16:return new Uint16Array(r,n,a/Uint16Array.BYTES_PER_ELEMENT);case ye.UInt32:return new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT)}},r.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},Pi(i,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),i}(no),Ac={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var Mc,Pc,Ic=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}Vt(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.engine.gl.createRenderbuffer())},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer.engine,r=i.gl;i.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):tt.error("Invalid render buffer size: "+t+"x"+e+".")}}else tt.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.engine.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=lt},e}(Po),Rc=((Mc={})[Di.RGBA]=34842,Mc[Di.RGB]=34843,Mc[Di.ALPHA]=33325,Mc[Di.RED]=33325,Mc[Di.LUMINANCE_ALPHA]=33327,Mc[Di.LUMINANCE]=33325,Mc),Oc=((Pc={})[Di.RGBA]=34836,Pc[Di.RGB]=34837,Pc[Di.ALPHA]=33326,Pc[Di.RED]=33326,Pc[Di.LUMINANCE_ALPHA]=33328,Pc[Di.LUMINANCE]=33326,Pc),Nc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.bind=function(t){this.engine.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){this.engine.addTexture(this);var t=this.engine.gl,e=this.source,i=e.target,r=void 0===i?t.TEXTURE_2D:i,n=e.name;this.textureBuffer=t.createTexture(),xc(this.textureBuffer,n),this.target=r,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case exports.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case exports.TextureSourceType.data:delete this.source.data;break;case exports.TextureSourceType.compressed:case exports.TextureSourceType.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.engine||!this.textureBuffer)return this.width=0,void(this.height=0);var i=this.target,r=this.source,n=this.engine.gl,a=this.engine.gpuCapability.detail,o=r.sourceType,s=r.data,u=r.cube,h=r.image,l=r.video,c=r.mipmaps,f=r.mipmaps,d=t.data,p=t.cube,m=t.generateMipmap,v=void 0!==m&&m,y=t.mipmaps,g=r.format,x=r.type,b=r.internalFormat,T=0,E=0;this.bind(o===exports.TextureSourceType.video),x===Di.HALF_FLOAT?((x=a.halfFloatTexture)||tt.error("Half float texture is not support."),Ui(n)&&b===g&&(g===Di.LUMINANCE&&(g=Di.RED),b=Rc[g]),a.halfFloatLinear||(r.minFilter=r.magFilter=n.NEAREST,tt.warn("Half float linear not support, change to NEAREST."))):x===n.FLOAT&&((x=a.floatTexture)||tt.error("Float texture is not support."),Ui(n)&&b===g&&(g===Di.LUMINANCE&&(g=Di.RED),b=Oc[g]),a.floatLinear||(r.minFilter=n.NEAREST,r.magFilter=n.NEAREST,tt.warn("Float linear not support, change to NEAREST."))),void 0===r.premultiplyAlpha&&(r.premultiplyAlpha=!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),void 0===r.flipY&&(r.flipY=!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,r.flipY);var _,S,C=function(t,e){ut(t)&&ut(e)||Ui(n)?n.generateMipmap(i):console.error("Mipmap generation failed. Texture width and height must be power of two in WebGL1.")};if(o===exports.TextureSourceType.framebuffer)d&&(T=null!=(_=d.width)?_:0,E=null!=(S=d.height)?S:0,T&&E&&(this.width!==T||this.height!==E)&&n.texImage2D(i,0,b,T,E,0,g,x,null));else if(o===exports.TextureSourceType.data){var w;if(i===n.TEXTURE_CUBE_MAP)p.forEach((function(t,i){var r=e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],o=r[1];T=Math.max(a,T),E=Math.max(o,E)}));else w=this.texImage2DData(n,i,0,b,g,x,s),T=w[0],E=w[1],v&&C(T,E)}else if(o===exports.TextureSourceType.image||o===exports.TextureSourceType.video){if(i===n.TEXTURE_CUBE_MAP)u.forEach((function(t,i){var r=e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],o=r[1];T=Math.max(a,T),E=Math.max(o,E)}));else if(i===n.TEXTURE_2D){var A,M=null!=h?h:l;A=this.texImage2D(n,i,0,b,g,x,M),T=A[0],E=A[1]}v&&C(T,E)}else if(o===exports.TextureSourceType.mipmaps){var P;i===n.TEXTURE_2D?c.forEach((function(t,r){var a;(P="data"in t?e.texImage2DData(n,i,r,b,g,x,t):e.texImage2D(n,i,r,b,g,x,t),0===r)&&(T=(a=P)[0],E=a[1])})):i===n.TEXTURE_CUBE_MAP&&f.forEach((function(t,i){t.forEach((function(t,r){var a;(P="data"in t?e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t):e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t),0===i)&&(T=(a=P)[0],E=a[1])}))}))}else o===exports.TextureSourceType.compressed&&y&&0!==y.length&&(T=y[0].width,E=y[0].height,y.forEach((function(t,e){n.compressedTexImage2D(i,e,b,t.width,t.height,0,t.data)})));this.width=T,this.height=E,this.setTextureFilters(n,i,r)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,a=i.wrapS,o=void 0===a?t.CLAMP_TO_EDGE:a,s=i.wrapT,u=void 0===s?t.CLAMP_TO_EDGE:s,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=Ui(t)||ut(this.width)&&ut(this.height),c=i.magFilter?i.magFilter:t.NEAREST,f=i.minFilter?i.minFilter:t.NEAREST;l||f!==t.LINEAR_MIPMAP_LINEAR&&f!==t.LINEAR_MIPMAP_NEAREST&&f!==t.NEAREST_MIPMAP_LINEAR&&f!==t.NEAREST_MIPMAP_NEAREST||(f=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,f),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,l?o:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?u:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,a=r.sourceFrom,o=r.name,s=void 0===o?"":o;this.source=r,this.sourceType=n,this.sourceFrom=a,this.name=s},i.texImage2D=function(t,e,i,r,n,a,o){var s,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(s=this.engine.gpuCapability.detail.maxTextureSize)?s:2048,v=o;if(l!==exports.TextureSourceType.video){var y=c!==t.NEAREST||f!==t.NEAREST||d!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(y=y||o.width>m||o.height>m)&&setTimeout((function(){v=u.resizeImage(o)}))}t.texImage2D(e,i,r,n,a,v);var g=[v.width,v.height];return l===exports.TextureSourceType.video?[o.videoWidth,o.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,a,o){var s=o.data,u=o.width,h=o.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Ui(this.engine.gl)&&t.width<n&&t.height<n)return t;var a=function(t,e,i,r){var n=t.width,a=t.height,o=Math.min(e,i||vn(n)),s=Math.min(e,r||vn(a));if(s!==a||o!==n){var u=ch.getCanvas(),h=u.getContext("2d");return u.width=o,u.height=s,null==h||h.drawImage(t,0,0,n,a,0,0,o,s),tt.warn("Image resize from "+n+"x"+a+" to "+o+"x"+s+"."),u}}(t,n,e,i);return a||t},i.reloadData=function(){var t=this;return r((function(){return o(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Er().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&Er().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.engine.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},i.uploadCurrentVideoFrame=function(){var t=this;return r((function(){return o(this,(function(e){return t.source.sourceType===exports.TextureSourceType.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(He({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.engine&&this.textureBuffer&&this.engine.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){tt.error("This texture has been destroyed.")},this.initialize=lt,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(pr);var Lc=1,Fc=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,a=e.depthStencilAttachment,o=e.viewport,s=e.storeAction,u=e.name,h=void 0===u?"GLFramebuffer"+Lc++:u;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==a?void 0:a.storageType)?n:exports.RenderPassAttachmentStorageType.none,r.viewport=o,r.name=h,r.storeAction=s,r.updateProps(e),r}Vt(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.updateAttachmentTextures=function(){var t=this,e=this.viewport[2],i=this.viewport[3];this.attachmentTextures.length=0,this.colorTextures.forEach((function(r){var n={width:e,height:i,data:new Uint8Array(0)};r.initialize(),r.update({data:n}),d(t.attachmentTextures,r.textureBuffer)})),this.stencilTexture&&d(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&(this.depthTexture.update({data:{width:e,height:i,data:new Uint16Array(0)}}),d(this.attachmentTextures,this.depthTexture.textureBuffer))},i.updateProps=function(t){var e,i,r=this.renderer,a=this.engine.gpuCapability,o=null!=(i=t.depthStencilAttachment)?i:{storageType:exports.RenderPassAttachmentStorageType.none},s=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!a.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,l=a.detail.readableDepthStencilTextures,c=o.storageType,f=o.storage;if(this.colorTextures=t.attachments.slice(),!s&&c!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(s&&(this.fbo=this.engine.createGLFramebuffer(this.name)),c){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!n(f,Ic))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Ic({format:Di.DEPTH_STENCIL,attachment:Di.DEPTH_STENCIL_ATTACHMENT,storageType:c},r);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!n(f,Ic))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Ic({attachment:Di.DEPTH_ATTACHMENT,format:Di.DEPTH_COMPONENT16,storageType:c},r);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!n(f,Ic))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Ic({attachment:Di.STENCIL_ATTACHMENT,format:Di.STENCIL_INDEX8,storageType:c},r);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!l)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Nc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Di.DEPTH_COMPONENT,internalFormat:a.internalFormatDepth16,type:Di.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!l)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Nc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Di.DEPTH_STENCIL,internalFormat:a.internalFormatDepth24_stencil8,type:a.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.engine.gl,r=this.colorTextures.length;if(t&&Ui(i)&&r>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&d(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&d(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var a=0;a<r;a++)d(n,i["COLOR_ATTACHMENT"+a]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.engine.gl;Ui(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.engine.gl,i=this.engine,r=this.viewport,n=r[0],a=r[1],o=r[2],s=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,o,s);var u=this.renderer.engine.whiteTexture,h=u.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==h&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),u.bind())}));for(var l=0;l<4;l++)i.activeTexture(e.TEXTURE0+l),u.bind();if(!this.ready){var c=this,f=c.depthStencilRenderbuffer,d=c.depthTexture,p=c.stencilTexture;if(i.activeTexture(e.TEXTURE0),f)f.setSize(o,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,f.attachment,e.RENDERBUFFER,f.buffer);else if(d){d.source.data={width:o,height:s},d.update({data:{width:o,height:s,data:new Uint16Array(0)}});var m=d&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,m,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(e.FRAMEBUFFER);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+v+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+". width="+o+", height="+s+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.engine.gl,r=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var o,s=_e(e);!(o=s()).done;){o.value.initialize()}this.colorTextures=e.slice()}this.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var o={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:o}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),a.push(!0)})),r.drawBuffers(i,a),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,a=n[0],o=n[1],s=n[2],u=n[3];a===t&&o===e&&s===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){var e;this.engine.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(n===exports.RenderPassDestroyAttachmentType.force||n===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose();for(var a,o=_e(this.colorTextures);!(a=o()).done;){a.value.dispose()}null==(e=this.stencilTexture)||e.dispose(),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},Pi(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(Ka),Vc=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return Ui(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),xc(e,t),e},e.bindVertexArray=function(t){var e;Ui(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Ui(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),kc=function(){function t(t,e,i){this.engine=t,this.program=e,this.id=i,this.engine.useProgram(e),this.attribInfoMap=this.createAttribMap(),this.engine.useProgram(null)}var e=t.prototype;return e.bind=function(){this.engine.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,a=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new Vc(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var o=t.buffers[n.dataSource];if(!o)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");o.bind(),a.enableVertexAttribArray(i.loc),a.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.engine.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=t.getActiveAttrib(e,n);if(a){var o=a.name,s=a.type,u=a.size,h=t.getAttribLocation(e,o);i[o]={type:s,name:o,size:u,loc:h}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),Dc=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}Vt(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.engine.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.engine.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.engine.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.engine.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.engine.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.engine.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.engine.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.engine.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.engine.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.engine.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.engine.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.engine.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.engine.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.engine.getUniforms(this.program.program,t),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var o=i[r];this.samplerChannels[o]=r}},i.toData=function(){var t=this.definition;t.dataType=pe.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var e;this.compileResult&&this.compileResult.shared||(null==(e=this.program)||e.dispose(),t.prototype.dispose.call(this))},i.bind=function(){this.program.bind()},i.isReady=function(){return!!this.program},e}(Fr),zc=0,Bc=function(){function t(t){this.engine=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=t.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=_e(Object.keys(this.cachedShaders));!(i=n()).done;){var a=i.value;this.cachedShaders[a].initialized||r.push(a)}t?r.length?Promise.all(r.map((function(t){return new Promise((function(i){return e.compileShader(e.cachedShaders[t],i)}))}))).then(t).catch((function(){return 0})):t([]):r.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},i.addShader=function(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var a=He({},t,{vertex:To.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:To.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),o=this.computeShaderCacheId(a);if(this.cachedShaders[o])return o;this.shaderAllDone=!1;var s=!1;return(a.shared||a.cacheId)&&(s=!0),this.cachedShaders[o]=new Dc(this.engine,He({},a,{vertex:a.vertex,fragment:a.fragment,name:a.name||o,shared:s})),this.cachedShaders[o].id=o,o},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(t,i){var r=this,n=t.source,a=n.shared,o=n.vertex,s=n.fragment,u=n.name,h=t.source.cacheId,l=!1;(a||h)&&(l=!0);var c=this.engine.gl,f={shared:l,status:exports.ShaderCompileResultStatus.compiling},d=this.createProgram(c,o,s,f),p=this.glAsyncCompileExt,m=e.performance.now(),v=function(i){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=i,t.initialized=!0,void 0!==r.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),r.programMap[t.id]=i},y=function(){if(r.engine.disposed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(t.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&1==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){xc(n,u);var a=new kc(r.engine,n,t.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(a);else{var h=c.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?v(a):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",o,"\nfragment:\n",s),c.deleteProgram(n))}}null==i||i(f)}else i&&e.requestAnimationFrame(y)};t.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,a=t.shared,o=t.cacheId;return a||o?o||"shared_"+Gc(i,n):"instanced_"+zc++},i.createProgram=function(t,e,i,r){var n=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,e),o=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&a&&o?(t.attachShader(n,a),t.attachShader(n,o),t.linkProgram(n),r.program=n,r.status=exports.ShaderCompileResultStatus.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var s=t.getProgramInfoLog(n);console.error("Failed to link program: "+s+".");var u=Uc(t,a,"vertex",e),h=Uc(t,o,"fragment",i);return r.status=exports.ShaderCompileResultStatus.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=exports.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Gc(null!=i?i:""),a=r.get(n);if(a)return a;var o=t.createShader(e);return o&&(t.shaderSource(o,i),t.compileShader(o),r.set(n,o)),o},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.engine){var e=this.engine.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function Uc(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}function Gc(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var a=e[n],o=0;o<a.length;o++)r=Math.imul(31,r)+a.charCodeAt(o)|0;return r}var jc=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],Y(t),this.gl=Li(t,e,i),this.contextLostListener=function(t){for(var e,i,n=_e(r.lostHandlers);!(i=n()).done;){i.value.lost(t)}null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=_e(r.restoreHandlers);!(i=n()).done;){i.value.restore()}null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){var t;(this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl)&&(null==(t=this.gl.getExtension("WEBGL_lose_context"))||t.loseContext());this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),Xc=function(t){function i(i,n){var a;(a=t.call(this,i,n)||this).restoreCompositionsCache=[],n=He({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,glType:"webgl2"},n),a.context=new jc(i,n.glType,n),a.context.addLostHandler({lost:function(t){var e;null==(e=a.ticker)||e.pause(),a.restoreCompositionsCache=a.compositions.slice(),a.compositions.forEach((function(e){return e.lost(t)})),t.preventDefault(),tt.error("WebGL context lost. Event target: "+t.target+"."),a.emit("contextlost",{engine:zl(a),e:t})}});var s=zl(a);a.context.addRestoreHandler({restore:r((function(){var t,i;return o(this,(function(n){switch(n.label){case 0:if(!(i=s.context.gl))throw new Error("Can not restore automatically because losing gl context.");return s.reset(),s.shaderLibrary=new Bc(s),s.gpuCapability=new Oo(i),[4,Promise.all(s.restoreCompositionsCache.map(r((function(t){var e,i,r,n,a,u,h,l,c,f,d;return o(this,(function(o){switch(o.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.reusable,a=t.renderOrder,u=t.transform,h=t.videoState,[4,yc.load(i,s)];case 1:(l=o.sent()).speed=r,l.reusable=n,l.renderOrder=a,l.transform.setPosition(u.position.x,u.position.y,u.position.z),l.transform.setRotation(u.rotation.x,u.rotation.y,u.rotation.z),l.transform.setScale(u.scale.x,u.scale.y,u.scale.z),l.onItemMessage=t.onItemMessage,c=0,o.label=2;case 2:return c<h.length?h[c]?((f=l.textures[c].source.video).currentTime=null!=(d=h[c])?d:0,[4,f.play()]):[3,4]:[3,5];case 3:o.sent(),o.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return n.sent(),s.restoreCompositionsCache=[],null==(t=s.ticker)||t.resume(),F()&&s.canvas&&(s.canvas.style.display="none",e.window.setTimeout((function(){s.canvas.style.display=""}),0)),s.emit("contextrestored",s),[2]}}))}))});var u=a.context.gl;return Y(u),a.gl=u,a.reset(),a.gpuCapability=new Oo(u),a.shaderLibrary=new Bc(zl(a)),a.renderer=new Fo(zl(a)),a.maxTextureCount=a.gl.TEXTURE0+a.gl.getParameter(a.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,a.resize(),a}Vt(i,t);var n=i.prototype;return n.getWidth=function(){return this.gl.drawingBufferWidth},n.getHeight=function(){return this.gl.drawingBufferHeight},n.getShaderLibrary=function(){return this.shaderLibrary},n.createGLFramebuffer=function(t){var e=this.gl.createFramebuffer();if(!e)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return xc(e,t,t),e},n.createVAO=function(t){return new Vc(this,t)},n.deleteGLTexture=function(t){t.textureBuffer&&!this.disposed&&(this.gl.deleteTexture(t.textureBuffer),t.textureBuffer=null)},n.deleteGPUBuffer=function(t){t&&!this.disposed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},n.deleteGLFramebuffer=function(t){t&&!this.disposed&&(this.gl.deleteFramebuffer(t.fbo),delete t.fbo)},n.deleteGLRenderbuffer=function(t){t&&!this.disposed&&(this.gl.deleteRenderbuffer(t.buffer),t.buffer=null)},n.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush();var n=this.renderingData;i.setMatrix("effects_ObjectToWorld",e);try{i.use(this.renderer,n.currentFrame.globalUniforms)}catch(t){return console.error(t),void this.renderErrors.add(t)}var a=this.gl;if(a){var o=t,s=i.shaderVariant.program.setupAttributes(o),u=o.indicesBuffer,h=o.drawStart,l=o.drawCount,c=o.mode,f=o.subMeshes;if(f&&f.length){var d,p=f[r];if(l<0)return;if(h=p.offset,u)l=null!=(d=p.indexCount)?d:0;else l=p.vertexCount}u?a.drawElements(c,l,u.type,null!=h?h:0):a.drawArrays(c,h,l),null==s||s.unbind()}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")}},n.clear=function(t){var e=0;if(t.colorAction===exports.TextureLoadAction.clear){var i=t.clearColor;i&&this.clearColor(i[0],i[1],i[2],i[3]),this.colorMask(!0,!0,!0,!0),e=Di.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(this.stencilMask(255),this.clearStencil(t.clearStencil||0),e|=Di.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var r=t.clearDepth;this.depthMask(!0),this.clearDepth(Number.isFinite(r)?r:1),e|=Di.DEPTH_BUFFER_BIT}e&&this.gl.clear(e)},n.dispose=function(){var e;this.disposed||(t.prototype.dispose.call(this),this.renderer.dispose(),this.renderTargetPool.dispose(),null==(e=this.shaderLibrary)||e.dispose(),this.context.dispose(),this.reset())},n.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Di.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},n.setSampleAlphaToCoverage=function(t){t?this.enable(Di.SAMPLE_ALPHA_TO_COVERAGE):this.disable(Di.SAMPLE_ALPHA_TO_COVERAGE)},n.setBlending=function(t){t?this.enable(Di.BLEND):this.disable(Di.BLEND)},n.setDepthTest=function(t){t?this.enable(Di.DEPTH_TEST):this.disable(Di.DEPTH_TEST)},n.setStencilTest=function(t){t?this.enable(Di.STENCIL_TEST):this.disable(Di.STENCIL_TEST)},n.setCulling=function(t){t?this.enable(Di.CULL_FACE):this.disable(Di.CULL_FACE)},n.setPolygonOffsetFill=function(t){t?this.enable(Di.POLYGON_OFFSET_FILL):this.disable(Di.POLYGON_OFFSET_FILL)},n.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},n.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},n.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},n.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},n.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},n.useProgram=function(t){this.set1("useProgram",t)},n.clearDepth=function(t){this.set1("clearDepth",t)},n.depthFunc=function(t){this.set1("depthFunc",t)},n.depthMask=function(t){this.set1("depthMask",t)},n.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},n.depthRange=function(t,e){this.set2("depthRange",t,e)},n.clearStencil=function(t){this.set1("clearStencil",t)},n.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},n.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},n.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},n.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},n.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},n.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},n.cullFace=function(t){this.set1("cullFace",t)},n.frontFace=function(t){this.set1("frontFace",t)},n.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},n.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},n.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},n.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},n.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},n.blendEquation=function(t){this.set1("blendEquation",t)},n.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},n.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},n.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},n.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},n.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},n.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},n.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),r.x===e&&r.y===i||this.gl[t](r.x=e,r.y=i)},n.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===i&&n.z===r||this.gl[t](n.x=e,n.y=i,n.z=r)},n.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),a.x===e&&a.y===i&&a.z===r&&a.w===n||this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},n.get=function(t){return this.glCapabilityCache[t]},n.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},n.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},n.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},n.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},n.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},n.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},n.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},n.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},n.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},n.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},n.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},n.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},n.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},n.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},n.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},n.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},n.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},i}(dc);function Wc(t,e){return!e||"object"!=((i=e)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)&&"function"!=typeof e?zl(t):e;var i}var Hc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Yc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Zc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",qc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Kc=new Map;var Qc=!1,Jc=1,$c=function(t){function i(i){var n;(n=t.call(this)||this).resumePending=!1,n.disposed=!1,n.lost=function(t){n.handleEmitEvent("webglcontextlost",t)};var a=zl(n);n.restore=r((function(){return o(this,(function(t){return a.emit("webglcontextrestored"),[2]}))}));var s=i.container,u=i.canvas,h=i.fps,l=i.name,c=i.pixelRatio,f=i.manualRender,d=i.renderFramework,p=i.notifyTouch,m=i.onError,v=i.interactive,y=void 0!==v&&v,g=i.renderOptions,x=void 0===g?{}:g,b=i.env,T=void 0===b?"":b,E=x.willCaptureImage,_=x.premultipliedAlpha;if(n.onError=m,Qc||"debug-disable"===d)return Wc(n);var S,C=(S=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===S[1]||"16"===S[1]&&"5"===S[2])?"webgl":"webgl2";d&&(C="webgl"===d?"webgl":"webgl2"),n.env=T,n.name=l||""+Jc++;var w=!1;try{if(ki.length)throw new Error("Errors before player create: "+ki.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?(n.canvas=u,w=!0):(!function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Hc+".")}(s),n.canvas=e.document.createElement("canvas"),s.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.engine=dc.create(n.canvas,{name:l,glType:C,fps:h,env:T,preserveDrawingBuffer:E,premultipliedAlpha:_,manualRender:f,notifyTouch:p,interactive:y,pixelRatio:Number.isFinite(c)?c:O()}),n.engine.offscreenMode=!0,n.engine.on("rendererror",(function(t){n.handleEmitEvent("rendererror",t)})),n.engine.on("contextlost",(function(t){n.lost(t.e)}));var A=zl(n);n.engine.on("contextrestored",r((function(){return o(this,(function(t){switch(t.label){case 0:return[4,A.restore()];case 1:return t.sent(),[2]}}))}))),n.engine.on("click",(function(t){var e=t.behavior||Mt.NOTIFY;n.emit("click",He({},t,{player:zl(n),compositionId:t.composition.id,compositionName:t.composition.name})),e===Mt.RESUME_PLAYER&&n.resume()})),n.engine.on("pointerdown",(function(t){n.emit("pointerdown",t)})),n.engine.on("pointerup",(function(t){n.emit("pointerup",t)})),n.engine.on("pointermove",(function(t){n.emit("pointermove",t)})),n.engine.runRenderLoop((function(t){n.autoPlaying&&n.emit("update",{player:zl(n),playing:!0})})),Kc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&tt.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+qc+".")})),Kc.set(n.canvas,zl(n)),function(){for(var t,e=[],i=_e(Kc.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&tt.error("Current running player count: "+e.length+", see "+Zc+".",e)}()}catch(t){var M;n.canvas&&!w&&n.canvas.remove(),null==(M=n.engine)||M.dispose(),n.disposed=!0,n.handleThrowError(t)}return n}Vt(i,t);var a=i.prototype;return a.setSpeed=function(t){isNaN(t)||(this.engine.speed=t)},a.getSpeed=function(){return this.engine.speed},a.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},a.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},a.getAssetManager=function(){return this.assetManagers},a.loadScene=function(t,e){var i=this;return r((function(){var n,a,s,u,h,l,c,f,d,p;return o(this,(function(m){switch(m.label){case 0:for(Y(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),(a=null==(n=null==e?void 0:e.autoplay)||n)&&(i.autoPlaying=!0),s=[],u=[],rt(t)?(h=s).push.apply(h,[].concat(t)):s.push(t),l=_e(i.assetManagers);!(c=l()).done;)c.value.dispose();return i.engine.assetManagers=[],f=i.engine.compositions.length,[4,Promise.all(s.map(r((function(t,r){var n,s,h,l,c,d,p;return o(this,(function(o){switch(o.label){case 0:return n=f+r,s=i.assetService.assembleSceneLoadOptions(t,He({autoplay:a},e)),h=s.source,l=s.options,d=null==(c=null==l?void 0:l.autoplay)||c,[4,yc.load(h,i.engine,l)];case 1:return(p=o.sent()).setIndex(n),p.onItemMessage=function(t){i.emit("message",t)},u[r]=d,[2,p]}}))}))))];case 1:for(d=m.sent(),p=0;p<d.length;p++)u[p]?d[p].play():d[p].pause();return d.some((function(t){return!t.getPaused()}))&&i.emit("play",{time:0}),[2,rt(t)?d:d[0]]}}))}))()},a.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},a.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.tick(0),this.emit("play",{time:t})},a.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.tick(0),this.emit("pause")},a.playSequence=function(t){for(var e,i=function(e){t[e].on("end",(function(){t[e+1].play()}))},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},a.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),this.compositions.map((function(t){t.pause()})),t&&t.offloadTexture&&this.offloadTexture())},a.resume=function(){var t=this;return r((function(){var e;return o(this,(function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return t.compositions.map((function(t){t.resume()})),null==(e=t.ticker)||e.resume(),[2]}}))}))()},a.tick=function(t){this.engine.mainLoop(t)},a.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},a.resize=function(){this.engine.resize()},a.clearCanvas=function(){this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})},a.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()}))},a.dispose=function(){if(tt.info("Call player destroyed: "+this.name+"."),!this.disposed){Kc.delete(this.canvas),this.pause(),this.engine.dispose(),n(this.canvas,e.HTMLCanvasElement)&&(ch.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var t="Never use destroyed player: "+this.name+" again, see "+Yc+".",i=function(){return function(t){throw new Error(t)}(t)},r=function(){return e=t,Promise.reject(e);var e};this.tick=i,this.resize=i,this.loadScene=r,this.play=r,this.gotoAndPlay=r,this.gotoAndStop=r,this.playSequence=i,this.destroyCurrentCompositions=i,this.resume=r,this.disposed=!0}},a.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},a.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},a.handleEmitEvent=function(t,i){this.onError?n(i,e.Event)?this.onError(new Error(i.type,{cause:t}),i):n(i,Error)?this.onError(new Error(i.message,{cause:t}),i):this.onError(new Error("Unknown error.",{cause:t}),i):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,i))},Pi(i,[{key:"skipPointerMovePicking",get:function(){return this.engine.eventSystem.skipPointerMovePicking},set:function(t){this.engine.eventSystem.skipPointerMovePicking=t}},{key:"ticker",get:function(){return this.engine.ticker}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"gpuCapability",get:function(){return this.engine.gpuCapability}},{key:"compositions",get:function(){return this.engine.compositions}},{key:"assetManagers",get:function(){return this.engine.assetManagers}},{key:"assetService",get:function(){return this.engine.assetService}},{key:"event",get:function(){return this.engine.eventSystem}},{key:"displayAspect",get:function(){return this.engine.displayAspect},set:function(t){this.engine.displayAspect=t}},{key:"displayScale",get:function(){return this.engine.displayScale},set:function(t){this.engine.displayScale=t}},{key:"offscreenMode",get:function(){return this.engine.offscreenMode},set:function(t){this.engine.offscreenMode=t}},{key:"pixelRatio",get:function(){return this.engine.pixelRatio},set:function(t){this.engine.pixelRatio=t}},{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),i}(Qr);a([function(t,e,i){var n=i.value;return i.value=r((function(){var e,i,r,a,s=arguments;return o(this,(function(o){switch(o.label){case 0:for(e=s.length,i=new Array(e),r=0;r<e;r++)i[r]=s[r];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.apply(this,i)];case 2:return[2,o.sent()];case 3:return a=o.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}}))})),i}],$c.prototype,"loadScene",null),pr.create=function(t,e){return new Nc(t,e)},pr.createWithData=function(t,e,i){void 0===e&&(e=U("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Di.UNSIGNED_BYTE:r,a=i.format,o=void 0===a?Di.RGBA:a,s=i.internalFormat,u=i.wrapS,h=void 0===u?Di.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Di.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Di.NEAREST:f,p=i.magFilter,m=void 0===p?Di.NEAREST:p,v=i.flipY,y=void 0!==v&&v,g=i.generateMipmap,x=void 0!==g&&g;return new Nc(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:o,internalFormat:s||o,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y,generateMipmap:x})},no.create=function(t,e){return new wc(t,e)},so.create=function(t,e){return new so(t,e)},Po.create=function(t){return new Ic(t)},Ka.create=function(t,e){return new Fc(t,e)},dc.create=function(t,e){return new Xc(t,e)};var tf="2.9.1";tt.info("Player version: 2.9.1."),exports.ActivationMixerPlayable=hs,exports.ActivationPlayable=ls,exports.AndNode=si,exports.Animatable=qe,exports.AnimationClipNode=Ze,exports.AnimationEvent=os,exports.ApplyAdditiveNode=ai,exports.Asset=xh,exports.AssetLoader=Th,exports.AssetManager=Nl,exports.AssetService=Vl,exports.BYTES_TYPE_MAP=ro,exports.Behaviour=Ni,exports.BezierCurve=ha,exports.BezierCurvePath=qn,exports.BezierCurveQuat=Kn,exports.BezierDataMap=Cn,exports.BezierEasing=Fn,exports.BezierLengthData=_n,exports.BezierMap=Sn,exports.BezierPath=Nn,exports.BezierQuat=Ln,exports.BlendNode=oi,exports.BoolValueNode=je,exports.BoundingBoxInfo=Wr,exports.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",exports.COPY_MESH_SHADER_ID="effects-internal-copy-mesh",exports.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}",exports.Camera=Dl,exports.CameraVFXItemLoader=Go,exports.ColorCurve=ma,exports.ColorPlayable=as,exports.ColorPropertyMixerPlayable=ds,exports.Component=Ii,exports.ComponentTimePlayable=hh,exports.ComponentTimePlayableAsset=uh,exports.ComponentTimeTrack=ah,exports.Composition=Hl,exports.ConstBoolNode=ci,exports.ConstFloatNode=li,exports.ConstraintTarget=Wa,exports.ControlParameterBoolNode=di,exports.ControlParameterFloatNode=fi,exports.ControlParameterTriggerNode=pi,exports.DEFAULT_FONTS=["serif","sans-serif","monospace","courier"],exports.DEFAULT_FPS=60,exports.Database=Eh,exports.Deferred=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},exports.Downloader=Yi,exports.DrawObjectPass=io,exports.EFFECTS_COPY_MESH_NAME="effects-internal-copy",exports.EVENT_TYPE_CLICK=jo,exports.EVENT_TYPE_TOUCH_END=Ho,exports.EVENT_TYPE_TOUCH_MOVE=Wo,exports.EVENT_TYPE_TOUCH_START=Xo,exports.EffectComponentTimeTrack=sh,exports.EffectsObject=Re,exports.EffectsPackage=cc,exports.Ellipse=La,exports.Engine=dc,exports.EventEmitter=Qr,exports.EventSystem=Yo,exports.Float16ArrayWrapper=sn,exports.FloatComparisonNode=xi,exports.FloatComparisonNodeData=gi,exports.FloatPropertyMixerPlayable=ps,exports.FloatValueNode=Ge,exports.Framebuffer=Ka,exports.GLEngine=Xc,exports.GLGeometry=wc,exports.GPUCapability=Oo,exports.Geometry=no,exports.GlobalUniforms=Mo,exports.GradientValue=Hn,exports.GraphInstance=Ai,exports.GraphNode=De,exports.GraphNodeData=ze,exports.Graphics=Vo,exports.GraphicsPath=Ua,exports.HELP_LINK=Kr,exports.InteractLoader=qo,exports.InteractMesh=Qo,exports.InvalidIndex=ke,exports.LayerBlendNode=mi,exports.LineSegments=Yn,exports.LinearValue=Wn,exports.MaskProcessor=Ur,exports.MaskableGraphic=ko,exports.Material=zr,exports.MaterialDataBlock=_r,exports.MaterialState=kr,exports.Mesh=so,exports.NodeTransform=ii,exports.NotNode=hi,exports.NotifyEvent=ss,exports.OrNode=ui,exports.PLAYER_OPTIONS_ENV_EDITOR=qr,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=zu,exports.ParticleBehaviourPlayableAsset=Bu,exports.ParticleLoader=lh,exports.ParticleMesh=Gu,exports.ParticleMixerPlayable=ms,exports.ParticleSystemRenderer=ju,exports.ParticleTrack=Rs,exports.PassTextureCache=vc,exports.PathSegments=Zn,exports.Playable=es,exports.PlayableAsset=rs,exports.PlayableOutput=is,exports.Player=$c,exports.Plugin=Lt,exports.PluginSystem=yt,exports.PointerEventData=Gr,exports.PolyStar=Va,exports.Polygon=Ma,exports.Pose=ri,exports.PoseNode=Be,exports.Precomposition=Rl,exports.PrecompositionManager=gc,exports.PropertyClipPlayable=cs,exports.PropertyTrack=Is,exports.RENDER_PREFER_LOOKUP_TEXTURE=Mu,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=Gn,exports.RandomValue=jn,exports.RandomVectorValue=Xn,exports.RaycastResult=jr,exports.RenderFrame=Co,exports.RenderPass=eo,exports.RenderPassPriorityNormal=1e3,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=Ja,exports.RenderTargetPool=Io,exports.Renderbuffer=Po,exports.Renderer=Fo,exports.RendererComponent=Hr,exports.RuntimeClip=Ps,exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",exports.SPRITE_VERTEX_STRIDE=Zr,exports.SceneLoader=yc,exports.SerializationHelper=bh,exports.ShaderFactory=To,exports.ShaderVariant=Fr,exports.ShapePath=Ba,exports.SpriteColorMixerPlayable=vs,exports.SpriteComponentTimeTrack=oh,exports.SpriteLoader=ts,exports.StateMachineNode=Ti,exports.StateNode=_i,exports.StaticValue=Un,exports.SubCompositionClipPlayable=ys,exports.SubCompositionMixerPlayable=gs,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=Pu,exports.TextComponentBase=ph,exports.TextLayout=fh,exports.TextLoader=gh,exports.TextStyle=dh,exports.Texture=pr,exports.TextureFactory=Tr,exports.Ticker=fc,exports.TimelineClip=Ms,exports.TimelineInstance=ih,exports.TrackMixerPlayable=us,exports.Transform=rn,exports.TransformMixerPlayable=xs,exports.TransformPlayable=ws,exports.TransitionNode=Ci,exports.ValueGetter=Bn,exports.ValueNode=Ue,exports.Vector2Curve=ua,exports.Vector2PropertyMixerPlayable=Es,exports.Vector3Curve=sa,exports.Vector3PropertyMixerPlayable=Ts,exports.Vector4Curve=oa,exports.Vector4PropertyMixerPlayable=bs,exports.addByOrder=X,exports.addItem=d,exports.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}}},exports.applyMixins=dt,exports.assertExist=Y,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=ft,exports.buildBezierData=On,exports.buildEasingCurve=Vn,exports.buildLine=Ea,exports.calculateTranslation=cn,exports.canUseBOM=L,exports.canvasPool=ch,exports.closePointEps=ga,exports.colorGradingFrag=mo,exports.colorStopsFromGradient=P,exports.colorToArr=A,exports.combineImageTemplate=Pl,exports.createGLContext=Li,exports.createKeyFrameMeta=ea,exports.createShape=Ys,exports.createValueGetter=pa,exports.curveEps=xa,exports.decimalEqual=xn,exports.deserializeMipmapTexture=hr,exports.disableAllPlayer=function(t){Qc=!!t},exports.earcut=vu,exports.effectsClass=Me,exports.effectsClassStore=we,exports.enlargeBuffer=m,exports.ensureFixedNumber=Sh,exports.ensureVec3=fn,exports.extractMinAndMax=Tn,exports.gaussianDownHFrag=vo,exports.gaussianDownVFrag=yo,exports.gaussianUpFrag=go,exports.generateEmptyTexture=gr,exports.generateEmptyTypedArray=ao,exports.generateGUID=ct,exports.generateHalfFloatTexture=mr,exports.generateWhiteTexture=yr,exports.getActivePlayers=function(){return Array.from(Kc.values())},exports.getBackgroundImage=Ml,exports.getClass=Ae,exports.getColorFromGradientStops=M,exports.getConfig=Ru,exports.getControlPoints=kn,exports.getDefaultTextureFactory=Er,exports.getGeometryByShape=Eu,exports.getGeometryTriangles=Tu,exports.getKeyFrameMetaByRawValue=ta,exports.getMergedStore=Ie,exports.getNodeDataClass=Fe,exports.getParticleMeshShader=function(t,e,i){var r;void 0===i&&(i="");var n,a=t.content,o=+((null==(r=a.renderer)?void 0:r.renderMode)||0),s=[["RENDER_MODE",o],["ENV_EDITOR",i===qr]],u=e.detail,h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c=u.maxVertexUniforms>0,f=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,d=0,p=0;c&&s.push(["ENABLE_VERTEX_TEXTURE",!0]),f&&(s.push(["SPEED_OVER_LIFETIME",!0]),p|=2,ta(h,f));var m=a.textureSheetAnimation;m&&m.animate&&(s.push(["USE_SPRITE",!0]),p|=4);var v=a.colorOverLifetime;v&&v.color&&(s.push(["COLOR_OVER_LIFETIME",!0]),p|=16);var y=v&&v.opacity;y&&ta(h,y);var g,x=a.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])&&(ta(h,x[r]),i=1,p|=1<<7+e),s.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==x?void 0:x[n])&&(ta(h,x[n]),a=1,p|=1<<10+e,g=!0),s.push(["ORB_VEL_"+t.toUpperCase(),a])})),(null==x?void 0:x.asMovement)&&(s.push(["AS_LINEAR_MOVEMENT",!0]),p|=32),g&&(null==x?void 0:x.asRotation)&&(s.push(["AS_ORBITAL_MOVEMENT",!0]),p|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(ta(h,b.x),s.push(["SIZE_Y_BY_LIFE",1]),p|=16384,ta(h,b.y)):ta(h,b.size)}if(a.rotationOverLifetime){var T=a.rotationOverLifetime;T.z&&(ta(h,null==T?void 0:T.z),p|=32768,s.push(["ROT_Z_LIFETIME",1])),T.separateAxes&&(T.x&&(ta(h,T.x),p|=65536,s.push(["ROT_X_LIFETIME",1])),T.y&&(ta(h,T.y),p|=1<<17,s.push(["ROT_Y_LIFETIME",1]))),(null==T?void 0:T.asRotation)&&(s.push(["ROT_LIFETIME_AS_MOVEMENT",1]),p|=1<<18)}ta(h,null==x?void 0:x.gravityOverLifetime),(null==x?void 0:x.forceTarget)&&(s.push(["FINAL_TARGET",!0]),p|=1<<19,ta(h,x.forceCurve));var E=u.halfFloatTexture;E&&l.max&&(p|=1<<20);var _=u.maxVertexUniforms,S=h.max+h.curves.length-32>_;Ru(Mu)&&(S=!0),S&&E&&c&&(d=1);var C=["-p:",o,p,h.index,h.max,l.index,l.max].join("+"),w={fragment:lo,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+co,shared:!0,cacheId:C,macros:s,name:"particle#"+t.name};return s.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:w,vertex:h.index,fragment:l.index}},exports.getPixelRatio=O,exports.getPlayerByCanvas=function(t){return Kc.get(t)},exports.getPluginUsageInfo=xt,exports.getPreMultiAlpha=Xi,exports.getStandardComposition=bl,exports.getStandardImage=xl,exports.getStandardItem=Sl,exports.getStandardJSON=yl,exports.getTextureSize=wo,exports.glContext=Di,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return ve.Float32;case e.WebGLRenderingContext.SHORT:return ve.Int16;case e.WebGLRenderingContext.BYTE:return ve.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return ve.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return ve.UInt8;default:return ve.Float32}},exports.gpuTimer=function(t){var i=t.getExtension("EXT_disjoint_timer_query_webgl2");if(i){var n=t.createQuery(),a=r((function(){return o(this,(function(r){return[2,new Promise((function(r,o){if(n){var s=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(i.GPU_DISJOINT_EXT);if(s&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);r(h/1e3/1e3)}(s||u)&&(t.deleteQuery(n),n=null),null!==s&&n&&e.window.setTimeout((function(){a().then(r).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(i.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(i.TIME_ELAPSED_EXT)},getTime:a}}},exports.imageDataFromColor=U,exports.imageDataFromGradient=G,exports.initErrors=ki,exports.initGLContext=Bi,exports.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.;}",exports.interpolateColor=I,exports.isAlipayMiniApp=z,exports.isAndroid=V,exports.isArray=rt,exports.isCanvas=st,exports.isCanvasUsedByPlayer=function(t){return Kc.has(t)},exports.isFunction=nt,exports.isIOS=F,exports.isIOSByUA=function(){var t=e.navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},exports.isMiniProgram=function(){return z()||B()},exports.isObject=at,exports.isOpenHarmony=k,exports.isPlainObject=ot,exports.isPowerOfTwo=ut,exports.isSafeFontFamily=q,exports.isSimulatorCellPhone=D,exports.isString=it,exports.isUniformStruct=Sr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&Sr(t[0])},exports.isValidFontFamily=Z,exports.isWebGL2=Ui,exports.isWechatMiniApp=B,exports.itemFrag=ho,exports.itemVert=uo,exports.loadAVIFOptional=Ji,exports.loadBinary=ir,exports.loadBlob=function(t){return nr.apply(this,arguments)},exports.loadImage=tr,exports.loadMedia=sr,exports.loadVideo=ar,exports.loadWebPOptional=Ki,exports.logger=tt,exports.math=Lr,exports.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}}},exports.nearestPowerOfTwo=vn,exports.nodeDataClass=Le,exports.noop=et,exports.normalizeColor=Rh,exports.numberToFix=bn,exports.oldBezierKeyFramesToNew=ca,exports.parsePercent=R,exports.particleFrag=lo,exports.particleOriginTranslateMap=mn,exports.particleUniformTypeMap=Uu,exports.particleVert=co,exports.passRenderLevel=Al,exports.pluginLoaderMap=pt,exports.randomInRange=ht,exports.registerPlugin=vt,exports.removeItem=p,exports.rotateVec2=_u,exports.screenMeshVert=po,exports.serialize=Pe,exports.setBlendMode=Wi,exports.setConfig=function(t,e){return Iu[t]=e},exports.setDefaultTextureFactory=function(t){xr=t},exports.setMaskMode=function(t,e){switch(e){case void 0:t.stencilTest=!1;break;case exports.MaskMode.MASK:t.stencilTest=!0,t.stencilFunc=[Di.ALWAYS,Di.ALWAYS],t.stencilOpZPass=[Di.REPLACE,Di.REPLACE];break;case exports.MaskMode.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Di.EQUAL,Di.EQUAL];break;case exports.MaskMode.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Di.NOTEQUAL,Di.NOTEQUAL];break;case exports.MaskMode.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}},exports.setRayFromCamera=yn,exports.setSideMode=Hi,exports.sortByOrder=j,exports.spec=Te,exports.textureLoaderRegistry=br,exports.thresholdFrag=xo,exports.throwDestroyedError=lt,exports.trailVert=fo,exports.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},exports.trianglesFromRect=gn,exports.unregisterPlugin=function(t){delete pt[t];var e=mt.findIndex((function(e){return e.name===t}));-1!==e&&mt.splice(e,1)},exports.valIfUndefined=function(t,e){return null==t?e:t},exports.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.;}",exports.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",exports.vecFill=dn,exports.vecMulCombine=pn,exports.version=tf,exports.vertexFormatType2GLType=ji;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/alipay");function i(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){return void i(t)}s.done?e(u):Promise.resolve(u).then(r,n)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function s(t){i(o,n,a,s,u,"next",t)}function u(t){i(o,n,a,s,u,"throw",t)}s(void 0)}))}}function n(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):n(t,e)}function a(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 o(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 new 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=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],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;var s=new Uint8Array(16);function u(){if(!t&&!(t=void 0!==e.crypto&&e.crypto.getRandomValues&&e.crypto.getRandomValues.bind(e.crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(s)}for(var h=[],l=0;l<256;++l)h.push((l+256).toString(16).slice(1));var c={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function f(t,e,i){if(c.randomUUID&&!e&&!t)return c.randomUUID();var r=(t=t||{}).random||(t.rng||u)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),h[t[e+0]]+h[t[e+1]]+h[t[e+2]]+h[t[e+3]]+"-"+h[t[e+4]]+h[t[e+5]]+"-"+h[t[e+6]]+h[t[e+7]]+"-"+h[t[e+8]]+h[t[e+9]]+"-"+h[t[e+10]]+h[t[e+11]]+h[t[e+12]]+h[t[e+13]]+h[t[e+14]]+h[t[e+15]]}(r)}function d(t,e){return t.includes(e)||t.push(e),t}function p(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function m(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 v=2*Math.PI,y=Math.PI/180,g=180/Math.PI,x=1e-6;function b(t,e){return Math.abs(t-e)<x||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var T=function(t,e,i){return(1-i)*t+i*e};function E(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,a=Math.min(r,n),o=Math.max(r,n);return Math.min(Math.max(t,a),o)}var _=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):n(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):n(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):n(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):n(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=x,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();_.ONE=new _(1,1),_.ZERO=new _(0,0);var S=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):n(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):n(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):n(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):n(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=x,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new _(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();S.X=new S(1,0,0),S.Y=new S(0,1,0),S.Z=new S(0,0,1),S.ONE=new S(1,1,1),S.ZERO=new S(0,0,0);var C=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):n(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):n(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):n(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):n(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=x,e=this,i=e.x,r=e.y,n=e.z,a=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(a)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new S(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}();C.ONE=new C(1,1,1,1),C.ZERO=new C(0,0,0,0);var w=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):n(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):n(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):n(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):n(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 C(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,a=e.a,o=Math.max(i,r,n),s=Math.min(i,r,n),u=o-s,h=0,l=0;return 0!==o&&(l=u/o),o!=s&&(o==i?(h=(r-n)/u,r<n&&(h+=6)):o==r?h=(n-i)/u+2:o==n&&(h=(i-r)/u+4),h*=60),new t(h,l,o,a)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function A(t,e){var i=[0,0,0,0];if(it(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var a=+r[4];i=[+r[1],+r[2],+r[3],isNaN(a)?255:255*a]}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 n(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function M(t,e,i){if(0===t.length)return[0,0,0,0];var r;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 n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.time<=e&&e<=o.time){r=I(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 P(t){var e=[];return n(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:R(i),color:new w(r,n,a,o)})})):Object.keys(t).forEach((function(i){var r=t[i],n=(new w).setFromArray(A(r));e.push({time:R(i),color:n})})),e=e.sort((function(t,e){return t.time-e.time}))}function I(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 R(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function O(){return"object"==typeof e.window?Math.min(2,e.window.devicePixelRatio||1):1}w.BLACK=new w(0,0,0,1),w.BLUE=new w(0,0,1,1),w.CLEAR=new w(0,0,0,0),w.CYAN=new w(0,1,1,1),w.GRAY=new w(.5,.5,.5,1),w.GREEN=new w(0,1,0,1),w.MAGENTA=new w(1,0,1,1),w.RED=new w(1,0,0,1),w.WHITE=new w(1,1,1,1),w.YELLOW=new w(1,.92,.016,1);var N,L=void 0!==e.window;function F(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function V(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function k(){return/\bOpenHarmony\b/.test(e.navigator.userAgent)}function D(){return V()||k()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function z(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function B(){return"miniprogram"===e.window.__wxjs_environment}function U(t){it(t)&&(t=A(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function G(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=P(t);if(n.length)for(var a=0;a<e;a++){var o=a/127;if(o<=n[0].time)r.set(n[0].color.toArray(),4*a);else if(o>=n[n.length-1].time)r.set(n[n.length-1].color.toArray(),4*a);else for(var s=0;s<n.length-1;s++){var u=n[s],h=n[s+1];if(u.time<=o&&h.time>o){var l=I(u.color.toArray(),h.color.toArray(),(o-u.time)/(h.time-u.time));r.set(l,4*a);break}}}return i}function j(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)W(t,r,e);return t}return H(t,e)}function X(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&W(t,t.length-1,i),t)}function W(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 H(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,a=t[i],o=i,s=r;o<s;){if(2===e){for(;t[s].priority>a.priority&&s>=o;)s--;for(;t[o].priority<=a.priority&&o<s;)o++}else{for(;t[s].priority<a.priority&&s>=o;)s--;for(;t[o].priority>=a.priority&&o<s;)o++}var u;u=[t[s],t[o]],t[o]=u[0],t[s]=u[1]}return n=[t[o],t[i]],t[i]=n[0],t[o]=n[1],H(t,e,i,o-1),H(t,e,s+1,r),t}function Y(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function Z(t){return q(t)||!D()}function q(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(N=exports.OrderType||(exports.OrderType={}))[N.none=1]="none",N[N.ascending=2]="ascending",N[N.descending=3]="descending";var K,Q="[Galacean Effects]";function J(t){return["%c"+Q,"color: #AA0100",""+t]}var $,tt={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(J(t),[i])),null==K||K("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(J(t))),null==K||K("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(J(t))),null==K||K("warn",t,i)},register:function(t){t&&nt(t)&&(K=t)}};function et(){}function it(t){return"string"==typeof t}exports.DestroyOptions=void 0,($=exports.DestroyOptions||(exports.DestroyOptions={}))[$.destroy=0]="destroy",$[$.keep=1]="keep",$[$.force=0]="force";var rt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function nt(t){return"[object Function]"===Object.prototype.toString.call(t)}function at(t){return"[object Object]"===Object.prototype.toString.call(t)}function ot(t){if(null===t||"object"!=typeof t)return!1;if("[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 st(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function ut(t){return 0==(t&t-1)&&0!==t}function ht(t,e){return t+Math.random()*(e-t)}function lt(){throw new Error("Destroyed item cannot be used again.")}function ct(){return f().replace(/-/g,"")}function ft(t,i,r){void 0===i&&(i="base64File"),void 0===r&&(r="");for(var n=t.split(",")[1]||t,a=e.atob(n),o=[],s=0;s<a.length;s+=512){for(var u=a.slice(s,s+512),h=new Array(u.length),l=0;l<u.length;l++)h[l]=u.charCodeAt(l);var c=new Uint8Array(h);o.push(c)}var f=new e.Blob(o,{type:r});return new File([f],i,{type:r})}function dt(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)}))}))}var pt={},mt=[];function vt(t,e){pt[t]&&tt.error("Duplicate registration for plugin "+t+"."),pt[t]=e;var i=new e;i.name=t,mt.push(i),mt.sort((function(t,e){return t.order-e.order}))}var yt=function(){function t(){}return t.getPlugins=function(){return mt},t.initializeComposition=function(t,e){mt.forEach((function(i){return i.onCompositionCreated(t,e)}))},t.destroyComposition=function(t){mt.forEach((function(e){return e.onCompositionDestroy(t)}))},t.onAssetsLoadStart=function(t,e){return r((function(){return o(this,(function(i){return[2,Promise.all(mt.map((function(i){return i.onAssetsLoadStart(t,e)})))]}))}))()},t.onAssetsLoadFinish=function(t,e,i){mt.forEach((function(r){return r.onAssetsLoadFinish(t,e,i)}))},t}(),gt={"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 xt(t){var e=gt[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 bt,Tt,Et,_t,St,Ct,wt,At,Mt,Pt,It,Rt,Ot,Nt,Lt=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return r((function(){return o(this,(function(t){return[2]}))}))()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},t}();function Ft(t,e){return Ft=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Ft(t,e)}function Vt(t,e){if("function"!=typeof e&&null!==e)throw new 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&&Ft(t,e)}!function(t){t["1_0"]="1.0",t["1_1"]="1.1",t["1_2"]="1.2",t["1_3"]="1.3",t["1_5"]="1.5",t["1_8"]="1.8",t["2_0"]="2.0",t["2_1"]="2.1",t["2_2"]="2.2",t["2_3"]="2.3",t["2_4"]="2.4",t["3_0"]="3.0",t["3_1"]="3.1",t["3_2"]="3.2",t["3_3"]="3.3",t["3_4"]="3.4",t["3_5"]="3.5",t["3_6"]="3.6",t["3_7"]="3.7",t.LATEST="3.7"}(bt||(bt={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Tt||(Tt={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(Et||(Et={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(_t||(_t={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(St||(St={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(Ct||(Ct={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(wt||(wt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(At||(At={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Mt||(Mt={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox",t.effect="effect",t.shape="shape",t.postProcessVolume="postProcessVolume",t.node="node",t.video="video",t.audio="audio",t.richtext="richtext"}(Pt||(Pt={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(It||(It={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Rt||(Rt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(Ot||(Ot={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Nt||(Nt={}));var kt,Dt,zt,Bt,Ut,Gt,jt,Xt,Wt,Ht,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,ie=1,re=3,ne=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(kt||(kt={})),function(t){t[t.CONSTANT=0]="CONSTANT",t[t.CONSTANT_VEC2=1]="CONSTANT_VEC2",t[t.CONSTANT_VEC3=2]="CONSTANT_VEC3",t[t.CONSTANT_VEC4=3]="CONSTANT_VEC4",t[t.RANDOM=4]="RANDOM",t[t.LINE=5]="LINE",t[t.CURVE=6]="CURVE",t[t.BEZIER_PATH=7]="BEZIER_PATH",t[t.RGBA_COLOR=8]="RGBA_COLOR",t[t.GRADIENT_COLOR=9]="GRADIENT_COLOR",t[t.SHAPE_POINTS=10]="SHAPE_POINTS",t[t.SHAPE_SPLITS=11]="SHAPE_SPLITS",t[t.LINEAR_PATH=12]="LINEAR_PATH",t[t.COLORS=13]="COLORS",t[t.BINARY=20]="BINARY",t[t.BEZIER_CURVE=21]="BEZIER_CURVE",t[t.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",t[t.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",t[t.COLOR_CURVE=24]="COLOR_CURVE",t[t.VECTOR4_CURVE=25]="VECTOR4_CURVE",t[t.VECTOR2_CURVE=26]="VECTOR2_CURVE",t[t.VECTOR3_CURVE=27]="VECTOR3_CURVE"}(Dt||(Dt={})),function(t){t[t.AUTO=0]="AUTO",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.LINE=4]="LINE",t[t.HOLD=5]="HOLD",t[t.LINE_OUT=6]="LINE_OUT"}(zt||(zt={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(Bt||(Bt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ut||(Ut={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(Gt||(Gt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(jt||(jt={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Xt||(Xt={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Wt||(Wt={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ht||(Ht={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Yt||(Yt={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive",t.diffuse="diffuse"}(Zt||(Zt={})),function(t){t[t.visible=0]="visible",t[t.display=1]="display",t[t.clip=2]="clip",t[t.ellipsis=3]="ellipsis"}(qt||(qt={})),function(t){t[t.autoWidth=0]="autoWidth",t[t.autoHeight=1]="autoHeight",t[t.fixed=2]="fixed"}(Kt||(Kt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Qt||(Qt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Jt||(Jt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}($t||($t={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(te||(te={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ee||(ee={}));var ae,oe,se,ue,he,le,ce,fe,de,pe,me,ve,ye,ge,xe={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!function(t){t[t.Solid=0]="Solid",t[t.GradientLinear=1]="GradientLinear",t[t.GradientRadial=2]="GradientRadial",t[t.GradientAngular=3]="GradientAngular",t[t.Texture=4]="Texture"}(ae||(ae={})),function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(oe||(oe={})),function(t){t[t.Custom=0]="Custom",t[t.Rectangle=1]="Rectangle",t[t.Ellipse=2]="Ellipse",t[t.Polygon=3]="Polygon",t[t.Star=4]="Star"}(se||(se={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(ue||(ue={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(he||(he={})),function(t){t.AnimationClipNodeData="AnimationClipNodeData",t.BlendNodeData="BlendNodeData",t.ApplyAdditiveNodeData="ApplyAdditiveNodeData",t.LayerBlendNodeData="LayerBlendNodeData",t.StateMachineNodeData="StateMachineNodeData",t.TransitionNodeData="TransitionNodeData",t.StateNodeData="StateNodeData",t.ConstFloatNodeData="ConstFloatNodeData",t.ConstBoolNodeData="ConstBoolNodeData",t.ControlParameterBoolNodeData="ControlParameterBoolNodeData",t.ControlParameterFloatNodeData="ControlParameterFloatNodeData",t.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",t.NotNodeData="NotNodeData",t.AndNodeData="AndNodeData",t.OrNodeData="OrNodeData",t.EqualNodeData="EqualNodeData",t.GreaterNodeData="GreaterNodeData",t.LessNodeData="LessNodeData"}(le||(le={})),function(t){t.video="video",t.image="image"}(ce||(ce={})),function(t){t.video="video",t.audio="audio"}(fe||(fe={})),function(t){t.L30="hev1.1.0.L30.B0",t.L60="hev1.1.0.L60.B0",t.L63="hev1.1.0.L63.B0",t.L90="hev1.1.0.L90.B0",t.L93="hev1.1.0.L93.B0",t.L120="hev1.1.0.L120.B0",t.L150="hev1.1.0.L150.B0",t.L180="hev1.1.0.L180.B0"}(de||(de={})),function(t){t.VFXItemData="VFXItemData",t.Material="Material",t.Shader="Shader",t.Geometry="Geometry",t.Texture="Texture",t.Image="Image",t.AnimationClip="AnimationClip",t.BinaryAsset="BinaryAsset",t.TrackAsset="TrackAsset",t.TimelineAsset="TimelineAsset",t.ObjectBindingTrack="ObjectBindingTrack",t.TransformTrack="TransformTrack",t.SpriteColorTrack="SpriteColorTrack",t.ActivationTrack="ActivationTrack",t.SubCompositionTrack="SubCompositionTrack",t.FloatPropertyTrack="FloatPropertyTrack",t.ColorPropertyTrack="ColorPropertyTrack",t.Vector2PropertyTrack="Vector2PropertyTrack",t.Vector3PropertyTrack="Vector3PropertyTrack",t.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",t.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",t.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",t.MeshComponent="MeshComponent",t.SkyboxComponent="SkyboxComponent",t.LightComponent="LightComponent",t.CameraComponent="CameraComponent",t.ModelPluginComponent="ModelPluginComponent",t.TreeComponent="TreeComponent",t.AnimationComponent="AnimationComponent",t.SpineComponent="SpineComponent",t.VideoComponent="VideoComponent",t.AudioComponent="AudioComponent",t.RichTextComponent="RichTextComponent",t.OrientationComponent="OrientationComponent",t.ShapeComponent="ShapeComponent",t.SpriteComponent="SpriteComponent",t.ParticleSystem="ParticleSystem",t.InteractComponent="InteractComponent",t.CameraController="CameraController",t.PostProcessVolume="PostProcessVolume",t.EffectComponent="EffectComponent",t.TextComponent="TextComponent",t.AnimationGraphAsset="AnimationGraphAsset",t.CompositionComponent="CompositionComponent",t.FFDComponent="FFDComponent",t.FrameComponent="FrameComponent",t.Animator="Animator",t.TimelineClip="TimelineClip"}(pe||(pe={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(me||(me={})),function(t){t[t.Float16=0]="Float16",t[t.Float32=1]="Float32",t[t.Int8=2]="Int8",t[t.Int16=3]="Int16",t[t.Int32=4]="Int32",t[t.UInt8=5]="UInt8",t[t.UInt16=6]="UInt16",t[t.UInt32=7]="UInt32"}(ve||(ve={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(ye||(ye={})),function(t){t.Position="POSITION",t.Uv="TEXCOORD0",t.Uv2="TEXCOORD1",t.Normal="NORMAL",t.Tangent="TANGENT",t.Color="COLOR",t.Joints="JOINTS",t.Weights="WEIGHTS",t.PositionBS0="POSITION_BS0",t.PositionBS1="POSITION_BS1",t.PositionBS2="POSITION_BS2",t.PositionBS3="POSITION_BS3",t.PositionBS4="POSITION_BS4",t.PositionBS5="POSITION_BS5",t.PositionBS6="POSITION_BS6",t.PositionBS7="POSITION_BS7",t.NormalBS0="NORMAL_BS0",t.NormalBS1="NORMAL_BS1",t.NormalBS2="NORMAL_BS2",t.NormalBS3="NORMAL_BS3",t.TangentBS0="TANGENT_BS0",t.TangentBS1="TANGENT_BS1",t.TangentBS2="TANGENT_BS2",t.TangentBS3="TANGENT_BS3"}(ge||(ge={}));var be=bt.LATEST,Te=Object.freeze({__proto__:null,LATEST_VERSION:be,get RenderLevel(){return Tt},get BlendingMode(){return Et},get SideMode(){return _t},get ObscuredMode(){return St},get ParticleEmitterShapeType(){return Ct},get PluginType(){return wt},get InteractType(){return At},get InteractBehavior(){return Mt},get ItemType(){return Pt},get RenderMode(){return It},get ParticleOrigin(){return Rt},get RenderType(){return Ot},get RenderFace(){return Nt},get CameraClipMode(){return kt},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:ie,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:re,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:ne,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return Dt},get BezierKeyframeType(){return zt},get JSONSceneVersion(){return bt},get EndBehavior(){return Bt},get ParticleInteractionBehavior(){return Ut},get ShapeArcMode(){return Gt},get LightType(){return jt},get ModelBoundingType(){return Xt},get CameraType(){return Wt},get MaterialType(){return Ht},get MaterialBlending(){return Yt},get RenderMode3D(){return Zt},get TextOverflow(){return qt},get TextSizeMode(){return Kt},get TextBaseline(){return Qt},get TextAlignment(){return Jt},get TextVerticalAlign(){return $t},get TextWeight(){return te},get FontStyle(){return ee},BuiltinObjectGUID:xe,get FillType(){return ae},get TexturePaintScaleMode(){return oe},get ShapePrimitiveType(){return se},get LineCap(){return ue},get LineJoin(){return he},get NodeDataType(){return le},get BackgroundType(){return ce},get MultimediaType(){return fe},get HevcVideoCodec(){return de},get DataType(){return pe},get GeometryType(){return me},get VertexFormatType(){return ve},get IndexFormatType(){return ye},get VertexBufferSemantic(){return ge}});function Ee(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function _e(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 Ee(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Ee(t,e):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 new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var Se=new Map,Ce=new Map,we={};function Ae(t){return we[t]}function Me(t){return function(e,i){we[t]&&console.warn("Class "+t+" is already registered."),we[t]=e}}function Pe(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;Se.get(e)||Se.set(e,{});return Se.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function Ie(t){var e=t.constructor;if(Ce.get(e))return Ce.get(e);var i={};Ce.set(e,i);for(var r=t,n=e;n;){var a=Se.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}var Re=function(){function t(t){this.engine=t,this.guid=ct(),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 n(e,t)&&"guid"in e},t}(),Oe=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),Ne={};function Le(t){return function(e,i){Ne[t]&&console.warn("NodeData Class "+t+" is already registered."),Ne[t]=e}}function Fe(t){return Ne[t]}var Ve,ke=-1,De=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 new 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 new Error("Node still initialized!");this.lastUpdateID=-1},t}(),ze=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}(),Be=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}Vt(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}(De),Ue=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.setValue=function(t){},e}(De),Ge=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Ue),je=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Ue);exports.AnimationGraphAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new Oe,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=ke,e}return Vt(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,a=0;a<n;a++)this.parameterLookupMap.set(i.controlParameterIDs[a],a);this.nodeDatas=[];for(var o=0;o<r.length;o++)this.nodeDatas[o]=e.createNodeData(r[o].type),this.nodeDatas[o].load(r[o]);this.graphDataSet=new Oe,this.graphDataSet.resources=[];for(var s,u=_e(i.graphDataSet.resources);!(s=u()).done;){var h=s.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=Fe(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(Re),exports.AnimationGraphAsset=a([Me("AnimationGraphAsset")],exports.AnimationGraphAsset),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(Ve||(Ve={}));var Xe=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}(),We=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 He(){return He=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},He.apply(this,arguments)}exports.AnimationClipNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ze,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=He({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(ze),exports.AnimationClipNodeData=a([Le(le.AnimationClipNodeData)],exports.AnimationClipNodeData);var Ye,Ze=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}Vt(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=E(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=_e(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 qe(e.skeleton,this.animation))},e}(Be);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(Ye||(Ye={}));var qe=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=_e(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,o=_e(e.scaleCurves);!(a=o()).done;){var s=a.value;this.addTransformCurveInfo(s,1)}for(var u,h=_e(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=_e(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=_e(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=_e(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}for(var b,T=_e(this.animationClip.events);!(b=T()).done;){var E=b.value;this.events.push({data:E,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=E(t,0,this.animationClip.duration),n=_e(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=_e(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=_e(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}(),Ke=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.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(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(E(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var 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,r=i.x,n=i.y,a=i.z,o=i.w,s=o*t.w+r*t.x+n*t.y+a*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=o,this.x=r,this.y=n,this.z=a,this;var u=1-s*s;if(u<=Number.EPSILON){var h=1-e;return this.w=h*o+e*this.w,this.x=h*r+e*this.x,this.y=h*n+e*this.y,this.z=h*a+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,s),f=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this.w=o*f+this.w*d,this.x=r*f+this.x*d,this.y=n*f+this.y*d,this.z=a*f+this.z*d,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,a=i.z,o=i.w,s=t.x,u=t.y,h=t.z,l=o*s+n*h-a*u,c=o*u+a*s-r*h,f=o*h+r*u-n*s,d=-r*s-n*u-a*h,p=null!=e?e:t;return p.x=l*o+d*-r+c*-a-f*-n,p.y=c*o+d*-n+f*-r-l*-a,p.z=f*o+d*-a+l*-n-c*-r,p},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(S.ZERO,this,S.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}();Ke.tempVec0=new S;var Qe=new Ke,Je=function(){},$e=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Je),ti=function(t){function e(){return t.apply(this,arguments)}Vt(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=Qe.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}(Je),ei=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 E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var S=0;S<t.colorPropertyValues.length;S++){var C=t.colorPropertyValues[S],w=e.colorPropertyValues[S],A=r.colorPropertyValues[S];n.blendColor(C,w,i,A)}},t}();ei.normalBlendFunction=new $e,ei.additiveBlendFunction=new ti;var ii=function(){function t(t){this.position=new S,this.rotation=new Ke,this.scale=new S,this.euler=new S,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}(),ri=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=_e(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new ii).copyFrom(r))}for(var n,a=_e(t.defaultFloatPropertyValues);!(n=a()).done;){var o=n.value;this.floatPropertyValues.push(o)}for(var s,u=_e(t.defaultColorPropertyValues);!(s=u()).done;){var h=s.value;this.colorPropertyValues.push((new w).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}(),ni=function(t){this.pose=new ri(t)};exports.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ai,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}(ze),exports.ApplyAdditiveNodeData=a([Le(le.ApplyAdditiveNodeData)],exports.ApplyAdditiveNodeData);var ai=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}Vt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new ni(e.skeleton),this.additiveNodeResult=new ni(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){ei.additiveBlend(t,e,i,r)},e}(Be);exports.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(oi,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}(ze),exports.BlendNodeData=a([Le(le.BlendNodeData)],exports.BlendNodeData);var oi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}Vt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new ni(e.skeleton),this.source1Result=new ni(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){ei.localBlend(t,e,i,r)},e}(Be);exports.AndNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(si,t),r=_e(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}(ze),exports.AndNodeData=a([Le(le.AndNodeData)],exports.AndNodeData);var si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}Vt(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=_e(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=_e(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=_e(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(je);exports.OrNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(ui,t),r=_e(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}(ze),exports.OrNodeData=a([Le(le.OrNodeData)],exports.OrNodeData);var ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}Vt(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=_e(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=_e(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=_e(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(je);exports.NotNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(hi,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(ze),exports.NotNodeData=a([Le(le.NotNodeData)],exports.NotNodeData);var hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}Vt(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}(je);exports.ConstFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(li,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ConstFloatNodeData=a([Le(le.ConstFloatNodeData)],exports.ConstFloatNodeData);var li=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return Vt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Ge);exports.ConstBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ci,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ConstBoolNodeData=a([Le(le.ConstBoolNodeData)],exports.ConstBoolNodeData);var ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return Vt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(je);exports.ControlParameterFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(fi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ControlParameterFloatNodeData=a([Le(le.ControlParameterFloatNodeData)],exports.ControlParameterFloatNodeData);var fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}Vt(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}(Ge);exports.ControlParameterBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(di,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(ze),exports.ControlParameterBoolNodeData=a([Le(le.ControlParameterBoolNodeData)],exports.ControlParameterBoolNodeData);var di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Vt(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}(je);exports.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(pi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(ze),exports.ControlParameterTriggerNodeData=a([Le(le.ControlParameterTriggerNodeData)],exports.ControlParameterTriggerNodeData);var pi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}Vt(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}(je);exports.LayerBlendNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=ke,e.layerDatas=[],e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(mi,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=_e(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){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:ke,e.layerDatas)for(var r,n=_e(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(He({inputNodeIndex:ke,weightValueNodeIndex:ke},a))}},e}(ze),exports.LayerBlendNodeData=a([Le(le.LayerBlendNodeData)],exports.LayerBlendNodeData);var mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}Vt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new ni(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=_e(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){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=_e(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):e},i.updateLayers=function(t,e){for(var i,r=_e(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);ei.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(Be);exports.EqualNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ke,e.comparandValueNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(yi,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}(ze),exports.EqualNodeData=a([Le(le.EqualNodeData)],exports.EqualNodeData);var vi,yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}Vt(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}(je),gi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ke,e.comparandValueNodeIndex=ke,e}return Vt(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(ze);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(vi||(vi={}));var xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}Vt(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}(je);exports.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(xi,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(gi),exports.GreaterNodeData=a([Le(le.GreaterNodeData)],exports.GreaterNodeData),exports.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(xi,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(gi),exports.LessNodeData=a([Le(le.LessNodeData)],exports.LessNodeData),exports.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Ti,t),r=_e(this.stateDatas);!(e=r()).done;){var n=e.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(a);for(var o,s=_e(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}(ze),exports.StateMachineNodeData=a([Le(le.StateMachineNodeData)],exports.StateMachineNodeData);var bi,Ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=ke,e}Vt(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===Ve.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=ke,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(o.targetStateIndex===ke)throw new 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(r!==ke){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=ke,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=_e(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=_e(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(Be);exports.TransitionState=void 0,(bi=exports.TransitionState||(exports.TransitionState={}))[bi.None=0]="None",bi[bi.TransitioningIn=1]="TransitioningIn",bi[bi.TransitioningOut=2]="TransitioningOut",exports.StateNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(_i,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}(ze),exports.StateNodeData=a([Le(le.StateNodeData)],exports.StateNodeData);var Ei,_i=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}Vt(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}(Be);exports.SourceType=void 0,(Ei=exports.SourceType||(exports.SourceType={}))[Ei.State=0]="State",Ei[Ei.Transition=1]="Transition",Ei[Ei.CachedPose=2]="CachedPose",exports.TransitionNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=ke,e}Vt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ci,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}(ze),exports.TransitionNodeData=a([Le(le.TransitionNodeData)],exports.TransitionNodeData);var Si,Ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}Vt(e,t);var i=e.prototype;return i.evaluate=function(t,e){Y(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=E(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=Ve.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),a=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,a),this.blendedDuration=T(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var o=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+o)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),a},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.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)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new ni(e.skeleton),this.targetNodeResult=new ni(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(exports.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(exports.TransitionState.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=T(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=E(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;ei.localBlend(t.pose,e.pose,r,i.pose)},e}(Be);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(Si||(Si={}));var wi=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=_e(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,o=_e(e.rotation);!(a=o()).done;){var s=a.value;this.addReferenceTransform(s)}for(var u,h=_e(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=_e(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 ii(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var a=this.findTarget(t);if(a){var o;(o="VFXItem"===e?a:a.getComponent(Ae(e)))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=o,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:o,propertyPath:i,directTarget:h,propertyName:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push((new w).copyFrom(h[u])),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=_e(i);!(e=n()).done;){var a=e.value,o=r.find(a);if(!o)return null;r=o}return r},t}(),Ai=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new Xe;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=_e(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var o,s=_e(a.positionCurves);!(o=s()).done;){var u=o.value;r.position.push(u.path)}for(var h,l=_e(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=_e(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=_e(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=_e(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=_e(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new wi(e,r),this.result=new ni(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var S=new We;S.nodes=this.nodes,S.nodeDatas=t.nodeDatas,S.dataSet=t.graphDataSet;for(var C=0;C<t.nodeDatas.length;C++)S.nodes[C]||t.nodeDatas[C].instantiate(S);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];n(i,pi)&&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=_e(this.nodes);!(e=r()).done;){var a=e.value;n(a,Ti)&&a.getNodeData().machineName===t&&(i=a)}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."),ke)},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);i!==ke&&this.nodes[i].setValue(e)},t}();function Mi(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 Pi(t,e,i){return e&&Mi(t.prototype,e),i&&Mi(t,i),t}var Ii=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}Vt(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.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&&p(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},Pi(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(Re);a([Pe()],Ii.prototype,"item",void 0),a([Pe()],Ii.prototype,"_enabled",void 0);var Ri,Oi,Ni=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Ii);function Li(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 new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}exports.Animator=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}Vt(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 Ai(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 a=e.pose.parentSpaceTransforms[r].position,o=e.pose.parentSpaceTransforms[r].rotation,s=e.pose.parentSpaceTransforms[r].scale,u=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(a.x,a.y,a.z),i[r].setScale(s.x,s.y,s.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(u.x,u.y,u.z):i[r].setQuaternion(o.x,o.y,o.z,o.w)}for(var h=this.graphInstance.skeleton.floatAnimatedObjects,l=0;l<h.length;l++){var c=h[l],f=c.propertyName;c.directTarget[f]=e.pose.floatPropertyValues[l],n(c.target,Ii)&&c.target.onApplyAnimationProperties()}for(var d=this.graphInstance.skeleton.colorAnimatedObjects,p=0;p<d.length;p++){var m=d[p],v=m.propertyName;m.directTarget[v]=e.pose.colorPropertyValues[p],n(m.target,Ii)&&m.target.onApplyAnimationProperties()}for(var y,g=_e(this.graphInstance.activeEvents);!(y=g()).done;){var x=y.value;x.data.event.onEvent(this.item,x)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(Ii),exports.Animator=a([Me("Animator")],exports.Animator),exports.ShaderType=void 0,(Ri=exports.ShaderType||(exports.ShaderType={}))[Ri.vertex=0]="vertex",Ri[Ri.fragment=1]="fragment",exports.MaskMode=void 0,(Oi=exports.MaskMode||(exports.MaskMode={}))[Oi.NONE=0]="NONE",Oi[Oi.MASK=1]="MASK",Oi[Oi.OBSCURED=2]="OBSCURED",Oi[Oi.REVERSE_OBSCURED=3]="REVERSE_OBSCURED";var Fi,Vi,ki=[],Di={},zi="WebGL Constants not in global, please check your environment";function Bi(){"function"==typeof e.WebGL2RenderingContext?Gi(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(Gi(e.WebGLRenderingContext),Gi(e.WebGLRenderingContext.prototype)):L?ki.push(F()?"iOS16 lockdown mode, WebGL Constants not in global":zi):ki.push(zi),ki.length||"HALF_FLOAT"in Di||(Di.HALF_FLOAT=5131)}function Ui(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Gi(t){for(var e in t)/^[A-Z_]/.test(e)&&(Di[e]=t[e])}function ji(t){switch(t){case ve.Float32:return e.WebGLRenderingContext.FLOAT;case ve.Int16:return e.WebGLRenderingContext.SHORT;case ve.Int8:return e.WebGLRenderingContext.BYTE;case ve.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case ve.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}function Xi(t){switch(t){case Et.ALPHA:case Et.ADD:case Et.SUBTRACTION:case Et.STRONG_LIGHT:case Et.WEAK_LIGHT:return 1;case Et.SUPERPOSITION:return 2;case Et.BRIGHTNESS:return 3;case Et.MULTIPLY:return 0;default:return 1}}function Wi(t,e){switch(e){case void 0:case Et.ALPHA:t.blendFunction=[Di.ONE,Di.ONE_MINUS_SRC_ALPHA,Di.ONE,Di.ONE_MINUS_SRC_ALPHA];break;case Et.ADD:t.blendFunction=[Di.ONE,Di.ONE,Di.ONE,Di.ONE];break;case Et.SUBTRACTION:t.blendFunction=[Di.ONE,Di.ONE,Di.ZERO,Di.ONE],t.blendEquation=[Di.FUNC_REVERSE_SUBTRACT,Di.FUNC_REVERSE_SUBTRACT];break;case Et.SUPERPOSITION:t.blendFunction=[Di.ONE,Di.ONE,Di.ONE,Di.ONE];break;case Et.MULTIPLY:t.blendFunction=[Di.DST_COLOR,Di.ONE_MINUS_SRC_ALPHA,Di.DST_COLOR,Di.ONE_MINUS_SRC_ALPHA];break;case Et.BRIGHTNESS:t.blendFunction=[Di.ONE,Di.ONE_MINUS_SRC_ALPHA,Di.ONE,Di.ONE_MINUS_SRC_ALPHA];break;case Et.STRONG_LIGHT:t.blendFunction=[Di.DST_COLOR,Di.DST_ALPHA,Di.ZERO,Di.ONE];break;case Et.WEAK_LIGHT:t.blendFunction=[Di.DST_COLOR,Di.ZERO,Di.ZERO,Di.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Hi(t,e){e===_t.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Di.CW,t.cullFace=e===_t.BACK?Di.BACK:Di.FRONT)}ki.length||Bi(),exports.TextureLoadAction=void 0,(Fi=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Fi.whatever=0]="whatever",Fi[Fi.clear=2]="clear",exports.TextureSourceType=void 0,(Vi=exports.TextureSourceType||(exports.TextureSourceType={}))[Vi.none=0]="none",Vi[Vi.data=1]="data",Vi[Vi.image=2]="image",Vi[Vi.compressed=3]="compressed",Vi[Vi.video=4]="video",Vi[Vi.canvas=5]="canvas",Vi[Vi.framebuffer=6]="framebuffer",Vi[Vi.mipmaps=7]="mipmaps";var Yi=function(){function t(){this.callbacks={}}var i=t.prototype;return i.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},i.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},i.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},i.downloadText=function(t,e,i){this.download(t,"text",e,i)},i.download=function(i,r,n,a){var o=this;if(void 0===r&&(r="json"),!this.start(i,n,a)){var s=new e.XMLHttpRequest,u=function(){o.finish(i,s.status,s.response)};s.responseType=r,s.addEventListener("load",(function(){200==s.status||0==s.status&&t.trustXHRStatusZero?o.finish(i,200,s.response):u()})),s.addEventListener("error",u),s.open("GET",i,!0),s.send()}},i.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},i.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}();Yi.trustXHRStatusZero=!1;var Zi=!1,qi=!1;function Ki(t,e){return Qi.apply(this,arguments)}function Qi(){return(Qi=r((function(t,e){return o(this,(function(i){switch(i.label){case 0:return!Zi&&e?[3,2]:[4,tr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,tr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Zi=!0,[4,tr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Ji(t,e){return $i.apply(this,arguments)}function $i(){return($i=r((function(t,e){return o(this,(function(i){switch(i.label){case 0:return!qi&&e?[3,2]:[4,tr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,tr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),qi=!0,[4,tr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function tr(t){return er.apply(this,arguments)}function er(){return(er=r((function(t){var i,r;return o(this,(function(a){if(i="",n(t,e.HTMLImageElement)){if(t.complete)return[2,t];i=t.src}else n(t,e.Blob)?(i=e.URL.createObjectURL(t),r=!0):"string"==typeof t&&(i=t);if(!i)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var a=new e.Image;/^data:/.test(i)||(a.crossOrigin="*"),a.onload=function(){return a.onload=null,r&&e.URL.revokeObjectURL(i),t(a)},a.onerror=function(t){return a.onerror=null,r&&e.URL.revokeObjectURL(i),n("Load image fail: "+i+", reason: "+JSON.stringify(t))},a.src=i}))]}))}))).apply(this,arguments)}function ir(t){return rr.apply(this,arguments)}function rr(){return(rr=r((function(t){return o(this,(function(e){return[2,new Promise((function(e,i){(new Yi).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function nr(){return(nr=r((function(t){return o(this,(function(e){return[2,new Promise((function(e,i){(new Yi).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function ar(t){return or.apply(this,arguments)}function or(){return(or=r((function(t){var i;return o(this,(function(r){return i=e.document.createElement("video"),"string"==typeof t?i.src=t:i.srcObject=t,i.crossOrigin="anonymous",i.muted=!0,i.autoplay=!1,V()&&i.setAttribute("renderer","standard"),i.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var r=!1,n=function(){r||(r=!0,o(),t(i))},a=function(){r||(r=!0,o(),e("Load video fail."))},o=function(){i.removeEventListener("loadeddata",n),i.removeEventListener("canplay",n),i.removeEventListener("error",a)};i.addEventListener("loadeddata",n),i.addEventListener("canplay",n),i.addEventListener("error",a),i.play().catch((function(t){console.warn("Autoplay blocked:",t)}))}))]}))}))).apply(this,arguments)}function sr(t,e){return ur.apply(this,arguments)}function ur(){return(ur=r((function(t,e){return o(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:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function hr(t,e,i){return lr.apply(this,arguments)}function lr(){return(lr=r((function(t,e,i,r){var n,a,s,u,h,l,c,f,d;return o(this,(function(o){switch(o.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,a=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:cr(t,e)})))})),[4,Promise.all(s)]);case 1:return u=o.sent(),[2,He({keepImageSource:!1},t,{mipmaps:u,sourceFrom:{target:a,type:exports.TextureSourceType.mipmaps}})];case 2:return h=t.mipmaps,l=t.target,c=h.map((function(t){return cr(t,e)})),[4,Promise.all(c)];case 3:return f=o.sent(),d=r[h[0][1][0]].url,[2,He({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:d,type:exports.TextureSourceType.mipmaps,mipmaps:h.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function cr(t,e){return fr.apply(this,arguments)}function fr(){return fr=r((function(t,i){var r,n,a,s,u;return o(this,(function(o){if(r=t[1],n=r[0],a=r[1],s=r[2],!(u=i[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,tr(new e.Blob([new Uint8Array(u,a,s)]))]}))})),fr.apply(this,arguments)}var dr=1,pr=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+dr++,i}Vt(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Di.TEXTURE_2D:e,r=t.format,n=void 0===r?Di.RGBA:r;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),He({minFilter:Di.NEAREST,magFilter:Di.NEAREST,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE,target:i,format:Di.RGBA,internalFormat:n,type:Di.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,n){return r((function(){var r,a;return o(this,(function(o){switch(o.label){case 0:return[4,tr(t)];case 1:return r=o.sent(),(a=e.create(i,He({sourceType:exports.TextureSourceType.image,image:r,target:Di.TEXTURE_2D,id:ct(),flipY:!0},n))).initialize(),[2,a]}}))}))()},e.fromVideo=function(t,i,n){return r((function(){var r,a;return o(this,(function(o){switch(o.label){case 0:return[4,ar(t)];case 1:return r=o.sent(),(a=e.create(i,He({sourceType:exports.TextureSourceType.video,video:r,id:ct(),flipY:!0},n))).initialize(),[2,a]}}))}))()},Pi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Re);function mr(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?Di.RGBA:3===o?Di.RGB:2===o?Di.LUMINANCE_ALPHA:Di.LUMINANCE,pr.createWithData(t,{data:e,width:i,height:r},{type:Di.HALF_FLOAT,format:n,internalFormat:a,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE})}var vr={type:Di.UNSIGNED_BYTE,format:Di.RGBA,internalFormat:Di.RGBA,wrapS:Di.MIRRORED_REPEAT,wrapT:Di.MIRRORED_REPEAT,minFilter:Di.NEAREST,magFilter:Di.NEAREST};function yr(t){return pr.create(t,He({id:xe.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},vr))}function gr(t){return pr.create(t,He({id:xe.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},vr))}var xr,br=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){this.loaders.has(t)?console.warn('TextureLoader for type "'+t+'" is already registered, skipping.'):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}()),Tr=function(){function t(){this.reloadPending={}}var i=t.prototype;return i.reload=function(t){var e=this;return r((function(){var i,r;return o(this,(function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},i.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var i=t.target,r=t.map,n=t.url;return i===Di.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:it(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var a=t.bin,o=t.mipmaps,s=t.target,u=t.maps,h=t.urls;return a?o.length>0:s===Di.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return it(t)&&t.length>0}))}}return!1},i.loadSource=function(t,e){var i=this;return r((function(){var r,n,a,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,S,C;return o(this,(function(o){switch(o.label){case 0:return r=t.type,n=t.target,a=t.map,s=t.url,u=t.bin,h=t.mipmaps,l=t.urls,c=t.maps,n!==Di.TEXTURE_CUBE_MAP||r===exports.TextureSourceType.mipmaps?[3,2]:[4,i.loadCubeMap(a)];case 1:return f=o.sent(),[2,He({},e,{cube:f,target:Di.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:He({},a),target:Di.TEXTURE_CUBE_MAP}})];case 2:return r!==exports.TextureSourceType.image?[3,4]:[4,tr(s)];case 3:return d=o.sent(),[2,He({},e,{image:d,sourceType:exports.TextureSourceType.image,sourceFrom:{type:r,url:s,target:Di.TEXTURE_2D}})];case 4:return r!==exports.TextureSourceType.video?[3,6]:[4,ar(s)];case 5:return p=o.sent(),[2,He({},e,{video:p,sourceType:exports.TextureSourceType.video})];case 6:return r!==exports.TextureSourceType.compressed?[3,14]:[4,ir(s)];case 7:if(m=o.sent(),!(v=br.getLoader("ktx2")))return[3,12];o.label=8;case 8:return o.trys.push([8,10,,11]),[4,v.loadFromBuffer(m)];case 9:return(y=o.sent()).sourceType===exports.TextureSourceType.compressed?[2,He({sourceType:y.sourceType,type:y.type,target:y.target,internalFormat:y.internalFormat,format:y.format,mipmaps:y.mipmaps,minFilter:Di.LINEAR,magFilter:Di.LINEAR,sourceFrom:t},e)]:[3,11];case 10:throw g=o.sent(),new Error("Failed to parse KTX2 from "+(null!=(x=null==t?void 0:t.url)?x:"buffer")+": "+(g.message||g));case 11:return[3,13];case 12:throw new Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:return r!==exports.TextureSourceType.mipmaps?[3,23]:u?[4,ir(u)]:[3,19];case 15:return b=o.sent(),T=null!=n?n:Di.TEXTURE_2D,E=T===Di.TEXTURE_2D?h.slice():h.map((function(t){return t.slice()})),n!==Di.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(h.map((function(t){return i.loadMipmapImages(t,b)})))];case 16:return _=o.sent(),[3,18];case 17:_=i.loadMipmapImages(h,b),o.label=18;case 18:return[2,He({},e,{mipmaps:_,target:T,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:E,target:T,type:exports.TextureSourceType.mipmaps}})];case 19:return n!==Di.TEXTURE_2D&&n?[3,21]:[4,Promise.all(l.map((function(t){return tr(t)})))];case 20:return S=o.sent(),[2,He({},e,{mipmaps:S,target:Di.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,urls:l.slice(),target:Di.TEXTURE_2D}})];case 21:return n!==Di.TEXTURE_CUBE_MAP?[3,23]:[4,Promise.all(c.map((function(t){return i.loadCubeMap(t)})))];case 22:return C=o.sent(),[2,He({},e,{mipmaps:C,target:Di.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,maps:c.map((function(t){return He({},t)})),target:Di.TEXTURE_CUBE_MAP}})];case 23:throw new Error("Invalid resource type: "+r+".")}}))}))()},i.loadMipmapImages=function(t,i){return r((function(){return o(this,(function(r){return[2,Promise.all(t.map((function(t){return tr(new e.Blob([new Uint8Array(i,t[0],t[1])]))})))]}))}))()},i.loadCubeMap=function(t){return r((function(){return o(this,(function(e){return[2,Promise.all(t.map((function(t){return tr(t)})))]}))}))()},t}();function Er(){return xr||(xr=new Tr),xr}var _r=function(){function t(t){this.destroyed=!1;var e=t.name,i=void 0===e?"defaultDataBlock":e;this.name=i}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 Sr(t){return"object"==typeof t&&t&&void 0===t.length&&n(t,pr)}var Cr,wr=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(S.ZERO,t,S.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},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],E=r[4],_=r[8],S=r[12],C=r[1],w=r[5],A=r[9],M=r[13],P=r[2],I=r[6],R=r[10],O=r[14],N=r[3],L=r[7],F=r[11],V=r[15];return n[0]=a*T+o*C+s*P+u*N,n[4]=a*E+o*w+s*I+u*L,n[8]=a*_+o*A+s*R+u*F,n[12]=a*S+o*M+s*O+u*V,n[1]=h*T+l*C+c*P+f*N,n[5]=h*E+l*w+c*I+f*L,n[9]=h*_+l*A+c*R+f*F,n[13]=h*S+l*M+c*O+f*V,n[2]=d*T+p*C+m*P+v*N,n[6]=d*E+p*w+m*I+v*L,n[10]=d*_+p*A+m*R+v*F,n[14]=d*S+p*M+m*O+v*V,n[3]=y*T+g*C+x*P+b*N,n[7]=y*E+g*w+x*I+b*L,n[11]=y*_+g*A+x*R+b*F,n[15]=y*S+g*M+x*O+b*V,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 E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=S.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,E=u*d,_=u*p,C=i.x,w=i.y,A=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*w,n[5]=(1-(m+b))*w,n[6]=(x+T)*w,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,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,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();this.determinant()<0&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];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),r.x=o,r.y=s,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new S,e=new Ke,i=new S;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(!b(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}();wr.IDENTITY=new wr(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),wr.ZERO=new wr(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),wr.tempVec0=new S,wr.tempVec1=new S,wr.tempVec2=new S,wr.tempMat0=new wr,function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(Cr||(Cr={}));var Ar=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 Cr.XYZ:this.y=Math.asin(E(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case Cr.YXZ:this.x=Math.asin(-E(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case Cr.ZXY:this.x=Math.asin(E(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case Cr.ZYX:this.y=Math.asin(-E(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case Cr.YZX:this.z=Math.asin(E(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case Cr.XZY:this.z=Math.asin(-E(n,-1,1)),Math.abs(n)<.9999999?(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*=g,this.y*=g,this.z*=g,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):(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):(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 Ke;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,i=e.x,r=e.y,n=e.z,a=e.order,o=Math.cos(i*y*.5),s=Math.cos(r*y*.5),u=Math.cos(n*y*.5),h=Math.sin(i*y*.5),l=Math.sin(r*y*.5),c=Math.sin(n*y*.5);switch(a){case Cr.XYZ:t.set(h*s*u+o*l*c,o*l*u-h*s*c,o*s*c+h*l*u,o*s*u-h*l*c);break;case Cr.YXZ:t.set(h*s*u+o*l*c,o*l*u-h*s*c,o*s*c-h*l*u,o*s*u+h*l*c);break;case Cr.ZXY:t.set(h*s*u-o*l*c,o*l*u+h*s*c,o*s*c+h*l*u,o*s*u-h*l*c);break;case Cr.ZYX:t.set(h*s*u-o*l*c,o*l*u+h*s*c,o*s*c-h*l*u,o*s*u+h*l*c);break;case Cr.YZX:t.set(h*s*u+o*l*c,o*l*u+h*s*c,o*s*c-h*l*u,o*s*u-h*l*c);break;case Cr.XZY:t.set(h*s*u-o*l*c,o*l*u-h*s*c,o*s*c+h*l*u,o*s*u+h*l*c);break;default:console.error("unknown euler order: "+a)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,a=i.z,o=i.order,s=Math.cos(r*y),u=Math.sin(r*y),h=Math.cos(n*y),l=Math.sin(n*y),c=Math.cos(a*y),f=Math.sin(a*y);if(o===Cr.XYZ){var d=s*c,p=s*f,m=u*c,v=u*f;e[0]=h*c,e[4]=-h*f,e[8]=l,e[1]=p+m*l,e[5]=d-v*l,e[9]=-u*h,e[2]=v-d*l,e[6]=m+p*l,e[10]=s*h}else if(o===Cr.YXZ){var g=h*c,x=h*f,b=l*c,T=l*f;e[0]=g+T*u,e[4]=b*u-x,e[8]=s*l,e[1]=s*f,e[5]=s*c,e[9]=-u,e[2]=x*u-b,e[6]=T+g*u,e[10]=s*h}else if(o===Cr.ZXY){var E=h*c,_=h*f,S=l*c,C=l*f;e[0]=E-C*u,e[4]=-s*f,e[8]=S+_*u,e[1]=_+S*u,e[5]=s*c,e[9]=C-E*u,e[2]=-s*l,e[6]=u,e[10]=s*h}else if(o===Cr.ZYX){var w=s*c,A=s*f,M=u*c,P=u*f;e[0]=h*c,e[4]=M*l-A,e[8]=w*l+P,e[1]=h*f,e[5]=P*l+w,e[9]=A*l-M,e[2]=-l,e[6]=u*h,e[10]=s*h}else if(o===Cr.YZX){var I=s*h,R=s*l,O=u*h,N=u*l;e[0]=h*c,e[4]=N-I*f,e[8]=O*f+R,e[1]=f,e[5]=s*c,e[9]=-u*c,e[2]=-l*c,e[6]=R*f+O,e[10]=I-N*f}else if(o===Cr.XZY){var L=s*h,F=s*l,V=u*h,k=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=L*f+k,e[5]=s*c,e[9]=F*f-V,e[2]=V*f-F,e[6]=u*c,e[10]=k*f+L}else console.error("toMatrix4: Invalid order "+o);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromArray(e,i,r)},t}();Ar.DEFAULT_ORDER=Cr.ZYX,Ar.tempQuat0=new Ke,Ar.tempMat0=new wr;var Mr=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){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},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],E=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],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(!b(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}(),Pr=function(){function t(t,e){void 0===t&&(t=S.ZERO),void 0===e&&(e=S.X),this.origin=new S,this.direction=new S,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 S;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,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,E=b.y,_=b.z,S=1/d,C=1/p,w=1/m;if(S>=0?(i=(y-h)*S,r=(T-h)*S):(i=(T-h)*S,r=(y-h)*S),C>=0?(n=(g-l)*C,a=(E-l)*C):(n=(E-l)*C,a=(g-l)*C),!(i>a||n>r||((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),w>=0?(o=(x-c)*w,s=(_-c)*w):(o=(_-c)*w,s=(x-c)*w),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 S).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),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}();Pr.tempVec0=new S,Pr.tempVec1=new S,Pr.tempVec2=new S,Pr.tempVec3=new S;var Ir,Rr,Or=function(){function t(t,e){void 0===t&&(t=new S(1/0,1/0,1/0)),void 0===e&&(e=new S(-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 S),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 S),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 S),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new S;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new S),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 S),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 S),this.isEmpty())return[];var i=[];return i[0]=new S(this.min.x,this.min.y,this.min.z),i[1]=new S(this.min.x,this.min.y,this.max.z),i[2]=new S(this.min.x,this.max.y,this.min.z),i[3]=new S(this.min.x,this.max.y,this.max.z),i[4]=new S(this.max.x,this.min.y,this.min.z),i[5]=new S(this.max.x,this.min.y,this.max.z),i[6]=new S(this.max.x,this.max.y,this.min.z),i[7]=new S(this.max.x,this.max.y,this.max.z),i.forEach((function(i){i.subtract(e),i.applyMatrix(t),i.add(e)})),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new S;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),Nr=function(){function t(t,e){void 0===t&&(t=S.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=(new Or).setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new S),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 Or),this.isEmpty()?(t.makeEmpty(),t):(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],a=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*a,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new S).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new S,i=new S;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=(new S).subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),Lr=Object.freeze({__proto__:null,get EulerOrder(){return Cr},Euler:Ar,Quaternion:Ke,Vector2:_,Vector3:S,Vector4:C,Matrix3:Mr,Matrix4:wr,Ray:Pr,PI2:v,DEG2RAD:y,RAD2DEG:g,NumberEpsilon:x,isZero:function(t){return isNaN(t)||Math.abs(t)<x},isEqual:b,damp:function(t,e,i,r){return T(t,e,1-Math.exp(-i*r))},lerp:T,degToRad:function(t){return t*y},radToDeg:function(t){return t*g},clamp:E,Color:w,Box3:Or,Sphere:Nr});exports.ShaderCompileResultStatus=void 0,(Ir=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[Ir.noShader=0]="noShader",Ir[Ir.success=1]="success",Ir[Ir.fail=2]="fail",Ir[Ir.compiling=3]="compiling",exports.GLSLVersion=void 0,(Rr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",Rr.GLSL3="300 es";var Fr=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return Vt(e,t),e.prototype.initialize=function(){},e}(Re);exports.Shader=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=_e(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}(Re),exports.Shader=a([Me(pe.Shader)],exports.Shader);var Vr,kr=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=[Di.ONE,Di.ONE_MINUS_SRC_ALPHA,Di.ONE,Di.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Di.FUNC_ADD,Di.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Di.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=[Di.ALWAYS,Di.ALWAYS],this.stencilOpFail=[Di.KEEP,Di.KEEP],this.stencilOpZFail=[Di.KEEP,Di.KEEP],this.stencilOpZPass=[Di.KEEP,Di.KEEP],this.culling=!1,this.frontFace=Di.CCW,this.cullFace=Di.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(Di.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Di.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Di.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Di.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Di.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Di.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[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}();exports.MaterialRenderType=void 0,(Vr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[Vr.normal=0]="normal",Vr[Vr.transformFeedback=1]="transformFeedback";var Dr=1,zr=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,r.floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.materialState=new kr,i){var n=i.name,a=void 0===n?"Material"+Dr++:n,o=i.renderType,s=void 0===o?0:o,u=i.shader;r.name=a,r.renderType=s,r.shaderSource=u,r.props=i,r._shader=new exports.Shader(e),r._shader.shaderData=He({},i.shader,{id:ct(),dataType:pe.Shader})}else r.name="Material"+Dr++,r.renderType=0;return r}Vt(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.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];nt(i.initialize)?i.initialize():tt.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this._shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.materialState.apply(t)},i.use=function(t,e){var i,r=t.engine,n=this.shaderVariant;if(n.bind(),this.setupStates(r),e){for(var a,o=_e(e.uniforms);!(a=o()).done;)i=a.value,this.checkUniform(i);for(var s,u=_e(e.samplers);!(s=u()).done;)i=s.value,this.samplers.includes(i)||(this.samplers.push(i),this.uniformDirty=!0)}if(this.uniformDirty&&(n.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(i in e.floats)n.setFloat(i,e.floats[i]);for(i in e.ints)n.setInt(i,e.ints[i]);for(i in e.vector4s)n.setVector4(i,e.vector4s[i]);for(i in e.vector3s)n.setVector3(i,e.vector3s[i]);for(i in e.matrices)n.setMatrix(i,e.matrices[i])}for(i in this.textures)this.textures[i].initialize();for(i in this.floats)n.setFloat(i,this.floats[i]);for(i in this.ints)n.setInt(i,this.ints[i]);for(i in this.floatArrays)n.setFloats(i,this.floatArrays[i]);for(i in this.textures)n.setTexture(i,this.textures[i]);for(i in this.vector2s)n.setVector2(i,this.vector2s[i]);for(i in this.vector3s)n.setVector3(i,this.vector3s[i]);for(i in this.vector4s)n.setVector4(i,this.vector4s[i]);for(i in this.colors)n.setColor(i,this.colors[i]);for(i in this.quaternions)n.setQuaternion(i,this.quaternions[i]);for(i in this.matrices)n.setMatrix(i,this.matrices[i]);for(i in this.matrice3s)n.setMatrix3(i,this.matrice3s[i]);for(i in this.vector4Arrays)n.setVector4Array(i,this.vector4Arrays[i]);for(i in this.matrixArrays)n.setMatrixArray(i,this.matrixArrays[i])},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=_e(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=_e(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;Y(r);var n=e.create(r,i);return n.materialState=Object.assign(new kr,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},i.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 C(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=wr.fromIdentity(),s=0;s<16;s++)o.elements[s]=t.matrixArrays[e][a+s];n.push(o)}this.setMatrixArray(e,n)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=He({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===Ot.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,a=e.stringTags.RenderFace;for(r in a===Nt.Front?(this.culling=!0,this.cullFace=Di.BACK):a===Nt.Back?(this.culling=!0,this.cullFace=Di.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var o=i.vector4s[r];this.setVector4(r,new C(o.x,o.y,o.z,o.w))}for(r in i.colors){var s=i.colors[r];this.setColor(r,new w(s.r,s.g,s.b,s.a))}for(r in i.textures){var u=i.textures[r],h=this.engine.findObject(u.texture);this.setTexture(r,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(r+"_ST",new C(c.x,c.y,l.x,l.y))}if(e.shader){var f=this.engine.findObject(e.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.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=pe.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},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(){var e;this.destroyed||(null==(e=this.shaderVariant)||e.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=lt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},Pi(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",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}}]),e}(Re);zr.create=function(t,e){return new zr(t,e)};var Br,Ur=function(){function t(){this.alphaMaskEnabled=!1,this.isMask=!1,this.inverted=!1,this.maskMode=exports.MaskMode.NONE,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:exports.TextureLoadAction.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.inverted,a=void 0!==n&&n,o=e.reference,s=e.alphaMaskEnabled,u=void 0!==s&&s;if(this.alphaMaskEnabled=u,this.isMask=r,this.inverted=a,this.maskReferences=[],r)this.maskMode=exports.MaskMode.MASK;else{this.maskMode=a?exports.MaskMode.REVERSE_OBSCURED:exports.MaskMode.OBSCURED;var h=t.findObject(o);h&&this.maskReferences.push({maskable:h,inverted:a})}},e.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some((function(e){return e.maskable===t}))){if(this.maskReferences.length>=255)return void console.warn("Maximum of 255 mask references exceeded. Additional masks will be ignored.");this.maskReferences.push({maskable:t,inverted:e})}},e.removeMaskReference=function(t){var e=this.maskReferences.findIndex((function(e){return e.maskable===t}));-1!==e&&this.maskReferences.splice(e,1)},e.clearMaskReferences=function(){this.maskReferences=[]},e.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=_e(r);!(i=n()).done;){var a=i.value;this.addMaskReference(a,!1)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var o,s=[],u=[],h=_e(this.maskReferences);!(o=h()).done;){var l=o.value;l.inverted?u.push(l):s.push(l)}for(var c=0;c<s.length;c++)s[c].maskable.drawStencilMask(c);for(var f,d=s.length,p=_e(u);!(f=p()).done;){f.value.maskable.drawStencilMask(d)}this.expectedStencilValue=d}for(var m,v=_e(e.materials);!(m=v()).done;){var y=m.value;this.setupMaskedMaterial(y)}for(var g,x=_e(r);!(g=x()).done;){var b=g.value;this.removeMaskReference(b)}},e.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.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.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},e.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[Di.EQUAL,Di.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpZPass=[Di.INCR,Di.INCR],t.colorMask=!1},e.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[Di.EQUAL,Di.EQUAL],t.stencilOpZPass=[Di.KEEP,Di.KEEP]):t.stencilTest=!1},e.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},Pi(t,[{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:this.maskMode===exports.MaskMode.REVERSE_OBSCURED})}}]),t}();exports.HitTestType=void 0,(Br=exports.HitTestType||(exports.HitTestType={}))[Br.triangle=1]="triangle",Br[Br.box=2]="box",Br[Br.sphere=3]="sphere",Br[Br.custom=4]="custom";var Gr=function(){this.position=new _,this.delta=new _,this.pointerCurrentRaycast=new jr},jr=function(){this.point=null,this.item=null},Xr=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new S),this.vectorsWorld.push(new S);for(var n=0;n<3;n++)this.directions.push(new S);this.minimum=new S,this.maximum=new S,this.minimumWorld=new S,this.maximumWorld=new S,this.center=new S,this.centerWorld=new S,this.extendSize=new S,this.extendSizeWorld=new S,this.worldMatrix=i||wr.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||wr.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);var n=r*e;i.scale(.5*n);var a=t.tempVector1,o=t.tempVector2;return a.copyFrom(this.center).subtract(i),o.copyFrom(this.center).add(i),this.reConstruct(a,o,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld,r=-1e-6;return!(i.x-t.x<r||r>t.x-e.x)&&(!(i.y-t.y<r||r>t.y-e.y)&&!(i.z-t.z<r||r>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}();Xr.tempVector0=new S,Xr.tempVector1=new S,Xr.tempVector2=new S;var Wr=function(){function t(){this.boundingBox=new Xr(new S,new S),this.triangles=[],this.worldMatrix=new wr,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 e=t.prototype;return e.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},e.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},e.getBoundingBoxTriangle=function(t){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=_e(this.boundingBoxTriangle.area);!(e=o()).done;){var s=e.value;i=Math.max(s.p0.x,s.p1.x,s.p2.x,i),r=Math.max(s.p0.y,s.p1.y,s.p2.y,r),n=Math.min(s.p0.x,s.p1.x,s.p2.x,n),a=Math.min(s.p0.y,s.p1.y,s.p2.y,a)}var u=[],h=new S(n,r,0),l=new S(i,r,0),c=new S(i,a,0),f=new S(n,a,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=_e(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxTriangle={type:exports.HitTestType.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=_e(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},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new S),t.p1=e.worldMatrix.transformPoint(t.p1,new S),t.p2=e.worldMatrix.transformPoint(t.p2,new S)})),t},t}(),Hr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e.frameClipMasks=[],e.maskManager=new Ur,e._priority=0,e.boundingBoxInfo=new Wr,e}Vt(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){},Pi(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}(Ii);a([Pe()],Hr.prototype,"materials",void 0),a([Pe()],Hr.prototype,"_priority",void 0);var Yr,Zr=6,qr="editor",Kr={"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"},Qr=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=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var a;null==(a=e.listeners[t])||a.forEach((function(i){var n=i.listener,a=i.options;n.apply(void 0,[].concat(r)),(null==a?void 0:a.once)&&e.off(t,n)}))},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map((function(t){return t.listener})))||[]}},Jr=new Ke,$r=new S,tn=new S,en=1,rn=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new S(0,0,0),this.quat=new Ke(0,0,0,1),this.rotation=new Ar(0,0,0),this.scale=new S(1,1,1),this.anchor=new S(0,0,0),this.size=new _(1,1),this.children=[],this.worldMatrix=wr.fromIdentity(),this.localMatrix=wr.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new S(0,0,0),quat:new Ke(0,0,0,1),scale:new S(1,1,1)},this.name="transform_"+en++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,a=t.scale,o=t.size,s=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(n(i,S)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)n(s,Ke)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var l=e?-1:1;n(r,Ar)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}a&&(n(a,S)?this.setScale(a.x,a.y,a.z):this.setScale(a[0],a[1],a[2])),o&&this.setSize(o.x,o.y),h&&(n(h,_)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){d(this.children,t)},e.removeChild=function(t){p(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Ar)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return 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?($r.set(0,0,0),Jr.set(0,0,0,1),tn.set(1,1,1),r.decompose($r,Jr,tn),$r.set(t-$r.x,e-$r.y,i-$r.z),Jr.invert(),$r.applyQuaternion(Jr),$r.x=0!==tn.x?$r.x/tn.x:0,$r.y=0!==tn.y?$r.y/tn.y:0,$r.z=0!==tn.z?$r.z/tn.z:0,this.setPosition($r.x,$r.y,$r.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Ar)},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.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new S).copyFrom(t.position),t.quat?e.quat=new Ke(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Ar(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new S).copyFrom(t.scale),t.size&&(e.size=(new _).copyFrom(t.size)),t.anchor&&(e.anchor=(new _).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var i=Jr.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},Pi(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}();exports.VFXItem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new rn,r.time=-1,r.duration=0,r.endBehavior=Bt.forward,r.type=Pt.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new Qr,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=_e(this.components);!(i=r()).done;){var a=i.value;if(n(a,t)){e=a;break}}return e},i.getComponents=function(t){for(var e,i=[],r=_e(this.components);!(e=r()).done;){var a=e.value;n(a,t)&&i.push(a)}return i},i.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},i.setParent=function(t){(t!==this||t)&&(this.parent&&p(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()))},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=_e(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new rn({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Ar(t,e,i),n=Ke.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(t,e,i)},i.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)}},i.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)}},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.hitTest=function(t,i,r,n,a,o,s){var u;if(!this.isActive)return!1;var h=!1,l=null==s?void 0:s.maxCount,c=this.getHitTestParams(o);if(c){var f=c.clipMasks,d=!0;if(f.length>0&&!function(t,e){for(var i,r=_e(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 S(-.5*s,.5*u,0).applyMatrix(o),l=new S(-.5*s,-.5*u,0).applyMatrix(o),c=new S(.5*s,.5*u,0).applyMatrix(o),f={p0:h,p1:l,p2:c},d={p0:c,p1:l,p2:new S(.5*s,-.5*u,0).applyMatrix(o)};if(!t.intersectTriangle(f)&&!t.intersectTriangle(d))return!1}}return!0}(t,f)&&(d=!1),d){var p=!1,m=new S;if(c.type===exports.HitTestType.triangle){for(var v=c.triangles,y=c.backfaceCulling,g=0;g<v.length;g++)if(t.intersectTriangle(v[g],m,y)){p=!0,a.push(m);break}}else if(c.type===exports.HitTestType.box){var x=c.center,b=c.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);t.intersectBox({min:T,max:E},m)&&(p=!0,a.push(m))}else if(c.type===exports.HitTestType.sphere){var C=c.center,w=c.radius;t.intersectSphere({center:C,radius:w},m)&&(p=!0,a.push(m))}else if(c.type===exports.HitTestType.custom){var A=c.collect(t,new _(i,r));A&&A.length>0&&(A.forEach((function(t){a.push(t)})),p=!0)}if(p){var M,P={id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:c.behavior,item:this,composition:this.composition};if(n.push(P),h=!0,null==s||null==(M=s.stop)?void 0:M.call(s,P))return!0}}}for(var I,R=_e(this.children);!(I=R()).done;){var O,N=I.value;if(void 0!==l&&n.length>=l)break;(null==s||null==(O=s.skip)?void 0:O.call(s,N))||N.hitTest(t,i,r,n,a,o,s)&&(h=!0)}return e.isComposition(this)&&h&&this!==(null==(u=this.composition)?void 0:u.rootItem)&&n.push({id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:Mt.NONE,item:this,composition:this.composition}),h},i.getCurrentPosition=function(){var t=new S;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,a=i[r];if(r++,a.name===t)return a;(n=i).push.apply(n,[].concat(a.children))}},i.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.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=_e(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=_e(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=_e(this.children);!(r=n()).done;){r.value.awake()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=_e(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=_e(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=_e(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.onParentChanged=function(){for(var t,e=_e(this.components);!(t=e()).done;){t.value.onParentChanged()}for(var i,r=_e(this.children);!(i=r()).done;){i.value.onParentChanged()}},i.setRendererComponentOrder=function(t){for(var e,i=_e(this.components);!(e=i()).done;){var r=e.value;n(r,Hr)&&(r.priority=t)}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r,n=i.id,a=i.name,o=i.parentId,s=i.endBehavior,u=i.transform,h=i.duration,l=void 0===h?0:h,c=i.visible,f=void 0===c||c;if(this.type=i.type,this.props=i,this.id=n.toString(),this.parentId=o,this.components.length=0,e.isComposition(this)){var d=this.definition.content.options.refId,p=this.engine.findEffectsObjectData(d);if(!p)throw new Error("Referenced precomposition with Id: "+d+" does not exist.");this.instantiatePreComposition(p)}if(this.name=a,this.duration=l,this.endBehavior=s,u&&this.transform.fromData(u),this.transform.name=this.name,this.transform.engine=this.engine,i.content||(i.content={options:{}}),l<0)throw new Error("Item duration can't be less than 0, see "+Kr["Item duration can't be less than 0"]+".");if(i.components)for(var m,v=_e(i.components);!(m=v()).done;){var y=m.value,g=this.engine.findObject(y);this.components.push(g)}for(var x,b=_e(null!=(r=i.children)?r:[]);!(x=b()).done;){var T=x.value;this.engine.findObject(T).setParent(this)}this.setVisible(f)},i.toData=function(){var t,e;(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=pe.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.definition.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.definition.components){this.definition.components=[];for(var i,r=_e(this.components);!(i=r()).done;){var a=i.value;n(a,exports.EffectComponent)&&this.definition.components.push(a)}}this.definition.content={}},i.dispose=function(){if(this.composition){this.composition.destroyItem(this);for(var e,i=_e(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}this.resetChildrenParent(),t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=_e(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&p(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i,r=this.getInstanceId();this.setInstanceId(t.id);for(var n,a=_e(t.components);!(n=a()).done;){var o=n.value,s=this.engine.findObject(o);s.item=this,this.components.push(s)}for(var u,h=_e(null!=(i=t.children)?i:[]);!(u=h()).done;){var l=u.value;this.engine.findObject(l).setParent(this)}if(e){for(var c,f=_e(this.components);!(c=f()).done;){c.value.setInstanceId(ct())}for(var d,p=_e(this.children);!(d=p()).done;){d.value.refreshGUIDRecursive()}}this.setInstanceId(r)},i.refreshGUIDRecursive=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:ct();this.setInstanceId(i);for(var r,n=_e(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:ct();o.setInstanceId(s)}for(var u,h=_e(this.children);!(u=h()).done;){u.value.refreshGUIDRecursive(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=_e(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=_e(this.children);!(n=a()).done;){n.value.gatherPreviousObjectID(t)}},i.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)}},e.isComposition=function(t){return t.type===Pt.composition},e.isSprite=function(t){return t.type===Pt.sprite},e.isParticle=function(t){return t.type===Pt.particle},e.isNull=function(t){return t.type===Pt.null},e.isTree=function(t){return t.type===Pt.tree},e.isCamera=function(t){return t.type===Pt.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},Pi(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=_e(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:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(Re),exports.VFXItem=a([Me(pe.VFXItemData)],exports.VFXItem),exports.Item=void 0,(Yr=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},Yr.isComposition=function(t){return t.type===Pt.composition},Yr.isParticle=function(t){return t.type===Pt.particle},Yr.isNull=function(t){return t.type===Pt.null};var nn,an,on=(nn=new Float32Array(1),an=new Int32Array(nn.buffer),function(t){nn[0]=t;var e=an[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?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),sn=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]=on(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=on(t[i])},t}();var un,hn=new Ar,ln=new wr;function cn(t,e,i,r,n,a,o){var s=t,u=r/n,h=r,l=e.speedOverLifetime;l&&(h=l.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;s.copyFrom(a),s.addScaledVector(o,h),s.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new S;d.center&&p.setFromArray(d.center);var m=s.clone().subtract(p),v=d.asRotation,y=["x","y","z"].map((function(t){var e=d[t];return e?v?e.getValue(u):e.getIntegrateValue(0,r,n):0}));hn.setFromArray(y).negate(),ln.setFromEuler(hn);var g=ln.transformPoint(m);s.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var _=x?b.getValue(u):b.getIntegrateValue(0,r,n);s.x=s.x+_}if(T){var C=x?T.getValue(u):T.getIntegrateValue(0,r,n);s.y=s.y+C}if(E){var w=x?E.getValue(u):E.getIntegrateValue(0,r,n);s.z=s.z+w}}return s}function fn(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function dn(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function pn(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 mn=((un={})[Rt.PARTICLE_ORIGIN_CENTER]=[0,0],un[Rt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],un[Rt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],un[Rt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],un[Rt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],un[Rt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],un[Rt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],un[Rt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],un[Rt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],un);function vn(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function yn(t,e,i){var r=i.position,n=new S(t,e,0),a=new S;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new Pr(r,a)}function gn(t,e,i){var r=t.x,n=t.y,a=t.z,o=new S(r-e,n+i,a),s=new S(r-e,n-i,a),u=new S(r+e,n-i,a),h=new S(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function xn(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function bn(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function Tn(t,e,i,r,n){void 0===r&&(r=null);var a=new S(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new S(-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 En={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,a=e[r],o=e[n];return new _(a,o)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===zt.LINE||i===zt.EASE_OUT?0:i===zt.EASE_IN||i===zt.EASE||i===zt.HOLD&&r===zt.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!==zt.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==zt.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[zt.EASE,zt.EASE_IN,zt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[zt.EASE,zt.EASE_OUT,zt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===zt.HOLD&&[zt.HOLD,zt.LINE_OUT,zt.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===zt.HOLD&&[zt.HOLD,zt.LINE,zt.EASE_IN].includes(i)}},_n=function(t,e){this.points=t,this.totalLength=e},Sn={},Cn={},wn=.1;function An(t,e){return 1-3*e+3*t}function Mn(t,e){return 3*e-6*t}function Pn(t){return 3*t}function In(t,e,i){return((An(e,i)*t+Mn(e,i))*t+Pn(e))*t}function Rn(t,e,i){return 3*An(e,i)*t*t+2*Mn(e,i)*t+Pn(e)}function On(t,e,i,r){var n=bn(e.x-t.x,3)+"_"+bn(e.y-t.y,3)+"_"+bn(e.z-t.z,3)+"&"+(bn(i.x-t.x,3)+"_"+bn(i.y-t.y,3)+"_"+bn(i.z-t.z,3))+"&"+(bn(r.x-t.x,3)+"_"+bn(r.y-t.y,3)+"_"+bn(r.z-t.z,3));if(Cn[n])return{data:Cn[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new S,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),u+=Math.pow(l.y-o.y,2),u+=Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new _n(a,s);return Cn[n]=f,{data:f,interval:new S(t.x,t.y,t.z)}}var Nn=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=On(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(xn(1-t,0))return e.points[299].point.clone().add(this.interval);if(xn(e.totalLength,0))return this.p1.clone();var i=new S,r=bn(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(xn(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+=bn(e.points[a].partialLength,5)):s<0&&a>0?(n-=bn(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),Ln=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new Ke,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):xn(1-t,0)?this.temp.copyFrom(this.p2):(Dn.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Fn=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new _,this.control2=new _,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new 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(),In(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 t*(o*a)+e*o*n*3+i*a*s*3+r*(s*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=In(t*wn,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+=wn;var n=i+(t-e[--r])/(e[r+1]-e[r])*wn,a=Rn(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=Rn(e,i,r);if(0===a)return e;e-=(In(e,i,r)-t)/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=In(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+wn,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 Vn(t,e){var i=kn(t,e,!0),r=i.p0,n=i.p1,a=i.p2,o=i.p3;Y(a),Y(o);var s,u,h=o.x-r.x,l=o.y-r.y,c=bn((n.x-r.x)/h,5),f=bn((a.x-r.x)/h,5);xn(l,0)?s=u=NaN:(s=bn((n.y-r.y)/l,5),u=bn((a.y-r.y)/l,5)),c<0&&(c=0),f<0&&(f=0),c>1&&(c=1),f>1&&(f=1);var d,p=("bez_"+c+"_"+s+"_"+f+"_"+u).replace(/\./g,"p");return Sn[p]?d=Sn[p]:(d=xn(l,0)?new Fn:new Fn(c,s,f,u),Sn[p]=d),{points:[r,n,a,o],timeInterval:h,valueInterval:l,curve:d}}function kn(t,e,i){var r=t[1],n=En.isHoldOutKeyframe(t),a=En.isHoldInKeyframe(e),o=!a&&En.isRightSideEase(t),s=!n&&En.isLeftSideEase(e);if(o&&!s&&!a){var u=new _(r[r.length-4],r[r.length-3]),h=new _(r[r.length-2],r[r.length-1]),l=En.getPointInCurve(e),c=new _(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new _(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!o&&s&&!n){var f=e[1],d=En.getPointInCurve(t),p=new _(d.x,d.y),m=new _(f[0],f[1]),v=new _(f[2],f[3]);return{type:"ease",p0:p,p1:new _(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(o&&s){var y=e[1];return{type:"ease",p0:new _(r[r.length-4],r[r.length-3]),p1:new _(r[r.length-2],r[r.length-1]),p2:new _(y[0],y[1]),p3:new _(y[2],y[3])}}var g=En.getPointInCurve(t),x=En.getPointInCurve(e);return n?x.y=g.y:a&&(g.y=x.y),i?{type:"line",p0:g,p1:new _((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new _((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}:{type:"line",p0:g,p1:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var Dn=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)return t.x=n,t.y=a,t.z=o,void(t.w=s);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);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}(),zn="not_implement",Bn=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(zn)},e.getIntegrateValue=function(t,e,i){throw new Error(zn)},e.getIntegrateByTime=function(t,e){throw new Error(zn)},e.getValue=function(t){throw new Error(zn)},e.getMaxTime=function(){throw new Error(zn)},e.toUniform=function(t){throw new Error(zn)},e.map=function(t){throw new Error(zn)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(zn)},t.getAllData=function(t,e){for(var i=new(e?sn: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}(),Un=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Bn),Gn=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Bn),jn=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(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}(Bn),Xn=function(t){function e(){return t.apply(this,arguments)}Vt(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}(Bn),Wn=function(t){function e(){return t.apply(this,arguments)}Vt(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 Jn(e,0,this.xCoord,this.min,this.max)-Jn(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}(Bn),Hn=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=P(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 I(n.color.toArray(),a.color.toArray(),o,!0)}}return e[i].color.toArray()},e}(Bn),Yn=function(t){function e(){return t.apply(this,arguments)}Vt(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?Jn:Qn,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=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},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}(Bn),Zn=function(t){function e(){return t.apply(this,arguments)}Vt(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;if(0===o)s=(t-n[0])/(a[0]-n[0]);else s=($n(t,n,a)-n[1])/o;return 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}(Bn),qn=function(t){function e(){return t.apply(this,arguments)}Vt(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 S(i[n][0],i[n][1],i[n][2]),u=new S(i[n+1][0],i[n+1][1],i[n+1][2]),h=new S(r[2*n][0],r[2*n][1],r[2*n][2]),l=new S(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=Vn(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Nn(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=bn(t,5),i=0,r=new S,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 r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return r=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=bn((e-r.x)/n,4);return E(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Bn),Kn=function(t){function e(){return t.apply(this,arguments)}Vt(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=Ke.fromArray(i[n]),u=Ke.fromArray(i[n+1]),h=Ke.fromArray(r[2*n]),l=Ke.fromArray(r[2*n+1]),c=Vn(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Ln(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=bn(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=bn((e-r.x)/n,4);return E(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Bn);function Qn(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function Jn(t,e,i,r,n){var a=t*t,o=e*e;return(2*(a*t)*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function $n(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,h=u-2*s+o,l=u-s,c=-2*u+3*s;return(2*u-3*s+1)*e[1]+h*n+l*a+c*i[1]}function ta(t,e){if(e){var i=e[0],r=e[1];if(i===Dt.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===Dt.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===Dt.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 ea(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function ia(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ia=function(){return!!t})()}function ra(t,e,i){return ra=ia()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Ft(n,i.prototype),n},ra.apply(null,arguments)}var na,aa,oa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new C,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=pa(t[0]),this.yCurve=pa(t[1]),this.zCurve=pa(t[2]),this.wCurve=pa(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}(Bn),sa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new S,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=pa(t[0]),this.yCurve=pa(t[1]),this.zCurve=pa(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}(Bn),ua=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new _,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=pa(t[0]),this.yCurve=pa(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}(Bn);exports.TangentMode=void 0,(na=exports.TangentMode||(exports.TangentMode={}))[na.Cubic=0]="Cubic",na[na.Linear=1]="Linear",na[na.Constant=2]="Constant",exports.WeightedMode=void 0,(aa=exports.WeightedMode||(exports.WeightedMode={}))[aa.None=0]="None",aa[aa.In=1]="In",aa[aa.Out=2]="Out",aa[aa.Both=3]="Both";var ha=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=ca(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=la(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);o+=0===u||20===u?l:u%2==1?4*l:2*l}return o*=s/3},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}(Bn);function la(t,e){var i=new _(t.time,t.value),r=new _,n=new _,a=new _,o=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,s=2===t.tangentMode,u=(o?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(s?0:t.outSlope);var h=(o?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(s?0:e.inSlope),a.x=e.time,a.y=s?t.value:e.value,Y(n),Y(a);var l,c,f=a.x-i.x,d=a.y-i.y,p=bn((r.x-i.x)/f,5),m=bn((n.x-i.x)/f,5);xn(d,0)?l=c=NaN:(l=bn((r.y-i.y)/d,5),c=bn((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,a),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,a),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,a),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,a),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return Sn[y]?v=Sn[y]:(v=xn(d,0)?new Fn:o?new Fn(p,l,m,c):new Fn(l,c),Sn[y]=v),{points:[i,r,n,a],timeInterval:f,valueInterval:d,curve:v}}function ca(t){for(var e=t,i=[],r=[],n={x:0,y:0},a=0;a<e.length;a++){var o=e[a],s=kn(o,a+1<e.length?e[a+1]:e[a],!0),u=s.p0,h=s.p1,l=s.p2,c=s.p3,f=s.type;Y(l),Y(c);var d={leftControl:n,value:u,rightControl:h,tangentMode:"line"===f?1:0};o[0]===zt.HOLD&&(d.tangentMode=2),r.push(d),n=l}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+x)},m=0;m<r.length;m++){var v=r[m].leftControl,y=r[m].value,g=r[m].rightControl,b=0,T=0;m>0&&(b=p(v,y)),m<r.length-1&&(T=p(y,g));var E={time:y.x,value:y.y,inSlope:b,outSlope:T,inWeight:0,outWeight:0,tangentMode:r[m].tangentMode,weightedMode:3};i.push(E),m>0&&(E.inWeight=(y.x-v.x)/((y.x-r[m-1].value.x)/3)),m+1<r.length&&(E.outWeight=(g.x-y.x)/((r[m+1].value.x-y.x)/3))}return i}var fa,da=((fa={})[Dt.RANDOM]=function(t){return n(t[0],Array)?new Xn(t):new jn(t)},fa[Dt.CONSTANT]=function(t){return new Un(t)},fa[Dt.CONSTANT_VEC2]=function(t){return new Un(t)},fa[Dt.CONSTANT_VEC3]=function(t){return new Un(t)},fa[Dt.CONSTANT_VEC4]=function(t){return new Un(t)},fa[Dt.RGBA_COLOR]=function(t){return new Un(t)},fa[Dt.COLORS]=function(t){return new Gn(t.map((function(t){return A(t,!1)})))},fa[Dt.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Wn([t[0][1],t[1][1]]):new Yn(t)},fa[Dt.GRADIENT_COLOR]=function(t){return new Hn(t)},fa[Dt.LINEAR_PATH]=function(t){return new Zn(t)},fa[Dt.BEZIER_CURVE]=function(t){return 1===t.length?new Un(t[0][1][1]):new ha(t)},fa[Dt.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Un(ra(S,[].concat(t[1][0]))):new qn(t)},fa[Dt.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Un(ra(Ke,[].concat(t[1][0]))):new Kn(t)},fa[Dt.COLOR_CURVE]=function(t){return new ma(t)},fa[Dt.VECTOR4_CURVE]=function(t){return new oa(t)},fa[Dt.VECTOR2_CURVE]=function(t){return new ua(t)},fa[27]=function(t){return new sa(t)},fa);function pa(t){if(!t||!isNaN(+t))return new Un(t||0);if(n(t,Bn))return t;if(nt(da[t[0]]))return da[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Kr["ValueType: 21/22 is not supported"]+".")}var ma=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new w,e}Vt(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=pa(t[0]),this.gCurve=pa(t[1]),this.bCurve=pa(t[2]),this.aCurve=pa(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}(Bn),va=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},Pi(t,null,[{key:"shared",get:function(){return ya.x=0,ya.y=0,ya}}]),t}(),ya=new va,ga=1e-4,xa=1e-4;function ba(t,e,i,r,n,a,o,s){var u,h;o?(u=r,h=-i):(u=-r,h=i);var 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 Ta(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.abs(d),m=Math.sqrt(u*u+h*h),v=1+(15*p*Math.sqrt(m)/Math.PI>>0),y=d/v;if(f+=y,s){o.push(t,e),o.push(i,r);for(var g=1,x=f;g<v;g++,x+=y)o.push(t,e),o.push(t+Math.sin(x)*m,e+Math.cos(x)*m);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)o.push(t+Math.sin(T)*m,e+Math.cos(T)*m),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*v}function Ea(t,e,i,r,n,a,o,s,u){var h=ga;if(0!==t.length){var l=e,c=l.alignment;if(.5!==e.alignment){var f=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&&(f*=-1),c=(c-.5)*f+.5}var d=new va(t[0],t[1]),p=new va(t[t.length-2],t[t.length-1]),m=r,v=Math.abs(d.x-p.x)<h&&Math.abs(d.y-p.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var y=.5*(d.x+p.x),g=.5*(p.y+d.y);t.unshift(y,g),t.push(y,g)}var b=n,T=t.length/2,E=t.length,_=b.length/2,S=l.width/2,C=S*S,w=l.miterLimit*l.miterLimit,A=t[0],M=t[1],P=t[2],I=t[3],R=0,O=0,N=-(M-I),L=A-P,F=0,V=0,k=Math.sqrt(N*N+L*L)+x;N/=k,L/=k,N*=S,L*=S;var D=2*(1-c),z=2*c;m||(l.cap===ue.Round?E+=Ta(A-N*(D-z)*.5,M-L*(D-z)*.5,A-N*D,M-L*D,A+N*z,M+L*z,b,!0)+2:l.cap===ue.Square&&(E+=ba(A,M,N,L,D,z,!0,b))),b.push(A-N*D,M-L*D),b.push(A+N*z,M+L*z);for(var B=1;B<T-1;++B){A=t[2*(B-1)],M=t[2*(B-1)+1],P=t[2*B],I=t[2*B+1],R=t[2*(B+1)],O=t[2*(B+1)+1],N=-(M-I),L=A-P,N/=k=Math.sqrt(N*N+L*L)+x,L/=k,N*=S,L*=S,F=-(I-O),V=P-R,F/=k=Math.sqrt(F*F+V*V)+x,V/=k,F*=S,V*=S;var U=P-A,G=M-I,j=P-R,X=O-I,W=U*j+G*X,H=G*j-X*U,Y=H<0;if(Math.abs(H)<.001*Math.abs(W))b.push(P-N*D,I-L*D),b.push(P+N*z,I+L*z),W>=0&&(l.join===he.Round?E+=Ta(P,I,P-N*D,I-L*D,P-F*D,I-V*D,b,!1)+4:E+=2,b.push(P-F*z,I-V*z),b.push(P+F*D,I+V*D));else{var Z=(-N+A)*(-L+I)-(-N+P)*(-L+M),q=(-F+R)*(-V+I)-(-F+P)*(-V+O),K=(U*q-j*Z)/H,Q=(X*Z-G*q)/H,J=(K-P)*(K-P)+(Q-I)*(Q-I),$=P+(K-P)*D,tt=I+(Q-I)*D,et=P-(K-P)*z,it=I-(Q-I)*z,rt=Y?D:z;J<=Math.min(U*U+G*G,j*j+X*X)+rt*rt*C?l.join===he.Bevel||J/C>w?(Y?(b.push($,tt),b.push(P+N*z,I+L*z),b.push($,tt),b.push(P+F*z,I+V*z)):(b.push(P-N*D,I-L*D),b.push(et,it),b.push(P-F*D,I-V*D),b.push(et,it)),E+=2):l.join===he.Round?Y?(b.push($,tt),b.push(P+N*z,I+L*z),E+=Ta(P,I,P+N*z,I+L*z,P+F*z,I+V*z,b,!0)+4,b.push($,tt),b.push(P+F*z,I+V*z)):(b.push(P-N*D,I-L*D),b.push(et,it),E+=Ta(P,I,P-N*D,I-L*D,P-F*D,I-V*D,b,!1)+4,b.push(P-F*D,I-V*D),b.push(et,it)):(b.push($,tt),b.push(et,it)):(b.push(P-N*D,I-L*D),b.push(P+N*z,I+L*z),l.join===he.Round?E+=Y?Ta(P,I,P+N*z,I+L*z,P+F*z,I+V*z,b,!0)+2:Ta(P,I,P-N*D,I-L*D,P-F*D,I-V*D,b,!1)+2:l.join===he.Miter&&J/C<=w&&(Y?(b.push(et,it),b.push(et,it)):(b.push($,tt),b.push($,tt)),E+=2),b.push(P-F*D,I-V*D),b.push(P+F*z,I+V*z),E+=2)}}A=t[2*(T-2)],M=t[2*(T-2)+1],P=t[2*(T-1)],N=-(M-(I=t[2*(T-1)+1])),L=A-P,N/=k=Math.sqrt(N*N+L*L)+x,L/=k,N*=S,L*=S,b.push(P-N*D,I-L*D),b.push(P+N*z,I+L*z),m||(l.cap===ue.Round?E+=Ta(P-N*(D-z)*.5,I-L*(D-z)*.5,P-N*D,I-L*D,P+N*z,I+L*z,b,!1)+2:l.cap===ue.Square&&(E+=ba(P,I,N,L,D,z,!1,b)));for(var nt=_;nt<E+_-2;++nt)A=b[2*nt],M=b[2*nt+1],P=b[2*(nt+1)],I=b[2*(nt+1)+1],R=b[2*(nt+2)],O=b[2*(nt+2)+1],Math.abs(A*(I-O)+P*(O-M)+R*(M-I))<1e-8||s.push(nt,nt+1,nt+2)}}var _a=function(){},Sa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ca={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(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 a(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 o(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function s(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 u(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 h(t){return r(t.b.a,t.a)}function l(t){return r(t.a,t.b.a)}function c(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 f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function d(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,E(e.a,t.a)),e.d!==t.d&&(i=!0,_(e.d,t.d)),g(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,_(t.d,t.b.d)),t.c===t?E(t.a,null):(t.b.d.a=$(t),t.a.c=t.c,g(t,$(t)),i||b(t,t.d)),e.c===e?(E(e.a,null),_(e.d,null)):(t.d.a=$(e),e.a.c=e.c,g(e,$(e))),T(t)}function m(t){var e=y(t),i=e.b;return g(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,g(t.b,$(t.b)),g(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 v(t,e){var i=!1,r=y(t),n=r.b;return e.d!==t.d&&(i=!0,_(e.d,t.d)),g(r,t.e),g(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function y(t){var e=new J,i=new J,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 g(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new Q(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 T(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function E(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 _(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 S(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 C=4e150;function w(t,e){t.f+=e.f,t.b.f+=e.b.f}function A(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=a(i.b.a,e.a,i.a):0<=a(e.b.a,i.a,e.a):0>=a(i.b.a,t,i.a):i.b.a===t?0<=a(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function M(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function P(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function I(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(P(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function R(t,e,i){var r=new ct;return r.a=i,r.e=W(t.f,e.e,r),i.i=r}function O(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 N(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,M(t)}function L(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=ft(t),n=r.a;if(n.a!==e.a){if(!r.c){N(t);break}P(r,n=v(e.c.b,n.b))}e.c!==n&&(d($(n),n),d(e,n)),N(t),e=r.a,t=r}return e}function F(t,e,i,r,n,a){var o=!0;do{R(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=ft(e).a.b.c);(i=(r=ft(e)).a.b).a===n.a;)i.c!==n&&(d($(i),i),d($(n),i)),r.f=e.f-i.f,r.d=O(t,r.f),e.b=!0,!o&&z(t,e)&&(w(i,n),M(e),p(n)),o=!1,e=r,n=i;e.b=!0,a&&U(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function k(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),d(e,i)}function D(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function z(t,e){var n=ft(e),o=e.a,s=n.a;if(r(o.a,s.a)){if(0<a(s.b.a,o.a,s.a))return!1;if(i(o.a,s.a)){if(o.a!==s.a){n=t.e;var u=o.a.h;if(0<=u){var h=(n=n.b).d,l=n.e,c=n.c,f=c[u];h[f]=h[n.a],c[h[f]]=f,f<=--n.a&&(1>=f||r(l[h[f>>1]],l[h[f]])?ht(n,f):lt(n,f)),l[u]=null,c[u]=n.b,n.b=u}else for(n.c[-(u+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;k(t,$(s),o)}}else m(s.b),d(o,$(s)),e.b=n.b=!0}else{if(0>a(o.b.a,s.a,o.a))return!1;dt(e).b=e.b=!0,m(o.b),d($(s),o)}return!0}function B(t,e){var h=ft(e),l=e.a,f=h.a,p=l.a,v=f.a,y=l.b.a,g=f.b.a,x=new et;if(a(y,t.a,p),a(g,t.a,v),p===v||Math.min(p.a,y.a)>Math.max(v.a,g.a))return!1;if(r(p,v)){if(0<a(g,p,v))return!1}else if(0>a(y,v,p))return!1;var b,T,E=y,_=p,S=g,C=v;if(r(E,_)||(b=E,E=_,_=b),r(S,C)||(b=S,S=C,C=b),r(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),r(S,_)?r(_,C)?(0>(b=n(E,S,_))+(T=n(S,_,C))&&(b=-b,T=-T),x.b=c(b,S.b,T,_.b)):(0>(b=a(E,S,_))+(T=-a(E,C,_))&&(b=-b,T=-T),x.b=c(b,S.b,T,C.b)):x.b=(S.b+_.b)/2,o(E,_)||(b=E,E=_,_=b),o(S,C)||(b=S,S=C,C=b),o(E,S)||(b=E,E=S,S=b,b=_,_=C,C=b),o(S,_)?o(_,C)?(0>(b=s(E,S,_))+(T=s(S,_,C))&&(b=-b,T=-T),x.a=c(b,S.a,T,_.a)):(0>(b=u(E,S,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=c(b,S.a,T,C.a)):x.a=(S.a+_.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=r(p,v)?p:v,r(E,x)&&(x.b=E.b,x.a=E.a),i(x,p)||i(x,v))return z(t,e),!1;if(!i(y,t.a)&&0<=a(y,t.a,x)||!i(g,t.a)&&0>=a(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=I(e)).a,L(t,ft(e),h),F(t,e,$(l),l,l,!0),!0;if(y===t.a){m(f.b),d(l.e,$(f)),v=(p=h=e).a.b.a;do{p=dt(p)}while(p.a.b.a===v);return p=ft(e=p).a.b.c,h.a=$(f),F(t,e,(f=L(t,h,null)).c,l.b.c,p,!0),!0}return 0<=a(y,t.a,x)&&(dt(e).b=e.b=!0,m(l.b),l.a.b=t.a.b,l.a.a=t.a.a),0>=a(g,t.a,x)&&(e.b=h.b=!0,m(f.b),f.a.b=t.a.b,f.a.a=t.a.a),!1}return m(l.b),m(f.b),d($(f),l),l.a.b=x.b,l.a.a=x.a,l.a.h=rt(t.e,l.a),l=l.a,f=[0,0,0,0],x=[p.d,y.d,v.d,g.d],l.g[0]=l.g[1]=l.g[2]=0,D(l,p,y,f,0),D(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function U(t,e){for(var i=ft(e);;){for(;i.b;)e=i,i=ft(i);if(!e.b&&(i=e,null===(e=dt(e))||!e.b))break;e.b=!1;var n,o=e.a,s=i.a;if(n=o.b.a!==s.b.a)t:{var u=ft(n=e),h=n.a,l=u.a,c=void 0;if(r(h.b.a,l.b.a)){if(0>a(h.b.a,l.b.a,h.a)){n=!1;break t}dt(n).b=n.b=!0,c=m(h),d(l.b,c),c.d.c=n.d}else{if(0<a(l.b.a,h.b.a,l.a)){n=!1;break t}n.b=u.b=!0,c=m(l),d(h.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(M(i),p(s),s=(i=ft(e)).a):e.c&&(M(e),p(o),o=(e=dt(i)).a)),o.a!==s.a)if(o.b.a===s.b.a||e.c||i.c||o.b.a!==t.a&&s.b.a!==t.a)z(t,e);else if(B(t,e))break;o.a===s.a&&o.b.a===s.b.a&&(w(s,o),M(e),p(o),e=dt(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var o=e;(h=new ct).a=o.c.b;var s=(c=n.f).a;do{s=s.a}while(null!==s.b&&!c.c(c.b,h,s.b));var u=ft(c=s.b),h=c.a;s=u.a;if(0===a(h.b.a,o,h.a))i((h=c.a).a,o)||i(h.b.a,o)||(m(h.b),c.c&&(p(h.c),c.c=!1),d(o.c,h),G(n,o));else{var l=r(s.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(o.c.b,h.e):v(s.b.c.b,o.c).b,l.c?P(l,u):(h=n,(c=R(n,c,u)).f=dt(c).f+c.a.f,c.d=O(h,c.f)),G(n,o)):F(n,c,o.c,o.c,null,!0)}return}if(c=(h=ft(n=I(n.i))).a,(h=L(t,h,null)).c===c){h=(c=h).c,s=ft(n),u=n.a,l=s.a;var c,f=!1;u.b.a!==l.b.a&&B(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=I(n)).a,L(t,ft(n),s),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=L(t,s,null),f=!0),f?F(t,n,c.c,h,h,!0):(o=r(l.a,u.a)?$(l):u,F(t,n,o=v(c.c.b,o),o.c,o.c,!1),o.b.i.c=!0,U(t,n))}else F(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=C,r.a.a=e,r.b.a.b=-C,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=W(r=t.f,r.a,i),i.e=r}function X(t){this.a=new H,this.b=t,this.c=A}function W(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new H(i,e.a,e),e.a.c=t,e.a=t}function H(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=Z,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 Z=0;function q(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case Z:K(t,100151),t.u(null);break;case 1:K(t,100152),t.t()}else switch(t.d){case 2:K(t,100154),t.v();break;case 1:K(t,100153),t.w()}}function K(t,e){t.p&&t.p(e,t.c)}function Q(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function $(t){return t.b.e}function tt(){this.c=new et,this.a=new Q,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function et(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 it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new at}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=ot(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&&lt(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ut(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(st(t.b),e))return ut(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function at(){this.d=ot([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 ot(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 st(t){return t.e[t.d[1]]}function ut(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&&ht(t,1)),a}function ht(t,e){for(var i=t.d,n=t.e,a=t.c,o=e,s=i[o];;){var u=o<<1;u<t.a&&r(n[i[u+1]],n[i[u]])&&(u+=1);var h=i[u];if(u>t.a||r(n[s],n[h])){i[o]=s,a[s]=o;break}i[o]=h,a[h]=o,o=u}}function lt(t,e){for(var i=t.d,n=t.e,a=t.c,o=e,s=i[o];;){var u=o>>1,h=i[u];if(0===u||r(n[h],n[s])){i[o]=s,a[s]=o;break}i[o]=h,a[h]=o,o=u}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function ft(t){return t.e.c.b}function dt(t){return t.e.a.b}(e=Y.prototype).x=function(){q(this,Z)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void K(this,100900)}K(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:K(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];q(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&&K(this,100155),null===(i=this.q)?d(i=f(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){q(this,Z),this.d=1,this.b=new tt,this.c=t},e.t=function(){q(this,1),this.d=2,this.q=null},e.v=function(){q(this,2),this.d=1},e.w=function(){q(this,1),this.d=Z;var t=!1,e=[c=this.j[0],n=this.j[1],s=this.j[2]];if(0===c&&0===n&&0===s){for(var n=[-2e150,-2e150,-2e150],o=[2e150,2e150,2e150],s=[],u=[],c=(t=this.b.c).e;c!==t;c=c.e)for(var f=0;3>f;++f){var d=c.g[f];d<o[f]&&(o[f]=d,u[f]=c),d>n[f]&&(n[f]=d,s[f]=c)}if(c=0,n[1]-o[1]>n[0]-o[0]&&(c=1),n[2]-o[2]>n[c]-o[c]&&(c=2),o[c]>=n[c])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,o=u[c],s=s[c],u=[0,0,0],o=[o.g[0]-s.g[0],o.g[1]-s.g[1],o.g[2]-s.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-s.g[0],f[1]=c.g[1]-s.g[1],f[2]=c.g[2]-s.g[2],u[0]=o[1]*f[2]-o[2]*f[1],u[1]=o[2]*f[0]-o[0]*f[2],u[2]=o[0]*f[1]-o[1]*f[0],(d=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=d,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[S(o)]=1)}t=!0}for(u=S(e),c=this.b.c,n=(u+1)%3,s=(u+2)%3,u=0<e[u]?1:-1,e=c.e;e!==c;e=e.e)e.b=e.g[n],e.a=u*e.g[s];if(t){for(e=0,c=(t=this.b.a).b;c!==t;c=c.b)if(!(0>=(n=c.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,c=(e=this.b.b).h;c!==e;c=t)t=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(k(this,n,c),p(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==t&&n!==t.b||(t=t.h),p(n)),c!==t&&c!==t.b||(t=t.h),p(c));for(this.e=e=new it,c=(t=this.b.c).e;c!==t;c=c.e)c.h=rt(e,c);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ht(t,e);t.h=!0}(t.b)}(e),this.f=new X(this),j(this,-C),j(this,C);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=st(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=st(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),k(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,M(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,c=(e=this.b).a.b;c!==e.a;c=t)t=c.b,(c=c.a).e.e===c&&(w(c.c,c),p(c));if(!this.n){if(e=this.b,this.m)for(c=e.b.h;c!==e.b;c=t)t=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:p(c);else for(c=e.a.b;c!==e.a;c=t)if(t=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,s=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=a(n.a,n.b.a,n.e.b.a));)n=(s=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=a(c.b.a,c.a,c.c.b.a));)c=(s=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(s=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),c=t.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,c=!1,n=-1,s=e.a.d;s!==e.a;s=s.d)if(s.c){c||(this.h&&this.h(4,this.c),c=!0),u=s.a;do{t&&(n!==(o=u.b.d.c?0:1)&&(n=o,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==s.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(e=this.b).a.b;c!==e.a;c=t)if(t=c.b,!c.c){s=(n=c.a).e,u=void 0;do{s=(u=s).e,u.d=null,null===u.b.d&&(u.c===u?E(u.a,null):(u.a.c=u.c,g(u,$(u))),(o=u.b).c===o?E(o.a,null):(o.a.c=o.c,g(o,$(o))),T(u))}while(u!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Sa.libtess={GluTesselator:Y,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}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=Sa.libtess}(Ca);var wa=function(){var t=new Ca.exports.GluTesselator;return t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Ca.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(Ca.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function Aa(t){wa.gluTessNormal(0,0,1);var e=[];wa.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){wa.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];wa.gluTessVertex(a,a)}wa.gluTessEndContour()}return wa.gluTessEndPolygon(),e}var Ma=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var a=Array.isArray(i[0])?i[0]:i;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 n.points=a,n.closePath=!0,n}Vt(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=Aa([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 new Error("Invalid points array");if(2!==t.length){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)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},Pi(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(_a),Pa=8,Ia=1.1920929e-7;function Ra(t,e,i,r,n,a,o,s,u,h,l){var c=null!=l?l:1,f=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/c;return function(t,e,i,r,n,a,o,s,u,h){Oa(t,e,i,r,n,a,o,s,u,h,0),u.push(o,s)}(e,i,r,n,a,o,s,u,t,f*=f),t}function Oa(t,e,i,r,n,a,o,s,u,h,l){if(!(l>Pa)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(c+d)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(y+x)/2,E=(g+b)/2;if(l>0){var _=o-t,S=s-e,C=Math.abs((i-o)*S-(r-s)*_),w=Math.abs((n-o)*S-(a-s)*_);if(C>Ia&&w>Ia){if((C+w)*(C+w)<=h*(_*_+S*S))return void u.push(T,E)}else if(C>Ia){if(C*C<=h*(_*_+S*S))return void u.push(T,E)}else if(w>Ia){if(w*w<=h*(_*_+S*S))return void u.push(T,E)}else if((_=T-(t+o)/2)*_+(S=E-(e+s)/2)*S<=h)return void u.push(T,E)}Oa(t,e,c,f,y,g,T,E,u,h,l+1),Oa(T,E,x,b,m,v,o,s,u,h,l+1)}}var Na,La=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}Vt(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)<=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=null!=e?e:1,s=Math.ceil(Math.sqrt(o*(n+a))),u=8*s+0+0;if(0===u)return t;if(0===s)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 h=0,l=4*s+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<s;g++){var x=Math.PI/2*(g/s),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,S=r+T,C=r-T;t[h++]=E,t[h++]=S,t[--l]=S,t[--l]=_,t[c++]=_,t[c++]=C,t[--f]=C,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var w=r-p;return t[h++]=m,t[h++]=y,t[--f]=w,t[--f]=m,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}(_a);exports.StarType=void 0,(Na=exports.StarType||(exports.StarType={}))[Na.Star=0]="Star",Na[Na.Polygon=1]="Polygon";var Fa,Va=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}Vt(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)Ra(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;Ra(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=Aa([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++){i=o?h:l,r=o?c:f;var p=(e=o?s:u)*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}(_a),ka=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}Vt(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=null!=e?e:1,c=Math.ceil(Math.sqrt(l*(s+i))),f=8*c+(u?4:0)+(h?4:0);if(0!==f){if(0===c)return t[0]=t[6]=a+u,t[1]=t[3]=o+h,t[2]=t[4]=a-u,void(t[5]=t[7]=o-h);var d=0,p=4*c+(u?2:0)+2,m=p,v=f,y=u+s,g=h,x=a+y,b=a-y,T=o+g;if(t[d++]=x,t[d++]=T,t[--p]=T,t[--p]=b,h){var E=o-g;t[m++]=b,t[m++]=E,t[--v]=E,t[--v]=x}for(var _=1;_<c;_++){var S=Math.PI/2*(_/c),C=u+Math.cos(S)*s,w=h+Math.sin(S)*i,A=a+C,M=a-C,P=o+w,I=o-w;t[d++]=A,t[d++]=P,t[--p]=P,t[--p]=M,t[m++]=M,t[m++]=I,t[--v]=I,t[--v]=A}x=a+(y=u),b=a-y,T=o+(g=h+i);var R=o-g;t[d++]=x,t[d++]=T,t[--v]=R,t[--v]=x,u&&(t[d++]=b,t[d++]=T,t[--v]=R,t[--v]=b)}}},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}(_a),Da=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}Vt(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 ka;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)+a]=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}(_a),za=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}Vt(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)<=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 ka),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=null!=e?e:1,s=Math.ceil(Math.sqrt(o*(n+a))),u=8*s+0+0;if(0!==u){if(0===s)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,void(t[5]=t[7]=r-0);var h=0,l=4*s+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<s;g++){var x=Math.PI/2*(g/s),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,S=r+T,C=r-T;t[h++]=E,t[h++]=S,t[--l]=S,t[--l]=_,t[c++]=_,t[c++]=C,t[--f]=C,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var w=r-p;t[h++]=m,t[h++]=y,t[--f]=w,t[--f]=m}}},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}(_a),Ba=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=_e(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"lineTo":this.lineTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"circle":this.circle(n[0],n[1],n[2],n[3]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"triangle":this.triangle(n[0],n[1],n[2],n[3],n[4],n[5],n[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 Ra(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 La(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new za(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new Va(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new ka(t,e,i,r,n),a),this},e.triangle=function(t,e,i,r,n,a,o){return this.drawShape(new Da(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 Ma).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 Ma,this.currentPoly.points.push(0,0))},t}(),Ua=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},Pi(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new Ba(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();exports.UpdateModes=void 0,(Fa=exports.UpdateModes||(exports.UpdateModes={}))[Fa.EveryUpdate=0]="EveryUpdate",Fa[Fa.Manual=1]="Manual",exports.CompositionComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).items=[],e.state=exports.PlayState.Stopped,e.updateMode=0,e.playOnStart=!1,e.endBehavior=Bt.forward,e.time=0,e.lastTime=0,e.sceneBindings=[],e.timelineAsset=null,e._timelineInstance=null,e.nestedCompositions=[],e}Vt(e,t);var i=e.prototype;return i.onStart=function(){this.playOnStart&&this.play()},i.pause=function(){this.state=exports.PlayState.Paused;for(var t,e=_e(this.nestedCompositions);!(t=e()).done;){t.value.pause()}},i.play=function(){this.state=exports.PlayState.Playing;for(var t,e=_e(this.nestedCompositions);!(t=e()).done;){t.value.play()}},i.stop=function(){this.state=exports.PlayState.Stopped,this.time=0,this.lastTime=0;for(var t,e=_e(this.nestedCompositions);!(t=e()).done;){t.value.stop()}},i.getTime=function(){return this.time},i.setTime=function(t){this.time=t},i.onUpdate=function(t){this.state===exports.PlayState.Playing&&0===this.updateMode&&this.tick(t/1e3)},i.tick=function(t){if(this.timelineInstance){var e=this.time;if(xn(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case Bt.forward:break;case Bt.freeze:e=this.item.duration;break;case Bt.restart:e%=this.item.duration;break;case Bt.destroy:return void this.item.dispose()}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},i.onEnable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!0),!1}))},i.onDisable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!1),!1}))},i.onDestroy=function(){this.item.getDescendants().forEach((function(t){return t.dispose()}))},i.setChildrenRenderOrder=function(t){if(!this.timelineInstance)return t;var i=[];this.collectChildren(this.item,i);for(var r,a=new Set,o=_e(this.timelineInstance.masterTrackInstances);!(r=o()).done;){var s=r.value;n(s.boundObject,exports.VFXItem)&&a.add(s.boundObject)}for(var u=[],h=0;h<i.length;h++)a.has(i[h])&&u.push(h);for(var l,c=[],f=_e(this.timelineInstance.masterTrackInstances);!(l=f()).done;){var d=l.value;n(d.boundObject,exports.VFXItem)&&c.push(d.boundObject)}for(var p=0;p<u.length&&p<c.length;p++)i[u[p]]=c[p];for(var m,v=_e(i);!(m=v()).done;){var y=m.value,g=t++;y.isManuallySetRenderOrder||y.setRendererComponentOrder(g);var x=y.getComponent(e);x&&(t=x.setChildrenRenderOrder(t))}return t},i.collectChildren=function(t,e){for(var i,r=_e(t.children);!(i=r()).done;){var n=i.value;e.push(n),exports.VFXItem.isComposition(n)||this.collectChildren(n,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this._timelineInstance=null},Pi(e,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new ih(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var t,i=_e(this._timelineInstance.masterTrackInstances);!(t=i()).done;){var r=t.value.boundObject;if(n(r,exports.VFXItem)&&exports.VFXItem.isComposition(r)){var a=r.getComponent(e);a.updateMode=1,this.nestedCompositions.push(a)}}}return this._timelineInstance}}]),e}(Ii),a([Pe()],exports.CompositionComponent.prototype,"items",void 0),a([Pe()],exports.CompositionComponent.prototype,"sceneBindings",void 0),a([Pe()],exports.CompositionComponent.prototype,"timelineAsset",void 0),exports.CompositionComponent=a([Me("CompositionComponent")],exports.CompositionComponent);var Ga=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}Vt(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("aPos");if(t){var e=Tn(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}(Hr);a([Pe()],Ga.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}Vt(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 C;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}(Ga),exports.EffectComponent=a([Me(pe.EffectComponent)],exports.EffectComponent);var ja=new S(0,0,0),Xa=new S(0,0,0),Wa=function(){this.target=null,this.weight=1};exports.PositionConstraint=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).positionAtRest=new S(0,0,0),e.positionOffset=new S(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}Vt(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){ja.set(0,0,0);for(var e,i=0,r=_e(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var a=n.target.transform.getWorldPosition(),o=n.weight;ja.x+=a.x*o,ja.y+=a.y*o,ja.z+=a.z*o,i+=o}}i>0&&(ja.x/=i,ja.y/=i,ja.z/=i),ja.x+=this.positionOffset.x,ja.y+=this.positionOffset.y,ja.z+=this.positionOffset.z,Xa.set(this.lerp(this.positionAtRest.x,ja.x,this.weight),this.lerp(this.positionAtRest.y,ja.y,this.weight),this.lerp(this.positionAtRest.z,ja.z,this.weight)),ja.copyFrom(this.item.transform.getWorldPosition());var s=this.constrainX?Xa.x:ja.x,u=this.constrainY?Xa.y:ja.y,h=this.constrainZ?Xa.z:ja.z;this.item.transform.setWorldPosition(s,u,h)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new Wa;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=_e(e.targets);!(i=r()).done;){var n=i.value,a=new Wa;a.target=this.engine.findObject(n.target),a.weight=n.weight,this.targets.push(a)}},e}(Ii),exports.PositionConstraint=a([Me("PositionConstraint")],exports.PositionConstraint),exports.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 Vt(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(Ii),a([Pe()],exports.PostProcessVolume.prototype,"bloom",void 0),a([Pe()],exports.PostProcessVolume.prototype,"vignette",void 0),a([Pe()],exports.PostProcessVolume.prototype,"tonemapping",void 0),a([Pe()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=a([Me(pe.PostProcessVolume)],exports.PostProcessVolume);var Ha,Ya;exports.FilterMode=void 0,(Ha=exports.FilterMode||(exports.FilterMode={}))[Ha.Nearest=0]="Nearest",Ha[Ha.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Ya=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Ya.RGBA32=0]="RGBA32",Ya[Ya.RGBAHalf=1]="RGBAHalf";var Za,qa,Ka=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){},Pi(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}();exports.RenderPassAttachmentStorageType=void 0,(Za=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[Za.none=0]="none",Za[Za.color=1]="color",Za[Za.stencil_8_opaque=2]="stencil_8_opaque",Za[Za.depth_16_opaque=3]="depth_16_opaque",Za[Za.depth_stencil_opaque=4]="depth_stencil_opaque",Za[Za.depth_16_texture=5]="depth_16_texture",Za[Za.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(qa=exports.TextureStoreAction||(exports.TextureStoreAction={}))[qa.store=0]="store",qa[qa.clear=2]="clear";var Qa,Ja=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(n(i,pr))this.texture=i,this.externalTexture=!0;else if(i){var a=i.wrapT,o=i.wrapS,s=i.minFilter,u=i.magFilter,h=i.internalFormat,l=i.format,c=void 0===l?Di.RGBA:l,f=i.type,d=void 0===f?Di.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:r,format:c,type:d,internalFormat:h||c,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:e.name},this.texture=pr.create(t,He({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Pi(t,[{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}}]),t}();exports.RenderPassDestroyAttachmentType=void 0,(Qa=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[Qa.force=0]="force",Qa[Qa.keep=1]="keep",Qa[Qa.keepExternal=2]="keepExternal",Qa[Qa.destroy=0]="destroy";var $a,to=1,eo=function(){function t(t){this.priority=0,this.name="RenderPass"+to++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var e=t.prototype;return e.addMesh=function(t){X(this.meshes,t)},e.removeMesh=function(t){p(this.meshes,t)},e.configure=function(t){},e.execute=function(t){},e.onCameraCleanup=function(t){},e.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]},e.dispose=function(t){if(!this.disposed){var e=(null==t?void 0:t.meshes)||void 0;e!==exports.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0,this.disposed=!0}},Pi(t,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),t}(),io=function(t){function e(e){var i;return(i=t.call(this,e)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}Vt(e,t);var i=e.prototype;return i.setup=function(t){this.useRenderTarget=t},i.configure=function(t){this.useRenderTarget&&(this.framebuffer=t.getTemporaryRT("DrawObjectPass",t.getWidth(),t.getHeight(),16,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf),t.setFramebuffer(this.framebuffer))},i.execute=function(t){this.useRenderTarget&&t.clear({colorAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear}),this.meshes.sort((function(t,e){return t.priority-e.priority})),t.renderMeshes(this.meshes)},i.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},e}(eo),ro=(($a={})[Di.FLOAT]=Float32Array.BYTES_PER_ELEMENT,$a[Di.INT]=Int32Array.BYTES_PER_ELEMENT,$a[Di.SHORT]=Int16Array.BYTES_PER_ELEMENT,$a[Di.BYTE]=Int8Array.BYTES_PER_ELEMENT,$a),no=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}Vt(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(Re);function ao(t){return t===Di.INT?new Int32Array(0):t===Di.SHORT?new Int16Array(0):new Float32Array(0)}var oo=1,so=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=void 0===o?"<unnamed>":o,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?wr.fromIdentity():l;r.id="Mesh"+oo++,r.name=s,r.geometry=a,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+oo++,r.name="<unnamed>",r.worldMatrix=wr.fromIdentity(),r._priority=0;return r}Vt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==exports.DestroyOptions.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},Pi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Hr),uo="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);}}",ho="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;}",lo="#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",co="#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;}}",fo="#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;}",po="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",mo="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);}",vo="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);}",yo="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);}",go="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);}",xo="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);}",bo={},To=function(){function t(){}return t.registerInclude=function(t,e){bo[t]&&tt.warn('The "'+t+'" shader include already exist.'),bo[t]=e},t.unRegisterInclude=function(t){delete bo[t]},t.unRegisterAllIncludes=function(){Object.keys(bo).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,a=e.macros,o=e.removeVersion,s=t.genMacroString(i,a),u=t.genShaderVersion(i),h=t.parseIncludes(n),l=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==i||l||(h=t.convertTo300(h,r===exports.ShaderType.fragment)),o?s+h:u+s+h},t.convertTo300=function(e,i){if(e=(e=(e=e.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(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=bo[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.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":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.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)},t}(),Eo=function(t){function e(e,i){var r;void 0===i&&(i=4),(r=t.call(this,e)||this).tempRTs=[],r.iterationCount=i;var n=r.renderer.engine;return r.thresholdMaterial=zr.create(n,{shader:{vertex:po,fragment:xo,glslVersion:exports.GLSLVersion.GLSL1}}),r.thresholdMaterial.blending=!1,r.thresholdMaterial.depthTest=!1,r.thresholdMaterial.culling=!1,r.downSampleHMaterial=zr.create(n,{shader:{vertex:po,fragment:vo,glslVersion:exports.GLSLVersion.GLSL1}}),r.downSampleHMaterial.blending=!1,r.downSampleHMaterial.depthTest=!1,r.downSampleHMaterial.culling=!1,r.downSampleVMaterial=zr.create(n,{shader:{vertex:po,fragment:yo,glslVersion:exports.GLSLVersion.GLSL1}}),r.downSampleVMaterial.blending=!1,r.downSampleVMaterial.depthTest=!1,r.downSampleVMaterial.culling=!1,r.upSampleMaterial=zr.create(n,{shader:{vertex:po,fragment:go,glslVersion:exports.GLSLVersion.GLSL1}}),r.upSampleMaterial.blending=!1,r.upSampleMaterial.depthTest=!1,r.upSampleMaterial.culling=!1,r.priority=5e3,r.name="BloomPass",r}Vt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},i.execute=function(t){var e,i,r,n=t.getWidth(),a=t.getHeight(),o=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.thresholdRT=t.getTemporaryRT("_BloomThreshold",n,a,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",o),t.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var s=this.thresholdRT.getColorTextures()[0],u=0;u<this.iterationCount;u++){var h=Math.floor(n/Math.pow(2,u+1)),l=Math.floor(a/Math.pow(2,u+1)),c=t.getTemporaryRT("_BloomDownH"+u,h,l,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",wo(s)),t.blit(s,c,this.downSampleHMaterial);var f=t.getTemporaryRT("_BloomDownV"+u,h,l,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",wo(c.getColorTextures()[0])),t.blit(c.getColorTextures()[0],f,this.downSampleVMaterial),t.releaseTemporaryRT(c),this.tempRTs.push(f),s=f.getColorTextures()[0]}t.releaseTemporaryRT(this.thresholdRT);for(var d=this.iterationCount-1;d>0;d--){var p=Math.floor(n/Math.pow(2,d-1)),m=Math.floor(a/Math.pow(2,d-1)),v=t.getTemporaryRT("_BloomUp"+d,p,m,0,exports.FilterMode.Linear,exports.RenderTextureFormat.RGBAHalf),y=this.tempRTs[d-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",y),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",wo(y)),t.blit(s,v,this.upSampleMaterial),s=v.getColorTextures()[0],this.tempRTs.push(v)}t.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},i.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},i.dispose=function(e){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),t.prototype.dispose.call(this,e)},e}(eo),_o=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e)||this).renderer.engine;r.sceneTextureHandle=i||new Ja(a);var o=no.create(a,{name:n,mode:Di.TRIANGLE_STRIP,attributes:{aPos:{type:Di.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=zr.create(a,{name:n,shader:{vertex:po,fragment:mo,glslVersion:exports.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=so.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r.name="ToneMappingPass",r}Vt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear});var e=t.renderingData.currentFrame.globalVolume,i=He({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=He({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=He({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),a=He({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new _(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new S(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),t.renderMeshes([this.screenMesh])},e}(eo),So=1,Co=function(){function t(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=void 0===r?[1,1,0,0]:r,a=t.globalVolume,o=t.postProcessingEnabled,s=void 0!==o&&o,u=i.engine;if(a&&(this.globalVolume=a),this.postProcessingEnabled=s,this.globalUniforms=new Mo,this.renderer=i,s&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");this.drawObjectPass=new io(i);var h=[this.drawObjectPass];if(this.setRenderPasses(h),s){var l=new Ja(u),c=new Eo(i,7);c.sceneTextureHandle=l,this.addRenderPass(c);var f=new _o(i,l);this.addRenderPass(f)}this.name="RenderFrame"+So++,this.camera=e,this.editorTransform=C.fromArray(n)}var e=t.prototype;return e.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){var e=(null==t?void 0:t.passes)?t.passes:void 0;e!==exports.DestroyOptions.keep&&this.renderPasses.forEach((function(t){t.dispose(e)})),this.renderPasses.length=0,this.disposed=!0},e.setRenderPasses=function(t){this.renderPasses=t.slice()},e.addRenderPass=function(t){this.renderPasses.push(t)},e.removeRenderPass=function(t){p(this.renderPasses,t)},Pi(t,[{key:"isDisposed",get:function(){return this.disposed}}]),t}();function wo(t){return t?new _(t.getWidth(),t.getHeight()):new _}var Ao,Mo=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Po=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 Pi(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Io=function(){function t(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var e=t.prototype;return e.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))}},e.get=function(t,e,i,r,n,a){void 0===r&&(r=0),void 0===n&&(n=exports.FilterMode.Linear),void 0===a&&(a=exports.RenderTextureFormat.RGBA32);for(var o,s,u,h=e+"_"+i+"_"+r+"_"+n+"_"+a,l=_e(this.temporaryRTs);!(o=l()).done;){var c=o.value;if(!c.isOccupied&&c.descriptionHash===h)return c.isOccupied=!0,c.RT.name=t,c.RT}var f=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?s=Di.LINEAR:n===exports.FilterMode.Nearest&&(s=Di.NEAREST),a===exports.RenderTextureFormat.RGBA32?u=Di.UNSIGNED_BYTE:a===exports.RenderTextureFormat.RGBAHalf&&(u=Di.HALF_FLOAT),0===r?f=exports.RenderPassAttachmentStorageType.none:16===r?f=exports.RenderPassAttachmentStorageType.depth_stencil_opaque:24===r&&(f=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var d=pr.create(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:Di.RGBA,format:Di.RGBA,type:u}),p={RT:Ka.create({name:t,storeAction:{},viewport:[0,0,e,i],attachments:[d],depthStencilAttachment:{storageType:f}},this.engine.renderer),lastFrameReleased:0,descriptionHash:h,isOccupied:!0};return this.temporaryRTs.push(p),p.RT},e.release=function(t){for(var e,i=_e(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},e.dispose=function(){for(var t,e=_e(this.temporaryRTs);!(t=e()).done;){t.value.RT.dispose()}},t}(),Ro="function"==typeof e.WebGL2RenderingContext,Oo=function(){function t(t){this.setupCapability(t)}var i=t.prototype;return i.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},i.setupCapability=function(t){var i,r=Ro&&n(t,e.WebGL2RenderingContext)?2:1,a=2===r,o=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),s=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=a?"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"),s&&(this.UNSIGNED_INT_24_8=s.UNSIGNED_INT_24_8_WEBGL),a&&!u&&(u=No(t,t.HALF_FLOAT)),a&&!h&&(h=No(t,t.FLOAT)),this.internalFormatDepth16=a?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=a?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var l=a||t.getExtension("OES_texture_float")?t.FLOAT:0,c=a?e.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 f,d,p={floatTexture:l,halfFloatTexture:c,maxSample:a?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:a?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:a?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:o?t.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:a||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:a||!!t.getExtension("ANGLE_instanced_arrays"),ktx2Support:(f=this.compressTextureCapabilityList,d=f.get("WEBGL_compressed_texture_astc")||f.get("WEBKIT_WEBGL_compressed_texture_astc"),!!d),drawBuffers:a||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:a||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:a||!!s,writableFragDepth:a||!!t.getExtension("EXT_frag_depth")};this.detail=p,o&&(this.textureMaxAnisotropyExt=o.TEXTURE_MAX_ANISOTROPY_EXT)},i.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw new 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+".")},i.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){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)}else if(e.length>1)throw new Error("Draw buffers not available.")},i.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},Pi(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function No(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}exports.CompressTextureCapabilityType=void 0,(Ao=exports.CompressTextureCapabilityType||(exports.CompressTextureCapabilityType={})).astc="WEBGL_compressed_texture_astc",Ao.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",Ao.etc="WEBGL_compressed_texture_etc",Ao.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",Ao.etc1="WEBGL_compressed_texture_etc1",Ao.pvrtc="WEBGL_compressed_texture_pvrtc",Ao.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",Ao.sRGB="EXT_sRGB";var Lo,Fo=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.viewport(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,i=t,r=i.renderPasses;if(this.disposed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.engine.getShaderLibrary())||e.compileAllShaders(),i.setup(),this.setFramebuffer(null);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),j(r);for(var a,o=_e(r);!(a=o()).done;){var s=a.value;this.renderRenderPass(s)}for(var u,h=_e(r);!(u=h()).done;){u.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=_e(t);!(e=i()).done;){e.value.render(this)}},e.drawGeometry=function(t,e,i,r){void 0===r&&(r=0),this.engine.drawGeometry(t,e,i,r)},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){this.blitGeometry||(this.blitGeometry=no.create(this.engine,{mode:Di.TRIANGLE_STRIP,attributes:{aPos:{type:Di.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4})),this.blitMaterial||(this.blitMaterial=zr.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 r=i||this.blitMaterial;r.setTexture("_MainTex",t);var n=this.currentFramebuffer;if(e){var a=e.viewport,o=a[0],s=a[1],u=a[2],h=a[3];this.setFramebuffer(e),this.setViewport(o,s,u,h)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,wr.IDENTITY,r),this.setFramebuffer(n)},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)},Pi(t,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),t}(),Vo=function(){function t(t){this.engine=t,this.graphicsPath=new Ua,this.vertices=[],this.colors=[],this.indices=[],this.lineStyle={width:1,alignment:.5,cap:ue.Butt,join:he.Miter,miterLimit:10},this.transformStack=[],this.currentTransform=Mr.fromIdentity(),this.geometry=no.create(this.engine,{attributes:{aPos:{type:Di.FLOAT,size:2,data:new Float32Array([-.5,.5,-.5,-.5,.5,.5,.5,-.5])},aColor:{type:Di.FLOAT,size:4,data:new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6}),this.material=zr.create(this.engine,{shader:{vertex:"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 mediump float;\n varying vec4 vColor;\n void main() {\n vec4 color = vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.material.depthTest=!1,this.material.depthMask=!1,this.material.blending=!0}var e=t.prototype;return e.begin=function(){this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.transformStack=[],this.currentTransform=Mr.fromIdentity();var t=this.engine.canvas.getBoundingClientRect(),e=t.width,i=t.height,r=new wr(2/e,0,0,0,0,2/i,0,0,0,0,-1,0,-1,-1,0,1);this.material.setMatrix("effects_MatrixVP",r)},e.pushTransform=function(t){this.transformStack.push(this.currentTransform.clone()),this.currentTransform=this.currentTransform.premultiply(t)},e.popTransform=function(){var t=this.transformStack.pop();t?this.currentTransform=t:console.warn("Render2D: 变换栈为空,无法弹出")},e.end=function(){if(0!==this.currentVertexCount&&0!==this.currentIndexCount){var t=new Float32Array(this.vertices),e=new Float32Array(this.colors),i=new Uint16Array(this.indices);this.geometry.setAttributeData("aPos",t),this.geometry.setAttributeData("aColor",e),this.geometry.setIndexData(i),this.geometry.setDrawCount(this.currentIndexCount),this.engine.renderer.drawGeometry(this.geometry,wr.IDENTITY,this.material)}},e.drawLines=function(t,e,i){if(void 0===e&&(e=w.WHITE),void 0===i&&(i=1),!t||t.length<4||t.length%2!=0)console.warn("drawLines: 至少需要2个点(4个数值), 且数组长度必须为偶数");else{var r=t.length/2,n=t[0]===t[t.length-2]&&t[1]===t[t.length-1],a=n?r-1:r;this.graphicsPath.clear(),this.graphicsPath.moveTo(t[0],t[1]);for(var o=1;o<a;o++)this.graphicsPath.lineTo(t[2*o],t[2*o+1]);this.buildShapeLine(this.graphicsPath.shapePath,e,i,n)}},e.drawLine=function(t,e,i,r,n,a){void 0===n&&(n=w.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.lineTo(i,r),this.buildShapeLine(this.graphicsPath.shapePath,n,a,closed)},e.drawBezier=function(t,e,i,r,n,a,o,s,u,h){void 0===u&&(u=w.WHITE),void 0===h&&(h=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.bezierCurveTo(i,r,n,a,o,s),this.buildShapeLine(this.graphicsPath.shapePath,u,h,!1)},e.drawTriangle=function(t,e,i,r,n,a,o,s){void 0===o&&(o=w.WHITE),void 0===s&&(s=1),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShapeLine(this.graphicsPath.shapePath,o,s,!0)},e.drawRectangle=function(t,e,i,r,n,a){void 0===n&&(n=w.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShapeLine(this.graphicsPath.shapePath,n,a,!0)},e.drawCircle=function(t,e,i,r,n){void 0===r&&(r=w.WHITE),void 0===n&&(n=1),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShapeLine(this.graphicsPath.shapePath,r,n,!0)},e.fillTriangle=function(t,e,i,r,n,a,o){void 0===o&&(o=w.WHITE),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShape(this.graphicsPath.shapePath,o)},e.fillRectangle=function(t,e,i,r,n){void 0===n&&(n=w.WHITE),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShape(this.graphicsPath.shapePath,n)},e.fillCircle=function(t,e,i,r){void 0===r&&(r=w.WHITE),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShape(this.graphicsPath.shapePath,r)},e.dispose=function(){this.geometry.dispose(),this.material.dispose()},e.buildShape=function(t,e){for(var i,r=_e(t.shapePrimitives);!(i=r()).done;){var n=i.value.shape,a=[],o=this.indices.length,s=this.vertices.length/2;n.build(a),n.triangulate(a,this.vertices,s,this.indices,o),this.applyTransformAndColor(s,this.vertices.length/2-s,e)}},e.buildShapeLine=function(t,e,i,r){void 0===r&&(r=!1);for(var n,a=_e(t.shapePrimitives);!(n=a()).done;){var o=n.value.shape,s=[];this.indices.length;var u=this.vertices.length/2;o.build(s),this.lineStyle.width=i,Ea(s,this.lineStyle,!1,r,this.vertices,0,0,this.indices),this.applyTransformAndColor(u,this.vertices.length/2-u,e)}},e.applyTransformAndColor=function(t,e,i){for(var r=0;r<e;r++){var n=2*(t+r),a=4*(t+r);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}},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]},Pi(t,[{key:"currentVertexCount",get:function(){return this.vertices.length/2}},{key:"currentIndexCount",get:function(){return this.indices.length}}]),t}(),ko=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i._color=new w(1,1,1,1),i.getHitTestParams=function(t){var e=wr.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===_t.FRONT,clipMasks:i.frameClipMasks}}},i.renderer={renderMode:It.MESH,blending:Et.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:_t.DOUBLE,mask:0},i.defaultGeometry=no.create(i.engine,{attributes:{aPos:{type:Di.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=zr.create(i.engine,{shader:{fragment:ho,vertex:uo,shared:!0}});return i.material=r,i.material.setColor("_Color",new w(1,1,1,1)),i.configureMaterial(i.renderer),i}Vt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){n(t,w)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return r((function(){var i;return o(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,pr.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!==It.BILLBOARD&&this.renderer.renderMode!==It.VERTICAL_BILLBOARD&&this.renderer.renderMode!==It.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("aPos");if(t){var e=Tn(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.maskManager.maskMode,o=this.material;o.blending=!0,o.depthTest=!0,o.depthMask=i,Wi(o,r),Hi(o,e),o.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',o.setVector4("_TexOffset",new C(0,0,1,1)),o.setTexture("_MainTex",n);var s=Xi(r),u=new C;return u.x=t.occlusion?+t.transparentOcclusion:1,u.y=s,u.z=t.renderMode,u.w=a,o.setVector4("_TexParams",u),0===u.x||this.maskManager.alphaMaskEnabled?o.enableMacro("ALPHA_CLIP"):o.disableMacro("ALPHA_CLIP"),o},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){var i;t.prototype.fromData.call(this,e);var 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:It.MESH,blending:null!=(n=o.blending)?n:Et.ALPHA,texture:o.texture?this.engine.findObject(o.texture):this.engine.whiteTexture,occlusion:!!o.occlusion,transparentOcclusion:!!o.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(a=o.side)?a:_t.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},Pi(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Hr);function Do(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 zo(t){return zo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},zo(t)}function Bo(t){var e="function"==typeof Map?new Map:void 0;return Bo=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new 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,r)}function r(){return ra(t,arguments,zo(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Ft(r,t)},Bo(t)}exports.TexturePaintScaleMode=void 0,function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(exports.TexturePaintScaleMode||(exports.TexturePaintScaleMode={})),exports.ShapeComponent=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new Ua,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:ue.Butt,join:he.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=ue.Butt,i.strokeJoin=he.Miter,i.strokes=[],i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=wr.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===_t.FRONT,clipMasks:i.frameClipMasks}}},i.rendererOptions={renderMode:It.MESH,blending:Et.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:_t.DOUBLE,mask:0};var r={type:ae.Solid,color:new w(1,1,1,1)};i.strokes.push(r);var n={type:ae.Solid,color:new w(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:se.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=no.create(i.engine,{attributes:{aPos:{type:Di.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}Vt(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){if(this.shapeDirty){var e=this.computeScreenScale();this.buildPath(this.shapeAttributes,e),this.buildGeometryFromPath(this.graphicsPath.shapePath,e),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},i.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)}},i.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)},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("aPos");if(t){var e=Tn(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.buildGeometryFromPath=function(t,e){var i=t.shapePrimitives,r=[],n=[];if(this.fills.length>0)for(var a,o=_e(i);!(a=o()).done;){var s=a.value.shape,u=[],h=n.length,l=r.length/2;s.build(u,e),s.triangulate(u,r,l,n,h)}var c=n.length;if(this.strokes.length>0)for(var f,d=_e(i);!(f=d()).done;){var p=f.value.shape,m=[],v=this.strokeAttributes;v.cap=this.strokeCap,v.join=this.strokeJoin,v.width=this.strokeWidth;var y=!0;this.shapeAttributes.type===se.Custom&&(y=p.closePath),p.build(m,e),Ea(m,v,!1,y,r,0,0,n)}var g=n.length-c,x=r.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<n.length)&&(E=new Uint16Array(n.length));for(var _=Number.MAX_VALUE,S=Number.MAX_VALUE,C=Number.MIN_VALUE,w=Number.MIN_VALUE,A=0;A<x;A++){var M=3*A,P=2*A,I=r[P],R=r[P+1];b[M]=I,b[M+1]=R,b[M+2]=0,_=Math.min(_,I),S=Math.min(S,R),C=Math.max(C,I),w=Math.max(w,R)}for(var O=C-_,N=w-S,L=0;L<x;L++){var F=3*L,V=2*L;T[V]=(b[F]-_)/O,T[V+1]=(b[F+1]-S)/N}E.set(n),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(n.length);var k=this.geometry.subMeshes[0],D=this.geometry.subMeshes[1];k.indexCount=c,D.offset=2*c,D.indexCount=g},i.computeScreenScale=function(){var t=this.item.composition;if(!t)return 1;var i=t.camera;if(!i)return 1;var r=i.getModelViewProjection(e.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=Math.max(a,o),u=this.engine.canvas.getBoundingClientRect(),h=s*(Math.max(u.width,u.height)/2)*this.engine.pixelRatio;return Math.max(1,Math.min(2e3,h))},i.buildPath=function(t,e){void 0===e&&(e=1),this.graphicsPath.clear();var i=e;switch(t.type){case se.Custom:for(var r,n=this.shapeAttributes,a=n.points,o=n.easingIns,s=n.easingOuts,u=_e(n.shapes);!(r=u()).done;){var h=r.value,l=h.indexes,c=a[l[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var f=1;f<l.length;f++){var d=l[f],p=l[f-1],m=a[d.point],v=a[p.point],y=s[p.easingOut],g=o[d.easingIn];this.graphicsPath.bezierCurveTo(y.x+v.x,y.y+v.y,g.x+m.x,g.y+m.y,m.x,m.y,void 0,i)}if(h.close){var x=l[0],b=l[l.length-1],T=a[x.point],E=a[b.point],_=s[b.easingOut],S=o[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,S.x+T.x,S.y+T.y,T.x,T.y,void 0,i),this.graphicsPath.closePath()}}break;case se.Ellipse:var C=t;this.graphicsPath.ellipse(0,0,C.xRadius,C.yRadius);break;case se.Rectangle:var w=t;this.graphicsPath.rect(-w.width/2,-w.height/2,w.width,w.height,w.roundness);break;case se.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,exports.StarType.Star);break;case se.Polygon:var M=t;this.graphicsPath.polyStar(M.pointCount,M.radius,M.radius,M.roundness,M.roundness,exports.StarType.Polygon)}},i.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])},i.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===ae.Solid)t.color=e.color;else if(e.type===ae.GradientLinear||e.type===ae.GradientAngular||e.type===ae.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===ae.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new _(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new _(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 Mr).scale(a.scale.x,a.scale.y).rotate(a.rotation).translate(a.offset.x,a.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,a=[],o=[],s=_e(e.stops);!(n=s()).done;){var u=n.value,h=u.color;a.push(new C(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)},i.createMaterialFromRendererOptions=function(t){var e={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:exports.GLSLVersion.GLSL1}},i=zr.create(this.engine,e),r=t,n=r.side,a=r.occlusion,o=r.blending,s=r.texture,u=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=a,Wi(i,o),Hi(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new C(0,0,1,1)),i.setTexture("_ImageTex",s);var h=Xi(o),l=new C;return l.x=r.occlusion?+r.transparentOcclusion:1,l.y=h,l.z=r.renderMode,l.w=u,i.setVector4("_TexParams",l),0===l.x||this.maskManager.alphaMaskEnabled?i.enableMacro("ALPHA_CLIP"):i.disableMacro("ALPHA_CLIP"),i},i.fromData=function(e){var i;t.prototype.fromData.call(this,e),this.shapeDirty=!0,e.mask&&this.maskManager.setMaskOptions(this.engine,e.mask);var r,n,a,o,s,u=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:It.MESH,blending:null!=(r=u.blending)?r:Et.ALPHA,texture:u.texture?this.engine.findObject(u.texture):this.engine.whiteTexture,occlusion:!!u.occlusion,transparentOcclusion:!!u.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(n=u.side)?n:_t.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(a=e.strokeCap)?a:ue.Butt,this.strokeWidth=null!=(o=e.strokeWidth)?o:1,this.strokeJoin=null!=(s=e.strokeJoin)?s:he.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var h,l=_e(e.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=_e(e.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),e.type){case se.Custom:for(var m,v=e,y={type:se.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},g=_e(v.points);!(m=g()).done;){var x=m.value;y.points.push(new _(x.x,x.y))}for(var b,T=_e(v.easingIns);!(b=T()).done;){var E=b.value;y.easingIns.push(new _(E.x,E.y))}for(var S,C=_e(v.easingOuts);!(S=C()).done;){var w=S.value;y.easingOuts.push(new _(w.x,w.y))}y.shapes=v.shapes,this.shapeAttributes=y;break;case se.Ellipse:var A=e,M={type:se.Ellipse,xRadius:A.xRadius,yRadius:A.yRadius};this.shapeAttributes=M;break;case se.Rectangle:var P=e,I={type:se.Rectangle,width:P.width,height:P.height,roundness:P.roundness};this.shapeAttributes=I;break;case se.Star:var R=e,O={type:se.Star,pointCount:R.pointCount,innerRadius:R.innerRadius,outerRadius:R.outerRadius,innerRoundness:R.innerRoundness,outerRoundness:R.outerRoundness};this.shapeAttributes=O;break;case se.Polygon:var N=e,L={type:se.Polygon,pointCount:N.pointCount,radius:N.radius,roundness:N.roundness};this.shapeAttributes=L}},i.createPaint=function(t){var e;switch(t.type){case ae.Solid:e={type:t.type,color:(new w).copyFrom(t.color)};break;case ae.GradientLinear:case ae.GradientAngular:case ae.GradientRadial:e={type:t.type,gradientStops:pa(t.gradientStops),startPoint:(new _).copyFrom(t.startPoint),endPoint:(new _).copyFrom(t.endPoint)};break;case ae.Texture:var i,r,n,a=He({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 _).copyFrom(a.offset),rotation:a.rotation,scale:(new _).copyFrom(a.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},Pi(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Hr),exports.ShapeComponent.tempMVP=wr.fromIdentity(),exports.ShapeComponent=a([Me("ShapeComponent")],exports.ShapeComponent),exports.Fake3DComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}Vt(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},i.onUpdate=function(t){this.updateFake3D()},i.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)}},e}(Ii),a([Pe()],exports.Fake3DComponent.prototype,"loop",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),a([Pe()],exports.Fake3DComponent.prototype,"animationLength",void 0),a([Pe()],exports.Fake3DComponent.prototype,"mode",void 0),a([Pe()],exports.Fake3DComponent.prototype,"startPositionX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"startPositionY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),a([Pe()],exports.Fake3DComponent.prototype,"endPositionX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"endPositionY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),a([Pe()],exports.Fake3DComponent.prototype,"phaseX",void 0),a([Pe()],exports.Fake3DComponent.prototype,"phaseY",void 0),a([Pe()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=a([Me("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(Lo=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[Lo.Circular=0]="Circular",Lo[Lo.Linear=1]="Linear",exports.FrameComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).color=new w(1,1,1,1),e.worldMatrix=new wr,e.getHitTestParams=function(t){var i=wr.fromScale(e.transform.size.x,e.transform.size.y,1).premultiply(e.transform.getWorldMatrix());if(t){e.boundingBoxInfo.setGeometry(e.clipGeometry,i);var r=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:e.frameClipMasks}}},e}Vt(e,t);var i=e.prototype;return i.onAwake=function(){this.clipGeometry=no.create(this.engine,{attributes:{aPos:{type:Di.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Di.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Di.TRIANGLES,drawCount:6});var t=zr.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}});t.depthTest=!0,t.depthMask=!1,t.setColor("_Color",this.color),this.material=t},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),Do(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},i.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},i.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),Do(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.color&&this.color.copyFrom(e.color)},i.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},i.setClipRectangleRecursive=function(t){for(var e,i=_e(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(Hr);n&&d(n.frameClipMasks,this),this.setClipRectangleRecursive(r)}},e}(Hr),exports.FrameComponent=a([Me("FrameComponent")],exports.FrameComponent),exports.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}Vt(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}(Ii),exports.CameraController=a([Me(pe.CameraController)],exports.CameraController);var Uo,Go=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),jo="click",Xo="touchstart",Wo="touchmove",Ho="touchend";exports.PointerEventType=void 0,(Uo=exports.PointerEventType||(exports.PointerEventType={}))[Uo.PointerDown=0]="PointerDown",Uo[Uo.PointerUp=1]="PointerUp",Uo[Uo.PointerMove=2]="PointerMove";var Yo=function(){function t(t,e){void 0===e&&(e=!1),this.engine=t,this.allowPropagation=e,this.enabled=!0,this.skipPointerMovePicking=!0,this.handlers={},this.nativeHandlers={},this.target=null}var i=t.prototype;return i.bindListeners=function(t){var i,r,n,a,o,s=this;this.target=t,o=function(t){return t};var u,h="mousedown",l="mousemove",c="mouseup",f="mouseleave",d=function(t,i,r,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var u=0,h=0,l=e.performance.now();if(!s.target)return tt.warn("Trigger TouchEvent after EventSystem is disposed."),{x:i,y:r,vx:0,vy:h,dx:n,dy:o,ts:l,width:0,height:0,origin:t};var c=s.target,f=c.width,d=c.height;if(a){var p=l-a.ts;u=(n-a.dx)/p||0,h=(o-a.dy)/p||0,a={dx:n,dy:o,ts:l}}return{x:i,y:r,vx:u,vy:h,dx:n,dy:o,ts:l,width:f,height:d,origin:t}};D()&&(o=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},h="touchstart",l="touchmove",c="touchend",f="touchcancel"),this.nativeHandlers=((u={})[h]=function(t){if(s.enabled){var u=o(t),h=Zo(u);i=h.x,r=h.y,a=n={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:i,y:r},s.dispatchEvent(Xo,d(t,i,r))}},u[l]=function(t){if(n&&s.enabled){var e=Zo(o(t));i=e.x,r=e.y,s.dispatchEvent(Wo,d(t,i,r,i-n.x,r-n.y))}},u[c]=function(t){if(n&&s.enabled){!s.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var e=o(t),a=Zo(e),u=Math.abs(n.clientX-e.clientX)+Math.abs(n.clientY-e.clientY);i=a.x,r=a.y,u<4&&s.dispatchEvent(jo,d(t,i,r)),s.dispatchEvent(Ho,d(t,i,r,i-n.x,r-n.y))}n=0},u),this.nativeHandlers[f]=this.nativeHandlers[c],Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=s.target)||e.addEventListener(String(t),s.nativeHandlers[t])})),this.addEventListener(jo,this.onClick.bind(this)),this.addEventListener(Xo,this.onPointerDown.bind(this)),this.addEventListener(Ho,this.onPointerUp.bind(this)),this.addEventListener(Wo,this.onPointerMove.bind(this))},i.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},i.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),d(i,e),function(){p(i,e)}},i.removeEventListener=function(t,e){var i=this.handlers[t];i&&p(i,e)},i.onClick=function(t){for(var e,i=t.x,r=t.y,n=[],a=_e(this.engine.compositions);!(e=a()).done;){var o,s=e.value;(o=n).push.apply(o,[].concat(s.hitTest(i,r)))}for(var u,h=_e(n);!(u=h()).done;){var l=u.value,c=l.item.composition;if(c){var f=He({},l,{compositionId:c.id,compositionName:c.name});l.item.emit("click",l),c.emit("click",f),this.engine.emit("click",f)}}},i.onPointerDown=function(t){this.handlePointerEvent(t,0)},i.onPointerUp=function(t){this.handlePointerEvent(t,1)},i.onPointerMove=function(t){this.handlePointerEvent(t,2)},i.handlePointerEvent=function(t,e){var i=null,r=t.x,n=t.y,a=t.width,o=t.height;if(2!==e||!this.skipPointerMovePicking)for(var s,u=_e(this.engine.compositions);!(s=u()).done;){var h=s.value.hitTest(r,n);h.length>0&&(i=h[h.length-1])}var l=new Gr;l.position.x=(r+1)/2*a,l.position.y=(n+1)/2*o,l.delta.x=t.vx*a,l.delta.y=t.vy*o;var c=l.pointerCurrentRaycast;i&&(c.point=i.position,c.item=i.item);var f="pointerdown";switch(e){case 0:f="pointerdown";break;case 1:f="pointerup";break;case 2:f="pointermove"}if(i){var d=i.item,p=d.composition;d.emit(f,l),p.emit(f,l),this.engine.emit(f,l)}},i.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={})},t}();function Zo(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var qo=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),Ko=1,Qo=function(){function t(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 e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new S,n=new Ke,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)},e.createMaterial=function(){var t=[["ENV_EDITOR",this.engine.env===qr]],e=pa(this.color).getValue(0),i={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n}\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:exports.GLSLVersion.GLSL1,macros:t}},r=zr.create(this.engine,i);return r.blending=!0,r.depthTest=!1,r.setVector4("uPos",new C(0,0,0,0)),r.setVector2("uSize",new _(1,1)),r.setVector4("uColor",new C(e[0]/255,e[1]/255,e[2]/255,e[3])),r.setQuaternion("uQuat",new Ke(0,0,0,0)),r},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return no.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:Di.LINES,maxVertex:4})},e.createMesh=function(t,e){return so.create(this.engine,{name:"Interact_preview"+Ko++,priority:0,worldMatrix:wr.fromIdentity(),geometry:t,material:e})},t}();function Jo(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i,clipMasks:e.frameClipMasks}:void 0}},e}Vt(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===At.CLICK&&(this.clickable=!0,r&&t===qr&&(this.previewContent=new Qo(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},i.onDisable=function(){t.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())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.env;if(e===At.CLICK)this.clickable=!0;else if(e===At.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==qr||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},i.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,Jo(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.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=s*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=a[0]-this.dragRatio[0]*f,y=a[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=E(v,g,x),y=E(y,b,T),v!==g&&v!==x&&g!==x)null==(i=e.origin)||i.preventDefault();if(y!==b&&y!==T&&b!==T)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new S(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,a={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){r.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!Jo(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=He({},n)),n=null}}};Object.keys(a).forEach((function(t){i.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(a).forEach((function(t){i.removeEventListener(t,a[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=gn(S.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===At.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,a=0;if("number"==typeof e)i=e,r=e,n=e,a=e;else if(rt(e)){var o,s,u,h,l;i=void 0===(s=(o=e)[0])?0:s,r=void 0===(u=o[1])?0:u,n=void 0===(h=o[2])?0:h,a=void 0===(l=o[3])?0:l}if(t.x<a-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},Pi(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Hr),exports.InteractComponent=a([Me(pe.InteractComponent)],exports.InteractComponent);var $o,ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return Vt(e,t),e}(Bo(Lt)),es=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(){if(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}(),is=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}(),rs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Re);exports.PlayState=void 0,($o=exports.PlayState||(exports.PlayState={}))[$o.Playing=0]="Playing",$o[$o.Paused=1]="Paused",$o[$o.Stopped=2]="Stopped";var ns=[1,1,1,1],as=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}Vt(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(n(e,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var a=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");a&&(this.startColor=a.toArray())}var o,s,u,h=dn(ns,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,f=this.colorOverLifetime;if(f&&(h=M(f,l,!0),o=!0),c&&(h[3]*=c.getValue(l),o=!0),o)pn(this.renderColor,h,this.startColor),null==(u=this.activeMaterial)||null==(s=u.getColor("_Color"))||s.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=pa(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===Dt.GRADIENT_COLOR&&(this.colorOverLifetime=P(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(ko)},e}(es),os=function(){function t(){}return t.prototype.onEvent=function(t,e){},t}(),ss=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.onEvent=function(t,e){t.emit("animationevent",e)},e}(Bo(os));exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e.events=[],e}Vt(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=E(e,0,this.duration),n=_e(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=_e(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=_e(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=_e(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),_=this.findTarget(t,b.path);null==_||_.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=_e(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:pa(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var o,s=_e(t.rotationCurves);!(o=s()).done;){var u=o.value,h={path:u.path,keyFrames:pa(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=_e(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:pa(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=_e(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:pa(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=_e(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:pa(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=_e(t.colorCurves);!(E=_()).done;){var S=E.value,C={path:S.path,keyFrames:pa(S.keyFrames),property:S.property,className:S.className};e=Math.max(e,C.keyFrames.getMaxTime()),this.colorCurves.push(C)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var w,A=_e(t.events);!(w=A()).done;){var M,P=w.value,I={name:P.name,startTime:P.startTime,duration:null!=(M=P.duration)?M:0,event:new ss};this.events.push(I)}},i.findTarget=function(t,e){for(var i,r=t,n=_e(e.split("."));!(i=n()).done;){for(var a,o=i.value,s=!1,u=_e(r.children);!(a=u()).done;){var h=a.value;if(h.name===o){r=h,s=!0;break}}if(!s)return}return r},e}(Re),exports.AnimationClip=a([Me(pe.AnimationClip)],exports.AnimationClip);var us=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}Vt(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=_e(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(n(t,es)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}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}(es),hs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(n(e,exports.VFXItem)){for(var i=e,r=!1,a=0;a<this.clipPlayables.length;a++)if(this.getClipWeight(a)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(us),ls=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();n(e,exports.VFXItem)&&(e.time=this.time)},e}(es),cs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(es),fs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}Vt(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 a=this.getClipWeight(r);if(a>0){var o=this.getClipPlayable(r);if(!n(o,cs)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=o.value;this.addWeightedValue(s,a),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,n(e,Ii)&&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}(us),ds=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),ps=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(fs),ms=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){},e}(us),vs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){},e}(us),ys=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();n(e,exports.CompositionComponent)&&e.tick(this.getTime()-e.getTime())},e}(es),gs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(n(e,exports.CompositionComponent)){for(var i=e,r=!1,a=0;a<this.clipPlayables.length;a++)if(this.getClipWeight(a)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(us),xs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.evaluate=function(t){},e}(us),bs=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),Ts=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),Es=function(t){function e(){return t.apply(this,arguments)}Vt(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}(fs),_s=new Ar,Ss=new S(1,1,1),Cs=new S,ws=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new S(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=pa(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&pa(r.linearX),y:r.linearY&&pa(r.linearY),z:r.linearZ&&pa(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&pa(r.orbitalX),y:r.orbitalY&&pa(r.orbitalY),z:r.orbitalZ&&pa(r.orbitalZ),center:fn(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&pa(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=pa(a.x||1),this.sizeYOverLifetime=pa(a.y||1),this.sizeZOverLifetime=pa(a.z||1)):this.sizeXOverLifetime=pa(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:pa(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=pa(n.x||0),u.y=pa(n.y||0)}this.gravity=S.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=pa(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?S.fromArray(r.direction).normalize():new S,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();n(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=this.getDuration(),r=this.time/i;if(r=r<0?0:r,this.sizeXOverLifetime){Ss.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Ss.y=this.sizeYOverLifetime.getValue(r),Ss.z=this.sizeZOverLifetime.getValue(r)):Ss.z=Ss.y=Ss.x;var n=this.originalTransform.scale;e.transform.setScale(Ss.x*n.x,Ss.y*n.y,Ss.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;_s.x=s?a(this.rotationOverLifetime.x):0,_s.y=s?a(this.rotationOverLifetime.y):0,_s.z=o;var u=_s.addEulers(this.originalTransform.rotation,_s);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Cs;cn(h,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(h.x,h.y,h.z)}},e}(es);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new ws;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(rs),exports.TransformPlayableAsset=a([Me(pe.TransformPlayableAsset)],exports.TransformPlayableAsset);var As,Ms=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===Bt.restart?e%=i:this.endBehavior===Bt.freeze&&(e=Math.min(i,e))),e},t}();exports.TrackAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}Vt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new us},i.createOutput=function(){return new is},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=_e(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=_e(t);!(i=n()).done;){var a=i.value,o=this.createClipPlayable(a);o.setDuration(a.duration);var s=new Ps(a,o,r);e.push(s),r.clipPlayables.push(o),r.setClipWeight(o,0)}return r},i.createPlayable=function(){return new es},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 Ms;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=_e(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=_e(this.children);!(i=r()).done;){i.value.parent=this}},e}(rs),a([Pe(Ms)],exports.TrackAsset.prototype,"clips",void 0),a([Pe()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=a([Me(pe.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(As=exports.TrackType||(exports.TrackType={}))[As.MasterTrack=0]="MasterTrack",As[As.ObjectTrack=1]="ObjectTrack";var Ps=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1;t>=e.start+e.duration&&e.endBehavior===Bt.destroy?(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==exports.PlayState.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var a=e.toLocalTime(t);this.playable.setTime(a),r&&this.playable.getPlayState()===exports.PlayState.Playing&&this.playable.pause()},Pi(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}();exports.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new hs},e}(exports.TrackAsset),exports.ActivationTrack=a([Me(pe.ActivationTrack)],exports.ActivationTrack);var Is=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return Vt(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(exports.TrackAsset);a([Pe()],Is.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new ps;return t.propertyPath=this.path,t},e}(Is),exports.FloatPropertyTrack=a([Me(pe.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new vs},e}(exports.TrackAsset),exports.SpriteColorTrack=a([Me(pe.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!n(t,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(exports.CompositionComponent)},i.createTrackMixer=function(){return new gs},e}(exports.TrackAsset),exports.SubCompositionTrack=a([Me(pe.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new xs},e}(exports.TrackAsset),exports.TransformTrack=a([Me(pe.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.updateAnimatedObject=function(t){if(!n(t,Hr))throw new Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw new Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(exports.TrackAsset),a([Pe()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=a([Me("MaterialTrack")],exports.MaterialTrack);var Rs=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new ms},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new bs;return t.propertyPath=this.path,t},e}(Is),exports.Vector4PropertyTrack=a([Me(pe.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector3PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new Ts;return t.propertyPath=this.path,t},e}(Is),exports.Vector3PropertyTrack=a([Me(pe.Vector3PropertyTrack)],exports.Vector3PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new Es;return t.propertyPath=this.path,t},e}(Is),exports.Vector2PropertyTrack=a([Me(pe.Vector2PropertyTrack)],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){var t=new ds;return t.propertyPath=this.path,t},e}(Is),exports.ColorPropertyTrack=a([Me(pe.ColorPropertyTrack)],exports.ColorPropertyTrack);var Os=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=Ns(this.arc,this.arcMode,t)*y,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new S(i,r,0),a=Math.tan(this.angle*y),o=n.clone().multiply(a);return o.z+=1,{position:n.multiply(ht(0,1)),direction:o.normalize()}},t}();function Ns(t,e,i){if(e===Gt.RANDOM)t=ht(0,t);else if(e===Gt.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===Gt.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===Gt.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var Ls,Fs=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=Ns(this.arc,this.arcMode,t)*y,i=new S(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),Vs=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=ht(-this._d,this._d),i=ht(-this._h,this._h);return{direction:new S(0,0,1),position:new S(e,i,0)}},t}(),ks=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=Ns(this.arc,this.arcMode,t)*y,i=new S(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new S;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}(),Ds=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Gt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):ht(0,1);return{direction:new S(0,1,0),position:new S(this._d*(e-.5),0,0)}},t}(),zs=new wr,Bs=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=ht(0,2*Math.PI),n=Ns(this.arc,this.arcMode,t)*y,a=zs.setFromRotationZ(n),o=new S(Math.cos(r),Math.sin(r),0),s=new S(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),Us=new wr,Gs=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 ht(-90,90)},e.generate=function(t){var e=Ns(this.arc,this.arcMode,t)*y,i=this.getHorizontalAngle()*y,r=this.radius,n=new S(Math.cos(i),0,Math.sin(i)),a=Us.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),js=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.getHorizontalAngle=function(){return ht(0,90)},e}(Gs),Xs=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=E(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(Ns(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,a=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,o=new S(n,a,0);return{position:new S(n*this.width,a*this.height,0),direction:o.normalize()}},t}(),Ws=function(){function t(){}return t.prototype.generate=function(){return{position:new S,direction:new S}},t}(),Hs=((Ls={})[Ct.NONE]=Ws,Ls[Ct.CONE]=Os,Ls[Ct.SPHERE]=Gs,Ls[Ct.HEMISPHERE]=js,Ls[Ct.CIRCLE]=Fs,Ls[Ct.DONUT]=Bs,Ls[Ct.RECTANGLE]=Vs,Ls[Ct.EDGE]=Ds,Ls[Ct.RECTANGLE_EDGE]=ks,Ls[Ct.TEXTURE]=Xs,Ls);function Ys(t){if(!t)return new Ws;var e=He({radius:1,arc:360,angle:0,arcMode:Gt.RANDOM},t),i=t.type,r=Hs[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==Ct.NONE){var a=t.alignSpeedDirection,o=t.upDirection,s=void 0===o?[0,0,1]:o;n.alignSpeedDirection=a,n.upDirection=S.fromArray(s).normalize()}return n}function Zs(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=fu(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=fu(a,t[a],t[a+1],o);return o&&ou(o,o.next)&&(du(o),o=o.next),o}function qs(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!ou(r,r.next)&&0!==au(r.prev,r,r.next))r=r.next;else{if(du(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Ks(t){var e=t.prev,i=t,r=t.next;if(au(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(ru(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&au(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Qs(t,e,i,r){var n=t.prev,a=t,o=t.next;if(au(n,a,o)>=0)return!1;for(var s=n.x<a.x?n.x<o.x?n.x:o.x:a.x<o.x?a.x:o.x,u=n.y<a.y?n.y<o.y?n.y:o.y:a.y<o.y?a.y:o.y,h=n.x>a.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,l=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,c=eu(s,u,e,i,r),f=eu(h,l,e,i,r),d=t.prevZ,p=t.nextZ;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&au(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&au(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,d.x,d.y)&&au(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&ru(n.x,n.y,a.x,a.y,o.x,o.y,p.x,p.y)&&au(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Js(t,e){return t.x-e.x}function $s(t,e){if(e=function(t,e){var i,r=e,n=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o){if(o=s,s===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===o)return i;var u,h=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&ru(a<c?n:o,a,l,c,a<c?o:n,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(n-r.x),lu(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&tu(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=cu(e,t);qs(e,e.next),qs(i,i.next)}}function tu(t,e){return au(t.prev,t,e.prev)<0&&au(e.next,t,t.next)<0}function eu(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function iu(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}function ru(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 nu(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&su(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(lu(t,e)&&lu(e,t)&&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}(t,e)&&(au(t.prev,t,e.prev)||au(t,e.prev,e))||ou(t,e)&&au(t.prev,t,t.next)>0&&au(e.prev,e,e.next)>0)}function au(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ou(t,e){return t.x===e.x&&t.y===e.y}function su(t,e,i,r){var n=hu(au(t,e,i)),a=hu(au(t,e,r)),o=hu(au(i,r,t)),s=hu(au(i,r,e));return n!==a&&o!==s||(!(0!==n||!uu(t,i,e))||(!(0!==a||!uu(t,r,e))||(!(0!==o||!uu(i,t,r))||!(0!==s||!uu(i,e,r)))))}function uu(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 hu(t){return t>0?1:t<0?-1:0}function lu(t,e){return au(t.prev,t,t.next)<0?au(t,e,t.next)>=0&&au(t,t.prev,e)>=0:au(t,e,t.prev)<0||au(t,t.next,e)<0}function cu(t,e){var i=new pu(t.i,t.x,t.y),r=new pu(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 fu(t,e,i,r){var n=new pu(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 du(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 pu(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 mu=0;function vu(t,e,i,r){i=i||2,mu=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=Zs(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=[];for(n=0,a=e.length;n<a;n++)(o=Zs(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(iu(o));for(s.sort(Js),n=0;n<s.length;n++)$s(s[n],i),i=qs(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])<n&&(n=u),(h=t[m+1])<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return yu(d,p,i,n,a,l),p}function yu(t,e,i,r,n,a,o){if(t){!o&&a&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=eu(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)}(t,r,n,a);for(var s,u,h=t;t.prev!==t.next;)if(s=t.prev,u=t.next,a?Qs(t,r,n,a):Ks(t))e.push(s.i/i+mu),e.push(t.i/i+mu),e.push(u.i/i+mu),du(t),t=u.next,h=u.next;else if((t=u)===h){o?1===o?yu(t=gu(qs(t),e,i),e,i,r,n,a,2):2===o&&xu(t,e,i,r,n,a):yu(qs(t),e,i,r,n,a,1);break}}}function gu(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ou(n,a)&&su(n,r,r.next,a)&&lu(n,a)&&lu(a,n)&&(e.push(n.i/i+mu),e.push(r.i/i+mu),e.push(a.i/i+mu),du(r),du(r.next),r=t=a),r=r.next}while(r!==t);return qs(r)}function xu(t,e,i,r,n,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&nu(o,s)){var u=cu(o,s);return o=qs(o,o.next),u=qs(u,u.next),yu(o,e,i,r,n,a),void yu(u,e,i,r,n,a)}s=s.next}o=o.next}while(o!==t)}var bu=2;function Tu(t,e){for(var i=t.s,r=t.p,n=i[1],a=r[1],o=0,s=0;s<n.length;s++){o+=n[s].length-1}var u,h=new Float32Array(o*Zr),l=e.indexBase,c=void 0===l?0:l,f=e.uvTransform,d=0,p=0,m=0,v=1,y=1;f&&(p=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);for(var g=[0,0],x=0===u?0:-Math.PI/2,b=0;b<n.length;b++)for(var T=n[b],E=a[b],_=a[b+1]||a[0],S=T,C=[0,0],w=0;w<S.length-1;w++){Su(C,S[w],E,_,E[4],E[5],_[2],_[3]),M(C[0],C[1])}var A=vu(Array.from(h),null,Zr,c);return{aPoint:h,index:new Uint16Array(A)};function M(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,_u(g,g,x),h[d++]=p+(g[0]+1)/2*v,h[d++]=m+(g[1]+1)/2*y):(h[d++]=(t+1)/2,h[d++]=(e+1)/2),d+=bu}}function Eu(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[Dt.SHAPE_POINTS,t.p],s:[Dt.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[Dt.SHAPE_POINTS,t.g.p],s:[Dt.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,a=0,o=0,s=0;s<r.length;s++){var u=Tu(r[s],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),a+=u.aPoint.length,o+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(a),l=new Uint16Array(o),c=0,f=0,d=0;c<i[c];c++){var p=i[c];h.set(p.aPoint,f),f+=p.aPoint.length,l.set(p.index,d),d+=p.index.length}return{aPoint:h,index:l}}function _u(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}function Su(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;return t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1],t}var Cu=function(){function t(t){var e=t.time,i=t.interval,r=t.count,a=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=n(r,Bn)?r:pa(r),this.cycles=+a||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),wu=function(t){this.content=t},Au=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new wu(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))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 wu(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))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}(),Mu="lookup_texture",Pu="offscreen_canvas",Iu={};function Ru(t){return Iu[t]}var Ou=new S,Nu=new S,Lu=function(){function t(t,e){this.pointStart=[];var i=e.colorOverLifetime,r=e.colorOverTrail,a=e.maxTrailCount,o=e.opacityOverLifetime,s=void 0===o?pa(1):o,u=e.widthOverTrail,h=e.name,l=e.occlusion,c=e.blending,f=e.texture,d=e.transparentOcclusion,p=e.minimumVertexDistance,m=e.lifetime,v=e.matrix,y=t.gpuCapability,g=y.detail,x=y.level,b=Math.max(e.pointCountPerTrail,2),T={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},E=g.maxVertexTextures>0,S=(null!=t?t:{}).env,w={},A=[["ENABLE_VERTEX_TEXTURE",E],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",S===qr]],M=a>64,P=0;i&&(A.push(["COLOR_OVER_LIFETIME",!0]),P|=1,w.uColorOverLifetime=pr.createWithData(t,G(i))),r&&(A.push(["COLOR_OVER_TRAIL",!0]),P|=4,w.uColorOverTrail=pr.createWithData(t,G(r))),M?(A.push(["ATTR_TRAIL_START",1]),P|=8):w.uTrailStart=new Float32Array(a),w.uOpacityOverLifetimeValue=s.toUniform(T);var I=u.toUniform(T);A.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),w.uVCurveValues=Bn.getAllData(T);var R={shader:{vertex:fo,fragment:lo,macros:A,glslVersion:1===x?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+P+"+"+T.index+"+"+T.max}},O=b*a*2,N=(b-1)*a,L=Float32Array.BYTES_PER_ELEMENT,F=12*L,V={attributes:{aColor:{size:4,stride:F,data:new Float32Array(12*O)},aSeed:{size:1,stride:F,offset:4*L,dataSource:"aColor"},aInfo:{size:3,stride:F,offset:5*L,dataSource:"aColor"},aPos:{size:4,stride:F,offset:8*L,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(O)},aDir:{size:3,data:new Float32Array(3*O)}},indices:{data:new Uint16Array(6*O)},drawCount:6*N,name:"trail#"+h,bufferUsage:Di.DYNAMIC_DRAW};if(M)V.attributes.aTrailStart={size:1,data:new Float32Array(O)};else{var k=new Float32Array(O);V.attributes.aTrailStartIndex={size:1,data:k};for(var D=0;D<a;D++)for(var z=2*b,B=D*z,U=0;U<z;U++)k[B+U]=D}var j=Xi(c),X=zr.create(t,R);X.blending=!0,X.depthMask=l,X.depthTest=!0,Wi(X,c);var W=this.mesh=so.create(t,{name:"MTrail_"+h,material:X,geometry:no.create(t,V)}),H=null!=f?f:pr.createWithData(t);Object.keys(w).map((function(t){var e=w[t];if(n(e,pr))X.setTexture(t,e);else if("uTrailStart"===t)X.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var a=new C(e[r],e[r+1],e[r+2],e[r+3]);i.push(a)}X.setVector4Array(t,i)}else X.setVector4(t,C.fromArray(e))})),X.setFloat("uTime",0),X.setVector4("uWidthOverTrail",C.fromArray(I)),X.setVector2("uTexOffset",new _(0,0)),X.setVector4("uTextureMap",new C(0,0,1,1)),X.setVector4("uParams",new C(0,b-1,0,0)),X.setTexture("uMaskTex",H),X.setVector4("uColorParams",new C(f?1:0,+j,0,+(l&&!d))),this.maxTrailCount=a,this.pointCountPerTrail=b,this.checkVertexDistance=p>0,this.minimumVertexDistance=Math.pow(p||.001,2),this.useAttributeTrailStart=M,this.lifetime=m,v&&(this.mesh.worldMatrix=v),this.geometry=W.firstGeometry(),this.trailCursors=new Uint16Array(a)}var e=t.prototype;return e.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,Ou);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=Du(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=6*c,y=new Float32Array(6);y.set(f,0),y.set(f,3),a.setAttributeSubData("aDir",v,y),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var g=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,a.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,Nu),E=new Float32Array(Du(T,l,e)),_=6*(t*n+u);a.setAttributeSubData("aDir",_,E),a.setAttributeSubData("aDir",_+3,E);var S=t*n*2,C=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),w=6*(t*o+(r-1)%o);a.setIndexSubData(w,C)}r=++this.trailCursors[t];var A=this.mesh.material,M=A.getVector4("uParams"),P=p[2];if(this.useAttributeTrailStart){for(var I=2*n,R=new Float32Array(I),O=0;O<I;O++)R[O]=P;a.setAttributeSubData("aTrailStart",t*R.length,R)}else{var N=A.getFloats("uTrailStart");null!=N&&(N[t]=P,A.setFloats("uTrailStart",N))}M&&(M.y=Math.max(M.y,r-1)-Math.max(0,r-n),A.setVector4("uParams",M))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,a=this.geometry.getAttributeData("aColor");return Y(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();Y(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");Y(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();Y(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},Pi(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),Fu=new S,Vu=new S,ku=new S;function Du(t,e,i){var r=Fu;return t||i?(t?i?(Vu.subtractVectors(e,t).normalize(),Vu.subtractVectors(i,e),ku.copyFrom(Vu).normalize(),r.addVectors(Vu,ku)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var zu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).particleSystem=null,e}Vt(e,t);var i=e.prototype;return i.getParticleSystem=function(t){if(this.particleSystem)return this.particleSystem;var e=t.output.getUserData();return n(e,exports.VFXItem)?(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem):null},i.processFrame=function(t){var e=this.getParticleSystem(t);if(e){this.time>=0&&this.time<e.time&&e.reset();for(;e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},e}(es),Bu=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new zu},e}(rs),Uu={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"},Gu=function(){function t(t,e){this.particleCount=0,this.cachedRotationVector3=new S,this.cachedRotationMatrix=new Mr,this.cachedLinearMove=new S,this.tempMatrix3=new Mr,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,r,a=(null!=t?t:{}).env,o=e.speedOverLifetime,s=e.colorOverLifetime,u=e.linearVelOverLifetime,h=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,c=e.rotationOverLifetime,f=e.sprite,d=e.gravityModifier,p=e.maxCount,m=e.textureFlip,v=e.useSprite,y=e.name,g=e.gravity,x=e.forceTarget,b=e.side,T=e.occlusion,E=e.anchor,w=e.blending,A=e.transparentOcclusion,M=e.renderMode,P=void 0===M?0:M,I=e.diffuse,R=void 0===I?pr.createWithData(t):I,O=t.gpuCapability.detail,N=O.halfFloatTexture,L=O.maxVertexUniforms,F=[["RENDER_MODE",+P],["ENV_EDITOR",a===qr]],V=t.gpuCapability.level,k={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},D={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},z=L>0,B={},U=0,j=0;(this.useSprite=v,z&&F.push(["ENABLE_VERTEX_TEXTURE",!0]),o&&(F.push(["SPEED_OVER_LIFETIME",!0]),j|=2,B.uSpeedLifetimeValue=o.toUniform(k)),(null==f?void 0:f.animate)&&(F.push(["USE_SPRITE",!0]),j|=4,B.uFSprite=B.uSprite=new Float32Array([f.col,f.row,f.total,f.blend?1:0]),this.useSprite=!0),(null==s?void 0:s.color)&&(F.push(["COLOR_OVER_LIFETIME",!0]),j|=16,B.uColorOverLifetime=n(s.color,pr)?s.color:pr.createWithData(t,G(s.color))),(null==s?void 0:s.opacity)?B.uOpacityOverLifetimeValue=s.opacity.toUniform(k):B.uOpacityOverLifetimeValue=pa(1).toUniform(k),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==u?void 0:u[t])&&(B["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=u[t].toUniform(k),r=1,j|=1<<7+e,u.enabled=!0),F.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==h?void 0:h[t])&&(B["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(k),n=1,j|=1<<10+e,i=!0,h.enabled=!0),F.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==u?void 0:u.asMovement)&&(F.push(["AS_LINEAR_MOVEMENT",!0]),j|=32),i&&((null==h?void 0:h.asRotation)&&(F.push(["AS_ORBITAL_MOVEMENT",!0]),j|=64),B.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),B.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(k),null==l?void 0:l.separateAxes)&&(F.push(["SIZE_Y_BY_LIFE",1]),j|=16384,B.uSizeYByLifetimeValue=null==l||null==(r=l.y)?void 0:r.toUniform(k));if((null==c?void 0:c.z)&&(B.uRZByLifeTimeValue=c.z.toUniform(k),j|=32768,F.push(["ROT_Z_LIFETIME",1])),(null==c?void 0:c.x)&&(B.uRXByLifeTimeValue=c.x.toUniform(k),j|=65536,F.push(["ROT_X_LIFETIME",1])),(null==c?void 0:c.y)&&(B.uRYByLifeTimeValue=c.y.toUniform(k),j|=1<<17,F.push(["ROT_Y_LIFETIME",1])),(null==c?void 0:c.asRotation)&&(F.push(["ROT_LIFETIME_AS_MOVEMENT",1]),j|=1<<18),B.uGravityModifierValue=d.toUniform(k),x&&(F.push(["FINAL_TARGET",!0]),j|=1<<19,B.uFinalTarget=new Float32Array(x.target||[0,0,0]),B.uForceCurve=x.curve.toUniform(k)),N&&D.max?(j|=1<<20,B.uFCurveValueTexture=mr(t,Bn.getAllData(D,!0),D.index,1)):B.uFCurveValues=Bn.getAllData(D),k.max+k.curves.length-32>L&&N&&z){var X=mr(t,Bn.getAllData(k,!0),k.index,1);B.uVCurveValueTexture=X,U=1}else B.uVCurveValues=Bn.getAllData(k);var W=["-p:",P,j,k.index,k.max,D.index,D.max].join("+");F.push(["VERT_CURVE_VALUE_COUNT",k.index],["FRAG_CURVE_VALUE_COUNT",D.index],["VERT_MAX_KEY_FRAME_COUNT",k.max],["FRAG_MAX_KEY_FRAME_COUNT",D.max]),this.VERT_MAX_KEY_FRAME_COUNT=k.max;var H={shader:{fragment:lo,vertex:"#define LOOKUP_TEXTURE_CURVE "+U+"\n"+co,glslVersion:1===V?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:W,macros:F,name:"particle#"+y}},Y=Xi(w);B.uTexOffset=new Float32Array(R?[1/R.getWidth(),1/R.getHeight()]:[0,0]),B.uMaskTex=R,B.uColorParams=new Float32Array([R?1:0,+Y,0,+(!!T&&!A)]),B.uParams=[0,0,0,0],B.uAcceleration=[(null==g?void 0:g[0])||0,(null==g?void 0:g[1])||0,(null==g?void 0:g[2])||0,0];var Z=zr.create(t,H);Z.blending=!0,Z.depthTest=!0,Z.depthMask=!!T,Wi(Z,w),Hi(Z,b),Object.keys(B).map((function(t){var e=B[t];if(n(e,pr))Z.setTexture(t,e);else{var i=[];switch(Uu[t]){case"vec4":Z.setVector4(t,C.fromArray(e));break;case"vec3":Z.setVector3(t,S.fromArray(e));break;case"vec2":Z.setVector2(t,_.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var a=new C(e[r],e[r+1],e[r+2],e[r+3]);i.push(a)}Z.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),Z.setVector3("emissionColor",new S(0,0,0)),Z.setFloat("emissionIntensity",0);var q=no.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,a={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(a.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:a,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*p,this.useSprite,"particle#"+y)),K=so.create(t,{name:"MParticle_"+y,material:Z,geometry:q});this.anchor=E,this.mesh=K,this.geometry=K.firstGeometry(),this.forceTarget=x,this.sizeOverLifetime=l,this.speedOverLifetime=o,this.linearVelOverLifetime=u,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=d,this.rotationOverLifetime=c,this.maxCount=p,this.textureOffsets=m?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return Y(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,a=this.geometry,o=r>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(u.aSprite=new Float32Array(12));var l=new S,c=new Ke,f=new S(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=rn.getRotation(c,new Ar),v=l.toArray(),y=p.toArray(),g=this.textureOffsets,x=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,E=e.color,_=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random();h&&(d=e.sprite);for(var w=0;w<4;w++){var A=2*w,M=3*w,P=4*w,I=12*w,R=8*w;u.aPos.set(v,I),T.fill(u.aPos,I+3),u.aRot.set(y,R),u.aRot[R+3]=C,u.aRot.set(E,R+4),h&&u.aSprite.set(d,M);var O=e.uv||b;if(O){var N=h?1-g[A+1]:g[A+1];x[0]=O[0]+g[A]*O[2],x[1]=O[1]+N*O[3]}u.aOffset.set(x,P);for(var L=w+w,F=(_[L]-this.anchor.x)*f.x,V=(_[L+1]-this.anchor.y)*f.y,k=0;k<3;k++)u.aPos[I+6+k]=e.dirX.getElement(k)*F,u.aPos[I+9+k]=e.dirY.getElement(k)*V}var D=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(o){var z=m(a.getIndexData(),6*r,6*i,s);z.set(D,6*t),a.setIndexData(z),this.maxParticleBufferCount=z.length/6}else a.setIndexSubData(6*t,D);Object.keys(u).forEach((function(e){var r=u[e],h=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var l=a.getAttributeData(e);Y(l);var c=m(l,n*h,4*i*h,s);c.set(r,r.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),a.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,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=o*(e/1e3),E=s*(e/1e3),_=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),a=this.geometry.getAttributeData("aRot"),o=this.geometry.getAttributeData("aSeed"),s=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=E((s-r[4*h+2])/r[4*h+3],0,1),c=8*h,f=this.cachedRotationVector3.set(a[c],a[c+1],a[c+2]),d=o[8*h+3],p=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(n(this.rotationOverLifetime.x,jn)?p.x+=this.rotationOverLifetime.x.getValue(l,d):p.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(n(this.rotationOverLifetime.y,jn)?p.y+=this.rotationOverLifetime.y.getValue(l,d):p.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(n(this.rotationOverLifetime.z,jn)?p.z+=this.rotationOverLifetime.z.getValue(l,d):p.z+=this.rotationOverLifetime.z.getValue(l))):u.setZero(),0===p.dot(p)&&u.identity();var m=Math.PI/180,v=p.x*m,y=p.y*m,g=p.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),_=Math.cos(v),S=Math.cos(y),C=Math.cos(g);u.set(C,-T,0,T,C,0,0,0,1),u.multiply(this.tempMatrix3.set(S,0,b,0,1,0,-b,0,S)),u.multiply(this.tempMatrix3.set(1,0,0,0,_,-x,0,x,_));var w=9*h,A=u.elements;i.set(A,w),h+4<=t&&(i.set(A,w+9),i.set(A,w+18),i.set(A,w+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),a=this.geometry.getAttributeData("aSeed"),o=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=o-r[4*u+2],l=r[4*u+3],c=h/l,f=a[8*u+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(n(this.linearVelOverLifetime.x,jn)?s.x=this.linearVelOverLifetime.x.getValue(c,f):s.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(n(this.linearVelOverLifetime.y,jn)?s.y=this.linearVelOverLifetime.y.getValue(c,f):s.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(n(this.linearVelOverLifetime.z,jn)?s.z=this.linearVelOverLifetime.z.getValue(c,f):s.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(n(this.linearVelOverLifetime.x,jn)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(n(this.linearVelOverLifetime.y,jn)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(n(this.linearVelOverLifetime.z,jn)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*u;i[d]=s.x,i[d+1]=s.y,i[d+2]=s.z,i[d+3]=s.x,i[d+4]=s.y,i[d+5]=s.z,i[d+6]=s.x,i[d+7]=s.y,i[d+8]=s.z,i[d+9]=s.x,i[d+10]=s.y,i[d+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}();var ju=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="ParticleSystemRenderer",i}Vt(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 C;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=_e(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 Gu(this.engine,t),e&&(this.trailMesh=new Lu(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.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}(Hr);exports.ParticleSystem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).particleMeshProps=null,r.trailMeshProps=null,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:exports.HitTestType.custom,clipMasks:r.renderer.frameClipMasks,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ut.removeParticle,ray:t})}}},r.maskManager=new Ur,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.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]===Dt.CONSTANT_VEC3?e.add(r[1]):t=pa(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)}},i.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)}},i.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())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new Au((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1},i.onStart=function(){var t=this;this.particleMeshProps&&(this.renderer=this.item.addComponent(ju),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)===Ut.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}})))},i.onUpdate=function(t){this.frozen||this.update(t)},i.simulate=function(t){this.update(1e3*t),this.frozen=!0},i.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=p,v=d/p,y=i,g=r.maxCount;this.updateEmitterTransform(u);for(var x=function(){var t=o.first;return e.emissionStopped||o.length===g&&t&&t.content[0]-n>u},b=0;b<m&&b<g&&!x();b++){var T=this.createPoint(f);T.delay+=y+b*v,this.addParticle(T,g),this.lastEmitTime=u}for(var E=a.bursts,_=(null==E?void 0:E.length)-1,S=0;_>=0&&S<g&&!x();_--){var C=E[_],w=!C.disabled&&C.getGeneratorOptions(u,f);if(w){var A=a.burstOffsets[_],M=A&&A[w.cycleIndex]||[0,0,0];C.once&&this.removeBurst(_);for(var P=0;P<w.count&&S<g;P++){var I;if(x())break;var R=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:P,burstCount:w.count}));R.delay+=y,S++,(I=R.transform).translate.apply(I,[].concat(M)),this.addParticle(R,g)}}}}else if(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);else{this.ended=!0,this.item.endBehavior===Bt.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=_e(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose()}))},i.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},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new S,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}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.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})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=void 0===a?[]:a,s=this.options.forceTarget,u=this.time-n,h=new S,l=S.fromArray(o);e.assignWorldTRS(h);var c=cn(new S,this.options,l,u,r,h,i);if(s){var f=s.target||[0,0,0],d=s.curve.getValue(u/r),p=1-d;c.x=c.x*p+f[0]*d,c.y=c.y*p+f[1]*d,c.z=c.z*p+f[2]*d}return c},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),a=e.particleFollowParent?wr.IDENTITY:this.transform.getWorldMatrix(),o=t.position,s=a.transformPoint(o,new S),u=new rn({position:s,valid:!0}),h=t.direction;if(h=a.transformNormal(h,Xu).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)qu.setElement(l,e.turbulence[l].getValue(i));Ku.setFromVector3(qu.negate()),Ju.setFromEuler(Ku).transformNormal(h).normalize()}var c,f=Yu,d=Zu;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=S.Z.clone(),a.transformNormal(this.upDirectionWorld)),f.crossVectors(d,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),d.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Qu)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=Hu;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(i);3===v.length&&(v[3]=1);var y=Wu;if(e.start3DSize)y.x=e.startSizeX.getValue(i),y.y=e.startSizeY.getValue(i);else{var g=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new S;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return u.setScale(y.x,y.y,1),{size:y,vel:b,color:v,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:th(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:d,dirX:f,transform:u}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&n(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i;var r,a,o,s,u,h=i.options,l=i.positionOverLifetime,c=void 0===l?{}:l,f=i.shape,d=null==c?void 0:c.gravityOverLifetime,p=fn(null==c?void 0:c.gravity),m=i.textureSheetAnimation,v=m?{animationDelay:pa(m.animationDelay||0),animationDuration:pa(m.animationDuration||1),cycles:pa(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,y=!!(f&&f.turbulenceX||(null==f?void 0:f.turbulenceY)||(null==f?void 0:f.turbulenceZ));y&&(r=[pa(null!=(a=f.turbulenceX)?a:0),pa(null!=(o=f.turbulenceY)?o:0),pa(null!=(s=f.turbulenceZ)?s:0)]);this.name="ParticleSystem",this.shape=Ys(f),this.emission={rateOverTime:pa(i.emission.rateOverTime),burstOffsets:$u(null!=(u=i.emission.burstOffsets)?u:[]),bursts:(i.emission.bursts||[]).map((function(t){return new Cu(t)}))},this.textureSheetAnimation=v;var g,x,b=i.renderer||{},T=i.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?pa(T.z):pa(0),T.separateAxes&&(g.x=T.x&&pa(T.x),g.y=T.y&&pa(T.y))),(null==c?void 0:c.forceTarget)&&(x={target:c.target||[0,0,0],curve:pa(c.forceCurve||[Dt.LINE,[[0,0],[1,1]]])});var E={x:c.linearX&&pa(c.linearX||0),y:c.linearY&&pa(c.linearY||0),z:c.linearZ&&pa(c.linearZ||0),asMovement:c.asMovement},S={x:c.orbitalX&&pa(c.orbitalX),y:c.orbitalY&&pa(c.orbitalY),z:c.orbitalZ&&pa(c.orbitalZ),center:c.orbCenter,asRotation:c.asRotation},C=i.sizeOverLifetime||{},w=i.colorOverLifetime,A=(null==C?void 0:C.separateAxes)?{separateAxes:!0,x:pa(C.x),y:pa(C.y)}:{separateAxes:!1,x:pa(("size"in C?C.size:C.x)||1)};b.anchor=b.anchor||[0,0];var M,P,I=_.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:pa(h.startLifetime),startDelay:pa(h.startDelay||0),startSpeed:pa(c.startSpeed||0),startColor:pa(h.startColor),looping:null!=(M=h.looping)&&M,maxCount:null!=(P=h.maxCount)?P:0,gravityModifier:pa(d||0),gravity:p,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:r,speedOverLifetime:c.speedOverLifetime&&pa(c.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:S,forceTarget:x},h.startRotationZ&&(this.options.startRotation=pa(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=pa(h.startRotationX||0),this.options.startRotationY=pa(h.startRotationY||0),this.options.startRotationZ=pa(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=pa(h.startSizeX),this.options.startSizeY=pa(h.startSizeY)):(this.options.startSize=pa(h.startSize),this.options.sizeAspect=pa(h.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(this.engine,i.mask);var R={name:this.name,matrix:wr.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||It.BILLBOARD,side:b.side||_t.DOUBLE,gravity:p,blending:b.blending||Et.ALPHA,rotationOverLifetime:g,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:h.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:x,diffuse:b.texture?this.engine.findObject(b.texture):void 0,sizeOverLifetime:A,anchor:I};if(w){var O=w.color,N=w.opacity;R.colorOverLifetime={},N&&(R.colorOverLifetime.opacity=pa(w.opacity)),O&&(O[0]===Dt.GRADIENT_COLOR?R.colorOverLifetime.color=w.color[1]:O[0]===Dt.RGBA_COLOR?R.colorOverLifetime.color=pr.createWithData(this.engine,{data:new Uint8Array(O[1]),width:1,height:1}):n(O,pr)&&(R.colorOverLifetime.color=O))}var L,F=[],V=[0,0,1,1];if(i.splits){var k=i.splits[0];V=(L=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(v&&!v.animate)for(var D=L?v.row:v.col,z=L?v.col:v.row,B=v.total||D*z,U=0,G=0;G<D;G++)for(var j=0;j<z&&U<B;j++,U++)F.push([G*V[2]/D+V[0],j*V[3]/z+V[1],V[2]/D,V[3]/z]);else F.push(V);this.uvs=F,R.textureFlip=L;var X,W=i.trails;W&&(this.trails={lifetime:pa(W.lifetime),dieWithParticles:!1!==W.dieWithParticles,sizeAffectsWidth:!!W.sizeAffectsWidth,sizeAffectsLifetime:!!W.sizeAffectsLifetime,inheritParticleColor:!!W.inheritParticleColor,parentAffectsPosition:!!W.parentAffectsPosition},X={name:"Trail",matrix:wr.IDENTITY,minimumVertexDistance:W.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(W.maxPointPerTrail)||32,blending:W.blending,texture:W.texture?this.engine.findObject(W.texture):void 0,opacityOverLifetime:pa(W.opacityOverLifetime||1),widthOverTrail:pa(W.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!W.occlusion,transparentOcclusion:!!W.transparentOcclusion,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},W.colorOverLifetime&&W.colorOverLifetime[0]===Dt.GRADIENT_COLOR&&(X.colorOverLifetime=W.colorOverLifetime[1]),W.colorOverTrail&&W.colorOverTrail[0]===Dt.GRADIENT_COLOR&&(X.colorOverTrail=W.colorOverTrail[1])),this.particleMeshProps=R,X&&(this.trailMeshProps=X);var H,Y=i.interaction;Y&&(this.interaction={multiple:Y.multiple,radius:null!=(H=Y.radius)?H:.4,behavior:Y.behavior});this.item.getHitTestParams=this.getHitTestParams},Pi(e,[{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)}}]),e}(Ii),exports.ParticleSystem=a([Me(pe.ParticleSystem)],exports.ParticleSystem);var Xu=new S,Wu=new _,Hu=new Ar,Yu=new S,Zu=new S,qu=new S,Ku=new Ar,Qu=[0,0,0],Ju=new wr;function $u(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=n(t,Array),r=i?t[0]:t.index,a=e[r];a||(a=e[r]=[]),i?a.push(t.slice(1,4)):a.push([+t.x,+t.y,+t.z])})),e}function th(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(n(i,exports.VFXItem))for(var r,a=_e(this.getChildTracks());!(r=a()).done;){var o=r.value;if(n(o,exports.ActivationTrack)){if(i.getComponent(exports.ParticleSystem))for(var s,u=t.createTrack(Rs,this,"ParticleTrack"),h=_e(o.getClips());!(s=h()).done;){var l=s.value,c=u.createClip(Bu);c.start=l.start,c.duration=l.duration,c.endBehavior=l.endBehavior}if(i.getComponent(exports.SpriteComponent))for(var f,d=t.createTrack(oh,this,"SpriteComponentTimeTrack"),p=_e(o.getClips());!(f=p()).done;){var m=f.value,v=d.createClip(uh);v.start=m.start,v.duration=m.duration,v.endBehavior=m.endBehavior}if(i.getComponent(exports.EffectComponent))for(var y,g=t.createTrack(sh,this,"EffectComponentTimeTrack"),x=_e(o.getClips());!(y=x()).done;){var b=y.value,T=g.createClip(uh);T.start=b.start,T.duration=b.duration,T.endBehavior=b.endBehavior}break}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=a([Me(pe.ObjectBindingTrack)],exports.ObjectBindingTrack),exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new ls},e}(rs),exports.ActivationPlayableAsset=a([Me(pe.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=a([Me(pe.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=a([Me(pe.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new ys},e}(rs),exports.SubCompositionPlayableAsset=a([Me(pe.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=a([Me(pe.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector3ropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.Vector3ropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector3ropertyPlayableAsset=a([Me(pe.Vector3PropertyPlayableAsset)],exports.Vector3ropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){var t=new cs;return t.curve=pa(this.curveData),t.value=t.curve.getValue(0),t},e}(rs),a([Pe()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=a([Me(pe.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset);var eh=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}();exports.TimelineAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}Vt(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=_e(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=_e(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},Pi(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=_e(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Re),a([Pe()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=a([Me(pe.TimelineAsset)],exports.TimelineAsset);var ih=function(){function t(t,e){this.masterTrackInstances=[],this.clips=[];for(var i,r={},a=_e(e);!(i=a()).done;){var o=i.value;r[o.key.getInstanceId()]=o.value}for(var s,u=_e(t.tracks);!(s=u()).done;){var h=s.value;n(h,exports.ObjectBindingTrack)&&h.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.evaluate=function(t,e){for(var i,r=_e(this.clips);!(i=r()).done;){i.value.evaluateAt(t)}for(var n,a=_e(this.masterTrackInstances);!(n=a()).done;){var o=n.value;this.tickTrack(o,e)}},e.compileTracks=function(t,e){for(var i,r=t,n={},a=_e(r);!(i=a()).done;){var o=i.value,s=o.createPlayableGraph(this.clips),u=o.createOutput(),h=new eh(o,s,u);n[o.getInstanceId()]=h,o.parent||this.masterTrackInstances.push(h)}for(var l,c=_e(r);!(l=c()).done;)for(var f,d=l.value,p=n[d.getInstanceId()],m=_e(d.getChildTracks());!(f=m()).done;){var v=n[f.value.getInstanceId()];p.addChild(v)}for(var y,g=_e(e);!(y=g()).done;){var x=y.value;n[x.key.getInstanceId()].boundObject=x.value}for(var b,T=_e(this.masterTrackInstances);!(b=T()).done;){var E=b.value;this.updateTrackAnimatedObject(E)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=_e(t.mixer.clipPlayables);!(r=n()).done;){var a=r.value;a.getPlayState()===exports.PlayState.Playing&&a.processFrame(i)}t.mixer.evaluate(i);for(var o,s=_e(t.children);!(o=s()).done;){var u=o.value;this.tickTrack(u,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=_e(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)}},t}(),rh=[[0,0,1,1,0]],nh=0;exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Vt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new as;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(rs),exports.SpriteColorPlayableAsset=a([Me(pe.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset);var ah=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createTrackMixer=function(){return new us},e}(exports.TrackAsset),oh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.SpriteComponent)},e}(ah),sh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.EffectComponent)},e}(ah),uh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.createPlayable=function(){return new hh},e}(rs),hh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(es);exports.SpriteComponent=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=1,r.splits=rh,r.name="MSprite"+nh++,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.onUpdate=function(e){var i=this;t.prototype.onUpdate.call(this,e);var r,n=this.time,a=this.duration,o=this.textureSheetAnimation,s=null==(r=null==o?void 0:o.loop)||r;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){i.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),o){var l,c,f,d,p,m=o.total||o.row*o.col,v=0,y=0,g=1,x=1;if(this.splits){var b=this.splits[0];c=b[4],v=b[0],y=b[1],c?(g=b[3],x=b[2]):(g=b[2],x=b[3])}if(c?(f=1/o.row*g,d=1/o.col*x):(f=1/o.col*g,d=1/o.row*x),o.animate){var T=Math.round(u*(m-1)),E=Math.floor(T/o.col),_=T-E*o.col;p=c?[f*E,d*(o.col-_)]:[f*_,d*(1+E)]}else p=[0,d];null==(l=this.material.getVector4("_TexOffset"))||l.setFromArray([v+p[0],x+y-p[1],f,d])}this.time=n+e/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===exports.TextureSourceType.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.updateGeometry=function(t){var e=this.textureSheetAnimation?[0,0,1,1,this.splits[0][4]]:this.splits[0],i=e[0],r=e[1],n=Boolean(e[4]),a=n?e[3]:e[2],o=n?e[2]:e[3],s=n?-Math.PI/2:0,u=t.getAttributeData("aUV"),h=t.getAttributeData("aPos"),l=t.getIndexData(),c=[0,0];if(u&&h&&l){for(var f=u.length/2,d=0;d<f;d++){var p=3*d,m=2*d,v=h[p],y=h[p+1];c[0]=v,c[1]=y,_u(c,c,s),u[m]=(c[0]+.5)*a+i,u[m+1]=(c[1]+.5)*o+r}this.geometry.setAttributeData("aPos",h.slice()),this.geometry.setAttributeData("aUV",u.slice()),this.geometry.setIndexData(l.slice()),this.geometry.setDrawCount(l.length)}this.geometry.subMeshes.length=0;for(var g,x=_e(t.subMeshes);!(g=x()).done;){var b=g.value;this.geometry.subMeshes.push({offset:b.offset,indexCount:b.indexCount,vertexCount:b.vertexCount})}},i.updateGeometryFromMultiSplit=function(){for(var t=this.splits,e=this.textureSheetAnimation,i=this.defaultGeometry,r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],n=[],a=[],o=[],s=0;s<2;s++)for(var u=0;u<2;u++){var h=4*(2*u+s),l=e?[0,0,1,1,t[0][4]]:t[2*u+s],c=l[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],f=((s+s+1)/2-1)/2,d=((u+u+1)/2-1)/2,p=l[0],m=l[1],v=l[4]?l[3]:l[2],y=l[4]?l[2]:l[3],g=[r[0]/2+f,r[1]/2+d,r[2]/2+f,r[3]/2+d,r[4]/2+f,r[5]/2+d,r[6]/2+f,r[7]/2+d];n.push(c[0]*v+p,c[1]*y+m,c[2]*v+p,c[3]*y+m,c[4]*v+p,c[5]*y+m,c[6]*v+p,c[7]*y+m),o.push(1*g[0],1*g[1],0,1*g[2],1*g[3],0,1*g[4],1*g[5],0,1*g[6],1*g[7],0),a.push(h,1+h,2+h,2+h,1+h,3+h)}i.setAttributeData("aPos",new Float32Array(o)),i.setIndexData(new Uint16Array(a)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(a.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:rh,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var a=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(a):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var o,s=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new w).setFromArray(s)),this.duration=null!=(o=e.duration)?o:this.item.duration},e}(ko),exports.SpriteComponent=a([Me(pe.SpriteComponent)],exports.SpriteComponent);var lh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),ch=new(function(){function t(){this.elements=[]}var i=t.prototype;return i.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},i.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return Y(t),t}if(Ru(Pu))return e.window._createOffscreenCanvas(10,10);var i=e.document.createElement("canvas");return i.getContext("2d",{willReadFrequently:!0}),i},i.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?d(this.elements,t):t.remove()},t}()),fh=function(){function t(t){this.width=0,this.height=0,this.autoResize=Kt.fixed,this.keepWordIntact=!0,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,a=t.textOverflow,o=void 0===a?qt.clip:a,s=t.textVerticalAlign,u=void 0===s?$t.top:s,h=t.textAlign,l=void 0===h?Jt.left:h,c=t.letterSpace,f=void 0===c?0:c,d=t.fontSize,p=t.lineHeight,m=void 0===p?d:p,v=t.autoResize,y=void 0===v?Kt.fixed:v,g=t.keepWordIntact,x=void 0===g||g;this.letterSpace=f,this.overflow=o,this.textVerticalAlign=u,this.textAlign=l,this.width=n,this.height=i,this.autoResize=y,this.keepWordIntact=x,this.lineHeight=m},e.getOffsetY=function(t,e,i,r,n){var a=(i-r)/3,o=r,s=void 0!==n?n:i*(e-1),u=0;switch(this.textVerticalAlign){case $t.top:u=o+a;break;case $t.middle:u=(this.height-s+o)/2;break;case $t.bottom:u=this.height-s-a}return u},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case Jt.left:i=0;break;case Jt.middle:i=(this.width-e)/2;break;case Jt.right:i=this.width-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),dh=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=void 0===u?[1,1,1,1]:u,l=t.fontSize,c=void 0===l?40:l,f=t.outline,d=t.shadow,p=t.fontWeight,m=void 0===p?"normal":p,v=t.fontStyle,y=void 0===v?"normal":v,g=t.fontFamily,x=void 0===g?"sans-serif":g;(this.textColor=[].concat(h),this.textWeight=m,this.fontStyle=y,this.fontFamily=x,this.fontSize=c,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,f&&(null!=(e=f.outlineWidth)?e:0)>0)&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=f.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=f.outlineWidth)?r:0);(this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,d)&&(this.hasShadow=!0,this.shadowBlur=null!=(n=d.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(a=d.shadowColor)?a:[0,0,0,1]),this.shadowOffsetX=null!=(o=d.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(s=d.shadowOffsetY)?s:0);this.fontOffset=0,this.fontStyle!==ee.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),ph=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){Z(t)?this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("Risky font family, ignored:",t)},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!==te.normal&&(o=n+" "+o),a!==ee.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.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var a=this.context;a.save(),this.canvas.width=t,this.canvas.height=e,a.setTransform(1,0,0,1,0,0),i||(a.translate(0,e),a.scale(1,-1)),a.clearRect(0,0,t,e),a.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(a),a.restore();var o=a.getImageData(0,0,t,e),s=pr.createWithData(this.engine,{data:new Uint8Array(o.data),width:o.width,height:o.height},{flipY:i,magFilter:Di.LINEAR,minFilter:Di.LINEAR,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=s,this.material.setTexture("_MainTex",s)}},e.initTextBase=function(t){this.engine=t,this.canvas=ch.getCanvas(),ch.saveCanvas(this.canvas),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})},t}(),mh=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,vh=function(t){return" "===t||"\t"===t||" "===t},yh=0;exports.TextComponent=function(t){function e(e){var i;(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+yh++,i.canvas=ch.getCanvas(),ch.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0});var r=i.getDefaultProps().options;return i.updateWithOptions(r),i}Vt(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=_e(this.materials);!(i=r()).done;){var n=i.value,a=this.transform.size.x,o=this.transform.size.y,s=this.getTextureExpandScale();a*=s[0],o*=s[1],n.setVector2("_Size",new _(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()},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 w(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 dh(t),this.textLayout?this.textLayout.update(t):this.textLayout=new fh(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;if(e&&(e.font=this.getFontDesc(this.textStyle.fontSize)),n===qt.display){for(var h=0;h<t.length;h++){var l,c,f=t[h],d=null!=(c=null==e||null==(l=e.measureText(f))?void 0:l.width)?c:0;"\n"===f?(o++,s=0,u=0):(u>0&&(s+=r),s+=d,u++,this.maxLineWidth=Math.max(this.maxLineWidth,s))}return o}if(this.textLayout.keepWordIntact)for(var p=0,m=0,v=0;v<t.length;v++){var y,g,x=t[v],b=null!=(g=null==e||null==(y=e.measureText(x))?void 0:y.width)?g:0;if("\n"!==x)s+(u>0?r:0)+b>a&&u>0&&(o++,m>1?(this.maxLineWidth=Math.max(this.maxLineWidth,p),s-=p,u-=m):(this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),p=0,m=0),u>0&&(s+=r),s+=b,u++,vh(x)&&(p=s,m=u);else o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0,p=0,m=0}else for(var T=0;T<t.length;T++){var E,_,S=t[T],C=null!=(_=null==e||null==(E=e.measureText(S))?void 0:E.width)?_:0;u>0&&(s+=r),(s+C>a&&T>0||"\n"===S)&&(o++,this.maxLineWidth=Math.max(this.maxLineWidth,s),s=0,u=0),"\n"!==S&&(s+=C,u++)}return this.maxLineWidth=Math.max(this.maxLineWidth,s),o},i.setLineHeight=function(t){var e=this.textStyle.fontSize,i=Math.max(e,t);this.textLayout.lineHeight!==i&&(this.textLayout.lineHeight=i,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===Kt.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):r.autoResize===Kt.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=0!=(c|f|d|p),v=this.engine.gpuCapability.detail.maxTextureSize/2,y=m?a+c+f:a,g=m?o+d+p:o,x=Math.max(y,g,1);n=Math.min(n,v/x);var b=Math.ceil(y*n),T=Math.ceil(g*n),E=m?c:0,_=m?t?d:p:0;this.effectScaleX=a>0?b/(a*n):1,this.effectScaleY=o>0?T/(o*n):1;var S=.0123044998279225;this.transform.setSize(a*S,o*S),this.renderToTexture(b,T,t,(function(t){t.scale(n,n),e.maxLineWidth>a&&r.overflow===qt.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=0;b<h.length;b++){var T=h[b],S=t.measureText(T);if("\n"!==T){if(m+(y.length>0?r.letterSpace:0)+S.width>a&&y.length>0)if(x>0){var C=y.slice(0,x),w=g.slice(0,x),A=C.length>0?w[w.length-1]+t.measureText(C[C.length-1]).width:0;p.push({y:v,width:A,chars:C,charOffsetX:w}),v+=u,y=y.slice(x+1),m=0,g=[];for(var M=0;M<y.length;M++)M>0&&(m+=r.letterSpace),g.push(m),m+=t.measureText(y[M]).width;x=-1}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1;y.length>0&&(m+=r.letterSpace),g.push(m),y.push(T),m+=S.width,vh(T)&&(x=y.length-1)}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1}else for(var P=0;P<h.length;P++){var I=h[P],R=t.measureText(I);y.length>0&&(m+=r.letterSpace),(m+R.width>a&&P>0||"\n"===I)&&(p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[]),"\n"!==I&&(y.push(I),g.push(m),m+=R.width)}y.length>0&&p.push({y:v,width:m,chars:y,charOffsetX:g});var O=i.isOutlined&&i.outlineWidth>0;O&&(i.hasShadow&&e.setupShadow(),e.setupOutline(n),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&mh.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.strokeText(a,E+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=E+u+e.charOffsetX[h];t.strokeText(l,c,n)}})),i.hasShadow&&(t.shadowColor="transparent")),!O&&i.hasShadow&&e.setupShadow(),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&mh.test(a)){var o=t.measureText(a).width,s=r.getOffsetX(i,o);t.save(),t.direction="rtl",t.fillText(a,E+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=E+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===Kt.autoWidth&&(i.autoResize=Kt.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];"\n"!==l?(u+=a.letterSpace||0,u+=r.measureText(l).width):(s=Math.max(s,u),u=0)}s=Math.max(s,u);var c=Math.ceil(s-(o.fontOffset||0)-1e-4)+2;return Math.max(0,c)},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:pe.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:te.normal,letterSpace:0,textAlign:Jt.middle,fontStyle:ee.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(ko),exports.TextComponent=a([Me(pe.TextComponent)],exports.TextComponent),dt(exports.TextComponent,[ph]);var gh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Bo(Lt)),xh=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Re);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e}(Re),a([Pe()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=a([Me(pe.BinaryAsset)],exports.BinaryAsset);var bh=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=Ie(e);if(r)for(var n,a=_e(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:rt(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):Re.is(s)?i[o]={id:s.getInstanceId()}:at(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=_e(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:rt(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):Re.is(c)?i[l]={id:c.getInstanceId()}:at(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.definition=e;var r=Ie(i),n=i.engine;if(r)for(var a,o=_e(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 n(t,Int8Array)||n(t,Uint8Array)||n(t,Uint8ClampedArray)||n(t,Int16Array)||n(t,Uint16Array)||n(t,Int32Array)||n(t,Uint32Array)||n(t,Float32Array)||n(t,Float64Array)||n(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(at(t)&&1===Object.keys(t).length&&"id"in t&&it(t.id))},t.checkGLTFNode=function(t){return at(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return st(t)||n(t,e.HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),!(r>14)){if(rt(e)){for(var o,s=[],u=_e(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(ot(e)){var c;c=n?new n:{};for(var f,d=_e(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,a=_e(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:rt(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):Re.is(s)?i[o]={id:s.getInstanceId()}:at(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.");else{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:rt(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):Re.is(a)?i[n]={id:a.getInstanceId()}:at(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}}},t}(),Th=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){switch(r.dataType){case pe.Material:e=zr.create(this.engine);break;case pe.Geometry:e=no.create(this.engine);break;case pe.Texture:e=pr.create(this.engine);break;default:var n=Ae(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),bh.deserialize(r,e),e;console.warn("Constructor for DataType: "+r.dataType+" not found.")}else console.warn("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),Eh=function(){function t(){}return t.prototype.loadGUID=function(t){return r((function(){return o(this,(function(t){return[2,void 0]}))}))()},t}();function _h(t,e){if(!t.includes(e))return t.push(e),!0}function Sh(t){if(Number.isFinite(t))return[Dt.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===Dt.CONSTANT)return[Dt.CONSTANT,t[1]];if("lines"===e)return[Dt.LINE,t[1]];if(e===Dt.LINE){var r=i.map((function(t){return[zt.LINE,t]}));return[Dt.BEZIER_CURVE,r]}return"curve"===e||e===Dt.CURVE?[Dt.BEZIER_CURVE,Wh(i)]:t}}function Ch(t,e){return Array.isArray(t)&&"random"===t[0]?[Dt.CONSTANT,t[1][e]]:Sh(t)}function wh(t){return t&&"color"===t[0]?Ih(t[1],!0):[1,1,1,1]}function Ah(t,e){if(t)return"colors"===t[0]?[Dt.COLORS,t[1].map((function(t){return Ih(t,e)}))]:"gradient"===t[0]?Ph(t[1],e):"color"===t[0]?[Dt.RGBA_COLOR,Ih(t[1],e)]:t}function Mh(t){return t&&"random"===t[0]?[Dt.RANDOM,t[1]]:Sh(t)}function Ph(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach((function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),a=Ih(t[r],e);i.push([n,a[0],a[1],a[2],a[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[Dt.GRADIENT_COLOR,i]}}function Ih(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 a=+r[4];i=[+r[1],+r[2],+r[3],isNaN(a)?255:Math.round(255*a)]}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 n(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Rh(i)),i}function Rh(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Oh(t,e){return Array.isArray(t)?t[0]===Dt.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Ph(t[1],e):Ph(t,e)}function Nh(t){if(t){if(3===t.length)return[Dt.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Dt.BEZIER_PATH||e===Dt.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=Wh(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s?a.push(u):s<n.length-1?(a.push(u),a.push(u)):a.push(u)}}return[Dt.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function Lh(t){for(var e,i=_e(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function Fh(t){for(var e,i=_e(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var Vh,kh=Math.cos,Dh=Math.sin,zh=Math.PI/180,Bh=180/Math.PI;function Uh(t,e){return t?[t[0]-.5,.5-t[1]]:e?jh[e]:[0,0]}var Gh,jh=((Vh={})[Rt.PARTICLE_ORIGIN_CENTER]=[0,0],Vh[Rt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Vh[Rt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Vh[Rt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Vh[Rt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Vh[Rt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Vh[Rt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Vh[Rt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Vh[Rt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Vh);function Xh(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=o-n;return[[n+(o-n)/3,a+(t*=s)/3],[o-(o-n)/3,r[1]-(e*=s)/3]]}function Wh(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=Xh(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?[zt.EASE_OUT,t]:e===n.length-1?[zt.EASE_IN,t]:[zt.EASE,t]}))}var Hh=new Map,Yh=new Map;function Zh(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Pt.null&&t.endBehavior===Bt.destroy&&(t.endBehavior=Bt.freeze)}))})),t.version=bt["2_1"],t}function qh(t){for(var e,i,r,n=function(){var t=u.value;t.endBehavior!==re&&t.endBehavior!==ie||(t.endBehavior=Bt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===Pt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=_e(t.items);!(e=i()).done;){var r=e.value;h[r.id]=ct(),r.oldId=r.id,r.id=h[r.id],l[r.id]=r}t.items.forEach((function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=h[r]+"^"+n}else e.parentId=h[e.parentId];a.items.push(e),t.items[i]={id:e.id}}));var n=He({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:ct(),dataType:"TimelineAsset"},u=_e(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:ct(),dataType:"ActivationPlayableAsset"};o.push(c);var f={id:ct(),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!==Pt.particle){var d={id:ct(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:ct(),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===Pt.sprite||h.type===Pt.text){var m={id:ct(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:ct(),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===Pt.composition){var y={id:ct(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:ct(),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:ct(),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=[],E=_e(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var S,C=_e(a);!(S=C()).done;){var w=S.value;i.miscs.push(w)}for(var A,M=_e(o);!(A=M()).done;){var P=A.value;i.miscs.push(P)}}(n,l,a)},a=He({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),o=_e(a.images);!(i=o()).done;){i.value.id=ct()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=ct(),t.dataType=pe.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var s=a.textures.length;s<a.images.length;s++)a.textures.push({id:ct(),dataType:pe.Texture,source:{id:a.images[s].id},flipY:!0});t.bins&&(r=t.bins,a.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:ct()}})));for(var u,h={},l={},c=_e(t.compositions);!(u=c()).done;)n();for(var f,d=_e(a.items);!(f=d()).done;){var p=f.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:a.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var v=p.content.trails.texture;p.content.trails.texture={id:a.textures[v].id}}}if(p.transform){var y,g,x,b=[].concat(null!=(y=p.transform.position)?y:[0,0,0]),T=[].concat(null!=(g=p.transform.rotation)?g:[0,0,0]),E=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:T[0],y:T[1],z:T[2]},scale:{x:E[0],y:E[1],z:E[0]}}}),p.type===Pt.sprite&&(p.transform.size={x:E[0],y:E[1]},p.transform.scale={x:1,y:1,z:1}),p.type===Pt.sprite){var _=p.content;_.renderer||(_.renderer={});var S,C,w,A,M=_.renderer,P=Uh(M.anchor,M.particleOrigin),I=p.transform.size;if(!M.anchor&&void 0!==M.particleOrigin)p.transform.position.x+=-P[0]*(null!=(S=null==I?void 0:I.x)?S:1),p.transform.position.y+=-P[1]*(null!=(C=null==I?void 0:I.y)?C:1);p.transform.anchor={x:P[0]*(null!=(w=null==I?void 0:I.x)?w:1),y:P[1]*(null!=(A=null==I?void 0:I.y)?A:1)}}}if(p.type===Pt.particle){var R=p.content;R.renderer||(R.renderer={});var O=R.renderer;R.renderer.anchor=Uh(O.anchor,O.particleOrigin)}if(p.type===Pt.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var N=p.pn,L=t.plugins,F=void 0===L?[]:L;void 0!==N&&Number.isInteger(N)&&(p.pluginName=F[N])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=h[p.content.options.target]),p.type===Pt.spine&&t.spines&&0!==t.spines.length&&ul(t.spines[p.content.options.spine],p.content,a),p.type!==Pt.sprite&&p.type!==Pt.particle&&p.type!==Pt.mesh&&p.type!==Pt.skybox&&p.type!==Pt.light&&"camera"!==p.type&&p.type!==Pt.tree&&p.type!==Pt.interact&&p.type!==Pt.camera&&p.type!==Pt.text&&p.type!==Pt.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],a.components.push(p.content),p.content.id=ct(),p.content.item={id:p.id},p.dataType=pe.VFXItemData,p.components.push({id:p.content.id})),p.type!==Pt.null&&p.type!==Pt.composition||(p.components=[],p.dataType=pe.VFXItemData),p.type){case Pt.sprite:p.content.dataType=pe.SpriteComponent;break;case Pt.particle:p.content.dataType=pe.ParticleSystem;break;case Pt.mesh:p.content.dataType=pe.MeshComponent;break;case Pt.skybox:p.content.dataType=pe.SkyboxComponent;break;case Pt.light:p.content.dataType=pe.LightComponent;break;case"camera":p.content.dataType=pe.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case Pt.tree:p.content.dataType=pe.TreeComponent;break;case Pt.interact:p.content.dataType=pe.InteractComponent;break;case Pt.camera:p.content.dataType=pe.CameraController;break;case Pt.text:p.content.dataType=pe.TextComponent;break;case Pt.spine:p.content.dataType=pe.SpineComponent}}return a.version=bt["3_0"],a}function Kh(t){for(var e,i=_e(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.ShapeComponent){var n=r;if(n.type===se.Custom){var a,o=n;(null==(a=o.shapes)?void 0:a.length)>0&&o.shapes[0].fill&&(o.fill=o.shapes[0].fill);for(var s,u=new Array(o.easingIns.length),h=new Array(o.easingOuts.length).fill(!1),l=_e(o.shapes);!(s=l()).done;)for(var c,f=_e(s.value.indexes);!(c=f()).done;){var d=c.value,p=o.points[d.point],m=o.easingIns[d.easingIn],v=o.easingOuts[d.easingOut];u[d.easingIn]||(m.x-=p.x,m.y-=p.y,u[d.easingIn]=!0),h[d.easingOut]||(v.x-=p.x,v.y-=p.y,h[d.easingOut]=!0)}}}}return t.version=bt["3_2"],t}function Qh(t){Hh.clear(),Yh.clear();for(var e,i=t.compositions,r=t.items,n=_e(t.components);!(e=n()).done;){var a=e.value;Hh.set(a.id,a)}for(var o,s=_e(r);!(o=s()).done;){var u=o.value;Yh.set(u.id,u)}for(var h,l=_e(i);!(h=l()).done;){al(h.value)}return t.version=bt["3_3"],t}function Jh(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=_e(t.items);!(i=r()).done;){var n=i.value;if(n.type===Pt.sprite){var a=Hh.get(n.components[0].id);if(a){var o,s=a.renderer.shape,u=void 0;if(Number.isInteger(s))u=null==(o=t.shapes)?void 0:o[s];else u=s;a.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=_e(t.compositions);!(h=f()).done;){var d=h.value,p=ct();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:ct(),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=_e(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=bt["3_4"],t}function $h(t){for(var e,i={},r=_e(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var a,o=_e(t.compositions);!(a=o()).done;)for(var s,u=a.value,h=_e(u.components);!(s=h()).done;){i[s.value.id].item.id=u.id}for(var l,c=_e(t.components);!(l=c()).done;){var f=l.value;if(f.dataType===pe.SpriteComponent){var d=f,p=d.renderer.shape;if(!(null==p||"aPoint"in p&&"index"in p)){var m=nl(p);d.geometry={id:m.id},t.geometries.push(m)}}if(f.dataType===pe.ShapeComponent){var v=f;if(v.fills=[],v.fill){var y={type:ae.Solid,color:v.fill.color};v.fills.push(y)}if(delete v.fill,v.strokes=[],v.stroke){var g={type:ae.Solid,color:v.stroke.color};v.strokes.push(g),v.strokeWidth=v.stroke.width,v.strokeCap=v.stroke.cap,v.strokeJoin=v.stroke.join,delete v.stroke}}}return t.version=bt["3_5"],t}function tl(t){if(t.components)for(var e,i=_e(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}(r.dataType===pe.TextComponent||r.dataType===pe.RichTextComponent&&r.options)&&il(r.options),r.dataType===pe.TextComponent&&rl(r.options)}return t.version=bt["3_6"],t}function el(t){for(var e,i,r=function(){var e=i.value;if(e.type===Pt.text&&e.transform){for(var r,a,o,s=t.components.find((function(t){return e.components[0].id===t.id})),u=e.transform.scale.x/(null!=(a=null==(r=s.options)?void 0:r.textWidth)?a:1)/.0123,h=e.transform.scale.x,l=e.transform.scale.y,c=e.transform.scale.z,f=_e(t.items);!(o=f()).done;){var d=o.value;d.parentId===e.id&&d.transform&&(d.transform.scale.x*=h/u,d.transform.scale.y*=l/u,d.transform.scale.z*=c/u)}e.transform.scale.x=u,e.transform.scale.y=u,e.transform.scale.z=u,n.push({item:e,scaleFactor:u,oldScaleX:h,oldScaleY:l,oldScaleZ:c})}},n=[],a=_e(t.items);!(i=a()).done;)r();n.length>0&&(null==(e=t.animations)?void 0:e.length)&&function(t,e){for(var i,r=new Map,n=new Map,a=_e(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=_e(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=_e(d);!(p=m()).done;){var v=p.value;l.set(v.id,f)}}for(var y,g=new Map,x=_e(t.components);!(y=x()).done;){var b=y.value;g.set(b.id,b)}for(var T,E=new Map,_=_e(t.animations);!(T=_()).done;){var S=T.value;E.set(S.id,S)}for(var C,w=_e(t.compositions);!(C=w()).done;){for(var A,M,P,I=C.value,R=void 0,O=void 0,N=_e(I.components);!(P=N()).done;){var L=P.value,F=g.get(L.id);if((null==F?void 0:F.dataType)===pe.Animator?R=F:(null==F?void 0:F.dataType)===pe.CompositionComponent&&(O=F),R&&O)break}if(R){var V=void 0;if(O){var k=O.items;if(k){V=[];for(var D,z=_e(k);!(D=z()).done;){var B=D.value,U=r.get(B.id);U&&!U.parentId&&V.push(U)}}}if((!V||0===V.length)&&I.children){V=[];for(var G,j=_e(I.children);!(G=j()).done;){var X=G.value,W=r.get(X.id);W&&V.push(W)}}if(V&&0!==V.length){var H=R,Y=E.get(null==(A=H.graphAsset)?void 0:A.id);if(null==Y||null==(M=Y.graphDataSet)?void 0:M.resources)for(var Z,q=_e(Y.graphDataSet.resources);!(Z=q()).done;){var K=Z.value,Q=E.get(K.id);if(null==Q?void 0:Q.scaleCurves)for(var J,$=_e(Q.scaleCurves);!(J=$()).done;){var tt=J.value,et=hl(V,tt.path,n);if(et){var it=h.get(et.id);if(it)ll(tt.keyFrames,it.scaleFactor/it.oldScaleX,it.scaleFactor/it.oldScaleY,it.scaleFactor/it.oldScaleZ);else{var rt=l.get(et.id);rt&&ll(tt.keyFrames,rt.oldScaleX/rt.scaleFactor,rt.oldScaleY/rt.scaleFactor,rt.oldScaleZ/rt.scaleFactor)}}}}}}}}(t,n);for(var o,s=new Map,u=new Map,h=new Map,l=_e(t.components);!(o=l()).done;){var c=o.value;h.set(c.id,c)}for(var f,d=_e(t.items);!(f=d()).done;){var p=f.value;p.children=[],s.set(p.id,p)}for(var m,v=_e(t.compositions);!(m=v()).done;){var y=m.value;y.children=[];for(var g,x=_e(y.components);!(g=x()).done;){var b=g.value,T=h.get(b.id);if(T.dataType===pe.CompositionComponent){for(var E,_=T,S=_e(_.items);!(E=S()).done;){var C=E.value,w=s.get(C.id);void 0===w.parentId&&y.children.push({id:w.id})}delete _.items}}u.set(y.id,y)}for(var A,M=_e(t.items);!(A=M()).done;){var P=A.value;if(P.parentId){var I=s.get(P.parentId);I&&I.children.push({id:P.id})}}return t.version=bt["3_7"],t}function il(t){t&&void 0===t.TextVerticalAlign&&void 0===t.TextVerticalAlign&&(t.TextVerticalAlign=t.textBaseline)}function rl(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]}}function nl(t,e){void 0===e&&(e="形状");for(var i=Eu(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:me.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:ye.UInt16,indexOffset:p,buffer:"",id:ct(),dataType:pe.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:ge.Position,offset:0,format:ve.Float32,dimension:3}),v.vertexData.channels.push({semantic:ge.Uv,offset:d,format:ve.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}function al(t){for(var e,i=_e(t.items);!(e=i()).done;){var r=e.value,n=Yh.get(r.id);if(!n)return;if(n.type===Pt.sprite||n.type===Pt.particle||n.type===Pt.spine||n.type===Pt.text||n.type===Pt.richtext||n.type===Pt.video||n.type===Pt.shape){var a=Hh.get(n.components[0].id);a&&ol(a)}}}function ol(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==exports.MaskMode.NONE&&(i===exports.MaskMode.MASK?(t.mask={isMask:!0},Gh=t.id):i!==St.OBSCURED&&i!==St.REVERSE_OBSCURED||(t.mask={inverted:i===St.REVERSE_OBSCURED,reference:{id:Gh}}))}function sl(t){if(t)for(var e,i=_e(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?Nh(n):Sh(n):a||"object"!=typeof n||sl(n)}}function ul(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}}))}}function hl(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}}function ll(t,e,i,r){if(Array.isArray(t)&&t[0]===Dt.VECTOR3_CURVE){var n=t[1];Array.isArray(n)&&3===n.length&&(cl(n[0],e),cl(n[1],i),cl(n[2],r))}}function cl(t,e){if(Array.isArray(t)&&t[0]===Dt.BEZIER_CURVE&&Array.isArray(t[1]))for(var i,r=_e(t[1]);!(i=r()).done;){var n=i.value;if(Array.isArray(n)&&!(n.length<2)&&Array.isArray(n[1]))for(var a=n[1],o=1;o<a.length;o+=2)a[o]*=e}}function fl(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:Nh(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Sh(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Sh(n.linearX),linearY:Sh(n.linearY),linearZ:Sh(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Sh(n.orbitalX),orbitalY:Sh(n.orbitalY),orbitalZ:Sh(n.orbitalZ),speedOverLifetime:Sh(n.speedOverLifetime)};Fh(a);var o={options:{startColor:wh(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=Sh(s.x),u.y=Sh(s.y),u.z=Sh(s.z)):u.z=Sh(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:Sh(h.opacity)};h.color&&(l.color=Oh(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:Sh(c.size),x:Sh(c.x),y:Sh(c.y),z:Sh(c.z)}),o}var dl="2.9.2",pl=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,ml=/^(\d+)\.(\d+)$/,vl=!1;function yl(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,a,o=null!=(n=pl.exec(r))?n:[],s=null!=(a=pl.exec(dl))?a:[],u=o[1],h=o[2],l=s[1],c=s[2];return Number(l)<Number(u)||Number(l)===Number(u)&&Number(c)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+dl+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Pt.mesh&&t.type!==Pt.light||(t.endBehavior=1===t.endBehavior?Bt.destroy:t.endBehavior)}))}))}(t),pl.test(t.version))return vl="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),el(tl($h(Jh(Qh(Kh(qh(Zh(function(t){var e;gl=bt["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(gl=bt["1_3"]);var r,n=(t.requires||[]).slice(),a=t.images.map((function(e,i){return xl(e,i,t.imageTags||[])})),o=t.textures||a.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:gl,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return bl(t,{plugins:i,requires:n})})),images:a,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:o,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t)))))))));vl=!1;var r=ml.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]);if(n)return(n<2||2===n&&a<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=_e(t.items);!(e=i()).done;)sl(e.value.content)})),t}(t)),n<3&&(t=qh(Zh(t))),r=ml.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]),n<4&&(a<2&&(t=Kh(t)),a<3&&(t=Qh(t)),a<4&&(t=Jh(t)),a<5&&(t=$h(t)),a<6&&(t=tl(t)),a<7&&(t=el(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var gl=bt["1_0"];function xl(t,e,i){var r=i[e];if("string"==typeof t)return{id:ct(),renderLevel:r,url:t};if(t.template)return{id:ct(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:ct(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:ct(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function bl(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:He({clipMode:ne},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Sl(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 Tl,El=[0,0,0,1],_l=.5;function Sl(t,e){var i;void 0===e&&(e={});var r,n,a,o,s,u,h=Pt.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||Pt.plugin,u=t.pn,s=t.pluginName,a=t.content,n=t.content,isNaN(u)&&!s&&(s=a.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=Pt.particle,r=y((n=t.particle).transform,vl,!0),a=function(t){var e=t.options,i=t.transform,r={type:Ct.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=He({},t.shape,{type:Ct[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=Mh(e.turbulenceX),r.turbulenceY=Mh(e.turbulenceY),r.turbulenceZ=Mh(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return Lh(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return Lh(t)}))),l.rateOverTime&&(l.rateOverTime=Mh(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Mh(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Mh(e.startSize),startSizeX:Mh(e.startSizeX),startSizeY:Mh(e.startSizeY),sizeAspect:Mh(e.sizeAspect),maxCount:e.maxCount,startDelay:Mh(e.startDelay),startColor:Ah(e.startColor,!0),startRotationZ:Mh(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Mh(e.startRotationX),c.options.startRotationY=Mh(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:Nh(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Mh(f.x),y:Mh(f.y)}:c.sizeOverLifetime={size:Mh(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Sh(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Sh(e.gravityModifier),startSpeed:Mh(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Mh(d.linearX),linearY:Mh(d.linearY),linearZ:Mh(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Mh(d.orbitalX),orbitalY:Mh(d.orbitalY),orbitalZ:Mh(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Sh(d.forceCurve)},Fh(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Mh(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Sh(m.y),c.rotationOverLifetime.x=Sh(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Sh(v.opacity)};v.color&&(y.color=Oh(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Sh(g.cycles),animationDelay:Ch(g.animationDelay,0),animationDuration:Ch(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Mh(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Sh(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Oh(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Oh(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:Mh(x.opacityOverLifetime)}),c.trails&&Fh(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=Pt.sprite,a=function(t,e){var i=fl(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=y(n.transform,!1,!0))):t.cal?(h=Pt.null,a=fl(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=Pt.interact,r=y((n=t.ui).transform),a=function(t){var e,i=t.options;switch(i.type){case"click":e={type:At.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&wh(i.previewColor),behavior:i.behavior||Mt.NOTIFY};break;case"drag":e={type:At.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:At.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=Pt.camera,r=y(n.transform),a=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var a,o={path:Nh(null==(a=t.transform)?void 0:a.path),linearX:Sh(null==n?void 0:n.translateX),linearY:Sh(null==n?void 0:n.translateY),linearZ:Sh(null==n?void 0:n.translateZ)};Fh(o),r.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:Sh(null==s?void 0:s.rotateX),y:Sh(null==s?void 0:s.rotateY),z:s.separateAxes?Sh(null==s?void 0:s.rotateZ):Sh(s.rotation)};Fh(u),r.rotationOverLifetime=u}return r}(n))),null==(i=a.renderer)?void 0:i.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==_l&&f[1]==_l?delete a.renderer.anchor:e.requires&&_h(e.requires,"anchor")}if(n){var d,p,m=null==(d=n.options)?void 0:d.looping;if(m)l=Array.isArray(m)?m[1]?Bt.restart:Bt.destroy:Bt.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||Bt.destroy;n.options.renderLevel&&(o=n.options.renderLevel),isNaN(c)&&(c=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:c,id:t.id+"",transform:r,endBehavior:l,renderLevel:o,content:a};return s?e.plugins?(_h(e.plugins,s),v.pn=e.plugins.indexOf(s)):v.pluginName=s:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var a=(o=El,s=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=kh(s*zh/2),c=kh(u*zh/2),f=kh(h*zh/2),d=Dh(s*zh/2),p=Dh(u*zh/2),m=Dh(h*zh/2),o[0]=d*c*f+l*p*m,o[1]=l*p*f-d*c*m,o[2]=l*c*m+d*p*f,o[3]=l*c*f-d*p*m,o);r.rotation=function(t,e){var i,r,n,a=e[0],o=e[1],s=e[2],u=e[3],h=a+a,l=o+o,c=s+s,f=a*h,d=o*h,p=o*l,m=s*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=s*h-u*l,E=s*l+u*h,_=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Bh,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Bh,t[2]=Math.atan2(x,y)*Bh):(t[0]=0,t[2]=Math.atan2(-g,b)*Bh),t}([],a)}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}var o,s,u,h,l,c,f,d,p,m;return{}}}var Cl,wl=((Tl={})[Tt.S]=[Tt.S,Tt.BPlus,Tt.APlus],Tl[Tt.A]=[Tt.A,Tt.BPlus,Tt.APlus],Tl[Tt.B]=[Tt.B,Tt.BPlus],Tl);function Al(t,e){if(!t||!e)return!0;var i=wl[e];return!!i&&i.includes(t)}function Ml(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 Pl(t,e,i){return Il.apply(this,arguments)}function Il(){return(Il=r((function(t,i,r){var a,s;return o(this,(function(o){switch(o.label){case 0:return"string"!=typeof t?[3,2]:[4,tr(t)];case 1:return a=o.sent(),[3,3];case 2:a=t,o.label=3;case 3:if(!a)throw new Error("Image not provided.");if(!i)return[2,a];if(s=Ml(i,r)){if(it(s)&&s!==a.src)return[2,tr(s)];if(n(s,e.HTMLImageElement))return[2,s]}return[2,a]}}))}))).apply(this,arguments)}exports.Scene=void 0,(Cl=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return at(t)&&"jsonScene"in t},Cl.isURL=function(t){return at(t)&&"url"in t},Cl.isWithOptions=function(t){return at(t)&&"options"in t};var Rl=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},Ol=1,Nl=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Yi),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=Ol++,this.timers=[],this.updateOptions(t)}var i=t.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},i.loadScene=function(t,i){var n=this;return r((function(){var a,s,u,h,l,c,f,d,p,m,v,y,g;return o(this,(function(x){return s=it(t)?t:n.id,u=e.performance.now(),h=[],l=null==i?void 0:i.engine.gpuCapability,f=null!=(c=null==l?void 0:l.detail.ktx2Support)&&c,d={},m=!1,v=new Promise((function(t,i){p=e.window.setTimeout((function(){m=!0,n.removeTimer(p);var t=e.performance.now()-u;i(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+h.join(" ")+", url: "+s+"."))}),1e3*n.timeout),n.timers.push(p)})),y=r((function(t,i){var r,n,a,s;return o(this,(function(o){switch(o.label){case 0:if(m)return[3,4];r=e.performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i()];case 2:return n=o.sent(),a=e.performance.now()-r,h.push("["+t+": "+a.toFixed(2)+"]"),d[t]=a,[2,n];case 3:throw s=o.sent(),new Error("Load error in "+t+", "+s+".");case 4:throw new Error("Load canceled.")}}))})),g=r((function(){var i,r,l,c,m,v,g,x,b,T,E,_,S,C,w;return o(this,(function(o){switch(o.label){case 0:return it(t)?(r=new e.URL(t,e.location.href).href,n.baseUrl=r,[4,y("loadJSON",(function(){return n.loadJSON(r)}))]):[3,2];case 1:return it(a=o.sent())&&(a=JSON.parse(a)),[3,3];case 2:a=t,n.baseUrl=e.location.href,o.label=3;case 3:return exports.Scene.isJSONObject(a)?(i=He({},a),[3,9]):[3,4];case 4:return[4,y("processJSON",(function(){return n.processJSON(a)}))];case 5:return v=o.sent().jsonScene,i={timeInfos:d,url:t,storage:{},jsonScene:v,bins:[],textureOptions:[],images:[],assets:n.assets},[4,y("plugin:onAssetsLoadStart",(function(){return n.onPluginSceneLoadStart(i)}))];case 6:return o.sent(),g=v.bins,x=void 0===g?[]:g,b=v.images,T=v.fonts,[4,Promise.all([y("processBins",(function(){return n.processBins(x)})),y("processImages",(function(){return n.processImages(b,f)})),y("processFontURL",(function(){return n.processFontURL(T)}))])];case 7:return E=o.sent(),_=E[0],S=E[1],[4,y("processTextures",(function(){return n.processTextures(S,_,v)}))];case 8:C=o.sent(),(l=i.bins).push.apply(l,[].concat(_)),(c=i.textureOptions).push.apply(c,[].concat(C)),(m=i.images).push.apply(m,[].concat(S)),i.renderLevel=n.options.renderLevel,o.label=9;case 9:return w=e.performance.now()-u,tt.info("Load asset: totalTime: "+w.toFixed(4)+"ms "+h.join(" ")+", url: "+s+"."),e.window.clearTimeout(p),n.removeTimer(p),i.totalTime=w,i.startTime=u,i.timeInfos=d,[2,i]}}))})),[2,Promise.race([v,g()])]}))}))()},i.getAssets=function(){return this.assets},i.processJSON=function(t){return r((function(){var e,i,r,n,a;return o(this,(function(o){for(e=yl(t),i=e.plugins,r=_e(void 0===i?[]:i);!(n=r()).done;)if(a=n.value,!pt[a])throw new Error("The plugin '"+a+"' not found."+xt(a));return[2,{jsonScene:e}]}))}))()},i.processBins=function(t){var i=this;return r((function(){var r,a,s;return o(this,(function(o){return r=i.options.renderLevel,a=i.baseUrl,s=t.map((function(o){if(n(o,ArrayBuffer))return o;if(Al(o.renderLevel,r))return i.loadBins(new e.URL(o.url,a).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(s)]}))}))()},i.processFontURL=function(e){var i=this;return r((function(){return o(this,(function(r){return[2,t.loadFontFamily(e,i.baseUrl)]}))}))()},i.processImages=function(t,i){void 0===i&&(i=!1);var a=this;return r((function(){var s,u,h,l,c,f,d,p;return o(this,(function(m){switch(m.label){case 0:return s=a.options,u=s.useCompressedTexture,h=s.variables,l=s.disableWebP,c=s.disableAVIF,f=a.baseUrl,d=t.map(r((function(t,r){var s,d,p,m,v,y,g,x,b,T,E,_,S,C,w,A,M,P,I,R;return o(this,(function(r){switch(r.label){case 0:if(s=t.url,d=t.webp,p=t.avif,m=t.ktx2,v=new e.URL(s,f).href,y=!l&&d?new e.URL(d,f).href:void 0,g=!c&&p?new e.URL(p,f).href:void 0,x=m&&u&&i?new e.URL(m,f).href:void 0,b=t.id,!("template"in t))return[3,8];if(T=t.template,!(E=T.background))return[3,7];_=Ml(T,h),S=E.type===ce.video,C=E&&S?ar:tr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,sr(_,C)];case 2:return n(w=r.sent(),e.HTMLVideoElement)?(a.sourceFrom[b]={url:w.src,type:exports.TextureSourceType.video},[2,w]):[3,3];case 3:return E&&Array.isArray(_)&&h&&(h[E.name]=w.src),a.sourceFrom[b]={url:w.src,type:exports.TextureSourceType.image},[4,Pl(w,T,h)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw A=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(S?"video":"image")+" type, URL: "+_+", Error: "+(A.message||A)+".");case 7:return[3,9];case 8:if("ktx2"in t&&x)return a.sourceFrom[b]={url:x,type:exports.TextureSourceType.compressed},[2,a.loadBins(x)];if(n(t,e.HTMLImageElement)||n(t,e.HTMLCanvasElement)||n(t,e.HTMLVideoElement)||n(t,pr))return[2,t];r.label=9;case 9:return g?[4,Ji(v,g)]:[3,11];case 10:return R=r.sent(),[3,13];case 11:return[4,Ki(v,y)];case 12:R=r.sent(),r.label=13;case 13:return P=(M=R).url,I=M.image,a.sourceFrom[b]={url:P,type:exports.TextureSourceType.image},[2,I]}}))}))),[4,Promise.all(d)];case 1:return p=m.sent(),a.assignImagesToAssets(t,p),[2,p]}}))}))()},i.onPluginSceneLoadStart=function(t){var e=this;return r((function(){return o(this,(function(i){switch(i.label){case 0:return[4,yt.onAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}}))}))()},i.processTextures=function(t,e,i){var a=this;return r((function(){var s,u,h;return o(this,(function(l){return u=null!=(s=i.textures)?s:t.map((function(t,e){return{source:e}})),h=u.map(r((function(t,r){var s,u,h,l,c,f;return o(this,(function(o){switch(o.label){case 0:if(n(t,pr))return[2,t];if(!("mipmaps"in t))return[3,4];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,hr(t,e,a.assets,i.bins)];case 2:return[2,o.sent()];case 3:throw s=o.sent(),new Error("Load texture "+r+" fails, error message: "+s+".");case 4:return u=t.source,h=t.id,c="",at(u)?(l=a.assets[u.id],c=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,tr(ft(u))];case 6:l=o.sent(),o.label=7;case 7:return l?[4,Ll(l,a.sourceFrom[c],h)]:[3,9];case 8:return[2,(f=o.sent()).sourceType===exports.TextureSourceType.compressed?f:He({},f,t)];case 9:throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(h)]}))}))()},i.loadJSON=function(t){var e=this;return r((function(){return o(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 r((function(){return o(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 e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(i,n){return void 0===n&&(n=e.location.href),r((function(){var a;return o(this,(function(s){return i?(a=i.map(r((function(i){var r,a,s;return o(this,(function(o){switch(o.label){case 0:if(!i.fontURL||t.fontCache.has(i.fontFamily))return[3,4];Z(i.fontFamily)||console.warn("Risky font family: "+i.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new e.URL(i.fontURL,n).href,[4,(s=new FontFace(null!=(a=i.fontFamily)?a:"","url("+r+")")).load()];case 2:return o.sent(),e.document.fonts.add(s),t.fontCache.add(i.fontFamily),[3,4];case 3:return o.sent(),tt.warn("Invalid font family or font source: "+JSON.stringify(i.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(a)]):[2]}))}))()},t.loadPrecomposition=function(e,i){return r((function(){var r;return o(this,(function(n){switch(n.label){case 0:return[4,new t(i).loadScene(e)];case 1:return r=n.sent(),[2,new Rl(r,i)]}}))}))()},t}();function Ll(t,e,i){return Fl.apply(this,arguments)}function Fl(){return(Fl=r((function(t,i,r){var a,s,u,h,l;return o(this,(function(o){switch(o.label){case 0:return a={id:r,dataType:pe.Texture},n(t,pr)?[2,He({},t.source,a)]:[3,1];case 1:return n(t,e.HTMLImageElement)||st(t)?[2,He({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:Di.LINEAR,magFilter:Di.LINEAR},a)]:[3,2];case 2:return n(t,e.HTMLVideoElement)?[2,He({sourceType:exports.TextureSourceType.video,video:t,minFilter:Di.LINEAR,magFilter:Di.LINEAR},a)]:[3,3];case 3:if(!n(t,ArrayBuffer))return[3,10];if(!(s=br.getLoader("ktx2")))return[3,8];o.label=4;case 4:return o.trys.push([4,6,,7]),[4,s.loadFromBuffer(t)];case 5:return u=o.sent(),tt.info("Loading KTX2 texture."),[2,He({sourceType:u.sourceType,type:u.type,target:u.target,internalFormat:u.internalFormat,format:u.format,mipmaps:u.mipmaps,minFilter:Di.LINEAR,magFilter:Di.LINEAR,sourceFrom:i},a)];case 6:throw h=o.sent(),new Error("Failed to parse KTX2 from "+(null!=(l=null==i?void 0:i.url)?l:"buffer")+": "+(h.message||h));case 7:return[3,9];case 8:throw new Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in t&&"height"in t&&"data"in t)return[2,He({sourceType:exports.TextureSourceType.data,data:t,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE,minFilter:Di.NEAREST,magFilter:Di.NEAREST},a)];o.label=11;case 11:throw new Error("Invalid texture options.")}}))}))).apply(this,arguments)}Nl.fontCache=new Set;var Vl=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(i=t.url),exports.Scene.isWithOptions(t)&&(e=He({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===Pt.text||t.type===Pt.richtext){var r=e[t.name];if(null==r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==pe.TextComponent&&(null==n?void 0:n.dataType)!==pe.RichTextComponent||(n.options.text=r)}))}}))},e.prepareAssets=function(t,e){for(var i,r=_e(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new xh(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=_e(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},e.createShaderVariant=function(){for(var t,e=_e(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];n(r,zr)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=_e(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),kl=new S(1,1,1),Dl=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new rn,this.viewportMatrix=wr.fromIdentity(),this.viewMatrix=wr.fromIdentity(),this.projectionMatrix=wr.fromIdentity(),this.viewProjectionMatrix=wr.fromIdentity(),this.inverseViewMatrix=wr.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,a=void 0===n?20:n,o=e.fov,s=void 0===o?60:o,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?kt.portrait:l,f=e.position,d=void 0===f?[0,0,8]:f,p=e.rotation,m=void 0===p?[0,0,0]:p,v=new Ar(m[0],m[1],m[2]),y=(new Ke).setFromEuler(v);this.options={near:r,far:a,fov:s,aspect:h,clipMode:c},this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.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 S(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 S(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new S(-1,-1,a)),l=h.x,c=h.y;return new S((s-l)/2,(u-c)/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 He({},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*y,r,n,a,o===kt.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),kl),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:wr.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 S,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=.5*(i.x+1)*a,i.y=.5*(i.y+1)*o,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new S,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},Pi(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}();function zl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Bl,Ul=function(){function t(){this.update=new jl,this.lateUpdate=new Xl,this.preRender=new Wl}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==Ii.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==Ii.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==Ii.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==Ii.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==Ii.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==Ii.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Gl=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}(),jl=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=_e(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(Gl),Xl=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=_e(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(Gl),Wl=function(t){function e(){return t.apply(this,arguments)}return Vt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=_e(t);!(i=r()).done;){i.value.onPreRender()}},e}(Gl),Hl=function(t){function i(i,r,a){var o;(o=t.call(this)||this).engine=i,o.sceneTicking=new Ul,o.speed=1,o.isEnded=!1,o.loaderData={},o.startTime=0,o.videos=[],o.postProcessingEnabled=!1,o.destroyed=!1,o.paused=!0,o.isEndCalled=!1,o._textures=[];var s=null!=r?r:{},u=s.reusable,h=void 0!==u&&u,l=s.speed,c=void 0===l?1:l,f=s.baseRenderOrder,d=void 0===f?0:f,p=s.event,m=s.onItemMessage;o.engine.addComposition(zl(o));var v,y,g,x,b,T,E,_=null;if(a){var S,C;o.createTexturesFromData(a.textureOptions);for(var w,A=_e(Object.keys(a.assets));!(w=A()).done;){var M=w.value,P=a.assets[M];n(P,e.HTMLVideoElement)&&o.videos.push(P)}o.postProcessingEnabled=null!=(C=null==(S=a.jsonScene.renderSettings)?void 0:S.postProcessingEnabled)&&C,o.engine.renderLevel=a.renderLevel,h&&(a.consumed=!0),_=a.jsonScene.compositions[0];for(var I,R=_e(a.jsonScene.compositions);!(I=R()).done;){var O=I.value;O.id===a.jsonScene.compositionId&&(_=O)}Y(_)}return o.rootItem=new exports.VFXItem(o.engine),_&&(o.rootItem.setInstanceId(_.id),o.rootItem.instantiatePreComposition(_,!1)),o.rootItem.name="rootItem",o.rootItem.composition=zl(o),o.rootComposition=null!=(v=o.rootItem.getComponent(exports.CompositionComponent))?v:o.rootItem.addComponent(exports.CompositionComponent),o.rootComposition.updateMode=exports.UpdateModes.Manual,o.rootComposition.play(),o.rootItem.on("animationevent",(function(t){o.emit("animationevent",t)})),o.renderOrder=d,o.id=null!=(y=null==_?void 0:_.id)?y:ct(),o.startTime=null!=(g=null==_?void 0:_.startTime)?g:0,o.event=p,o.statistic={loadStart:null!=(x=null==a?void 0:a.startTime)?x:0,loadTime:null!=(b=null==a?void 0:a.totalTime)?b:0,compileTime:0,firstFrameTime:0},o.reusable=h,o.speed=c,o.name=null!=(T=null==_?void 0:_.name)?T:"New Composition",o.camera=new Dl(o.name,He({},null==_?void 0:_.camera,{aspect:o.width/o.height})),o.camera.engine=o.engine,o.url=null!=(E=null==a?void 0:a.url)?E:"",o.interactive=!0,m&&(o.onItemMessage=m),o.createRenderFrame(),yt.initializeComposition(zl(o),a),o}Vt(i,t);var a=i.prototype;return a.getDuration=function(){return this.rootItem.duration},a.restart=function(){this.reset(),this.forwardTime(this.startTime)},a.setIndex=function(t){this.renderOrder=t},a.getIndex=function(){return this.renderOrder},a.setSpeed=function(t){this.speed=t},a.setVisible=function(t){this.rootItem.setVisible(t)},a.getSpeed=function(){return this.speed},a.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},a.pause=function(){this.paused=!0,this.emit("pause")},a.getPaused=function(){return this.paused},a.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},a.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},a.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},a.createRenderFrame=function(){this.renderFrame=new Co({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},a.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)},a.addItem=function(t){t.setParent(this.rootItem)},a.getComponent=function(t){return this.rootItem.getComponent(t)},a.forwardTime=function(t){var e=1e3*t-1e3*this.time;this.update(e)},a.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},a.prepareRender=function(){},a.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.rootItem.awake(),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.rootComposition.setChildrenRenderOrder(0),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},a.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Bt.destroy&&!this.reusable},a.updateCamera=function(){this.camera.updateMatrix()},a.updateCompositionTime=function(t){if(this.rootComposition.state===exports.PlayState.Playing&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e>=i)switch(n=!0,r){case Bt.restart:e%=i,this.restart();break;case Bt.freeze:e=Math.min(i,e);case Bt.forward:case Bt.destroy:}this.rootComposition.tick(e+this.startTime-this.rootComposition.getTime()),this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},a.createTexturesFromData=function(t){for(var e,i=_e(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},a.getItemByName=function(t){return this.rootItem.find(t)},a.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return yn((t-i.z)/r,(e-i.w)/n,this.camera)},a.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},a.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.rootItem.hitTest(a,t,e,n,[],i,r),n},a.addInteractiveItem=function(t,e){if(e===At.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},a.removeInteractiveItem=function(t,e){e===At.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}))},a.destroyItem=function(t){},a.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},a.dispose=function(){var t=this;if(!this.destroyed){this.destroyed=!0;for(var e,i=_e(this.textures);!(e=i()).done;){e.value.dispose()}this._textures=[];for(var r,n=_e(this.videos);!(r=n()).done;){var a=r.value;a.pause(),a.removeAttribute("src"),a.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),yt.destroyComposition(this),this.update=function(){tt.error("Update disposed composition: "+t.name+".")},this.dispose=et,this.renderer.engine.removeComposition(this),this.engine.env!==qr&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},a.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},a.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},a.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},a.translate=function(t,e,i){this.rootItem.translate(t,e,i)},a.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},a.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},a.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},a.scale=function(t,e,i){this.rootItem.scale(t,e,i)},a.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},a.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},a.reloadTexture=function(){var t=this;return r((function(){return o(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},Pi(i,[{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:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootItem.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}(Qr),Yl=new Int32Array(2),Zl=new Float32Array(Yl.buffer),ql=new Float64Array(Yl.buffer),Kl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Bl||(Bl={}));var Ql=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var i=t.prototype;return i.clear=function(){this.position_=0},i.bytes=function(){return this.bytes_},i.position=function(){return this.position_},i.setPosition=function(t){this.position_=t},i.capacity=function(){return this.bytes_.length},i.readInt8=function(t){return this.readUint8(t)<<24>>24},i.readUint8=function(t){return this.bytes_[t]},i.readInt16=function(t){return this.readUint16(t)<<16>>16},i.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},i.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},i.readUint32=function(t){return this.readInt32(t)>>>0},i.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readFloat32=function(t){return Yl[0]=this.readInt32(t),Zl[0]},i.readFloat64=function(t){return Yl[Kl?0:1]=this.readInt32(t),Yl[Kl?1:0]=this.readInt32(t+4),ql[0]},i.writeInt8=function(t,e){this.bytes_[t]=e},i.writeUint8=function(t,e){this.bytes_[t]=e},i.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.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},i.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},i.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},i.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},i.writeFloat32=function(t,e){Zl[0]=e,this.writeInt32(t,Yl[0])},i.writeFloat64=function(t,e){ql[0]=e,this.writeInt32(t,Yl[Kl?0:1]),this.writeInt32(t+4,Yl[Kl?1:0])},i.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new 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},i.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},i.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},i.__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===Bl.UTF8_BYTES?r:this.text_decoder_.decode(r)},i.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},i.__indirect=function(t){return t+this.readInt32(t)},i.__vector=function(t){return t+this.readInt32(t)+4},i.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},i.__has_identifier=function(t){if(4!=t.length)throw new 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},i.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},i.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}(),Jl=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=Ql.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=1+~(this.bb.capacity()-this.space+i)&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 new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new 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 new 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=2*(i+2);this.addInt16(r);var n=0,a=this.space;t: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 t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var a=3;a>=0;a--)this.writeInt8(n.charCodeAt(a))}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 new 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){return null==t?0:(e=n(t,Uint8Array)?t: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());var e},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)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}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 new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=Ql.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),$l=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 tc(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}(),tc=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=$l.createDataVector(t,this.data);return $l.createFBEffectsObjectData(t,e,i)},t}(),ec=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 $l).__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 ic(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}(),ic=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=ec.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return ec.createFBEffectsPackageData(t,e)},t}(),rc=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 nc(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}(),nc=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 rc.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ac=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 oc(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}(),oc=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 ac.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sc=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 ac).__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 uc(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}(),uc=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=sc.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sc.createFBVertexData(t,this.vertexCount,e)},t}(),hc=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 sc).__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 rc).__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 lc(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}(),lc=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=hc.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=hc.createBinaryDataVector(t,this.binaryData),s=hc.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=hc.createInverseBindMatricesVector(t,this.inverseBindMatrices);return hc.startFBGeometryData(t),hc.addId(t,e),hc.addName(t,i),hc.addVertexData(t,r),hc.addIndexFormat(t,this.indexFormat),hc.addIndexOffset(t,this.indexOffset),hc.addSubMeshes(t,n),hc.addMode(t,this.mode),hc.addBuffer(t,a),hc.addBinaryData(t,o),hc.addBoneNames(t,s),hc.addRootBoneName(t,u),hc.addInverseBindMatrices(t,h),hc.endFBGeometryData(t)},t}(),cc=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 Jl(1),i=new ic,r=[],n=_e(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===pe.Geometry&&(o=new tc("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,ec.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new Ql(t),i=ec.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===pe.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new Jl(1),i=new lc,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=void 0===u?[]:u,l=t.rootBoneName,c=void 0===l?"":l,f=t.inverseBindMatrices,d=void 0===f?[]:f,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=h,i.rootBoneName=c,i.inverseBindMatrices=d,i.binaryData=m;var v=new uc;v.vertexCount=s.vertexCount,v.channels=[];for(var y,g=_e(s.channels);!(y=g()).done;){var x=y.value,b=x.semantic,T=x.offset,E=x.format,_=x.dimension,S=x.normalize,C=new oc(b,T,E,_,S);v.channels.push(C)}i.vertexData=v;for(var w,A=[],M=_e(t.subMeshes);!(w=M()).done;){var P=w.value,I=P.offset,R=P.indexCount,O=P.vertexCount,N=new nc(I,R,O);A.push(N)}return i.subMeshes=A,ec.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new Ql(t),i=hc.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var a=0;a<n.channelsLength();a++){var o=n.channels(a);if(o){var s,u={semantic:null!=(s=o.semantic())?s:"",offset:o.offset(),format:o.format(),dimension:o.dimension(),normalize:o.normalize()};r.channels.push(u)}}}for(var h=[],l=0;l<i.subMeshesLength();l++){var c=i.subMeshes(l);if(c){var f={offset:c.offset(),vertexCount:c.vertexCount(),indexCount:c.indexCount()};h.push(f)}}for(var d=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);d.push(m)}var v,y,g,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:h,mode:i.mode(),buffer:null!=(v=i.buffer())?v:"",boneNames:d,rootBoneName:null!=(y=i.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=i.binaryDataArray())?g:void 0,id:null!=(x=i.id())?x:"",dataType:pe.Geometry}},t}(),fc=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var i=t.prototype;return i.getFPS=function(){return this.targetFPS},i.setFPS=function(t){this.targetFPS=E(t,1,120),this.interval=Math.floor(1e3/t)-2},i.getPaused=function(){return this.paused},i.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var i=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},r=function(){t.intervalId=i(r),t.paused||t.tick()};r()}},i.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},i.pause=function(){this.paused=!0,this.dt=0},i.resume=function(){this.paused=!1,this.dt=0},i.tick=function(){if(!this.paused){var t=e.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 i,r=_e(this.tickers);!(i=r()).done;){var n=i.value;n(this.dt)}}}},i.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},Pi(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),dc=function(t){function i(e,i){var r,n,a,o,s,u;return(r=t.call(this)||this).name="NewEngine",r.speed=1,r.displayScale=1,r.offscreenMode=!1,r.renderErrors=new Set,r.compositions=[],r.assetManagers=[],r.env="",r.ticker=null,r._disposed=!1,r.textures=[],r.materials=[],r.geometries=[],r.meshes=[],r.renderPasses=[],r.clearAction={stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]},r.canvas=e,r.env=null!=(n=null==i?void 0:i.env)?n:"",r.name=null!=(a=null==i?void 0:i.name)?a:r.name,r.pixelRatio=null!=(o=null==i?void 0:i.pixelRatio)?o:O(),r.jsonSceneData={},r.objectInstance={},r.whiteTexture=yr(zl(r)),r.transparentTexture=gr(zl(r)),(null==i?void 0:i.manualRender)||(r.ticker=new fc(null==i?void 0:i.fps),r.runRenderLoop(r.mainLoop.bind(zl(r)))),r.eventSystem=new Yo(zl(r),null!=(s=null==i?void 0:i.notifyTouch)&&s),r.eventSystem.enabled=null!=(u=null==i?void 0:i.interactive)&&u,r.eventSystem.bindListeners(r.canvas),r.assetLoader=new Th(zl(r)),r.assetService=new Vl(zl(r)),r.renderTargetPool=new Io(zl(r)),r.renderingData={currentFrame:{}},r}Vt(i,t);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 ot(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=void 0===r?[]:r,a=i.items,o=void 0===a?[]:a,s=i.materials,u=void 0===s?[]:s,h=i.shaders,l=void 0===h?[]:h,c=i.geometries,f=void 0===c?[]:c,d=i.components,p=void 0===d?[]:d,m=i.animations,v=void 0===m?[]:m,y=i.bins,g=void 0===y?[]:y,x=i.miscs,b=void 0===x?[]:x,T=_e(i.compositions);!(e=T()).done;){var E=e.value;this.addEffectsObjectData(E)}for(var _,S=_e(o);!(_=S()).done;){var C=_.value;Al(C.renderLevel,t.renderLevel)||(C.components=[],C.type=Pt.null),this.addEffectsObjectData(C)}for(var w,A=_e(u);!(w=A()).done;){var M=w.value;this.addEffectsObjectData(M)}for(var P,I=_e(l);!(P=I()).done;){var R=P.value;this.addEffectsObjectData(R)}for(var O,N=_e(f);!(O=N()).done;){var L=O.value;this.addEffectsObjectData(L)}for(var F,V=_e(p);!(F=V()).done;){var k=F.value;this.addEffectsObjectData(k)}for(var D,z=_e(v);!(D=z()).done;){var B=D.value;this.addEffectsObjectData(B)}for(var U,G=_e(b);!(U=G()).done;){var j=U.value;this.addEffectsObjectData(j)}for(var X=0;X<g.length;X++){var W=g[X],H=t.bins[X];if(W.dataType===pe.BinaryAsset)W.buffer=H,W.id&&this.addEffectsObjectData(W);else{var Y=new cc;Y.deserializeFromBinary(new Uint8Array(H));for(var Z,q=_e(Y.exportObjectDatas);!(Z=q()).done;){var K=Z.value;this.addEffectsObjectData(K)}}}for(var Q,J=_e(n);!(Q=J()).done;){var $=Q.value;this.addEffectsObjectData($)}},r.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},r.mainLoop=function(t){var e,i=this.renderErrors;if(i.size>0)return this.emit("rendererror",i.values().next().value),void(null==(e=this.ticker)||e.pause());t=Math.min(t,33)*this.speed;var r=this.compositions;r.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var n,a,o=!1,s=_e(r);!(n=s()).done;){var u=n.value;u.textureOffloaded?(o=!0,tt.error("Composition "+u.name+" texture offloaded, skip render.")):u.update(t)}if(o)return this.emit("rendererror",new Error("Play when texture offloaded.")),void(null==(a=this.ticker)||a.pause());for(var h,l=_e(r);!(h=l()).done;){h.value.sceneTicking.preRender.tick(0)}this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var c,f=_e(r);!(c=f()).done;){var d=c.value;this.renderer.renderRenderFrame(d.renderFrame)}this.renderTargetPool.flush()},r.resize=function(){var t,i,r,n,a=this.canvas.parentElement;if(a){var o=this.getTargetSize(a);t=o[0],i=o[1],r=o[2],n=o[3]}else t=r=this.canvas.width,i=n=this.canvas.height;var s=t/i;if(t&&i){var u=e.document.documentElement.clientWidth;r>2*u&&tt.error("DPI overflowed, width "+r+" is more than 2x document width "+u+", see "+Kr["DPI overflowed"]+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(r>h||n>h)&&(tt.error("Container size overflowed "+r+"x"+n+", see "+Kr["Container size overflowed"]+"."),s>1?(r=Math.round(h),n=Math.round(h/s)):(n=Math.round(h),r=Math.round(h*s))),this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",tt.info("Resize engine "+this.name+" ["+r+","+n+","+t+","+i+"]."),this.setSize(r,n)}},r.setSize=function(t,e){var i;this.getWidth()===t&&this.getHeight()===e||(this.canvas.width=t,this.canvas.height=e,this.viewport(0,0,t,e)),null==(i=this.compositions)||i.forEach((function(i){i.camera.aspect=t/e})),this.emit("resize",this)},r.getTargetSize=function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Kr["Container is not an HTMLElement"]+".");var i,r,n=this.displayAspect,a=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),o=0,s=0;(a?(o=parseInt(a.width,10),s=parseInt(a.height,10)):(o=t.clientWidth,s=t.clientHeight),n)?o/s>n?i=(r=s*this.displayScale)*n:r=(i=o*this.displayScale)/n:(i=o,r=s);var u=this.pixelRatio,h=i,l=r;if(i=Math.round(i*u),r=Math.round(r*u),i<1||r<1){if(!this.offscreenMode)throw new Error("Invalid container size "+i+"x"+r+", see "+Kr["Invalid container size"]+".");i=r=h=l=1}return[h,l,i,r]},r.addTexture=function(t){this.disposed||d(this.textures,t)},r.removeTexture=function(t){this.disposed||p(this.textures,t)},r.addMaterial=function(t){this.disposed||d(this.materials,t)},r.removeMaterial=function(t){this.disposed||p(this.materials,t)},r.addGeometry=function(t){this.disposed||d(this.geometries,t)},r.removeGeometry=function(t){this.disposed||p(this.geometries,t)},r.addMesh=function(t){this.disposed||d(this.meshes,t)},r.removeMesh=function(t){this.disposed||p(this.meshes,t)},r.addRenderPass=function(t){this.disposed||d(this.renderPasses,t)},r.removeRenderPass=function(t){this.disposed||p(this.renderPasses,t)},r.addComposition=function(t){this.disposed||d(this.compositions,t)},r.removeComposition=function(t){this.disposed||p(this.compositions,t)},r.getWidth=function(){return 0},r.getHeight=function(){return 0},r.getShaderLibrary=function(){return null},r.bindSystemFramebuffer=function(){},r.viewport=function(t,e,i,r){},r.clear=function(t){},r.drawGeometry=function(t,e,i,r){},r.setSampleAlphaToCoverage=function(t){},r.setBlending=function(t){},r.setDepthTest=function(t){},r.setStencilTest=function(t){},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(){var t,e,i;if(!this.disposed){this._disposed=!0;var r=[];this.renderPasses.length>0&&r.push("Pass "+this.renderPasses.length),this.meshes.length>0&&r.push("Mesh "+this.meshes.length),this.geometries.length>0&&r.push("Geom "+this.geometries.length),this.textures.length>0&&r.push("Tex "+this.textures.length),r.length>0&&tt.warn("Release GPU memory: "+r.join(", ")+"."),null==(t=this.ticker)||t.stop(),null==(e=this.eventSystem)||e.dispose(),null==(i=this.assetService)||i.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.compositions.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.compositions=[]}},Pi(i,[{key:"disposed",get:function(){return this._disposed}}]),i}(Qr),pc={format:Di.RGBA,type:Di.UNSIGNED_BYTE,minFilter:Di.LINEAR,magFilter:Di.LINEAR,wrapS:Di.CLAMP_TO_EDGE,wrapT:Di.CLAMP_TO_EDGE},mc=Symbol("dispose"),vc=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,i=t.width,r=t.height,n=t.name,a={sourceType:exports.TextureSourceType.framebuffer,data:{width:i,height:r},name:n},o=[n];Object.getOwnPropertyNames(pc).forEach((function(e){var i,r=null!=(i=t[e])?i:pc[e];a[e]=r,o.push(e,r)}));var s=o.join(":"),u=this.textureCache[s];if(u)this.textureRef[s]++;else{var h=this.engine;Y(h),u=pr.create(h,a),this.textureCache[s]=u,this.textureRef[s]=1,u[mc]=u.dispose,u.dispose=function(){return e.removeTexture(s)}}return u},e.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[mc](),i.dispose=i[mc]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var i=t.textureCache[e];i[mc](),i.dispose=i[mc]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),yc=function(){function t(){}return t.load=function(t,i,n){void 0===n&&(n={});var a=this;return r((function(){var r,s,u,h,l,c,f,d,p,m,v,y,g;return o(this,(function(o){switch(o.label){case 0:return h=e.performance.now(),l=null==(s=i.gpuCapability)||null==(r=s.detail)?void 0:r.asyncShaderCompile,c=i.compositions.length,f=new Nl(n),i.assetManagers.push(f),[4,f.loadScene(t,i.renderer)];case 1:return d=o.sent(),i.clearResources(),yt.onAssetsLoadFinish(d,f.options,i),i.assetService.prepareAssets(d,d.assets),i.assetService.updateTextVariables(d,n.variables),(p=a.createComposition(d,i,n)).setIndex(c),m=e.performance.now(),[4,new Promise((function(t){var e;null==(e=i.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:return o.sent(),v=e.performance.now()-m,null==(u=i.ticker)||u.start(),y=p.name,g=e.performance.now()-h,p.statistic.compileTime=v,p.statistic.firstFrameTime=g,tt.info("First frame ["+y+"]: "+g.toFixed(4)+"ms."),tt.info("Shader "+(l?"async":"sync")+" compile ["+y+"]: "+v.toFixed(4)+"ms."),[2,p]}}))}))()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=new Hl(e,He({},i,{event:e.eventSystem}),t);return e.env!==qr&&e.assetService.createShaderVariant(),r},t}(),gc=function(){function t(){}return t.instantiate=function(t,i){var r=t.scene,a=t.scene.jsonScene,o=t.options,s=i.engine;s.clearResources(),yt.onAssetsLoadFinish(r,o,s),s.assetService.prepareAssets(r,r.assets),s.assetService.updateTextVariables(r,o.variables),i.createTexturesFromData(r.textureOptions);for(var u,h=_e(Object.keys(r.assets));!(u=h()).done;){var l=u.value,c=r.assets[l];n(c,e.HTMLVideoElement)&&i.videos.push(c)}var f=a.compositionId,d=a.compositions.find((function(t){return t.id===f}));if(!d)throw new Error('Composition with id "'+f+'" not found in JSONScene.');var p,m=new exports.VFXItem(s);return m.instantiatePreComposition(d),m.getComponent(exports.CompositionComponent).playOnStart=null==(p=o.autoplay)||p,m.getComponent(exports.CompositionComponent).endBehavior=0,i.addItem(m),m},t}();vt("camera",Go),vt("text",gh),vt("sprite",ts),vt("particle",lh),vt("interact",qo);function xc(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}tt.info("Core version: 2.9.2.");var bc,Tc,Ec=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,a=e.target,o=void 0===a?Di.ARRAY_BUFFER:a,s=e.type,u=void 0===s?Di.FLOAT:s,h=e.usage,l=void 0===h?Di.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=_c[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(u);this.target=o,this.type=u,this.usage=l,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=c,r?this.bufferData(r):n&&this.bufferData(c*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.engine.gl.createBuffer();return xc(e,t),e},e.bind=function(){this.engine.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.engine){this.byteLength=e;var i=this.engine.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.engine){var i=this.engine.gl,r=this.target,n=t*this.bytesPerElement,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.engine.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Ui(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},Pi(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),_c=((bc={})[Di.INT]=Int32Array,bc[Di.FLOAT]=Float32Array,bc[Di.SHORT]=Int16Array,bc[Di.BYTE]=Int8Array,bc[Di.UNSIGNED_BYTE]=Uint8Array,bc[Di.UNSIGNED_INT]=Uint32Array,bc[Di.UNSIGNED_SHORT]=Uint16Array,bc);var Sc=((Tc={})[Uint8Array.BYTES_PER_ELEMENT]=Di.UNSIGNED_BYTE,Tc[Uint16Array.BYTES_PER_ELEMENT]=Di.UNSIGNED_SHORT,Tc[Uint32Array.BYTES_PER_ELEMENT]=Di.UNSIGNED_INT,Tc),Cc=1,wc=function(t){function i(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}Vt(i,t);var r=i.prototype;return r.getOptions=function(){return He({},this.options)},r.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;Y(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new Ec(t.engine,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},r.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},r.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},r.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},r.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,a=e+i.length;if(r.data.length<a){var o=new i.constructor(a);o.set(r.data),r.data=o,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var s=this.dirtyFlags[t];void 0!==s.start&&(s.start=Math.min(s.start,n)),void 0!==s.end&&(s.end=Math.max(s.end,a-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},r.getIndexData=function(){return this.indices},r.setIndexData=function(t){(n(t,Uint8Array)||n(t,Uint16Array)||n(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},r.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var a=new e.constructor(n);a.set(this.indices),this.indices=a,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var o=this.dirtyFlags.index;void 0!==o.start&&(o.start=Math.min(o.start,r)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},r.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*ro[n]},r.getAttributeNames=function(){return this.attributesName},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.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},r.createIndicesBuffer=function(t){var e=Sc[t.BYTES_PER_ELEMENT],i={data:t,target:Di.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new Ec(this.engine,i)},r.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var a,o,s=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,o=r;else{var u=e[n].dataSource;a=t.buffers[u],o=i[u].data}if((s.dirty||s.discard)&&a&&o){if(s.discard)a.bufferData(o);else if(void 0!==s.start&&void 0!==s.end){var h=s.start*o.BYTES_PER_ELEMENT+o.byteOffset,l=s.end-s.start+1,c=new o.constructor(o.buffer,h,l);a.bufferSubData(s.start,c)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)})),this.indicesReleasable}},r.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,a=e.drawCount,o=e.mode,s=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+Cc++:u,l=e.bufferUsage,c=void 0===l?Di.STATIC_DRAW:l;this.name=h;var f={},d=[],p={},m={},v={},y=c;this.drawStart=r,void 0!==a&&(this.drawCount=a),this.mode=isNaN(o)?Di.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,a=i.stride,o=i.offset,s=i.normalize,u=i.type,h=void 0===u?Di.FLOAT:u,l=i.releasable,c=i.data;if(!h||"dataSource"in i||c||(c=ao(h)),c){var g=n(c,Float32Array)?Di.FLOAT:Di.INT;f[t]={data:c,usage:y,target:Di.ARRAY_BUFFER,name:t},p[t]={size:r,stride:a,offset:o,type:null!=h?h:g,normalize:!!s,dataSource:t},v[t]=null!=l&&l,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(p[t]={size:r,stride:a,offset:o,type:h,dataSource:x,normalize:!!s})}d.push(t)})),m.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=!0===(null==s?void 0:s.releasable),this.bufferProps=f,this.attributes=p,this.attributesName=d,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},r.fromData=function(i){var r,n=this;if(t.prototype.fromData.call(this,i),this.subMeshes=i.subMeshes,i.buffer?r=new Uint8Array(function(t){for(var i=e.atob(t),r=new Uint8Array(i.length),n=0;n<i.length;n++)r[n]=i.charCodeAt(n);var a=r.buffer;return a}(i.buffer)):i.binaryData&&(r=i.binaryData),r){var a=i.vertexData.vertexCount;if(this.hasSemantic(i)){var o={mode:Di.TRIANGLES,attributes:{}};if(i.vertexData.channels.forEach((function(t){var e,i=null!=(e=Ac[t.semantic])?e:t.semantic,s=n.createVertexTypedArray(t,r,a);o.attributes[i]={type:ji(t.format),size:t.dimension,data:s,normalize:t.normalize}})),i.indexFormat!==ye.None){var s=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset);o.indices={data:s},o.drawCount=s.length}else o.drawCount=a;this.processProps(o)}else{var u=i.vertexData.channels[0],h=i.vertexData.channels[1],l=i.vertexData.channels[2],c=this.createVertexTypedArray(u,r,a),f=this.createVertexTypedArray(h,r,a),d=this.createVertexTypedArray(l,r,a),p=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset),m={mode:Di.TRIANGLES,attributes:{aPos:{type:ji(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:ji(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:ji(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:i.boneNames,rootBoneName:i.rootBoneName,inverseBindMatrices:i.inverseBindMatrices}}},r.dispose=function(){var e,i=this;(this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized)&&(Object.keys(this.buffers).forEach((function(t){i.buffers[t].dispose()})),this.buffers={},null==(e=this.indicesBuffer)||e.dispose(),Object.keys(this.vaos).forEach((function(t){var e;null==(e=i.vaos[t])||e.dispose(),i.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&this.engine.removeGeometry(this));this.destroyed=!0,t.prototype.dispose.call(this)},r.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case ve.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},r.createIndexTypedArray=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,a=e.byteLength-i;switch(t){case ye.UInt16:return new Uint16Array(r,n,a/Uint16Array.BYTES_PER_ELEMENT);case ye.UInt32:return new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT)}},r.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},Pi(i,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),i}(no),Ac={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var Mc,Pc,Ic=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}Vt(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.engine.gl.createRenderbuffer())},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer.engine,r=i.gl;i.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):tt.error("Invalid render buffer size: "+t+"x"+e+".")}}else tt.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.engine.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=lt},e}(Po),Rc=((Mc={})[Di.RGBA]=34842,Mc[Di.RGB]=34843,Mc[Di.ALPHA]=33325,Mc[Di.RED]=33325,Mc[Di.LUMINANCE_ALPHA]=33327,Mc[Di.LUMINANCE]=33325,Mc),Oc=((Pc={})[Di.RGBA]=34836,Pc[Di.RGB]=34837,Pc[Di.ALPHA]=33326,Pc[Di.RED]=33326,Pc[Di.LUMINANCE_ALPHA]=33328,Pc[Di.LUMINANCE]=33326,Pc),Nc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}Vt(e,t);var i=e.prototype;return i.bind=function(t){this.engine.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){this.engine.addTexture(this);var t=this.engine.gl,e=this.source,i=e.target,r=void 0===i?t.TEXTURE_2D:i,n=e.name;this.textureBuffer=t.createTexture(),xc(this.textureBuffer,n),this.target=r,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case exports.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case exports.TextureSourceType.data:delete this.source.data;break;case exports.TextureSourceType.compressed:case exports.TextureSourceType.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.engine||!this.textureBuffer)return this.width=0,void(this.height=0);var i=this.target,r=this.source,n=this.engine.gl,a=this.engine.gpuCapability.detail,o=r.sourceType,s=r.data,u=r.cube,h=r.image,l=r.video,c=r.mipmaps,f=r.mipmaps,d=t.data,p=t.cube,m=t.generateMipmap,v=void 0!==m&&m,y=t.mipmaps,g=r.format,x=r.type,b=r.internalFormat,T=0,E=0;this.bind(o===exports.TextureSourceType.video),x===Di.HALF_FLOAT?((x=a.halfFloatTexture)||tt.error("Half float texture is not support."),Ui(n)&&b===g&&(g===Di.LUMINANCE&&(g=Di.RED),b=Rc[g]),a.halfFloatLinear||(r.minFilter=r.magFilter=n.NEAREST,tt.warn("Half float linear not support, change to NEAREST."))):x===n.FLOAT&&((x=a.floatTexture)||tt.error("Float texture is not support."),Ui(n)&&b===g&&(g===Di.LUMINANCE&&(g=Di.RED),b=Oc[g]),a.floatLinear||(r.minFilter=n.NEAREST,r.magFilter=n.NEAREST,tt.warn("Float linear not support, change to NEAREST."))),void 0===r.premultiplyAlpha&&(r.premultiplyAlpha=!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),void 0===r.flipY&&(r.flipY=!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,r.flipY);var _,S,C=function(t,e){ut(t)&&ut(e)||Ui(n)?n.generateMipmap(i):console.error("Mipmap generation failed. Texture width and height must be power of two in WebGL1.")};if(o===exports.TextureSourceType.framebuffer)d&&(T=null!=(_=d.width)?_:0,E=null!=(S=d.height)?S:0,T&&E&&(this.width!==T||this.height!==E)&&n.texImage2D(i,0,b,T,E,0,g,x,null));else if(o===exports.TextureSourceType.data){var w;if(i===n.TEXTURE_CUBE_MAP)p.forEach((function(t,i){var r=e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],o=r[1];T=Math.max(a,T),E=Math.max(o,E)}));else w=this.texImage2DData(n,i,0,b,g,x,s),T=w[0],E=w[1],v&&C(T,E)}else if(o===exports.TextureSourceType.image||o===exports.TextureSourceType.video){if(i===n.TEXTURE_CUBE_MAP)u.forEach((function(t,i){var r=e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],o=r[1];T=Math.max(a,T),E=Math.max(o,E)}));else if(i===n.TEXTURE_2D){var A,M=null!=h?h:l;A=this.texImage2D(n,i,0,b,g,x,M),T=A[0],E=A[1]}v&&C(T,E)}else if(o===exports.TextureSourceType.mipmaps){var P;i===n.TEXTURE_2D?c.forEach((function(t,r){var a;(P="data"in t?e.texImage2DData(n,i,r,b,g,x,t):e.texImage2D(n,i,r,b,g,x,t),0===r)&&(T=(a=P)[0],E=a[1])})):i===n.TEXTURE_CUBE_MAP&&f.forEach((function(t,i){t.forEach((function(t,r){var a;(P="data"in t?e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t):e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t),0===i)&&(T=(a=P)[0],E=a[1])}))}))}else o===exports.TextureSourceType.compressed&&y&&0!==y.length&&(T=y[0].width,E=y[0].height,y.forEach((function(t,e){n.compressedTexImage2D(i,e,b,t.width,t.height,0,t.data)})));this.width=T,this.height=E,this.setTextureFilters(n,i,r)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,a=i.wrapS,o=void 0===a?t.CLAMP_TO_EDGE:a,s=i.wrapT,u=void 0===s?t.CLAMP_TO_EDGE:s,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=Ui(t)||ut(this.width)&&ut(this.height),c=i.magFilter?i.magFilter:t.NEAREST,f=i.minFilter?i.minFilter:t.NEAREST;l||f!==t.LINEAR_MIPMAP_LINEAR&&f!==t.LINEAR_MIPMAP_NEAREST&&f!==t.NEAREST_MIPMAP_LINEAR&&f!==t.NEAREST_MIPMAP_NEAREST||(f=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,f),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,l?o:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?u:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,a=r.sourceFrom,o=r.name,s=void 0===o?"":o;this.source=r,this.sourceType=n,this.sourceFrom=a,this.name=s},i.texImage2D=function(t,e,i,r,n,a,o){var s,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(s=this.engine.gpuCapability.detail.maxTextureSize)?s:2048,v=o;if(l!==exports.TextureSourceType.video){var y=c!==t.NEAREST||f!==t.NEAREST||d!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(y=y||o.width>m||o.height>m)&&setTimeout((function(){v=u.resizeImage(o)}))}t.texImage2D(e,i,r,n,a,v);var g=[v.width,v.height];return l===exports.TextureSourceType.video?[o.videoWidth,o.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,a,o){var s=o.data,u=o.width,h=o.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Ui(this.engine.gl)&&t.width<n&&t.height<n)return t;var a=function(t,e,i,r){var n=t.width,a=t.height,o=Math.min(e,i||vn(n)),s=Math.min(e,r||vn(a));if(s!==a||o!==n){var u=ch.getCanvas(),h=u.getContext("2d");return u.width=o,u.height=s,null==h||h.drawImage(t,0,0,n,a,0,0,o,s),tt.warn("Image resize from "+n+"x"+a+" to "+o+"x"+s+"."),u}}(t,n,e,i);return a||t},i.reloadData=function(){var t=this;return r((function(){return o(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Er().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&Er().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.engine.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},i.uploadCurrentVideoFrame=function(){var t=this;return r((function(){return o(this,(function(e){return t.source.sourceType===exports.TextureSourceType.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(He({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.engine&&this.textureBuffer&&this.engine.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){tt.error("This texture has been destroyed.")},this.initialize=lt,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(pr);var Lc=1,Fc=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,a=e.depthStencilAttachment,o=e.viewport,s=e.storeAction,u=e.name,h=void 0===u?"GLFramebuffer"+Lc++:u;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==a?void 0:a.storageType)?n:exports.RenderPassAttachmentStorageType.none,r.viewport=o,r.name=h,r.storeAction=s,r.updateProps(e),r}Vt(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.updateAttachmentTextures=function(){var t=this,e=this.viewport[2],i=this.viewport[3];this.attachmentTextures.length=0,this.colorTextures.forEach((function(r){var n={width:e,height:i,data:new Uint8Array(0)};r.initialize(),r.update({data:n}),d(t.attachmentTextures,r.textureBuffer)})),this.stencilTexture&&d(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&(this.depthTexture.update({data:{width:e,height:i,data:new Uint16Array(0)}}),d(this.attachmentTextures,this.depthTexture.textureBuffer))},i.updateProps=function(t){var e,i,r=this.renderer,a=this.engine.gpuCapability,o=null!=(i=t.depthStencilAttachment)?i:{storageType:exports.RenderPassAttachmentStorageType.none},s=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!a.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,l=a.detail.readableDepthStencilTextures,c=o.storageType,f=o.storage;if(this.colorTextures=t.attachments.slice(),!s&&c!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(s&&(this.fbo=this.engine.createGLFramebuffer(this.name)),c){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!n(f,Ic))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Ic({format:Di.DEPTH_STENCIL,attachment:Di.DEPTH_STENCIL_ATTACHMENT,storageType:c},r);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!n(f,Ic))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Ic({attachment:Di.DEPTH_ATTACHMENT,format:Di.DEPTH_COMPONENT16,storageType:c},r);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!n(f,Ic))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Ic({attachment:Di.STENCIL_ATTACHMENT,format:Di.STENCIL_INDEX8,storageType:c},r);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!l)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Nc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Di.DEPTH_COMPONENT,internalFormat:a.internalFormatDepth16,type:Di.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!l)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Nc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Di.DEPTH_STENCIL,internalFormat:a.internalFormatDepth24_stencil8,type:a.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.engine.gl,r=this.colorTextures.length;if(t&&Ui(i)&&r>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&d(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&d(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var a=0;a<r;a++)d(n,i["COLOR_ATTACHMENT"+a]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.engine.gl;Ui(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.engine.gl,i=this.engine,r=this.viewport,n=r[0],a=r[1],o=r[2],s=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,o,s);var u=this.renderer.engine.whiteTexture,h=u.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==h&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),u.bind())}));for(var l=0;l<4;l++)i.activeTexture(e.TEXTURE0+l),u.bind();if(!this.ready){var c=this,f=c.depthStencilRenderbuffer,d=c.depthTexture,p=c.stencilTexture;if(i.activeTexture(e.TEXTURE0),f)f.setSize(o,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,f.attachment,e.RENDERBUFFER,f.buffer);else if(d){d.source.data={width:o,height:s},d.update({data:{width:o,height:s,data:new Uint16Array(0)}});var m=d&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,m,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(e.FRAMEBUFFER);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+v+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+". width="+o+", height="+s+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.engine.gl,r=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var o,s=_e(e);!(o=s()).done;){o.value.initialize()}this.colorTextures=e.slice()}this.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var o={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:o}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),a.push(!0)})),r.drawBuffers(i,a),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,a=n[0],o=n[1],s=n[2],u=n[3];a===t&&o===e&&s===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){var e;this.engine.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(n===exports.RenderPassDestroyAttachmentType.force||n===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose();for(var a,o=_e(this.colorTextures);!(a=o()).done;){a.value.dispose()}null==(e=this.stencilTexture)||e.dispose(),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},Pi(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(Ka),Vc=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return Ui(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),xc(e,t),e},e.bindVertexArray=function(t){var e;Ui(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Ui(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),kc=function(){function t(t,e,i){this.engine=t,this.program=e,this.id=i,this.engine.useProgram(e),this.attribInfoMap=this.createAttribMap(),this.engine.useProgram(null)}var e=t.prototype;return e.bind=function(){this.engine.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,a=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new Vc(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var o=t.buffers[n.dataSource];if(!o)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");o.bind(),a.enableVertexAttribArray(i.loc),a.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.engine.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=t.getActiveAttrib(e,n);if(a){var o=a.name,s=a.type,u=a.size,h=t.getAttribLocation(e,o);i[o]={type:s,name:o,size:u,loc:h}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),Dc=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}Vt(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.engine.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.engine.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.engine.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.engine.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.engine.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.engine.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.engine.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.engine.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.engine.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.engine.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.engine.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.engine.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.engine.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.engine.getUniforms(this.program.program,t),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var o=i[r];this.samplerChannels[o]=r}},i.toData=function(){var t=this.definition;t.dataType=pe.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var e;this.compileResult&&this.compileResult.shared||(null==(e=this.program)||e.dispose(),t.prototype.dispose.call(this))},i.bind=function(){this.program.bind()},i.isReady=function(){return!!this.program},e}(Fr),zc=0,Bc=function(){function t(t){this.engine=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=t.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=_e(Object.keys(this.cachedShaders));!(i=n()).done;){var a=i.value;this.cachedShaders[a].initialized||r.push(a)}t?r.length?Promise.all(r.map((function(t){return new Promise((function(i){return e.compileShader(e.cachedShaders[t],i)}))}))).then(t).catch((function(){return 0})):t([]):r.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},i.addShader=function(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var a=He({},t,{vertex:To.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:To.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),o=this.computeShaderCacheId(a);if(this.cachedShaders[o])return o;this.shaderAllDone=!1;var s=!1;return(a.shared||a.cacheId)&&(s=!0),this.cachedShaders[o]=new Dc(this.engine,He({},a,{vertex:a.vertex,fragment:a.fragment,name:a.name||o,shared:s})),this.cachedShaders[o].id=o,o},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(t,i){var r=this,n=t.source,a=n.shared,o=n.vertex,s=n.fragment,u=n.name,h=t.source.cacheId,l=!1;(a||h)&&(l=!0);var c=this.engine.gl,f={shared:l,status:exports.ShaderCompileResultStatus.compiling},d=this.createProgram(c,o,s,f),p=this.glAsyncCompileExt,m=e.performance.now(),v=function(i){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=i,t.initialized=!0,void 0!==r.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),r.programMap[t.id]=i},y=function(){if(r.engine.disposed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(t.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&1==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){xc(n,u);var a=new kc(r.engine,n,t.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(a);else{var h=c.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?v(a):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",o,"\nfragment:\n",s),c.deleteProgram(n))}}null==i||i(f)}else i&&e.requestAnimationFrame(y)};t.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,a=t.shared,o=t.cacheId;return a||o?o||"shared_"+Gc(i,n):"instanced_"+zc++},i.createProgram=function(t,e,i,r){var n=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,e),o=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&a&&o?(t.attachShader(n,a),t.attachShader(n,o),t.linkProgram(n),r.program=n,r.status=exports.ShaderCompileResultStatus.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var s=t.getProgramInfoLog(n);console.error("Failed to link program: "+s+".");var u=Uc(t,a,"vertex",e),h=Uc(t,o,"fragment",i);return r.status=exports.ShaderCompileResultStatus.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=exports.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Gc(null!=i?i:""),a=r.get(n);if(a)return a;var o=t.createShader(e);return o&&(t.shaderSource(o,i),t.compileShader(o),r.set(n,o)),o},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.engine){var e=this.engine.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function Uc(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}function Gc(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var a=e[n],o=0;o<a.length;o++)r=Math.imul(31,r)+a.charCodeAt(o)|0;return r}var jc=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],Y(t),this.gl=Li(t,e,i),this.contextLostListener=function(t){for(var e,i,n=_e(r.lostHandlers);!(i=n()).done;){i.value.lost(t)}null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=_e(r.restoreHandlers);!(i=n()).done;){i.value.restore()}null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){var t;(this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl)&&(null==(t=this.gl.getExtension("WEBGL_lose_context"))||t.loseContext());this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),Xc=function(t){function i(i,n){var a;(a=t.call(this,i,n)||this).restoreCompositionsCache=[],n=He({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,glType:"webgl2"},n),a.context=new jc(i,n.glType,n),a.context.addLostHandler({lost:function(t){var e;null==(e=a.ticker)||e.pause(),a.restoreCompositionsCache=a.compositions.slice(),a.compositions.forEach((function(e){return e.lost(t)})),t.preventDefault(),tt.error("WebGL context lost. Event target: "+t.target+"."),a.emit("contextlost",{engine:zl(a),e:t})}});var s=zl(a);a.context.addRestoreHandler({restore:r((function(){var t,i;return o(this,(function(n){switch(n.label){case 0:if(!(i=s.context.gl))throw new Error("Can not restore automatically because losing gl context.");return s.reset(),s.shaderLibrary=new Bc(s),s.gpuCapability=new Oo(i),[4,Promise.all(s.restoreCompositionsCache.map(r((function(t){var e,i,r,n,a,u,h,l,c,f,d;return o(this,(function(o){switch(o.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.reusable,a=t.renderOrder,u=t.transform,h=t.videoState,[4,yc.load(i,s)];case 1:(l=o.sent()).speed=r,l.reusable=n,l.renderOrder=a,l.transform.setPosition(u.position.x,u.position.y,u.position.z),l.transform.setRotation(u.rotation.x,u.rotation.y,u.rotation.z),l.transform.setScale(u.scale.x,u.scale.y,u.scale.z),l.onItemMessage=t.onItemMessage,c=0,o.label=2;case 2:return c<h.length?h[c]?((f=l.textures[c].source.video).currentTime=null!=(d=h[c])?d:0,[4,f.play()]):[3,4]:[3,5];case 3:o.sent(),o.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return n.sent(),s.restoreCompositionsCache=[],null==(t=s.ticker)||t.resume(),F()&&s.canvas&&(s.canvas.style.display="none",e.window.setTimeout((function(){s.canvas.style.display=""}),0)),s.emit("contextrestored",s),[2]}}))}))});var u=a.context.gl;return Y(u),a.gl=u,a.reset(),a.gpuCapability=new Oo(u),a.shaderLibrary=new Bc(zl(a)),a.renderer=new Fo(zl(a)),a.maxTextureCount=a.gl.TEXTURE0+a.gl.getParameter(a.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,a.resize(),a}Vt(i,t);var n=i.prototype;return n.getWidth=function(){return this.gl.drawingBufferWidth},n.getHeight=function(){return this.gl.drawingBufferHeight},n.getShaderLibrary=function(){return this.shaderLibrary},n.createGLFramebuffer=function(t){var e=this.gl.createFramebuffer();if(!e)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return xc(e,t,t),e},n.createVAO=function(t){return new Vc(this,t)},n.deleteGLTexture=function(t){t.textureBuffer&&!this.disposed&&(this.gl.deleteTexture(t.textureBuffer),t.textureBuffer=null)},n.deleteGPUBuffer=function(t){t&&!this.disposed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},n.deleteGLFramebuffer=function(t){t&&!this.disposed&&(this.gl.deleteFramebuffer(t.fbo),delete t.fbo)},n.deleteGLRenderbuffer=function(t){t&&!this.disposed&&(this.gl.deleteRenderbuffer(t.buffer),t.buffer=null)},n.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush();var n=this.renderingData;i.setMatrix("effects_ObjectToWorld",e);try{i.use(this.renderer,n.currentFrame.globalUniforms)}catch(t){return console.error(t),void this.renderErrors.add(t)}var a=this.gl;if(a){var o=t,s=i.shaderVariant.program.setupAttributes(o),u=o.indicesBuffer,h=o.drawStart,l=o.drawCount,c=o.mode,f=o.subMeshes;if(f&&f.length){var d,p=f[r];if(l<0)return;if(h=p.offset,u)l=null!=(d=p.indexCount)?d:0;else l=p.vertexCount}u?a.drawElements(c,l,u.type,null!=h?h:0):a.drawArrays(c,h,l),null==s||s.unbind()}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")}},n.clear=function(t){var e=0;if(t.colorAction===exports.TextureLoadAction.clear){var i=t.clearColor;i&&this.clearColor(i[0],i[1],i[2],i[3]),this.colorMask(!0,!0,!0,!0),e=Di.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(this.stencilMask(255),this.clearStencil(t.clearStencil||0),e|=Di.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var r=t.clearDepth;this.depthMask(!0),this.clearDepth(Number.isFinite(r)?r:1),e|=Di.DEPTH_BUFFER_BIT}e&&this.gl.clear(e)},n.dispose=function(){var e;this.disposed||(t.prototype.dispose.call(this),this.renderer.dispose(),this.renderTargetPool.dispose(),null==(e=this.shaderLibrary)||e.dispose(),this.context.dispose(),this.reset())},n.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Di.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},n.setSampleAlphaToCoverage=function(t){t?this.enable(Di.SAMPLE_ALPHA_TO_COVERAGE):this.disable(Di.SAMPLE_ALPHA_TO_COVERAGE)},n.setBlending=function(t){t?this.enable(Di.BLEND):this.disable(Di.BLEND)},n.setDepthTest=function(t){t?this.enable(Di.DEPTH_TEST):this.disable(Di.DEPTH_TEST)},n.setStencilTest=function(t){t?this.enable(Di.STENCIL_TEST):this.disable(Di.STENCIL_TEST)},n.setCulling=function(t){t?this.enable(Di.CULL_FACE):this.disable(Di.CULL_FACE)},n.setPolygonOffsetFill=function(t){t?this.enable(Di.POLYGON_OFFSET_FILL):this.disable(Di.POLYGON_OFFSET_FILL)},n.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},n.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},n.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},n.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},n.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},n.useProgram=function(t){this.set1("useProgram",t)},n.clearDepth=function(t){this.set1("clearDepth",t)},n.depthFunc=function(t){this.set1("depthFunc",t)},n.depthMask=function(t){this.set1("depthMask",t)},n.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},n.depthRange=function(t,e){this.set2("depthRange",t,e)},n.clearStencil=function(t){this.set1("clearStencil",t)},n.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},n.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},n.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},n.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},n.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},n.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},n.cullFace=function(t){this.set1("cullFace",t)},n.frontFace=function(t){this.set1("frontFace",t)},n.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},n.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},n.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},n.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},n.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},n.blendEquation=function(t){this.set1("blendEquation",t)},n.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},n.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},n.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},n.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},n.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},n.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},n.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),r.x===e&&r.y===i||this.gl[t](r.x=e,r.y=i)},n.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===i&&n.z===r||this.gl[t](n.x=e,n.y=i,n.z=r)},n.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),a.x===e&&a.y===i&&a.z===r&&a.w===n||this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},n.get=function(t){return this.glCapabilityCache[t]},n.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},n.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},n.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},n.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},n.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},n.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},n.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},n.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},n.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},n.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},n.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},n.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},n.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},n.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},n.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},n.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},n.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},i}(dc);function Wc(t,e){return!e||"object"!=((i=e)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)&&"function"!=typeof e?zl(t):e;var i}var Hc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Yc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Zc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",qc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Kc=new Map;var Qc=!1,Jc=1,$c=function(t){function i(i){var n;(n=t.call(this)||this).resumePending=!1,n.disposed=!1,n.lost=function(t){n.handleEmitEvent("webglcontextlost",t)};var a=zl(n);n.restore=r((function(){return o(this,(function(t){return a.emit("webglcontextrestored"),[2]}))}));var s=i.container,u=i.canvas,h=i.fps,l=i.name,c=i.pixelRatio,f=i.manualRender,d=i.renderFramework,p=i.notifyTouch,m=i.onError,v=i.interactive,y=void 0!==v&&v,g=i.renderOptions,x=void 0===g?{}:g,b=i.env,T=void 0===b?"":b,E=x.willCaptureImage,_=x.premultipliedAlpha;if(n.onError=m,Qc||"debug-disable"===d)return Wc(n);var S,C=(S=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===S[1]||"16"===S[1]&&"5"===S[2])?"webgl":"webgl2";d&&(C="webgl"===d?"webgl":"webgl2"),n.env=T,n.name=l||""+Jc++;var w=!1;try{if(ki.length)throw new Error("Errors before player create: "+ki.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?(n.canvas=u,w=!0):(!function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Hc+".")}(s),n.canvas=e.document.createElement("canvas"),s.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.engine=dc.create(n.canvas,{name:l,glType:C,fps:h,env:T,preserveDrawingBuffer:E,premultipliedAlpha:_,manualRender:f,notifyTouch:p,interactive:y,pixelRatio:Number.isFinite(c)?c:O()}),n.engine.offscreenMode=!0,n.engine.on("rendererror",(function(t){n.handleEmitEvent("rendererror",t)})),n.engine.on("contextlost",(function(t){n.lost(t.e)}));var A=zl(n);n.engine.on("contextrestored",r((function(){return o(this,(function(t){switch(t.label){case 0:return[4,A.restore()];case 1:return t.sent(),[2]}}))}))),n.engine.on("click",(function(t){var e=t.behavior||Mt.NOTIFY;n.emit("click",He({},t,{player:zl(n),compositionId:t.composition.id,compositionName:t.composition.name})),e===Mt.RESUME_PLAYER&&n.resume()})),n.engine.on("pointerdown",(function(t){n.emit("pointerdown",t)})),n.engine.on("pointerup",(function(t){n.emit("pointerup",t)})),n.engine.on("pointermove",(function(t){n.emit("pointermove",t)})),n.engine.runRenderLoop((function(t){n.autoPlaying&&n.emit("update",{player:zl(n),playing:!0})})),Kc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&tt.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+qc+".")})),Kc.set(n.canvas,zl(n)),function(){for(var t,e=[],i=_e(Kc.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&tt.error("Current running player count: "+e.length+", see "+Zc+".",e)}()}catch(t){var M;n.canvas&&!w&&n.canvas.remove(),null==(M=n.engine)||M.dispose(),n.disposed=!0,n.handleThrowError(t)}return n}Vt(i,t);var a=i.prototype;return a.setSpeed=function(t){isNaN(t)||(this.engine.speed=t)},a.getSpeed=function(){return this.engine.speed},a.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},a.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},a.getAssetManager=function(){return this.assetManagers},a.loadScene=function(t,e){var i=this;return r((function(){var n,a,s,u,h,l,c,f,d,p;return o(this,(function(m){switch(m.label){case 0:for(Y(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),(a=null==(n=null==e?void 0:e.autoplay)||n)&&(i.autoPlaying=!0),s=[],u=[],rt(t)?(h=s).push.apply(h,[].concat(t)):s.push(t),l=_e(i.assetManagers);!(c=l()).done;)c.value.dispose();return i.engine.assetManagers=[],f=i.engine.compositions.length,[4,Promise.all(s.map(r((function(t,r){var n,s,h,l,c,d,p;return o(this,(function(o){switch(o.label){case 0:return n=f+r,s=i.assetService.assembleSceneLoadOptions(t,He({autoplay:a},e)),h=s.source,l=s.options,d=null==(c=null==l?void 0:l.autoplay)||c,[4,yc.load(h,i.engine,l)];case 1:return(p=o.sent()).setIndex(n),p.onItemMessage=function(t){i.emit("message",t)},u[r]=d,[2,p]}}))}))))];case 1:for(d=m.sent(),p=0;p<d.length;p++)u[p]?d[p].play():d[p].pause();return d.some((function(t){return!t.getPaused()}))&&i.emit("play",{time:0}),[2,rt(t)?d:d[0]]}}))}))()},a.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},a.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.tick(0),this.emit("play",{time:t})},a.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.tick(0),this.emit("pause")},a.playSequence=function(t){for(var e,i=function(e){t[e].on("end",(function(){t[e+1].play()}))},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},a.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),this.compositions.map((function(t){t.pause()})),t&&t.offloadTexture&&this.offloadTexture())},a.resume=function(){var t=this;return r((function(){var e;return o(this,(function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return t.compositions.map((function(t){t.resume()})),null==(e=t.ticker)||e.resume(),[2]}}))}))()},a.tick=function(t){this.engine.mainLoop(t)},a.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},a.resize=function(){this.engine.resize()},a.clearCanvas=function(){this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})},a.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()}))},a.dispose=function(){if(tt.info("Call player destroyed: "+this.name+"."),!this.disposed){Kc.delete(this.canvas),this.pause(),this.engine.dispose(),n(this.canvas,e.HTMLCanvasElement)&&(ch.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var t="Never use destroyed player: "+this.name+" again, see "+Yc+".",i=function(){return function(t){throw new Error(t)}(t)},r=function(){return e=t,Promise.reject(e);var e};this.tick=i,this.resize=i,this.loadScene=r,this.play=r,this.gotoAndPlay=r,this.gotoAndStop=r,this.playSequence=i,this.destroyCurrentCompositions=i,this.resume=r,this.disposed=!0}},a.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},a.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},a.handleEmitEvent=function(t,i){this.onError?n(i,e.Event)?this.onError(new Error(i.type,{cause:t}),i):n(i,Error)?this.onError(new Error(i.message,{cause:t}),i):this.onError(new Error("Unknown error.",{cause:t}),i):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,i))},Pi(i,[{key:"skipPointerMovePicking",get:function(){return this.engine.eventSystem.skipPointerMovePicking},set:function(t){this.engine.eventSystem.skipPointerMovePicking=t}},{key:"ticker",get:function(){return this.engine.ticker}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"gpuCapability",get:function(){return this.engine.gpuCapability}},{key:"compositions",get:function(){return this.engine.compositions}},{key:"assetManagers",get:function(){return this.engine.assetManagers}},{key:"assetService",get:function(){return this.engine.assetService}},{key:"event",get:function(){return this.engine.eventSystem}},{key:"displayAspect",get:function(){return this.engine.displayAspect},set:function(t){this.engine.displayAspect=t}},{key:"displayScale",get:function(){return this.engine.displayScale},set:function(t){this.engine.displayScale=t}},{key:"offscreenMode",get:function(){return this.engine.offscreenMode},set:function(t){this.engine.offscreenMode=t}},{key:"pixelRatio",get:function(){return this.engine.pixelRatio},set:function(t){this.engine.pixelRatio=t}},{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),i}(Qr);a([function(t,e,i){var n=i.value;return i.value=r((function(){var e,i,r,a,s=arguments;return o(this,(function(o){switch(o.label){case 0:for(e=s.length,i=new Array(e),r=0;r<e;r++)i[r]=s[r];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.apply(this,i)];case 2:return[2,o.sent()];case 3:return a=o.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}}))})),i}],$c.prototype,"loadScene",null),pr.create=function(t,e){return new Nc(t,e)},pr.createWithData=function(t,e,i){void 0===e&&(e=U("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Di.UNSIGNED_BYTE:r,a=i.format,o=void 0===a?Di.RGBA:a,s=i.internalFormat,u=i.wrapS,h=void 0===u?Di.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Di.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Di.NEAREST:f,p=i.magFilter,m=void 0===p?Di.NEAREST:p,v=i.flipY,y=void 0!==v&&v,g=i.generateMipmap,x=void 0!==g&&g;return new Nc(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:o,internalFormat:s||o,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y,generateMipmap:x})},no.create=function(t,e){return new wc(t,e)},so.create=function(t,e){return new so(t,e)},Po.create=function(t){return new Ic(t)},Ka.create=function(t,e){return new Fc(t,e)},dc.create=function(t,e){return new Xc(t,e)};var tf="2.9.2";tt.info("Player version: 2.9.2."),exports.ActivationMixerPlayable=hs,exports.ActivationPlayable=ls,exports.AndNode=si,exports.Animatable=qe,exports.AnimationClipNode=Ze,exports.AnimationEvent=os,exports.ApplyAdditiveNode=ai,exports.Asset=xh,exports.AssetLoader=Th,exports.AssetManager=Nl,exports.AssetService=Vl,exports.BYTES_TYPE_MAP=ro,exports.Behaviour=Ni,exports.BezierCurve=ha,exports.BezierCurvePath=qn,exports.BezierCurveQuat=Kn,exports.BezierDataMap=Cn,exports.BezierEasing=Fn,exports.BezierLengthData=_n,exports.BezierMap=Sn,exports.BezierPath=Nn,exports.BezierQuat=Ln,exports.BlendNode=oi,exports.BoolValueNode=je,exports.BoundingBoxInfo=Wr,exports.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",exports.COPY_MESH_SHADER_ID="effects-internal-copy-mesh",exports.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}",exports.Camera=Dl,exports.CameraVFXItemLoader=Go,exports.ColorCurve=ma,exports.ColorPlayable=as,exports.ColorPropertyMixerPlayable=ds,exports.Component=Ii,exports.ComponentTimePlayable=hh,exports.ComponentTimePlayableAsset=uh,exports.ComponentTimeTrack=ah,exports.Composition=Hl,exports.ConstBoolNode=ci,exports.ConstFloatNode=li,exports.ConstraintTarget=Wa,exports.ControlParameterBoolNode=di,exports.ControlParameterFloatNode=fi,exports.ControlParameterTriggerNode=pi,exports.DEFAULT_FONTS=["serif","sans-serif","monospace","courier"],exports.DEFAULT_FPS=60,exports.Database=Eh,exports.Deferred=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},exports.Downloader=Yi,exports.DrawObjectPass=io,exports.EFFECTS_COPY_MESH_NAME="effects-internal-copy",exports.EVENT_TYPE_CLICK=jo,exports.EVENT_TYPE_TOUCH_END=Ho,exports.EVENT_TYPE_TOUCH_MOVE=Wo,exports.EVENT_TYPE_TOUCH_START=Xo,exports.EffectComponentTimeTrack=sh,exports.EffectsObject=Re,exports.EffectsPackage=cc,exports.Ellipse=La,exports.Engine=dc,exports.EventEmitter=Qr,exports.EventSystem=Yo,exports.Float16ArrayWrapper=sn,exports.FloatComparisonNode=xi,exports.FloatComparisonNodeData=gi,exports.FloatPropertyMixerPlayable=ps,exports.FloatValueNode=Ge,exports.Framebuffer=Ka,exports.GLEngine=Xc,exports.GLGeometry=wc,exports.GPUCapability=Oo,exports.Geometry=no,exports.GlobalUniforms=Mo,exports.GradientValue=Hn,exports.GraphInstance=Ai,exports.GraphNode=De,exports.GraphNodeData=ze,exports.Graphics=Vo,exports.GraphicsPath=Ua,exports.HELP_LINK=Kr,exports.InteractLoader=qo,exports.InteractMesh=Qo,exports.InvalidIndex=ke,exports.LayerBlendNode=mi,exports.LineSegments=Yn,exports.LinearValue=Wn,exports.MaskProcessor=Ur,exports.MaskableGraphic=ko,exports.Material=zr,exports.MaterialDataBlock=_r,exports.MaterialState=kr,exports.Mesh=so,exports.NodeTransform=ii,exports.NotNode=hi,exports.NotifyEvent=ss,exports.OrNode=ui,exports.PLAYER_OPTIONS_ENV_EDITOR=qr,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=zu,exports.ParticleBehaviourPlayableAsset=Bu,exports.ParticleLoader=lh,exports.ParticleMesh=Gu,exports.ParticleMixerPlayable=ms,exports.ParticleSystemRenderer=ju,exports.ParticleTrack=Rs,exports.PassTextureCache=vc,exports.PathSegments=Zn,exports.Playable=es,exports.PlayableAsset=rs,exports.PlayableOutput=is,exports.Player=$c,exports.Plugin=Lt,exports.PluginSystem=yt,exports.PointerEventData=Gr,exports.PolyStar=Va,exports.Polygon=Ma,exports.Pose=ri,exports.PoseNode=Be,exports.Precomposition=Rl,exports.PrecompositionManager=gc,exports.PropertyClipPlayable=cs,exports.PropertyTrack=Is,exports.RENDER_PREFER_LOOKUP_TEXTURE=Mu,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=Gn,exports.RandomValue=jn,exports.RandomVectorValue=Xn,exports.RaycastResult=jr,exports.RenderFrame=Co,exports.RenderPass=eo,exports.RenderPassPriorityNormal=1e3,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=Ja,exports.RenderTargetPool=Io,exports.Renderbuffer=Po,exports.Renderer=Fo,exports.RendererComponent=Hr,exports.RuntimeClip=Ps,exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",exports.SPRITE_VERTEX_STRIDE=Zr,exports.SceneLoader=yc,exports.SerializationHelper=bh,exports.ShaderFactory=To,exports.ShaderVariant=Fr,exports.ShapePath=Ba,exports.SpriteColorMixerPlayable=vs,exports.SpriteComponentTimeTrack=oh,exports.SpriteLoader=ts,exports.StateMachineNode=Ti,exports.StateNode=_i,exports.StaticValue=Un,exports.SubCompositionClipPlayable=ys,exports.SubCompositionMixerPlayable=gs,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=Pu,exports.TextComponentBase=ph,exports.TextLayout=fh,exports.TextLoader=gh,exports.TextStyle=dh,exports.Texture=pr,exports.TextureFactory=Tr,exports.Ticker=fc,exports.TimelineClip=Ms,exports.TimelineInstance=ih,exports.TrackMixerPlayable=us,exports.Transform=rn,exports.TransformMixerPlayable=xs,exports.TransformPlayable=ws,exports.TransitionNode=Ci,exports.ValueGetter=Bn,exports.ValueNode=Ue,exports.Vector2Curve=ua,exports.Vector2PropertyMixerPlayable=Es,exports.Vector3Curve=sa,exports.Vector3PropertyMixerPlayable=Ts,exports.Vector4Curve=oa,exports.Vector4PropertyMixerPlayable=bs,exports.addByOrder=X,exports.addItem=d,exports.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}}},exports.applyMixins=dt,exports.assertExist=Y,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=ft,exports.buildBezierData=On,exports.buildEasingCurve=Vn,exports.buildLine=Ea,exports.calculateTranslation=cn,exports.canUseBOM=L,exports.canvasPool=ch,exports.closePointEps=ga,exports.colorGradingFrag=mo,exports.colorStopsFromGradient=P,exports.colorToArr=A,exports.combineImageTemplate=Pl,exports.createGLContext=Li,exports.createKeyFrameMeta=ea,exports.createShape=Ys,exports.createValueGetter=pa,exports.curveEps=xa,exports.decimalEqual=xn,exports.deserializeMipmapTexture=hr,exports.disableAllPlayer=function(t){Qc=!!t},exports.earcut=vu,exports.effectsClass=Me,exports.effectsClassStore=we,exports.enlargeBuffer=m,exports.ensureFixedNumber=Sh,exports.ensureVec3=fn,exports.extractMinAndMax=Tn,exports.gaussianDownHFrag=vo,exports.gaussianDownVFrag=yo,exports.gaussianUpFrag=go,exports.generateEmptyTexture=gr,exports.generateEmptyTypedArray=ao,exports.generateGUID=ct,exports.generateHalfFloatTexture=mr,exports.generateWhiteTexture=yr,exports.getActivePlayers=function(){return Array.from(Kc.values())},exports.getBackgroundImage=Ml,exports.getClass=Ae,exports.getColorFromGradientStops=M,exports.getConfig=Ru,exports.getControlPoints=kn,exports.getDefaultTextureFactory=Er,exports.getGeometryByShape=Eu,exports.getGeometryTriangles=Tu,exports.getKeyFrameMetaByRawValue=ta,exports.getMergedStore=Ie,exports.getNodeDataClass=Fe,exports.getParticleMeshShader=function(t,e,i){var r;void 0===i&&(i="");var n,a=t.content,o=+((null==(r=a.renderer)?void 0:r.renderMode)||0),s=[["RENDER_MODE",o],["ENV_EDITOR",i===qr]],u=e.detail,h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c=u.maxVertexUniforms>0,f=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,d=0,p=0;c&&s.push(["ENABLE_VERTEX_TEXTURE",!0]),f&&(s.push(["SPEED_OVER_LIFETIME",!0]),p|=2,ta(h,f));var m=a.textureSheetAnimation;m&&m.animate&&(s.push(["USE_SPRITE",!0]),p|=4);var v=a.colorOverLifetime;v&&v.color&&(s.push(["COLOR_OVER_LIFETIME",!0]),p|=16);var y=v&&v.opacity;y&&ta(h,y);var g,x=a.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])&&(ta(h,x[r]),i=1,p|=1<<7+e),s.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==x?void 0:x[n])&&(ta(h,x[n]),a=1,p|=1<<10+e,g=!0),s.push(["ORB_VEL_"+t.toUpperCase(),a])})),(null==x?void 0:x.asMovement)&&(s.push(["AS_LINEAR_MOVEMENT",!0]),p|=32),g&&(null==x?void 0:x.asRotation)&&(s.push(["AS_ORBITAL_MOVEMENT",!0]),p|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(ta(h,b.x),s.push(["SIZE_Y_BY_LIFE",1]),p|=16384,ta(h,b.y)):ta(h,b.size)}if(a.rotationOverLifetime){var T=a.rotationOverLifetime;T.z&&(ta(h,null==T?void 0:T.z),p|=32768,s.push(["ROT_Z_LIFETIME",1])),T.separateAxes&&(T.x&&(ta(h,T.x),p|=65536,s.push(["ROT_X_LIFETIME",1])),T.y&&(ta(h,T.y),p|=1<<17,s.push(["ROT_Y_LIFETIME",1]))),(null==T?void 0:T.asRotation)&&(s.push(["ROT_LIFETIME_AS_MOVEMENT",1]),p|=1<<18)}ta(h,null==x?void 0:x.gravityOverLifetime),(null==x?void 0:x.forceTarget)&&(s.push(["FINAL_TARGET",!0]),p|=1<<19,ta(h,x.forceCurve));var E=u.halfFloatTexture;E&&l.max&&(p|=1<<20);var _=u.maxVertexUniforms,S=h.max+h.curves.length-32>_;Ru(Mu)&&(S=!0),S&&E&&c&&(d=1);var C=["-p:",o,p,h.index,h.max,l.index,l.max].join("+"),w={fragment:lo,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+co,shared:!0,cacheId:C,macros:s,name:"particle#"+t.name};return s.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:w,vertex:h.index,fragment:l.index}},exports.getPixelRatio=O,exports.getPlayerByCanvas=function(t){return Kc.get(t)},exports.getPluginUsageInfo=xt,exports.getPreMultiAlpha=Xi,exports.getStandardComposition=bl,exports.getStandardImage=xl,exports.getStandardItem=Sl,exports.getStandardJSON=yl,exports.getTextureSize=wo,exports.glContext=Di,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return ve.Float32;case e.WebGLRenderingContext.SHORT:return ve.Int16;case e.WebGLRenderingContext.BYTE:return ve.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return ve.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return ve.UInt8;default:return ve.Float32}},exports.gpuTimer=function(t){var i=t.getExtension("EXT_disjoint_timer_query_webgl2");if(i){var n=t.createQuery(),a=r((function(){return o(this,(function(r){return[2,new Promise((function(r,o){if(n){var s=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(i.GPU_DISJOINT_EXT);if(s&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);r(h/1e3/1e3)}(s||u)&&(t.deleteQuery(n),n=null),null!==s&&n&&e.window.setTimeout((function(){a().then(r).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(i.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(i.TIME_ELAPSED_EXT)},getTime:a}}},exports.imageDataFromColor=U,exports.imageDataFromGradient=G,exports.initErrors=ki,exports.initGLContext=Bi,exports.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.;}",exports.interpolateColor=I,exports.isAlipayMiniApp=z,exports.isAndroid=V,exports.isArray=rt,exports.isCanvas=st,exports.isCanvasUsedByPlayer=function(t){return Kc.has(t)},exports.isFunction=nt,exports.isIOS=F,exports.isIOSByUA=function(){var t=e.navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},exports.isMiniProgram=function(){return z()||B()},exports.isObject=at,exports.isOpenHarmony=k,exports.isPlainObject=ot,exports.isPowerOfTwo=ut,exports.isSafeFontFamily=q,exports.isSimulatorCellPhone=D,exports.isString=it,exports.isUniformStruct=Sr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&Sr(t[0])},exports.isValidFontFamily=Z,exports.isWebGL2=Ui,exports.isWechatMiniApp=B,exports.itemFrag=ho,exports.itemVert=uo,exports.loadAVIFOptional=Ji,exports.loadBinary=ir,exports.loadBlob=function(t){return nr.apply(this,arguments)},exports.loadImage=tr,exports.loadMedia=sr,exports.loadVideo=ar,exports.loadWebPOptional=Ki,exports.logger=tt,exports.math=Lr,exports.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}}},exports.nearestPowerOfTwo=vn,exports.nodeDataClass=Le,exports.noop=et,exports.normalizeColor=Rh,exports.numberToFix=bn,exports.oldBezierKeyFramesToNew=ca,exports.parsePercent=R,exports.particleFrag=lo,exports.particleOriginTranslateMap=mn,exports.particleUniformTypeMap=Uu,exports.particleVert=co,exports.passRenderLevel=Al,exports.pluginLoaderMap=pt,exports.randomInRange=ht,exports.registerPlugin=vt,exports.removeItem=p,exports.rotateVec2=_u,exports.screenMeshVert=po,exports.serialize=Pe,exports.setBlendMode=Wi,exports.setConfig=function(t,e){return Iu[t]=e},exports.setDefaultTextureFactory=function(t){xr=t},exports.setMaskMode=function(t,e){switch(e){case void 0:t.stencilTest=!1;break;case exports.MaskMode.MASK:t.stencilTest=!0,t.stencilFunc=[Di.ALWAYS,Di.ALWAYS],t.stencilOpZPass=[Di.REPLACE,Di.REPLACE];break;case exports.MaskMode.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Di.EQUAL,Di.EQUAL];break;case exports.MaskMode.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Di.NOTEQUAL,Di.NOTEQUAL];break;case exports.MaskMode.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}},exports.setRayFromCamera=yn,exports.setSideMode=Hi,exports.sortByOrder=j,exports.spec=Te,exports.textureLoaderRegistry=br,exports.thresholdFrag=xo,exports.throwDestroyedError=lt,exports.trailVert=fo,exports.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},exports.trianglesFromRect=gn,exports.unregisterPlugin=function(t){delete pt[t];var e=mt.findIndex((function(e){return e.name===t}));-1!==e&&mt.splice(e,1)},exports.valIfUndefined=function(t,e){return null==t?e:t},exports.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.;}",exports.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",exports.vecFill=dn,exports.vecMulCombine=pn,exports.version=tf,exports.vertexFormatType2GLType=ji;
2
2
  //# sourceMappingURL=alipay.js.map