@galacean/effects 2.5.0-alpha.5 → 2.5.0-alpha.6

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/weapp.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/weapp");function r(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}function i(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var o=t.apply(e,i);function a(t){r(o,n,s,a,u,"next",t)}function u(t){r(o,n,s,a,u,"throw",t)}a(void 0)}))}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):o(t,e)}function a(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function u(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o}function h(t,e){var r,i,n,s={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=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;var c=new Uint8Array(16);function l(){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(c)}for(var f=[],p=0;p<256;++p)f.push((p+256).toString(16).slice(1));var d,m={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function v(t,e,r){if(m.randomUUID&&!e&&!t)return m.randomUUID();var i=(t=t||{}).random||(t.rng||l)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=i[n];return e}return function(t,e){return void 0===e&&(e=0),f[t[e+0]]+f[t[e+1]]+f[t[e+2]]+f[t[e+3]]+"-"+f[t[e+4]]+f[t[e+5]]+"-"+f[t[e+6]]+f[t[e+7]]+"-"+f[t[e+8]]+f[t[e+9]]+"-"+f[t[e+10]]+f[t[e+11]]+f[t[e+12]]+f[t[e+13]]+f[t[e+14]]+f[t[e+15]]}(i)}function y(t,e){return t.includes(e)||t.push(e),t}function g(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function x(t,e,r,i){if(void 0===i&&(i=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*i);Number.isNaN(r)||(n=Math.min(n,r));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(s);return o.set(t),o}return t}function b(t,e){var r=[0,0,0,0];if(W(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else o(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var s=0;s<4;s++)r[s]/=255;return r}function T(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var s=t[n-1],o=t[n];if(s.stop<=e&&e<=o.stop){i=_(s.color,o.color,(e-s.stop)/(o.stop-s.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}function E(t){var e=[];if(o(t,Array)?t.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3],o=t[4];e.push({stop:A(r),color:[i,n,s,o]})})):Object.keys(t).forEach((function(r){var i=b(t[r]);e.push({stop:A(r),color:i})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function _(t,e,r,i){var n=[],s=1-r;if(i)for(var o=0;o<4;o++)n[o]=t[o]*s+e[o]*r;else{for(var a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*s+e[a]*e[a]*r));n[3]=Math.round(t[3]*s+e[3]*r)}return n}function A(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function C(){if("object"==typeof e.screen&&"object"==typeof e.document){var t=Math.max(e.document.documentElement.clientWidth,e.window.innerWidth||0),r=e.screen.width/t;return Math.min(2*r,2)}return 1}function S(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function w(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function R(){return/\bOpenHarmony\b/.test(e.navigator.userAgent)}function M(){return w()||R()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function O(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function P(){return"miniprogram"===e.window.__wxjs_environment}function I(t){W(t)&&(t=b(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r}function L(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=E(t);if(n.length){i.set(n[0].color,0);for(var s=1;s<127;s++){for(var o=s/e,a=void 0,u=void 0,h=0;h<n.length&&(a=n[h],u=n[h+1],!(a.stop<=o&&u.stop>o));h++);var c=_(a.color,u.color,(o-a.stop)/(u.stop-a.stop));i.set(c,4*s)}i.set(n[n.length-1].color,508)}return r}function F(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(r<=30){for(var i=1;i<r;i++)D(t,i,e);return t}return N(t,e)}function V(t,e,r){return void 0===r&&(r=2),t.includes(e)?t:(t.push(e),1===t.length||1!==r&&D(t,t.length-1,r),t)}function D(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function N(t,e,r,i){if(void 0===r&&(r=0),void 0===i&&(i=t.length-1),r>=i)return t;for(var n,s=t[r],o=r,a=i;o<a;){if(2===e){for(;t[a].priority>s.priority&&a>=o;)a--;for(;t[o].priority<=s.priority&&o<a;)o++}else{for(;t[a].priority<s.priority&&a>=o;)a--;for(;t[o].priority>=s.priority&&o<a;)o++}var u;u=[t[a],t[o]],t[o]=u[0],t[a]=u[1]}return n=[t[o],t[r]],t[r]=n[0],t[o]=n[1],N(t,e,r,o-1),N(t,e,a+1,i),t}function k(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function z(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(d=exports.OrderType||(exports.OrderType={}))[d.none=1]="none",d[d.ascending=2]="ascending",d[d.descending=3]="descending";var U,B="[Galacean Effects]";function G(t){return["%c"+B,"color: #AA0100",""+t]}var j,X={error:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).error.apply(n,[].concat(G(t),[r])),null==U||U("error",t,r)},info:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).debug.apply(n,[].concat(G(t))),null==U||U("info",t,r)},warn:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).warn.apply(n,[].concat(G(t))),null==U||U("warn",t,r)},register:function(t){t&&Z(t)&&(U=t)}};function H(){}function W(t){return"string"==typeof t}exports.DestroyOptions=void 0,(j=exports.DestroyOptions||(exports.DestroyOptions={}))[j.destroy=0]="destroy",j[j.keep=1]="keep",j[j.force=0]="force";var Y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Z(t){return"[object Function]"===Object.prototype.toString.call(t)}function q(t){return"[object Object]"===Object.prototype.toString.call(t)}function K(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function Q(t,e){return t+Math.random()*(e-t)}function J(){throw new Error("Destroyed item cannot be used again.")}function $(){return v().replace(/-/g,"")}function tt(t,r,i){void 0===r&&(r="base64File"),void 0===i&&(i="");for(var n=t.split(",")[1]||t,s=e.atob(n),o=[],a=0;a<s.length;a+=512){for(var u=s.slice(a,a+512),h=new Array(u.length),c=0;c<u.length;c++)h[c]=u.charCodeAt(c);var l=new Uint8Array(h);o.push(l)}var f=new e.Blob(o,{type:i});return new File([f],r,{type:i})}function et(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(r){var i=Object.getOwnPropertyDescriptor(e.prototype,r);if(!i)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,r,i)}))}))}var rt={},it=[],nt={};function st(t,e,r){nt[t]&&X.error("Duplicate registration for plugin "+t+"."),nt[t]=r,rt[t]=e,y(it,t)}var ot=function(){function t(t){var e={},r=[];it.forEach((function(t){var i=rt[t];r.includes(i)||(r.push(i),e[t]=i)}));for(var i,n=s(t);!(i=n()).done;){var o=i.value;if(!rt[o])throw new Error("The plugin '"+o+"' not found."+ut(o))}this.plugins=Object.keys(e).map((function(t){var e=new(0,rt[t]);return e.name=t,e})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},e.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},e.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var r,i=s(this.plugins);!(r=i()).done;){r.value.precompile(t,e)}},e.loadResources=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var s=this;return i((function(){var e,i,n,o,a,u,c;return h(this,(function(h){for(e=[],i=s.plugins,n=0;n<i.length;n++)o=i[n],a=rt[o.name],t in a&&e.push(Promise.resolve(null==(c=a[t])?void 0:(u=c).call.apply(u,[].concat([a],r))));return[2,Promise.all(e)]}))}))()},t}(),at={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",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 ut(t){var e=at[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 ht,ct,lt,ft,pt,dt,mt,vt,yt,gt,xt,bt,Tt,Et,_t=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function At(t,e){return At=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},At(t,e)}function Ct(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&&At(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.LATEST="3.3"}(ht||(ht={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ct||(ct={})),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"}(lt||(lt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(ft||(ft={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(pt||(pt={})),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"}(dt||(dt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(mt||(mt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(vt||(vt={})),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"}(yt||(yt={})),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"}(gt||(gt={})),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"}(xt||(xt={})),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"}(bt||(bt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(Tt||(Tt={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Et||(Et={}));var St,wt,Rt,Mt,Ot,Pt,It,Lt,Ft,Vt,Dt,Nt,kt,zt,Ut,Bt,Gt,jt=1,Xt=3,Ht=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(St||(St={})),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"}(wt||(wt={})),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"}(Rt||(Rt={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(Mt||(Mt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ot||(Ot={})),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"}(Pt||(Pt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(It||(It={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Lt||(Lt={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Ft||(Ft={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Vt||(Vt={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Dt||(Dt={})),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"}(Nt||(Nt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(kt||(kt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(zt||(zt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Ut||(Ut={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Bt||(Bt={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Gt||(Gt={}));var Wt,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,re={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!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"}(Wt||(Wt={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Yt||(Yt={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(Zt||(Zt={})),function(t){t.video="video",t.image="image"}(qt||(qt={})),function(t){t.video="video",t.audio="audio"}(Kt||(Kt={})),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.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",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.TimelineClip="TimelineClip"}(Qt||(Qt={})),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"}(Jt||(Jt={})),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"}($t||($t={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(te||(te={})),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"}(ee||(ee={}));var ie=ht.LATEST,ne=Object.freeze({__proto__:null,LATEST_VERSION:ie,get RenderLevel(){return ct},get BlendingMode(){return lt},get SideMode(){return ft},get ObscuredMode(){return pt},get ParticleEmitterShapeType(){return dt},get PluginType(){return mt},get InteractType(){return vt},get InteractBehavior(){return yt},get ItemType(){return gt},get RenderMode(){return xt},get ParticleOrigin(){return bt},get RenderType(){return Tt},get RenderFace(){return Et},get CameraClipMode(){return St},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:jt,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:Xt,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:Ht,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return wt},get BezierKeyframeType(){return Rt},get JSONSceneVersion(){return ht},get EndBehavior(){return Mt},get ParticleInteractionBehavior(){return Ot},get ShapeArcMode(){return Pt},get LightType(){return It},get ModelBoundingType(){return Lt},get CameraType(){return Ft},get MaterialType(){return Vt},get MaterialBlending(){return Dt},get RenderMode3D(){return Nt},get TextOverflow(){return kt},get TextBaseline(){return zt},get TextAlignment(){return Ut},get TextWeight(){return Bt},get FontStyle(){return Gt},BuiltinObjectGUID:re,get ShapePrimitiveType(){return Wt},get LineCap(){return Yt},get LineJoin(){return Zt},get BackgroundType(){return qt},get MultimediaType(){return Kt},get DataType(){return Qt},get GeometryType(){return Jt},get VertexFormatType(){return $t},get IndexFormatType(){return te},get VertexBufferSemantic(){return ee}});function se(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function oe(t,e,r){return e&&se(t.prototype,e),r&&se(t,r),t}var ae=new Map,ue=new Map,he={};function ce(t){return function(e,r){he[t]&&console.warn("Class "+t+" is already registered."),he[t]=e}}function le(t,e){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor;ae.get(e)||ae.set(e,{});return ae.get(e)}(r);n&&(n[i]||(n[i]={type:t,sourceName:e}))}}(t,e)}function fe(t){var e=t.constructor;if(ue.get(e))return ue.get(e);var r={};ue.set(e,r);for(var i=t,n=e;n;){var s=ae.get(n);for(var o in s)r[o]=s[o];var a=Object.getPrototypeOf(i);if((n=Object.getPrototypeOf(a).constructor)===Object)break;i=a}return r}var pe=function(){function t(t){this.engine=t,this.guid=$(),this.defination={},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){},e.dispose=function(){},t.is=function(e){return o(e,t)&&"guid"in e},t}(),de=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}Ct(e,t);var r=e.prototype;return r.onAwake=function(){},r.onEnable=function(){},r.onDisable=function(){},r.onStart=function(){},r.onUpdate=function(t){},r.onLateUpdate=function(t){},r.onDestroy=function(){},r.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},r.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},r.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&g(this.item.components,this)},r.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},oe(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}(pe);u([le()],de.prototype,"item",void 0),u([le()],de.prototype,"_enabled",void 0);var me=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},r.dispose=function(){t.prototype.dispose.call(this)},e}(de),ve=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}Ct(e,t);var r=e.prototype;return r.render=function(t){},r.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},r.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},oe(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}(de);u([le()],ve.prototype,"materials",void 0),u([le()],ve.prototype,"_priority",void 0);var ye=2*Math.PI,ge=Math.PI/180,xe=180/Math.PI,be=1e-6;function Te(t,e){return Math.abs(t-e)<be||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var Ee=function(t,e,r){return(1-r)*t+r*e};function _e(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,s=Math.min(i,n),o=Math.max(i,n);return Math.min(Math.max(t,s),o)}var Ae=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):o(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):o(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):o(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):o(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=be,e=this.x,r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ae.ONE=new Ae(1,1),Ae.ZERO=new Ae(0,0);var Ce=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):o(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):o(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):o(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):o(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var r=t.x,i=t.y,n=t.z,s=e.x,o=e.y,a=e.z;return this.x=i*a-n*o,this.y=n*s-r*a,this.z=r*o-i*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=be,e=this,r=e.x,i=e.y,n=e.z;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new Ae(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ce.X=new Ce(1,0,0),Ce.Y=new Ce(0,1,0),Ce.Z=new Ce(0,0,1),Ce.ONE=new Ce(1,1,1),Ce.ZERO=new Ce(0,0,0);var Se=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var r,i,n,s;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s: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):o(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):o(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):o(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):o(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=be,e=this,r=e.x,i=e.y,n=e.z,s=e.w;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t&&Math.abs(s)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new Ce(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Se.ONE=new Se(1,1,1,1),Se.ZERO=new Se(0,0,0,0);var we=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new so,e.getHitTestParams=function(t){var r=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,r);var i=e.meshCollider.getBoundingBoxData();if(i)return{type:i.type,triangles:i.area}},e}Ct(e,t);var r=e.prototype;return r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.materials[e],e)},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(ve);u([le()],we.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var r;return(r=t.call(this,e)||this).name="EffectComponent",r}Ct(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){var e,r=this.item.time,i=null!=(e=this.material.getVector4("_Time"))?e:new Se;this.material.setVector4("_Time",i.set(r/20,r,2*r,3*r))},r.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(we),exports.EffectComponent=u([ce(Qt.EffectComponent)],exports.EffectComponent),exports.PostProcessVolume=function(t){function e(e){var r;return(r=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},r.vignette={intensity:0,smoothness:0,roundness:0,active:!1},r.tonemapping={active:!1},r.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},r}return Ct(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(de),u([le()],exports.PostProcessVolume.prototype,"bloom",void 0),u([le()],exports.PostProcessVolume.prototype,"vignette",void 0),u([le()],exports.PostProcessVolume.prototype,"tonemapping",void 0),u([le()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=u([ce(Qt.PostProcessVolume)],exports.PostProcessVolume);var Re=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var r,i,n,s;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,s=t/60,o=n*(1-Math.abs(s%2-1)),a=0,u=0,h=0;s>=0&&s<=1?(a=n,u=o):s>=1&&s<=2?(a=o,u=n):s>=2&&s<=3?(u=n,h=o):s>=3&&s<=4?(u=o,h=n):s>=4&&s<=5?(a=o,h=n):s>=5&&s<=6&&(a=n,h=o);var c=r-n;return this.set(a+c,u+c,h+c,i)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):o(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):o(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):o(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):o(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 Se(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,r=e.r,i=e.g,n=e.b,s=e.a,o=Math.max(r,i,n),a=Math.min(r,i,n),u=o-a,h=0,c=0;return 0!==o&&(c=u/o),o!=a&&(o==r?(h=(i-n)/u,i<n&&(h+=6)):o==i?h=(n-r)/u+2:o==n&&(h=(r-i)/u+4),h*=60),new t(h,c,o,s)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+s:"#"+r+i+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();Re.BLACK=new Re(0,0,0,1),Re.BLUE=new Re(0,0,1,1),Re.CLEAR=new Re(0,0,0,0),Re.CYAN=new Re(0,1,1,1),Re.GRAY=new Re(.5,.5,.5,1),Re.GREEN=new Re(0,1,0,1),Re.MAGENTA=new Re(1,0,1,1),Re.RED=new Re(1,0,0,1),Re.WHITE=new Re(1,1,1,1),Re.YELLOW=new Re(1,.92,.016,1);var Me=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(i),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],i=e[4],n=e[8],s=e[1],o=e[5],a=e[9],u=e[2],h=e[6],c=e[10],l=r+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(h-a)*f,this.y=(n-u)*f,this.z=(s-i)*f}else if(r>o&&r>c){var p=2*Math.sqrt(1+r-o-c);this.w=(h-a)/p,this.x=.25*p,this.y=(i+s)/p,this.z=(n+u)/p,this.negate()}else if(o>c){var d=2*Math.sqrt(1+o-r-c);this.w=(n-u)/d,this.x=(i+s)/d,this.y=.25*d,this.z=(a+h)/d,this.negate()}else{var m=2*Math.sqrt(1+c-r-o);this.w=(s-i)/m,this.x=(n+u)/m,this.y=(a+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},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 r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var r=t.x,i=t.y,n=t.z,s=t.w,o=e.x,a=e.y,u=e.z,h=e.w;return this.x=r*h+s*o+i*u-n*a,this.y=i*h+s*a+n*o-r*u,this.z=n*h+s*u+r*a-i*o,this.w=s*h-r*o-i*a-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this,i=r.x,n=r.y,s=r.z,o=r.w,a=o*t.w+i*t.x+n*t.y+s*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=i,this.y=n,this.z=s,this;var u=1-a*a;if(u<=Number.EPSILON){var h=1-e;return this.w=h*o+e*this.w,this.x=h*i+e*this.x,this.y=h*n+e*this.y,this.z=h*s+e*this.z,this.normalize(),this}var c=Math.sqrt(u),l=Math.atan2(c,a),f=Math.sin((1-e)*l)/c,p=Math.sin(e*l)/c;return this.w=o*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=s*f+this.z*p,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this,i=r.x,n=r.y,s=r.z,o=r.w,a=t.x,u=t.y,h=t.z,c=o*a+n*h-s*u,l=o*u+s*a-i*h,f=o*h+i*u-n*a,p=-i*a-n*u-s*h,d=null!=e?e:t;return d.x=c*o+p*-i+l*-s-f*-n,d.y=l*o+p*-n+f*-i-c*-s,d.z=f*o+p*-s+c*-n-l*-i,d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(Ce.ZERO,this,Ce.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return(new t).setFromUnitVectors(e,r)},t}();Me.tempVec0=new Ce;var Oe=function(){function t(t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=s,v[6]=o,v[7]=a,v[8]=u,v[9]=h,v[10]=c,v[11]=l,v[12]=f,v[13]=p,v[14]=d,v[15]=m,this},e.setFromRowMajorData=function(t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=s,v[9]=o,v[13]=a,v[2]=u,v[6]=h,v[10]=c,v[14]=l,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),s=Math.sin(r),o=1-n,a=i.x,u=i.y,h=i.z,c=o*a,l=o*u;return this.set(c*a+n,c*u+s*h,c*h-s*u,0,c*u-s*h,l*u+n,l*h+s*a,0,c*h+s*u,l*h-s*a,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(Ce.ZERO,t,Ce.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,r,i){var n=t.tempVec0,s=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,r),o.normalize(),n.crossVectors(i,o),n.normalize(),s.crossVectors(o,n);var a=this.elements;return a[0]=n.x,a[1]=s.x,a[2]=o.x,a[3]=0,a[4]=n.y,a[5]=s.y,a[6]=o.y,a[7]=0,a[8]=n.z,a[9]=s.z,a[10]=o.z,a[11]=0,a[12]=-n.dot(e),a[13]=-s.dot(e),a[14]=-o.dot(e),a[15]=1,this},e.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},e.multiply=function(t){if("number"==typeof t){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 r=t.elements,i=e.elements,n=this.elements,s=r[0],o=r[4],a=r[8],u=r[12],h=r[1],c=r[5],l=r[9],f=r[13],p=r[2],d=r[6],m=r[10],v=r[14],y=r[3],g=r[7],x=r[11],b=r[15],T=i[0],E=i[4],_=i[8],A=i[12],C=i[1],S=i[5],w=i[9],R=i[13],M=i[2],O=i[6],P=i[10],I=i[14],L=i[3],F=i[7],V=i[11],D=i[15];return n[0]=s*T+o*C+a*M+u*L,n[4]=s*E+o*S+a*O+u*F,n[8]=s*_+o*w+a*P+u*V,n[12]=s*A+o*R+a*I+u*D,n[1]=h*T+c*C+l*M+f*L,n[5]=h*E+c*S+l*O+f*F,n[9]=h*_+c*w+l*P+f*V,n[13]=h*A+c*R+l*I+f*D,n[2]=p*T+d*C+m*M+v*L,n[6]=p*E+d*S+m*O+v*F,n[10]=p*_+d*w+m*P+v*V,n[14]=p*A+d*R+m*I+v*D,n[3]=y*T+g*C+x*M+b*L,n[7]=y*E+g*S+x*O+b*F,n[11]=y*_+g*w+x*P+b*V,n[15]=y*A+g*R+x*I+b*D,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],s=t[1],o=t[5],a=t[9],u=t[13],h=t[2],c=t[6],l=t[10],f=t[14];return t[3]*(+n*a*c-i*u*c-n*o*l+r*u*l+i*o*f-r*a*f)+t[7]*(+e*a*f-e*u*l+n*s*l-i*s*f+i*u*h-n*a*h)+t[11]*(+e*u*c-e*o*f-n*s*c+r*s*f+n*o*h-r*u*h)+t[15]*(-i*o*h-e*a*c+e*o*l+i*s*c-r*s*l+r*a*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],r=t[1],i=t[2],n=t[3],s=t[4],o=t[5],a=t[6],u=t[7],h=t[8],c=t[9],l=t[10],f=t[11],p=t[12],d=t[13],m=t[14],v=t[15],y=c*m*u-d*l*u+d*a*f-o*m*f-c*a*v+o*l*v,g=p*l*u-h*m*u-p*a*f+s*m*f+h*a*v-s*l*v,x=h*d*u-p*c*u+p*o*f-s*d*f-h*o*v+s*c*v,b=p*c*a-h*d*a-p*o*l+s*d*l+h*o*m-s*c*m,T=e*y+r*g+i*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]=(d*l*n-c*m*n-d*i*f+r*m*f+c*i*v-r*l*v)*E,t[2]=(o*m*n-d*a*n+d*i*u-r*m*u-o*i*v+r*a*v)*E,t[3]=(c*a*n-o*l*n-c*i*u+r*l*u+o*i*f-r*a*f)*E,t[4]=g*E,t[5]=(h*m*n-p*l*n+p*i*f-e*m*f-h*i*v+e*l*v)*E,t[6]=(p*a*n-s*m*n-p*i*u+e*m*u+s*i*v-e*a*v)*E,t[7]=(s*l*n-h*a*n+h*i*u-e*l*u-s*i*f+e*a*f)*E,t[8]=x*E,t[9]=(p*c*n-h*d*n-p*r*f+e*d*f+h*r*v-e*c*v)*E,t[10]=(s*d*n-p*o*n+p*r*u-e*d*u-s*r*v+e*o*v)*E,t[11]=(h*o*n-s*c*n-h*r*u+e*c*u+s*r*f-e*o*f)*E,t[12]=b*E,t[13]=(h*d*i-p*c*i+p*r*l-e*d*l-h*r*m+e*c*m)*E,t[14]=(p*o*i-s*d*i-p*r*a+e*d*a+s*r*m-e*o*m)*E,t[15]=(s*c*i-h*o*i+h*r*a-e*c*a-s*r*l+e*o*l)*E,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=Ce.ZERO);var n=this.elements,s=e.x,o=e.y,a=e.z,u=e.w,h=-i.x,c=-i.y,l=-i.z,f=s+s,p=o+o,d=a+a,m=s*f,v=s*p,y=s*d,g=o*p,x=o*d,b=a*d,T=u*f,E=u*p,_=u*d,A=r.x,C=r.y,S=r.z;return n[0]=(1-(g+b))*A,n[1]=(v+_)*A,n[2]=(y-E)*A,n[3]=0,n[4]=(v-_)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*S,n[9]=(x-T)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,r,i){var n=t.tempVec0,s=this.elements,o=n.set(s[0],s[1],s[2]).length(),a=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14];var h=t.tempMat0;h.copyFrom(this);var c=1/o,l=1/a,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,r.setFromRotationMatrix(h),i.x=o,i.y=a,i.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new Ce,e=new Me,r=new Ce;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,s){var o=1/(e-t),a=1/(r-i),u=1/(s-n),h=-(e+t)*o,c=-(r+i)*a,l=-(s+n)*u;o*=2,a*=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]=a,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=c,f[14]=l,f[15]=1,this},e.perspective=function(t,e,r,i,n){var s=1/Math.tan(.5*t),o=1/(r-i),a=this.elements;return a[0]=n?s:s/e,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=n?s*e:s,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(i+r)*o,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*i*r*o,a[15]=0,null!==i&&i!==1/0||(a[10]=-1,a[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;o.x=s[0]*r+s[4]*i+s[8]*n+s[12],o.y=s[1]*r+s[5]*i+s[9]*n+s[13],o.z=s[2]*r+s[6]*i+s[10]*n+s[14];var a=s[3]*r+s[7]*i+s[11]*n+s[15];return o.multiply(1/a)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*r+s[4]*i+s[8]*n+s[12],o.y=s[1]*r+s[5]*i+s[9]*n+s[13],o.z=s[2]*r+s[6]*i+s[10]*n+s[14],o},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*r+s[4]*i+s[8]*n,o.y=s[1]*r+s[5]*i+s[9]*n,o.z=s[2]*r+s[6]*i+s[10]*n,o.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,s=t.w,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12]*s,a.y=o[1]*r+o[5]*i+o[9]*n+o[13]*s,a.z=o[2]*r+o[6]*i+o[10]*n+o[14]*s,a.w=o[3]*r+o[7]*i+o[11]*n+o[15]*s,a},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!Te(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,r,i){return(new t).lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,s){return(new t).perspective(e,r,i,n,s)},t.fromColumnVectors=function(e,r,i,n){return(new t).setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromScale=function(e,r,i){return(new t).setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return(new t).setFromTranslation(e,r,i)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,r){return(new t).setFromRotationAxis(e,r)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,r,i){return(new t).setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return(new t).setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,s,o,a,u,h,c,l,f,p,d,m,v){return new t(e,s,h,p,r,o,c,d,i,a,l,m,n,u,f,v)},t}();function Pe(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"===e&&((i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i}function Ie(t){var r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var n=t.createQuery(),s=i((function(){return h(this,(function(i){return[2,new Promise((function(i,o){if(n){var a=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(r.GPU_DISJOINT_EXT);if(a&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);i(h/1e3/1e3)}(a||u)&&(t.deleteQuery(n),n=null),null!==a&&n&&e.window.setTimeout((function(){s().then(i).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(r.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:s}}}Oe.IDENTITY=new Oe(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Oe.ZERO=new Oe(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Oe.tempVec0=new Ce,Oe.tempVec1=new Ce,Oe.tempVec2=new Ce,Oe.tempMat0=new Oe;var Le,Fe,Ve,De,Ne=[],ke={};function ze(){"function"==typeof e.WebGL2RenderingContext?Be(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(Be(e.WebGLRenderingContext),Be(e.WebGLRenderingContext.prototype)):Ne.push("iOS16 lockdown mode, WebGL Constants not in global"),Ne.length||"HALF_FLOAT"in ke||(ke.HALF_FLOAT=5131)}function Ue(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Be(t){for(var e in t)/^[A-Z_]/.test(e)&&(ke[e]=t[e])}function Ge(t){switch(t){case $t.Float32:return e.WebGLRenderingContext.FLOAT;case $t.Int16:return e.WebGLRenderingContext.SHORT;case $t.Int8:return e.WebGLRenderingContext.BYTE;case $t.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case $t.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}function je(t){switch(t){case lt.ALPHA:case lt.ADD:case lt.SUBTRACTION:case lt.STRONG_LIGHT:case lt.WEAK_LIGHT:return 1;case lt.SUPERPOSITION:return 2;case lt.BRIGHTNESS:return 3;case lt.MULTIPLY:return 0;default:return 1}}function Xe(t,e){switch(e){case void 0:case lt.ALPHA:t.blendFunction=[ke.ONE,ke.ONE_MINUS_SRC_ALPHA,ke.ONE,ke.ONE_MINUS_SRC_ALPHA];break;case lt.ADD:t.blendFunction=[ke.ONE,ke.ONE,ke.ONE,ke.ONE];break;case lt.SUBTRACTION:t.blendFunction=[ke.ONE,ke.ONE,ke.ZERO,ke.ONE],t.blendEquation=[ke.FUNC_REVERSE_SUBTRACT,ke.FUNC_REVERSE_SUBTRACT];break;case lt.SUPERPOSITION:t.blendFunction=[ke.ONE,ke.ONE,ke.ONE,ke.ONE];break;case lt.MULTIPLY:t.blendFunction=[ke.DST_COLOR,ke.ONE_MINUS_SRC_ALPHA,ke.DST_COLOR,ke.ONE_MINUS_SRC_ALPHA];break;case lt.BRIGHTNESS:t.blendFunction=[ke.ONE,ke.ONE_MINUS_SRC_ALPHA,ke.ONE,ke.ONE_MINUS_SRC_ALPHA];break;case lt.STRONG_LIGHT:t.blendFunction=[ke.DST_COLOR,ke.DST_ALPHA,ke.ZERO,ke.ONE];break;case lt.WEAK_LIGHT:t.blendFunction=[ke.DST_COLOR,ke.ZERO,ke.ZERO,ke.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function He(t,e){e===ft.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=ke.CW,t.cullFace=e===ft.BACK?ke.BACK:ke.FRONT)}function We(t,e){switch(e){case void 0:t.stencilTest=!1;break;case exports.MaskMode.MASK:t.stencilTest=!0,t.stencilFunc=[ke.ALWAYS,ke.ALWAYS],t.stencilOpZPass=[ke.REPLACE,ke.REPLACE];break;case exports.MaskMode.OBSCURED:t.stencilTest=!0,t.stencilFunc=[ke.EQUAL,ke.EQUAL];break;case exports.MaskMode.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[ke.NOTEQUAL,ke.NOTEQUAL];break;case exports.MaskMode.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function Ye(){return Ye=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ye.apply(this,arguments)}Ne.length||ze(),exports.ShaderType=void 0,(Le=exports.ShaderType||(exports.ShaderType={}))[Le.vertex=0]="vertex",Le[Le.fragment=1]="fragment",exports.MaskMode=void 0,(Fe=exports.MaskMode||(exports.MaskMode={}))[Fe.NONE=0]="NONE",Fe[Fe.MASK=1]="MASK",Fe[Fe.OBSCURED=2]="OBSCURED",Fe[Fe.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",exports.TextureLoadAction=void 0,(Ve=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Ve.whatever=0]="whatever",Ve[Ve.clear=2]="clear",exports.TextureSourceType=void 0,(De=exports.TextureSourceType||(exports.TextureSourceType={}))[De.none=0]="none",De[De.data=1]="data",De[De.image=2]="image",De[De.compressed=3]="compressed",De[De.video=4]="video",De[De.canvas=5]="canvas",De[De.framebuffer=6]="framebuffer",De[De.mipmaps=7]="mipmaps";var Ze=function(){function t(){this.callbacks={}}var r=t.prototype;return r.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},r.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},r.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},r.download=function(t,r,i,n){var s=this;if(void 0===r&&(r="json"),!this.start(t,i,n)){var o=new e.XMLHttpRequest,a=function(){s.finish(t,o.status,o.response)};o.responseType=r,o.addEventListener("load",(function(){200==o.status?s.finish(t,200,o.response):a()})),o.addEventListener("error",a),o.open("GET",t,!0),o.send()}},r.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},r.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[r]:[e,r],s=n.length-1,o=i.length;s<o;s+=2)i[s].apply(null,n)},t}(),qe=!1,Ke=!1;function Qe(t,e){return Je.apply(this,arguments)}function Je(){return(Je=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!qe&&e?[3,2]:[4,er(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,er(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),qe=!0,[4,er(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function $e(t,e){return tr.apply(this,arguments)}function tr(){return(tr=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!Ke&&e?[3,2]:[4,er(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,er(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Ke=!0,[4,er(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function er(t){return rr.apply(this,arguments)}function rr(){return(rr=i((function(t){var r,i;return h(this,(function(n){if(r="",o(t,e.HTMLImageElement)){if(t.complete)return[2,t];r=t.src}else o(t,e.Blob)?(r=e.URL.createObjectURL(t),i=!0):"string"==typeof t&&(r=t);if(!r)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var s=new e.Image;/^data:/.test(r)||(s.crossOrigin="*"),s.onload=function(){return s.onload=null,i&&e.URL.revokeObjectURL(r),t(s)},s.onerror=function(t){return s.onerror=null,i&&e.URL.revokeObjectURL(r),n("Load image fail: "+r+", reason: "+JSON.stringify(t))},s.src=r}))]}))}))).apply(this,arguments)}function ir(t){return nr.apply(this,arguments)}function nr(){return(nr=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Ze).downloadBinary(t,e,(function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function sr(){return(sr=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Ze).downloadBlob(t,e,(function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function or(t){return ar.apply(this,arguments)}function ar(){return(ar=i((function(t){var r;return h(this,(function(i){return r=e.document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,w()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e("Load video fail.")}))}))]}))}))).apply(this,arguments)}function ur(t,e){return hr.apply(this,arguments)}function hr(){return(hr=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 4:return[2,r.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function cr(t,e,r){return lr.apply(this,arguments)}function lr(){return(lr=i((function(t,e,r,i){var n,s,o,a,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:return void 0===i&&(i=[]),34067!==t.target?[3,2]:(n=t.mipmaps,s=t.target,o=n.map((function(t){return Promise.all(t.map((function(t){return t.id?r[t.id]:fr(t,e)})))})),[4,Promise.all(o)]);case 1:return a=h.sent(),[2,Ye({keepImageSource:!1},t,{mipmaps:a,sourceFrom:{target:s,type:exports.TextureSourceType.mipmaps}})];case 2:return u=t.mipmaps,c=t.target,l=u.map((function(t){return fr(t,e)})),[4,Promise.all(l)];case 3:return f=h.sent(),p=i[u[0][1][0]].url,[2,Ye({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:p,type:exports.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function fr(t,e){return pr.apply(this,arguments)}function pr(){return pr=i((function(t,r){var i,n,s,o,a;return h(this,(function(u){if(i=t[1],n=i[0],s=i[1],o=i[2],!(a=r[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,er(new e.Blob([new Uint8Array(a,s,o)]))]}))})),pr.apply(this,arguments)}var dr=1,mr=function(t){function e(e){var r;return(r=t.call(this,e)||this).destroyed=!1,r.id="Tex"+dr++,r}Ct(e,t);var r=e.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(t){var e=t.target,r=void 0===e?ke.TEXTURE_2D:e,i=t.format,n=void 0===i?ke.RGBA:i;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),Ye({minFilter:ke.NEAREST,magFilter:ke.NEAREST,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE,target:r,format:ke.RGBA,internalFormat:n,type:ke.UNSIGNED_BYTE},t)},e.fromImage=function(t,r,n){return i((function(){var i,s;return h(this,(function(o){switch(o.label){case 0:return[4,er(t)];case 1:return i=o.sent(),(s=e.create(r,Ye({sourceType:exports.TextureSourceType.image,image:i,target:ke.TEXTURE_2D,id:$(),flipY:!0},n))).initialize(),[2,s]}}))}))()},e.fromVideo=function(t,r,n){return i((function(){var i,s;return h(this,(function(o){switch(o.label){case 0:return[4,or(t)];case 1:return i=o.sent(),(s=e.create(r,Ye({sourceType:exports.TextureSourceType.video,video:i,id:$(),flipY:!0},n))).initialize(),[2,s]}}))}))()},oe(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(pe);function vr(t,e,r,i){var n,s,o=e.length/r/i;return s=n=4===o||0===o?ke.RGBA:3===o?ke.RGB:2===o?ke.LUMINANCE_ALPHA:ke.LUMINANCE,mr.createWithData(t,{data:e,width:r,height:i},{type:ke.HALF_FLOAT,format:n,internalFormat:s,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE})}var yr={type:ke.UNSIGNED_BYTE,format:ke.RGBA,internalFormat:ke.RGBA,wrapS:ke.MIRRORED_REPEAT,wrapT:ke.MIRRORED_REPEAT,minFilter:ke.NEAREST,magFilter:ke.NEAREST};function gr(t){return mr.create(t,Ye({id:re.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},yr))}function xr(t){return mr.create(t,Ye({id:re.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},yr))}var br=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===s.getUint32(0,!0);this.glType=s.getUint32(1*n,o),this.glTypeSize=s.getUint32(2*n,o),this.glFormat=s.getUint32(3*n,o),this.glInternalFormat=s.getUint32(4*n,o),this.glBaseInternalFormat=s.getUint32(5*n,o),this.pixelWidth=s.getUint32(6*n,o),this.pixelHeight=s.getUint32(7*n,o),this.pixelDepth=s.getUint32(8*n,o),this.numberOfArrayElements=s.getUint32(9*n,o),this.numberOfFaces=s.getUint32(10*n,o),this.numberOfMipmapLevels=s.getUint32(11*n,o),this.bytesOfKeyValueData=s.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:X.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):X.warn("Texture arrays not currently supported."):X.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,o=0;o<s;o++){for(var a=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,a);e.push({data:h,width:i,height:n}),r+=a+4,r+=3-(a+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function Tr(t){var e=new br(t,1),r=e.numberOfMipmapLevels,i=e.pixelWidth,n=e.pixelHeight,s=e.glType,o=e.numberOfFaces,a=e.glInternalFormat,u=e.glFormat,h=r>=Math.floor(Math.log2(Math.max(i,n))+1);return{sourceType:exports.TextureSourceType.compressed,type:s,target:6===o?ke.TEXTURE_CUBE_MAP:ke.TEXTURE_2D,internalFormat:a,format:u,mipmaps:e.mipmaps(h)}}var Er,_r=function(){function t(){this.reloadPending={}}var r=t.prototype;return r.reload=function(t){var e=this;return i((function(){var r,i;return h(this,(function(n){switch(n.label){case 0:return r=t.id,e.reloadPending[r]?[2]:t.sourceFrom?(e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},r.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var r=t.target,i=t.map,n=t.url;return r===ke.TEXTURE_CUBE_MAP?"object"==typeof i&&!!i:W(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var s=t.bin,o=t.mipmaps,a=t.target,u=t.maps,h=t.urls;return s?o.length>0:a===ke.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return W(t)&&t.length>0}))}}return!1},r.loadSource=function(t,e){var r=this;return i((function(){var i,n,s,o,a,u,c,l,f,p,d,m,v,y,g,x,b;return h(this,(function(h){switch(h.label){case 0:return i=t.type,n=t.target,s=t.map,o=t.url,a=t.bin,u=t.mipmaps,c=t.urls,l=t.maps,n!==ke.TEXTURE_CUBE_MAP||i===exports.TextureSourceType.mipmaps?[3,2]:[4,r.loadCubeMap(s)];case 1:return f=h.sent(),[2,Ye({},e,{cube:f,target:ke.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:Ye({},s),target:ke.TEXTURE_CUBE_MAP}})];case 2:return i!==exports.TextureSourceType.image?[3,4]:[4,er(o)];case 3:return p=h.sent(),[2,Ye({},e,{image:p,sourceType:exports.TextureSourceType.image,sourceFrom:{type:i,url:o,target:ke.TEXTURE_2D}})];case 4:return i!==exports.TextureSourceType.video?[3,6]:[4,or(o)];case 5:return d=h.sent(),[2,Ye({},e,{video:d,sourceType:exports.TextureSourceType.video})];case 6:return i!==exports.TextureSourceType.compressed?[3,8]:[4,ir(o)];case 7:return[2,Ye({},Tr(h.sent()),e,{sourceFrom:{url:o,type:exports.TextureSourceType.compressed}})];case 8:return i!==exports.TextureSourceType.mipmaps?[3,17]:a?[4,ir(a)]:[3,13];case 9:return m=h.sent(),v=null!=n?n:ke.TEXTURE_2D,y=v===ke.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==ke.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return r.loadMipmapImages(t,m)})))];case 10:return g=h.sent(),[3,12];case 11:g=r.loadMipmapImages(u,m),h.label=12;case 12:return[2,Ye({},e,{mipmaps:g,target:v,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:a,mipmaps:y,target:v,type:exports.TextureSourceType.mipmaps}})];case 13:return n!==ke.TEXTURE_2D&&n?[3,15]:[4,Promise.all(c.map((function(t){return er(t)})))];case 14:return x=h.sent(),[2,Ye({},e,{mipmaps:x,target:ke.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:ke.TEXTURE_2D}})];case 15:return n!==ke.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(l.map((function(t){return r.loadCubeMap(t)})))];case 16:return b=h.sent(),[2,Ye({},e,{mipmaps:b,target:ke.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:l.map((function(t){return Ye({},t)})),target:ke.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+i+".")}}))}))()},r.loadMipmapImages=function(t,r){return i((function(){return h(this,(function(i){return[2,Promise.all(t.map((function(t){return er(new e.Blob([new Uint8Array(r,t[0],t[1])]))})))]}))}))()},r.loadCubeMap=function(t){return i((function(){return h(this,(function(e){return[2,Promise.all(t.map((function(t){return er(t)})))]}))}))()},t}();function Ar(){return Er||(Er=new _r),Er}var Cr,Sr=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function wr(t){return"object"==typeof t&&t&&void 0===t.length&&o(t,mr)}exports.MaterialRenderType=void 0,(Cr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[Cr.normal=0]="normal",Cr[Cr.transformFeedback=1]="transformFeedback";var Rr,Mr,Or=1,Pr=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).stringTags={},i.enabledMacros={},i.destroyed=!1,i.initialized=!1,i.shaderDirty=!0,r){var n=r.name,s=void 0===n?"Material"+Or++:n,o=r.renderType,a=void 0===o?0:o,u=r.shader,h=r.uniformSemantics;i.name=s,i.renderType=a,i.shaderSource=u,i.props=r,i.uniformSemantics=Ye({},h)}else i.name="Material"+Or++,i.renderType=0;return i}Ct(e,t);var r=e.prototype;return r.initialize=function(){},r.createShaderVariant=function(){},r.use=function(t,e){},oe(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",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(pe),Ir=function(){function t(t){this.engine=t,this.alphaMaskEnabled=!1,this.maskMode=exports.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:exports.TextureLoadAction.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.getMaskMode=function(t){var e=t.isMask,r=void 0!==e&&e,i=t.inverted,n=void 0!==i&&i,s=t.reference,o=t.alphaMaskEnabled,a=void 0!==o&&o;return this.alphaMaskEnabled=a,r?this.maskMode=exports.MaskMode.MASK:(this.maskMode=n?exports.MaskMode.REVERSE_OBSCURED:exports.MaskMode.OBSCURED,s&&(this.maskable=this.engine.findObject(s))),this.maskMode},e.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},t}();exports.ShaderCompileResultStatus=void 0,(Rr=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[Rr.noShader=0]="noShader",Rr[Rr.success=1]="success",Rr[Rr.fail=2]="fail",Rr[Rr.compiling=3]="compiling",exports.GLSLVersion=void 0,(Mr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",Mr.GLSL3="300 es";var Lr=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return Ct(e,t),e}(pe);exports.Shader=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=s(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(pe),exports.Shader=u([ce(Qt.Shader)],exports.Shader);var Fr="effects-internal-copy",Vr="effects-internal-copy-mesh",Dr="\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}",Nr="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function kr(t,e){return{name:Fr,vertex:Dr,fragment:Nr,glslVersion:2===t?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:Vr+ +e}}var zr,Ur,Br={format:ke.RGBA,type:ke.UNSIGNED_BYTE,minFilter:ke.LINEAR,magFilter:ke.LINEAR,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE},Gr=Symbol("dispose"),jr=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,r=t.width,i=t.height,n=t.name,s={sourceType:exports.TextureSourceType.framebuffer,data:{width:r,height:i},name:n},o=[n];Object.getOwnPropertyNames(Br).forEach((function(e){var r,i=null!=(r=t[e])?r:Br[e];s[e]=i,o.push(e,i)}));var a=o.join(":"),u=this.textureCache[a];if(u)this.textureRef[a]++;else{var h=this.engine;k(h),u=mr.create(h,s),this.textureCache[a]=u,this.textureRef[a]=1,u[Gr]=u.dispose,u.dispose=function(){return e.removeTexture(a)}}return u},e.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var r=this.textureCache[t];r&&(r[Gr](),r.dispose=r[Gr]),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 r=t.textureCache[e];r[Gr](),r.dispose=r[Gr]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Xr=function(){function t(t){void 0===t&&(t={}),this.semantics=Ye({},t)}var e=t.prototype;return e.toObject=function(){return Ye({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return Z(r)?r(e):r},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),Hr=((zr={})[ke.FLOAT]=Float32Array.BYTES_PER_ELEMENT,zr[ke.INT]=Int32Array.BYTES_PER_ELEMENT,zr[ke.SHORT]=Int16Array.BYTES_PER_ELEMENT,zr[ke.BYTE]=Int8Array.BYTES_PER_ELEMENT,zr),Wr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}Ct(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(pe);function Yr(t){return t===ke.INT?new Int32Array(0):t===ke.SHORT?new Int16Array(0):new Float32Array(0)}!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"}(Ur||(Ur={}));var Zr=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var r=t.elements,i=r[0],n=r[4],s=r[8],o=r[1],a=r[5],u=r[9],h=r[2],c=r[6],l=r[10];switch(e){case Ur.XYZ:this.y=Math.asin(_e(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,a),this.z=0);break;case Ur.YXZ:this.x=Math.asin(-_e(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(s,l),this.z=Math.atan2(o,a)):(this.y=Math.atan2(-h,i),this.z=0);break;case Ur.ZXY:this.x=Math.asin(_e(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,a)):(this.y=0,this.z=Math.atan2(o,i));break;case Ur.ZYX:this.y=Math.asin(-_e(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(c,l),this.z=Math.atan2(o,i)):(this.x=0,this.z=Math.atan2(-n,a));break;case Ur.YZX:this.z=Math.asin(_e(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,a),this.y=Math.atan2(-h,i)):(this.x=0,this.y=Math.atan2(s,l));break;case Ur.XZY:this.z=Math.asin(-_e(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,a),this.y=Math.atan2(s,i)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=xe,this.y*=xe,this.z*=xe,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,r){var i,n,s,o;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(o=t[e+3])?o:r,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(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 Me;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this,r=e.x,i=e.y,n=e.z,s=e.order,o=Math.cos(r*ge*.5),a=Math.cos(i*ge*.5),u=Math.cos(n*ge*.5),h=Math.sin(r*ge*.5),c=Math.sin(i*ge*.5),l=Math.sin(n*ge*.5);switch(s){case Ur.XYZ:t.set(h*a*u+o*c*l,o*c*u-h*a*l,o*a*l+h*c*u,o*a*u-h*c*l);break;case Ur.YXZ:t.set(h*a*u+o*c*l,o*c*u-h*a*l,o*a*l-h*c*u,o*a*u+h*c*l);break;case Ur.ZXY:t.set(h*a*u-o*c*l,o*c*u+h*a*l,o*a*l+h*c*u,o*a*u-h*c*l);break;case Ur.ZYX:t.set(h*a*u-o*c*l,o*c*u+h*a*l,o*a*l-h*c*u,o*a*u+h*c*l);break;case Ur.YZX:t.set(h*a*u+o*c*l,o*c*u+h*a*l,o*a*l-h*c*u,o*a*u-h*c*l);break;case Ur.XZY:t.set(h*a*u-o*c*l,o*c*u-h*a*l,o*a*l+h*c*u,o*a*u+h*c*l);break;default:console.error("unknown euler order: "+s)}return t},e.toMatrix4=function(t){var e=t.elements,r=this,i=r.x,n=r.y,s=r.z,o=r.order,a=Math.cos(i*ge),u=Math.sin(i*ge),h=Math.cos(n*ge),c=Math.sin(n*ge),l=Math.cos(s*ge),f=Math.sin(s*ge);if(o===Ur.XYZ){var p=a*l,d=a*f,m=u*l,v=u*f;e[0]=h*l,e[4]=-h*f,e[8]=c,e[1]=d+m*c,e[5]=p-v*c,e[9]=-u*h,e[2]=v-p*c,e[6]=m+d*c,e[10]=a*h}else if(o===Ur.YXZ){var y=h*l,g=h*f,x=c*l,b=c*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=a*c,e[1]=a*f,e[5]=a*l,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=a*h}else if(o===Ur.ZXY){var T=h*l,E=h*f,_=c*l,A=c*f;e[0]=T-A*u,e[4]=-a*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=a*l,e[9]=A-T*u,e[2]=-a*c,e[6]=u,e[10]=a*h}else if(o===Ur.ZYX){var C=a*l,S=a*f,w=u*l,R=u*f;e[0]=h*l,e[4]=w*c-S,e[8]=C*c+R,e[1]=h*f,e[5]=R*c+C,e[9]=S*c-w,e[2]=-c,e[6]=u*h,e[10]=a*h}else if(o===Ur.YZX){var M=a*h,O=a*c,P=u*h,I=u*c;e[0]=h*l,e[4]=I-M*f,e[8]=P*f+O,e[1]=f,e[5]=a*l,e[9]=-u*l,e[2]=-c*l,e[6]=O*f+P,e[10]=M-I*f}else if(o===Ur.XZY){var L=a*h,F=a*c,V=u*h,D=u*c;e[0]=h*l,e[4]=-f,e[8]=c*l,e[1]=L*f+D,e[5]=a*l,e[9]=F*f-V,e[2]=V*f-F,e[6]=u*l,e[10]=D*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,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromArray(e,r,i)},t}();Zr.DEFAULT_ORDER=Ur.ZYX,Zr.tempQuat0=new Me,Zr.tempMat0=new Oe;var qr=function(){function t(t,e,r,i,n,s,o,a,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,s,o,a,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,o,a,u){var h=this.elements;return h[0]=t,h[3]=i,h[6]=o,h[1]=e,h[4]=n,h[7]=a,h[2]=r,h[5]=s,h[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,s,o,a,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=r,h[1]=i,h[4]=n,h[7]=s,h[2]=o,h[5]=a,h[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,s=e+e,o=r+r,a=i+i,u=e*s,h=e*o,c=e*a,l=r*o,f=r*a,p=i*a,d=n*s,m=n*o,v=n*a,y=this.elements;return y[0]=1-(l+p),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+p),y[5]=f+d,y[6]=c+m,y[7]=f-d,y[8]=1-(u+l),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],s=i[3],o=i[6],a=i[1],u=i[4],h=i[7];return i[0]=e*n+r*a,i[3]=e*s+r*u,i[6]=e*o+r*h,i[1]=-r*n+e*a,i[4]=-r*s+e*u,i[7]=-r*o+e*h,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},e.multiply=function(t){if("number"==typeof t){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 r=t.elements,i=e.elements,n=this.elements,s=r[0],o=r[3],a=r[6],u=r[1],h=r[4],c=r[7],l=r[2],f=r[5],p=r[8],d=i[0],m=i[3],v=i[6],y=i[1],g=i[4],x=i[7],b=i[2],T=i[5],E=i[8];return n[0]=s*d+o*y+a*b,n[3]=s*m+o*g+a*T,n[6]=s*v+o*x+a*E,n[1]=u*d+h*y+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*d+f*y+p*b,n[5]=l*m+f*g+p*T,n[8]=l*v+f*x+p*E,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],o=t[7],a=t[2],u=t[5],h=t[8];return e*(s*h-u*o)+n*(u*i-r*h)+a*(r*o-s*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],o=t[7],a=t[2],u=t[5],h=t[8],c=h*s-u*o,l=u*i-h*r,f=o*r-s*i,p=e*c+n*l+a*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=c*d,t[1]=(a*o-h*n)*d,t[2]=(u*n-a*s)*d,t[3]=l*d,t[4]=(h*e-a*i)*d,t[5]=(a*r-u*e)*d,t[6]=f*d,t[7]=(n*i-o*e)*d,t[8]=(s*e-n*r)*d,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*r+s[3]*i+s[6]*n,o.y=s[1]*r+s[4]*i+s[7]*n,o.z=s[2]*r+s[5]*i+s[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!Te(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,s,o,a,u,h){return new t(e,n,a,r,s,u,i,o,h)},t}(),Kr=function(){function t(t,e){void 0===t&&(t=Ce.ZERO),void 0===e&&(e=Ce.X),this.origin=new Ce,this.direction=new Ce,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var r=e||new Ce;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var r,i,n,s,o,a,u=this.origin,h=u.x,c=u.y,l=u.z,f=this.direction,p=f.x,d=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,A=1/p,C=1/d,S=1/m;if(A>=0?(r=(y-h)*A,i=(T-h)*A):(r=(T-h)*A,i=(y-h)*A),C>=0?(n=(g-c)*C,s=(E-c)*C):(n=(E-c)*C,s=(g-c)*C),!(r>s||n>i||((n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),(n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),S>=0?(o=(x-l)*S,a=(_-l)*S):(o=(_-l)*S,a=(x-l)*S),r>a||o>i||((o>r||r!=r)&&(r=o),(a<i||i!=i)&&(i=a),i<0))))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new Ce).copyFrom(this.origin):void 0;var s=-(this.origin.dot(r)+i)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),s=n.dot(this.direction),o=n.dot(n)-s*s,a=e.radius*e.radius;if(!(o>a)){var u=Math.sqrt(a-o),h=s-u,c=s+u;if(!(c<0))return h>=0?this.at(h,r):this.at(c,r)}},e.intersectTriangle=function(e,r,i){var n,s=e.p0,o=e.p1,a=e.p2,u=t.tempVec0.subtractVectors(o,s),h=t.tempVec1.subtractVectors(a,s),c=t.tempVec2.subtractVectors(this.origin,s),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var p=n*this.direction.dot(h);if(!(p<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,r)}}},t}();Kr.tempVec0=new Ce,Kr.tempVec1=new Ce,Kr.tempVec2=new Ce,Kr.tempVec3=new Ce;var Qr,Jr,$r=function(){function t(t,e){void 0===t&&(t=new Ce(1/0,1/0,1/0)),void 0===e&&(e=new Ce(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),r=Number(1/0),i=Number(1/0),n=-1/0,s=-1/0,o=-1/0,a=0,u=t.length;a<u;a+=3){var h=t[a],c=t[a+1],l=t[a+2];h<e&&(e=h),c<r&&(r=c),l<i&&(i=l),h>n&&(n=h),c>s&&(s=c),l>o&&(o=l)}return this.min.set(e,r,i),this.max.set(n,s,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new t).copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new Ce),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 Ce),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,s=0,o=n.length;s<o;s++)this.expandByObject(n[s]);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 Ce),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 Ce;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 Ce),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 Ce),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new Ce),this.isEmpty())return[];var r=[];return r[0]=new Ce(this.min.x,this.min.y,this.min.z),r[1]=new Ce(this.min.x,this.min.y,this.max.z),r[2]=new Ce(this.min.x,this.max.y,this.min.z),r[3]=new Ce(this.min.x,this.max.y,this.max.z),r[4]=new Ce(this.max.x,this.min.y,this.min.z),r[5]=new Ce(this.max.x,this.min.y,this.max.z),r[6]=new Ce(this.max.x,this.max.y,this.min.z),r[7]=new Ce(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new Ce;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}(),ti=function(){function t(t,e){void 0===t&&(t=Ce.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var s=(new $r).setFromPoints(t);s.getCenter(r),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new Ce),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(t=new $r),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],s=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*s,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new Ce).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new Ce,r=new Ce;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=(new Ce).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),ei=Object.freeze({__proto__:null,get EulerOrder(){return Ur},Euler:Zr,Quaternion:Me,Vector2:Ae,Vector3:Ce,Vector4:Se,Matrix3:qr,Matrix4:Oe,Ray:Kr,PI2:ye,DEG2RAD:ge,RAD2DEG:xe,NumberEpsilon:be,isZero:function(t){return isNaN(t)||Math.abs(t)<be},isEqual:Te,damp:function(t,e,r,i){return Ee(t,e,1-Math.exp(-r*i))},lerp:Ee,degToRad:function(t){return t*ge},radToDeg:function(t){return t*xe},clamp:_e,Color:Re,Box3:$r,Sphere:ti}),ri=1,ii=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).destroyed=!1,i.visible=!0,r){var n=r.material,s=r.geometry,o=r.name,a=void 0===o?"<unnamed>":o,u=r.priority,h=void 0===u?0:u,c=r.worldMatrix,l=void 0===c?Oe.fromIdentity():c;i.id="Mesh"+ri++,i.name=a,i.geometry=s,i.material=n,i.priority=h,i.worldMatrix=l}else i.id="Mesh"+ri++,i.name="<unnamed>",i.worldMatrix=Oe.fromIdentity(),i._priority=0;return i}Ct(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){this.isDestroyed||this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.material=t},r.restore=function(){},r.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},oe(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(ve),ni=1e3;exports.RenderPassAttachmentStorageType=void 0,(Qr=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[Qr.none=0]="none",Qr[Qr.color=1]="color",Qr[Qr.stencil_8_opaque=2]="stencil_8_opaque",Qr[Qr.depth_16_opaque=3]="depth_16_opaque",Qr[Qr.depth_stencil_opaque=4]="depth_stencil_opaque",Qr[Qr.depth_16_texture=5]="depth_16_texture",Qr[Qr.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(Jr=exports.TextureStoreAction||(exports.TextureStoreAction={}))[Jr.store=0]="store",Jr[Jr.clear=2]="clear";var si,oi=function(){function t(t,e){if(this.destroyed=!1,e){var r=e.texture,i=e.size;if(o(r,mr))this.texture=r,this.externalTexture=!0;else if(r){var n=r.wrapT,s=r.wrapS,a=r.minFilter,u=r.magFilter,h=r.internalFormat,c=r.format,l=void 0===c?ke.RGBA:c,f=r.type,p=void 0===f?ke.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:i,format:l,type:p,internalFormat:h||l,wrapT:n,wrapS:s,minFilter:a,magFilter:u,name:e.name},this.texture=mr.create(t,Ye({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:i[0],height:i[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},oe(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,(si=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[si.force=0]="force",si[si.keep=1]="keep",si[si.keepExternal=2]="keepExternal",si[si.destroy=0]="destroy";var ai=1,ui=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"RenderPass_"+ai++:r,n=e.clearAction,s=e.semantics,o=e.depthStencilAttachment,a=e.storeAction,u=e.priority,h=void 0===u?0:u,c=e.meshOrder,l=void 0===c?exports.OrderType.ascending:c,f=e.meshes,p=void 0===f?[]:f,d=e.delegate,m=void 0===d?{}:d;this.name=i,this.renderer=t,this.priority=h,this.meshOrder=l,this.meshes=F(p.slice(),this.meshOrder),this.depthStencilType=(null==o?void 0:o.storageType)||0,this.clearAction=Ye({},n),this.storeAction=Ye({colorAction:0,depthAction:0,stencilAction:0},a),this.semantics=new Xr(s),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){V(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){g(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),F(this.meshes,this.meshOrder),this.meshes},e.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),r=e[0],i=e[1],n=e[2],s=e[3];t.setViewport(r,i,n,s)}},e.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.frameCleanup=function(t){},e.resetColorAttachments=function(t){var e=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=t.map((function(t){return t.updateSource({sourceType:exports.TextureSourceType.framebuffer}),new oi(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(t.map((function(t){return t}))))}else this.resetAttachments({attachments:t.map((function(t){return{texture:t}}))})},e.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},e._resetAttachments=function(){var t,e,r=this,i=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,i.getWidth()*s,i.getHeight()*s],a=[o[2],o[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var i;return new oi(r.renderer.engine,Ye({size:a,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))}));this.attachments=h;var c=Ui.create({storeAction:this.storeAction,name:u,viewport:o,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);c.bind(),c.unbind(),this.framebuffer=c}else this.attachments.length=0},e.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:r}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:r}}},e.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){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;var r=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===r||1===r||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var i,n,s=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,o=this.framebuffer;if(o)if(o.dispose({depthStencilAttachment:s}),!(o.externalStorage&&2===s||1===s))null==(i=this.stencilTexture)||i.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=J}},oe(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),t}(),hi="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;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid 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);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",ci="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;}",li="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",fi="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",pi="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",di="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",mi="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);}",vi="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);}",yi="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);}",gi="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);}",xi="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);}",bi={},Ti=function(){function t(){}return t.registerInclude=function(t,e){bi[t]&&X.warn('The "'+t+'" shader include already exist.'),bi[t]=e},t.unRegisterInclude=function(t){delete bi[t]},t.unRegisterAllIncludes=function(){Object.keys(bi).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var r=e.level,i=e.shaderType,n=e.shader,s=e.macros,o=e.removeVersion,a=t.genMacroString(r,s),u=t.genShaderVersion(r),h=t.parseIncludes(n),c=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==r||c||(h=t.convertTo300(h,i===exports.ShaderType.fragment)),o?a+h:u+a+h},t.convertTo300=function(e,r){if(e=(e=(e=e.replace(/\bvarying\b/g,r?"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,""),r){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 i=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);i&&(e=t.replaceMRTShader(e,i))}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 r;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(r=e.exec(t));){var i=r[1],n=bi[i];if(void 0===n)throw new Error("Can't find include shader name "+i);t=t.replace(r[0],n)}return t},t.genMacroString=function(t,e,r){void 0===r&&(r=!0);var i=[],n="WEBGL"+t;return i.push("#ifndef "+n),i.push("#define "+n),i.push("#endif"),r&&i.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],r=t[1];!0===r?i.push("#define "+e):Number.isFinite(r)&&i.push("#define "+e+" "+r)})),i.length?i.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 r=new Set,i="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&r.add(s[1])}return r.forEach((function(t){i+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),i+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,i)},t}(),Ei=function(t){function e(e,r){var i,n=(i=t.call(this,e,r)||this).renderer.engine,s=Wr.create(n,{mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=Pr.create(n,{shader:{vertex:di,fragment:xi,glslVersion:exports.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,i.screenMesh=ii.create(n,{geometry:s,material:o,priority:0}),i.priority=5e3,i}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(t){var e,r,i;t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(i=null==(r=t.renderingData.currentFrame.globalVolume)||null==(e=r.bloom)?void 0:e.threshold)?i:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(ui),_i=function(t){function e(e,r,i){var n;(n=t.call(this,e,i)||this).type=r;var s=n.renderer.engine,o="PostProcess",a=Wr.create(s,{name:o,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:di,fragment:"H"==r?vi:yi,glslVersion:exports.GLSLVersion.GLSL1},h=Pr.create(s,{name:o,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=ii.create(s,{name:o,geometry:a,material:h,priority:0}),n.priority=5e3,n}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Mi(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(ui),Ai=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,r)||this).renderer.engine,o=Wr.create(s,{name:n,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a={vertex:di,fragment:gi},u=Pr.create(s,{name:n,shader:a});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=ii.create(s,{name:n,geometry:o,material:u,priority:0}),i.priority=5e3,i}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Mi(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(ui),Ci=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,{})||this).renderer.engine;i.sceneTextureHandle=r||new oi(s);var o=Wr.create(s,{name:n,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Pr.create(s,{name:n,shader:{vertex:di,fragment:mi,glslVersion:exports.GLSLVersion.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,i.screenMesh=ii.create(s,{name:n,geometry:o,material:a,priority:0}),i.priority=5e3,i}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear});var e=t.renderingData.currentFrame.globalVolume,r=Ye({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),i=Ye({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Ye({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),s=Ye({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(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),i.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",i.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",i.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",i.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new Ae(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new Ce(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(s.active)),t.renderMeshes([this.screenMesh])},e}(ui),Si="_effects_default_",wi=1,Ri=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=t.camera,i=t.keepColorBuffer,n=t.renderer,s=t.editorTransform,o=void 0===s?[1,1,0,0]:s,a=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,c=t.clearAction,l=void 0===c?{colorAction:exports.TextureLoadAction.whatever,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.whatever}:c,f=n.engine;a&&(this.globalVolume=a),this.globalUniforms=new Fi;var p,d=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=ke.HALF_FLOAT;d=[{texture:{format:ke.RGBA,type:v,magFilter:ke.LINEAR,minFilter:ke.LINEAR}}],p={storageType:exports.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear}}this.drawObjectPass=new ui(n,{name:Si,priority:ni,meshOrder:exports.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new oi(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=ke.HALF_FLOAT,E=new Ei(n,{name:"BloomThresholdPass",attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new oi(f);var A=new _i(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]}),C=new _i(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(A),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var w=new Ai(n,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]});w.gaussianDownSampleResult=b[5-S],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new Ci(n,g);this.addRenderPass(R)}this.semantics=new Xr(t.semantics),this.clearAction=l,this.name="RenderFrame"+wi++;var M=y[0];this.emptyTexture=gr(f),this.transparentTexture=xr(f),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(M,{listStart:0,listEnd:0,renderPass:M,intermedia:!1}),this.editorTransform=Se.fromArray(o),t.clearAction||this.resetClearActions(),this.passTextureCache=new jr(f);var O=f.gpuCapability,P=O.detail,I=kr(O.level,P.readableDepthStencilTextures&&P.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(I)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose();var e,r,i=(null==t?void 0:t.passes)?t.passes:void 0;(i!==exports.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(i)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(e=r.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var r,i=this.resource,n=i.color_a,s=i.color_b,o=e;o<t.length;o++){var a,u,h=t[o],c=null==(a=h.attachments[0])?void 0:a.texture;if(c&&r===c){var l=c===n?s:n;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(r=c)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(Si)||!r.meshes.includes(t)||(e=i,!1)})),e},e.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;r&&(0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var r,i=t[0],n=i.texture,s=i.persistent,o=n.format,a=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(o===ke.RGBA&&!s){var u=this.resource.color_a;return 0===a.length?[{texture:u}]:[{texture:a[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?exports.TextureLoadAction.clear:exports.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=exports.TextureLoadAction.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,r=t.gpuCapability,i=r.detail,n=r.level,s=this.renderer.getWidth(),o=this.renderer.getHeight(),a=2===n?ke.LINEAR:ke.NEAREST,u=mr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:ke.RGBA,name:"frame_a",minFilter:a,magFilter:a}),h=mr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:ke.RGBA,data:{width:s,height:o},minFilter:a,magFilter:a,name:"frame_b"}),c=i.readableDepthStencilTextures&&i.writableFragDepth?exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:exports.RenderPassAttachmentStorageType.depth_stencil_opaque,l=new ui(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:u}]}).initialize(this.renderer),f=new Li(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,colorAction:exports.TextureLoadAction.clear},meshOrder:exports.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=l.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:l.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:l.depthAttachment,resRP:l}}},e.createCopyMesh=function(t){var e,r=Fr,i=this.renderer.engine,n=Wr.create(i,{name:r,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=kr(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(s);var o=Pr.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:r,shader:s});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[ke.SRC_ALPHA,ke.ONE_MINUS_SRC_ALPHA,ke.SRC_ALPHA,ke.ONE_MINUS_SRC_ALPHA]),ii.create(i,{name:r,geometry:n,material:o,priority:0})},e.removeRenderPass=function(t){g(this._renderPasses,t)},oe(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function Mi(t){return t?new Ae(t.getWidth(),t.getHeight()):new Ae}var Oi,Pi,Ii,Li=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Mi(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(ui),Fi=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Vi=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return oe(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Di="function"==typeof e.WebGL2RenderingContext,Ni=function(){function t(t){this.setupCapability(t)}var r=t.prototype;return r.setupCapability=function(t){var r,i=Di&&o(t,e.WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),n&&!u&&(u=ki(t,t.HALF_FLOAT)),n&&!h&&(h=ki(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var c=n||t.getExtension("OES_texture_float")?t.FLOAT:0,l=n?e.WebGL2RenderingContext.HALF_FLOAT:(null==(r=t.getExtension("OES_texture_half_float"))?void 0:r.HALF_FLOAT_OES)||0,f={floatTexture:c,halfFloatTexture:l,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:zi(t),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!a,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=f,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},r.framebufferTexture2D=function(t,e,r,i,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&r>0)throw new Error("Draw multiple color buffers not available.");var o=s?s["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];o?t.framebufferTexture2D(e,o,i,n,0):console.error("Invalid color attachment index: "+r+".")},r.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw new Error("Draw buffers not available.")},r.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function ki(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(i=!0),t.deleteTexture(r),i}function zi(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}exports.COMPRESSED_TEXTURE=void 0,(Oi=exports.COMPRESSED_TEXTURE||(exports.COMPRESSED_TEXTURE={}))[Oi.NONE=0]="NONE",Oi[Oi.PVRTC=1]="PVRTC",Oi[Oi.ASTC=2]="ASTC",exports.FilterMode=void 0,(Pi=exports.FilterMode||(exports.FilterMode={}))[Pi.Nearest=0]="Nearest",Pi[Pi.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Ii=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Ii.RGBA32=0]="RGBA32",Ii[Ii.RGBAHalf=1]="RGBAHalf";var Ui=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},oe(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Bi=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,r,i){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,r){},e.getTemporaryRT=function(t,e,r,i,n,s){return null},e.dispose=function(t){},t}(),Gi=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=ji(this.arc,this.arcMode,t)*ge,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new Ce(r,i,0),s=Math.tan(this.angle*ge),o=n.clone().multiply(s);return o.z+=1,{position:n.multiply(Q(0,1)),direction:o.normalize()}},t}();function ji(t,e,r){if(e===Pt.RANDOM)t=Q(0,t);else if(e===Pt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Pt.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===Pt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var Xi,Hi=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=ji(this.arc,this.arcMode,t)*ge,r=new Ce(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Wi=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=Q(-this._d,this._d),r=Q(-this._h,this._h);return{direction:new Ce(0,0,1),position:new Ce(e,r,0)}},t}(),Yi=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=ji(this.arc,this.arcMode,t)*ge,r=new Ce(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,s=Math.atan2(n,i),o=Math.tan(e),a=new Ce;return e<s?a.set(i,i*o,0):e>=s&&e<Math.PI-s?a.set(n/o,n,0):e<Math.PI+s?a.set(-i,-i*o,0):e<2*Math.PI-s?a.set(-n/o,-n,0):a.set(i,i*o,0),{direction:r,position:a}},t}(),Zi=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Pt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Q(0,1);return{direction:new Ce(0,1,0),position:new Ce(this._d*(e-.5),0,0)}},t}(),qi=new Oe,Ki=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=Q(0,2*Math.PI),n=ji(this.arc,this.arcMode,t)*ge,s=qi.setFromRotationZ(n),o=new Ce(Math.cos(i),Math.sin(i),0),a=new Ce(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:s.transformNormal(o),position:s.transformPoint(a)}},t}(),Qi=new Oe,Ji=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}var e=t.prototype;return e.getHorizontalAngle=function(){return Q(-90,90)},e.generate=function(t){var e=ji(this.arc,this.arcMode,t)*ge,r=this.getHorizontalAngle()*ge,i=this.radius,n=new Ce(Math.cos(r),0,Math.sin(r)),s=Qi.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(i),direction:s}},t}(),$i=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.getHorizontalAngle=function(){return Q(0,90)},e}(Ji),tn=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,r=e.length/2-1,i=Math.floor(ji(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,s=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,o=new Ce(n,s,0);return{position:new Ce(n*this.width,s*this.height,0),direction:o.normalize()}},t}(),en=function(){function t(){}return t.prototype.generate=function(){return{position:new Ce,direction:new Ce}},t}(),rn=((Xi={})[dt.NONE]=en,Xi[dt.CONE]=Gi,Xi[dt.SPHERE]=Ji,Xi[dt.HEMISPHERE]=$i,Xi[dt.CIRCLE]=Hi,Xi[dt.DONUT]=Ki,Xi[dt.RECTANGLE]=Wi,Xi[dt.EDGE]=Zi,Xi[dt.RECTANGLE_EDGE]=Yi,Xi[dt.TEXTURE]=tn,Xi);function nn(t){if(!t)return new en;var e=Ye({radius:1,arc:360,angle:0,arcMode:Pt.RANDOM},t),r=t.type,i=rn[r];if(!i)throw new Error("Invalid shape: "+r+".");var n=new i(e);if(r!==dt.NONE){var s=t.alignSpeedDirection,o=t.upDirection,a=void 0===o?[0,0,1]:o;n.alignSpeedDirection=s,n.upDirection=Ce.fromArray(a).normalize()}return n}function sn(t,e,r,i,n){var s,o;if(n===function(t,e,r,i){for(var n=0,s=e,o=r-i;s<r;s+=i)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,e,r,i)>0)for(s=e;s<r;s+=i)o=_n(s,t[s],t[s+1],o);else for(s=r-i;s>=e;s-=i)o=_n(s,t[s],t[s+1],o);return o&&yn(o,o.next)&&(An(o),o=o.next),o}function on(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!yn(i,i.next)&&0!==vn(i.prev,i,i.next))i=i.next;else{if(An(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function an(t){var e=t.prev,r=t,i=t.next;if(vn(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(dn(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&vn(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function un(t,e,r,i){var n=t.prev,s=t,o=t.next;if(vn(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,u=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,h=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,c=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,l=fn(a,u,e,r,i),f=fn(h,c,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=l&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&vn(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vn(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=l;){if(p!==t.prev&&p!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&vn(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vn(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function hn(t,e){return t.x-e.x}function cn(t,e){if(e=function(t,e){var r,i=e,n=t.x,s=t.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>o){if(o=a,a===n){if(s===i.y)return i;if(s===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===o)return r;var u,h=r,c=r.x,l=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&dn(s<l?n:o,s,c,l,s<l?o:n,s,i.x,i.y)&&(u=Math.abs(s-i.y)/(n-i.x),Tn(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&ln(r,i)))&&(r=i,f=u)),i=i.next}while(i!==h);return r}(t,e),e){var r=En(e,t);on(e,e.next),on(r,r.next)}}function ln(t,e){return vn(t.prev,t,e.prev)<0&&vn(e.next,t,t.next)<0}function fn(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function pn(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function dn(t,e,r,i,n,s,o,a){return(n-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(i-a)-(r-o)*(e-a)>=0&&(r-o)*(s-a)-(n-o)*(i-a)>=0}function mn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&gn(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Tn(t,e)&&Tn(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(vn(t.prev,t,e.prev)||vn(t,e.prev,e))||yn(t,e)&&vn(t.prev,t,t.next)>0&&vn(e.prev,e,e.next)>0)}function vn(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function yn(t,e){return t.x===e.x&&t.y===e.y}function gn(t,e,r,i){var n=bn(vn(t,e,r)),s=bn(vn(t,e,i)),o=bn(vn(r,i,t)),a=bn(vn(r,i,e));return n!==s&&o!==a||(!(0!==n||!xn(t,r,e))||(!(0!==s||!xn(t,i,e))||(!(0!==o||!xn(r,t,i))||!(0!==a||!xn(r,e,i)))))}function xn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function bn(t){return t>0?1:t<0?-1:0}function Tn(t,e){return vn(t.prev,t,t.next)<0?vn(t,e,t.next)>=0&&vn(t,t.prev,e)>=0:vn(t,e,t.prev)<0||vn(t,t.next,e)<0}function En(t,e){var r=new Cn(t.i,t.x,t.y),i=new Cn(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function _n(t,e,r,i){var n=new Cn(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function An(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 Cn(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Sn=0;function wn(t,e,r,i){r=r||2,Sn=i||0;var n,s,o,a,u,h,c,l=e&&e.length,f=l?e[0]*r:t.length,p=sn(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(t,e,r,i){var n,s,o,a=[];for(n=0,s=e.length;n<s;n++)(o=sn(t,e[n]*i,n<s-1?e[n+1]*i:t.length,i,!1))===o.next&&(o.steiner=!0),a.push(pn(o));for(a.sort(hn),n=0;n<a.length;n++)cn(a[n],r),r=on(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=o=t[0],s=a=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(h=t[m+1])<s&&(s=h),u>o&&(o=u),h>a&&(a=h);c=0!==(c=Math.max(o-n,a-s))?1/c:0}return Rn(p,d,r,n,s,c),d}function Rn(t,e,r,i,n,s,o){if(t){!o&&s&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=fn(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,s,o,a,u,h=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,a=0,e=0;e<h&&(a++,i=i.nextZ);e++);for(u=h;a>0||u>0&&i;)0!==a&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,h*=2}while(o>1)}(n)}(t,i,n,s);for(var a,u,h=t;t.prev!==t.next;)if(a=t.prev,u=t.next,s?un(t,i,n,s):an(t))e.push(a.i/r+Sn),e.push(t.i/r+Sn),e.push(u.i/r+Sn),An(t),t=u.next,h=u.next;else if((t=u)===h){o?1===o?Rn(t=Mn(on(t),e,r),e,r,i,n,s,2):2===o&&On(t,e,r,i,n,s):Rn(on(t),e,r,i,n,s,1);break}}}function Mn(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!yn(n,s)&&gn(n,i,i.next,s)&&Tn(n,s)&&Tn(s,n)&&(e.push(n.i/r+Sn),e.push(i.i/r+Sn),e.push(s.i/r+Sn),An(i),An(i.next),i=t=s),i=i.next}while(i!==t);return on(i)}function On(t,e,r,i,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&mn(o,a)){var u=En(o,a);return o=on(o,o.next),u=on(u,u.next),Rn(o,e,r,i,n,s),void Rn(u,e,r,i,n,s)}a=a.next}o=o.next}while(o!==t)}var Pn=6,In="editor",Ln={"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"},Fn=2;function Vn(t,e){for(var r=t.s,i=t.p,n=r[1],s=i[1],o=0,a=0;a<n.length;a++){o+=n[a].length-1}var u,h=new Float32Array(o*Pn),c=e.indexBase,l=void 0===c?0:c,f=e.uvTransform,p=0,d=0,m=0,v=1,y=1;f&&(d=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=s[b],_=s[b+1]||s[0],A=T,C=[0,0],S=0;S<A.length-1;S++){kn(C,A[S],E,_,E[4],E[5],_[2],_[3]),R(C[0],C[1])}var w=wn(Array.from(h),null,Pn,l);return{aPoint:h,index:new Uint16Array(w)};function R(t,e){h[p++]=t/2,h[p++]=e/2,f?(g[0]=t,g[1]=e,Nn(g,g,x),h[p++]=d+(g[0]+1)/2*v,h[p++]=m+(g[1]+1)/2*y):(h[p++]=(t+1)/2,h[p++]=(e+1)/2),p+=Fn}}function Dn(t,e){for(var r=[],i=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[wt.SHAPE_POINTS,t.p],s:[wt.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[wt.SHAPE_POINTS,t.g.p],s:[wt.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,s=0,o=0,a=0;a<i.length;a++){var u=Vn(i[a],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,r.push(u),s+=u.aPoint.length,o+=u.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(s),c=new Uint16Array(o),l=0,f=0,p=0;l<r[l];l++){var d=r[l];h.set(d.aPoint,f),f+=d.aPoint.length,c.set(d.index,p),p+=d.index.length}return{aPoint:h,index:c}}function Nn(t,e,r){var i=Math.cos(r),n=Math.sin(r),s=e[0],o=e[1];return t[0]=i*s+n*o,t[1]=-n*s+i*o,t}function kn(t,e,r,i,n,s,o,a){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;return t[0]=h*r[0]+c*n+l*o+f*i[0],t[1]=h*r[1]+c*s+l*a+f*i[1],t}var zn,Un=[[0,0,1,1,0]],Bn=function(t){function e(e){var r;(r=t.call(this,e)||this).visible=!0,r.splits=Un,r.meshCollider=new so,r._color=new Re(1,1,1,1),r.getHitTestParams=function(t){var e=Oe.fromScale(r.transform.size.x,r.transform.size.y,1).premultiply(r.transform.getWorldMatrix()),i=r.interaction;if(t||i){r.meshCollider.setGeometry(r.geometry,e);var n,s=r.meshCollider.getBoundingBoxData();if(s)return{behavior:(null==(n=r.interaction)?void 0:n.behavior)||0,type:s.type,triangles:s.area,backfaceCulling:r.renderer.side===ft.FRONT}}},r.renderer={renderMode:xt.MESH,blending:lt.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:ft.DOUBLE,mask:0},r.defaultGeometry=Wr.create(r.engine,{attributes:{aPos:{type:ke.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:ke.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:ke.TRIANGLES,drawCount:6}),r.geometry=r.defaultGeometry;var i=Pr.create(r.engine,{shader:{fragment:ci,vertex:hi,shared:!0}});return r.material=i,r.material.setColor("_Color",new Re(1,1,1,1)),r.maskManager=new Ir(e),r}Ct(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){o(t,Re)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},r.setTexture=function(t){var e=this;return i((function(){var r;return h(this,(function(i){switch(i.label){case 0:return"string"!=typeof t?[3,2]:[4,mr.fromImage(t,e.item.engine)];case 1:return r=i.sent(),[3,3];case 2:r=t,i.label=3;case 3:return e.renderer.texture=r,e.material.setTexture("_MainTex",r),[2]}}))}))()},r.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},r.getItemGeometryData=function(t){var e=this.splits,r=this.textureSheetAnimation,i=this.defaultGeometry;if(t.shape){for(var n=t.shape,s=n.index,o=void 0===s?[]:s,a=n.aPoint,u=void 0===a?[]:a,h=new Float32Array(u),c=[],l=[],f=0;f<h.length;f+=6)h[f]*=1,h[f+1]*=1,l.push(u[f+2],u[f+3]),c.push(h[f],h[f+1],0);return i.setAttributeData("aPos",new Float32Array(c)),{index:o,aUV:l}}var p=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],d=[],m=[],v=[];if(1===e.length){var y=r?[0,0,1,1,e[0][4]]:e[0],g=y[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],x=y[0],b=y[1],T=y[4]?y[3]:y[2],E=y[4]?y[2]:y[3];d.push(g[0]*T+x,g[1]*E+b,g[2]*T+x,g[3]*E+b,g[4]*T+x,g[5]*E+b,g[6]*T+x,g[7]*E+b),v.push(p[0],p[1],0,p[2],p[3],0,p[4],p[5],0,p[6],p[7],0),m.push(0,1,2,2,1,3)}else for(var _=0;_<2;_++)for(var A=0;A<2;A++){var C=4*(2*A+_),S=r?[0,0,1,1,e[0][4]]:e[2*A+_],w=S[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],R=((_+_+1)/2-1)/2,M=((A+A+1)/2-1)/2,O=S[0],P=S[1],I=S[4]?S[3]:S[2],L=S[4]?S[2]:S[3],F=[p[0]/2+R,p[1]/2+M,p[2]/2+R,p[3]/2+M,p[4]/2+R,p[5]/2+M,p[6]/2+R,p[7]/2+M];d.push(w[0]*I+O,w[1]*L+P,w[2]*I+O,w[3]*L+P,w[4]*I+O,w[5]*L+P,w[6]*I+O,w[7]*L+P),v.push(1*F[0],1*F[1],0,1*F[2],1*F[3],0,1*F[4],1*F[5],0,1*F[6],1*F[7],0),m.push(C,1+C,2+C,2+C,1+C,3+C)}return i.setAttributeData("aPos",new Float32Array(v)),{index:m,aUV:d}},r.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),r=e.index,i=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(r)),n.setAttributeData("aUV",new Float32Array(i)),n.setDrawCount(r.length),n},r.configureMaterial=function(t){var e=t.side,r=t.occlusion,i=t.blending,n=t.mask,s=t.texture,o=this.maskManager.maskMode,a=this.material;a.blending=!0,a.depthTest=!0,a.depthMask=r,a.stencilRef=void 0!==n?[n,n]:void 0,Xe(a,i),We(a,o),He(a,e),a.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',a.setVector4("_TexOffset",new Se(0,0,1,1)),a.setTexture("_MainTex",s);var u=je(i),h=new Se;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=o,a.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},r.draw=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++){var r=this.materials[e];r.setVector2("_Size",this.transform.size),this.renderer.renderMode!==xt.BILLBOARD&&this.renderer.renderMode!==xt.VERTICAL_BILLBOARD&&this.renderer.renderMode!==xt.HORIZONTAL_BILLBOARD||r.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,r,e)}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i=e,n=null!=(r=i.renderer)?r:{},o=i.splits,a=i.textureSheetAnimation,u=i.mask;u&&this.maskManager.getMaskMode(u);var h,c,l,f=n.shape,p=o&&!a?o[0]:void 0,d=void 0;if(null==f||"aPoint"in f&&"index"in f||(d=Dn(f,p)),this.splits=o||Un,this.textureSheetAnimation=a,this.renderer={renderMode:null!=(h=n.renderMode)?h:xt.MESH,blending:null!=(c=n.blending)?c:lt.ALPHA,texture:n.texture?this.engine.findObject(n.texture):this.engine.emptyTexture,occlusion:!!n.occlusion,transparentOcclusion:!!n.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(l=n.side)?l:ft.DOUBLE,mask:this.maskManager.getRefValue(),shape:d},this.configureMaterial(this.renderer),i.geometry){var m=this.engine.findObject(i.geometry),v=i.splits&&!i.textureSheetAnimation?i.splits[0]:Un[0],y=v[0],g=v[1],x=Boolean(v[4]),b=x?v[3]:v[2],T=x?v[2]:v[3],E=x?-Math.PI/2:0,_=m.getAttributeData("aUV"),A=m.getAttributeData("aPos"),C=m.getIndexData(),S=[0,0];if(_&&A&&C){for(var w=_.length/2,R=0;R<w;R++){var M=3*R,O=2*R,P=A[M],I=A[M+1];S[0]=P,S[1]=I,Nn(S,S,E),_[O]=(S[0]+.5)*b+y,_[O+1]=(S[1]+.5)*T+g}this.geometry.setAttributeData("aPos",A.slice()),this.geometry.setAttributeData("aUV",_.slice()),this.geometry.setIndexData(C.slice()),this.geometry.setDrawCount(C.length)}this.geometry.subMeshes.length=0;for(var L,F=s(m.subMeshes);!(L=F()).done;){var V=L.value;this.geometry.subMeshes.push({offset:V.offset,indexCount:V.indexCount,vertexCount:V.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},oe(e,[{key:"color",get:function(){return this._color},set:function(t){this._color=t,this.material.setColor("_Color",this._color)}}]),e}(ve);exports.ShapeComponent=function(t){function e(e){var r;(r=t.call(this,e)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new au,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",r.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0});var i={shader:{vertex:r.vert,fragment:r.frag,glslVersion:exports.GLSLVersion.GLSL1}},n=Pr.create(e,i),s=Pr.create(e,i);return n.color=new Re(1,1,1,1),n.depthMask=!1,n.depthTest=!0,n.blending=!0,r.material=n,s.color=new Re(.25,.25,.25,1),s.depthMask=!1,s.depthTest=!0,s.blending=!0,r.materials[1]=s,r.strokeAttributes={width:1,alignment:.5,cap:Yt.Butt,join:Zt.Miter,miterLimit:10,color:new Re(1,1,1,1)},r.fillAttribute={color:new Re(1,1,1,1)},r.shapeAttribute={type:Wt.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}Ct(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){this.material.color=this.fillAttribute.color,this.materials[1].color=this.strokeAttributes.color,this.shapeDirty&&(this.buildPath(this.shapeAttribute),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1)},r.buildGeometryFromPath=function(t){var e=t.shapePrimitives,r=[],i=[];if(this.hasFill)for(var n,o=s(e);!(n=o()).done;){var a=n.value.shape,u=[],h=i.length,c=r.length/2;a.build(u),a.triangulate(u,r,c,i,h)}var l=i.length;if(this.hasStroke)for(var f,p=s(e);!(f=p()).done;){var d=f.value.shape,m=[],v=r.length/2,y=this.strokeAttributes,g=!0;this.shapeAttribute.type===Wt.Custom&&(g=d.closePath),d.build(m),Ha(m,y,!1,g,r,2,v,i)}var x=i.length-l,b=r.length/2,T=this.geometry.getAttributeData("aPos"),E=this.geometry.getAttributeData("aUV"),_=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!E||E.length<2*b)&&(E=new Float32Array(2*b)),(!_||_.length<i.length)&&(_=new Uint16Array(i.length));for(var A=0;A<b;A++){var C=3*A,S=2*A,w=2*A;T[C]=r[S],T[C+1]=r[S+1],T[C+2]=0,E[w]=T[C],E[w+1]=T[C+1]}_.set(i),this.geometry.setAttributeData("aPos",T),this.geometry.setAttributeData("aUV",E),this.geometry.setIndexData(_),this.geometry.setDrawCount(i.length);var R=this.geometry.subMeshes[0],M=this.geometry.subMeshes[1];R.indexCount=l,M.offset=2*l,M.indexCount=x},r.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case Wt.Custom:for(var e,r=this.shapeAttribute,i=r.points,n=r.easingIns,o=r.easingOuts,a=s(r.shapes);!(e=a()).done;){var u=e.value,h=u.indexes,c=i[h[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var l=1;l<h.length;l++){var f=h[l],p=h[l-1],d=i[f.point],m=i[p.point],v=o[p.easingOut],y=n[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+d.x,y.y+d.y,d.x,d.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=i[g.point],T=i[x.point],E=o[x.easingOut],_=n[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,_.x+b.x,_.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case Wt.Ellipse:var A=t;this.graphicsPath.ellipse(0,0,A.xRadius,A.yRadius);break;case Wt.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case Wt.Star:var S=t;this.graphicsPath.polyStar(S.pointCount,S.outerRadius,S.innerRadius,S.outerRoundness,S.innerRoundness,exports.StarType.Star);break;case Wt.Polygon:var w=t;this.graphicsPath.polyStar(w.pointCount,w.radius,w.radius,w.roundness,w.roundness,exports.StarType.Polygon)}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shapeDirty=!0;var r=e.stroke;r&&(this.hasStroke=!0,this.strokeAttributes.width=r.width,this.strokeAttributes.color.copyFrom(r.color),this.strokeAttributes.cap=r.cap,this.strokeAttributes.join=r.join);var i=e.fill;switch(i&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(i.color)),e.type){case Wt.Custom:for(var n,o=e,a={type:Wt.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:o.fill},u=s(o.points);!(n=u()).done;){var h=n.value;a.points.push(new Ae(h.x,h.y))}for(var c,l=s(o.easingIns);!(c=l()).done;){var f=c.value;a.easingIns.push(new Ae(f.x,f.y))}for(var p,d=s(o.easingOuts);!(p=d()).done;){var m=p.value;a.easingOuts.push(new Ae(m.x,m.y))}a.shapes=o.shapes,this.shapeAttribute=a;break;case Wt.Ellipse:var v=e,y={type:Wt.Ellipse,xRadius:v.xRadius,yRadius:v.yRadius,fill:v.fill};this.shapeAttribute=y;break;case Wt.Rectangle:var g=e,x={type:Wt.Rectangle,width:g.width,height:g.height,roundness:g.roundness,fill:g.fill};this.shapeAttribute=x;break;case Wt.Star:var b=e,T={type:Wt.Star,pointCount:b.pointCount,innerRadius:b.innerRadius,outerRadius:b.outerRadius,innerRoundness:b.innerRoundness,outerRoundness:b.outerRoundness,fill:b.fill};this.shapeAttribute=T;break;case Wt.Polygon:var E=e,_={type:Wt.Polygon,pointCount:E.pointCount,radius:E.radius,roundness:E.roundness,fill:E.fill};this.shapeAttribute=_}e.mask&&this.maskManager.getMaskMode(e.mask);var A=this.maskManager.getRefValue();this.material.stencilRef=void 0!==A?[A,A]:void 0,We(this.material,this.maskManager.maskMode)},oe(e,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),e}(Bn),exports.ShapeComponent=u([ce("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}Ct(e,t);var r=e.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,r=0,i=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,r=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,i=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,r=this.startPositionY*(1-s)+s*this.endPositionY,i=this.startPositionZ*(1-s)+s*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",r*this.amountOfMotion),o.setFloat("_PosZ",i*this.amountOfMotion)}},e}(de),u([le()],exports.Fake3DComponent.prototype,"loop",void 0),u([le()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),u([le()],exports.Fake3DComponent.prototype,"animationLength",void 0),u([le()],exports.Fake3DComponent.prototype,"mode",void 0),u([le()],exports.Fake3DComponent.prototype,"startPositionX",void 0),u([le()],exports.Fake3DComponent.prototype,"startPositionY",void 0),u([le()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),u([le()],exports.Fake3DComponent.prototype,"endPositionX",void 0),u([le()],exports.Fake3DComponent.prototype,"endPositionY",void 0),u([le()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),u([le()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),u([le()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),u([le()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),u([le()],exports.Fake3DComponent.prototype,"phaseX",void 0),u([le()],exports.Fake3DComponent.prototype,"phaseY",void 0),u([le()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=u([ce("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(zn=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[zn.Circular=0]="Circular",zn[zn.Linear=1]="Linear",exports.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.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())}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(de),exports.CameraController=u([ce(Qt.CameraController)],exports.CameraController);var Gn,jn=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t);exports.HitTestType=void 0,(Gn=exports.HitTestType||(exports.HitTestType={}))[Gn.triangle=1]="triangle",Gn[Gn.box=2]="box",Gn[Gn.sphere=3]="sphere",Gn[Gn.custom=4]="custom";var Xn="click",Hn="touchstart",Wn="touchmove",Yn="touchend",Zn=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var r=t.prototype;return r.bindListeners=function(){var t,r,i,n,s,o=this;s=function(t){return t};var a,u="mousedown",h="mousemove",c="mouseup",l=function(t,r,i,s,a){void 0===s&&(s=0),void 0===a&&(a=0);var u=0,h=0,c=e.performance.now();if(!o.target)return X.warn("Trigger TouchEvent after EventSystem is disposed."),{x:r,y:i,vx:0,vy:h,dx:s,dy:a,ts:c,width:0,height:0,origin:t};var l=o.target,f=l.width,p=l.height;if(n){var d=c-n.ts;u=(s-n.dx)/d||0,h=(a-n.dy)/d||0,n={dx:s,dy:a,ts:c}}return{x:r,y:i,vx:u,vy:h,dx:s,dy:a,ts:c,width:f,height:p,origin:t}};M()&&(s=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},u="touchstart",h="touchmove",c="touchend"),this.nativeHandlers=((a={})[u]=function(a){if(o.enabled){var u=s(a),h=qn(u);t=h.x,r=h.y,n=i={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:t,y:r},o.dispatchEvent(Hn,l(a,t,r))}},a[h]=function(e){if(i&&o.enabled){var n=qn(s(e));t=n.x,r=n.y,o.dispatchEvent(Wn,l(e,t,r,t-i.x,r-i.y))}},a[c]=function(e){if(i&&o.enabled){!o.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=s(e),a=qn(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=a.x,r=a.y,u<4&&o.dispatchEvent(Xn,l(e,t,r)),o.dispatchEvent(Yn,l(e,t,r,t-i.x,r-i.y))}i=0},a),Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.nativeHandlers[t])}))},r.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},r.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),y(r,e),function(){g(r,e)}},r.removeEventListener=function(t,e){var r=this.handlers[t];r&&g(r,e)},r.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function qn(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),s=n.left,o=n.top;return{x:(r-s)/n.width*2-1,y:1-(i-o)/n.height*2}}var Kn,Qn,Jn=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),$n=(Kn=new Float32Array(1),Qn=new Int32Array(Kn.buffer),function(t){Kn[0]=t;var e=Qn[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),ts=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=$n(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=$n(t[r])},t}();var es,rs=new Zr,is=new Oe;function ns(t,e,r,i,n,s,o){var a=t,u=i/n,h=i,c=e.speedOverLifetime;c&&(h=c.getIntegrateValue(0,i,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;a.copyFrom(s),a.addScaledVector(o,h),a.addScaledVector(r,l);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{};if(p.enabled){var d=new Ce;p.center&&d.setFromArray(p.center);var m=a.clone().subtract(d),v=p.asRotation,y=["x","y","z"].map((function(t){var e=p[t];return e?v?e.getValue(u):e.getIntegrateValue(0,i,n):0}));rs.setFromArray(y).negate(),is.setFromEuler(rs);var g=is.transformPoint(m);a.addVectors(d,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,i,n);a.x=a.x+_}if(T){var A=x?T.getValue(u):T.getIntegrateValue(0,i,n);a.y=a.y+A}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,i,n);a.z=a.z+C}}return a}function ss(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function os(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function as(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(r&&t!==r)for(var o=0;o<r.length;o++)t[o]=r[o];return t}var us=((es={})[bt.PARTICLE_ORIGIN_CENTER]=[0,0],es[bt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],es[bt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],es[bt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],es[bt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],es[bt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],es[bt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],es[bt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],es[bt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],es);function hs(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function cs(t,e,r){var i=r.position,n=new Ce(t,e,0),s=new Ce;return r.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(i),new Kr(i,s)}function ls(t,e,r){var i=t.x,n=t.y,s=t.z,o=new Ce(i-e,n+r,s),a=new Ce(i-e,n-r,s),u=new Ce(i+e,n-r,s),h=new Ce(i+e,n+r,s);return[{p0:o,p1:a,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function fs(t,e,r){return void 0===r&&(r=1e-6),Math.abs(t-e)<r}function ps(t,e){void 0===e&&(e=2);var r=Math.pow(10,e);return Math.floor(t*r)/r}var ds={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],r=this.getPointIndexInCurve(t,this.pointIndexCache),i=r.xIndex,n=r.yIndex,s=e[i],o=e[n];return new Ae(s,o)},getPointIndexInCurve:function(t,e){var r=t[0],i=t[2],n=r===Rt.LINE||r===Rt.EASE_OUT?0:r===Rt.EASE_IN||r===Rt.EASE||r===Rt.HOLD&&i===Rt.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 r=t[2];return!(e!==Rt.HOLD||!this.isKeyframeTypeLeftSideEase(r))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var r=t[2];return!(e!==Rt.HOLD||!this.isKeyframeTypeRightSideEase(r))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[Rt.EASE,Rt.EASE_IN,Rt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[Rt.EASE,Rt.EASE_OUT,Rt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===Rt.HOLD&&[Rt.HOLD,Rt.LINE_OUT,Rt.EASE_OUT].includes(r)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===Rt.HOLD&&[Rt.HOLD,Rt.LINE,Rt.EASE_IN].includes(r)}},ms=function(t,e){this.points=t,this.totalLength=e},vs={},ys={},gs=.1;function xs(t,e){return 1-3*e+3*t}function bs(t,e){return 3*e-6*t}function Ts(t){return 3*t}function Es(t,e,r){return((xs(e,r)*t+bs(e,r))*t+Ts(e))*t}function _s(t,e,r){return 3*xs(e,r)*t*t+2*bs(e,r)*t+Ts(e)}var As=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,r,i){var n=ps(e.x-t.x,3)+"_"+ps(e.y-t.y,3)+"_"+ps(e.z-t.z,3)+"&"+ps(r.x-t.x,3)+"_"+ps(r.y-t.y,3)+"_"+ps(r.z-t.z,3)+"&"+ps(i.x-t.x,3)+"_"+ps(i.y-t.y,3)+"_"+ps(i.z-t.z,3);if(ys[n])return{data:ys[n],interval:t};for(var s=[],o=null,a=0,u=0,h=0;h<300;h+=1){var c=new Ce,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(r.x-t.x)+3*(1-l)*Math.pow(l,2)*(i.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(r.y-t.y)+3*(1-l)*Math.pow(l,2)*(i.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(r.z-t.z)+3*(1-l)*Math.pow(l,2)*(i.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==o&&(u+=Math.pow(c.x-o.x,2),u+=Math.pow(c.y-o.y,2),u+=Math.pow(c.z-o.z,2)),o=c,a+=u=Math.sqrt(u),s[h]={partialLength:u,point:c}}var f=new ms(s,a);return ys[n]=f,{data:f,interval:new Ce(t.x,t.y,t.z)}}(t,e,r,i),s=n.data,o=n.interval;this.lengthData=s,this.interval=o,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(fs(1-t,0))return e.points[299].point.clone().add(this.interval);if(fs(e.totalLength,0))return this.p1.clone();var r=new Ce,i=ps(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(fs(n,i))return e.points[s].point.clone().add(this.interval);var o=!0,a=1;for(i<n&&(a=-1);o;){if(i>=n){if(299===s){r.x=e.points[s].point.x,r.y=e.points[s].point.y,r.z=e.points[s].point.z;break}if(i<n+e.points[s+1].partialLength){var u=(i-n)/e.points[s+1].partialLength;r.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,r.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,r.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}a>0&&s<299?(s+=a,n+=ps(e.points[s].partialLength,5)):a<0&&s>0?(n-=ps(e.points[s].partialLength,5),s+=a):o=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,r.add(this.interval),r},t}(),Cs=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.temp=new Me,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):fs(1-t,0)?this.temp.copyFrom(this.p2):(Rs.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Ss=function(){function t(t,e,r,i){this.mX1=t,this.mY1=e,this.mX2=r,this.mY2=i,this.precomputed=!1,this.mSampleValues=new Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,this.mX1===this.mY1&&this.mX2===this.mY2||this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),Es(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=Es(t*gs,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,r=0,i=1;10!==i&&e[i]<=t;++i)r+=gs;var n=r+(t-e[--i])/(e[i+1]-e[i])*gs,s=_s(n,this.mX1,this.mX2);return s>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var s=_s(e,r,i);if(0===s)return e;e-=(Es(e,r,i)-t)/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,r,i,n){var s,o,a=0;do{(s=Es(o=e+(r-e)/2,i,n)-t)>0?r=o:e=o}while(Math.abs(s)>1e-7&&++a<10);return o}(t,r,r+gs,this.mX1,this.mX2)},t}();function ws(t,e){var r=function(t,e,r){var i=t[1],n=ds.isHoldOutKeyframe(t),s=ds.isHoldInKeyframe(e),o=!s&&ds.isRightSideEase(t),a=!n&&ds.isLeftSideEase(e);if(o&&!a&&!s){var u=new Ae(i[i.length-4],i[i.length-3]),h=new Ae(i[i.length-2],i[i.length-1]),c=ds.getPointInCurve(e),l=new Ae(c.x,c.y);return{type:"ease",p0:u,p1:h,p2:new Ae(l.x-(l.x-u.x)/10,l.y),p3:l}}if(!o&&a&&!n){var f=e[1],p=ds.getPointInCurve(t),d=new Ae(p.x,p.y),m=new Ae(f[0],f[1]),v=new Ae(f[2],f[3]);return{type:"ease",p0:d,p1:new Ae(d.x+(v.x-d.x)/10,d.y),p2:m,p3:v}}if(o&&a){var y=e[1];return{type:"ease",p0:new Ae(i[i.length-4],i[i.length-3]),p1:new Ae(i[i.length-2],i[i.length-1]),p2:new Ae(y[0],y[1]),p3:new Ae(y[2],y[3])}}var g=ds.getPointInCurve(t),x=ds.getPointInCurve(e);n?x.y=g.y:s&&(g.y=x.y);return r?{type:"ease",p0:g,p1:new Ae((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new Ae((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}:{type:"line",p0:g,p1:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),i=r.p0,n=r.p1,s=r.p2,o=r.p3;k(s),k(o);var a,u,h=o.x-i.x,c=o.y-i.y,l=ps((n.x-i.x)/h,5),f=ps((s.x-i.x)/h,5);fs(c,0)?a=u=NaN:(a=ps((n.y-i.y)/c,5),u=ps((s.y-i.y)/c,5)),l<0&&(console.error("Invalid bezier points, x1 < 0",i,n,s,o),l=0),f<0&&(console.error("Invalid bezier points, x2 < 0",i,n,s,o),f=0),l>1&&(console.error("Invalid bezier points, x1 >= 1",i,n,s,o),l=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",i,n,s,o),f=1);var p,d=("bez_"+l+"_"+a+"_"+f+"_"+u).replace(/\./g,"p");return vs[d]?p=vs[d]:(p=new Ss(l,a,f,u),vs[d]=p),{points:[i,n,s,o],timeInterval:h,valueInterval:c,curve:p}}var Rs=function(){function t(){}return t.slerpFlat=function(t,e,r,i){var n=e.x,s=e.y,o=e.z,a=e.w,u=r.x,h=r.y,c=r.z,l=r.w;if(0===i)return t.x=n,t.y=s,t.z=o,void(t.w=a);if(1===i)return t.x=u,t.y=h,t.z=c,void(t.w=l);if(a!==l||n!==u||s!==h||o!==c){var f=1-i,p=n*u+s*h+o*c+a*l,d=p>=0?1:-1,m=1-p*p;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,p*d);f=Math.sin(f*y)/v,i=Math.sin(i*y)/v}var g=i*d;if(n=n*f+u*g,s=s*f+h*g,o=o*f+c*g,a=a*f+l*g,f===1-i){var x=1/Math.sqrt(n*n+s*s+o*o+a*a);n*=x,s*=x,o*=x,a*=x}}t.x=n,t.y=s,t.z=o,t.w=a},t}(),Ms="not_implement",Os=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Ms)},e.getIntegrateValue=function(t,e,r){throw new Error(Ms)},e.getIntegrateByTime=function(t,e){throw new Error(Ms)},e.getValue=function(t){throw new Error(Ms)},e.getMaxTime=function(){throw new Error(Ms)},e.toUniform=function(t){throw new Error(Ms)},e.map=function(t){throw new Error(Ms)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Ms)},t.getAllData=function(t,e){for(var r=new(e?ts:Float32Array)(4*t.index),i=0,n=0,s=t.curves;i<s.length;i++){var o=s[i].toData();r.set(o,n),n+=o.length}return e?r.data:r},t}(),Ps=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},r.getMaxTime=function(){return 0},e}(Os),Is=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(Os),Ls=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t,e){var r=null!=e?e:Math.random();return this.min+r*(this.max-this.min)},r.getIntegrateValue=function(t,e,r){var i=null!=r?r:1;return(this.min+i*(this.max-this.min))*(e-t)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Os),Fs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var s=Math.random();i[n]=e[n]*(1-s)+r[n]*s}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Os),Vs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,s=this.xCoord*r;return((i+e/s*(n-i)+i)*e-(i+t/s*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return js(e,0,this.xCoord,this.min,this.max)-js(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(Os),Ds=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=E(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1];if(n.stop<=t&&s.stop>t){var o=(t-n.stop)/(s.stop-n.stop);return _(n.color,s.color,o,!0)}}return e[r].color.slice()},e}(Os),Ns=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1],o=n[0],a=s[0];if(t>=o&&t<=a){var u=(t-o)/(a-o),h=n[1];return h+u*(s[1]-h)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,s=e?js:Gs,o=0;o<n;o++){var a=r[o],u=r[o+1],h=a[0],c=u[0];if(t>h&&t<=c)return i+s(t,h,c,a[1],u[1]);i+=s(c,h,c,a[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},r.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},r.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Os),ks=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t;this.curveMap={},this.keys=[];for(var r=0;r<e.length-1;r++){var i=ws(e[r],e[r+1]),n=i.points,s=i.curve,o=i.timeInterval,a=i.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())),this.curveMap[u.x+"&"+h.x]={points:n,timeInterval:o,valueInterval:a,curve:s,timeStart:Number(u.x),timeEnd:Number(h.x)}}this.startKeyframe=e[0],this.endKeyframe=e[e.length-1],this.keyTimeData=Object.keys(this.curveMap)},r.getValue=function(t){var e=0,r=this.keyTimeData,i=this.curveMap[r[0]].timeStart,n=this.curveMap[r[r.length-1]].timeEnd;if(t<=i)return ds.getPointIndexInCurve(this.startKeyframe,ds.pointIndexCache),this.startKeyframe[1][ds.pointIndexCache.yIndex];if(t>=n)return ds.getPointIndexInCurve(this.endKeyframe,ds.pointIndexCache),this.endKeyframe[1][ds.pointIndexCache.yIndex];for(var s=0;s<r.length;s++){var o=this.curveMap[r[s]].timeStart,a=this.curveMap[r[s]].timeEnd;if(t>=Number(o)&&t<Number(a)){e=this.getCurveValue(r[s],t);break}}return e},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=(e-t)/r,n=0,s=Object.keys(this.curveMap);if(i<=this.curveMap[s[0]].timeStart)return 0;for(var o=0;o<s.length;o++){var a=this.curveMap[s[o]].timeStart,u=this.curveMap[s[o]].timeEnd;if(i>=Number(u)&&(n+=r*this.getCurveIntegrateValue(s[o],Number(u))),i>=Number(a)&&i<Number(u)){n+=r*this.getCurveIntegrateValue(s[o],i);break}}return n},r.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},r.getCurveIntegrateValue=function(t,e){for(var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,o=0,a=(e-i.x)/20,u=0;u<=20;u++){var h=u*a/n,c=i.y+s*r.curve.getValue(h);o+=0===u||20===u?c:u%2==1?4*c:2*c}return o*=a/3},r.getCurveValue=function(t,e){var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,o=(e-i.x)/n,a=r.curve.getValue(o);return i.y+s*a},r.toUniform=function(t){var e=t.index,r=this.keys.length;return t.curves.push(this),t.index=e+r,t.max=Math.max(t.max,r),t.curveCount+=r,new Float32Array([5,e+1/r,e,r])},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveMap[t[t.length-1]].timeEnd},e}(Os),zs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],s=e[i+1];if(n[0]<=t&&s[0]>=t){var o=s[1]-n[1],a=void 0;if(0===o)a=(t-n[0])/(s[0]-n[0]);else a=(Xs(t,n,s)-n[1])/o;return this.calculateVec(i,a)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],s=0;s<r.length;s++)n[s]=r[s]*(1-e)+i[s]*e;return n},e}(Os),Us=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length){for(var n=0;n<e.length-1;n++){var s=e[n],o=e[n+1],a=new Ce(r[n][0],r[n][1],r[n][2]),u=new Ce(r[n+1][0],r[n+1][1],r[n+1][2]),h=new Ce(i[2*n][0],i[2*n][1],i[2*n][2]),c=new Ce(i[2*n+1][0],i[2*n+1][1],i[2*n+1][2]),l=ws(s,o),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new As(a,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},r.getValue=function(t){var e=ps(t,5),r=0,i=new Ce,n=this.keyTimeData;if(!n.length)return i;var s=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=s)return i=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return i=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<n.length;a++){var u=this.curveSegments[n[a]].timeStart,h=this.curveSegments[n[a]].timeEnd;if(e>=Number(u)&&e<Number(h)){var c=this.curveSegments[n[a]].pathCurve;r=this.getPercValue(n[a],e),i=c.getPointInPercent(r)}}return i},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=ps((e-i.x)/n,4);return _e(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Os),Bs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length)for(var n=0;n<e.length-1;n++){var s=e[n],o=e[n+1],a=Me.fromArray(r[n]),u=Me.fromArray(r[n+1]),h=Me.fromArray(i[2*n]),c=Me.fromArray(i[2*n+1]),l=ws(s,o),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new Cs(a,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g}}},r.getValue=function(t){var e=0,r=ps(t,5),i=Object.keys(this.curveSegments),n=Number(i[0].split("&")[0]),s=Number(i[i.length-1].split("&")[1]);if(r<=n)return this.curveSegments[i[0]].pathCurve.getPointInPercent(0);if(r>=s)return this.curveSegments[i[i.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<i.length;o++){var a=i[o].split("&"),u=a[0],h=a[1];if(r>=Number(u)&&r<Number(h)){var c=this.curveSegments[i[o]].pathCurve;return e=this.getPercValue(i[o],r),c.getPointInPercent(e)}}return this.curveSegments[i[0]].pathCurve.getPointInPercent(0)},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=ps((e-i.x)/n,4);return _e(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Os);function Gs(t,e,r,i,n){var s=t-e;return(i+i+(n-i)*s/(r-e))*s/2}function js(t,e,r,i,n){var s=t*t,o=e*e;return(2*(s*t)*(i-n)+3*s*(e*n-r*i)-o*e*(2*i+n)+3*o*r*i)/(6*(e-r))}function Xs(t,e,r){var i=r[0]-e[0],n=e[3]*i,s=r[2]*i,o=(t-e[0])/i,a=o*o,u=a*o,h=u-2*a+o,c=u-a,l=-2*u+3*a;return(2*u-3*a+1)*e[1]+h*n+c*s+l*r[1]}function Hs(t,e){if(e){var r=e[0],i=e[1];if(r===wt.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===wt.LINE){var s=i.length;if(2===s&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&s++,i[i.length-1][0]<1&&s++;var o=Math.ceil(s/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}else if(r===wt.BEZIER_CURVE){var a=i.length-1;t.index+=2*a,t.curves.push(i),t.max=Math.max(t.max,2*a),t.curveCount+=2*a}}}function Ws(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function Ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ys=function(){return!!t})()}function Zs(t,e,r){return Zs=Ys()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&At(n,r.prototype),n},Zs.apply(null,arguments)}var qs,Ks=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Se,e}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=$s(t[0]),this.yCurve=$s(t[1]),this.zCurve=$s(t[2]),this.wCurve=$s(t[3])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t),i=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Os),Qs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Ae,e}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=$s(t[0]),this.yCurve=$s(t[1])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t);return this.value.set(e,r),this.value},e}(Os),Js=((qs={})[wt.RANDOM]=function(t){return o(t[0],Array)?new Fs(t):new Ls(t)},qs[wt.CONSTANT]=function(t){return new Ps(t)},qs[wt.CONSTANT_VEC2]=function(t){return new Ps(t)},qs[wt.CONSTANT_VEC3]=function(t){return new Ps(t)},qs[wt.CONSTANT_VEC4]=function(t){return new Ps(t)},qs[wt.RGBA_COLOR]=function(t){return new Ps(t)},qs[wt.COLORS]=function(t){return new Is(t.map((function(t){return b(t,!1)})))},qs[wt.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Vs([t[0][1],t[1][1]]):new Ns(t)},qs[wt.GRADIENT_COLOR]=function(t){return new Ds(t)},qs[wt.LINEAR_PATH]=function(t){return new zs(t)},qs[wt.BEZIER_CURVE]=function(t){return 1===t.length?new Ps(t[0][1][1]):new ks(t)},qs[wt.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Ps(Zs(Ce,[].concat(t[1][0]))):new Us(t)},qs[wt.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Ps(Zs(Me,[].concat(t[1][0]))):new Bs(t)},qs[wt.COLOR_CURVE]=function(t){return new to(t)},qs[wt.VECTOR4_CURVE]=function(t){return new Ks(t)},qs[wt.VECTOR2_CURVE]=function(t){return new Qs(t)},qs);function $s(t){if(!t||!isNaN(+t))return new Ps(t||0);if(o(t,Os))return t;if(Z(Js[t[0]]))return Js[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Ln["ValueType: 21/22 is not supported"]+".")}var to=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Re,e}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.rCurve=$s(t[0]),this.gCurve=$s(t[1]),this.bCurve=$s(t[2]),this.aCurve=$s(t[3])},r.getValue=function(t){var e=this.rCurve.getValue(t),r=this.gCurve.getValue(t),i=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Os),eo=1,ro=function(){function t(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new Ce,n=new Me,s=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,s),e.x=s.x,e.y=s.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},e.createMaterial=function(t){var e,r=[["ENV_EDITOR",(null==(e=this.engine.renderer)?void 0:e.env)===In]],i=$s(this.color).getValue(0),n={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:exports.GLSLVersion.GLSL1,cacheId:t.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=Pr.create(this.engine,n);return s.blending=!0,s.depthTest=!1,s.setVector4("uPos",new Se(0,0,0,0)),s.setVector2("uSize",new Ae(1,1)),s.setVector4("uColor",new Se(i[0]/255,i[1]/255,i[2]/255,i[3])),s.setQuaternion("uQuat",new Me(0,0,0,0)),s},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Wr.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:ke.LINES,maxVertex:4})},e.createMesh=function(t,e){return ii.create(this.engine,{name:"Interact_preview"+eo++,priority:0,worldMatrix:Oe.fromIdentity(),geometry:t,material:e})},t}();function io(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var r=e.item.props.content.options.behavior,i=e.getBoundingBox();return i?{type:i.type,triangles:i.area,behavior:r}:void 0}},e}Ct(e,t);var r=e.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.props.content.options,e=this.item.engine.renderer.env,r=this.item.composition,i=this.interactData.options,n=i.type,s=i.showPreview;if(n===vt.CLICK&&(this.clickable=!0,s&&e===In)){var o=null==r?void 0:r.getRendererOptions();void 0!==o&&(this.previewContent=new ro(this.item.props.content,o,this.transform,this.engine))}t.type===vt.DRAG&&(e!==In||t.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(t,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,r=this.item.engine.renderer.env;if(e===vt.CLICK)this.clickable=!0;else if(e===vt.DRAG){var i,n=this.interactData.options,s=n.enableInEditor;if(r!==In||s)(null==(i=this.item.composition)?void 0:i.event)&&this.beginDragTarget(n,this.item.composition.event)}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var r,i=this.item.props.content.options;null==(r=this.item.composition)||r.addInteractiveItem(this.item,i.type)}}else if(this.item.time>=0){var n,s=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,s.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,io(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var r,i,n=t.cameraParam,s=n.position,o=n.fov,a=e.dy,u=e.dx*e.width/e.height,h=s[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(h),l=a*c,f=u*c,p=this.dragRange,d=p.dxRange,m=p.dyRange,v=s[0]-this.dragRatio[0]*f,y=s[1]-this.dragRatio[1]*l,g=d[0],x=d[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==(r=e.origin)||r.preventDefault();if(y!==b&&y!==T&&b!==T)null==(i=e.origin)||i.preventDefault();this.item.composition.camera.position=new Ce(v,y,h)}},r.beginDragTarget=function(t,r){var i=this;if("camera"===t.target){var n,s={touchstart:function(t){var e;if(i.canInteract()){i.dragEvent=null,i.bouncingArg=null;var r=null==(e=i.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}}},touchmove:function(t){i.handleDragMove(n,t),i.bouncingArg=t},touchend:function(t){if(i.canInteract()){var e=i.bouncingArg;if(!io(e,3)&&e){e.vx*=5,e.vy*=5,i.dragEvent=Ye({},n)}n=null}}};Object.keys(s).forEach((function(t){r.addEventListener(t,s[t])})),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(s).forEach((function(t){r.removeEventListener(t,s[t])}))}}},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=ls(Ce.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}},r.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===vt.DRAG){var r=e.options;r.dxRange&&(this.dragRange.dxRange=r.dxRange),r.dyRange&&(this.dragRange.dyRange=r.dyRange)}},r.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},oe(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(ve),exports.InteractComponent=u([ce(Qt.InteractComponent)],exports.InteractComponent);var no,so=function(){function t(){this.triangles=[],this.worldMatrix=new Oe,this.assemblyTriangles=function(t,e,r,i,n){for(var s=r;s<i;s+=3){var o=3*e[s],a=3*e[s+1],u=3*e[s+2],h={x:t[o],y:t[o+1],z:t[o+2]},c={x:t[a],y:t[a+1],z:t[a+2]},l={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:c,p2:l})}}}var e=t.prototype;return e.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},e.getBoundingBox=function(){for(var t,e=-Number.MAX_VALUE,r=-Number.MAX_VALUE,i=Number.MAX_VALUE,n=Number.MAX_VALUE,o=s(this.boundingBoxData.area);!(t=o()).done;){var a=t.value;e=Math.max(a.p0.x,a.p1.x,a.p2.x,e),r=Math.max(a.p0.y,a.p1.y,a.p2.y,r),i=Math.min(a.p0.x,a.p1.x,a.p2.x,i),n=Math.min(a.p0.y,a.p1.y,a.p2.y,n)}var u=[],h=new Ce(i,r,0),c=new Ce(e,r,0),l=new Ce(e,n,0),f=new Ce(i,n,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var r,i=[],n=s(this.triangles);!(r=n()).done;){var o=r.value;i.push({p0:o.p0,p1:o.p1,p2:o.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:exports.HitTestType.triangle,area:i}},e.geometryToTriangles=function(t){var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[];if(!e||!r)return i;if(0===t.subMeshes.length)this.assemblyTriangles(r,e,0,e.length,i);else for(var n,o=s(t.subMeshes);!(n=o()).done;){var a=n.value;if(void 0!==a.indexCount){var u=e.BYTES_PER_ELEMENT,h=a.offset/u,c=h+a.indexCount;this.assemblyTriangles(r,e,h,c,i)}}return i},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new Ce),t.p1=e.worldMatrix.transformPoint(t.p1,new Ce),t.p2=e.worldMatrix.transformPoint(t.p2,new Ce)})),t},t}(),oo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return Ct(e,t),e}(_t),ao=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=s(this.playableOutputs);!(e=r()).done;){e.value.context.deltaTime=t}for(var i,n=s(this.playableOutputs);!(i=n()).done;){var o=i.value;this.prepareFrameWithRoot(o)}for(var a,u=s(this.playableOutputs);!(a=u()).done;){var h=a.value;this.processFrameWithRoot(h)}},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrame(t.context),t.processFrame()},e.prepareFrameWithRoot=function(t){t.prepareFrame(),t.sourcePlayable.prepareFrame(t.context)},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),uo=function(){function t(t,e){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0,t.addPlayable(this)}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}(),ho=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t){this.sourcePlayable=t},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),co=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(pe);function lo(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused"}(no||(no={}));var fo=new Me,po=1,mo=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new Ce(0,0,0),this.quat=new Me(0,0,0,1),this.rotation=new Zr(0,0,0),this.scale=new Ce(1,1,1),this.anchor=new Ce(0,0,0),this.size=new Ae(1,1),this.children=[],this.worldMatrix=Oe.fromIdentity(),this.localMatrix=Oe.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new Ce(0,0,0),quat:new Me(0,0,0,1),scale:new Ce(1,1,1)},this.name="transform_"+po++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,r){this.position.x===t&&this.position.y===e&&this.position.z===r||(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){0===t&&0===e&&0===r||(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===r||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){this.quat.x===t&&this.quat.y===e&&this.quat.z===r&&this.quat.w===i||(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){this.scale.x===t&&this.scale.y===e&&this.scale.z===r||(this.scale.x=t,this.scale.y=e,this.scale.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var r=t.position,i=t.rotation,n=t.scale,s=t.size,a=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),r&&(o(r,Ce)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)o(a,Me)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(i){var c=e?-1:1;o(i,Zr)?this.setRotation(i.x*c,i.y*c,i.z*c):this.setRotation(i[0]*c,i[1]*c,i[2]*c)}n&&(o(n,Ce)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),s&&this.setSize(s.x,s.y),h&&(o(h,Ae)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){y(this.children,t)},e.removeChild=function(t){g(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Zr)},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.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Zr)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),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={position:(new Ce).copyFrom(t.position),rotation:new Zr(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:(new Ce).copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var r=fo.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},oe(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}(),vo=new Ce(1,1,1),yo=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new mo,this.viewportMatrix=Oe.fromIdentity(),this.viewMatrix=Oe.fromIdentity(),this.projectionMatrix=Oe.fromIdentity(),this.viewProjectionMatrix=Oe.fromIdentity(),this.inverseViewMatrix=Oe.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,s=void 0===n?20:n,o=e.fov,a=void 0===o?60:o,u=e.aspect,h=void 0===u?1:u,c=e.clipMode,l=void 0===c?St.portrait:c,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d,v=new Zr(m[0],m[1],m[2]),y=(new Me).setFromEuler(v);this.options={near:i,far:s,fov:a,aspect:h,clipMode:l},this.transform.setPosition(p[0],p[1],p[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 Ce(this.position.x,this.position.y,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();i.premultiply(n),r.multiply(n.invert())}var s=r.projectPoint(e).z,o=i.projectPoint(new Ce(1,1,s)),a=o.x,u=o.y,h=i.projectPoint(new Ce(-1,-1,s)),c=h.x,l=h.y;return new Ce((a-c)/2,(u-l)/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 Ye({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,s=t.aspect,o=t.position,a=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=s,this.position=o,this.rotation=a,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,r=e.fov,i=e.aspect,n=e.near,s=e.far,o=e.clipMode;this.projectionMatrix.perspective(r*ge,i,n,s,o===St.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),vo),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Oe.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},oe(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}(),go=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,s=t.probability;this.time=+e||0,this.interval=+r||1,this.count=o(i,Os)?i:$s(i),this.cycles=+n||1/0,this.probability=isNaN(s)?1:+s,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}(),xo=function(t){this.content=t},bo=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new xo(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new xo(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do{t.call(e||this,r.content,i--)}while(r=r.pre)},e.getNodeByIndex=function(t){var e=0,r=this.first;if(!r||t>=this.length||t<0)return null;for(;e<t;)r=r.next,e++;return r},t}(),To="lookup_texture",Eo="offscreen_canvas",_o={};function Ao(t){return _o[t]}var Co=new Ce,So=new Ce,wo=function(){function t(t,e){this.pointStart=[];var r,i=e.colorOverLifetime,n=e.colorOverTrail,s=e.maxTrailCount,a=e.opacityOverLifetime,u=void 0===a?$s(1):a,h=e.widthOverTrail,c=e.name,l=e.occlusion,f=e.blending,p=e.maskMode,d=e.mask,m=e.textureMap,v=void 0===m?[0,0,1,1]:m,y=e.texture,g=e.transparentOcclusion,x=e.minimumVertexDistance,b=e.lifetime,T=e.matrix,E=t.gpuCapability,_=E.detail,A=E.level,C=Math.max(e.pointCountPerTrail,2),S={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},w=_.maxVertexTextures>0,R=(null!=(r=t.renderer)?r:{}).env,M={},O=[["ENABLE_VERTEX_TEXTURE",w],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===In]],P=s>64,I=0;i&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,M.uColorOverLifetime=mr.createWithData(t,L(i))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,M.uColorOverTrail=mr.createWithData(t,L(n))),P?(O.push(["ATTR_TRAIL_START",1]),I|=8):M.uTrailStart=new Float32Array(s),M.uOpacityOverLifetimeValue=u.toUniform(S);var F=h.toUniform(S);O.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),M.uVCurveValues=Os.getAllData(S);var V={shader:{vertex:pi,fragment:li,macros:O,glslVersion:1===A?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+I+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},D=C*s*2,N=(C-1)*s,k=Float32Array.BYTES_PER_ELEMENT,z=12*k,U={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*D)},aSeed:{size:1,stride:z,offset:4*k,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*k,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*k,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(D)},aDir:{size:3,data:new Float32Array(3*D)}},indices:{data:new Uint16Array(6*D)},drawCount:6*N,name:"trail#"+c,bufferUsage:ke.DYNAMIC_DRAW};if(P)U.attributes.aTrailStart={size:1,data:new Float32Array(D)};else{var B=new Float32Array(D);U.attributes.aTrailStartIndex={size:1,data:B};for(var G=0;G<s;G++)for(var j=2*C,X=G*j,H=0;H<j;H++)B[X+H]=G}var W=je(f),Y=Pr.create(t,V);Y.blending=!0,Y.depthMask=l,Y.depthTest=!0,Y.stencilRef=d?[d,d]:void 0,We(Y,p),Xe(Y,f);var Z=this.mesh=ii.create(t,{name:"MTrail_"+c,material:Y,geometry:Wr.create(t,U)}),q=null!=y?y:mr.createWithData(t);Object.keys(M).map((function(t){var e=M[t];if(o(e,mr))Y.setTexture(t,e);else if("uTrailStart"===t)Y.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var r=[],i=0;i<e.length;i+=4){var n=new Se(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}Y.setVector4Array(t,r)}else Y.setVector4(t,Se.fromArray(e))})),Y.setFloat("uTime",0),Y.setVector4("uWidthOverTrail",Se.fromArray(F)),Y.setVector2("uTexOffset",new Ae(0,0)),Y.setVector4("uTextureMap",Se.fromArray(v)),Y.setVector4("uParams",new Se(0,C-1,0,0)),Y.setTexture("uMaskTex",q),Y.setVector4("uColorParams",new Se(y?1:0,+W,0,+(l&&!g))),this.maxTrailCount=s,this.pointCountPerTrail=C,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=P,this.lifetime=b,T&&(this.mesh.worldMatrix=T),this.geometry=Z.firstGeometry(),this.trailCursors=new Uint16Array(s)}var e=t.prototype;return e.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,o=n-1,a=i%n,u=(i-1)%n,h=(i-2)%n,c=this.getTrailPosition(t,u,Co);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+a,f=Po(c,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*l,y=new Float32Array(6);y.set(f,0),y.set(f,3),s.setAttributeSubData("aDir",v,y),s.setAttributeSubData("aTime",2*l,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(b,20),x[23]=-.5*m,s.setAttributeSubData("aColor",24*l,x),u>=0){var T=this.getTrailPosition(t,h,So),E=new Float32Array(Po(T,c,e)),_=6*(t*n+u);s.setAttributeSubData("aDir",_,E),s.setAttributeSubData("aDir",_+3,E);var A=t*n*2,C=new Uint16Array([2*u+A,2*u+1+A,2*a+A,2*a+A,2*u+1+A,2*a+1+A]),S=6*(t*o+(i-1)%o);s.setIndexSubData(S,C)}i=++this.trailCursors[t];var w=this.mesh.material,R=w.getVector4("uParams"),M=d[2];if(this.useAttributeTrailStart){for(var O=2*n,P=new Float32Array(O),I=0;I<O;I++)P[I]=M;s.setAttributeSubData("aTrailStart",t*P.length,P)}else{var L=w.getFloats("uTrailStart");null!=L&&(L[t]=M,w.setFloats("uTrailStart",L))}R&&(R.y=Math.max(R.y,i-1)-Math.max(0,i-n),w.setVector4("uParams",R))}},e.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,s=this.geometry.getAttributeData("aColor");return k(s),r.x=s[n],r.y=s[1+n],r.z=s[2+n],r}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();k(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");k(e);for(var r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();k(r),r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),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){},oe(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}(),Ro=new Ce,Mo=new Ce,Oo=new Ce;function Po(t,e,r){var i=Ro;return t||r?(t?r?(Mo.subtractVectors(e,t).normalize(),Mo.subtractVectors(r,e),Oo.copyFrom(Mo).normalize(),i.addVectors(Mo,Oo)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var Io=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}Ct(e,t);var r=e.prototype;return r.start=function(t){var e=t.output.getUserData();!this.particleSystem&&o(e,exports.VFXItem)&&(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem&&(this.particleSystem.name=e.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var r=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),Math.abs(this.time-this.lastTime)<.001&&(r=0),e.update(r)}this.lastTime=this.time},e}(uo),Lo=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){return new Io(t)},e}(co),Fo={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"},Vo=function(){function t(t,e){var r;this.particleCount=0,this.cachedRotationVector3=new Ce,this.cachedRotationMatrix=new qr,this.cachedLinearMove=new Ce,this.tempMatrix3=new qr,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,n,s=(null!=(r=t.renderer)?r:{}).env,a=e.speedOverLifetime,u=e.colorOverLifetime,h=e.linearVelOverLifetime,c=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,f=e.rotationOverLifetime,p=e.sprite,d=e.gravityModifier,m=e.maxCount,v=e.textureFlip,y=e.useSprite,g=e.name,x=e.gravity,b=e.forceTarget,T=e.side,E=e.occlusion,_=e.anchor,A=e.blending,C=e.maskMode,S=e.mask,w=e.transparentOcclusion,R=e.meshSlots,M=e.renderMode,O=void 0===M?0:M,P=e.diffuse,I=void 0===P?mr.createWithData(t):P,F=t.gpuCapability.detail,V=F.halfFloatTexture,D=F.maxVertexUniforms,N=[["RENDER_MODE",+O],["ENV_EDITOR",s===In]],k=t.gpuCapability.level,z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},B=D>0,G={},j=0,X=0;(this.useSprite=y,B&&N.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(N.push(["SPEED_OVER_LIFETIME",!0]),X|=2,G.uSpeedLifetimeValue=a.toUniform(z)),(null==p?void 0:p.animate)&&(N.push(["USE_SPRITE",!0]),X|=4,G.uFSprite=G.uSprite=new Float32Array([p.col,p.row,p.total,p.blend?1:0]),this.useSprite=!0),(null==u?void 0:u.color)&&(N.push(["COLOR_OVER_LIFETIME",!0]),X|=16,G.uColorOverLifetime=o(u.color,mr)?u.color:mr.createWithData(t,L(u.color))),(null==u?void 0:u.opacity)?G.uOpacityOverLifetimeValue=u.opacity.toUniform(z):G.uOpacityOverLifetimeValue=$s(1).toUniform(z),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==h?void 0:h[t])&&(G["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(z),r=1,X|=1<<7+e,h.enabled=!0),N.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==c?void 0:c[t])&&(G["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=c[t].toUniform(z),n=1,X|=1<<10+e,i=!0,c.enabled=!0),N.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==h?void 0:h.asMovement)&&(N.push(["AS_LINEAR_MOVEMENT",!0]),X|=32),i&&((null==c?void 0:c.asRotation)&&(N.push(["AS_ORBITAL_MOVEMENT",!0]),X|=64),G.uOrbCenter=new Float32Array((null==c?void 0:c.center)||[0,0,0])),G.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(z),null==l?void 0:l.separateAxes)&&(N.push(["SIZE_Y_BY_LIFE",1]),X|=16384,G.uSizeYByLifetimeValue=null==l||null==(n=l.y)?void 0:n.toUniform(z));(null==f?void 0:f.z)&&(G.uRZByLifeTimeValue=f.z.toUniform(z),X|=32768,N.push(["ROT_Z_LIFETIME",1])),(null==f?void 0:f.x)&&(G.uRXByLifeTimeValue=f.x.toUniform(z),X|=65536,N.push(["ROT_X_LIFETIME",1])),(null==f?void 0:f.y)&&(G.uRYByLifeTimeValue=f.y.toUniform(z),X|=1<<17,N.push(["ROT_Y_LIFETIME",1])),(null==f?void 0:f.asRotation)&&(N.push(["ROT_LIFETIME_AS_MOVEMENT",1]),X|=1<<18),G.uGravityModifierValue=d.toUniform(z),b&&(N.push(["FINAL_TARGET",!0]),X|=1<<19,G.uFinalTarget=new Float32Array(b.target||[0,0,0]),G.uForceCurve=b.curve.toUniform(z)),V&&U.max?(X|=1<<20,G.uFCurveValueTexture=vr(t,Os.getAllData(U,!0),U.index,1)):G.uFCurveValues=Os.getAllData(U);var H=z.max+z.curves.length-32>D;if(2===k&&(z.max=-1,z.index=R?R[0]:No(z.index),U.index>0&&(U.max=-1,U.index=R?R[1]:No(U.index))),H&&V&&B){var W=vr(t,Os.getAllData(z,!0),z.index,1);G.uVCurveValueTexture=W,j=1}else G.uVCurveValues=Os.getAllData(z);var Y=["-p:",O,X,z.index,z.max,U.index,U.max].join("+");N.push(["VERT_CURVE_VALUE_COUNT",z.index],["FRAG_CURVE_VALUE_COUNT",U.index],["VERT_MAX_KEY_FRAME_COUNT",z.max],["FRAG_MAX_KEY_FRAME_COUNT",U.max]),this.VERT_MAX_KEY_FRAME_COUNT=z.max;var Z={shader:{fragment:li,vertex:"#define LOOKUP_TEXTURE_CURVE "+j+"\n"+fi,glslVersion:1===k?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:Y,macros:N,name:"particle#"+g},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},q=je(A);G.uTexOffset=new Float32Array(I?[1/I.getWidth(),1/I.getHeight()]:[0,0]),G.uMaskTex=I,G.uColorParams=new Float32Array([I?1:0,+q,0,+(!!E&&!w)]),G.uParams=[0,0,0,0],G.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var K=Pr.create(t,Z);K.blending=!0,K.depthTest=!0,K.depthMask=!!E,K.stencilRef=S?[S,S]:void 0,We(K,C),Xe(K,A),He(K,T),Object.keys(G).map((function(t){var e=G[t];if(o(e,mr))K.setTexture(t,e);else{var r=[];switch(Fo[t]){case"vec4":K.setVector4(t,Se.fromArray(e));break;case"vec3":K.setVector3(t,Ce.fromArray(e));break;case"vec2":K.setVector2(t,Ae.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new Se(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}K.setVector4Array(t,r),r.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),K.setVector3("emissionColor",new Ce(0,0,0)),K.setFloat("emissionIntensity",0);var Q=Wr.create(t,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,s={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*i,data:new Float32Array(0)},aRotation1:{size:3,offset:3*i,stride:9*i,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*i,stride:9*i,dataSource:"aRotation0"}};e&&(s.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:s,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*m,this.useSprite,"particle#"+g)),J=ii.create(t,{name:"MParticle_"+g,material:K,geometry:Q});this.anchor=_,this.mesh=J,this.geometry=J.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=l,this.speedOverLifetime=a,this.linearVelOverLifetime=h,this.orbitalVelOverLifetime=c,this.orbitalVelOverLifetime=c,this.gravityModifier=d,this.rotationOverLifetime=f,this.maxCount=m,this.textureOffsets=v?[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"),r=32*t+4;return k(e),[e[r],e[r+1],e[r+2],e[r+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(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new r.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),r=Math.ceil(e.length/12);this.applyTranslation(r,t),this.applyRotation(r,t),this.applyLinearMove(r,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,s=this.geometry,o=i>this.maxParticleBufferCount,a=1;this.particleCount>300?a=(this.particleCount+100)/this.particleCount:this.particleCount>100?a=1.4:this.particleCount>0&&(a=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 c=new Ce,l=new Me,f=new Ce(1,1,1);e.transform.assignWorldTRS(c,l,f);var p,d=mo.getRotation(l,new Zr),m=c.toArray(),v=d.toArray(),y=this.textureOffsets,g=[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],A=Math.random();h&&(p=e.sprite);for(var C=0;C<4;C++){var S=2*C,w=3*C,R=4*C,M=12*C,O=8*C;u.aPos.set(m,M),T.fill(u.aPos,M+3),u.aRot.set(v,O),u.aRot[O+3]=A,u.aRot.set(E,O+4),h&&u.aSprite.set(p,w);var P=e.uv||b;if(P){var I=h?1-y[S+1]:y[S+1];g[0]=P[0]+y[S]*P[2],g[1]=P[1]+I*P[3]}u.aOffset.set(g,R);for(var L=C+C,F=(_[L]-this.anchor.x)*f.x,V=(_[L+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[M+6+D]=e.dirX.getElement(D)*F,u.aPos[M+9+D]=e.dirY.getElement(D)*V}var N=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(o){var z=x(s.getIndexData(),6*i,6*r,a);z.set(N,6*t),s.setIndexData(z),this.maxParticleBufferCount=z.length/6}else s.setIndexSubData(6*t,N);Object.keys(u).forEach((function(e){var i=u[e],h=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var c=s.getAttributeData(e);k(c);var l=x(c,n*h,4*r*h,a);l.set(i,i.length*t),s.setAttributeData(e,l)}else s.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),s.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var r=this.time,i=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");i.length<3*t&&(i=this.expandArray(i,3*t));for(var o=0,a=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;o=n[f],a=n[f+1],u=n[f+2];var p=r-s[4*l+2],d=s[4*l+3];if(h&&c){var m=this.gravityModifier.getIntegrateValue(0,p,d),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(p/d);o=o*x+v,a=a*x+y,u=u*x+g}else o+=v,a+=y,u+=g}var b=3*l;if(s[4*l+2]<r){var T=o*(e/1e3),E=a*(e/1e3),_=u*(e/1e3);i[b]+=T,i[b+1]+=E,i[b+2]+=_,i[b+3]+=T,i[b+4]+=E,i[b+5]+=_,i[b+6]+=T,i[b+7]+=E,i[b+8]+=_,i[b+9]+=T,i[b+10]+=E,i[b+11]+=_}}this.geometry.setAttributeData("aTranslation",i)},e.applyRotation=function(t,e){var r=this.geometry.getAttributeData("aRotation0"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),s=this.geometry.getAttributeData("aSeed"),a=this.time,u=this.cachedRotationMatrix;r.length<9*t&&(r=this.expandArray(r,9*t));for(var h=0;h<t;h+=4){var c=_e((a-i[4*h+2])/i[4*h+3],0,1),l=8*h,f=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),p=s[8*h+3],d=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(o(this.rotationOverLifetime.x,Ls)?d.x+=this.rotationOverLifetime.x.getValue(c,p):d.x+=this.rotationOverLifetime.x.getValue(c)),this.rotationOverLifetime.y&&(o(this.rotationOverLifetime.y,Ls)?d.y+=this.rotationOverLifetime.y.getValue(c,p):d.y+=this.rotationOverLifetime.y.getValue(c)),this.rotationOverLifetime.z&&(o(this.rotationOverLifetime.z,Ls)?d.z+=this.rotationOverLifetime.z.getValue(c,p):d.z+=this.rotationOverLifetime.z.getValue(c))):u.setZero(),0===d.dot(d)&&u.identity();var m=Math.PI/180,v=d.x*m,y=d.y*m,g=d.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),_=Math.cos(y),A=Math.cos(g);u.set(A,-T,0,T,A,0,0,0,1),u.multiply(this.tempMatrix3.set(_,0,b,0,1,0,-b,0,_)),u.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var C=9*h,S=u.elements;r.set(S,C),h+4<=t&&(r.set(S,C+9),r.set(S,C+18),r.set(S,C+27))}this.geometry.setAttributeData("aRotation0",r)},e.applyLinearMove=function(t,e){var r=this.geometry.getAttributeData("aLinearMove"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),s=this.time;r.length<3*t&&(r=this.expandArray(r,3*t));var a=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=s-i[4*u+2],c=i[4*u+3],l=h/c,f=n[8*u+3];a.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(o(this.linearVelOverLifetime.x,Ls)?a.x=this.linearVelOverLifetime.x.getValue(l,f):a.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(o(this.linearVelOverLifetime.y,Ls)?a.y=this.linearVelOverLifetime.y.getValue(l,f):a.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(o(this.linearVelOverLifetime.z,Ls)?a.z=this.linearVelOverLifetime.z.getValue(l,f):a.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(o(this.linearVelOverLifetime.x,Ls)?a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.y&&(o(this.linearVelOverLifetime.y,Ls)?a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.z&&(o(this.linearVelOverLifetime.z,Ls)?a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,c)));var p=3*u;r[p]=a.x,r[p+1]=a.y,r[p+2]=a.z,r[p+3]=a.x,r[p+4]=a.y,r[p+5]=a.z,r[p+6]=a.x,r[p+7]=a.y,r[p+8]=a.z,r[p+9]=a.x,r[p+10]=a.y,r[p+11]=a.z}this.geometry.setAttributeData("aLinearMove",r)},e.expandArray=function(t,e){var r=new Float32Array(e);return r.set(t),r},t}(),Do=[10,32,64,160];function No(t){for(var e=0;e<Do.length;e++){var r=Do[e];if(r>t)return r}return t||Do[0]}var ko=function(t){function e(e,r,i){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",r&&(n.particleMesh=new Vo(e,r)),i&&(n.trailMesh=new wo(e,i));var s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}Ct(e,t);var r=e.prototype;return r.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=s(this.meshes);!(t=e()).done;){t.value.onStart()}},r.onUpdate=function(t){var e,r=this.particleMesh.time,i=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new Se;this.particleMesh.mesh.material.setVector4("uParams",i.set(r,this.item.duration,0,0))},r.render=function(t){this.maskManager.drawStencilMask(t);for(var e,r=s(this.meshes);!(e=r()).done;){e.value.render(t)}},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(r){t.push(e[r])})),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach((function(e){t.push(r[e])}))}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(ve);exports.ParticleSystem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).destroyed=!1,i.getHitTestParams=function(t){var e=i.interaction;if(t||e)return{type:exports.HitTestType.custom,collect:function(t){return i.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ot.removeParticle,ray:t})}}},i.maskManager=new Ir(e),r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===wt.CONSTANT_VEC3?e.add(i[1]):t=$s(i)),this.basicTransform={position:e,rotation:r,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 s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,r=e.path,i=e.position.clone();if(r){var n=this.item.duration;i.add(r.getValue(t/n))}if(this.transform.setPosition(i.x,i.y,i.z),this.options.particleFollowParent){var s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var s=i.first;i.removeNode(s),r=n[1]=s.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new Se(n[0],n[1],n[2],t));for(var s=i.getAttributeData("aColor")||[],o=0;o<s.length;o+=32)s[8*o+7]=t},r.setColor=function(t,e,r,i){var n,s=this.renderer.particleMesh.mesh.material,o=this.renderer.particleMesh.mesh.geometry,a=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new Se(a[0],a[1],a[2],i));for(var u=o.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=r,u[8*h+7]=i},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new bo((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1,this.destroyed=!1},r.update=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var o=this.particleLink,a=(r-n)/this.item.duration,u=this.timePassed,h=!1,c=function(){e.trails&&!h&&(h=!0,o.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,a,s,n)})))};if(this.ended){if(this.item.endBehavior!==Mt.restart&&Mt.destroy===this.item.endBehavior){var l=o.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,p=this.lifetime;if(u<f){var d=1/s.rateOverTime.getValue(p),m=Math.floor((u-this.lastEmitTime)/d),v=m,y=d/m,g=r,x=i.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=o.first;return e.emissionStopped||o.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(p);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var _=s.bursts,A=(null==_?void 0:_.length)-1,C=0;A>=0&&C<x&&!b();A--){var S=_[A],w=!S.disabled&&S.getGeneratorOptions(u,p);if(w){var R=s.burstOffsets[A],M=R&&R[w.cycleIndex]||[0,0,0];S.once&&this.removeBurst(A);for(var O=0;O<w.count&&C<x;O++){var P;if(b())break;var I=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:O,burstCount:w.count}));I.delay+=g,C++,(P=I.transform).translate.apply(P,[].concat(M)),this.addParticle(I,x)}}}}else if(this.item.endBehavior===Mt.restart)c(),this.loopStartTime=r-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===Mt.freeze&&(this.frozen=!0)}}c()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],r=0;r<this.renderer.meshes.length;r++){var i=this.renderer.meshes[r].material;e.push(i.colorMask),i.colorMask=!1}for(var n,o=s(this.renderer.meshes);!(n=o()).done;){n.value.render(t)}for(var a=0;a<this.renderer.meshes.length;a++){this.renderer.meshes[a].material.colorMask=e[a]}}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose({material:{textures:exports.DestroyOptions.keep}})}))},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var s=t.last,o=!1;!o;){var a=s.content[0],u=s.content[3];if(a>this.timePassed){var h=this.getPointPosition(u);r.push({center:h,size:u.transform.scale}),s.pre?s=s.pre:o=!0}++n>i&&(o=!0)}return r},r.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],s=new Ce,o=!1;if(i&&i.content)do{var a=i.content,u=a[0],h=a[1];a[2];var c=a[3];if(u>this.timePassed){var l=this.getPointPosition(c),f=t.ray,p=!1;f&&(p=!!f.intersectSphere({center:l,radius:t.radius},s)),p&&(t.removeParticle&&(r.removeParticlePoint(h),this.clearPointTrail(h),i.content=[0]),n.push(l),t.multiple||(o=!0))}}while((i=i.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var s=this.trails,o=this.getPointPosition(r),a=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),h=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(h*=u[0]),s.sizeAffectsLifetime&&(c*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&o.subtract(l)}n.addTrailPoint(t,o,{color:a,lifetime:c,size:h,time:i})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,s=t.gravity,o=void 0===s?[]:s,a=this.options.forceTarget,u=this.lastUpdate-n,h=new Ce,c=Ce.fromArray(o);e.assignWorldTRS(h);var l=ns(new Ce,this.options,c,u,i,h,r);if(a){var f=a.target||[0,0,0],p=a.curve.getValue(u/i),d=1-p;l.x=l.x*d+f[0]*p,l.y=l.y*d+f[1]*p,l.z=l.z*d+f[2]*p}return l},r.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),s=e.particleFollowParent?Oe.IDENTITY:this.transform.getWorldMatrix(),o=t.position,a=s.transformPoint(o,new Ce),u=new mo({position:a,valid:!0}),h=t.direction;if(h=s.transformNormal(h,zo).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)Xo.setElement(c,e.turbulence[c].getValue(r));Ho.setFromVector3(Xo.negate()),Yo.setFromEuler(Ho).transformNormal(h).normalize()}var l,f=Go,p=jo;i.alignSpeedDirection?(p.copyFrom(h),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=Ce.Z.clone(),s.transformNormal(this.upDirectionWorld)),f.crossVectors(p,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),p.set(0,1,0));var d=this.textureSheetAnimation;d&&d.animate&&((l=Wo)[0]=d.animationDelay.getValue(r),l[1]=d.animationDuration.getValue(r),l[2]=d.cycles.getValue(r));var m=Bo;e.start3DRotation?m.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?m.set(0,0,e.startRotation.getValue(r)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(r);3===v.length&&(v[3]=1);var y=Uo;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var g=e.startSize.getValue(r),x=e.sizeAspect.getValue(r);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new Ce;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(r),lifetime:e.startLifetime.getValue(r),uv:qo(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:p,dirX:f,transform:u}},r.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&o(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e;this.props=r,this.destroyed=!1;var i,n,s,a,u,h=r.options,c=r.positionOverLifetime,l=void 0===c?{}:c,f=r.shape,p=null==l?void 0:l.gravityOverLifetime,d=ss(null==l?void 0:l.gravity),m=r.textureSheetAnimation,v=m?{animationDelay:$s(m.animationDelay||0),animationDuration:$s(m.animationDuration||1),cycles:$s(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&&(i=[$s(null!=(n=f.turbulenceX)?n:0),$s(null!=(s=f.turbulenceY)?s:0),$s(null!=(a=f.turbulenceZ)?a:0)]);this.name="ParticleSystem",this.shape=nn(f),this.emission={rateOverTime:$s(r.emission.rateOverTime),burstOffsets:Zo(null!=(u=r.emission.burstOffsets)?u:[]),bursts:(r.emission.bursts||[]).map((function(t){return new go(t)}))},this.textureSheetAnimation=v;var g,x,b=r.renderer||{},T=r.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?$s(T.z):$s(0),T.separateAxes&&(g.x=T.x&&$s(T.x),g.y=T.y&&$s(T.y))),(null==l?void 0:l.forceTarget)&&(x={target:l.target||[0,0,0],curve:$s(l.forceCurve||[wt.LINE,[[0,0],[1,1]]])});var E={x:l.linearX&&$s(l.linearX||0),y:l.linearY&&$s(l.linearY||0),z:l.linearZ&&$s(l.linearZ||0),asMovement:l.asMovement},_={x:l.orbitalX&&$s(l.orbitalX),y:l.orbitalY&&$s(l.orbitalY),z:l.orbitalZ&&$s(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},A=r.sizeOverLifetime||{},C=r.colorOverLifetime,S=(null==A?void 0:A.separateAxes)?{separateAxes:!0,x:$s(A.x),y:$s(A.y)}:{separateAxes:!1,x:$s(("size"in A?A.size:A.x)||1)};b.anchor=b.anchor||[0,0];var w,R=Ae.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:$s(h.startLifetime),startDelay:$s(h.startDelay||0),startSpeed:$s(l.startSpeed||0),startColor:$s(h.startColor),looping:!1,maxCount:null!=(w=h.maxCount)?w:0,gravityModifier:$s(p||0),gravity:d,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:i,speedOverLifetime:l.speedOverLifetime&&$s(l.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:_,forceTarget:x},h.startRotationZ&&(this.options.startRotation=$s(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=$s(h.startRotationX||0),this.options.startRotationY=$s(h.startRotationY||0),this.options.startRotationZ=$s(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=$s(h.startSizeX),this.options.startSizeY=$s(h.startSizeY)):(this.options.startSize=$s(h.startSize),this.options.sizeAspect=$s(h.sizeAspect||1));var M=this.getMaskOptions(r),O={meshSlots:h.meshSlots,name:this.name,matrix:Oe.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||xt.BILLBOARD,side:b.side||ft.DOUBLE,gravity:d,blending:b.blending||lt.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:M.maskRef,maskMode:M.maskMode,forceTarget:x,diffuse:b.texture?this.engine.findObject(b.texture):void 0,sizeOverLifetime:S,anchor:R};if(C){var P=C.color,I=C.opacity;O.colorOverLifetime={},I&&(O.colorOverLifetime.opacity=$s(C.opacity)),P&&(P[0]===wt.GRADIENT_COLOR?O.colorOverLifetime.color=C.color[1]:P[0]===wt.RGBA_COLOR?O.colorOverLifetime.color=mr.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):o(P,mr)&&(O.colorOverLifetime.color=P))}var L,F=[],V=[0,0,1,1];if(r.splits){var D=r.splits[0];V=(L=D[4])?[D[0],D[1],D[3],D[2]]:[D[0],D[1],D[2],D[3]]}if(v&&!v.animate)for(var N=L?v.row:v.col,k=L?v.col:v.row,z=v.total||N*k,U=0,B=0;B<N;B++)for(var G=0;G<k&&U<z;G++,U++)F.push([B*V[2]/N+V[0],G*V[3]/k+V[1],V[2]/N,V[3]/k]);else F.push(V);this.uvs=F,O.textureFlip=L;var j,X=r.trails;X&&(this.trails={lifetime:$s(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},M=this.getMaskOptions(X),j={name:"Trail",matrix:Oe.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:$s(X.opacityOverLifetime||1),widthOverTrail:$s(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:M.maskRef,maskMode:M.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===wt.GRADIENT_COLOR&&(j.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===wt.GRADIENT_COLOR&&(j.colorOverTrail=X.colorOverTrail[1])),this.renderer=new ko(this.engine,O,j),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var H,W=r.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(H=W.radius)?H:.4,behavior:W.behavior});this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},r.getMaskOptions=function(t){var e=exports.MaskMode.NONE,r=0;return t.mask&&(e=this.maskManager.getMaskMode(t.mask),r=this.maskManager.getRefValue()),{maskMode:e,maskRef:r}},oe(e,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{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}(de),exports.ParticleSystem=u([ce(Qt.ParticleSystem)],exports.ParticleSystem);var zo=new Ce,Uo=new Ae,Bo=new Zr,Go=new Ce,jo=new Ce,Xo=new Ce,Ho=new Zr,Wo=[0,0,0],Yo=new Oe;function Zo(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=o(t,Array),i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function qo(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var Ko,Qo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}Ct(e,t);var r=e.prototype;return r.processFrame=function(t){for(var e,r=s(this.clipPlayables);!(e=r()).done;){e.value.processFrame(t)}this.evaluate(t)},r.setClipWeight=function(t,e){if(o(t,uo)){for(var r=0;r<this.clipPlayables.length;r++)if(this.clipPlayables[r]===t)return void(this.clipWeights[r]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},r.getClipWeight=function(t){return this.clipWeights[t]},r.getClipPlayable=function(t){return this.clipPlayables[t]},r.evaluate=function(t){},e}(uo),Jo=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(o(e,exports.VFXItem)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?(r.transform.setValid(!0),r.setActive(!0)):(r.transform.setValid(!1),r.setActive(!1))}},e}(Qo),$o=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(uo),ta=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyName="",e}return Ct(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var r=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var i=0;i<this.clipPlayables.length;i++){var n=this.getClipWeight(i);if(n>0){var s=this.getClipPlayable(i);if(!o(s,$o)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var a=s.value;this.addWeightedValue(a,n),r=!0}}r&&(e[this.propertyName]=this.propertyValue)}}},e}(Qo),ea=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.setZero()},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.r+=t.r*e,r.g+=t.g*e,r.b+=t.b*e,r.a+=t.a*e},e}(ta),ra=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue=0},r.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(ta),ia=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){},e}(Qo),na=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){},e}(Qo),sa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();o(e,exports.CompositionComponent)&&(e.time=this.getTime())},e}(uo),oa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(o(e,exports.CompositionComponent)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?r.item.setActive(!0):r.item.setActive(!1)}},e}(Qo),aa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){},e}(Qo),ua=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e,r.z+=t.z*e,r.w+=t.w*e},e}(ta),ha=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e},e}(ta),ca=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,r=this.duration;return e-r>0&&(this.endBehavior===Mt.restart?e%=r:this.endBehavior===Mt.freeze&&(e=Math.min(r,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}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},r.createTrackMixer=function(t){return new Qo(t)},r.createOutput=function(){return new ho},r.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},r.createMixerPlayableGraph=function(t,e){for(var r,i=[],n=s(this.clips);!(r=n()).done;){var o=r.value;i.push(o)}return this.compileClips(t,i,e)},r.compileClips=function(t,e,r){for(var i,n=this.createTrackMixer(t),o=s(e);!(i=o()).done;){var a=i.value,u=this.createClipPlayable(t,a);u.setDuration(a.duration);var h=new la(a,u,n,this);r.push(h),n.clipPlayables.push(u),n.setClipWeight(u,0)}return n},r.createPlayable=function(t){return new uo(t)},r.getChildTracks=function(){return this.children},r.addChild=function(t){this.children.push(t),t.parent=this},r.createClip=function(t,e){var r=new ca;return r.asset=new t(this.engine),r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=s(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},r.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},r.fromData=function(e){t.prototype.fromData.call(this,e);for(var r,i=s(this.children);!(r=i()).done;){r.value.parent=this}},e}(co),u([le(ca)],exports.TrackAsset.prototype,"clips",void 0),u([le()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=u([ce(Qt.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(Ko=exports.TrackType||(exports.TrackType={}))[Ko.MasterTrack=0]="MasterTrack",Ko[Ko.ObjectTrack=1]="ObjectTrack";var la=function(){function t(t,e,r,i){this.clip=t,this.playable=e,this.parentMixer=r,this.track=i,o(this.track.boundObject,exports.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(exports.ParticleSystem))}return t.prototype.evaluateAt=function(t){var e=this.clip,r=1,i=!1,n=!1,s=this.track.boundObject;t>=e.start+e.duration&&e.endBehavior===Mt.destroy?o(s,exports.VFXItem)&&exports.VFXItem.isParticle(s)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,i=!0):t-this.clip.start>=0?(r=1,n=!0):t<e.start&&(r=0),n&&this.playable.getPlayState()!==no.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var a=e.toLocalTime(t);this.playable.setTime(a),i&&this.playable.getPlayState()===no.Playing&&this.playable.pause()},oe(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 Ct(e,t),e.prototype.createTrackMixer=function(t){return new Jo(t)},e}(exports.TrackAsset),exports.ActivationTrack=u([ce(Qt.ActivationTrack)],exports.ActivationTrack);var fa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=this.path.split(".");this.propertyNames=r},e}(exports.TrackAsset);u([le()],fa.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createTrackMixer=function(t){var e=new ra(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},e}(fa),exports.FloatPropertyTrack=u([ce(Qt.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){return new na(t)},e}(exports.TrackAsset),exports.SpriteColorTrack=u([ce(Qt.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!o(this.parent.boundObject,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(exports.CompositionComponent)},r.createTrackMixer=function(t){return new oa(t)},e}(exports.TrackAsset),exports.SubCompositionTrack=u([ce(Qt.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){return new aa(t)},e}(exports.TrackAsset),exports.TransformTrack=u([ce(Qt.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.updateAnimatedObject=function(){o(this.parent.boundObject,ve)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(exports.TrackAsset),u([le()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=u([ce("MaterialTrack")],exports.MaterialTrack);var pa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){return new ia(t)},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){var e=new ua(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(fa),exports.Vector4PropertyTrack=u([ce(Qt.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){var e=new ha(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(fa),exports.Vector2PropertyTrack=u([ce("Vector2PropertyTrack")],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){var e=new ea(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(fa),exports.ColorPropertyTrack=u([ce(Qt.ColorPropertyTrack)],exports.ColorPropertyTrack),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=u([ce(Qt.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=u([ce(Qt.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){return new sa(t)},e}(co),exports.SubCompositionPlayableAsset=u([ce(Qt.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){},r.create=function(t){if(o(this.boundObject,exports.VFXItem)){var e=this.boundObject;if(e.getComponent(exports.ParticleSystem)){var r=t.createTrack(pa,this,"ParticleTrack");r.boundObject=this.boundObject;var i=r.createClip(Lo);i.start=e.start,i.duration=e.duration,i.endBehavior=e.endBehavior}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=u([ce(Qt.ObjectBindingTrack)],exports.ObjectBindingTrack);var da=function(){function t(t,e,r){this.children=[],this.trackAsset=t,this.mixer=e,this.output=r}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}Ct(e,t);var r=e.prototype;return r.createPlayable=function(t){for(var e,r=new ma(t),i=s(this.tracks);!(e=i()).done;){var n=e.value;o(n,exports.ObjectBindingTrack)&&n.create(this)}return this.sortTracks(this.tracks),r.compileTracks(t,this.flattenedTracks),r},r.createTrack=function(t,e,r){var i=new t(this.engine);return i.name=r||t.name,e.addChild(i),this.invalidate(),i},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var r,i=s(t.getChildTracks());!(r=i()).done;){var n=r.value;e.push(n)}for(var o,a=s(t.getChildTracks());!(o=a()).done;){var u=o.value;this.addSubTracksRecursive(u,e)}},r.sortTracks=function(t){for(var e=[],r=0;r<t.length;r++)e.push(new va(t[r],r));e.sort(ya),t.length=0;for(var i,n=s(e);!(i=n()).done;){var o=i.value;t.push(o.track)}},r.fromData=function(t){},oe(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=s(this.tracks);!(t=e()).done;){var r=t.value;this.cacheFlattenedTracks.push(r),this.addSubTracksRecursive(r,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(co),u([le()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=u([ce(Qt.TimelineAsset)],exports.TimelineAsset);var ma=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clips=[],e.masterTrackInstances=[],e}Ct(e,t);var r=e.prototype;return r.prepareFrame=function(t){},r.evaluate=function(){for(var t,e=this.getTime(),r=s(this.clips);!(t=r()).done;){t.value.evaluateAt(e)}},r.compileTracks=function(t,e){for(var r,i=e,n={},o=s(i);!(r=o()).done;){var a=r.value,u=a.createPlayableGraph(t,this.clips),h=a.createOutput();h.setUserData(a.boundObject),t.addOutput(h),h.setSourcePlayable(u);var c=new da(a,u,h);n[a.getInstanceId()]=c,a.parent||this.masterTrackInstances.push(c)}for(var l,f=s(i);!(l=f()).done;)for(var p,d=l.value,m=n[d.getInstanceId()],v=s(d.getChildTracks());!(p=v()).done;){var y=n[p.value.getInstanceId()];m.addChild(y)}},e}(uo),va=function(t,e){this.track=t,this.originalIndex=e};function ya(t,e){var r=t.track.boundObject,i=e.track.boundObject;return o(r,exports.VFXItem)&&o(i,exports.VFXItem)?exports.VFXItem.isAncestor(r,i)?-1:exports.VFXItem.isAncestor(i,r)?1:t.originalIndex-e.originalIndex:t.originalIndex-e.originalIndex}exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=u([ce(Qt.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=u([ce(Qt.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset),exports.CompositionComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.startTime=0,e.items=[],e.state=no.Playing,e.reusable=!1,e.sceneBindings=[],e.graph=new ao,e}Ct(e,t);var r=e.prototype;return r.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new exports.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==Mt.destroy&&this.setReusable(!0),null==(t=this.item.composition)||t.refContent.push(this.item)},r.setReusable=function(t){for(var r,i=s(this.timelineAsset.tracks);!(r=i()).done;){var n=r.value.boundObject;if(o(n,exports.VFXItem)){var a=n.getComponent(e);a&&a.setReusable(t)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=no.Paused},r.resume=function(){this.state=no.Playing},r.onUpdate=function(t){if(this.state!==no.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},r.onEnable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!0)}},r.onDisable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!1)}},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},r.hitTest=function(t,e,r,i,n,s){for(var o,u=function(s){var a=o.items[s];if(a.isActive&&a.transform.getValid()&&!exports.VFXItem.isComposition(a)&&!l(a)){var u=a.getHitTestParams(n);if(u){var f=!1,p=new Ce;if(u.type===exports.HitTestType.triangle)for(var d=u.triangles,m=u.backfaceCulling,v=0;v<d.length;v++){var y=d[v];if(t.intersectTriangle(y,p,m)){f=!0,h.push(p);break}}else if(u.type===exports.HitTestType.box){var g=u.center,x=u.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.sphere){var E=u.center,_=u.radius;t.intersectSphere({center:E,radius:_},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.custom){var A=u.collect(t,new Ae(e,r));A&&A.length>0&&(A.forEach((function(t){h.push(t)})),f=!0)}if(f){var C={compContent:o.item,id:a.id,name:a.name,position:h[h.length-1],parentId:a.parentId,hitPositions:h,behavior:u.behavior};if(a.emit("click",C),i.push(C),c(C))return{v:i}}}}},h=[],c=(null==s?void 0:s.stop)||H,l=(null==s?void 0:s.skip)||H,f=(null==s?void 0:s.maxCount)||this.items.length,p=0;p<this.items.length&&i.length<f;p++){var d=(o=this,u(p));if("object"===a(d))return d.v}return i},r.setChildrenRenderOrder=function(t){for(var r,i=s(this.items);!(r=i()).done;){var n=r.value;n.renderOrder=t++;var o=n.getComponent(e);o&&(t=o.setChildrenRenderOrder(t))}return t},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i=e;this.startTime=null!=(r=i.startTime)?r:0},r.resolveBindings=function(){for(var t,e=s(this.sceneBindings);!(t=e()).done;){var r=t.value;r.key.boundObject=r.value}for(var i,n=s(this.timelineAsset.tracks);!(i=n()).done;){var o=i.value;this.updateTrackAnimatedObject(o)}},r.updateTrackAnimatedObject=function(t){for(var e,r=s(t.getChildTracks());!(e=r()).done;){var i=e.value;i.updateAnimatedObject(),this.updateTrackAnimatedObject(i)}},e}(de),u([le()],exports.CompositionComponent.prototype,"items",void 0),u([le()],exports.CompositionComponent.prototype,"sceneBindings",void 0),u([le()],exports.CompositionComponent.prototype,"timelineAsset",void 0),exports.CompositionComponent=u([ce("CompositionComponent")],exports.CompositionComponent);var ga,xa=function(){var t=this,e=this;this.listeners={},this.off=function(e,r){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==r})))},this.on=function(e,r,i){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:r,options:i}),function(){return t.off(e,r)}},this.once=function(e,r){t.on(e,r,{once:!0})},this.emit=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];var s;null==(s=e.listeners[t])||s.forEach((function(r){var n=r.listener,s=r.options;n.apply(void 0,[].concat(i)),(null==s?void 0:s.once)&&e.off(t,n)}))},this.getListeners=function(e){var r;return(null==(r=t.listeners[e])?void 0:r.map((function(t){return t.listener})))||[]}},ba=function(){function t(){this.update=new Ea,this.lateUpdate=new _a}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==de.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==de.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==de.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==de.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Ta=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 r=t.bind(e);this.ticks.includes(r)||this.ticks.push(r)},e.clear=function(){this.components=[]},t}(),Ea=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onUpdate(e)}},e}(Ta),_a=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onLateUpdate(e)}},e}(Ta),Aa=function(t){function e(r,i){var n,o;(n=t.call(this)||this).sceneTicking=new ba,n.speed=1,n.isEnded=!1,n.loaderData={},n.refContent=[],n.postProcessingEnabled=!1,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.isEndCalled=!1,n._textures=[];var a,u=r.reusable,h=void 0!==u&&u,c=r.speed,l=void 0===c?1:c,f=r.baseRenderOrder,p=void 0===f?0:f,d=r.renderer,m=r.event,v=r.width,y=r.height,g=r.handleItemMessage;n.renderer=d,n._textures=i.textures,n.postProcessingEnabled=null!=(a=null==(o=i.jsonScene.renderSettings)?void 0:o.postProcessingEnabled)&&a,n.getEngine().renderLevel=i.renderLevel,h&&(n.keepResource=!0,i.consumed=!0);for(var x,b=i.jsonScene.compositions[0],T=s(i.jsonScene.compositions);!(x=T()).done;){var E=x.value;E.id===i.jsonScene.compositionId&&(b=E)}k(b),n.rootItem=new exports.VFXItem(n.getEngine()),n.rootItem.name="rootItem",n.rootItem.duration=b.duration,n.rootItem.endBehavior=b.endBehavior,n.rootItem.composition=lo(n);for(var _,A,C,S=s(b.components);!(_=S()).done;){var w=_.value,R=n.getEngine().findObject(w);n.rootItem.components.push(R),R.item=n.rootItem}return n.rootComposition=n.rootItem.getComponent(exports.CompositionComponent),n.width=v,n.height=y,n.renderOrder=p,n.id=b.id,n.renderer=d,n.event=m,n.statistic={loadStart:null!=(A=i.startTime)?A:0,loadTime:null!=(C=i.totalTime)?C:0,compileTime:0,firstFrameTime:0},n.reusable=h,n.speed=l,n.name=b.name,n.pluginSystem=i.pluginSystem,n.pluginSystem.initializeComposition(lo(n),i),n.camera=new yo(n.name,Ye({},null==b?void 0:b.camera,{aspect:v/y})),n.url=i.url,n.assigned=!0,n.interactive=!0,n.handleItemMessage=g,n.createRenderFrame(),n.rendererOptions=null,e.buildItemTree(n.rootItem),n.rootComposition.setChildrenRenderOrder(0),n.pluginSystem.resetComposition(lo(n),n.renderFrame),n}Ct(e,t);var r=e.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.rootItem.setVisible(t)},r.getSpeed=function(){return this.speed},r.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new Ri({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.speed,r=this.getPaused();r&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),r&&this.pause(),this.emit("goto",{time:t})},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,r=e<0,i=Math.abs(e),n=r?-15:15;i>15;i-=15)this.update(n);this.update(r?-i:i)},r.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(t,e)}))},r.update=function(t){if(this.assigned&&!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var r=1e3*(this.time-e);this.updatePluginLoaders(r),this.sceneTicking.update.tick(r),this.sceneTicking.lateUpdate.tick(r),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Mt.destroy&&!this.reusable},r.callAwake=function(t){for(var e,r=s(t.components);!(e=r()).done;){var i=e.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var n,o=s(t.children);!(n=o()).done;){var a=n.value;this.callAwake(a)}},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},r.updateCompositionTime=function(t){if(this.rootComposition.state!==no.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var r=this.rootItem.duration,i=this.rootItem.endBehavior,n=!1;if(e-r>.001)switch(n=!0,i){case Mt.restart:e%=r,this.restart();break;case Mt.freeze:e=Math.min(r,e);case Mt.forward:case Mt.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return cs((t-r.z)/i,(e-r.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,r,i){if(this.isDestroyed||!this.interactive)return[];var n=[],s=this.getHitTestRay(t,e);return this.refContent.forEach((function(o){var a;null==(a=o.getComponent(exports.CompositionComponent))||a.hitTest(s,t,e,n,r,i)})),n},r.addInteractiveItem=function(t,e){if(e===vt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},r.removeInteractiveItem=function(t,e){e===vt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},r.destroyItem=function(t){var e=this;t.type==gt.composition?t.endBehavior!==Mt.freeze&&t.getComponent(exports.CompositionComponent).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},r.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},r.dispose=function(){var t,e,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&this.keepResource&&n.forEach((function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=H)})),this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.rendererOptions)||t.emptyTexture.dispose(),null==(e=this.pluginSystem)||e.destroyComposition(this),this.update=function(){X.error("Update disposed composition: "+r.name+".")},this.dispose=H,n&&this.keepResource&&n.forEach((function(t){t.dispose=i[t.id],t.dispose()})),this.renderer.env!==In&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},r.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},r.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},r.translate=function(t,e,r){this.rootItem.translate(t,e,r)},r.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},r.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},r.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},r.scale=function(t,e,r){this.rootItem.scale(t,e,r)},r.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return i((function(){return h(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]}}))}))()},e.buildItemTree=function(t){for(var e,r=new Map,i=t.getComponent(exports.CompositionComponent).items,n=s(i);!(e=n()).done;){var o=e.value;r.set(o.id,o)}for(var a,u=s(i);!(a=u()).done;){var h=a.value;if(void 0===h.parentId)h.setParent(t);else{var c=r.get(h.parentId);if(!c)throw new Error("The element references a non-existent element, please check the data.");h.setParent(c)}}},oe(e,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(xa);exports.VFXItem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).children=[],i.transform=new mo,i.time=-1,i.duration=0,i.start=0,i.endBehavior=Mt.forward,i.type=gt.base,i.components=[],i.isDuringPlay=!1,i.active=!0,i.visible=!0,i.speed=1,i.listIndex=0,i.isEnabled=!1,i.eventProcessor=new xa,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=e,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.on=function(t,e,r){this.eventProcessor.on(t,e,r)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,r,i=s(this.components);!(r=i()).done;){var n=r.value;if(o(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,r=[],i=s(this.components);!(e=i()).done;){var n=e.value;o(n,t)&&r.push(n)}return r},r.setParent=function(t){(t!==this||t)&&(this.parent&&g(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.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},r.setColor=function(t,e,r,i){},r.setOpacity=function(t){},r.setActive=function(t){this.active!==t&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,r=s(this.components);!(e=r()).done;){e.value.enabled=t}this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new mo({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,r){this.transform.translate(t,e,r)},r.rotate=function(t,e,r){var i=new Zr(t,e,r),n=Me.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},r.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,s=i.y,o=this.composition.renderer.getWidth()/2,a=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/a)*s,r)}},r.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},r.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},r.setScale=function(t,e,r){this.transform.setScale(t,e,r)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new Ce;return this.transform.assignWorldTRS(t),t},r.find=function(t){var e;if(this.name===t)return this;var r=[];(e=r).push.apply(e,[].concat(this.children));for(var i=0;i<r.length;){var n,s=r[i];if(i++,s.name===t)return s;(n=r).push.apply(n,[].concat(s.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;r.isDuringPlay||r.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&!r.isStartCalled&&(r.onStart(),r.isStartCalled=!0)}for(var i,n=s(this.components);!(i=n()).done;){var o=i.value;o.enabled&&!o.isEnableCalled&&o.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&r.isEnableCalled&&r.disable()}},r.fromData=function(r){t.prototype.fromData.call(this,r);var i=r.id,n=r.name,a=r.delay,u=r.parentId,h=r.endBehavior,c=r.transform,l=r.duration,f=void 0===l?0:l;this.props=r,this.type=r.type,this.id=i.toString(),this.name=n,this.start=a||this.start;var p={};if(c){var d;if(p.position=(new Ce).copyFrom(c.position),c.quat)p.quat=new Me(c.quat.x,c.quat.y,c.quat.z,c.quat.w);else p.rotation=(new Zr).copyFrom(null!=(d=c.eulerHint)?d:c.rotation);p.scale=(new Ce).copyFrom(c.scale),c.size&&(p.size=(new Ae).copyFrom(c.size)),c.anchor&&(p.anchor=(new Ae).copyFrom(c.anchor)),this.transform.setTransform(p)}if(this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=u,this.duration=f,this.endBehavior=h,r.content||(r.content={options:{}}),f<0)throw new Error("Item duration can't be less than 0, see "+Ln["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var m,v=s(r.components);!(m=v()).done;){var y=m.value,g=this.engine.findObject(y);this.components.push(g),o(g,exports.ParticleSystem)&&(this.components.includes(g.renderer)||this.components.push(g.renderer))}}e.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=Qt.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var r,i=s(this.components);!(r=i()).done;){var n=r.value;o(n,exports.EffectComponent)&&this.defination.components.push(n)}}this.defination.content={}},r.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,s=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(s),a=o.x,u=o.y;this.transform.translate(2*t*a/i,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=s(this.components.slice());!(t=e()).done;){t.value.dispose()}this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;this.parent&&r.setParent(this.parent)}var i;this.parent&&g(null==(i=this.parent)?void 0:i.children,this)},r.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");for(var r,i=s(e.components);!(r=i()).done;){var n=r.value,a=this.engine.findObject(n);if(a.item=this,this.components.push(a),a.setInstanceId($()),o(a,exports.CompositionComponent))for(var u,h=s(a.items);!(u=h()).done;){var c=u.value;c.setInstanceId($());for(var l,f=s(c.components);!(l=f()).done;){l.value.setInstanceId($())}}}Aa.buildItemTree(this)},r.resetGUID=function(t){var e,r=null!=(e=null==t?void 0:t.get(this))?e:$();this.setInstanceId(r);for(var i,n=s(this.components);!(i=n()).done;){var o,a=i.value,u=null!=(o=null==t?void 0:t.get(a))?o:$();a.setInstanceId(u)}for(var h,c=s(this.children);!(h=c()).done;){h.value.resetGUID(t)}},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,r=s(this.components);!(e=r()).done;){var i=e.value;t.set(i,i.getInstanceId())}for(var n,o=s(this.children);!(n=o()).done;){n.value.gatherPreviousObjectID(t)}},e.isComposition=function(t){return t.type===gt.composition},e.isSprite=function(t){return t.type===gt.sprite},e.isParticle=function(t){return t.type===gt.particle},e.isNull=function(t){return t.type===gt.null},e.isTree=function(t){return t.type===gt.tree},e.isCamera=function(t){return t.type===gt.camera},e.isAncestor=function(t,e){for(var r=e.parent;r;){if(r===t)return!0;r=r.parent}return!1},oe(e,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,r=s(this.children);!(e=r()).done;){var i=e.value;i.composition||(i.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){if(this.listIndex!==t){this.listIndex=t;for(var e,r=s(this.components);!(e=r()).done;){var i=e.value;o(i,ve)&&(i.priority=t)}}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),e}(pe),exports.VFXItem=u([ce(Qt.VFXItemData)],exports.VFXItem),exports.Item=void 0,(ga=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},ga.isComposition=function(t){return t.type===gt.composition},ga.isParticle=function(t){return t.type===gt.particle},ga.isNull=function(t){return t.type===gt.null};var Ca=[1,1,1,1],Sa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}Ct(e,t);var r=e.prototype;return r.processFrame=function(t){var e=t.output.getUserData();if(o(e,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var r,i;this.activeMaterial=null==(r=this.activeComponent)?void 0:r.material;var n=null==(i=this.activeMaterial)?void 0:i.getColor("_Color");n&&(this.startColor=n.toArray())}var s,a,u,h=os(Ca,1),c=this.time/e.duration,l=this.opacityOverLifetime,f=this.colorOverLifetime;if(f&&(h=T(f,c,!0),s=!0),l&&(h[3]*=l.getValue(c),s=!0),s)as(this.renderColor,h,this.startColor),null==(u=this.activeMaterial)||null==(a=u.getColor("_Color"))||a.setFromArray(this.renderColor)}},r.create=function(t){this.clipData=t;var e,r=t.colorOverLifetime;r&&(this.opacityOverLifetime=$s(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===wt.GRADIENT_COLOR&&(this.colorOverLifetime=E(r.color[1])));return this},r.getActiveComponent=function(t){return t.getComponent(Bn)},e}(uo),wa=0;function Ra(t){return t.maxVertexUniforms>=256?exports.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?exports.maxSpriteMeshItemCount=16:void 0}exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new Sa(t);return e.create(this.data),e},r.fromData=function(t){this.data=t},e}(co),exports.SpriteColorPlayableAsset=u([ce(Qt.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset),exports.SpriteComponent=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).frameAnimationLoop=!1,i.name="MSprite"+wa++,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.onUpdate=function(t){var e=this,r=this.item.time,i=this.item.duration;r>i&&this.frameAnimationLoop&&(r%=i);var n=Math.min(Math.max(r/i,0),1),s=this.textureSheetAnimation,o=this.renderer.texture.source.video;if(o&&(0===r?o.pause():o.play().catch((function(t){e.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),s){var a,u,h,c,l,f=s.total||s.row*s.col,p=0,d=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],p=y[0],d=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/s.row*m,c=1/s.col*v):(h=1/s.col*m,c=1/s.row*v),s.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/s.col),b=g-x*s.col;l=u?[h*x,c*(s.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(a=this.material.getVector4("_TexOffset"))||a.setFromArray([p+l[0],v+d-l[1],h,c])}},r.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())},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.interaction,i=e.options;this.interaction=r;var n=i.startColor||[1,1,1,1];this.material.setColor("_Color",(new Re).setFromArray(n))},e}(Bn),exports.SpriteComponent=u([ce(Qt.SpriteComponent)],exports.SpriteComponent),exports.maxSpriteMeshItemCount=8;var Ma=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),Oa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),Pa=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),Ia=function(t){function e(e){var r;return(r=t.call(this,e)||this).animationStream=new Pa(lo(r)),r}return Ct(e,t),e}(uo),La=new Zr,Fa=new Ce(1,1,1),Va=new Ce,Da=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new Ce(e.x,e.y,e.x)};var r,i=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=$s(i.path));var o=i.linearX||i.linearY||i.linearZ;o&&(this.linearVelOverLifetime={x:i.linearX&&$s(i.linearX),y:i.linearY&&$s(i.linearY),z:i.linearZ&&$s(i.linearZ),asMovement:i.asMovement,enabled:!!o});var a=i.orbitalX||i.orbitalY||i.orbitalZ;a&&(this.orbitalVelOverLifetime={x:i.orbitalX&&$s(i.orbitalX),y:i.orbitalY&&$s(i.orbitalY),z:i.orbitalZ&&$s(i.orbitalZ),center:ss(i.orbCenter),asRotation:i.asRotation,enabled:!!a}),this.speedOverLifetime=i.speedOverLifetime&&$s(i.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=$s(s.x||1),this.sizeYOverLifetime=$s(s.y||1),this.sizeZOverLifetime=$s(s.z||1)):this.sizeXOverLifetime=$s(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:$s(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=$s(n.x||0),u.y=$s(n.y||0)}this.gravity=Ce.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=$s(null!=(r=null==i?void 0:i.gravityOverLifetime)?r:0),this.direction=(null==i?void 0:i.direction)?Ce.fromArray(i.direction).normalize():new Ce,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();o(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,r=e.duration,i=this.time/r;if(i=i<0?0:i>1?1:i,this.sizeXOverLifetime){Fa.x=this.sizeXOverLifetime.getValue(i),this.sizeSeparateAxes?(Fa.y=this.sizeYOverLifetime.getValue(i),Fa.z=this.sizeZOverLifetime.getValue(i)):Fa.z=Fa.y=Fa.x;var n=this.originalTransform.scale;e.transform.setScale(Fa.x*n.x,Fa.y*n.y,Fa.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(i):e.getIntegrateValue(0,i,r)},o=s(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;La.x=a?s(this.rotationOverLifetime.x):0,La.y=a?s(this.rotationOverLifetime.y):0,La.z=o;var u=La.addEulers(this.originalTransform.rotation,La);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Va;ns(h,this,this.gravity,this.time,r,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(i)),e.transform.setPosition(h.x,h.y,h.z)}},e}(Ia);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new Da(t);return e.data=this.transformAnimationData,e},r.fromData=function(t){this.transformAnimationData=t},e}(co),exports.TransformPlayableAsset=u([ce(Qt.TransformPlayableAsset)],exports.TransformPlayableAsset);var Na=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();o(e,exports.VFXItem)&&(e.time=this.time)},e}(uo);exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){return new Na(t)},e}(co),exports.ActivationPlayableAsset=u([ce(Qt.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}Ct(e,t);var r=e.prototype;return r.sampleAnimation=function(t,e){var r=e/t.duration;r=r<0?0:r>1?1:r;for(var i,n=s(this.positionCurves);!(i=n()).done;){var o=i.value,a=o.keyFrames.getValue(r),u=this.findTarget(t,o.path);null==u||u.transform.setPosition(a.x,a.y,a.z)}for(var h,c=s(this.rotationCurves);!(h=c()).done;){var l=h.value,f=l.keyFrames.getValue(r),p=this.findTarget(t,l.path);null==p||p.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var d,m=s(this.scaleCurves);!(d=m()).done;){var v=d.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setScale(y.x,y.y,y.z)}},r.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,r=s(t.positionCurves);!(e=r()).done;){var i=e.value,n={path:i.path,keyFrames:$s(i.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var o,a=s(t.rotationCurves);!(o=a()).done;){var u=o.value,h={path:u.path,keyFrames:$s(u.keyFrames)};this.duration=Math.max(this.duration,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}for(var c,l=s(t.scaleCurves);!(c=l()).done;){var f=c.value,p={path:f.path,keyFrames:$s(f.keyFrames)};this.duration=Math.max(this.duration,p.keyFrames.getMaxTime()),this.scaleCurves.push(p)}for(var d,m=s(t.floatCurves);!(d=m()).done;){var v=d.value,y={path:v.path,keyFrames:$s(v.keyFrames),property:v.property,className:v.className};this.duration=Math.max(this.duration,y.keyFrames.getMaxTime()),this.floatCurves.push(y)}},r.findTarget=function(t,e){for(var r,i=t,n=s(e);!(r=n()).done;){for(var o,a=r.value,u=!1,h=s(i.children);!(o=h()).done;){var c=o.value;if(c.name===a){i=c,u=!0;break}}if(!u)return}return i},e}(pe),exports.AnimationClip=u([ce(Qt.AnimationClip)],exports.AnimationClip);var ka=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();o(e,exports.VFXItem)&&e.composition&&this.clip.sampleAnimation(e,this.time)},e}(uo),za=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},oe(t,null,[{key:"shared",get:function(){return Ua.x=0,Ua.y=0,Ua}}]),t}(),Ua=new za,Ba=1e-4,Ga=1e-4;function ja(t,e,r,i,n,s,o,a){var u,h;o?(u=i,h=-r):(u=-i,h=r);var c=t-r*n+u,l=e-i*n+h,f=t+r*s+u,p=e+i*s+h;return a.push(c,l),a.push(f,p),2}function Xa(t,e,r,i,n,s,o,a){var u=r-t,h=i-e,c=Math.atan2(u,h),l=Math.atan2(n-t,s-e);a&&c<l?c+=2*Math.PI:!a&&c>l&&(l+=2*Math.PI);var f=c,p=l-c,d=Math.abs(p),m=Math.sqrt(u*u+h*h),v=1+(15*d*Math.sqrt(m)/Math.PI>>0),y=p/v;if(f+=y,a){o.push(t,e),o.push(r,i);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,s)}else{o.push(r,i),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,s),o.push(t,e)}return 2*v}function Ha(t,e,r,i,n,s,o,a,u){var h=Ba;if(0!==t.length){var c=e,l=c.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var r=0,i=0,n=t[e-2],s=t[e-1];i<e;i+=2){var o=t[i],a=t[i+1];r+=(o-n)*(a+s),n=o,s=a}return r<0?-1:1}(t);r&&(f*=-1),l=(l-.5)*f+.5}var p=new za(t[0],t[1]),d=new za(t[t.length-2],t[t.length-1]),m=i,v=Math.abs(p.x-d.x)<h&&Math.abs(p.y-d.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),d.set(t[t.length-2],t[t.length-1]));var y=.5*(p.x+d.x),g=.5*(d.y+p.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,E=x.length/2,_=c.width/2,A=_*_,C=c.miterLimit*c.miterLimit,S=t[0],w=t[1],R=t[2],M=t[3],O=0,P=0,I=-(w-M),L=S-R,F=0,V=0,D=Math.sqrt(I*I+L*L)+be;I/=D,L/=D,I*=_,L*=_;var N=2*(1-l),k=2*l;m||(c.cap===Yt.Round?T+=Xa(S-I*(N-k)*.5,w-L*(N-k)*.5,S-I*N,w-L*N,S+I*k,w+L*k,x,!0)+2:c.cap===Yt.Square&&(T+=ja(S,w,I,L,N,k,!0,x))),x.push(S-I*N,w-L*N),x.push(S+I*k,w+L*k);for(var z=1;z<b-1;++z){S=t[2*(z-1)],w=t[2*(z-1)+1],R=t[2*z],M=t[2*z+1],O=t[2*(z+1)],P=t[2*(z+1)+1],I=-(w-M),L=S-R,I/=D=Math.sqrt(I*I+L*L)+be,L/=D,I*=_,L*=_,F=-(M-P),V=R-O,F/=D=Math.sqrt(F*F+V*V)+be,V/=D,F*=_,V*=_;var U=R-S,B=w-M,G=R-O,j=P-M,X=U*G+B*j,H=B*G-j*U,W=H<0;if(Math.abs(H)<.001*Math.abs(X))x.push(R-I*N,M-L*N),x.push(R+I*k,M+L*k),X>=0&&(c.join===Zt.Round?T+=Xa(R,M,R-I*N,M-L*N,R-F*N,M-V*N,x,!1)+4:T+=2,x.push(R-F*k,M-V*k),x.push(R+F*N,M+V*N));else{var Y=(-I+S)*(-L+M)-(-I+R)*(-L+w),Z=(-F+O)*(-V+M)-(-F+R)*(-V+P),q=(U*Z-G*Y)/H,K=(j*Y-B*Z)/H,Q=(q-R)*(q-R)+(K-M)*(K-M),J=R+(q-R)*N,$=M+(K-M)*N,tt=R-(q-R)*k,et=M-(K-M)*k,rt=W?N:k;Q<=Math.min(U*U+B*B,G*G+j*j)+rt*rt*A?c.join===Zt.Bevel||Q/A>C?(W?(x.push(J,$),x.push(R+I*k,M+L*k),x.push(J,$),x.push(R+F*k,M+V*k)):(x.push(R-I*N,M-L*N),x.push(tt,et),x.push(R-F*N,M-V*N),x.push(tt,et)),T+=2):c.join===Zt.Round?W?(x.push(J,$),x.push(R+I*k,M+L*k),T+=Xa(R,M,R+I*k,M+L*k,R+F*k,M+V*k,x,!0)+4,x.push(J,$),x.push(R+F*k,M+V*k)):(x.push(R-I*N,M-L*N),x.push(tt,et),T+=Xa(R,M,R-I*N,M-L*N,R-F*N,M-V*N,x,!1)+4,x.push(R-F*N,M-V*N),x.push(tt,et)):(x.push(J,$),x.push(tt,et)):(x.push(R-I*N,M-L*N),x.push(R+I*k,M+L*k),c.join===Zt.Round?T+=W?Xa(R,M,R+I*k,M+L*k,R+F*k,M+V*k,x,!0)+2:Xa(R,M,R-I*N,M-L*N,R-F*N,M-V*N,x,!1)+2:c.join===Zt.Miter&&Q/A<=C&&(W?(x.push(tt,et),x.push(tt,et)):(x.push(J,$),x.push(J,$)),T+=2),x.push(R-F*N,M-V*N),x.push(R+F*k,M+V*k),T+=2)}}S=t[2*(b-2)],w=t[2*(b-2)+1],R=t[2*(b-1)],I=-(w-(M=t[2*(b-1)+1])),L=S-R,I/=D=Math.sqrt(I*I+L*L)+be,L/=D,I*=_,L*=_,x.push(R-I*N,M-L*N),x.push(R+I*k,M+L*k),m||(c.cap===Yt.Round?T+=Xa(R-I*(N-k)*.5,M-L*(N-k)*.5,R-I*N,M-L*N,R+I*k,M+L*k,x,!1)+2:c.cap===Yt.Square&&(T+=ja(R,M,I,L,N,k,!1,x)));for(var it=Ga*Ga,nt=E;nt<T+E-2;++nt)S=x[2*nt],w=x[2*nt+1],R=x[2*(nt+1)],M=x[2*(nt+1)+1],O=x[2*(nt+2)],P=x[2*(nt+2)+1],Math.abs(S*(M-P)+R*(P-w)+O*(w-M))<it||a.push(nt,nt+1,nt+2)}}var Wa=function(){},Ya="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Za={exports:{}};!function(t){var e;function r(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?i<n?e.a-t.a+i/(i+n)*(t.a-r.a):e.a-r.a+n/(i+n)*(r.a-t.a):0}function s(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?(e.a-r.a)*i+(e.a-t.a)*n:0}function o(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?i<n?e.b-t.b+i/(i+n)*(t.b-r.b):e.b-r.b+n/(i+n)*(r.b-t.b):0}function u(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?(e.b-r.b)*i+(e.b-t.b)*n:0}function h(t){return i(t.b.a,t.a)}function c(t){return i(t.a,t.b.a)}function l(t,e,r,i){return(t=0>t?0:t)<=(r=0>r?0:r)?0===r?(e+i)/2:e+t/(t+r)*(i-e):i+r/(t+r)*(e-i)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function p(t,e){var r=!1,i=!1;t!==e&&(e.a!==t.a&&(i=!0,E(e.a,t.a)),e.d!==t.d&&(r=!0,_(e.d,t.d)),g(e,t),i||(x(e,t.a),t.a.c=t),r||(b(e,t.d),t.d.a=t))}function d(t){var e=t.b,r=!1;t.d!==t.b.d&&(r=!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)),r||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),r=e.b;return g(e,t.e),e.a=t.b.a,x(r,e.a),e.d=r.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 r=!1,i=y(t),n=i.b;return e.d!==t.d&&(r=!0,_(e.d,t.d)),g(i,t.e),g(n,e),i.a=t.b.a,n.a=e.a,i.d=n.d=t.d,t.d.a=n,r||b(i,t.d),i}function y(t){var e=new J,r=new J,i=t.b.h;return r.h=i,i.b.h=e,e.h=t,t.b.h=r,e.b=r,e.c=e,e.e=r,r.b=e,r.c=r,r.e=e}function g(t,e){var r=t.c,i=e.c;r.b.e=e,i.b.e=t,t.c=i,e.c=r}function x(t,e){var r=e.f,i=new et(e,r);r.e=i,e.f=i,r=i.c=t;do{r.a=i,r=r.c}while(r!==t)}function b(t,e){var r=e.d,i=new Q(e,r);r.b=i,e.d=i,i.a=t,i.c=e.c,r=t;do{r.d=i,r=r.e}while(r!==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 r=t.c,i=r;do{i.a=e,i=i.c}while(i!==r);r=t.f,(i=t.e).f=r,r.e=i}function _(t,e){var r=t.a,i=r;do{i.d=e,i=i.e}while(i!==r);r=t.d,(i=t.b).d=r,r.b=i}function A(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 S(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,r){return t=t.a,e=e.a,r=r.a,e.b.a===t?r.b.a===t?i(e.a,r.a)?0>=s(r.b.a,e.a,r.a):0<=s(e.b.a,r.a,e.a):0>=s(r.b.a,t,r.a):r.b.a===t?0<=s(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(r.b.a,t,r.a))}function R(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function M(t,e){d(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do{t=pt(t)}while(t.a.a===e);return t.c&&(M(t,e=v(ft(t).a.b,t.a.e)),t=pt(t)),t}function P(t,e,r){var i=new lt;return i.a=r,i.e=H(t.f,e.e,i),r.i=i}function I(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function L(t){var e=t.a,r=e.d;r.c=t.d,r.a=e,R(t)}function F(t,e,r){for(t=e,e=e.a;t!==r;){t.c=!1;var i=ft(t),n=i.a;if(n.a!==e.a){if(!i.c){L(t);break}M(i,n=v(e.c.b,n.b))}e.c!==n&&(p($(n),n),p(e,n)),L(t),e=i.a,t=i}return e}function V(t,e,r,i,n,s){var o=!0;do{P(t,e,r.b),r=r.c}while(r!==i);for(null===n&&(n=ft(e).a.b.c);(r=(i=ft(e)).a.b).a===n.a;)r.c!==n&&(p($(r),r),p($(n),r)),i.f=e.f-r.f,i.d=I(t,i.f),e.b=!0,!o&&z(t,e)&&(S(r,n),R(e),d(n)),o=!1,e=i,n=r;e.b=!0,s&&B(t,e)}function D(t,e,r,i,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,r,i,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=r[0])}function N(t,e,r){var i=[null,null,null,null];i[0]=e.a.d,i[1]=r.a.d,D(t,e.a,i,[.5,.5,0,0],!1),p(e,r)}function k(t,e,r,i,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(r.b-t.b)+Math.abs(r.a-t.a),a=n+1;i[n]=.5*o/(s+o),i[a]=.5*s/(s+o),t.g[0]+=i[n]*e.g[0]+i[a]*r.g[0],t.g[1]+=i[n]*e.g[1]+i[a]*r.g[1],t.g[2]+=i[n]*e.g[2]+i[a]*r.g[2]}function z(t,e){var n=ft(e),o=e.a,a=n.a;if(i(o.a,a.a)){if(0<s(a.b.a,o.a,a.a))return!1;if(r(o.a,a.a)){if(o.a!==a.a){n=t.e;var u=o.a.h;if(0<=u){var h=(n=n.b).d,c=n.e,l=n.c,f=l[u];h[f]=h[n.a],l[h[f]]=f,f<=--n.a&&(1>=f||i(c[h[f>>1]],c[h[f]])?ht(n,f):ct(n,f)),c[u]=null,l[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;N(t,$(a),o)}}else m(a.b),p(o,$(a)),e.b=n.b=!0}else{if(0>s(o.b.a,a.a,o.a))return!1;pt(e).b=e.b=!0,m(o.b),p($(a),o)}return!0}function U(t,e){var h=ft(e),c=e.a,f=h.a,d=c.a,v=f.a,y=c.b.a,g=f.b.a,x=new et;if(s(y,t.a,d),s(g,t.a,v),d===v||Math.min(d.a,y.a)>Math.max(v.a,g.a))return!1;if(i(d,v)){if(0<s(g,d,v))return!1}else if(0>s(y,v,d))return!1;var b,T,E=y,_=d,A=g,C=v;if(i(E,_)||(b=E,E=_,_=b),i(A,C)||(b=A,A=C,C=b),i(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),i(A,_)?i(_,C)?(0>(b=n(E,A,_))+(T=n(A,_,C))&&(b=-b,T=-T),x.b=l(b,A.b,T,_.b)):(0>(b=s(E,A,_))+(T=-s(E,C,_))&&(b=-b,T=-T),x.b=l(b,A.b,T,C.b)):x.b=(A.b+_.b)/2,o(E,_)||(b=E,E=_,_=b),o(A,C)||(b=A,A=C,C=b),o(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),o(A,_)?o(_,C)?(0>(b=a(E,A,_))+(T=a(A,_,C))&&(b=-b,T=-T),x.a=l(b,A.a,T,_.a)):(0>(b=u(E,A,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=l(b,A.a,T,C.a)):x.a=(A.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(d,v)?d:v,i(E,x)&&(x.b=E.b,x.a=E.a),r(x,d)||r(x,v))return z(t,e),!1;if(!r(y,t.a)&&0<=s(y,t.a,x)||!r(g,t.a)&&0>=s(g,t.a,x)){if(g===t.a)return m(c.b),p(f.b,c),c=ft(e=O(e)).a,F(t,ft(e),h),V(t,e,$(c),c,c,!0),!0;if(y===t.a){m(f.b),p(c.e,$(f)),v=(d=h=e).a.b.a;do{d=pt(d)}while(d.a.b.a===v);return d=ft(e=d).a.b.c,h.a=$(f),V(t,e,(f=F(t,h,null)).c,c.b.c,d,!0),!0}return 0<=s(y,t.a,x)&&(pt(e).b=e.b=!0,m(c.b),c.a.b=t.a.b,c.a.a=t.a.a),0>=s(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(c.b),m(f.b),p($(f),c),c.a.b=x.b,c.a.a=x.a,c.a.h=it(t.e,c.a),c=c.a,f=[0,0,0,0],x=[d.d,y.d,v.d,g.d],c.g[0]=c.g[1]=c.g[2]=0,k(c,d,y,f,0),k(c,v,g,f,2),D(t,c,x,f,!0),pt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var r=ft(e);;){for(;r.b;)e=r,r=ft(r);if(!e.b&&(r=e,null===(e=pt(e))||!e.b))break;e.b=!1;var n,o=e.a,a=r.a;if(n=o.b.a!==a.b.a)t:{var u=ft(n=e),h=n.a,c=u.a,l=void 0;if(i(h.b.a,c.b.a)){if(0>s(h.b.a,c.b.a,h.a)){n=!1;break t}pt(n).b=n.b=!0,l=m(h),p(c.b,l),l.d.c=n.d}else{if(0<s(c.b.a,h.b.a,c.a)){n=!1;break t}n.b=u.b=!0,l=m(c),p(h.e,c.b),l.b.d.c=n.d}n=!0}if(n&&(r.c?(R(r),d(a),a=(r=ft(e)).a):e.c&&(R(e),d(o),o=(e=pt(r)).a)),o.a!==a.a)if(o.b.a===a.b.a||e.c||r.c||o.b.a!==t.a&&a.b.a!==t.a)z(t,e);else if(U(t,e))break;o.a===a.a&&o.b.a===a.b.a&&(S(a,o),R(e),d(o),e=pt(r))}}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 lt).a=o.c.b;var a=(l=n.f).a;do{a=a.a}while(null!==a.b&&!l.c(l.b,h,a.b));var u=ft(l=a.b),h=l.a;a=u.a;if(0===s(h.b.a,o,h.a))r((h=l.a).a,o)||r(h.b.a,o)||(m(h.b),l.c&&(d(h.c),l.c=!1),p(o.c,h),G(n,o));else{var c=i(a.b.a,h.b.a)?l:u;u=void 0;l.d||c.c?(u=c===l?v(o.c.b,h.e):v(a.b.c.b,o.c).b,c.c?M(c,u):(h=n,(l=P(n,l,u)).f=pt(l).f+l.a.f,l.d=I(h,l.f)),G(n,o)):V(n,l,o.c,o.c,null,!0)}return}if(l=(h=ft(n=O(n.i))).a,(h=F(t,h,null)).c===l){h=(l=h).c,a=ft(n),u=n.a,c=a.a;var l,f=!1;u.b.a!==c.b.a&&U(t,n),r(u.a,t.a)&&(p($(h),u),h=ft(n=O(n)).a,F(t,ft(n),a),f=!0),r(c.a,t.a)&&(p(l,$(c)),l=F(t,a,null),f=!0),f?V(t,n,l.c,h,h,!0):(o=i(c.a,u.a)?$(c):u,V(t,n,o=v(l.c.b,o),o.c,o.c,!1),o.b.i.c=!0,B(t,n))}else V(t,n,h.c,l,l,!0)}function j(t,e){var r=new lt,i=f(t.b);i.a.b=C,i.a.a=e,i.b.a.b=-C,i.b.a.a=e,t.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=H(i=t.f,i.a,r),r.e=i}function X(t){this.a=new W,this.b=t,this.c=w}function H(t,e,r){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,r));return t=new W(r,e.a,e),e.a.c=t,e.a=t}function W(t,e,r){this.b=t||null,this.a=e||this,this.c=r||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 rt(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new st}function it(t,e){if(t.e){var r,i=t.b,n=++i.a;return 2*n>i.f&&(i.f*=2,i.c=ot(i.c,i.f+1)),0===i.b?r=n:(r=i.b,i.b=i.c[i.b]),i.e[r]=e,i.c[r]=n,i.d[n]=r,i.h&&ct(i,n),r}return i=t.a++,t.c[i]=e,-(i+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&&i(at(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 st(){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 r=Array(e),i=0;i<t.length;i++)r[i]=t[i];for(;i<e;i++)r[i]=0;return r}function at(t){return t.e[t.d[1]]}function ut(t){var e=t.d,r=t.e,i=t.c,n=e[1],s=r[n];return 0<t.a&&(e[1]=e[t.a],i[e[1]]=1,r[n]=null,i[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),s}function ht(t,e){for(var r=t.d,n=t.e,s=t.c,o=e,a=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[a],n[h])){r[o]=a,s[a]=o;break}r[o]=h,s[h]=o,o=u}}function ct(t,e){for(var r=t.d,n=t.e,s=t.c,o=e,a=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[a])){r[o]=a,s[a]=o;break}r[o]=h,s[h]=o,o=u}}function lt(){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 pt(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,r){this.j[0]=t,this.j[1]=e,this.j[2]=r},e.z=function(t,e){var r=e||null;switch(t){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:K(this,100900)}},e.C=function(t,e){var r=!1,i=[0,0,0];q(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,r=!0),1e150<s&&(s=1e150,r=!0),i[n]=s}r&&K(this,100155),null===(r=this.q)?p(r=f(this.b),r.b):(m(r),r=r.e),r.a.d=e,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},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=[l=this.j[0],n=this.j[1],a=this.j[2]];if(0===l&&0===n&&0===a){for(var n=[-2e150,-2e150,-2e150],o=[2e150,2e150,2e150],a=[],u=[],l=(t=this.b.c).e;l!==t;l=l.e)for(var f=0;3>f;++f){var p=l.g[f];p<o[f]&&(o[f]=p,u[f]=l),p>n[f]&&(n[f]=p,a[f]=l)}if(l=0,n[1]-o[1]>n[0]-o[0]&&(l=1),n[2]-o[2]>n[l]-o[l]&&(l=2),o[l]>=n[l])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,o=u[l],a=a[l],u=[0,0,0],o=[o.g[0]-a.g[0],o.g[1]-a.g[1],o.g[2]-a.g[2]],f=[0,0,0],l=t.e;l!==t;l=l.e)f[0]=l.g[0]-a.g[0],f[1]=l.g[1]-a.g[1],f[2]=l.g[2]-a.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],(p=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=p,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[A(o)]=1)}t=!0}for(u=A(e),l=this.b.c,n=(u+1)%3,a=(u+2)%3,u=0<e[u]?1:-1,e=l.e;e!==l;e=e.e)e.b=e.g[n],e.a=u*e.g[a];if(t){for(e=0,l=(t=this.b.a).b;l!==t;l=l.b)if(!(0>=(n=l.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==l.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,l=(e=this.b.b).h;l!==e;l=t)t=l.h,n=l.e,r(l.a,l.b.a)&&l.e.e!==l&&(N(this,n,l),d(l),n=(l=n).e),n.e===l&&(n!==l&&(n!==t&&n!==t.b||(t=t.h),d(n)),l!==t&&l!==t.b||(t=t.h),d(l));for(this.e=e=new rt,l=(t=this.b.c).e;l!==t;l=l.e)l.h=it(e,l);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,r){return i(t[e],t[r])?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(l=this.e,0===l.a)t=at(l.b);else if(t=l.c[l.d[l.a-1]],0!==l.b.a&&(l=at(l.b),i(l,t))){t=l;break t}if(null===t||!r(t,e))break;t=nt(this.e),N(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,R(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,l=(e=this.b).a.b;l!==e.a;l=t)t=l.b,(l=l.a).e.e===l&&(S(l.c,l),d(l));if(!this.n){if(e=this.b,this.m)for(l=e.b.h;l!==e.b;l=t)t=l.h,l.b.d.c!==l.d.c?l.f=l.d.c?1:-1:d(l);else for(l=e.a.b;l!==e.a;l=t)if(t=l.b,l.c){for(l=l.a;i(l.b.a,l.a);l=l.c.b);for(;i(l.a,l.b.a);l=l.e);for(n=l.c.b,a=void 0;l.e!==n;)if(i(l.b.a,n.a)){for(;n.e!==l&&(h(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(a=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==l&&(c(l.c.b)||0<=s(l.b.a,l.a,l.c.b.a));)l=(a=v(l,l.c.b)).b;l=l.e}for(;n.e.e!==l;)n=(a=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),l=t.a;do{this.k&&this.k(l.a.d,this.c),l=l.e}while(l!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,l=!1,n=-1,a=e.a.d;a!==e.a;a=a.d)if(a.c){l||(this.h&&this.h(4,this.c),l=!0),u=a.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!==a.a)}l&&this.i&&this.i(this.c)}if(this.r){for(l=(e=this.b).a.b;l!==e.a;l=t)if(t=l.b,!l.c){a=(n=l.a).e,u=void 0;do{a=(u=a).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=l.d,(l=l.b).d=n,n.b=l}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Ya.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=Ya.libtess}(Za);var qa=function(){var t=new Za.exports.GluTesselator;return t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Za.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,r){return[t[0],t[1],t[2]]})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function Ka(t){qa.gluTessNormal(0,0,1);var e=[];qa.gluTessBeginPolygon(e);for(var r=0;r<t.length;r++){qa.gluTessBeginContour();for(var i=t[r],n=0;n<i.length;n+=2){var s=[i[n],i[n+1],0];qa.gluTessVertex(s,s)}qa.gluTessEndContour()}return qa.gluTessEndPolygon(),e}var Qa=function(t){function e(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var s=Array.isArray(r[0])?r[0]:r;if("number"!=typeof s[0]){for(var o=[],a=0,u=s.length;a<u;a++)o.push(s[a].x,s[a].y);s=o}return n.points=s,n.closePath=!0,n}Ct(e,t);var r=e.prototype;return r.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},r.contains=function(t,e){for(var r=!1,i=this.points.length/2,n=0,s=i-1;n<i;s=n++){var o=this.points[2*n],a=this.points[2*n+1],u=this.points[2*s],h=this.points[2*s+1];a>e!=h>e&&t<(e-a)/(h-a)*(u-o)+o&&(r=!r)}return r},r.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.points[this.points.length-2]},r.getY=function(){return this.points[this.points.length-1]},r.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},r.triangulate=function(t,e,r,i,n){var s=Ka([t]),o=e.length/2;0===s.length&&this.getLineEndPointsTriangle(t,s);for(var a=0;a<s.length;a++)e[2*r+a]=s[a];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=o+h},r.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var r=t[2]-t[0],i=t[3]-t[1],n=t[0],s=t[1],o=t[0],a=t[1];if(Math.abs(r)>=Math.abs(i))for(var u=0;u<t.length;u+=2){var h=t[u],c=t[u+1];h<n&&(n=h,s=c),h>o&&(o=h,a=c)}else for(var l=0;l<t.length;l+=2){var f=t[l],p=t[l+1];p<s&&(n=f,s=p),p>a&&(o=f,a=p)}e.push(n,s,o,a,o,a)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},oe(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Wa),Ja=8,$a=1.1920929e-7;function tu(t,e,r,i,n,s,o,a,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,r,i,n,s,o,a,u,h){eu(t,e,r,i,n,s,o,a,u,h,0),u.push(o,a)}(e,r,i,n,s,o,a,u,t,c*=c),t}function eu(t,e,r,i,n,s,o,a,u,h,c){if(!(c>Ja)){var l=(t+r)/2,f=(e+i)/2,p=(r+n)/2,d=(i+s)/2,m=(n+o)/2,v=(s+a)/2,y=(l+p)/2,g=(f+d)/2,x=(p+m)/2,b=(d+v)/2,T=(y+x)/2,E=(g+b)/2;if(c>0){var _=o-t,A=a-e,C=Math.abs((r-o)*A-(i-a)*_),S=Math.abs((n-o)*A-(s-a)*_);if(C>$a&&S>$a){if((C+S)*(C+S)<=h*(_*_+A*A))return void u.push(T,E)}else if(C>$a){if(C*C<=h*(_*_+A*A))return void u.push(T,E)}else if(S>$a){if(S*S<=h*(_*_+A*A))return void u.push(T,E)}else if((_=T-(t+o)/2)*_+(A=E-(e+a)/2)*A<=h)return void u.push(T,E)}eu(t,e,l,f,y,g,T,E,u,h,c+1),eu(T,E,x,b,m,v,o,a,u,h,c+1)}}var ru,iu=function(t){function e(e,r,i,n){var s;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=r,s.halfWidth=i,s.halfHeight=n,s}Ct(e,t);var r=e.prototype;return r.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},r.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var r=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return(r*=r)+(i*=i)<=1},r.strokeContains=function(t,e,r){var i=this.halfWidth,n=this.halfHeight;if(i<=0||n<=0)return!1;var s=r/2,o=i-s,a=n-s,u=i+s,h=n+s,c=t-this.x,l=e-this.y;return c*c/(o*o)+l*l/(a*a)>1&&c*c/(u*u)+l*l/(h*h)<=1},r.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.x},r.getY=function(){return this.y},r.build=function(t){var e=this.x,r=this.y,i=this.halfWidth,n=this.halfHeight;if(!(i>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(i+n)),o=8*s+0+0;if(0===o)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=r+0,t[2]=t[4]=e-0,t[5]=t[7]=r-0,t;var a=0,u=4*s+0+2,h=u,c=o,l=0+i,f=0,p=e+l,d=e-l,m=r+f;t[a++]=p,t[a++]=m,t[--u]=m,t[--u]=d;for(var v=1;v<s;v++){var y=Math.PI/2*(v/s),g=0+Math.cos(y)*i,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=r+x,_=r-x;t[a++]=b,t[a++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--c]=_,t[--c]=b}p=e+(l=0),d=e-l,m=r+(f=0+n);var A=r-f;return t[a++]=p,t[a++]=m,t[--c]=A,t[--c]=p,t},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=o;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Wa);exports.StarType=void 0,(ru=exports.StarType||(exports.StarType={}))[ru.Star=0]="Star",ru[ru.Polygon=1]="Polygon";var nu=function(t){function e(e,r,i,n,s,o){var a;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),(a=t.call(this)||this).pointCount=e,a.outerRadius=r,a.innerRadius=i,a.outerRoundness=n,a.innerRoundness=s,a.starType=o,a.v=[],a.in=[],a.out=[],a}Ct(e,t);var r=e.prototype;return r.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},r.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},r.copyTo=function(t){t.copyFrom(this)},r.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)tu(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var r=this.v.length-1;tu(t,this.v[r-1],this.v[r],this.out[r-1],this.out[r],this.in[0],this.in[1],this.v[0],this.v[1],1)},r.triangulate=function(t,e,r,i,n){for(var s=Ka([t]),o=e.length/2,a=0;a<s.length;a++)e[2*r+a]=s[a];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=o+h},r.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,r,i,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,o=!0,a=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,c=this.innerRoundness/100,l=2*Math.PI*a/(2*n),f=2*Math.PI*u/(2*n),p=-Math.PI/2;for(t=0;t<n;t++){r=o?h:c,i=o?l:f;var d=(e=o?a:u)*Math.cos(p),m=e*Math.sin(p),v=0===d&&0===m?0:m/Math.sqrt(d*d+m*m),y=0===d&&0===m?0:-d/Math.sqrt(d*d+m*m),g=2*t;this.v[g]=d,this.v[g+1]=m,this.in[g]=d+v*i*r*1,this.in[g+1]=m+y*i*r*1,this.out[g]=d-v*i*r*1,this.out[g+1]=m-y*i*r*1,o=!o,p+=1*s}},r.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),r=2*Math.PI/e,i=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*i/(4*e),o=.5*-Math.PI;for(t=0;t<e;t++){var a=i*Math.cos(o),u=i*Math.sin(o),h=0===a&&0===u?0:u/Math.sqrt(a*a+u*u),c=0===a&&0===u?0:-a/Math.sqrt(a*a+u*u),l=2*t;this.v[l]=a,this.v[l+1]=u,this.in[l]=a+h*s*n*1,this.in[l+1]=u+c*s*n*1,this.out[l]=a-h*s*n*1,this.out[l+1]=u-c*s*n*1,o+=1*r}},e}(Wa),su=function(t){function e(e,r,i,n,s){var o;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=20),(o=t.call(this)||this).x=e,o.y=r,o.width=i,o.height=n,o.roundness=s,o}Ct(e,t);var r=e.prototype;return r.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},r.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},r.copyTo=function(t){return t.copyFrom(this),t},r.build=function(t){var e,r=this.width/2,i=this.height/2,n=this.x+r,s=this.y+i,o=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,i)),a=r-o,u=i-e;if(o>=0&&e>=0&&a>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(o+e)),c=8*h+(a?4:0)+(u?4:0);if(0!==c){if(0===h)return t[0]=t[6]=n+a,t[1]=t[3]=s+u,t[2]=t[4]=n-a,void(t[5]=t[7]=s-u);var l=0,f=4*h+(a?2:0)+2,p=f,d=c,m=a+o,v=u,y=n+m,g=n-m,x=s+v;if(t[l++]=y,t[l++]=x,t[--f]=x,t[--f]=g,u){var b=s-v;t[p++]=g,t[p++]=b,t[--d]=b,t[--d]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=a+Math.cos(E)*o,A=u+Math.sin(E)*e,C=n+_,S=n-_,w=s+A,R=s-A;t[l++]=C,t[l++]=w,t[--f]=w,t[--f]=S,t[p++]=S,t[p++]=R,t[--d]=R,t[--d]=C}y=n+(m=a),g=n-m,x=s+(v=u+e);var M=s-v;t[l++]=y,t[l++]=x,t[--d]=M,t[--d]=y,a&&(t[l++]=g,t[l++]=x,t[--d]=M,t[--d]=g)}}},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=o;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Wa),ou=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=s(this.graphicsPath.instructions);!(t=e()).done;){var r=t.value,i=r.action,n=r.data;switch(i){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);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"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,r,i,n,s,o){this.ensurePoly();var a=this.currentPoly;return tu(a.points,a.lastX,a.lastY,t,e,r,i,n,s,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,r,i,n){return this.drawShape(new iu(t,e,r,i),n),this},e.polyStar=function(t,e,r,i,n,s,o){return this.drawShape(new nu(t,e,r,i,n,s),o),this},e.rect=function(t,e,r,i,n,s){return this.drawShape(new su(t,e,r,i,n),s),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var r=this.currentPoly;return r&&this.endPoly(),(r=new Qa).points.push(t,e),this.currentPoly=r,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 Qa,this.currentPoly.points.push(0,0))},t}(),au=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,r,i,n,s,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,r,i,n,s,o]}),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,r,i,n){return this.instructions.push({action:"ellipse",data:[t,e,r,i,n]}),this.dirty=!0,this},e.rect=function(t,e,r,i,n,s){return this.instructions.push({action:"rect",data:[t,e,r,i,n,s]}),this.dirty=!0,this},e.polyStar=function(t,e,r,i,n,s,o){return this.instructions.push({action:"polyStar",data:[t,e,r,i,n,s,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},oe(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new ou(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function uu(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?lo(t):e}var hu=new(function(){function t(){this.elements=[]}var r=t.prototype;return r.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},r.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return k(t),t}if(Ao(Eo))return e.window._createOffscreenCanvas(10,10);var r=e.document.createElement("canvas");return r.getContext("2d",{willReadFrequently:!0}),r},r.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?y(this.elements,t):t.remove()},t}()),cu=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,s=t.textOverflow,o=void 0===s?kt.clip:s,a=t.textBaseline,u=void 0===a?zt.top:a,h=t.textAlign,c=void 0===h?Ut.left:h,l=t.text,f=void 0===l?" ":l,p=t.letterSpace,d=void 0===p?0:p,m=t.autoWidth,v=void 0!==m&&m,y=t.fontSize,g=t.lineHeight,x=void 0===g?y:g,b=y+d;this.autoWidth=v,this.maxTextWidth=f.length*b,this.width=n,this.height=r,this.letterSpace=d,this.overflow=o,this.textBaseline=u,this.textAlign=c,this.lineHeight=x}var e=t.prototype;return e.getOffsetY=function(t,e,r,i){var n=t.outlineWidth,s=t.fontScale,o=(r-i)/3,a=i+n*s,u=r*(e-1),h=0;switch(this.textBaseline){case zt.top:h=a+o;break;case zt.middle:h=(this.height*s-u+a)/2;break;case zt.bottom:h=this.height*s-u-o}return h},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case Ut.left:r=t.outlineWidth*t.fontScale;break;case Ut.middle:r=(this.width*t.fontScale-e)/2;break;case Ut.right:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),lu=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,r,i,n,s,o,a=t.textColor,u=void 0===a?[1,1,1,1]:a,h=t.fontSize,c=void 0===h?40:h,l=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=c,l)&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(r=l.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth);f&&(this.hasShadow=!0,this.shadowBlur=null!=(i=f.shadowBlur)?i:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=f.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(o=f.shadowOffsetY)?o:0);this.fontStyle!==Gt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},fu=["serif","sans-serif","monospace","courier"],pu=0;exports.TextComponent=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.maxLineWidth=0,i.SCALE_FACTOR=.1,i.ALPHA_FIX_VALUE=1/255,i.name="MText"+pu++,r&&i.fromData(r),i.canvas=hu.getCanvas(),hu.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return uu(i);var n=r.options;return i.updateWithOptions(n),i.updateTexture(),i}Ct(e,t);var r=e.prototype;return r.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.interaction,i=e.options;this.interaction=r,this.updateWithOptions(i),this.renderText(i),this.material.setColor("_Color",new Re(1,1,1,1))},r.updateWithOptions=function(t){},r.updateTexture=function(t){},e}(Bn),exports.TextComponent=u([ce(Qt.TextComponent)],exports.TextComponent);var du=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new lu(t),this.textLayout=new cu(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var r=this.context,i=this.textLayout,n=i.letterSpace,s=i.overflow,o=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,a=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,c=0;c<t.length;c++){var l,f,p=t[c],d=(null!=(f=null==r||null==(l=r.measureText(p))?void 0:l.width)?f:0)*o;h+=n,s===kt.display?"\n"===p?(u++,h=0):(h+=d,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+d>a&&c>0||"\n"===p)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==p&&(h+=d))}return u},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){this.textStyle.fontFamily!==t||z(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,s=(i.width+r.fontOffset)*n,o=i.lineHeight*this.lineCount,a=r.fontSize*n,u=i.lineHeight*n;r.fontDesc=this.getFontDesc(a),this.char=(this.text||"").split(""),this.canvas.width=s,i.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/i.height)):this.canvas.height=i.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>s&&i.overflow===kt.display?e.font=this.getFontDesc(a*s/this.maxLineWidth):e.font=r.fontDesc,e.clearRect(0,0,s,h),r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+r.textColor[0]+", "+r.textColor[1]+", "+r.textColor[2]+", "+r.textColor[3]+")";for(var c=[],l=0,f=i.getOffsetY(r,this.lineCount,u,a),p=[],d=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=i.letterSpace*n)+y.width>s&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:p,charOffsetX:d}),l=0,f+=u,p=[],d=[]),"\n"!==v&&(p.push(v),d.push(l),l+=y.width)}c.push({y:f,width:l,chars:p,charOffsetX:d}),c.forEach((function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach((function(i,s){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[s],t.y),e.fillText(i,n+t.charOffsetX[s],t.y)}))})),r.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=mr.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:ke.LINEAR,minFilter:ke.LINEAR,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,r=e.fontSize,i=e.fontScale,n=e.fontFamily,s=e.textWeight,o=e.fontStyle,a=(t||r*i).toString()+"px ";return fu.includes(n)?a+=n:a+='"'+n+'"',s!==Bt.normal&&(a=s+" "+a),o!==Gt.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.outlineWidth,n=r[0],s=r[1],o=r[2],a=r[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*o+", "+a+")",t.lineWidth=2*i)},e.setupShadow=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,o=r[0],a=r[1],u=r[2],h=r[3];t&&(t.shadowColor="rgba("+255*o+", "+255*a+", "+255*u+", "+h+")",t.shadowBlur=i,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();et(exports.TextComponent,[du]);var mu=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),vu=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(pe);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(pe),u([le()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=u([ce(Qt.BinaryAsset)],exports.BinaryAsset);var yu=function(){function t(){}return t.serialize=function(e,r){e.toData(),r||(r={});var i=fe(e);if(i)for(var n,o=s(Object.keys(i));!(n=o()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?r[a]=u:Y(u)?(r[a]||(r[a]=[]),t.serializeArrayProperty(u,r[a],0)):pe.is(u)?r[a]={id:u.getInstanceId()}:q(u)&&(r[a]||(r[a]={}),t.serializeObjectProperty(u,r[a],0))}for(var h,c=s(Object.keys(e.defination));!(h=c()).done;){var l=h.value,f=e.defination[l];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?r[l]=f:Y(f)?(r[l]||(r[l]=[]),t.serializeArrayProperty(f,r[l],0)):pe.is(f)?r[l]={id:f.getInstanceId()}:q(f)&&(r[l]||(r[l]={}),t.serializeObjectProperty(f,r[l],0))}return r},t.deserialize=function(e,r){r.defination=e;var i=fe(r),n=r.engine;if(i)for(var o,a=s(Object.keys(i));!(o=a()).done;){var u=o.value,h=e[u];if(void 0!==h){var c=i[u].type;r[u]=t.deserializeProperty(h,n,0,c)}}r.fromData(r.defination)},t.checkTypedArray=function(t){return o(t,Int8Array)||o(t,Uint8Array)||o(t,Uint8ClampedArray)||o(t,Int16Array)||o(t,Uint16Array)||o(t,Int32Array)||o(t,Uint32Array)||o(t,Float32Array)||o(t,Float64Array)||o(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(q(t)&&1===Object.keys(t).length&&"id"in t&&W(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return q(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return K(t)||o(t,e.HTMLImageElement)},t.deserializeProperty=function(e,r,i,n,o){if(void 0===o&&(o=!0),!(i>14)){if(Y(e)){for(var a,u=[],h=s(e);!(a=h()).done;){var c=a.value;u.push(t.deserializeProperty(c,r,i+1,n,o))}return u}if(t.checkDataPath(e)){var l=r.findObject(e);return o?l:e}if(q(e)&&e.constructor===Object){var f;f=n?new n:{};for(var p,d=s(Object.keys(e));!(p=d()).done;){var m=p.value;f[m]=t.deserializeProperty(e[m],r,i+1,void 0,o)}return f}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r={});for(var n,o=s(Object.keys(e));!(n=o()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?r[a]=u:Y(u)?(r[a]||(r[a]=[]),t.serializeArrayProperty(u,r[a],i+1)):pe.is(u)?r[a]={id:u.getInstanceId()}:q(u)&&(r[a]||(r[a]={}),t.serializeObjectProperty(u,r[a],i+1))}}},t.serializeArrayProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?r[n]=s:Y(s)?(r[n]||(r[n]=[]),t.serializeArrayProperty(s,r[n],i+1)):pe.is(s)?r[n]={id:s.getInstanceId()}:q(s)&&(r[n]||(r[n]={}),t.serializeObjectProperty(s,r[n],i+1))}}},t}(),gu=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(!e)return null;var r,i=e.id,n=this.findData(i);if(n){switch(n.dataType){case Qt.Material:r=Pr.create(this.engine);break;case Qt.Geometry:r=Wr.create(this.engine);break;case Qt.Texture:r=mr.create(this.engine);break;default:var s=t.getClass(n.dataType);s&&(r=new s(this.engine))}if(r)return r.setInstanceId(n.id),this.engine.addInstance(r),yu.deserialize(n,r),r;console.error("Constructor for DataType: "+n.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return he[t]},t}(),xu=function(){function t(){}return t.prototype.loadGUID=function(t){return i((function(){return h(this,(function(t){return[2,void 0]}))}))()},t}();function bu(t,e){if(!t.includes(e))return t.push(e),!0}function Tu(t){if(Number.isFinite(t))return[wt.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===wt.CONSTANT)return[wt.CONSTANT,t[1]];if("lines"===e)return[wt.LINE,t[1]];if(e===wt.LINE){var i=r.map((function(t){return[Rt.LINE,t]}));return[wt.BEZIER_CURVE,i]}return"curve"===e||e===wt.CURVE?[wt.BEZIER_CURVE,Gu(r)]:t}}function Eu(t,e){return Array.isArray(t)&&"random"===t[0]?[wt.CONSTANT,t[1][e]]:Tu(t)}function _u(t){return t&&"color"===t[0]?wu(t[1],!0):[1,1,1,1]}function Au(t,e){if(t)return"colors"===t[0]?[wt.COLORS,t[1].map((function(t){return wu(t,e)}))]:"gradient"===t[0]?Su(t[1],e):"color"===t[0]?[wt.RGBA_COLOR,wu(t[1],e)]:t}function Cu(t){return t&&"random"===t[0]?[wt.RANDOM,t[1]]:Tu(t)}function Su(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),s=wu(t[i],e);r.push([n,s[0],s[1],s[2],s[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[wt.GRADIENT_COLOR,r]}}function wu(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else o(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=Ru(r)),r}function Ru(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Mu(t,e){return Array.isArray(t)?t[0]===wt.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Su(t[1],e):Su(t,e)}function Ou(t){if(t){if(3===t.length)return[wt.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===wt.BEZIER_PATH||e===wt.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],s=r[2],o=Gu(i);if(!s){s=[];for(var a=0;a<n.length;a++){var u=n[a].slice();0===a?s.push(u):a<n.length-1?(s.push(u),s.push(u)):s.push(u)}}return[wt.BEZIER_CURVE_PATH,[o,n,s]]}return t}}function Pu(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;t[i]=Number(t[i])}return t}function Iu(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;void 0===t[i]&&delete t[i]}return t}var Lu,Fu=Math.cos,Vu=Math.sin,Du=Math.PI/180,Nu=180/Math.PI;function ku(t,e){return t?[t[0]-.5,.5-t[1]]:e?Uu[e]:[0,0]}var zu,Uu=((Lu={})[bt.PARTICLE_ORIGIN_CENTER]=[0,0],Lu[bt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Lu[bt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Lu[bt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Lu[bt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Lu[bt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Lu[bt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Lu[bt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Lu[bt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Lu);function Bu(t,e,r,i){var n=r[0],s=r[1],o=i[0],a=o-n;return[[n+(o-n)/3,s+(t*=a)/3],[o-(o-n)/3,i[1]-(e*=a)/3]]}function Gu(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var o=t[s][3]*(e-r),a=t[s+1][2]*(e-r),u=[t[s][0],t[s][1]],h=[t[s+1][0],t[s+1][1]];if(u[0]!=h[0]){var c=Bu(o,a,u,h),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[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?[Rt.EASE_OUT,t]:e===n.length-1?[Rt.EASE_IN,t]:[Rt.EASE,t]}))}function ju(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===gt.null&&t.endBehavior===Mt.destroy&&(t.endBehavior=Mt.freeze)}))})),t.version=ht["2_1"],t}var Xu=new Map,Hu=new Map;function Wu(t){for(var e,r=s(t.components);!(e=r()).done;){var i=e.value;if(i.dataType===Qt.ShapeComponent){var n=i;if(n.type===Wt.Custom){var o,a=n;(null==(o=a.shapes)?void 0:o.length)>0&&a.shapes[0].fill&&(a.fill=a.shapes[0].fill);for(var u,h=new Array(a.easingIns.length),c=new Array(a.easingOuts.length).fill(!1),l=s(a.shapes);!(u=l()).done;)for(var f,p=s(u.value.indexes);!(f=p()).done;){var d=f.value,m=a.points[d.point],v=a.easingIns[d.easingIn],y=a.easingOuts[d.easingOut];h[d.easingIn]||(v.x-=m.x,v.y-=m.y,h[d.easingIn]=!0),c[d.easingOut]||(y.x-=m.x,y.y-=m.y,c[d.easingOut]=!0)}}}}return t}function Yu(t){Xu.clear(),Hu.clear();for(var e,r=t.compositions,i=t.items,n=s(t.components);!(e=n()).done;){var o=e.value;Xu.set(o.id,o)}for(var a,u=s(i);!(a=u()).done;){var h=a.value;Hu.set(h.id,h)}for(var c,l=s(r);!(c=l()).done;){qu(c.value)}return t}function Zu(t){var e;null==(e=t.plugins)||e.forEach((function(e,r){"richtext"===e&&(t.plugins[r]="rich-text")}));for(var r,i=s(t.items);!(r=i()).done;){var n=r.value;if(n.type===gt.sprite){var o=Xu.get(n.components[0].id);if(o){var a=o.renderer.shape,u=void 0;u=Number.isInteger(a)?t.shapes[a]:a,o.renderer.shape=u}}}for(var h,c=t.compositionId,l={},f=s(t.compositions);!(h=f()).done;){var p=h.value,d=$();l[p.id]=d,p.id===c&&(t.compositionId=d),p.id=d;var m={id:$(),dataType:"CompositionComponent",items:p.items,timelineAsset:p.timelineAsset,sceneBindings:p.sceneBindings,startTime:p.startTime};p.timelineAsset=void 0,p.sceneBindings=void 0,p.startTime=void 0,p.components=[{id:m.id}],t.components.push(m)}for(var v,y=s(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=l[x.refId])}}return t}function qu(t){for(var e,r=s(t.items);!(e=r()).done;){var i=e.value,n=Hu.get(i.id);if(!n)return;if(n.type===gt.sprite||n.type===gt.particle||n.type===gt.spine||n.type===gt.text||n.type===gt.richtext||n.type===gt.video||n.type===gt.shape){var o=Xu.get(n.components[0].id);o&&Ku(o)}}}function Ku(t){var e=t.renderer,r=null==e?void 0:e.maskMode;r&&r!==exports.MaskMode.NONE&&(r===exports.MaskMode.MASK?(t.mask={isMask:!0},zu=t.id):r!==pt.OBSCURED&&r!==pt.REVERSE_OBSCURED||(t.mask={inverted:r===pt.REVERSE_OBSCURED,reference:{id:zu}}))}function Qu(t){for(var e,r,i,n=function(){var t=h.value;t.endBehavior!==Xt&&t.endBehavior!==jt||(t.endBehavior=Mt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===gt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,r=s(t.items);!(e=r()).done;){var i=e.value;c[i.id]=$(),i.oldId=i.id,i.id=c[i.id],l[i.id]=i}t.items.forEach((function(e,r){if(e.parentId)if(e.parentId.includes("^")){var i=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=c[i]+"^"+n}else e.parentId=c[e.parentId];o.items.push(e),t.items[r]={id:e.id}}));var n=Ye({},t,{timelineAsset:{id:""},sceneBindings:[]});o.compositions.push(n),function(t,e,r){for(var i,n=[],o=[],a=[],u={tracks:[],id:$(),dataType:"TimelineAsset"},h=s(t.items);!(i=h()).done;){var c=e[i.value.id],l=[],f={id:$(),dataType:"ActivationPlayableAsset"};a.push(f);var p={id:$(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:f.id}}]};if(l.push({id:p.id}),o.push(p),c.type!==gt.particle){var d={id:$(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(d);var m={id:$(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};l.push({id:m.id}),o.push(m)}if(c.type===gt.sprite||c.type===gt.text){var v={id:$(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};a.push(v);var y={id:$(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:v.id}}]};l.push({id:y.id}),o.push(y)}if(c.type===gt.composition){var g={id:$(),dataType:"SubCompositionPlayableAsset"};a.push(g);var x={id:$(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:g.id}}]};l.push({id:x.id}),o.push(x)}var b={id:$(),dataType:"ObjectBindingTrack",children:l,clips:[]};o.push(b),u.tracks.push({id:b.id}),n.push({key:{id:b.id},value:{id:c.id}})}for(var T,E=[],_=s(o);!(T=_()).done;){var A=T.value;E.push({id:A.id})}t.timelineAsset={id:u.id},t.sceneBindings=n,r.miscs.push(u);for(var C,S=s(o);!(C=S()).done;){var w=C.value;r.miscs.push(w)}for(var R,M=s(a);!(R=M()).done;){var O=R.value;r.miscs.push(O)}}(n,l,o)},o=Ye({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),a=s(o.images);!(r=a()).done;){r.value.id=$()}if(null!=(e=o).textures||(e.textures=[]),o.textures.forEach((function(t){var e;t.id=$(),t.dataType=Qt.Texture,t.source={id:null==(e=o.images[t.source])?void 0:e.id}})),o.textures.length<o.images.length)for(var u=o.textures.length;u<o.images.length;u++)o.textures.push({id:$(),dataType:Qt.Texture,source:{id:o.images[u].id},flipY:!0});t.bins&&(i=t.bins,o.bins=i.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:$()}})));for(var h,c={},l={},f=s(t.compositions);!(h=f()).done;)n();for(var p,d=s(o.items);!(p=d()).done;){var m=p.value;if(m.content){if(m.content.renderer&&void 0!==m.content.renderer.texture){var v=m.content.renderer.texture;m.content.renderer.texture={id:o.textures[v].id}}if(m.content.trails&&void 0!==m.content.trails.texture){var y=m.content.trails.texture;m.content.trails.texture={id:o.textures[y].id}}}if(m.transform){var g,x,b,T=[].concat(null!=(g=m.transform.position)?g:[0,0,0]),E=[].concat(null!=(x=m.transform.rotation)?x:[0,0,0]),_=[].concat(null!=(b=m.transform.scale)?b:[1,1,1]);if(Object.assign(m,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:_[0],y:_[1],z:_[0]}}}),m.type===gt.sprite&&(m.transform.size={x:_[0],y:_[1]},m.transform.scale={x:1,y:1,z:1}),m.type===gt.sprite){var A=m.content;A.renderer||(A.renderer={});var C,S,w,R,M=A.renderer,O=ku(M.anchor,M.particleOrigin),P=m.transform.size;if(!M.anchor&&void 0!==M.particleOrigin)m.transform.position.x+=-O[0]*(null!=(C=null==P?void 0:P.x)?C:1),m.transform.position.y+=-O[1]*(null!=(S=null==P?void 0:P.y)?S:1);m.transform.anchor={x:O[0]*(null!=(w=null==P?void 0:P.x)?w:1),y:O[1]*(null!=(R=null==P?void 0:P.y)?R:1)}}}if(m.type===gt.particle){var I=m.content;I.renderer||(I.renderer={});var L=I.renderer;I.renderer.anchor=ku(L.anchor,L.particleOrigin)}if(m.type===gt.camera&&m.content.positionOverLifetime&&0!==Object.keys(m.content.positionOverLifetime).length&&(m.content.positionOverLifetime.asMovement=!0),void 0!==m.pn){var F=m.pn,V=t.plugins,D=void 0===V?[]:V;void 0!==F&&Number.isInteger(F)&&(m.pluginName=D[F])}switch("editor-gizmo"===m.pluginName&&(m.type="editor-gizmo"),"orientation-transformer"===m.pluginName&&(m.type="orientation-transformer"),m.content.options.target&&"editor-gizmo"===m.pluginName&&(m.content.options.target=c[m.content.options.target]),m.type===gt.spine&&t.spines&&0!==t.spines.length&&$u(t.spines[m.content.options.spine],m.content,o),m.type!==gt.sprite&&m.type!==gt.particle&&m.type!==gt.mesh&&m.type!==gt.skybox&&m.type!==gt.light&&"camera"!==m.type&&m.type!==gt.tree&&m.type!==gt.interact&&m.type!==gt.camera&&m.type!==gt.text&&m.type!==gt.spine&&"editor-gizmo"!==m.type&&"orientation-transformer"!==m.type||(m.components=[],o.components.push(m.content),m.content.id=$(),m.content.item={id:m.id},m.dataType=Qt.VFXItemData,m.components.push({id:m.content.id})),m.type!==gt.null&&m.type!==gt.composition||(m.components=[],m.dataType=Qt.VFXItemData),m.type){case gt.sprite:m.content.dataType=Qt.SpriteComponent;break;case gt.particle:m.content.dataType=Qt.ParticleSystem;break;case gt.mesh:m.content.dataType=Qt.MeshComponent;break;case gt.skybox:m.content.dataType=Qt.SkyboxComponent;break;case gt.light:m.content.dataType=Qt.LightComponent;break;case"camera":m.content.dataType=Qt.CameraComponent;break;case"editor-gizmo":m.content.dataType="GizmoComponent";break;case"orientation-transformer":m.content.dataType="OrientationComponent";break;case gt.tree:m.content.dataType=Qt.TreeComponent;break;case gt.interact:m.content.dataType=Qt.InteractComponent;break;case gt.camera:m.content.dataType=Qt.CameraController;break;case gt.text:m.content.dataType=Qt.TextComponent;break;case gt.spine:m.content.dataType=Qt.SpineComponent}}return o.version=ht["3_0"],o}function Ju(t){if(t)for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value,n=t[i],o=Array.isArray(n);o&&2===n.length&&Array.isArray(n[1])?t[i]="path"===i?Ou(n):Tu(n):o||"object"!=typeof n||Ju(n)}}function $u(t,e,r){e.resource={atlas:{bins:{id:r.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:r.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map((function(t){return{id:r.textures[t].id}}))}}function th(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},s={path:Ou(null==(r=t.transform)?void 0:r.path),gravity:i.gravity,gravityOverLifetime:Tu(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:Tu(n.linearX),linearY:Tu(n.linearY),linearZ:Tu(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Tu(n.orbitalX),orbitalY:Tu(n.orbitalY),orbitalZ:Tu(n.orbitalZ),speedOverLifetime:Tu(n.speedOverLifetime)};Iu(s);var o={options:{startColor:_u(i.startColor)},positionOverLifetime:s};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var a=t.rotationOverLifetime;if(a){var u=o.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};u.separateAxes?(u.x=Tu(a.x),u.y=Tu(a.y),u.z=Tu(a.z)):u.z=Tu(a.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=o.colorOverLifetime={opacity:Tu(h.opacity)};h.color&&(c.color=Mu(h.color))}var l=t.sizeOverLifetime;return l&&(o.sizeOverLifetime={separateAxes:l.separateAxes,size:Tu(l.size),x:Tu(l.x),y:Tu(l.y),z:Tu(l.z)}),o}var eh="2.5.0-alpha.5",rh=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,ih=/^(\d+)\.(\d+)$/,nh=!1;function sh(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,r;(function(t){var e=t.playerVersion||{},r=e.web,i=void 0===r?"":r;if(i){var n,s,o=null!=(n=rh.exec(i))?n:[],a=null!=(s=rh.exec(eh))?s:[],u=o[1],h=o[2],c=a[1],l=a[2];return Number(c)<Number(u)||Number(c)===Number(u)&&Number(l)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+eh+"). Some features may not work as expected.");if(function(t){var e,r=null==(e=t.version)?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==gt.mesh&&t.type!==gt.light||(t.endBehavior=1===t.endBehavior?Mt.destroy:t.endBehavior)}))}))}(t),rh.test(t.version))return nh="0"===(null==(r=/^(\d+)/.exec(t.version))?void 0:r[0]),Zu(Yu(Wu(Qu(ju(function(t){var e;oh=ht["1_0"];var r=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(oh=ht["1_3"]);var i,n=(t.requires||[]).slice(),s=t.images.map((function(e,r){return ah(e,r,t.imageTags||[])})),o=t.textures||s.map((function(t,e){return{source:e,flipY:!0}})),a={plugins:r,shapes:t.shapes||[],type:"ge",version:oh,playerVersion:null!=(i=t.playerVersion)?i:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return uh(t,{plugins:r,requires:n})})),images:s,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:o,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t))))));nh=!1;var i=ih.exec(t.version)||[],n=Number(i[1]),o=Number(i[2]);if(n)return(n<2||2===n&&o<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,r=s(t.items);!(e=r()).done;)Ju(e.value.content)})),t}(t)),n<3&&(t=Qu(ju(t))),i=ih.exec(t.version)||[],n=Number(i[1]),o=Number(i[2]),n<4&&(o<2&&(t=Wu(t)),o<3&&(t=Yu(t)),o<4&&(t=Zu(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var oh=ht["1_0"];function ah(t,e,r){var i=r[e];if("string"==typeof t)return{id:$(),renderLevel:i,url:t};if(t.template)return{id:$(),url:t.url,template:t.template,webp:t.webp,renderLevel:i};if(t.compressed)return{id:$(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{id:$(),url:t.url,webp:t.webp,renderLevel:i};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function uh(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Ye({clipMode:Ht},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return fh(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var s=null==(r=t.meta)?void 0:r.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(i.previewSize=s),i}var hh,ch=[0,0,0,1],lh=.5;function fh(t,e){var r;void 0===e&&(e={});var i,n,s,o,a,u,h=gt.base,c=t.endBehavior,l=NaN;if(t.content?(h=t.type||gt.plugin,u=t.pn,a=t.pluginName,s=t.content,n=t.content,isNaN(u)&&!a&&(a=s.options.type),t.duration&&(l=t.duration),i=t.transform||y(n.transform)):t.particle?(h=gt.particle,i=y((n=t.particle).transform,nh,!0),s=function(t){var e=t.options,r=t.transform,i={type:dt.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(i=Ye({},t.shape,{type:dt[s]}),t.shape.upDirection){var o=t.shape.upDirection,a=o[0],u=o[1],h=o[2];0===a&&0===u&&0===h&&delete i.upDirection}}e.startTurbulence&&(i.turbulenceX=Cu(e.turbulenceX),i.turbulenceY=Cu(e.turbulenceY),i.turbulenceZ=Cu(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Pu(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Pu(t)}))),c.rateOverTime&&(c.rateOverTime=Cu(c.rateOverTime));var l={renderer:t.renderer,shape:i,splits:t.splits,emission:c,options:{startLifetime:Cu(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Cu(e.startSize),startSizeX:Cu(e.startSizeX),startSizeY:Cu(e.startSizeY),sizeAspect:Cu(e.sizeAspect),maxCount:e.maxCount,startDelay:Cu(e.startDelay),startColor:Au(e.startColor,!0),startRotationZ:Cu(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=Cu(e.startRotationX),l.options.startRotationY=Cu(e.startRotationY)),r&&r.path&&(l.emitterTransform={path:Ou(r.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:Cu(f.x),y:Cu(f.y)}:l.sizeOverLifetime={size:Cu(f.size)});var p=t.velocityOverLifetime||{},d=p.speedOverLifetime;d=d?Tu(d):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Tu(e.gravityModifier),startSpeed:Cu(e.startSpeed),speedOverLifetime:d,asMovement:p.asMovement,linearX:Cu(p.linearX),linearY:Cu(p.linearY),linearZ:Cu(p.linearZ),asRotation:p.asRotation,orbCenter:p.orbCenter,orbitalX:Cu(p.orbitalX),orbitalY:Cu(p.orbitalY),orbitalZ:Cu(p.orbitalZ),forceTarget:p.forceTarget,target:p.target,forceCurve:Tu(p.forceCurve)},Iu(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Cu(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=Tu(m.y),l.rotationOverLifetime.x=Tu(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:Tu(v.opacity)};v.color&&(y.color=Mu(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Tu(g.cycles),animationDelay:Eu(g.animationDelay,0),animationDuration:Eu(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:Cu(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Tu(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Mu(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Mu(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:Cu(x.opacityOverLifetime)}),l.trails&&Iu(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(n)):t.sprite?(h=gt.sprite,s=function(t,e){var r=th(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}(n=t.sprite,i=y(n.transform,!1,!0))):t.cal?(h=gt.null,s=th(n=t.cal,i=y(n.transform,!1,!0))):t.ui?(h=gt.interact,i=y((n=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:vt.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&_u(r.previewColor),behavior:r.behavior||yt.NOTIFY};break;case"drag":e={type:vt.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:vt.MESSAGE}}return{options:e}}(n),i.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=gt.camera,i=y(n.transform),s=function(t){var e,r=t.options,i={options:{fov:r.fov,far:r.far,near:r.near,clipMode:r.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var s,o={path:Ou(null==(s=t.transform)?void 0:s.path),linearX:Tu(null==n?void 0:n.translateX),linearY:Tu(null==n?void 0:n.translateY),linearZ:Tu(null==n?void 0:n.translateZ)};Iu(o),i.positionOverLifetime=o}var a=t.rotationOverLifetime;if(a){var u={separateAxes:a.separateAxes,x:Tu(null==a?void 0:a.rotateX),y:Tu(null==a?void 0:a.rotateY),z:a.separateAxes?Tu(null==a?void 0:a.rotateZ):Tu(a.rotation)};Iu(u),i.rotationOverLifetime=u}return i}(n))),null==(r=s.renderer)?void 0:r.anchor){var f=new Float32Array(s.renderer.anchor);f[0]==lh&&f[1]==lh?delete s.renderer.anchor:e.requires&&bu(e.requires,"anchor")}if(n){var p,d,m=null==(p=n.options)?void 0:p.looping;if(m)c=Array.isArray(m)?m[1]?Mt.restart:Mt.destroy:Mt.restart;else c=c||(null==n||null==(d=n.options)?void 0:d.endBehavior)||Mt.destroy;n.options.renderLevel&&(o=n.options.renderLevel),isNaN(l)&&(l=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:l,id:t.id+"",transform:i,endBehavior:c,renderLevel:o,content:s};return a?e.plugins?(bu(e.plugins,a),v.pn=e.plugins.indexOf(a)):v.pluginName=a:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var s=(o=ch,a=i.rotation[0],u=i.rotation[1],h=i.rotation[2],c=Fu(a*Du/2),l=Fu(u*Du/2),f=Fu(h*Du/2),p=Vu(a*Du/2),d=Vu(u*Du/2),m=Vu(h*Du/2),o[0]=p*l*f+c*d*m,o[1]=c*d*f-p*l*m,o[2]=c*l*m+p*d*f,o[3]=c*l*f-p*d*m,o);i.rotation=function(t,e){var r,i,n,s=e[0],o=e[1],a=e[2],u=e[3],h=s+s,c=o+o,l=a+a,f=s*h,p=o*h,d=o*c,m=a*l,v=u*l,y=1-d-m,g=p-v,x=p+v,b=1-f-m,T=a*h-u*c,E=a*c+u*h,_=1-f-d;return t[1]=Math.asin((i=-1,(r=-T)>(n=1)?n:r<i?i:r))*Nu,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Nu,t[2]=Math.atan2(x,y)*Nu):(t[0]=0,t[2]=Math.atan2(-g,b)*Nu),t}([],s)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var o,a,u,h,c,l,f,p,d,m;return{}}}var ph,dh=((hh={})[ct.S]=[ct.S,ct.BPlus,ct.APlus],hh[ct.A]=[ct.A,ct.BPlus,ct.APlus],hh[ct.B]=[ct.B,ct.BPlus],hh);function mh(t,e){if(!t||!e)return!0;var r=dh[e];return!!r&&r.includes(t)}function vh(t,e){var r,i,n=null!=(i=null==t?void 0:t.background)?i:{},s=n.name,o=n.url;return s&&(e&&e[s]?r=e[s]:o&&(r=o)),r}function yh(t,e,r){return gh.apply(this,arguments)}function gh(){return(gh=i((function(t,r,i){var n,s;return h(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,er(t)];case 1:return n=a.sent(),[3,3];case 2:n=t,a.label=3;case 3:if(!n)throw new Error("Image not provided.");if(!r)return[2,n];if(s=vh(r,i)){if(W(s)&&s!==n.src)return[2,er(s)];if(o(s,e.HTMLImageElement))return[2,s]}return[2,n]}}))}))).apply(this,arguments)}exports.Scene=void 0,(ph=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return q(t)&&"jsonScene"in t},ph.isURL=function(t){return q(t)&&"url"in t},ph.isWithOptions=function(t){return q(t)&&"options"in t};var xh=1,bh=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ze),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=xh++,this.timers=[],this.updateOptions(t)}var r=t.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},r.loadScene=function(t,r,n){var s=this;return i((function(){var o,a,u,c,l,f,p,d,m,v,y,g,x;return h(this,(function(b){return a=W(t)?t:s.id,u=e.performance.now(),c=[],l=null==r?void 0:r.engine.gpuCapability,p=null!=(f=null==l?void 0:l.detail.compressedTexture)?f:exports.COMPRESSED_TEXTURE.NONE,d={},v=!1,y=new Promise((function(t,r){m=e.window.setTimeout((function(){v=!0,s.removeTimer(m);var t=e.performance.now()-u;r(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+c.join(" ")+", url: "+a+"."))}),1e3*s.timeout),s.timers.push(m)})),g=i((function(t,r){var i,n,s,o;return h(this,(function(a){switch(a.label){case 0:if(v)return[3,4];i=e.performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r()];case 2:return n=a.sent(),s=e.performance.now()-i,c.push("["+t+": "+s.toFixed(2)+"]"),d[t]=s,[2,n];case 3:throw o=a.sent(),new Error("Load error in "+t+", "+o+".");case 4:throw new Error("Load canceled.")}}))})),x=i((function(){var r,i,l,f,v,y,x,b,T,E,_,A,C,S;return h(this,(function(h){switch(h.label){case 0:return W(t)?(i=new e.URL(t,e.location.href).href,s.baseUrl=i,[4,g("loadJSON",(function(){return s.loadJSON(i)}))]):[3,2];case 1:return o=h.sent(),[3,3];case 2:o=t,s.baseUrl=e.location.href,h.label=3;case 3:return exports.Scene.isJSONObject(o)?(r=Ye({},o),[3,9]):[3,4];case 4:return[4,g("processJSON",(function(){return s.processJSON(o)}))];case 5:return l=h.sent(),f=l.jsonScene,v=l.pluginSystem,y=f.bins,x=void 0===y?[]:y,b=f.images,T=f.fonts,[4,Promise.all([g("processBins",(function(){return s.processBins(x)})),g("processImages",(function(){return s.processImages(b,p)})),g("plugin:processAssets",(function(){return s.processPluginAssets(f,v,n)})),g("processFontURL",(function(){return s.processFontURL(T)}))])];case 6:return E=h.sent(),_=E[0],A=E[1],[4,g("processTextures",(function(){return s.processTextures(A,_,f)}))];case 7:return C=h.sent(),r={timeInfos:d,url:t,renderLevel:s.options.renderLevel,storage:{},pluginSystem:v,jsonScene:f,bins:_,textureOptions:C,textures:[],images:A,assets:s.assets},[4,g("plugin:prepareResource",(function(){return v.loadResources(r,s.options)}))];case 8:h.sent(),h.label=9;case 9:return S=e.performance.now()-u,X.info("Load asset: totalTime: "+S.toFixed(4)+"ms "+c.join(" ")+", url: "+a+"."),e.window.clearTimeout(m),s.removeTimer(m),r.totalTime=S,r.startTime=u,r.timeInfos=d,[2,r]}}))})),[2,Promise.race([y,x()])]}))}))()},r.getAssets=function(){return this.assets},r.processJSON=function(t){var e=this;return i((function(){var r,i,n;return h(this,(function(s){switch(s.label){case 0:return r=sh(t),i=r.plugins,[4,(n=new ot(void 0===i?[]:i)).processRawJSON(r,e.options)];case 1:return s.sent(),[2,{jsonScene:r,pluginSystem:n}]}}))}))()},r.processBins=function(t){var r=this;return i((function(){var i,n,s;return h(this,(function(a){return i=r.options.renderLevel,n=r.baseUrl,s=t.map((function(s){if(o(s,ArrayBuffer))return s;if(mh(s.renderLevel,i))return r.loadBins(new e.URL(s.url,n).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(s)]}))}))()},r.processFontURL=function(r){var n=this;return i((function(){var s;return h(this,(function(o){return r?(s=r.map(i((function(r){var i,s,o;return h(this,(function(a){switch(a.label){case 0:if(!r.fontURL||t.fontCache.has(r.fontFamily))return[3,4];z(r.fontFamily)||console.warn("Risky font family: "+r.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),i=new e.URL(r.fontURL,n.baseUrl).href,[4,(o=new FontFace(null!=(s=r.fontFamily)?s:"","url("+i+")")).load()];case 2:return a.sent(),e.document.fonts.add(o),t.fontCache.add(r.fontFamily),[3,4];case 3:return a.sent(),X.warn("Invalid font family or font source: "+JSON.stringify(r.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(s)]):[2]}))}))()},r.processImages=function(t,r){void 0===r&&(r=0);var n=this;return i((function(){var s,a,u,c,l,f,p,d;return h(this,(function(m){switch(m.label){case 0:return s=n.options,a=s.useCompressedTexture,u=s.variables,c=s.disableWebP,l=s.disableAVIF,f=n.baseUrl,p=t.map(i((function(t,i){var s,p,d,m,v,y,g,x,b,T,E,_,A,C,S,w,R,M,O,P,I;return h(this,(function(i){switch(i.label){case 0:if(s=t.url,p=t.webp,d=t.avif,m=new e.URL(s,f).href,v=!c&&p?new e.URL(p,f).href:void 0,y=!l&&d?new e.URL(d,f).href:void 0,g=t.id,!("template"in t))return[3,8];if(x=t.template,!(b=x.background))return[3,7];T=vh(x,u),E=b.type===qt.video,_=b&&E?or:er,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,ur(T,_)];case 2:return o(A=i.sent(),e.HTMLVideoElement)?(n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.video},[2,A]):[3,3];case 3:return b&&Array.isArray(T)&&u&&(u[b.name]=A.src),n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.image},[4,yh(A,x,u)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw C=i.sent(),new Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("compressed"in t&&a&&r){if(S=t.compressed,r===exports.COMPRESSED_TEXTURE.ASTC?w=S.astc:r===exports.COMPRESSED_TEXTURE.PVRTC&&(w=S.pvrtc),w)return R=new e.URL(w,f).href,n.sourceFrom[g]={url:R,type:exports.TextureSourceType.compressed},[2,n.loadBins(R)]}else if(o(t,e.HTMLImageElement)||o(t,e.HTMLCanvasElement)||o(t,e.HTMLVideoElement)||o(t,mr))return[2,t];i.label=9;case 9:return y?[4,$e(m,y)]:[3,11];case 10:return I=i.sent(),[3,13];case 11:return[4,Qe(m,v)];case 12:I=i.sent(),i.label=13;case 13:return O=(M=I).url,P=M.image,n.sourceFrom[g]={url:O,type:exports.TextureSourceType.image},[2,P]}}))}))),[4,Promise.all(p)];case 1:return d=m.sent(),n.assignImagesToAssets(t,d),[2,d]}}))}))()},r.processPluginAssets=function(t,e,r){var n=this;return i((function(){var i,s,o,a,u;return h(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,r)];case 1:for(i=h.sent(),s=i.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),o=s.assets,a=s.loadedAssets,u=0;u<o.length;u++)n.assets[o[u].id]=a[u];return[2]}}))}))()},r.processTextures=function(t,r,n){var s=this;return i((function(){var a,u,c;return h(this,(function(l){return u=null!=(a=n.textures)?a:t.map((function(t,e){return{source:e}})),c=u.map(i((function(t,i){var a,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:if(o(t,mr))return[2,t];if(!("mipmaps"in t))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,cr(t,r,s.assets,n.bins)];case 2:return[2,h.sent()];case 3:throw a=h.sent(),new Error("Load texture "+i+" fails, error message: "+a+".");case 4:return u=t.source,c=t.id,f="",q(u)?(l=s.assets[u.id],f=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,er(tt(u))];case 6:l=h.sent(),h.label=7;case 7:if(l)return p=function(t,r,i){var n={id:i,dataType:Qt.Texture};if(o(t,mr))return Ye({},t.source,n);if(o(t,e.HTMLImageElement)||K(t))return Ye({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:ke.LINEAR,magFilter:ke.LINEAR},n);if(o(t,e.HTMLVideoElement))return Ye({sourceType:exports.TextureSourceType.video,video:t,minFilter:ke.LINEAR,magFilter:ke.LINEAR},n);if(o(t,ArrayBuffer))return Ye({},Tr(t),{sourceFrom:r},n);if("width"in t&&"height"in t&&"data"in t)return Ye({sourceType:exports.TextureSourceType.data,data:t,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE,minFilter:ke.NEAREST,magFilter:ke.NEAREST},n);throw new Error("Invalid texture options.")}(l,s.sourceFrom[f],c),[2,p.sourceType===exports.TextureSourceType.compressed?p:Ye({},p,t)];throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(c)]}))}))()},r.loadJSON=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.loadBins=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.assignImagesToAssets=function(t,e){for(var r=0;r<t.length;r++)this.assets[t[r].id]=e[r]},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){this.timers.length&&this.timers.map((function(t){return e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t}();bh.fontCache=new Set;var Th,Eh=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(gr(t))}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var r=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(r=t.url),exports.Scene.isWithOptions(t)&&(e=Ye({},e,t.options))),{source:r,options:e}},e.updateTextVariables=function(t,e){var r=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===gt.text||t.type===gt.richtext){var i=e[t.name];if(!i)return;t.components.forEach((function(t){var e=t.id,n=r.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==Qt.TextComponent&&(null==n?void 0:n.dataType)!==Qt.RichTextComponent||(n.options.text=i)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},e.prepareAssets=function(t,e){this.engine.clearResources();for(var r,i=s(Object.keys(e));!(r=i()).done;){var n=r.value,o=e[n],a=new vu(this.engine);a.data=o,a.setInstanceId(n)}this.engine.addPackageDatas(t);for(var u,h=s(this.builtinObjects);!(u=h()).done;){var c=u.value;this.engine.addInstance(c)}},e.createShaderVariant=function(){for(var t,e=s(Object.keys(this.engine.objectInstance));!(t=e()).done;){var r=t.value,i=this.engine.objectInstance[r];o(i,Pr)&&i.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=s(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),_h=new Int32Array(2),Ah=new Float32Array(_h.buffer),Ch=new Float64Array(_h.buffer),Sh=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"}(Th||(Th={}));var wh=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var r=t.prototype;return r.clear=function(){this.position_=0},r.bytes=function(){return this.bytes_},r.position=function(){return this.position_},r.setPosition=function(t){this.position_=t},r.capacity=function(){return this.bytes_.length},r.readInt8=function(t){return this.readUint8(t)<<24>>24},r.readUint8=function(t){return this.bytes_[t]},r.readInt16=function(t){return this.readUint16(t)<<16>>16},r.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.readUint32=function(t){return this.readInt32(t)>>>0},r.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readFloat32=function(t){return _h[0]=this.readInt32(t),Ah[0]},r.readFloat64=function(t){return _h[Sh?0:1]=this.readInt32(t),_h[Sh?1:0]=this.readInt32(t+4),Ch[0]},r.writeInt8=function(t,e){this.bytes_[t]=e},r.writeUint8=function(t,e){this.bytes_[t]=e},r.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.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},r.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},r.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},r.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},r.writeFloat32=function(t,e){Ah[0]=e,this.writeInt32(t,_h[0])},r.writeFloat64=function(t,e){Ch[0]=e,this.writeInt32(t,_h[Sh?0:1]),this.writeInt32(t+4,_h[Sh?1:0])},r.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},r.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},r.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},r.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t);t+=4;var i=this.bytes_.subarray(t,t+r);return e===Th.UTF8_BYTES?i:this.text_decoder_.decode(i)},r.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},r.__indirect=function(t){return t+this.readInt32(t)},r.__vector=function(t){return t+this.readInt32(t)+4},r.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.__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},r.createScalarList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n)}return r},r.createObjList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n.unpack())}return r},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Rh=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=wh.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,r){e>this.minalign&&(this.minalign=e);for(var i=1+~(this.bb.capacity()-this.space+r)&e-1;this.space<i+e+r;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)},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,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,r){e!=r&&(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 r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=2*(r+2);this.addInt16(i);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(o)){for(var a=2;a<i;a+=2)if(this.bb.readInt16(s+a)!=this.bb.readInt16(o+a))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,r){var i=r?4:0;if(e){var n=e;if(this.prep(this.minalign,8+i),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var s=3;s>=0;s--)this.writeInt8(n.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&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 r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(e<this.bb.readInt16(i)&&0!=this.bb.readInt16(i+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(r,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=o(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=[],r=0;r<t.length;++r){var i=t[r];if(null===i)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(i))}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 r=e<<1,i=wh.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},t}(),Mh=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 Oh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,r,i){return t.startFBEffectsObjectData(e),t.addDataType(e,r),t.addData(e,i),t.endFBEffectsObjectData(e)},t}(),Oh=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,r=Mh.createDataVector(t,this.data);return Mh.createFBEffectsObjectData(t,e,r)},t}(),Ph=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 r=this.bb.__offset(this.bb_pos,4);return r?(e||new Mh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 Ih(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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,r){return t.startFBEffectsPackageData(e),t.addExportObjects(e,r),t.endFBEffectsPackageData(e)},t}(),Ih=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Ph.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Ph.createFBEffectsPackageData(t,e)},t}(),Lh=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 Fh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n){return t.startFBSubMesh(e),t.addOffset(e,r),t.addIndexCount(e,i),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Fh=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.offset=t,this.indexCount=e,this.vertexCount=r}return t.prototype.pack=function(t){return Lh.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Vh=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 Dh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n,s,o){return t.startFBVertexChannel(e),t.addSemantic(e,r),t.addOffset(e,i),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),Dh=function(){function t(t,e,r,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=r,this.dimension=i,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Vh.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Nh=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 r=this.bb.__offset(this.bb_pos,6);return r?(e||new Vh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 kh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,r,i){return t.startFBVertexData(e),t.addVertexCount(e,r),t.addChannels(e,i),t.endFBVertexData(e)},t}(),kh=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=Nh.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Nh.createFBVertexData(t,this.vertexCount,e)},t}(),zh=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 Nh).__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 r=this.bb.__offset(this.bb_pos,14);return r?(e||new Lh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+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 Uh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Uh=function(){function t(t,e,r,i,n,s,o,a,u,h,c,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===o&&(o=0),void 0===a&&(a=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===c&&(c=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=r,this.indexFormat=i,this.indexOffset=n,this.subMeshes=s,this.mode=o,this.buffer=a,this.binaryData=u,this.boneNames=h,this.rootBoneName=c,this.inverseBindMatrices=l}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,r=null!==this.name?t.createString(this.name):0,i=null!==this.vertexData?this.vertexData.pack(t):0,n=zh.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,o=zh.createBinaryDataVector(t,this.binaryData),a=zh.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=zh.createInverseBindMatricesVector(t,this.inverseBindMatrices);return zh.startFBGeometryData(t),zh.addId(t,e),zh.addName(t,r),zh.addVertexData(t,i),zh.addIndexFormat(t,this.indexFormat),zh.addIndexOffset(t,this.indexOffset),zh.addSubMeshes(t,n),zh.addMode(t,this.mode),zh.addBuffer(t,s),zh.addBinaryData(t,o),zh.addBoneNames(t,a),zh.addRootBoneName(t,u),zh.addInverseBindMatrices(t,h),zh.endFBGeometryData(t)},t}(),Bh=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 Rh(1),r=new Ih,i=[],n=s(this.exportObjectDatas);!(t=n()).done;){var o=t.value,a=void 0;o.dataType===Qt.Geometry&&(a=new Oh("Geometry",this.geometryDataToBinary(o))),a&&i.push(a)}return r.exportObjects=i,Ph.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new wh(t),r=Ph.getRootAsFBEffectsPackageData(e),i=0;i<r.exportObjectsLength();i++){var n=r.exportObjects(i);if(n){var s=n.dataArray(),o=n.dataType();if(s){var a=void 0;o===Qt.Geometry&&(a=this.binaryToGeometryData(s)),a&&this.exportObjectDatas.push(a)}}}},e.geometryDataToBinary=function(t){var e=new Rh(1),r=new Uh,i=t.indexFormat,n=t.indexOffset,o=t.mode,a=t.id,u=t.vertexData,h=t.boneNames,c=void 0===h?[]:h,l=t.rootBoneName,f=void 0===l?"":l,p=t.inverseBindMatrices,d=void 0===p?[]:p,m=t.binaryData,v=void 0===m?[]:m;r.indexFormat=i,r.indexOffset=n,r.mode=o,r.id=a,r.boneNames=c,r.rootBoneName=f,r.inverseBindMatrices=d,r.binaryData=v;var y=new kh;y.vertexCount=u.vertexCount,y.channels=[];for(var g,x=s(u.channels);!(g=x()).done;){var b=g.value,T=b.semantic,E=b.offset,_=b.format,A=b.dimension,C=b.normalize,S=new Dh(T,E,_,A,C);y.channels.push(S)}r.vertexData=y;for(var w,R=[],M=s(t.subMeshes);!(w=M()).done;){var O=w.value,P=O.offset,I=O.indexCount,L=O.vertexCount,F=new Fh(P,I,L);R.push(F)}return r.subMeshes=R,Ph.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new wh(t),r=zh.getRootAsFBGeometryData(e),i={vertexCount:0,channels:[]},n=r.vertexData();if(n){i.vertexCount=n.vertexCount();for(var s=0;s<n.channelsLength();s++){var o=n.channels(s);if(o){var a,u={semantic:null!=(a=o.semantic())?a:"",offset:o.offset(),format:o.format(),dimension:o.dimension(),normalize:o.normalize()};i.channels.push(u)}}}for(var h=[],c=0;c<r.subMeshesLength();c++){var l=r.subMeshes(c);if(l){var f={offset:l.offset(),vertexCount:l.vertexCount(),indexCount:l.indexCount()};h.push(f)}}for(var p=[],d=0;d<r.boneNamesLength();d++){var m=r.boneNames(d);p.push(m)}var v,y,g,x,b=r.inverseBindMatricesArray();return{vertexData:i,indexFormat:r.indexFormat(),indexOffset:r.indexOffset(),subMeshes:h,mode:r.mode(),buffer:null!=(v=r.buffer())?v:"",boneNames:p,rootBoneName:null!=(y=r.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=r.binaryDataArray())?g:void 0,id:null!=(x=r.id())?x:"",dataType:Qt.Geometry}},t}(),Gh=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new gu(this),this.emptyTexture=gr(this),this.transparentTexture=xr(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return q(t)&&t.constructor===Object?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,r=t.jsonScene,i=t.textureOptions,n=void 0===i?[]:i,o=r.items,a=void 0===o?[]:o,u=r.materials,h=void 0===u?[]:u,c=r.shaders,l=void 0===c?[]:c,f=r.geometries,p=void 0===f?[]:f,d=r.components,m=void 0===d?[]:d,v=r.animations,y=void 0===v?[]:v,g=r.bins,x=void 0===g?[]:g,b=r.miscs,T=void 0===b?[]:b,E=s(r.compositions);!(e=E()).done;){var _=e.value;this.addEffectsObjectData(_)}for(var A,C=s(a);!(A=C()).done;){var S=A.value;mh(S.renderLevel,t.renderLevel)||(S.components=[],S.type=gt.null),this.addEffectsObjectData(S)}for(var w,R=s(h);!(w=R()).done;){var M=w.value;this.addEffectsObjectData(M)}for(var O,P=s(l);!(O=P()).done;){var I=O.value;this.addEffectsObjectData(I)}for(var L,F=s(p);!(L=F()).done;){var V=L.value;this.addEffectsObjectData(V)}for(var D,N=s(m);!(D=N()).done;){var k=D.value;this.addEffectsObjectData(k)}for(var z,U=s(y);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G,j=s(T);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}for(var H=0;H<x.length;H++){var W=x[H],Y=t.bins[H];if(W.dataType===Qt.BinaryAsset)W.buffer=Y,W.id&&this.addEffectsObjectData(W);else{var Z=new Bh;Z.deserializeFromBinary(new Uint8Array(Y));for(var q,K=s(Z.exportObjectDatas);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}}}for(var J,$=s(n);!(J=$()).done;){var tt=J.value;this.addEffectsObjectData(tt)}},e.createVFXItems=function(t){var e=this;return i((function(){var r,i,n,o,a;return h(this,(function(u){for(r=t.jsonScene,i=s(r.items);!(n=i()).done;)o=n.value,"ECS"!==(a=o.type)&&"camera"!==a&&a!==gt.sprite&&a!==gt.particle&&a!==gt.mesh&&a!==gt.skybox&&a!==gt.light&&a!==gt.tree&&a!==gt.interact&&a!==gt.camera||e.database&&e.assetLoader.loadGUID(o);return[2]}))}))()},e.addTexture=function(t){this.destroyed||y(this.textures,t)},e.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.addMaterial=function(t){this.destroyed||y(this.materials,t)},e.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.addGeometry=function(t){this.destroyed||y(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.addMesh=function(t){this.destroyed||y(this.meshes,t)},e.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||y(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||g(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&X.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach((function(t){return t.dispose()})),this.meshes.forEach((function(t){return t.dispose()})),this.geometries.forEach((function(t){return t.dispose()})),this.materials.forEach((function(t){return t.dispose()})),this.textures.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},oe(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),jh=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var r=t.prototype;return r.getFPS=function(){return this.targetFPS},r.setFPS=function(t){this.targetFPS=_e(t,1,120),this.interval=Math.floor(1e3/t)-2},r.getPaused=function(){return this.paused},r.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var r=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},i=function(){t.intervalId=r(i),t.paused||t.tick()};i()}},r.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},r.pause=function(){this.paused=!0,this.dt=0},r.resume=function(){this.paused=!1,this.dt=0},r.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 r=0,i=this.tickers.length;r<i;r++){var n=this.tickers[r];n(this.dt)}}}},r.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},oe(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();st("camera",jn,exports.VFXItem),st("text",mu,exports.VFXItem),st("sprite",oo,exports.VFXItem),st("particle",Ma,exports.VFXItem),st("cal",Oa,exports.VFXItem),st("interact",Jn,exports.VFXItem);var Xh;X.info("Core version: 2.5.0-alpha.5.");var Hh,Wh=((Xh={})[ke.RGBA]=34842,Xh[ke.RGB]=34843,Xh[ke.ALPHA]=33325,Xh[ke.RED]=33325,Xh[ke.LUMINANCE_ALPHA]=33327,Xh[ke.LUMINANCE]=33325,Xh),Yh=((Hh={})[ke.RGBA]=34836,Hh[ke.RGB]=34837,Hh[ke.ALPHA]=33326,Hh[ke.RED]=33326,Hh[ke.LUMINANCE_ALPHA]=33328,Hh[ke.LUMINANCE]=33326,Hh),Zh=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},r.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,r=this.source,i=r.target,n=void 0===i?e.TEXTURE_2D:i,s=r.name;this.textureBuffer=e.createTexture(),$h(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},r.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},r.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}},r.update=function(t){var e=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var r,i,n=this.target,s=this.source,o=this.pipelineContext.gl,a=this.engine.gpuCapability.detail,u=s.sourceType,h=s.data,c=s.cube,l=s.image,f=s.video,p=s.mipmaps,d=s.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=s.format,b=s.type,T=s.internalFormat,E=0,_=0;if(this.bind(u===exports.TextureSourceType.video),b===ke.HALF_FLOAT?((b=a.halfFloatTexture)||X.error("Half float texture is not support."),Ue(o)&&T===x&&(x===ke.LUMINANCE&&(x=ke.RED),T=Wh[x]),a.halfFloatLinear||(s.minFilter=s.magFilter=o.NEAREST,X.warn("Half float linear not support, change to NEAREST."))):b===o.FLOAT&&((b=a.floatTexture)||X.error("Float texture is not support."),Ue(o)&&T===x&&(x===ke.LUMINANCE&&(x=ke.RED),T=Yh[x]),a.floatLinear||(s.minFilter=o.NEAREST,s.magFilter=o.NEAREST,X.warn("Float linear not support, change to NEAREST."))),void 0===s.premultiplyAlpha&&(s.premultiplyAlpha=!1),o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),void 0===s.flipY&&(s.flipY=!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,s.flipY),u===exports.TextureSourceType.framebuffer)m&&(E=null!=(r=m.width)?r:0,_=null!=(i=m.height)?i:0,E&&_&&(this.width!==E||this.height!==_)&&o.texImage2D(n,0,T,E,_,0,x,b,null));else if(u===exports.TextureSourceType.data){var A;if(n===o.TEXTURE_CUBE_MAP)v.forEach((function(t,r){var i=e.texImage2DData(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else A=this.texImage2DData(o,n,0,T,x,b,h),E=A[0],_=A[1]}else if(u===exports.TextureSourceType.image||u===exports.TextureSourceType.video){if(n===o.TEXTURE_CUBE_MAP)c.forEach((function(t,r){var i=e.texImage2D(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else if(n===o.TEXTURE_2D){var C,S=null!=l?l:f;C=this.texImage2D(o,n,0,T,x,b,S),E=C[0],_=C[1]}y&&(qh(E)&&qh(_)||Ue(o))&&o.generateMipmap(n)}else if(u===exports.TextureSourceType.mipmaps){var w;n===o.TEXTURE_2D?p.forEach((function(t,r){var i;(w="data"in t?e.texImage2DData(o,n,r,T,x,b,t):e.texImage2D(o,n,r,T,x,b,t),0===r)&&(E=(i=w)[0],_=i[1])})):n===o.TEXTURE_CUBE_MAP&&d.forEach((function(t,r){t.forEach((function(t,i){var n;(w="data"in t?e.texImage2DData(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t):e.texImage2D(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t),0===r)&&(E=(n=w)[0],_=n[1])}))}))}else u===exports.TextureSourceType.compressed&&g&&0!==g.length&&(E=g[0].width,_=g[0].height,g.forEach((function(t,e){o.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=_,this.setTextureFilters(o,n,s)},r.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,s=r.wrapS,o=void 0===s?t.CLAMP_TO_EDGE:s,a=r.wrapT,u=void 0===a?t.CLAMP_TO_EDGE:a,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var c=Ue(t)||qh(this.width)&&qh(this.height),l=r.magFilter?r.magFilter:t.NEAREST,f=r.minFilter?r.minFilter:t.NEAREST;c||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,l),t.texParameteri(e,t.TEXTURE_WRAP_S,c?o:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e,i=this.assembleOptions(r),n=i.sourceType,s=i.sourceFrom,o=i.name,a=void 0===o?"":o;this.source=i,this.sourceType=n,this.sourceFrom=s,this.name=a,this.guid=e.id},r.texImage2D=function(t,e,r,i,n,s,o){var a,u=this,h=this.source,c=h.sourceType,l=h.minFilter,f=h.magFilter,p=h.wrapS,d=h.wrapT,m=null!=(a=this.engine.gpuCapability.detail.maxTextureSize)?a:2048,v=o;if(c!==exports.TextureSourceType.video){var y=l!==t.NEAREST||f!==t.NEAREST||p!==t.CLAMP_TO_EDGE||d!==t.CLAMP_TO_EDGE;(y=y||o.width>m||o.height>m)&&setTimeout((function(){v=u.resizeImage(o)}))}t.texImage2D(e,r,i,n,s,v);var g=[v.width,v.height];return c===exports.TextureSourceType.video?[o.videoWidth,o.videoHeight]:g},r.texImage2DData=function(t,e,r,i,n,s,o){var a=o.data,u=o.width,h=o.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,r,i,u,h,0,n,s,c),[u,h]},r.resizeImage=function(t,e,r){var i,n=null!=(i=this.engine.gpuCapability.detail.maxTextureSize)?i:2048;if(Ue(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var s=function(t,e,r,i){var n=t.width,s=t.height,o=Math.min(e,r||hs(n)),a=Math.min(e,i||hs(s));if(a!==s||o!==n){var u=hu.getCanvas(),h=u.getContext("2d");return u.width=o,u.height=a,null==h||h.drawImage(t,0,0,n,s,0,0,o,a),X.warn("Image resize from "+n+"x"+s+" to "+o+"x"+a+"."),u}}(t,n,e,r);return s||t},r.reloadData=function(){var t=this;return i((function(){return h(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Ar().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},r.offloadData=function(){if(this.initialized&&Ar().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[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<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},r.uploadCurrentVideoFrame=function(){var t=this;return i((function(){return h(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]}))}))()},r.updateSource=function(t){this.source=this.assembleOptions(Ye({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},r.restore=function(){},r.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){X.error("This texture has been destroyed.")},this.initialize=J,void 0!==this.engine&&this.engine.removeTexture(this)},e}(mr);function qh(t){return 0==(t&t-1)&&0!==t}var Kh=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().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 Ue(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),$h(e,t),e},e.bindVertexArray=function(t){var e;Ue(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Ue(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),Qh=1,Jh=function(){function t(t){this.engine=t,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var e={width:1,height:1,data:new Uint8Array([255])},r=t.getGLPipelineContext(),i=r.gl;this.gl=i,this.pipelineContext=r,this.emptyTexture2D=new Zh(t,{data:e,sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new Zh(t,{target:i.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+Qh,Qh++}var e=t.prototype;return e.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,n),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&y(this.renderbuffers,t),e},e.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.framebuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.drawGeometry=function(t,e,r){if(this.gl){var i=t,n=e.shaderVariant.program;if(n){var s=n.setupAttributes(i),o=this.gl,a=i.indicesBuffer,u=i.drawStart,h=i.drawCount,c=i.mode,l=i.subMeshes;if(l&&l.length){var f,p=l[r];if(h<0)return;if(u=p.offset,a)h=null!=(f=p.indexCount)?f:0;else h=p.vertexCount}a?o.drawElements(c,h,a.type,null!=u?u:0):o.drawArrays(c,u,h),null==s||s.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var r=this.gl.createFramebuffer();if(!r)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return y(this.framebuffers,t),$h(r,e,e),r},e.createVAO=function(t){return new Kh(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(this.textures,t),delete t.textureBuffer)},e.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),g(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(this.renderbuffers,t),delete t.buffer)},e.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach((function(e){return t.deleteGLFramebuffer(e)})),this.framebuffers.length=0,this.renderbuffers.forEach((function(e){return t.deleteGLRenderbuffer(e)})),this.renderbuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.lost=function(t){X.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},e.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},oe(t,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function $h(t,e,r){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var tc,ec,rc=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.name,i=e.data,n=e.elementCount,s=e.target,o=void 0===s?ke.ARRAY_BUFFER:s,a=e.type,u=void 0===a?ke.FLOAT:a,h=e.usage,c=void 0===h?ke.STATIC_DRAW:h,l=function(t){var e,r;return null!=(r=null==(e=ic[t])?void 0:e.BYTES_PER_ELEMENT)?r:0}(u);this.target=o,this.type=u,this.usage=c,this.glBuffer=this.createGLBuffer(r),this.bytesPerElement=l,i?this.bufferData(i):n&&this.bufferData(l*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return $h(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;r.bindBuffer(i,this.glBuffer),s>this.byteLength&&(this.byteLength=s,r.bufferData(i,s,this.usage)),r.bufferSubData(i,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Ue(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},oe(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ic=((tc={})[ke.INT]=Int32Array,tc[ke.FLOAT]=Float32Array,tc[ke.SHORT]=Int16Array,tc[ke.BYTE]=Int8Array,tc[ke.UNSIGNED_BYTE]=Uint8Array,tc[ke.UNSIGNED_INT]=Uint32Array,tc[ke.UNSIGNED_SHORT]=Uint16Array,tc);var nc=((ec={})[Uint8Array.BYTES_PER_ELEMENT]=ke.UNSIGNED_BYTE,ec[Uint16Array.BYTES_PER_ELEMENT]=ke.UNSIGNED_SHORT,ec[Uint32Array.BYTES_PER_ELEMENT]=ke.UNSIGNED_INT,ec),sc=1,oc=function(t){function r(e,r){var i;return(i=t.call(this,e)||this).drawCount=0,i.buffers={},i.vaos={},i.skin={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}Ct(r,t);var i=r.prototype;return i.getOptions=function(){return Ye({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;k(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new rc(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,s=r.target;this.bufferProps[i]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,s=e+r.length;if(i.data.length<s){var o=new r.constructor(s);o.set(i.data),i.data=o,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,n)),void 0!==a.end&&(a.end=Math.max(a.end,s-1))}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(o(t,Uint8Array)||o(t,Uint16Array)||o(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var r,i=t,n=t+e.length;if(this.indices.length<n){var s=new e.constructor(n);s.set(this.indices),this.indices=s,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,i)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}null==(r=this.indices)||r.set(e,i),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*Hr[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var r=nc[e.BYTES_PER_ELEMENT],i={data:e,target:ke.ELEMENT_ARRAY_BUFFER,type:r,name:this.name+"##index"};return new rc(t,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var s,o,a=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,o=i;else{var u=e[n].dataSource;s=t.buffers[u],o=r[u].data}if((a.dirty||a.discard)&&s&&o){if(a.discard)s.bufferData(o);else if(void 0!==a.start&&void 0!==a.end){var h=a.start*o.BYTES_PER_ELEMENT+o.byteOffset,c=a.end-a.start+1,l=new o.constructor(o.buffer,h,c);s.bufferSubData(a.start,l)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],s=e[i].dataSource;r[s]&&n&&(r[s].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,s=e.mode,a=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+sc++:u,c=e.bufferUsage,l=void 0===c?ke.STATIC_DRAW:c;this.name=h;var f={},p=[],d={},m={},v={},y=l;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(s)?ke.TRIANGLES:s,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,s=r.offset,a=r.normalize,u=r.type,h=void 0===u?ke.FLOAT:u,c=r.releasable,l=r.data;if(!h||"dataSource"in r||l||(l=Yr(h)),l){var g=o(l,Float32Array)?ke.FLOAT:ke.INT;f[t]={data:l,usage:y,target:ke.ARRAY_BUFFER,name:t},d[t]={size:i,stride:n,offset:s,type:null!=h?h:g,normalize:!!a,dataSource:t},v[t]=null!=c&&c,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(d[t]={size:i,stride:n,offset:s,type:h,dataSource:x,normalize:!!a})}p.push(t)})),m.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==a?void 0:a.data,this.indicesReleasable=!0===(null==a?void 0:a.releasable),this.bufferProps=f,this.attributes=d,this.attributesName=p,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},i.fromData=function(r){var i,n=this;if(t.prototype.fromData.call(this,r),this.subMeshes=r.subMeshes,r.buffer?i=new Uint8Array(function(t){for(var r=e.atob(t),i=new Uint8Array(r.length),n=0;n<r.length;n++)i[n]=r.charCodeAt(n);var s=i.buffer;return s}(r.buffer)):r.binaryData&&(i=r.binaryData),i){var s=r.vertexData.vertexCount;if(this.hasSemantic(r)){var o={mode:ke.TRIANGLES,attributes:{}};if(r.vertexData.channels.forEach((function(t){var e,r=null!=(e=ac[t.semantic])?e:t.semantic,a=n.createVertexTypedArray(t,i,s);o.attributes[r]={type:Ge(t.format),size:t.dimension,data:a,normalize:t.normalize}})),r.indexFormat!==te.None){var a=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset);o.indices={data:a},o.drawCount=a.length}else o.drawCount=s;this.processProps(o)}else{var u=r.vertexData.channels[0],h=r.vertexData.channels[1],c=r.vertexData.channels[2],l=this.createVertexTypedArray(u,i,s),f=this.createVertexTypedArray(h,i,s),p=this.createVertexTypedArray(c,i,s),d=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset),m={mode:ke.TRIANGLES,attributes:{aPos:{type:Ge(u.format),size:3,data:l,normalize:u.normalize},aUV:{type:Ge(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Ge(c.format),size:3,data:p,normalize:c.normalize}}};m.indices={data:d},m.drawCount=d.length,this.processProps(m)}this.skin={boneNames:r.boneNames,rootBoneName:r.rootBoneName,inverseBindMatrices:r.inverseBindMatrices}}},i.dispose=function(){var t,e=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){e.buffers[t].dispose()})),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach((function(t){var r;null==(r=e.vaos[t])||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0));this.destroyed=!0},i.createVertexTypedArray=function(t,e,r){var i=e.buffer;switch(t.format){case $t.Float32:return new Float32Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.Int16:return new Int16Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.Int8:return new Int8Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.UInt16:return new Uint16Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.UInt8:return new Uint8Array(i,e.byteOffset+t.offset,t.dimension*r);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(i,e.byteOffset+t.offset,t.dimension*r)}},i.createIndexTypedArray=function(t,e,r){var i=e.buffer;switch(t){case te.UInt16:return new Uint16Array(i,e.byteOffset+r);case te.UInt32:return new Uint32Array(i,e.byteOffset+r);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(i,e.byteOffset+r)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},oe(r,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),r}(Wr),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 uc,hc,cc=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===r&&this.blendColor[2]===i&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=r,this.blendColor[2]=i,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===r&&this.blendFunctionParameters[2]===i&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=r,this.blendFunctionParameters[2]=i,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],r=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===r||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=r)},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=[ke.ONE,ke.ONE_MINUS_SRC_ALPHA,ke.ONE,ke.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[ke.FUNC_ADD,ke.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=ke.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=[ke.ALWAYS,ke.ALWAYS],this.stencilOpFail=[ke.KEEP,ke.KEEP],this.stencilOpZFail=[ke.KEEP,ke.KEEP],this.stencilOpZPass=[ke.KEEP,ke.KEEP],this.culling=!1,this.frontFace=ke.CCW,this.cullFace=ke.FRONT},e.apply=function(t){if(t.toggle(ke.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(ke.BLEND,this.blending),t.toggle(ke.DEPTH_TEST,this.depthTest),t.toggle(ke.STENCIL_TEST,this.stencilTest),t.toggle(ke.CULL_FACE,this.culling),t.toggle(ke.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(ke.BACK,this.stencilMask[1]),t.stencilMaskSeparate(ke.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(ke.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(ke.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(ke.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(ke.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[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}(),lc=Se,fc=Oe,pc=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.colors={},i.quaternions={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirty=!0,i.macrosDirty=!0,i.glMaterialState=new cc,r&&(i.shader=new exports.Shader(e),i.shader.shaderData=Ye({},r.shader,{id:$(),dataType:Qt.Shader})),i}Ct(e,t);var r=e.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];Z(r.initialize)?r.initialize():X.error("Failed to initialize texture: "+JSON.stringify(r)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var r=t.engine.getGLPipelineContext(),i=this.shaderVariant;if(i.program){var n;if(i.program.bind(),this.setupStates(r),e){for(var o,a=s(e.uniforms);!(o=a()).done;)n=o.value,this.checkUniform(n);for(var u,h=s(e.samplers);!(u=h()).done;)n=u.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(i.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)i.setFloat(n,e.floats[n]);for(n in e.ints)i.setInt(n,e.ints[n]);for(n in e.vector4s)i.setVector4(n,e.vector4s[n]);for(n in e.vector3s)i.setVector3(n,e.vector3s[n]);for(n in e.matrices)i.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)i.setFloat(n,this.floats[n]);for(n in this.ints)i.setInt(n,this.ints[n]);for(n in this.floatArrays)i.setFloats(n,this.floatArrays[n]);for(n in this.textures)i.setTexture(n,this.textures[n]);for(n in this.vector2s)i.setVector2(n,this.vector2s[n]);for(n in this.vector3s)i.setVector3(n,this.vector3s[n]);for(n in this.vector4s)i.setVector4(n,this.vector4s[n]);for(n in this.colors)i.setColor(n,this.colors[n]);for(n in this.quaternions)i.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)i.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)i.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)i.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)i.setMatrixArray(n,this.matrixArrays[n])}else{var c;null==(c=this.engine)||c.renderErrors.add(new Error("Shader program is not initialized."))}},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var r,i=s(e);!(r=i()).done;){var n=r.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var r,i=s(e);!(r=i()).done;)for(var n=r.value,o=0;o<16;o++)this.matrixArrays[t].push(n.elements[o])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var r=t||this.props,i=this.engine;k(i);var n=new e(i,r);return n.glMaterialState=Object.assign(new cc,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r=Ye({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===Tt.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var i,n,s=e.stringTags.RenderFace;for(i in s===Et.Front?(this.culling=!0,this.cullFace=ke.BACK):s===Et.Back?(this.culling=!0,this.cullFace=ke.FRONT):this.culling=!1,r.floats)this.setFloat(i,r.floats[i]);for(i in r.ints)this.setInt(i,r.ints[i]);for(i in r.vector4s){var o=r.vector4s[i];this.setVector4(i,new Se(o.x,o.y,o.z,o.w))}for(i in r.colors){var a=r.colors[i];this.setColor(i,new Re(a.r,a.g,a.b,a.a))}for(i in r.textures){var u=r.textures[i],h=this.engine.findObject(u.texture);this.setTexture(i,h);var c=u.offset,l=u.scale;c&&l&&this.setVector4(i+"_ST",new lc(l.x,l.y,c.x,c.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},r.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=Qt.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var r in this.ints)t.ints[r]=this.ints[r];for(var i in this.vector4s)t.vector4s[i]=this.vector4s[i];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var o=t.textures[s],a=this.getVector4(s+"_ST");a&&(o.scale={x:a.x,y:a.y},o.offset={x:a.z,y:a.w},delete t.vector4s[s+"_ST"])}return t},r.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new lc(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){for(var s=[],o=0;o<r.matrixArrays[e].length;o+=16){for(var a=fc.fromIdentity(),u=0;u<16;u++)a.elements[u]=r.matrixArrays[e][o+u];s.push(a)}this.setMatrixArray(e,s)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(t){var e,r=this;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),(null==t?void 0:t.textures)!==exports.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},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=J,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},oe(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Pr),dc=function(){function t(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var e=t.prototype;return e.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.copyTexture=function(t,e){this.renderer&&(t.initialize(),e.initialize(),e.updateSource({sourceType:exports.TextureSourceType.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var r=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(r)},e.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:ke.RGBA}},r=this.renderer.engine,i=new oc(r,{name:t,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=r.gpuCapability.level,s=new pc(r,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1}});s.blending=!1,s.depthTest=!1,s.culling=!1;var o=new ii(r,{name:t,geometry:i,material:s,priority:0});return new mc(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:exports.TextureLoadAction.whatever},attachments:[e],meshes:[o]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),mc=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},r.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(ui),vc=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],k(t),this.gl=Pe(t,e,r),this.contextLostListener=function(t){for(var e,r,n=s(i.lostHandlers);!(r=n()).done;){r.value.lost(t)}null==(e=i.canvas)||e.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){for(var e,r,n=s(i.restoreHandlers);!(r=n()).done;){r.value.restore()}null==(e=i.canvas)||e.addEventListener("webglcontextlost",i.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),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}(),yc=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new Ni(e),r}Ct(e,t);var r=e.prototype;return r.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},r.getGLRenderer=function(){return this.renderer},r.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},r.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(Gh),gc=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,void 0!==r&&i.initialize(r),i}Ct(e,t);var r=e.prototype;return r.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},r.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderbuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):X.error("Invalid render buffer size: "+t+"x"+e+".")}}else X.error("Can't set size for uninitialized render buffer.")},r.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=J},e}(Vi),xc=1,bc=function(t){function e(e,r){var i;(i=t.call(this)||this).attachmentTextures=[];var n,s=e.depthStencilAttachment,o=e.viewport,a=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,c=void 0===h?1:h,l=e.name,f=void 0===l?"GLFramebuffer"+xc++:l;return i.renderer=r,i.engine=r.engine,i.depthStencilStorageType=null!=(n=null==s?void 0:s.storageType)?n:exports.RenderPassAttachmentStorageType.none,i.viewport=o,i.isCustomViewport=!!a,i.viewportScale=c,i.name=f,i.storeAction=u,i.updateProps(e),i}Ct(e,t);var r=e.prototype;return r.getDepthTexture=function(){return this.depthTexture},r.getStencilTexture=function(){return this.stencilTexture},r.getColorTextures=function(){return this.colorTextures},r.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),y(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&y(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&y(this.attachmentTextures,this.depthTexture.textureBuffer)},r.updateProps=function(t){var e,r,i=this.renderer,n=this.engine.gpuCapability,s=null!=(r=t.depthStencilAttachment)?r:{storageType:exports.RenderPassAttachmentStorageType.none},a=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,c=n.detail.readableDepthStencilTextures,l=s.storageType,f=s.storage;if(this.colorTextures=t.attachments.slice(),!a&&l!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(a&&(this.fbo=i.glRenderer.createGLFramebuffer(this,this.name)),l){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!o(f,gc))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new gc({format:ke.DEPTH_STENCIL,attachment:ke.DEPTH_STENCIL_ATTACHMENT,storageType:l},i.glRenderer);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!o(f,gc))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new gc({attachment:ke.DEPTH_ATTACHMENT,format:ke.DEPTH_COMPONENT16,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!o(f,gc))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new gc({attachment:ke.STENCIL_ATTACHMENT,format:ke.STENCIL_INDEX8,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Zh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:ke.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:ke.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Zh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:ke.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},r.getStoreAttachments=function(t,e){var r=this.renderer.glRenderer.gl,i=this.colorTextures.length;if(t&&Ue(r)&&i>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&y(n,e?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&y(n,e?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var s=0;s<i;s++)y(n,r["COLOR_ATTACHMENT"+s]);return n}},r.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;Ue(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext,i=this.viewport,n=i[0],s=i[1],o=i[2],a=i[3];r.bindFramebuffer(e.FRAMEBUFFER,this.fbo),r.viewport(n,s,o,a);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i&&i!==u&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var c=this,l=c.depthStencilRenderbuffer,f=c.depthTexture,p=c.stencilTexture;if(r.activeTexture(e.TEXTURE0),l)l.setSize(o,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,l.attachment,e.RENDERBUFFER,l.buffer);else if(f){f.source.data={width:o,height:a},f.update({data:{width:o,height:a,data:new Uint16Array(0)}});var d=f&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var m=e.checkFramebufferStatus(e.FRAMEBUFFER);if(m!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+m+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},r.resetColorTextures=function(t){var e=t,r=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,n=this.viewport,o=[];if(e){for(var a,u=s(e);!(a=u()).done;){a.value.initialize()}this.colorTextures=e.slice()}this.renderer.pipelineContext.activeTexture(r.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),i.framebufferTexture2D(r,r.FRAMEBUFFER,e,r.TEXTURE_2D,t.textureBuffer),o.push(!0)})),i.drawBuffers(r,o),this.updateAttachmentTextures()},r.resize=function(t,e,r,i){var n=this.viewport,s=n[0],o=n[1],a=n[2],u=n[3];s===t&&o===e&&a===r&&u===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},r.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,r,i=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(i===exports.RenderPassDestroyAttachmentType.force||i===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(r=this.depthTexture)||r.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},oe(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}(Ui),Tc=((uc={})[ke.FLOAT]=1,uc[ke.INT]=1,uc[ke.UNSIGNED_INT]=1,uc[ke.SHORT]=1,uc[ke.BOOL]=1,uc[ke.UNSIGNED_SHORT]=1,uc[ke.FLOAT_VEC2]=2,uc[ke.FLOAT_VEC3]=3,uc[ke.FLOAT_VEC4]=4,uc[ke.FLOAT_MAT2]=4,uc[ke.FLOAT_MAT3]=9,uc[ke.FLOAT_MAT4]=16,uc[ke.FLOAT_MAT2x3]=6,uc[ke.FLOAT_MAT2x4]=8,uc[ke.FLOAT_MAT4x3]=12,uc[ke.FLOAT_MAT4x2]=8,uc[ke.FLOAT_MAT3x4]=12,uc[ke.FLOAT_MAT3x2]=6,uc[ke.INT_VEC2]=2,uc[ke.INT_VEC3]=3,uc[ke.INT_VEC4]=4,uc[ke.UNSIGNED_INT_VEC2]=2,uc[ke.UNSIGNED_INT_VEC3]=3,uc[ke.UNSIGNED_INT_VEC4]=4,uc[ke.BOOL_VEC2]=2,uc[ke.BOOL_VEC3]=3,uc[ke.BOOL_VEC4]=4,uc),Ec=Sc(Float32Array),_c=Sc(Int32Array),Ac=Sc(Uint8Array);function Cc(t){return function(e,r,i,n){var s={start:r[1],dirty:!0};if(r[2]>1){var o=e;if(o.length){for(var a=n[1]||o.length,u=r[4]/t.BYTES_PER_ELEMENT,h=s.buffer=new t(a*u),c=n[0]||0,l=0;l<a;l++)h[l*u]=o[l+c];s.start+=c*u}}else s.buffer=new t([e]);return s}}function Sc(t){return function(e,r,i,n){for(var s=r[8],o=r[2],a=r[5],u=1===o?s:r[4],h=a?u/a:1,c=u/t.BYTES_PER_ELEMENT/h,l=s/t.BYTES_PER_ELEMENT/c,f=Tc[r[0]],p=f/h,d=(n[0]||0)*f,m=n[1]?h*n[1]:l,v=new t(c*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=d;g<m;g++){for(var T=0;T<p;T++)v[x+T]=e[b+T];x+=c,b+=p}return y}}function wc(t,e){for(var r=function(r){var s=t.getActiveUniformBlockName(e,r);k(s);var o={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};o.used=o.usedByVertexShader||o.usedByFragmentShader,i[r]=o;for(var a=o.uniformIndices,u=[],h=0;h<a.length;h++){var c=t.getActiveUniform(e,a[h]).name.replace("[0]","");o.uniforms[c]=[0,0,0,0,0,0,0,h,0],u[h]=c,n.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,a,r).forEach((function(t,e){var r=u[e];o.uniforms[r][i]=+t}))}));for(var l=0;l<u.length;l++){var f=o.uniforms[u[l]],p=o.uniforms[u[l+1]],d=p?p[1]:o.size;f[8]=d-f[1]}o.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices,s=Object.keys(i).map((function(t){return t+"["+i[t].join(":")+"]"})).join("+");return Rc(e+"+",r+"+",n.length+"+",s)}(o)+""},i=[],n=[],s=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=0;o<s;++o)r(o);return{blockSpecs:i,blockUniformNames:n}}function Rc(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var i=0,n=0;n<arguments.length;n++)for(var s=e[n],o=0;o<s.length;o++)i=Math.imul(31,i)+s.charCodeAt(o)|0;return i}(hc={})[ke.FLOAT]=Cc(Float32Array),hc[ke.INT]=Cc(Int32Array),hc[ke.UNSIGNED_INT]=Cc(Uint32Array),hc[ke.SHORT]=Cc(Int16Array),hc[ke.BOOL]=Cc(Uint8Array),hc[ke.UNSIGNED_SHORT]=Cc(Uint16Array),hc[ke.FLOAT_VEC2]=Ec,hc[ke.FLOAT_VEC3]=Ec,hc[ke.FLOAT_VEC4]=Ec,hc[ke.FLOAT_MAT2]=Ec,hc[ke.FLOAT_MAT3]=Ec,hc[ke.FLOAT_MAT4]=Ec,hc[ke.FLOAT_MAT2x3]=Ec,hc[ke.FLOAT_MAT2x4]=Ec,hc[ke.FLOAT_MAT4x3]=Ec,hc[ke.FLOAT_MAT4x2]=Ec,hc[ke.FLOAT_MAT3x4]=Ec,hc[ke.FLOAT_MAT3x2]=Ec,hc[ke.INT_VEC2]=_c,hc[ke.INT_VEC3]=_c,hc[ke.INT_VEC4]=_c,hc[ke.UNSIGNED_INT_VEC2]=_c,hc[ke.UNSIGNED_INT_VEC3]=_c,hc[ke.UNSIGNED_INT_VEC4]=_c,hc[ke.BOOL_VEC2]=Ac,hc[ke.BOOL_VEC3]=Ac,hc[ke.BOOL_VEC4]=Ac;var Mc=function(){function t(t,e,r){var i=this;this.engine=t,this.program=e,this.id=r,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),Ue(n))&&wc(n,e).blockSpecs.forEach((function(t){return i.uniformBlockMap[t.name]=t}));this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,r,i=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new Kh(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=r),r&&r.vao&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.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(),s.enableVertexAttribArray(r.loc),s.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),r&&(r.ready=!0)),r},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=t.getActiveAttrib(e,n);if(s){var o=s.name,a=s.type,u=s.size,h=t.getAttribLocation(e,o);r[o]={type:a,name:o,size:u,loc:h}}}return r},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),Oc=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).initialized=!1,i.uniformLocations={},i.samplerChannels={},i}Ct(e,t);var r=e.prototype;return r.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},r.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},r.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},r.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},r.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},r.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},r.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},r.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},r.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},r.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},r.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},r.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},r.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},r.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},r.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var o=r[i];this.samplerChannels[o]=i}},r.toData=function(){var t=this.defination;t.dataType=Qt.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},r.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(Lr),Pc=0,Ic=function(){function t(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var r=t.prototype;return r.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var r,i=[],n=s(Object.keys(this.cachedShaders));!(r=n()).done;){var o=r.value;this.cachedShaders[o].initialized||i.push(o)}t?i.length?Promise.all(i.map((function(t){return new Promise((function(r){return e.compileShader(e.cachedShaders[t],r)}))}))).then(t).catch((function(){return 0})):t([]):i.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},r.addShader=function(t,e){var r,i,n=[];t.macros&&(r=n).push.apply(r,[].concat(t.macros));e&&(i=n).push.apply(i,[].concat(e));var s=Ye({},t,{vertex:Ti.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:Ti.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),o=this.computeShaderCacheId(s);if(this.cachedShaders[o])return o;this.shaderAllDone=!1;var a=!1;return(s.shared||s.cacheId)&&(a=!0),this.cachedShaders[o]=new Oc(this.engine,Ye({},s,{vertex:s.vertex,fragment:s.fragment,name:s.name||o,shared:a})),this.cachedShaders[o].id=o,o},r.createShader=function(t,e){var r=this.addShader(t,e);return this.cachedShaders[r]},r.compileShader=function(t,r){var i=this,n=t.source,s=n.shared,o=n.vertex,a=n.fragment,u=n.name,h=t.source.cacheId,c=!1;(s||h)&&(c=!0);var l=this.pipelineContext.gl,f={shared:c,status:exports.ShaderCompileResultStatus.compiling},p=this.createProgram(l,o,a,f),d=this.glAsyncCompileExt,m=e.performance.now(),v=function(r){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=r,t.initialized=!0,t.pipelineContext=i.pipelineContext,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=r},y=function(){if(i.engine.isDestroyed)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==r?void 0:r(f);if(t.initialized)return null==r?void 0:r(f);var n=(!r||!d||d&&1==l.getProgramParameter(f.program,d.COMPLETION_STATUS_KHR))&&p();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){$h(n,u);var s=new Mc(i.engine,n,t.id);if(l.validateProgram(n),l.getProgramParameter(n,l.VALIDATE_STATUS))v(s);else{var h=l.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(s):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",o,"\nfragment:\n",a),l.deleteProgram(n))}}null==r||r(f)}else r&&e.requestAnimationFrame(y)};t.compileResult=f,y()},r.computeShaderCacheId=function(t){var e=t.vertex,r=void 0===e?"":e,i=t.fragment,n=void 0===i?"":i,s=t.shared,o=t.cacheId;return s||o?o||"shared_"+Rc(r,n):"instanced_"+Pc++},r.createProgram=function(t,e,r,i){var n=t.createProgram(),s=this.createGLShader(t,t.VERTEX_SHADER,e),o=this.createGLShader(t,t.FRAGMENT_SHADER,r);return n&&s&&o?(t.attachShader(n,s),t.attachShader(n,o),t.linkProgram(n),i.program=n,i.status=exports.ShaderCompileResultStatus.compiling,function(){if(i.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var a=t.getProgramInfoLog(n);console.error("Failed to link program: "+a+".");var u=Lc(t,s,"vertex",e),h=Lc(t,o,"fragment",r);return i.status=exports.ShaderCompileResultStatus.fail,u&&(i.error=u.error,i.status=u.status),h&&(i.error=h.error,i.status=h.status),n}return n}):(i.status=exports.ShaderCompileResultStatus.fail,function(){return null})},r.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Rc(null!=r?r:""),s=i.get(n);if(s)return s;var o=t.createShader(e);return o&&(t.shaderSource(o,r),t.compileShader(o),i.set(n,o)),o},r.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]},r.restore=function(){},r.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.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 Lc(t,e,r,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+r+" error: "+n,(null!=i?i:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}var Fc=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Ic(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=ke.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},e.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},e.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},e.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},e.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,r,i){this.set4("viewport",t,e,r,i)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,r){(this.currentTextureBinding!==e||r)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},e.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},e.set4=function(t,e,r,i,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),s.x===e&&s.y===r&&s.z===i&&s.w===n||this.gl[t](s.x=e,s.y=r,s.z=i,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},e.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},e.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},e.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),Vc=function(t){function e(e,r,i){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var s=Ye({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},i);n.context=new vc(e,r,s);var o=n.context.gl;return k(o),n.engine=new yc(o),n.engine.renderer=lo(n),n.pipelineContext=new Fc(n.engine,o),n.glRenderer=new Jh(n.engine),n.extension=new dc(lo(n)),n.renderingData={currentFrame:{}},n.framebuffer=new bc({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new Zh(n.engine,{sourceType:exports.TextureSourceType.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:exports.RenderPassAttachmentStorageType.none}},lo(n)),n}Ct(e,t);var r=e.prototype;return r.renderRenderFrame=function(t){var e,r=t;r.resource&&r.resource.color_b.initialize(),r.emptyTexture.initialize(),r.transparentTexture.initialize();var i=r._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=r.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(r.clearAction);var n=r.camera;this.renderingData.currentFrame=r,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),F(i);for(var o,a=s(i);!(o=a()).done;){var u=o.value,h=u.delegate;null==h.willBeginRenderPass||h.willBeginRenderPass.call(h,u,this.renderingData),this.renderRenderPass(u),null==h.didEndRenderPass||h.didEndRenderPass.call(h,u,this.renderingData)}for(var c,l=s(i);!(c=l()).done;){c.value.frameCleanup(this)}}},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,r=this.renderingData.currentPass.delegate,i=s(t);!(e=i()).done;){var n=e.value;null==r.willRenderMesh||r.willRenderMesh.call(r,n,this.renderingData),n.render(this),null==r.didRenderMesh||r.didRenderMesh.call(r,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,r){if(void 0===r&&(r=0),t&&e){e.initialize(),t.initialize(),t.flush();var i=this.renderingData;i.currentFrame.editorTransform&&e.setVector4("uEditorTransform",i.currentFrame.editorTransform);try{e.use(this,i.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e,r)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(t,e,r,i,n,s){if(this.temporaryRTs[t])return this.temporaryRTs[t];var o,a,u=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?o=ke.LINEAR:n===exports.FilterMode.Nearest&&(o=ke.NEAREST),s===exports.RenderTextureFormat.RGBA32?a=ke.UNSIGNED_BYTE:s===exports.RenderTextureFormat.RGBAHalf&&(a=ke.HALF_FLOAT),0===i?u=exports.RenderPassAttachmentStorageType.none:16===i?u=exports.RenderPassAttachmentStorageType.depth_16_opaque:24===i&&(u=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new Zh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:o,magFilter:o,internalFormat:ke.RGBA,format:ke.RGBA,type:a}),c=new bc({name:t,storeAction:{},viewport:[0,0,e,r],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=c,c},r.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},r.clear=function(t){var e=this.pipelineContext,r=0;if(t.colorAction===exports.TextureLoadAction.clear){var i=t.clearColor;i&&e.clearColor(i[0],i[1],i[2],i[3]),e.colorMask(!0,!0,!0,!0),r=ke.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),r|=ke.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),r|=ke.DEPTH_BUFFER_BIT}r&&e.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new Ni(t),this.engine.renderer=this,this.pipelineContext=new Fc(this.engine,t),this.glRenderer=new Jh(this.engine),this.extension=new dc(this)},r.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},oe(e,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),e}(Bi),Dc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Nc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",kc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",zc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Uc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Bc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",Gc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var jc=new Map;var Xc=!1,Hc=1,Wc=function(t){function r(r){var n;(n=t.call(this)||this).compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),n.handleEmitEvent("webglcontextlost",t),Yc(lo(n),!1)};var o=lo(n);n.restore=i((function(){var t;return h(this,(function(r){switch(r.label){case 0:return o.renderer.restore(),[4,Promise.all(o.compositions.map(i((function(t){var e,r,i,n,s,a,u,c,l,f,p,d;return h(this,(function(h){switch(h.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,s=t.reusable,a=t.renderOrder,u=t.transform,c=t.videoState,[4,o.loadScene(r)];case 1:(l=h.sent()).speed=i,l.reusable=s,l.keepResource=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),f=0,h.label=2;case 2:return f<c.length?c[f]?((p=l.textures[f].source.video).currentTime=null!=(d=c[f])?d:0,[4,p.play()]):[3,4]:[3,5];case 3:h.sent(),h.label=4;case 4:return f++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return o.compositions=r.sent(),o.emit("webglcontextrestored"),null==(t=o.ticker)||t.resume(),S()&&o.canvas&&(o.canvas.style.display="none",e.window.setTimeout((function(){o.canvas.style.display=""}),0)),[2]}}))})),n.handleResume=function(){n.emit("update",{player:lo(n),playing:!0})},n.handleClick=function(t){var e=t.x,r=t.y,i=[];n.compositions.forEach((function(t){for(var o,a=s(t.hitTest(e,r));!(o=a()).done;){var u=o.value;i.push(Ye({},u,{player:lo(n),composition:t}))}}));for(var o=0;o<i.length;o++){var a=i[o],u=a.behavior||yt.NOTIFY;u===yt.NOTIFY?(n.emit("click",Ye({},a,{compositionId:a.composition.id,compositionName:a.composition.name})),a.composition.emit("click",Ye({},a,{compositionId:a.composition.id,compositionName:a.composition.name}))):u===yt.RESUME_PLAYER&&n.resume()}};var a=r.container,u=r.canvas,c=r.fps,l=r.name,f=r.pixelRatio,p=r.manualRender,d=r.reportGPUTime,m=r.renderFramework,v=r.notifyTouch,y=r.onError,g=r.interactive,x=void 0!==g&&g,b=r.renderOptions,T=void 0===b?{}:b,E=r.env,_=void 0===E?"":E,A=T.willCaptureImage,w=T.premultipliedAlpha;if(n.onError=y,Xc||"debug-disable"===m)return uu(n);var R,M=(R=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===R[1]||"16"===R[1]&&"5"===R[2])?"webgl":"webgl2";m&&(M="webgl"===m?"webgl":"webgl2"),n.reportGPUTime=d,n.pixelRatio=Number.isFinite(f)?f:C(),n.offscreenMode=!0,n.env=_,n.name=l||""+Hc++;try{if(Ne.length)throw new Error("Errors before player create: "+Ne.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?n.canvas=u:(Zc(a),n.canvas=e.document.createElement("canvas"),a.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=Bi.create(n.canvas,M,{preserveDrawingBuffer:A,premultipliedAlpha:w}),n.renderer.env=_,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.assetService=new Eh(n.renderer.engine),p||(n.ticker=new jh(c),n.ticker.add(n.tick.bind(lo(n)))),n.event=new Zn(n.canvas,!!v),n.event.bindListeners(),n.event.addEventListener(Xn,n.handleClick),n.interactive=x,n.resize(),Ra(n.gpuCapability.detail)}catch(t){n.handleThrowError(t)}return jc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&X.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+Gc+".")})),jc.set(n.canvas,lo(n)),function(){for(var t,e=[],r=s(jc.values());!(t=r()).done;){var i=t.value;i.paused||e.push(i)}e.length>1&&X.error("Current running player count: "+e.length+", see "+Bc+".",e)}(),Yc(lo(n),!0),n}Ct(r,t);var n=r.prototype;return n.setSpeed=function(t){isNaN(t)||(this.speed=t)},n.getSpeed=function(){return this.speed},n.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},n.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(t,r){var n=this;return i((function(){var o,a,u,c,l,f,p,d,m,v,y,g,x,b,T,E,_,A,C,S;return h(this,(function(w){switch(w.label){case 0:return k(n.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),c=e.performance.now(),l=[],f=[],d=null==(p=null==r?void 0:r.autoplay)||p,m=null==(a=n.renderer.engine.gpuCapability)||null==(o=a.detail)?void 0:o.asyncShaderCompile,v=n.baseCompositionIndex,Y(t)?(y=l).push.apply(y,[].concat(t)):l.push(t),n.baseCompositionIndex+=l.length,d&&(n.autoPlaying=!0),g=[],[4,Promise.all(l.map(i((function(t,e){var i,s,o,a,u,c,l,p;return h(this,(function(h){switch(h.label){case 0:return i=n.assetService.assembleSceneLoadOptions(t,Ye({autoplay:d},r)),s=i.source,o=i.options,u=null!=(a=null==o?void 0:o.autoplay)?a:d,c=new bh(o),n.assetManagers.push(c),[4,c.loadScene(s,n.renderer,{env:n.env})];case 1:return l=h.sent(),n.disposed?(f.length=0,[2]):(n.assetService.prepareAssets(l,l.assets),n.assetService.updateTextVariables(l,c.options.variables),n.assetService.initializeTexture(l),l.pluginSystem.precompile(l.jsonScene.compositions,n.renderer),(p=n.createComposition(l,o)).setIndex(v+e),f[e]=p,g[e]=u,[2])}}))}))))];case 1:return w.sent(),x=e.performance.now(),[4,new Promise((function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(w.sent(),b=e.performance.now()-x,T=0;T<f.length;T++)g[T]?f[T].play():f[T].pause();for(null==(u=n.ticker)||u.start(),E=f.map((function(t){return t.name})),_=e.performance.now()-c,A=s(f);!(C=A()).done;)(S=C.value).statistic.compileTime=b,S.statistic.firstFrameTime=_;return X.info("First frame ["+E+"]: "+_.toFixed(4)+"ms."),X.info("Shader "+(m?"async":"sync")+" compile ["+E+"]: "+b.toFixed(4)+"ms."),[2,Y(t)?f:f[0]]}}))}))()},n.createComposition=function(t,e){var r=this;void 0===e&&(e={});var i=this.renderer,n=new Aa(Ye({},e,{renderer:i,width:i.getWidth(),height:i.getHeight(),event:this.event,handleItemMessage:function(t){r.emit("message",t)}}),t);return this.ticker&&e.renderLevel===ct.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==In&&this.assetService.createShaderVariant(),this.compositions.push(n),n},n.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()},n.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.doTick(0,!0)},n.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.doTick(0,!0),this.emit("update",{player:this,playing:!1})},n.playSequence=function(t){for(var e,r=function(e){t[e].on("end",(function(){t[e+1].play()}))},i=0;i<t.length-1;i++)r(i);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return i((function(){var e;return h(this,(function(r){switch(r.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:r.sent(),t.resumePending=!1,t.handleResume(),r.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}}))}))()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(t,e){var r,i=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(r=this.ticker)||r.pause());t=Math.min(t,33)*this.speed;var s=this.compositions,o=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var a,u=[],h=0;h<s.length;h++){var c=s[h];c.textureOffloaded?(o=!0,X.error("Composition "+c.name+" texture offloaded, skip render."),u.push(c)):(!c.isDestroyed&&c.renderer&&c.update(t),c.isDestroyed||u.push(c))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,o)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(a=this.ticker)?void 0:a.pause();if(!this.paused||e){var l=this.gpuCapability.level,f=this.renderer.context.gl,p=2===l&&this.reportGPUTime?Ie(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var d=0;d<s.length;d++)!s[d].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[d].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){return null==i.reportGPUTime?void 0:i.reportGPUTime.call(i,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},n.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},n.resize=function(){var t,r,i,n,s=this.canvas.parentElement;if(s){var o=this.getTargetSize(s);t=o[0],r=o[1],i=o[2],n=o[3]}else t=i=this.canvas.width,r=n=this.canvas.height;var a=t/r;if(t&&r){var u,h=e.document.documentElement.clientWidth;i>2*h&&X.error("DPI overflowed, width "+i+" is more than 2x document width "+h+", see "+Nc+".");var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>c||n>c)&&(X.error("Container size overflowed "+i+"x"+n+", see "+Dc+"."),a>1?(i=Math.round(c),n=Math.round(c/a)):(n=Math.round(c),i=Math.round(c*a))),this.renderer.resize(i,n),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",X.info("Resize player "+this.name+" ["+i+","+n+","+t+","+r+"]."),null==(u=this.compositions)||u.forEach((function(t){t.camera.aspect=a}))}},n.clearCanvas=function(t){t?this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},n.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},n.dispose=function(t){var r;if(X.info("Call player destroyed: "+this.name+"."),!this.disposed){jc.delete(this.canvas),this.pause(),null==(r=this.ticker)||r.stop(),this.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),this.event&&this.event.dispose(),this.assetService.dispose(),Yc(this,!1),o(this.canvas,e.HTMLCanvasElement)&&!t&&this.renderer.context&&(hu.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i="Never use destroyed player: "+this.name+" again, see "+Uc+".",n=function(){return function(t){throw new Error(t)}(i)},s=function(){return t=i,Promise.reject(t);var t};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},n.getTargetSize=function(t){Zc(t);var r,i,n=this.displayAspect,s=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),o=0,a=0;(s?(o=parseInt(s.width,10),a=parseInt(s.height,10)):(o=t.clientWidth,a=t.clientHeight),n)?o/a>n?r=(i=a*this.displayScale)*n:i=(r=o*this.displayScale)/n:(r=o,i=a);var u=this.pixelRatio,h=r,c=i;if(r=Math.round(r*u),(i=Math.round(i*u))<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+r+"x"+i+", see "+kc+".");r=i=h=c=1}return[h,c,r,i]},n.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},n.handleEmitEvent=function(t,r){this.onError?o(r,e.Event)?this.onError(new Error(r.type,{cause:t}),r):o(r,Error)?this.onError(new Error(r.message,{cause:t}),r):this.onError(new Error("Unknown error.",{cause:t}),r):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,r))},oe(r,[{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}}]),r}(xa);function Yc(t,e){Object.keys(rt).forEach((function(r){var i=rt[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function Zc(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+zc+".")}u([function(t,e,r){var n=r.value;return r.value=i((function(){var e,r,i,s,o=arguments;return h(this,(function(a){switch(a.label){case 0:for(e=o.length,r=new Array(e),i=0;i<e;i++)r[i]=o[i];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.apply(this,r)];case 2:return[2,a.sent()];case 3:return s=a.sent(),t.handleThrowError.call(this,s),[3,4];case 4:return[2]}}))})),r}],Wc.prototype,"loadScene",null),mr.create=function(t,e){return new Zh(t,e)},mr.createWithData=function(t,e,r){void 0===e&&(e=I("#fff")),void 0===r&&(r={});var i=r.type,n=void 0===i?ke.UNSIGNED_BYTE:i,s=r.format,o=void 0===s?ke.RGBA:s,a=r.internalFormat,u=r.wrapS,h=void 0===u?ke.MIRRORED_REPEAT:u,c=r.wrapT,l=void 0===c?ke.MIRRORED_REPEAT:c,f=r.minFilter,p=void 0===f?ke.NEAREST:f,d=r.magFilter,m=void 0===d?ke.NEAREST:d,v=r.flipY,y=void 0!==v&&v;return new Zh(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:o,internalFormat:a||o,wrapS:h,wrapT:l,minFilter:p,magFilter:m,flipY:y})},Pr.create=function(t,e){return new pc(t,e)},Wr.create=function(t,e){return new oc(t,e)},ii.create=function(t,e){return new ii(t,e)},Vi.create=function(t){return new gc(t)},Ui.create=function(t,e){return new bc(t,e)},Bi.create=function(t,e,r){return new Vc(t,e,r)},Gh.create=function(t){return new yc(t)};var qc="2.5.0-alpha.5";X.info("Player version: "+qc+"."),exports.AbstractPlugin=_t,exports.ActivationPlayable=Na,exports.AnimationClipPlayable=ka,exports.Asset=vu,exports.AssetLoader=gu,exports.AssetManager=bh,exports.AssetService=Eh,exports.BYTES_TYPE_MAP=Hr,exports.BaseRenderComponent=Bn,exports.Behaviour=me,exports.BezierCurve=ks,exports.BezierCurvePath=Us,exports.BezierCurveQuat=Bs,exports.COPY_FRAGMENT_SHADER=Nr,exports.COPY_MESH_SHADER_ID=Vr,exports.COPY_VERTEX_SHADER=Dr,exports.CalculateLoader=Oa,exports.Camera=yo,exports.CameraVFXItemLoader=jn,exports.ColorCurve=to,exports.Component=de,exports.Composition=Aa,exports.DEFAULT_FONTS=fu,exports.DEFAULT_FPS=60,exports.Database=xu,exports.Deferred=function(){var t=this;this.promise=new Promise((function(e,r){t.resolve=e,t.reject=r}))},exports.Downloader=Ze,exports.EFFECTS_COPY_MESH_NAME=Fr,exports.EVENT_TYPE_CLICK=Xn,exports.EVENT_TYPE_TOUCH_END=Yn,exports.EVENT_TYPE_TOUCH_MOVE=Wn,exports.EVENT_TYPE_TOUCH_START=Hn,exports.EffectsObject=pe,exports.EffectsPackage=Bh,exports.Ellipse=iu,exports.Engine=Gh,exports.EventEmitter=xa,exports.EventSystem=Zn,exports.Float16ArrayWrapper=ts,exports.Framebuffer=Ui,exports.GLEngine=yc,exports.GLGeometry=oc,exports.GLRenderer=Vc,exports.GPUCapability=Ni,exports.Geometry=Wr,exports.GlobalUniforms=Fi,exports.GradientValue=Ds,exports.GraphicsPath=au,exports.HELP_LINK=Ln,exports.InteractLoader=Jn,exports.InteractMesh=ro,exports.KTXTexture=br,exports.LineSegments=Ns,exports.LinearValue=Vs,exports.MaskProcessor=Ir,exports.Material=Pr,exports.MaterialDataBlock=Sr,exports.Mesh=ii,exports.MeshCollider=so,exports.PLAYER_OPTIONS_ENV_EDITOR=In,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=Io,exports.ParticleBehaviourPlayableAsset=Lo,exports.ParticleLoader=Ma,exports.ParticleMesh=Vo,exports.ParticleSystemRenderer=ko,exports.ParticleTrack=pa,exports.PassTextureCache=jr,exports.PathSegments=zs,exports.Player=Wc,exports.PluginSystem=ot,exports.PolyStar=nu,exports.Polygon=Qa,exports.PropertyTrack=fa,exports.RENDER_PASS_NAME_PREFIX=Si,exports.RENDER_PREFER_LOOKUP_TEXTURE=To,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=Is,exports.RandomValue=Ls,exports.RandomVectorValue=Fs,exports.RenderFrame=Ri,exports.RenderPass=ui,exports.RenderPassPriorityNormal=ni,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=oi,exports.Renderbuffer=Vi,exports.Renderer=Bi,exports.RendererComponent=ve,exports.RuntimeClip=la,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=Pn,exports.SemanticMap=Xr,exports.SerializationHelper=yu,exports.ShaderFactory=Ti,exports.ShaderVariant=Lr,exports.ShapePath=ou,exports.SpriteLoader=oo,exports.StaticValue=Ps,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=Eo,exports.TextComponentBase=du,exports.TextLayout=cu,exports.TextLoader=mu,exports.TextStyle=lu,exports.Texture=mr,exports.TextureFactory=_r,exports.Ticker=jh,exports.TimelineClip=ca,exports.TimelinePlayable=ma,exports.TrackSortWrapper=va,exports.Transform=mo,exports.TransformAnimationPlayable=Da,exports.ValueGetter=Os,exports.Vector2Curve=Qs,exports.Vector4Curve=Ks,exports.addByOrder=V,exports.addItem=y,exports.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(i)for(;t[n-1][r]<s[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>s[r]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},exports.applyMixins=et,exports.assertExist=k,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=tt,exports.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",exports.buildLine=Ha,exports.calculateTranslation=ns,exports.canvasPool=hu,exports.closePointEps=Ba,exports.colorGradingFrag=mi,exports.colorStopsFromGradient=E,exports.colorToArr=b,exports.combineImageTemplate=yh,exports.createCopyShader=kr,exports.createGLContext=Pe,exports.createKeyFrameMeta=Ws,exports.createShape=nn,exports.createValueGetter=$s,exports.curveEps=Ga,exports.decimalEqual=fs,exports.defaultPlugins=it,exports.deserializeMipmapTexture=cr,exports.disableAllPlayer=function(t){Xc=!!t},exports.earcut=wn,exports.effectsClass=ce,exports.effectsClassStore=he,exports.enlargeBuffer=x,exports.ensureFixedNumber=Tu,exports.ensureVec3=ss,exports.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},exports.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",exports.gaussianDownHFrag=vi,exports.gaussianDownVFrag=yi,exports.gaussianUpFrag=gi,exports.generateEmptyTypedArray=Yr,exports.generateGUID=$,exports.generateHalfFloatTexture=vr,exports.generateTransparentTexture=xr,exports.generateWhiteTexture=gr,exports.getActivePlayers=function(){return Array.from(jc.values())},exports.getBackgroundImage=vh,exports.getColorFromGradientStops=T,exports.getConfig=Ao,exports.getDefaultTextureFactory=Ar,exports.getGeometryByShape=Dn,exports.getGeometryTriangles=Vn,exports.getKTXTextureOptions=Tr,exports.getKeyFrameMetaByRawValue=Hs,exports.getMergedStore=fe,exports.getParticleMeshShader=function(t,e,r){var i;void 0===r&&(r="");var n,s=t.content,o=+((null==(i=s.renderer)?void 0:i.renderMode)||0),a=[["RENDER_MODE",o],["ENV_EDITOR",r===In]],u=e.level,h=e.detail,c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,p=(null!=(n=s.positionOverLifetime)?n:{}).speedOverLifetime,d=0,m=0;f&&a.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(a.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Hs(c,p));var v=s.textureSheetAnimation;v&&v.animate&&(a.push(["USE_SPRITE",!0]),m|=4);var y=s.colorOverLifetime;y&&y.color&&(a.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&Hs(c,g);var x,b=s.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[i])&&(Hs(c,b[i]),r=1,m|=1<<7+e),a.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var s=0;(null==b?void 0:b[n])&&(Hs(c,b[n]),s=1,m|=1<<10+e,x=!0),a.push(["ORB_VEL_"+t.toUpperCase(),s])})),(null==b?void 0:b.asMovement)&&(a.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==b?void 0:b.asRotation)&&(a.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),s.sizeOverLifetime){var T=s.sizeOverLifetime;T.separateAxes?(Hs(c,T.x),a.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Hs(c,T.y)):Hs(c,T.size)}if(s.rotationOverLifetime){var E=s.rotationOverLifetime;E.z&&(Hs(c,null==E?void 0:E.z),m|=32768,a.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(Hs(c,E.x),m|=65536,a.push(["ROT_X_LIFETIME",1])),E.y&&(Hs(c,E.y),m|=1<<17,a.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(a.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18)}Hs(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(a.push(["FINAL_TARGET",!0]),m|=1<<19,Hs(c,b.forceCurve));var _=h.halfFloatTexture;_&&l.max&&(m|=1<<20);var A=h.maxVertexUniforms,C=c.max+c.curves.length-32>A;Ao(To)&&(C=!0),2===u&&(c.max=-1,l.index>0&&(l.max=-1)),C&&_&&f&&(d=1);var S=["-p:",o,m,c.index,c.max,l.index,l.max].join("+"),w={fragment:li,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+fi,shared:!0,cacheId:S,macros:a,name:"particle#"+t.name};return a.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:w,vertex:c.index,fragment:l.index}},exports.getPixelRatio=C,exports.getPlayerByCanvas=function(t){return jc.get(t)},exports.getPreMultiAlpha=je,exports.getStandardComposition=uh,exports.getStandardImage=ah,exports.getStandardItem=fh,exports.getStandardJSON=sh,exports.getTextureSize=Mi,exports.glContext=ke,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return $t.Float32;case e.WebGLRenderingContext.SHORT:return $t.Int16;case e.WebGLRenderingContext.BYTE:return $t.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return $t.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return $t.UInt8;default:return $t.Float32}},exports.gpuTimer=Ie,exports.imageDataFromColor=I,exports.imageDataFromGradient=L,exports.initErrors=Ne,exports.initGLContext=ze,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=_,exports.isAlipayMiniApp=O,exports.isAndroid=w,exports.isArray=Y,exports.isCanvas=K,exports.isCanvasUsedByPlayer=function(t){return jc.has(t)},exports.isFunction=Z,exports.isIOS=S,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 O()||P()},exports.isObject=q,exports.isOpenHarmony=R,exports.isSimulatorCellPhone=M,exports.isString=W,exports.isUniformStruct=wr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&wr(t[0])},exports.isValidFontFamily=z,exports.isWebGL2=Ue,exports.isWechatMiniApp=P,exports.itemFrag=ci,exports.itemFrameFrag="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",exports.itemVert=hi,exports.loadAVIFOptional=$e,exports.loadBinary=ir,exports.loadBlob=function(t){return sr.apply(this,arguments)},exports.loadImage=er,exports.loadMedia=ur,exports.loadVideo=or,exports.loadWebPOptional=Qe,exports.logger=X,exports.math=ei,exports.modifyMaxKeyframeShader=function(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var o=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=r;break}}},exports.nearestPowerOfTwo=hs,exports.noop=H,exports.normalizeColor=Ru,exports.numberToFix=ps,exports.parsePercent=A,exports.particleFrag=li,exports.particleOriginTranslateMap=us,exports.particleUniformTypeMap=Fo,exports.particleVert=fi,exports.passRenderLevel=mh,exports.pluginLoaderMap=rt,exports.randomInRange=Q,exports.registerPlugin=st,exports.removeItem=g,exports.rotateVec2=Nn,exports.screenMeshVert=di,exports.serialize=le,exports.setBlendMode=Xe,exports.setConfig=function(t,e){return _o[t]=e},exports.setDefaultTextureFactory=function(t){Er=t},exports.setMaskMode=We,exports.setMaxSpriteMeshItemCount=function(t){exports.maxSpriteMeshItemCount=t},exports.setRayFromCamera=cs,exports.setSideMode=He,exports.setSpriteMeshMaxItemCountByGPU=Ra,exports.sortByOrder=F,exports.spec=ne,exports.thresholdFrag=xi,exports.throwDestroyedError=J,exports.trailVert=pi,exports.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},exports.trianglesFromRect=ls,exports.unregisterPlugin=function(t){delete nt[t],delete rt[t],g(it,t)},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=os,exports.vecMulCombine=as,exports.version=qc,exports.vertexFormatType2GLType=Ge;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/weapp");function r(t,e,r,i,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(i,n)}function i(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var o=t.apply(e,i);function a(t){r(o,n,s,a,u,"next",t)}function u(t){r(o,n,s,a,u,"throw",t)}a(void 0)}))}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):o(t,e)}function a(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function u(t,e,r,i){var n,s=arguments.length,o=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,r,o):n(e,r))||o);return s>3&&o&&Object.defineProperty(e,r,o),o}function h(t,e){var r,i,n,s={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=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;var c=new Uint8Array(16);function l(){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(c)}for(var f=[],p=0;p<256;++p)f.push((p+256).toString(16).slice(1));var d,m={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function v(t,e,r){if(m.randomUUID&&!e&&!t)return m.randomUUID();var i=(t=t||{}).random||(t.rng||l)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=i[n];return e}return function(t,e){return void 0===e&&(e=0),f[t[e+0]]+f[t[e+1]]+f[t[e+2]]+f[t[e+3]]+"-"+f[t[e+4]]+f[t[e+5]]+"-"+f[t[e+6]]+f[t[e+7]]+"-"+f[t[e+8]]+f[t[e+9]]+"-"+f[t[e+10]]+f[t[e+11]]+f[t[e+12]]+f[t[e+13]]+f[t[e+14]]+f[t[e+15]]}(i)}function y(t,e){return t.includes(e)||t.push(e),t}function g(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function x(t,e,r,i){if(void 0===i&&(i=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*i);Number.isNaN(r)||(n=Math.min(n,r));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(s);return o.set(t),o}return t}function b(t,e){var r=[0,0,0,0];if(W(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else o(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var s=0;s<4;s++)r[s]/=255;return r}function T(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var s=t[n-1],o=t[n];if(s.stop<=e&&e<=o.stop){i=_(s.color,o.color,(e-s.stop)/(o.stop-s.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}function E(t){var e=[];if(o(t,Array)?t.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3],o=t[4];e.push({stop:A(r),color:[i,n,s,o]})})):Object.keys(t).forEach((function(r){var i=b(t[r]);e.push({stop:A(r),color:i})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function _(t,e,r,i){var n=[],s=1-r;if(i)for(var o=0;o<4;o++)n[o]=t[o]*s+e[o]*r;else{for(var a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*s+e[a]*e[a]*r));n[3]=Math.round(t[3]*s+e[3]*r)}return n}function A(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function C(){if("object"==typeof e.screen&&"object"==typeof e.document){var t=Math.max(e.document.documentElement.clientWidth,e.window.innerWidth||0),r=e.screen.width/t;return Math.min(2*r,2)}return 1}function S(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function w(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function R(){return/\bOpenHarmony\b/.test(e.navigator.userAgent)}function M(){return w()||R()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function O(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function P(){return"miniprogram"===e.window.__wxjs_environment}function I(t){W(t)&&(t=b(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r}function L(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=E(t);if(n.length){i.set(n[0].color,0);for(var s=1;s<127;s++){for(var o=s/e,a=void 0,u=void 0,h=0;h<n.length&&(a=n[h],u=n[h+1],!(a.stop<=o&&u.stop>o));h++);var c=_(a.color,u.color,(o-a.stop)/(u.stop-a.stop));i.set(c,4*s)}i.set(n[n.length-1].color,508)}return r}function F(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(r<=30){for(var i=1;i<r;i++)D(t,i,e);return t}return N(t,e)}function V(t,e,r){return void 0===r&&(r=2),t.includes(e)?t:(t.push(e),1===t.length||1!==r&&D(t,t.length-1,r),t)}function D(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function N(t,e,r,i){if(void 0===r&&(r=0),void 0===i&&(i=t.length-1),r>=i)return t;for(var n,s=t[r],o=r,a=i;o<a;){if(2===e){for(;t[a].priority>s.priority&&a>=o;)a--;for(;t[o].priority<=s.priority&&o<a;)o++}else{for(;t[a].priority<s.priority&&a>=o;)a--;for(;t[o].priority>=s.priority&&o<a;)o++}var u;u=[t[a],t[o]],t[o]=u[0],t[a]=u[1]}return n=[t[o],t[r]],t[r]=n[0],t[o]=n[1],N(t,e,r,o-1),N(t,e,a+1,i),t}function k(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function z(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(d=exports.OrderType||(exports.OrderType={}))[d.none=1]="none",d[d.ascending=2]="ascending",d[d.descending=3]="descending";var U,B="[Galacean Effects]";function G(t){return["%c"+B,"color: #AA0100",""+t]}var j,X={error:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).error.apply(n,[].concat(G(t),[r])),null==U||U("error",t,r)},info:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).debug.apply(n,[].concat(G(t))),null==U||U("info",t,r)},warn:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).warn.apply(n,[].concat(G(t))),null==U||U("warn",t,r)},register:function(t){t&&Z(t)&&(U=t)}};function H(){}function W(t){return"string"==typeof t}exports.DestroyOptions=void 0,(j=exports.DestroyOptions||(exports.DestroyOptions={}))[j.destroy=0]="destroy",j[j.keep=1]="keep",j[j.force=0]="force";var Y=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Z(t){return"[object Function]"===Object.prototype.toString.call(t)}function q(t){return"[object Object]"===Object.prototype.toString.call(t)}function K(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function Q(t,e){return t+Math.random()*(e-t)}function J(){throw new Error("Destroyed item cannot be used again.")}function $(){return v().replace(/-/g,"")}function tt(t,r,i){void 0===r&&(r="base64File"),void 0===i&&(i="");for(var n=t.split(",")[1]||t,s=e.atob(n),o=[],a=0;a<s.length;a+=512){for(var u=s.slice(a,a+512),h=new Array(u.length),c=0;c<u.length;c++)h[c]=u.charCodeAt(c);var l=new Uint8Array(h);o.push(l)}var f=new e.Blob(o,{type:i});return new File([f],r,{type:i})}function et(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(r){var i=Object.getOwnPropertyDescriptor(e.prototype,r);if(!i)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,r,i)}))}))}var rt={},it=[],nt={};function st(t,e,r){nt[t]&&X.error("Duplicate registration for plugin "+t+"."),nt[t]=r,rt[t]=e,y(it,t)}var ot=function(){function t(t){var e={},r=[];it.forEach((function(t){var i=rt[t];r.includes(i)||(r.push(i),e[t]=i)}));for(var i,n=s(t);!(i=n()).done;){var o=i.value;if(!rt[o])throw new Error("The plugin '"+o+"' not found."+ut(o))}this.plugins=Object.keys(e).map((function(t){var e=new(0,rt[t]);return e.name=t,e})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},e.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},e.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var r,i=s(this.plugins);!(r=i()).done;){r.value.precompile(t,e)}},e.loadResources=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var s=this;return i((function(){var e,i,n,o,a,u,c;return h(this,(function(h){for(e=[],i=s.plugins,n=0;n<i.length;n++)o=i[n],a=rt[o.name],t in a&&e.push(Promise.resolve(null==(c=a[t])?void 0:(u=c).call.apply(u,[].concat([a],r))));return[2,Promise.all(e)]}))}))()},t}(),at={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",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 ut(t){var e=at[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 ht,ct,lt,ft,pt,dt,mt,vt,yt,gt,xt,bt,Tt,Et,_t=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function At(t,e){return At=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},At(t,e)}function Ct(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&&At(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.LATEST="3.3"}(ht||(ht={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ct||(ct={})),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"}(lt||(lt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(ft||(ft={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(pt||(pt={})),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"}(dt||(dt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(mt||(mt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(vt||(vt={})),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"}(yt||(yt={})),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"}(gt||(gt={})),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"}(xt||(xt={})),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"}(bt||(bt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(Tt||(Tt={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Et||(Et={}));var St,wt,Rt,Mt,Ot,Pt,It,Lt,Ft,Vt,Dt,Nt,kt,zt,Ut,Bt,Gt,jt=1,Xt=3,Ht=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(St||(St={})),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"}(wt||(wt={})),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"}(Rt||(Rt={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(Mt||(Mt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ot||(Ot={})),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"}(Pt||(Pt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(It||(It={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Lt||(Lt={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Ft||(Ft={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Vt||(Vt={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Dt||(Dt={})),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"}(Nt||(Nt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(kt||(kt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(zt||(zt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Ut||(Ut={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Bt||(Bt={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Gt||(Gt={}));var Wt,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,re={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!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"}(Wt||(Wt={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Yt||(Yt={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(Zt||(Zt={})),function(t){t.video="video",t.image="image"}(qt||(qt={})),function(t){t.video="video",t.audio="audio"}(Kt||(Kt={})),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.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",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.TimelineClip="TimelineClip"}(Qt||(Qt={})),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"}(Jt||(Jt={})),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"}($t||($t={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(te||(te={})),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"}(ee||(ee={}));var ie=ht.LATEST,ne=Object.freeze({__proto__:null,LATEST_VERSION:ie,get RenderLevel(){return ct},get BlendingMode(){return lt},get SideMode(){return ft},get ObscuredMode(){return pt},get ParticleEmitterShapeType(){return dt},get PluginType(){return mt},get InteractType(){return vt},get InteractBehavior(){return yt},get ItemType(){return gt},get RenderMode(){return xt},get ParticleOrigin(){return bt},get RenderType(){return Tt},get RenderFace(){return Et},get CameraClipMode(){return St},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:jt,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:Xt,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:Ht,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return wt},get BezierKeyframeType(){return Rt},get JSONSceneVersion(){return ht},get EndBehavior(){return Mt},get ParticleInteractionBehavior(){return Ot},get ShapeArcMode(){return Pt},get LightType(){return It},get ModelBoundingType(){return Lt},get CameraType(){return Ft},get MaterialType(){return Vt},get MaterialBlending(){return Dt},get RenderMode3D(){return Nt},get TextOverflow(){return kt},get TextBaseline(){return zt},get TextAlignment(){return Ut},get TextWeight(){return Bt},get FontStyle(){return Gt},BuiltinObjectGUID:re,get ShapePrimitiveType(){return Wt},get LineCap(){return Yt},get LineJoin(){return Zt},get BackgroundType(){return qt},get MultimediaType(){return Kt},get DataType(){return Qt},get GeometryType(){return Jt},get VertexFormatType(){return $t},get IndexFormatType(){return te},get VertexBufferSemantic(){return ee}});function se(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function oe(t,e,r){return e&&se(t.prototype,e),r&&se(t,r),t}var ae=new Map,ue=new Map,he={};function ce(t){return function(e,r){he[t]&&console.warn("Class "+t+" is already registered."),he[t]=e}}function le(t,e){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor;ae.get(e)||ae.set(e,{});return ae.get(e)}(r);n&&(n[i]||(n[i]={type:t,sourceName:e}))}}(t,e)}function fe(t){var e=t.constructor;if(ue.get(e))return ue.get(e);var r={};ue.set(e,r);for(var i=t,n=e;n;){var s=ae.get(n);for(var o in s)r[o]=s[o];var a=Object.getPrototypeOf(i);if((n=Object.getPrototypeOf(a).constructor)===Object)break;i=a}return r}var pe=function(){function t(t){this.engine=t,this.guid=$(),this.defination={},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){},e.dispose=function(){},t.is=function(e){return o(e,t)&&"guid"in e},t}(),de=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}Ct(e,t);var r=e.prototype;return r.onAwake=function(){},r.onEnable=function(){},r.onDisable=function(){},r.onStart=function(){},r.onUpdate=function(t){},r.onLateUpdate=function(t){},r.onDestroy=function(){},r.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},r.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},r.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&g(this.item.components,this)},r.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},oe(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}(pe);u([le()],de.prototype,"item",void 0),u([le()],de.prototype,"_enabled",void 0);var me=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},r.dispose=function(){t.prototype.dispose.call(this)},e}(de),ve=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}Ct(e,t);var r=e.prototype;return r.render=function(t){},r.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},r.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},oe(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}(de);u([le()],ve.prototype,"materials",void 0),u([le()],ve.prototype,"_priority",void 0);var ye=2*Math.PI,ge=Math.PI/180,xe=180/Math.PI,be=1e-6;function Te(t,e){return Math.abs(t-e)<be||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var Ee=function(t,e,r){return(1-r)*t+r*e};function _e(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,s=Math.min(i,n),o=Math.max(i,n);return Math.min(Math.max(t,s),o)}var Ae=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):o(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):o(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):o(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):o(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=be,e=this.x,r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ae.ONE=new Ae(1,1),Ae.ZERO=new Ae(0,0);var Ce=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):o(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):o(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):o(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):o(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var r=t.x,i=t.y,n=t.z,s=e.x,o=e.y,a=e.z;return this.x=i*a-n*o,this.y=n*s-r*a,this.z=r*o-i*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=be,e=this,r=e.x,i=e.y,n=e.z;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new Ae(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ce.X=new Ce(1,0,0),Ce.Y=new Ce(0,1,0),Ce.Z=new Ce(0,0,1),Ce.ONE=new Ce(1,1,1),Ce.ZERO=new Ce(0,0,0);var Se=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var r,i,n,s;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s: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):o(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):o(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):o(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):o(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=be,e=this,r=e.x,i=e.y,n=e.z,s=e.w;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t&&Math.abs(s)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new Ce(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Se.ONE=new Se(1,1,1,1),Se.ZERO=new Se(0,0,0,0);var we=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new so,e.getHitTestParams=function(t){var r=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,r);var i=e.meshCollider.getBoundingBoxData();if(i)return{type:i.type,triangles:i.area}},e}Ct(e,t);var r=e.prototype;return r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.materials[e],e)},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(ve);u([le()],we.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var r;return(r=t.call(this,e)||this).name="EffectComponent",r}Ct(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){var e,r=this.item.time,i=null!=(e=this.material.getVector4("_Time"))?e:new Se;this.material.setVector4("_Time",i.set(r/20,r,2*r,3*r))},r.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(we),exports.EffectComponent=u([ce(Qt.EffectComponent)],exports.EffectComponent),exports.PostProcessVolume=function(t){function e(e){var r;return(r=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},r.vignette={intensity:0,smoothness:0,roundness:0,active:!1},r.tonemapping={active:!1},r.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},r}return Ct(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(de),u([le()],exports.PostProcessVolume.prototype,"bloom",void 0),u([le()],exports.PostProcessVolume.prototype,"vignette",void 0),u([le()],exports.PostProcessVolume.prototype,"tonemapping",void 0),u([le()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=u([ce(Qt.PostProcessVolume)],exports.PostProcessVolume);var Re=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var r,i,n,s;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,s=t/60,o=n*(1-Math.abs(s%2-1)),a=0,u=0,h=0;s>=0&&s<=1?(a=n,u=o):s>=1&&s<=2?(a=o,u=n):s>=2&&s<=3?(u=n,h=o):s>=3&&s<=4?(u=o,h=n):s>=4&&s<=5?(a=o,h=n):s>=5&&s<=6&&(a=n,h=o);var c=r-n;return this.set(a+c,u+c,h+c,i)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):o(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):o(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):o(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):o(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 Se(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,r=e.r,i=e.g,n=e.b,s=e.a,o=Math.max(r,i,n),a=Math.min(r,i,n),u=o-a,h=0,c=0;return 0!==o&&(c=u/o),o!=a&&(o==r?(h=(i-n)/u,i<n&&(h+=6)):o==i?h=(n-r)/u+2:o==n&&(h=(r-i)/u+4),h*=60),new t(h,c,o,s)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+s:"#"+r+i+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();Re.BLACK=new Re(0,0,0,1),Re.BLUE=new Re(0,0,1,1),Re.CLEAR=new Re(0,0,0,0),Re.CYAN=new Re(0,1,1,1),Re.GRAY=new Re(.5,.5,.5,1),Re.GREEN=new Re(0,1,0,1),Re.MAGENTA=new Re(1,0,1,1),Re.RED=new Re(1,0,0,1),Re.WHITE=new Re(1,1,1,1),Re.YELLOW=new Re(1,.92,.016,1);var Me=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(i),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],i=e[4],n=e[8],s=e[1],o=e[5],a=e[9],u=e[2],h=e[6],c=e[10],l=r+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(h-a)*f,this.y=(n-u)*f,this.z=(s-i)*f}else if(r>o&&r>c){var p=2*Math.sqrt(1+r-o-c);this.w=(h-a)/p,this.x=.25*p,this.y=(i+s)/p,this.z=(n+u)/p,this.negate()}else if(o>c){var d=2*Math.sqrt(1+o-r-c);this.w=(n-u)/d,this.x=(i+s)/d,this.y=.25*d,this.z=(a+h)/d,this.negate()}else{var m=2*Math.sqrt(1+c-r-o);this.w=(s-i)/m,this.x=(n+u)/m,this.y=(a+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},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 r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var r=t.x,i=t.y,n=t.z,s=t.w,o=e.x,a=e.y,u=e.z,h=e.w;return this.x=r*h+s*o+i*u-n*a,this.y=i*h+s*a+n*o-r*u,this.z=n*h+s*u+r*a-i*o,this.w=s*h-r*o-i*a-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this,i=r.x,n=r.y,s=r.z,o=r.w,a=o*t.w+i*t.x+n*t.y+s*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=i,this.y=n,this.z=s,this;var u=1-a*a;if(u<=Number.EPSILON){var h=1-e;return this.w=h*o+e*this.w,this.x=h*i+e*this.x,this.y=h*n+e*this.y,this.z=h*s+e*this.z,this.normalize(),this}var c=Math.sqrt(u),l=Math.atan2(c,a),f=Math.sin((1-e)*l)/c,p=Math.sin(e*l)/c;return this.w=o*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=s*f+this.z*p,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this,i=r.x,n=r.y,s=r.z,o=r.w,a=t.x,u=t.y,h=t.z,c=o*a+n*h-s*u,l=o*u+s*a-i*h,f=o*h+i*u-n*a,p=-i*a-n*u-s*h,d=null!=e?e:t;return d.x=c*o+p*-i+l*-s-f*-n,d.y=l*o+p*-n+f*-i-c*-s,d.z=f*o+p*-s+c*-n-l*-i,d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(Ce.ZERO,this,Ce.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return(new t).setFromUnitVectors(e,r)},t}();Me.tempVec0=new Ce;var Oe=function(){function t(t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=s,v[6]=o,v[7]=a,v[8]=u,v[9]=h,v[10]=c,v[11]=l,v[12]=f,v[13]=p,v[14]=d,v[15]=m,this},e.setFromRowMajorData=function(t,e,r,i,n,s,o,a,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=s,v[9]=o,v[13]=a,v[2]=u,v[6]=h,v[10]=c,v[14]=l,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),s=Math.sin(r),o=1-n,a=i.x,u=i.y,h=i.z,c=o*a,l=o*u;return this.set(c*a+n,c*u+s*h,c*h-s*u,0,c*u-s*h,l*u+n,l*h+s*a,0,c*h+s*u,l*h-s*a,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(Ce.ZERO,t,Ce.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,r,i){var n=t.tempVec0,s=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,r),o.normalize(),n.crossVectors(i,o),n.normalize(),s.crossVectors(o,n);var a=this.elements;return a[0]=n.x,a[1]=s.x,a[2]=o.x,a[3]=0,a[4]=n.y,a[5]=s.y,a[6]=o.y,a[7]=0,a[8]=n.z,a[9]=s.z,a[10]=o.z,a[11]=0,a[12]=-n.dot(e),a[13]=-s.dot(e),a[14]=-o.dot(e),a[15]=1,this},e.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},e.multiply=function(t){if("number"==typeof t){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 r=t.elements,i=e.elements,n=this.elements,s=r[0],o=r[4],a=r[8],u=r[12],h=r[1],c=r[5],l=r[9],f=r[13],p=r[2],d=r[6],m=r[10],v=r[14],y=r[3],g=r[7],x=r[11],b=r[15],T=i[0],E=i[4],_=i[8],A=i[12],C=i[1],S=i[5],w=i[9],R=i[13],M=i[2],O=i[6],P=i[10],I=i[14],L=i[3],F=i[7],V=i[11],D=i[15];return n[0]=s*T+o*C+a*M+u*L,n[4]=s*E+o*S+a*O+u*F,n[8]=s*_+o*w+a*P+u*V,n[12]=s*A+o*R+a*I+u*D,n[1]=h*T+c*C+l*M+f*L,n[5]=h*E+c*S+l*O+f*F,n[9]=h*_+c*w+l*P+f*V,n[13]=h*A+c*R+l*I+f*D,n[2]=p*T+d*C+m*M+v*L,n[6]=p*E+d*S+m*O+v*F,n[10]=p*_+d*w+m*P+v*V,n[14]=p*A+d*R+m*I+v*D,n[3]=y*T+g*C+x*M+b*L,n[7]=y*E+g*S+x*O+b*F,n[11]=y*_+g*w+x*P+b*V,n[15]=y*A+g*R+x*I+b*D,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],s=t[1],o=t[5],a=t[9],u=t[13],h=t[2],c=t[6],l=t[10],f=t[14];return t[3]*(+n*a*c-i*u*c-n*o*l+r*u*l+i*o*f-r*a*f)+t[7]*(+e*a*f-e*u*l+n*s*l-i*s*f+i*u*h-n*a*h)+t[11]*(+e*u*c-e*o*f-n*s*c+r*s*f+n*o*h-r*u*h)+t[15]*(-i*o*h-e*a*c+e*o*l+i*s*c-r*s*l+r*a*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],r=t[1],i=t[2],n=t[3],s=t[4],o=t[5],a=t[6],u=t[7],h=t[8],c=t[9],l=t[10],f=t[11],p=t[12],d=t[13],m=t[14],v=t[15],y=c*m*u-d*l*u+d*a*f-o*m*f-c*a*v+o*l*v,g=p*l*u-h*m*u-p*a*f+s*m*f+h*a*v-s*l*v,x=h*d*u-p*c*u+p*o*f-s*d*f-h*o*v+s*c*v,b=p*c*a-h*d*a-p*o*l+s*d*l+h*o*m-s*c*m,T=e*y+r*g+i*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]=(d*l*n-c*m*n-d*i*f+r*m*f+c*i*v-r*l*v)*E,t[2]=(o*m*n-d*a*n+d*i*u-r*m*u-o*i*v+r*a*v)*E,t[3]=(c*a*n-o*l*n-c*i*u+r*l*u+o*i*f-r*a*f)*E,t[4]=g*E,t[5]=(h*m*n-p*l*n+p*i*f-e*m*f-h*i*v+e*l*v)*E,t[6]=(p*a*n-s*m*n-p*i*u+e*m*u+s*i*v-e*a*v)*E,t[7]=(s*l*n-h*a*n+h*i*u-e*l*u-s*i*f+e*a*f)*E,t[8]=x*E,t[9]=(p*c*n-h*d*n-p*r*f+e*d*f+h*r*v-e*c*v)*E,t[10]=(s*d*n-p*o*n+p*r*u-e*d*u-s*r*v+e*o*v)*E,t[11]=(h*o*n-s*c*n-h*r*u+e*c*u+s*r*f-e*o*f)*E,t[12]=b*E,t[13]=(h*d*i-p*c*i+p*r*l-e*d*l-h*r*m+e*c*m)*E,t[14]=(p*o*i-s*d*i-p*r*a+e*d*a+s*r*m-e*o*m)*E,t[15]=(s*c*i-h*o*i+h*r*a-e*c*a-s*r*l+e*o*l)*E,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=Ce.ZERO);var n=this.elements,s=e.x,o=e.y,a=e.z,u=e.w,h=-i.x,c=-i.y,l=-i.z,f=s+s,p=o+o,d=a+a,m=s*f,v=s*p,y=s*d,g=o*p,x=o*d,b=a*d,T=u*f,E=u*p,_=u*d,A=r.x,C=r.y,S=r.z;return n[0]=(1-(g+b))*A,n[1]=(v+_)*A,n[2]=(y-E)*A,n[3]=0,n[4]=(v-_)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*S,n[9]=(x-T)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,r,i){var n=t.tempVec0,s=this.elements,o=n.set(s[0],s[1],s[2]).length(),a=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();this.determinant()<0&&(o=-o),e.x=s[12],e.y=s[13],e.z=s[14];var h=t.tempMat0;h.copyFrom(this);var c=1/o,l=1/a,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,r.setFromRotationMatrix(h),i.x=o,i.y=a,i.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new Ce,e=new Me,r=new Ce;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,s){var o=1/(e-t),a=1/(r-i),u=1/(s-n),h=-(e+t)*o,c=-(r+i)*a,l=-(s+n)*u;o*=2,a*=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]=a,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=c,f[14]=l,f[15]=1,this},e.perspective=function(t,e,r,i,n){var s=1/Math.tan(.5*t),o=1/(r-i),a=this.elements;return a[0]=n?s:s/e,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=n?s*e:s,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(i+r)*o,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*i*r*o,a[15]=0,null!==i&&i!==1/0||(a[10]=-1,a[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;o.x=s[0]*r+s[4]*i+s[8]*n+s[12],o.y=s[1]*r+s[5]*i+s[9]*n+s[13],o.z=s[2]*r+s[6]*i+s[10]*n+s[14];var a=s[3]*r+s[7]*i+s[11]*n+s[15];return o.multiply(1/a)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*r+s[4]*i+s[8]*n+s[12],o.y=s[1]*r+s[5]*i+s[9]*n+s[13],o.z=s[2]*r+s[6]*i+s[10]*n+s[14],o},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*r+s[4]*i+s[8]*n,o.y=s[1]*r+s[5]*i+s[9]*n,o.z=s[2]*r+s[6]*i+s[10]*n,o.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,s=t.w,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12]*s,a.y=o[1]*r+o[5]*i+o[9]*n+o[13]*s,a.z=o[2]*r+o[6]*i+o[10]*n+o[14]*s,a.w=o[3]*r+o[7]*i+o[11]*n+o[15]*s,a},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!Te(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,r,i){return(new t).lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,s){return(new t).perspective(e,r,i,n,s)},t.fromColumnVectors=function(e,r,i,n){return(new t).setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromScale=function(e,r,i){return(new t).setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return(new t).setFromTranslation(e,r,i)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,r){return(new t).setFromRotationAxis(e,r)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,r,i){return(new t).setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return(new t).setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,s,o,a,u,h,c,l,f,p,d,m,v){return new t(e,s,h,p,r,o,c,d,i,a,l,m,n,u,f,v)},t}();function Pe(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"===e&&((i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i}function Ie(t){var r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var n=t.createQuery(),s=i((function(){return h(this,(function(i){return[2,new Promise((function(i,o){if(n){var a=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(r.GPU_DISJOINT_EXT);if(a&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);i(h/1e3/1e3)}(a||u)&&(t.deleteQuery(n),n=null),null!==a&&n&&e.window.setTimeout((function(){s().then(i).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(r.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:s}}}Oe.IDENTITY=new Oe(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Oe.ZERO=new Oe(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Oe.tempVec0=new Ce,Oe.tempVec1=new Ce,Oe.tempVec2=new Ce,Oe.tempMat0=new Oe;var Le,Fe,Ve,De,Ne=[],ke={};function ze(){"function"==typeof e.WebGL2RenderingContext?Be(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(Be(e.WebGLRenderingContext),Be(e.WebGLRenderingContext.prototype)):Ne.push("iOS16 lockdown mode, WebGL Constants not in global"),Ne.length||"HALF_FLOAT"in ke||(ke.HALF_FLOAT=5131)}function Ue(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Be(t){for(var e in t)/^[A-Z_]/.test(e)&&(ke[e]=t[e])}function Ge(t){switch(t){case $t.Float32:return e.WebGLRenderingContext.FLOAT;case $t.Int16:return e.WebGLRenderingContext.SHORT;case $t.Int8:return e.WebGLRenderingContext.BYTE;case $t.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case $t.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}function je(t){switch(t){case lt.ALPHA:case lt.ADD:case lt.SUBTRACTION:case lt.STRONG_LIGHT:case lt.WEAK_LIGHT:return 1;case lt.SUPERPOSITION:return 2;case lt.BRIGHTNESS:return 3;case lt.MULTIPLY:return 0;default:return 1}}function Xe(t,e){switch(e){case void 0:case lt.ALPHA:t.blendFunction=[ke.ONE,ke.ONE_MINUS_SRC_ALPHA,ke.ONE,ke.ONE_MINUS_SRC_ALPHA];break;case lt.ADD:t.blendFunction=[ke.ONE,ke.ONE,ke.ONE,ke.ONE];break;case lt.SUBTRACTION:t.blendFunction=[ke.ONE,ke.ONE,ke.ZERO,ke.ONE],t.blendEquation=[ke.FUNC_REVERSE_SUBTRACT,ke.FUNC_REVERSE_SUBTRACT];break;case lt.SUPERPOSITION:t.blendFunction=[ke.ONE,ke.ONE,ke.ONE,ke.ONE];break;case lt.MULTIPLY:t.blendFunction=[ke.DST_COLOR,ke.ONE_MINUS_SRC_ALPHA,ke.DST_COLOR,ke.ONE_MINUS_SRC_ALPHA];break;case lt.BRIGHTNESS:t.blendFunction=[ke.ONE,ke.ONE_MINUS_SRC_ALPHA,ke.ONE,ke.ONE_MINUS_SRC_ALPHA];break;case lt.STRONG_LIGHT:t.blendFunction=[ke.DST_COLOR,ke.DST_ALPHA,ke.ZERO,ke.ONE];break;case lt.WEAK_LIGHT:t.blendFunction=[ke.DST_COLOR,ke.ZERO,ke.ZERO,ke.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function He(t,e){e===ft.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=ke.CW,t.cullFace=e===ft.BACK?ke.BACK:ke.FRONT)}function We(t,e){switch(e){case void 0:t.stencilTest=!1;break;case exports.MaskMode.MASK:t.stencilTest=!0,t.stencilFunc=[ke.ALWAYS,ke.ALWAYS],t.stencilOpZPass=[ke.REPLACE,ke.REPLACE];break;case exports.MaskMode.OBSCURED:t.stencilTest=!0,t.stencilFunc=[ke.EQUAL,ke.EQUAL];break;case exports.MaskMode.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[ke.NOTEQUAL,ke.NOTEQUAL];break;case exports.MaskMode.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function Ye(){return Ye=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ye.apply(this,arguments)}Ne.length||ze(),exports.ShaderType=void 0,(Le=exports.ShaderType||(exports.ShaderType={}))[Le.vertex=0]="vertex",Le[Le.fragment=1]="fragment",exports.MaskMode=void 0,(Fe=exports.MaskMode||(exports.MaskMode={}))[Fe.NONE=0]="NONE",Fe[Fe.MASK=1]="MASK",Fe[Fe.OBSCURED=2]="OBSCURED",Fe[Fe.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",exports.TextureLoadAction=void 0,(Ve=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Ve.whatever=0]="whatever",Ve[Ve.clear=2]="clear",exports.TextureSourceType=void 0,(De=exports.TextureSourceType||(exports.TextureSourceType={}))[De.none=0]="none",De[De.data=1]="data",De[De.image=2]="image",De[De.compressed=3]="compressed",De[De.video=4]="video",De[De.canvas=5]="canvas",De[De.framebuffer=6]="framebuffer",De[De.mipmaps=7]="mipmaps";var Ze=function(){function t(){this.callbacks={}}var r=t.prototype;return r.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},r.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},r.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},r.download=function(t,r,i,n){var s=this;if(void 0===r&&(r="json"),!this.start(t,i,n)){var o=new e.XMLHttpRequest,a=function(){s.finish(t,o.status,o.response)};o.responseType=r,o.addEventListener("load",(function(){200==o.status?s.finish(t,200,o.response):a()})),o.addEventListener("error",a),o.open("GET",t,!0),o.send()}},r.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},r.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[r]:[e,r],s=n.length-1,o=i.length;s<o;s+=2)i[s].apply(null,n)},t}(),qe=!1,Ke=!1;function Qe(t,e){return Je.apply(this,arguments)}function Je(){return(Je=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!qe&&e?[3,2]:[4,er(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,er(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),qe=!0,[4,er(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function $e(t,e){return tr.apply(this,arguments)}function tr(){return(tr=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!Ke&&e?[3,2]:[4,er(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,er(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Ke=!0,[4,er(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function er(t){return rr.apply(this,arguments)}function rr(){return(rr=i((function(t){var r,i;return h(this,(function(n){if(r="",o(t,e.HTMLImageElement)){if(t.complete)return[2,t];r=t.src}else o(t,e.Blob)?(r=e.URL.createObjectURL(t),i=!0):"string"==typeof t&&(r=t);if(!r)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var s=new e.Image;/^data:/.test(r)||(s.crossOrigin="*"),s.onload=function(){return s.onload=null,i&&e.URL.revokeObjectURL(r),t(s)},s.onerror=function(t){return s.onerror=null,i&&e.URL.revokeObjectURL(r),n("Load image fail: "+r+", reason: "+JSON.stringify(t))},s.src=r}))]}))}))).apply(this,arguments)}function ir(t){return nr.apply(this,arguments)}function nr(){return(nr=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Ze).downloadBinary(t,e,(function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function sr(){return(sr=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Ze).downloadBlob(t,e,(function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function or(t){return ar.apply(this,arguments)}function ar(){return(ar=i((function(t){var r;return h(this,(function(i){return r=e.document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,w()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e("Load video fail.")}))}))]}))}))).apply(this,arguments)}function ur(t,e){return hr.apply(this,arguments)}function hr(){return(hr=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 4:return[2,r.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function cr(t,e,r){return lr.apply(this,arguments)}function lr(){return(lr=i((function(t,e,r,i){var n,s,o,a,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:return void 0===i&&(i=[]),34067!==t.target?[3,2]:(n=t.mipmaps,s=t.target,o=n.map((function(t){return Promise.all(t.map((function(t){return t.id?r[t.id]:fr(t,e)})))})),[4,Promise.all(o)]);case 1:return a=h.sent(),[2,Ye({keepImageSource:!1},t,{mipmaps:a,sourceFrom:{target:s,type:exports.TextureSourceType.mipmaps}})];case 2:return u=t.mipmaps,c=t.target,l=u.map((function(t){return fr(t,e)})),[4,Promise.all(l)];case 3:return f=h.sent(),p=i[u[0][1][0]].url,[2,Ye({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:p,type:exports.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function fr(t,e){return pr.apply(this,arguments)}function pr(){return pr=i((function(t,r){var i,n,s,o,a;return h(this,(function(u){if(i=t[1],n=i[0],s=i[1],o=i[2],!(a=r[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,er(new e.Blob([new Uint8Array(a,s,o)]))]}))})),pr.apply(this,arguments)}var dr=1,mr=function(t){function e(e){var r;return(r=t.call(this,e)||this).destroyed=!1,r.id="Tex"+dr++,r}Ct(e,t);var r=e.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(t){var e=t.target,r=void 0===e?ke.TEXTURE_2D:e,i=t.format,n=void 0===i?ke.RGBA:i;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),Ye({minFilter:ke.NEAREST,magFilter:ke.NEAREST,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE,target:r,format:ke.RGBA,internalFormat:n,type:ke.UNSIGNED_BYTE},t)},e.fromImage=function(t,r,n){return i((function(){var i,s;return h(this,(function(o){switch(o.label){case 0:return[4,er(t)];case 1:return i=o.sent(),(s=e.create(r,Ye({sourceType:exports.TextureSourceType.image,image:i,target:ke.TEXTURE_2D,id:$(),flipY:!0},n))).initialize(),[2,s]}}))}))()},e.fromVideo=function(t,r,n){return i((function(){var i,s;return h(this,(function(o){switch(o.label){case 0:return[4,or(t)];case 1:return i=o.sent(),(s=e.create(r,Ye({sourceType:exports.TextureSourceType.video,video:i,id:$(),flipY:!0},n))).initialize(),[2,s]}}))}))()},oe(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(pe);function vr(t,e,r,i){var n,s,o=e.length/r/i;return s=n=4===o||0===o?ke.RGBA:3===o?ke.RGB:2===o?ke.LUMINANCE_ALPHA:ke.LUMINANCE,mr.createWithData(t,{data:e,width:r,height:i},{type:ke.HALF_FLOAT,format:n,internalFormat:s,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE})}var yr={type:ke.UNSIGNED_BYTE,format:ke.RGBA,internalFormat:ke.RGBA,wrapS:ke.MIRRORED_REPEAT,wrapT:ke.MIRRORED_REPEAT,minFilter:ke.NEAREST,magFilter:ke.NEAREST};function gr(t){return mr.create(t,Ye({id:re.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},yr))}function xr(t){return mr.create(t,Ye({id:re.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},yr))}var br=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===s.getUint32(0,!0);this.glType=s.getUint32(1*n,o),this.glTypeSize=s.getUint32(2*n,o),this.glFormat=s.getUint32(3*n,o),this.glInternalFormat=s.getUint32(4*n,o),this.glBaseInternalFormat=s.getUint32(5*n,o),this.pixelWidth=s.getUint32(6*n,o),this.pixelHeight=s.getUint32(7*n,o),this.pixelDepth=s.getUint32(8*n,o),this.numberOfArrayElements=s.getUint32(9*n,o),this.numberOfFaces=s.getUint32(10*n,o),this.numberOfMipmapLevels=s.getUint32(11*n,o),this.bytesOfKeyValueData=s.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:X.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):X.warn("Texture arrays not currently supported."):X.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,o=0;o<s;o++){for(var a=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,a);e.push({data:h,width:i,height:n}),r+=a+4,r+=3-(a+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function Tr(t){var e=new br(t,1),r=e.numberOfMipmapLevels,i=e.pixelWidth,n=e.pixelHeight,s=e.glType,o=e.numberOfFaces,a=e.glInternalFormat,u=e.glFormat,h=r>=Math.floor(Math.log2(Math.max(i,n))+1);return{sourceType:exports.TextureSourceType.compressed,type:s,target:6===o?ke.TEXTURE_CUBE_MAP:ke.TEXTURE_2D,internalFormat:a,format:u,mipmaps:e.mipmaps(h)}}var Er,_r=function(){function t(){this.reloadPending={}}var r=t.prototype;return r.reload=function(t){var e=this;return i((function(){var r,i;return h(this,(function(n){switch(n.label){case 0:return r=t.id,e.reloadPending[r]?[2]:t.sourceFrom?(e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},r.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var r=t.target,i=t.map,n=t.url;return r===ke.TEXTURE_CUBE_MAP?"object"==typeof i&&!!i:W(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var s=t.bin,o=t.mipmaps,a=t.target,u=t.maps,h=t.urls;return s?o.length>0:a===ke.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return W(t)&&t.length>0}))}}return!1},r.loadSource=function(t,e){var r=this;return i((function(){var i,n,s,o,a,u,c,l,f,p,d,m,v,y,g,x,b;return h(this,(function(h){switch(h.label){case 0:return i=t.type,n=t.target,s=t.map,o=t.url,a=t.bin,u=t.mipmaps,c=t.urls,l=t.maps,n!==ke.TEXTURE_CUBE_MAP||i===exports.TextureSourceType.mipmaps?[3,2]:[4,r.loadCubeMap(s)];case 1:return f=h.sent(),[2,Ye({},e,{cube:f,target:ke.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:Ye({},s),target:ke.TEXTURE_CUBE_MAP}})];case 2:return i!==exports.TextureSourceType.image?[3,4]:[4,er(o)];case 3:return p=h.sent(),[2,Ye({},e,{image:p,sourceType:exports.TextureSourceType.image,sourceFrom:{type:i,url:o,target:ke.TEXTURE_2D}})];case 4:return i!==exports.TextureSourceType.video?[3,6]:[4,or(o)];case 5:return d=h.sent(),[2,Ye({},e,{video:d,sourceType:exports.TextureSourceType.video})];case 6:return i!==exports.TextureSourceType.compressed?[3,8]:[4,ir(o)];case 7:return[2,Ye({},Tr(h.sent()),e,{sourceFrom:{url:o,type:exports.TextureSourceType.compressed}})];case 8:return i!==exports.TextureSourceType.mipmaps?[3,17]:a?[4,ir(a)]:[3,13];case 9:return m=h.sent(),v=null!=n?n:ke.TEXTURE_2D,y=v===ke.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==ke.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return r.loadMipmapImages(t,m)})))];case 10:return g=h.sent(),[3,12];case 11:g=r.loadMipmapImages(u,m),h.label=12;case 12:return[2,Ye({},e,{mipmaps:g,target:v,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:a,mipmaps:y,target:v,type:exports.TextureSourceType.mipmaps}})];case 13:return n!==ke.TEXTURE_2D&&n?[3,15]:[4,Promise.all(c.map((function(t){return er(t)})))];case 14:return x=h.sent(),[2,Ye({},e,{mipmaps:x,target:ke.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:ke.TEXTURE_2D}})];case 15:return n!==ke.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(l.map((function(t){return r.loadCubeMap(t)})))];case 16:return b=h.sent(),[2,Ye({},e,{mipmaps:b,target:ke.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:l.map((function(t){return Ye({},t)})),target:ke.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+i+".")}}))}))()},r.loadMipmapImages=function(t,r){return i((function(){return h(this,(function(i){return[2,Promise.all(t.map((function(t){return er(new e.Blob([new Uint8Array(r,t[0],t[1])]))})))]}))}))()},r.loadCubeMap=function(t){return i((function(){return h(this,(function(e){return[2,Promise.all(t.map((function(t){return er(t)})))]}))}))()},t}();function Ar(){return Er||(Er=new _r),Er}var Cr,Sr=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function wr(t){return"object"==typeof t&&t&&void 0===t.length&&o(t,mr)}exports.MaterialRenderType=void 0,(Cr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[Cr.normal=0]="normal",Cr[Cr.transformFeedback=1]="transformFeedback";var Rr,Mr,Or=1,Pr=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).stringTags={},i.enabledMacros={},i.destroyed=!1,i.initialized=!1,i.shaderDirty=!0,r){var n=r.name,s=void 0===n?"Material"+Or++:n,o=r.renderType,a=void 0===o?0:o,u=r.shader,h=r.uniformSemantics;i.name=s,i.renderType=a,i.shaderSource=u,i.props=r,i.uniformSemantics=Ye({},h)}else i.name="Material"+Or++,i.renderType=0;return i}Ct(e,t);var r=e.prototype;return r.initialize=function(){},r.createShaderVariant=function(){},r.use=function(t,e){},oe(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",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(pe),Ir=function(){function t(t){this.engine=t,this.alphaMaskEnabled=!1,this.maskMode=exports.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:exports.TextureLoadAction.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.getMaskMode=function(t){var e=t.isMask,r=void 0!==e&&e,i=t.inverted,n=void 0!==i&&i,s=t.reference,o=t.alphaMaskEnabled,a=void 0!==o&&o;return this.alphaMaskEnabled=a,r?this.maskMode=exports.MaskMode.MASK:(this.maskMode=n?exports.MaskMode.REVERSE_OBSCURED:exports.MaskMode.OBSCURED,s&&(this.maskable=this.engine.findObject(s))),this.maskMode},e.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},t}();exports.ShaderCompileResultStatus=void 0,(Rr=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[Rr.noShader=0]="noShader",Rr[Rr.success=1]="success",Rr[Rr.fail=2]="fail",Rr[Rr.compiling=3]="compiling",exports.GLSLVersion=void 0,(Mr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",Mr.GLSL3="300 es";var Lr=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return Ct(e,t),e}(pe);exports.Shader=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=s(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(pe),exports.Shader=u([ce(Qt.Shader)],exports.Shader);var Fr="effects-internal-copy",Vr="effects-internal-copy-mesh",Dr="\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}",Nr="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function kr(t,e){return{name:Fr,vertex:Dr,fragment:Nr,glslVersion:2===t?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:Vr+ +e}}var zr,Ur,Br={format:ke.RGBA,type:ke.UNSIGNED_BYTE,minFilter:ke.LINEAR,magFilter:ke.LINEAR,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE},Gr=Symbol("dispose"),jr=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,r=t.width,i=t.height,n=t.name,s={sourceType:exports.TextureSourceType.framebuffer,data:{width:r,height:i},name:n},o=[n];Object.getOwnPropertyNames(Br).forEach((function(e){var r,i=null!=(r=t[e])?r:Br[e];s[e]=i,o.push(e,i)}));var a=o.join(":"),u=this.textureCache[a];if(u)this.textureRef[a]++;else{var h=this.engine;k(h),u=mr.create(h,s),this.textureCache[a]=u,this.textureRef[a]=1,u[Gr]=u.dispose,u.dispose=function(){return e.removeTexture(a)}}return u},e.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var r=this.textureCache[t];r&&(r[Gr](),r.dispose=r[Gr]),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 r=t.textureCache[e];r[Gr](),r.dispose=r[Gr]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Xr=function(){function t(t){void 0===t&&(t={}),this.semantics=Ye({},t)}var e=t.prototype;return e.toObject=function(){return Ye({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return Z(r)?r(e):r},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),Hr=((zr={})[ke.FLOAT]=Float32Array.BYTES_PER_ELEMENT,zr[ke.INT]=Int32Array.BYTES_PER_ELEMENT,zr[ke.SHORT]=Int16Array.BYTES_PER_ELEMENT,zr[ke.BYTE]=Int8Array.BYTES_PER_ELEMENT,zr),Wr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}Ct(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(pe);function Yr(t){return t===ke.INT?new Int32Array(0):t===ke.SHORT?new Int16Array(0):new Float32Array(0)}!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"}(Ur||(Ur={}));var Zr=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var r=t.elements,i=r[0],n=r[4],s=r[8],o=r[1],a=r[5],u=r[9],h=r[2],c=r[6],l=r[10];switch(e){case Ur.XYZ:this.y=Math.asin(_e(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,a),this.z=0);break;case Ur.YXZ:this.x=Math.asin(-_e(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(s,l),this.z=Math.atan2(o,a)):(this.y=Math.atan2(-h,i),this.z=0);break;case Ur.ZXY:this.x=Math.asin(_e(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,a)):(this.y=0,this.z=Math.atan2(o,i));break;case Ur.ZYX:this.y=Math.asin(-_e(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(c,l),this.z=Math.atan2(o,i)):(this.x=0,this.z=Math.atan2(-n,a));break;case Ur.YZX:this.z=Math.asin(_e(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,a),this.y=Math.atan2(-h,i)):(this.x=0,this.y=Math.atan2(s,l));break;case Ur.XZY:this.z=Math.asin(-_e(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,a),this.y=Math.atan2(s,i)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=xe,this.y*=xe,this.z*=xe,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,r){var i,n,s,o;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(o=t[e+3])?o:r,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(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 Me;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this,r=e.x,i=e.y,n=e.z,s=e.order,o=Math.cos(r*ge*.5),a=Math.cos(i*ge*.5),u=Math.cos(n*ge*.5),h=Math.sin(r*ge*.5),c=Math.sin(i*ge*.5),l=Math.sin(n*ge*.5);switch(s){case Ur.XYZ:t.set(h*a*u+o*c*l,o*c*u-h*a*l,o*a*l+h*c*u,o*a*u-h*c*l);break;case Ur.YXZ:t.set(h*a*u+o*c*l,o*c*u-h*a*l,o*a*l-h*c*u,o*a*u+h*c*l);break;case Ur.ZXY:t.set(h*a*u-o*c*l,o*c*u+h*a*l,o*a*l+h*c*u,o*a*u-h*c*l);break;case Ur.ZYX:t.set(h*a*u-o*c*l,o*c*u+h*a*l,o*a*l-h*c*u,o*a*u+h*c*l);break;case Ur.YZX:t.set(h*a*u+o*c*l,o*c*u+h*a*l,o*a*l-h*c*u,o*a*u-h*c*l);break;case Ur.XZY:t.set(h*a*u-o*c*l,o*c*u-h*a*l,o*a*l+h*c*u,o*a*u+h*c*l);break;default:console.error("unknown euler order: "+s)}return t},e.toMatrix4=function(t){var e=t.elements,r=this,i=r.x,n=r.y,s=r.z,o=r.order,a=Math.cos(i*ge),u=Math.sin(i*ge),h=Math.cos(n*ge),c=Math.sin(n*ge),l=Math.cos(s*ge),f=Math.sin(s*ge);if(o===Ur.XYZ){var p=a*l,d=a*f,m=u*l,v=u*f;e[0]=h*l,e[4]=-h*f,e[8]=c,e[1]=d+m*c,e[5]=p-v*c,e[9]=-u*h,e[2]=v-p*c,e[6]=m+d*c,e[10]=a*h}else if(o===Ur.YXZ){var y=h*l,g=h*f,x=c*l,b=c*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=a*c,e[1]=a*f,e[5]=a*l,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=a*h}else if(o===Ur.ZXY){var T=h*l,E=h*f,_=c*l,A=c*f;e[0]=T-A*u,e[4]=-a*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=a*l,e[9]=A-T*u,e[2]=-a*c,e[6]=u,e[10]=a*h}else if(o===Ur.ZYX){var C=a*l,S=a*f,w=u*l,R=u*f;e[0]=h*l,e[4]=w*c-S,e[8]=C*c+R,e[1]=h*f,e[5]=R*c+C,e[9]=S*c-w,e[2]=-c,e[6]=u*h,e[10]=a*h}else if(o===Ur.YZX){var M=a*h,O=a*c,P=u*h,I=u*c;e[0]=h*l,e[4]=I-M*f,e[8]=P*f+O,e[1]=f,e[5]=a*l,e[9]=-u*l,e[2]=-c*l,e[6]=O*f+P,e[10]=M-I*f}else if(o===Ur.XZY){var L=a*h,F=a*c,V=u*h,D=u*c;e[0]=h*l,e[4]=-f,e[8]=c*l,e[1]=L*f+D,e[5]=a*l,e[9]=F*f-V,e[2]=V*f-F,e[6]=u*l,e[10]=D*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,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromArray(e,r,i)},t}();Zr.DEFAULT_ORDER=Ur.ZYX,Zr.tempQuat0=new Me,Zr.tempMat0=new Oe;var qr=function(){function t(t,e,r,i,n,s,o,a,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,s,o,a,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,o,a,u){var h=this.elements;return h[0]=t,h[3]=i,h[6]=o,h[1]=e,h[4]=n,h[7]=a,h[2]=r,h[5]=s,h[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,s,o,a,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=r,h[1]=i,h[4]=n,h[7]=s,h[2]=o,h[5]=a,h[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,s=e+e,o=r+r,a=i+i,u=e*s,h=e*o,c=e*a,l=r*o,f=r*a,p=i*a,d=n*s,m=n*o,v=n*a,y=this.elements;return y[0]=1-(l+p),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+p),y[5]=f+d,y[6]=c+m,y[7]=f-d,y[8]=1-(u+l),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],s=i[3],o=i[6],a=i[1],u=i[4],h=i[7];return i[0]=e*n+r*a,i[3]=e*s+r*u,i[6]=e*o+r*h,i[1]=-r*n+e*a,i[4]=-r*s+e*u,i[7]=-r*o+e*h,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},e.multiply=function(t){if("number"==typeof t){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 r=t.elements,i=e.elements,n=this.elements,s=r[0],o=r[3],a=r[6],u=r[1],h=r[4],c=r[7],l=r[2],f=r[5],p=r[8],d=i[0],m=i[3],v=i[6],y=i[1],g=i[4],x=i[7],b=i[2],T=i[5],E=i[8];return n[0]=s*d+o*y+a*b,n[3]=s*m+o*g+a*T,n[6]=s*v+o*x+a*E,n[1]=u*d+h*y+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*d+f*y+p*b,n[5]=l*m+f*g+p*T,n[8]=l*v+f*x+p*E,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],o=t[7],a=t[2],u=t[5],h=t[8];return e*(s*h-u*o)+n*(u*i-r*h)+a*(r*o-s*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],o=t[7],a=t[2],u=t[5],h=t[8],c=h*s-u*o,l=u*i-h*r,f=o*r-s*i,p=e*c+n*l+a*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=c*d,t[1]=(a*o-h*n)*d,t[2]=(u*n-a*s)*d,t[3]=l*d,t[4]=(h*e-a*i)*d,t[5]=(a*r-u*e)*d,t[6]=f*d,t[7]=(n*i-o*e)*d,t[8]=(s*e-n*r)*d,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,o=null!=e?e:t;return o.x=s[0]*r+s[3]*i+s[6]*n,o.y=s[1]*r+s[4]*i+s[7]*n,o.z=s[2]*r+s[5]*i+s[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!Te(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,s,o,a,u,h){return new t(e,n,a,r,s,u,i,o,h)},t}(),Kr=function(){function t(t,e){void 0===t&&(t=Ce.ZERO),void 0===e&&(e=Ce.X),this.origin=new Ce,this.direction=new Ce,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var r=e||new Ce;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var r,i,n,s,o,a,u=this.origin,h=u.x,c=u.y,l=u.z,f=this.direction,p=f.x,d=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,A=1/p,C=1/d,S=1/m;if(A>=0?(r=(y-h)*A,i=(T-h)*A):(r=(T-h)*A,i=(y-h)*A),C>=0?(n=(g-c)*C,s=(E-c)*C):(n=(E-c)*C,s=(g-c)*C),!(r>s||n>i||((n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),(n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),S>=0?(o=(x-l)*S,a=(_-l)*S):(o=(_-l)*S,a=(x-l)*S),r>a||o>i||((o>r||r!=r)&&(r=o),(a<i||i!=i)&&(i=a),i<0))))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new Ce).copyFrom(this.origin):void 0;var s=-(this.origin.dot(r)+i)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),s=n.dot(this.direction),o=n.dot(n)-s*s,a=e.radius*e.radius;if(!(o>a)){var u=Math.sqrt(a-o),h=s-u,c=s+u;if(!(c<0))return h>=0?this.at(h,r):this.at(c,r)}},e.intersectTriangle=function(e,r,i){var n,s=e.p0,o=e.p1,a=e.p2,u=t.tempVec0.subtractVectors(o,s),h=t.tempVec1.subtractVectors(a,s),c=t.tempVec2.subtractVectors(this.origin,s),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var p=n*this.direction.dot(h);if(!(p<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,r)}}},t}();Kr.tempVec0=new Ce,Kr.tempVec1=new Ce,Kr.tempVec2=new Ce,Kr.tempVec3=new Ce;var Qr,Jr,$r=function(){function t(t,e){void 0===t&&(t=new Ce(1/0,1/0,1/0)),void 0===e&&(e=new Ce(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),r=Number(1/0),i=Number(1/0),n=-1/0,s=-1/0,o=-1/0,a=0,u=t.length;a<u;a+=3){var h=t[a],c=t[a+1],l=t[a+2];h<e&&(e=h),c<r&&(r=c),l<i&&(i=l),h>n&&(n=h),c>s&&(s=c),l>o&&(o=l)}return this.min.set(e,r,i),this.max.set(n,s,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new t).copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new Ce),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 Ce),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,s=0,o=n.length;s<o;s++)this.expandByObject(n[s]);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 Ce),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 Ce;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 Ce),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 Ce),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new Ce),this.isEmpty())return[];var r=[];return r[0]=new Ce(this.min.x,this.min.y,this.min.z),r[1]=new Ce(this.min.x,this.min.y,this.max.z),r[2]=new Ce(this.min.x,this.max.y,this.min.z),r[3]=new Ce(this.min.x,this.max.y,this.max.z),r[4]=new Ce(this.max.x,this.min.y,this.min.z),r[5]=new Ce(this.max.x,this.min.y,this.max.z),r[6]=new Ce(this.max.x,this.max.y,this.min.z),r[7]=new Ce(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new Ce;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}(),ti=function(){function t(t,e){void 0===t&&(t=Ce.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var s=(new $r).setFromPoints(t);s.getCenter(r),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new Ce),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(t=new $r),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],s=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*s,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new Ce).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new Ce,r=new Ce;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=(new Ce).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),ei=Object.freeze({__proto__:null,get EulerOrder(){return Ur},Euler:Zr,Quaternion:Me,Vector2:Ae,Vector3:Ce,Vector4:Se,Matrix3:qr,Matrix4:Oe,Ray:Kr,PI2:ye,DEG2RAD:ge,RAD2DEG:xe,NumberEpsilon:be,isZero:function(t){return isNaN(t)||Math.abs(t)<be},isEqual:Te,damp:function(t,e,r,i){return Ee(t,e,1-Math.exp(-r*i))},lerp:Ee,degToRad:function(t){return t*ge},radToDeg:function(t){return t*xe},clamp:_e,Color:Re,Box3:$r,Sphere:ti}),ri=1,ii=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).destroyed=!1,i.visible=!0,r){var n=r.material,s=r.geometry,o=r.name,a=void 0===o?"<unnamed>":o,u=r.priority,h=void 0===u?0:u,c=r.worldMatrix,l=void 0===c?Oe.fromIdentity():c;i.id="Mesh"+ri++,i.name=a,i.geometry=s,i.material=n,i.priority=h,i.worldMatrix=l}else i.id="Mesh"+ri++,i.name="<unnamed>",i.worldMatrix=Oe.fromIdentity(),i._priority=0;return i}Ct(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){this.isDestroyed||this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.material=t},r.restore=function(){},r.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},oe(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(ve),ni=1e3;exports.RenderPassAttachmentStorageType=void 0,(Qr=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[Qr.none=0]="none",Qr[Qr.color=1]="color",Qr[Qr.stencil_8_opaque=2]="stencil_8_opaque",Qr[Qr.depth_16_opaque=3]="depth_16_opaque",Qr[Qr.depth_stencil_opaque=4]="depth_stencil_opaque",Qr[Qr.depth_16_texture=5]="depth_16_texture",Qr[Qr.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(Jr=exports.TextureStoreAction||(exports.TextureStoreAction={}))[Jr.store=0]="store",Jr[Jr.clear=2]="clear";var si,oi=function(){function t(t,e){if(this.destroyed=!1,e){var r=e.texture,i=e.size;if(o(r,mr))this.texture=r,this.externalTexture=!0;else if(r){var n=r.wrapT,s=r.wrapS,a=r.minFilter,u=r.magFilter,h=r.internalFormat,c=r.format,l=void 0===c?ke.RGBA:c,f=r.type,p=void 0===f?ke.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:i,format:l,type:p,internalFormat:h||l,wrapT:n,wrapS:s,minFilter:a,magFilter:u,name:e.name},this.texture=mr.create(t,Ye({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:i[0],height:i[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},oe(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,(si=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[si.force=0]="force",si[si.keep=1]="keep",si[si.keepExternal=2]="keepExternal",si[si.destroy=0]="destroy";var ai=1,ui=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"RenderPass_"+ai++:r,n=e.clearAction,s=e.semantics,o=e.depthStencilAttachment,a=e.storeAction,u=e.priority,h=void 0===u?0:u,c=e.meshOrder,l=void 0===c?exports.OrderType.ascending:c,f=e.meshes,p=void 0===f?[]:f,d=e.delegate,m=void 0===d?{}:d;this.name=i,this.renderer=t,this.priority=h,this.meshOrder=l,this.meshes=F(p.slice(),this.meshOrder),this.depthStencilType=(null==o?void 0:o.storageType)||0,this.clearAction=Ye({},n),this.storeAction=Ye({colorAction:0,depthAction:0,stencilAction:0},a),this.semantics=new Xr(s),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){V(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){g(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),F(this.meshes,this.meshOrder),this.meshes},e.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),r=e[0],i=e[1],n=e[2],s=e[3];t.setViewport(r,i,n,s)}},e.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.frameCleanup=function(t){},e.resetColorAttachments=function(t){var e=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=t.map((function(t){return t.updateSource({sourceType:exports.TextureSourceType.framebuffer}),new oi(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(t.map((function(t){return t}))))}else this.resetAttachments({attachments:t.map((function(t){return{texture:t}}))})},e.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},e._resetAttachments=function(){var t,e,r=this,i=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,i.getWidth()*s,i.getHeight()*s],a=[o[2],o[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var i;return new oi(r.renderer.engine,Ye({size:a,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))}));this.attachments=h;var c=Ui.create({storeAction:this.storeAction,name:u,viewport:o,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);c.bind(),c.unbind(),this.framebuffer=c}else this.attachments.length=0},e.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:r}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:r}}},e.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){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;var r=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===r||1===r||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var i,n,s=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,o=this.framebuffer;if(o)if(o.dispose({depthStencilAttachment:s}),!(o.externalStorage&&2===s||1===s))null==(i=this.stencilTexture)||i.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=J}},oe(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),t}(),hi="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;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid 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);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",ci="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;}",li="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",fi="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",pi="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",di="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",mi="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);}",vi="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);}",yi="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);}",gi="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);}",xi="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);}",bi={},Ti=function(){function t(){}return t.registerInclude=function(t,e){bi[t]&&X.warn('The "'+t+'" shader include already exist.'),bi[t]=e},t.unRegisterInclude=function(t){delete bi[t]},t.unRegisterAllIncludes=function(){Object.keys(bi).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var r=e.level,i=e.shaderType,n=e.shader,s=e.macros,o=e.removeVersion,a=t.genMacroString(r,s),u=t.genShaderVersion(r),h=t.parseIncludes(n),c=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==r||c||(h=t.convertTo300(h,i===exports.ShaderType.fragment)),o?a+h:u+a+h},t.convertTo300=function(e,r){if(e=(e=(e=e.replace(/\bvarying\b/g,r?"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,""),r){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 i=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);i&&(e=t.replaceMRTShader(e,i))}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 r;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(r=e.exec(t));){var i=r[1],n=bi[i];if(void 0===n)throw new Error("Can't find include shader name "+i);t=t.replace(r[0],n)}return t},t.genMacroString=function(t,e,r){void 0===r&&(r=!0);var i=[],n="WEBGL"+t;return i.push("#ifndef "+n),i.push("#define "+n),i.push("#endif"),r&&i.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],r=t[1];!0===r?i.push("#define "+e):Number.isFinite(r)&&i.push("#define "+e+" "+r)})),i.length?i.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 r=new Set,i="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&r.add(s[1])}return r.forEach((function(t){i+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),i+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,i)},t}(),Ei=function(t){function e(e,r){var i,n=(i=t.call(this,e,r)||this).renderer.engine,s=Wr.create(n,{mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=Pr.create(n,{shader:{vertex:di,fragment:xi,glslVersion:exports.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,i.screenMesh=ii.create(n,{geometry:s,material:o,priority:0}),i.priority=5e3,i}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(t){var e,r,i;t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(i=null==(r=t.renderingData.currentFrame.globalVolume)||null==(e=r.bloom)?void 0:e.threshold)?i:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(ui),_i=function(t){function e(e,r,i){var n;(n=t.call(this,e,i)||this).type=r;var s=n.renderer.engine,o="PostProcess",a=Wr.create(s,{name:o,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:di,fragment:"H"==r?vi:yi,glslVersion:exports.GLSLVersion.GLSL1},h=Pr.create(s,{name:o,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=ii.create(s,{name:o,geometry:a,material:h,priority:0}),n.priority=5e3,n}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Mi(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(ui),Ai=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,r)||this).renderer.engine,o=Wr.create(s,{name:n,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a={vertex:di,fragment:gi},u=Pr.create(s,{name:n,shader:a});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=ii.create(s,{name:n,geometry:o,material:u,priority:0}),i.priority=5e3,i}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Mi(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(ui),Ci=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,{})||this).renderer.engine;i.sceneTextureHandle=r||new oi(s);var o=Wr.create(s,{name:n,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Pr.create(s,{name:n,shader:{vertex:di,fragment:mi,glslVersion:exports.GLSLVersion.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,i.screenMesh=ii.create(s,{name:n,geometry:o,material:a,priority:0}),i.priority=5e3,i}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear});var e=t.renderingData.currentFrame.globalVolume,r=Ye({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),i=Ye({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Ye({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),s=Ye({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(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),i.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",i.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",i.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",i.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new Ae(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new Ce(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(s.active)),t.renderMeshes([this.screenMesh])},e}(ui),Si="_effects_default_",wi=1,Ri=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=t.camera,i=t.keepColorBuffer,n=t.renderer,s=t.editorTransform,o=void 0===s?[1,1,0,0]:s,a=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,c=t.clearAction,l=void 0===c?{colorAction:exports.TextureLoadAction.whatever,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.whatever}:c,f=n.engine;a&&(this.globalVolume=a),this.globalUniforms=new Fi;var p,d=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=ke.HALF_FLOAT;d=[{texture:{format:ke.RGBA,type:v,magFilter:ke.LINEAR,minFilter:ke.LINEAR}}],p={storageType:exports.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear}}this.drawObjectPass=new ui(n,{name:Si,priority:ni,meshOrder:exports.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new oi(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=ke.HALF_FLOAT,E=new Ei(n,{name:"BloomThresholdPass",attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new oi(f);var A=new _i(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]}),C=new _i(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(A),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var w=new Ai(n,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:ke.RGBA,type:T,minFilter:ke.LINEAR,magFilter:ke.LINEAR}}]});w.gaussianDownSampleResult=b[5-S],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new Ci(n,g);this.addRenderPass(R)}this.semantics=new Xr(t.semantics),this.clearAction=l,this.name="RenderFrame"+wi++;var M=y[0];this.emptyTexture=gr(f),this.transparentTexture=xr(f),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(M,{listStart:0,listEnd:0,renderPass:M,intermedia:!1}),this.editorTransform=Se.fromArray(o),t.clearAction||this.resetClearActions(),this.passTextureCache=new jr(f);var O=f.gpuCapability,P=O.detail,I=kr(O.level,P.readableDepthStencilTextures&&P.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(I)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose();var e,r,i=(null==t?void 0:t.passes)?t.passes:void 0;(i!==exports.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(i)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(e=r.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var r,i=this.resource,n=i.color_a,s=i.color_b,o=e;o<t.length;o++){var a,u,h=t[o],c=null==(a=h.attachments[0])?void 0:a.texture;if(c&&r===c){var l=c===n?s:n;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(r=c)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(Si)||!r.meshes.includes(t)||(e=i,!1)})),e},e.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;r&&(0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var r,i=t[0],n=i.texture,s=i.persistent,o=n.format,a=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(o===ke.RGBA&&!s){var u=this.resource.color_a;return 0===a.length?[{texture:u}]:[{texture:a[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?exports.TextureLoadAction.clear:exports.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=exports.TextureLoadAction.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,r=t.gpuCapability,i=r.detail,n=r.level,s=this.renderer.getWidth(),o=this.renderer.getHeight(),a=2===n?ke.LINEAR:ke.NEAREST,u=mr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:ke.RGBA,name:"frame_a",minFilter:a,magFilter:a}),h=mr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:ke.RGBA,data:{width:s,height:o},minFilter:a,magFilter:a,name:"frame_b"}),c=i.readableDepthStencilTextures&&i.writableFragDepth?exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:exports.RenderPassAttachmentStorageType.depth_stencil_opaque,l=new ui(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:u}]}).initialize(this.renderer),f=new Li(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,colorAction:exports.TextureLoadAction.clear},meshOrder:exports.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=l.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:l.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:l.depthAttachment,resRP:l}}},e.createCopyMesh=function(t){var e,r=Fr,i=this.renderer.engine,n=Wr.create(i,{name:r,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=kr(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(s);var o=Pr.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:r,shader:s});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[ke.SRC_ALPHA,ke.ONE_MINUS_SRC_ALPHA,ke.SRC_ALPHA,ke.ONE_MINUS_SRC_ALPHA]),ii.create(i,{name:r,geometry:n,material:o,priority:0})},e.removeRenderPass=function(t){g(this._renderPasses,t)},oe(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function Mi(t){return t?new Ae(t.getWidth(),t.getHeight()):new Ae}var Oi,Pi,Ii,Li=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Mi(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(ui),Fi=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Vi=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return oe(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Di="function"==typeof e.WebGL2RenderingContext,Ni=function(){function t(t){this.setupCapability(t)}var r=t.prototype;return r.setupCapability=function(t){var r,i=Di&&o(t,e.WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),n&&!u&&(u=ki(t,t.HALF_FLOAT)),n&&!h&&(h=ki(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var c=n||t.getExtension("OES_texture_float")?t.FLOAT:0,l=n?e.WebGL2RenderingContext.HALF_FLOAT:(null==(r=t.getExtension("OES_texture_half_float"))?void 0:r.HALF_FLOAT_OES)||0,f={floatTexture:c,halfFloatTexture:l,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:zi(t),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!a,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=f,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},r.framebufferTexture2D=function(t,e,r,i,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&r>0)throw new Error("Draw multiple color buffers not available.");var o=s?s["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];o?t.framebufferTexture2D(e,o,i,n,0):console.error("Invalid color attachment index: "+r+".")},r.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw new Error("Draw buffers not available.")},r.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function ki(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(i=!0),t.deleteTexture(r),i}function zi(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}exports.COMPRESSED_TEXTURE=void 0,(Oi=exports.COMPRESSED_TEXTURE||(exports.COMPRESSED_TEXTURE={}))[Oi.NONE=0]="NONE",Oi[Oi.PVRTC=1]="PVRTC",Oi[Oi.ASTC=2]="ASTC",exports.FilterMode=void 0,(Pi=exports.FilterMode||(exports.FilterMode={}))[Pi.Nearest=0]="Nearest",Pi[Pi.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Ii=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Ii.RGBA32=0]="RGBA32",Ii[Ii.RGBAHalf=1]="RGBAHalf";var Ui=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},oe(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Bi=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,r,i){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,r){},e.getTemporaryRT=function(t,e,r,i,n,s){return null},e.dispose=function(t){},t}(),Gi=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=ji(this.arc,this.arcMode,t)*ge,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new Ce(r,i,0),s=Math.tan(this.angle*ge),o=n.clone().multiply(s);return o.z+=1,{position:n.multiply(Q(0,1)),direction:o.normalize()}},t}();function ji(t,e,r){if(e===Pt.RANDOM)t=Q(0,t);else if(e===Pt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Pt.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===Pt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var Xi,Hi=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=ji(this.arc,this.arcMode,t)*ge,r=new Ce(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Wi=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=Q(-this._d,this._d),r=Q(-this._h,this._h);return{direction:new Ce(0,0,1),position:new Ce(e,r,0)}},t}(),Yi=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=ji(this.arc,this.arcMode,t)*ge,r=new Ce(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,s=Math.atan2(n,i),o=Math.tan(e),a=new Ce;return e<s?a.set(i,i*o,0):e>=s&&e<Math.PI-s?a.set(n/o,n,0):e<Math.PI+s?a.set(-i,-i*o,0):e<2*Math.PI-s?a.set(-n/o,-n,0):a.set(i,i*o,0),{direction:r,position:a}},t}(),Zi=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Pt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Q(0,1);return{direction:new Ce(0,1,0),position:new Ce(this._d*(e-.5),0,0)}},t}(),qi=new Oe,Ki=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=Q(0,2*Math.PI),n=ji(this.arc,this.arcMode,t)*ge,s=qi.setFromRotationZ(n),o=new Ce(Math.cos(i),Math.sin(i),0),a=new Ce(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:s.transformNormal(o),position:s.transformPoint(a)}},t}(),Qi=new Oe,Ji=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}var e=t.prototype;return e.getHorizontalAngle=function(){return Q(-90,90)},e.generate=function(t){var e=ji(this.arc,this.arcMode,t)*ge,r=this.getHorizontalAngle()*ge,i=this.radius,n=new Ce(Math.cos(r),0,Math.sin(r)),s=Qi.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(i),direction:s}},t}(),$i=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.getHorizontalAngle=function(){return Q(0,90)},e}(Ji),tn=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,r=e.length/2-1,i=Math.floor(ji(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,s=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,o=new Ce(n,s,0);return{position:new Ce(n*this.width,s*this.height,0),direction:o.normalize()}},t}(),en=function(){function t(){}return t.prototype.generate=function(){return{position:new Ce,direction:new Ce}},t}(),rn=((Xi={})[dt.NONE]=en,Xi[dt.CONE]=Gi,Xi[dt.SPHERE]=Ji,Xi[dt.HEMISPHERE]=$i,Xi[dt.CIRCLE]=Hi,Xi[dt.DONUT]=Ki,Xi[dt.RECTANGLE]=Wi,Xi[dt.EDGE]=Zi,Xi[dt.RECTANGLE_EDGE]=Yi,Xi[dt.TEXTURE]=tn,Xi);function nn(t){if(!t)return new en;var e=Ye({radius:1,arc:360,angle:0,arcMode:Pt.RANDOM},t),r=t.type,i=rn[r];if(!i)throw new Error("Invalid shape: "+r+".");var n=new i(e);if(r!==dt.NONE){var s=t.alignSpeedDirection,o=t.upDirection,a=void 0===o?[0,0,1]:o;n.alignSpeedDirection=s,n.upDirection=Ce.fromArray(a).normalize()}return n}function sn(t,e,r,i,n){var s,o;if(n===function(t,e,r,i){for(var n=0,s=e,o=r-i;s<r;s+=i)n+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return n}(t,e,r,i)>0)for(s=e;s<r;s+=i)o=_n(s,t[s],t[s+1],o);else for(s=r-i;s>=e;s-=i)o=_n(s,t[s],t[s+1],o);return o&&yn(o,o.next)&&(An(o),o=o.next),o}function on(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!yn(i,i.next)&&0!==vn(i.prev,i,i.next))i=i.next;else{if(An(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function an(t){var e=t.prev,r=t,i=t.next;if(vn(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(dn(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&vn(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function un(t,e,r,i){var n=t.prev,s=t,o=t.next;if(vn(n,s,o)>=0)return!1;for(var a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,u=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,h=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,c=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,l=fn(a,u,e,r,i),f=fn(h,c,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=l&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&vn(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vn(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=l;){if(p!==t.prev&&p!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&vn(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&dn(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&vn(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function hn(t,e){return t.x-e.x}function cn(t,e){if(e=function(t,e){var r,i=e,n=t.x,s=t.y,o=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var a=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>o){if(o=a,a===n){if(s===i.y)return i;if(s===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===o)return r;var u,h=r,c=r.x,l=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&dn(s<l?n:o,s,c,l,s<l?o:n,s,i.x,i.y)&&(u=Math.abs(s-i.y)/(n-i.x),Tn(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&ln(r,i)))&&(r=i,f=u)),i=i.next}while(i!==h);return r}(t,e),e){var r=En(e,t);on(e,e.next),on(r,r.next)}}function ln(t,e){return vn(t.prev,t,e.prev)<0&&vn(e.next,t,t.next)<0}function fn(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function pn(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function dn(t,e,r,i,n,s,o,a){return(n-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(i-a)-(r-o)*(e-a)>=0&&(r-o)*(s-a)-(n-o)*(i-a)>=0}function mn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&gn(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Tn(t,e)&&Tn(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(vn(t.prev,t,e.prev)||vn(t,e.prev,e))||yn(t,e)&&vn(t.prev,t,t.next)>0&&vn(e.prev,e,e.next)>0)}function vn(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function yn(t,e){return t.x===e.x&&t.y===e.y}function gn(t,e,r,i){var n=bn(vn(t,e,r)),s=bn(vn(t,e,i)),o=bn(vn(r,i,t)),a=bn(vn(r,i,e));return n!==s&&o!==a||(!(0!==n||!xn(t,r,e))||(!(0!==s||!xn(t,i,e))||(!(0!==o||!xn(r,t,i))||!(0!==a||!xn(r,e,i)))))}function xn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function bn(t){return t>0?1:t<0?-1:0}function Tn(t,e){return vn(t.prev,t,t.next)<0?vn(t,e,t.next)>=0&&vn(t,t.prev,e)>=0:vn(t,e,t.prev)<0||vn(t,t.next,e)<0}function En(t,e){var r=new Cn(t.i,t.x,t.y),i=new Cn(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function _n(t,e,r,i){var n=new Cn(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function An(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 Cn(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Sn=0;function wn(t,e,r,i){r=r||2,Sn=i||0;var n,s,o,a,u,h,c,l=e&&e.length,f=l?e[0]*r:t.length,p=sn(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(t,e,r,i){var n,s,o,a=[];for(n=0,s=e.length;n<s;n++)(o=sn(t,e[n]*i,n<s-1?e[n+1]*i:t.length,i,!1))===o.next&&(o.steiner=!0),a.push(pn(o));for(a.sort(hn),n=0;n<a.length;n++)cn(a[n],r),r=on(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=o=t[0],s=a=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(h=t[m+1])<s&&(s=h),u>o&&(o=u),h>a&&(a=h);c=0!==(c=Math.max(o-n,a-s))?1/c:0}return Rn(p,d,r,n,s,c),d}function Rn(t,e,r,i,n,s,o){if(t){!o&&s&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=fn(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,s,o,a,u,h=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,i=r,a=0,e=0;e<h&&(a++,i=i.nextZ);e++);for(u=h;a>0||u>0&&i;)0!==a&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,h*=2}while(o>1)}(n)}(t,i,n,s);for(var a,u,h=t;t.prev!==t.next;)if(a=t.prev,u=t.next,s?un(t,i,n,s):an(t))e.push(a.i/r+Sn),e.push(t.i/r+Sn),e.push(u.i/r+Sn),An(t),t=u.next,h=u.next;else if((t=u)===h){o?1===o?Rn(t=Mn(on(t),e,r),e,r,i,n,s,2):2===o&&On(t,e,r,i,n,s):Rn(on(t),e,r,i,n,s,1);break}}}function Mn(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!yn(n,s)&&gn(n,i,i.next,s)&&Tn(n,s)&&Tn(s,n)&&(e.push(n.i/r+Sn),e.push(i.i/r+Sn),e.push(s.i/r+Sn),An(i),An(i.next),i=t=s),i=i.next}while(i!==t);return on(i)}function On(t,e,r,i,n,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&mn(o,a)){var u=En(o,a);return o=on(o,o.next),u=on(u,u.next),Rn(o,e,r,i,n,s),void Rn(u,e,r,i,n,s)}a=a.next}o=o.next}while(o!==t)}var Pn=6,In="editor",Ln={"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"},Fn=2;function Vn(t,e){for(var r=t.s,i=t.p,n=r[1],s=i[1],o=0,a=0;a<n.length;a++){o+=n[a].length-1}var u,h=new Float32Array(o*Pn),c=e.indexBase,l=void 0===c?0:c,f=e.uvTransform,p=0,d=0,m=0,v=1,y=1;f&&(d=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=s[b],_=s[b+1]||s[0],A=T,C=[0,0],S=0;S<A.length-1;S++){kn(C,A[S],E,_,E[4],E[5],_[2],_[3]),R(C[0],C[1])}var w=wn(Array.from(h),null,Pn,l);return{aPoint:h,index:new Uint16Array(w)};function R(t,e){h[p++]=t/2,h[p++]=e/2,f?(g[0]=t,g[1]=e,Nn(g,g,x),h[p++]=d+(g[0]+1)/2*v,h[p++]=m+(g[1]+1)/2*y):(h[p++]=(t+1)/2,h[p++]=(e+1)/2),p+=Fn}}function Dn(t,e){for(var r=[],i=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[wt.SHAPE_POINTS,t.p],s:[wt.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[wt.SHAPE_POINTS,t.g.p],s:[wt.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,s=0,o=0,a=0;a<i.length;a++){var u=Vn(i[a],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,r.push(u),s+=u.aPoint.length,o+=u.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(s),c=new Uint16Array(o),l=0,f=0,p=0;l<r[l];l++){var d=r[l];h.set(d.aPoint,f),f+=d.aPoint.length,c.set(d.index,p),p+=d.index.length}return{aPoint:h,index:c}}function Nn(t,e,r){var i=Math.cos(r),n=Math.sin(r),s=e[0],o=e[1];return t[0]=i*s+n*o,t[1]=-n*s+i*o,t}function kn(t,e,r,i,n,s,o,a){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;return t[0]=h*r[0]+c*n+l*o+f*i[0],t[1]=h*r[1]+c*s+l*a+f*i[1],t}var zn,Un=[[0,0,1,1,0]],Bn=function(t){function e(e){var r;(r=t.call(this,e)||this).visible=!0,r.splits=Un,r.meshCollider=new so,r._color=new Re(1,1,1,1),r.getHitTestParams=function(t){var e=Oe.fromScale(r.transform.size.x,r.transform.size.y,1).premultiply(r.transform.getWorldMatrix()),i=r.interaction;if(t||i){r.meshCollider.setGeometry(r.geometry,e);var n,s=r.meshCollider.getBoundingBoxData();if(s)return{behavior:(null==(n=r.interaction)?void 0:n.behavior)||0,type:s.type,triangles:s.area,backfaceCulling:r.renderer.side===ft.FRONT}}},r.renderer={renderMode:xt.MESH,blending:lt.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:ft.DOUBLE,mask:0},r.defaultGeometry=Wr.create(r.engine,{attributes:{aPos:{type:ke.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:ke.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:ke.TRIANGLES,drawCount:6}),r.geometry=r.defaultGeometry;var i=Pr.create(r.engine,{shader:{fragment:ci,vertex:hi,shared:!0}});return r.material=i,r.material.setColor("_Color",new Re(1,1,1,1)),r.maskManager=new Ir(e),r}Ct(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){o(t,Re)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},r.setTexture=function(t){var e=this;return i((function(){var r;return h(this,(function(i){switch(i.label){case 0:return"string"!=typeof t?[3,2]:[4,mr.fromImage(t,e.item.engine)];case 1:return r=i.sent(),[3,3];case 2:r=t,i.label=3;case 3:return e.renderer.texture=r,e.material.setTexture("_MainTex",r),[2]}}))}))()},r.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},r.getItemGeometryData=function(t){var e=this.splits,r=this.textureSheetAnimation,i=this.defaultGeometry;if(t.shape){for(var n=t.shape,s=n.index,o=void 0===s?[]:s,a=n.aPoint,u=void 0===a?[]:a,h=new Float32Array(u),c=[],l=[],f=0;f<h.length;f+=6)h[f]*=1,h[f+1]*=1,l.push(u[f+2],u[f+3]),c.push(h[f],h[f+1],0);return i.setAttributeData("aPos",new Float32Array(c)),{index:o,aUV:l}}var p=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],d=[],m=[],v=[];if(1===e.length){var y=r?[0,0,1,1,e[0][4]]:e[0],g=y[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],x=y[0],b=y[1],T=y[4]?y[3]:y[2],E=y[4]?y[2]:y[3];d.push(g[0]*T+x,g[1]*E+b,g[2]*T+x,g[3]*E+b,g[4]*T+x,g[5]*E+b,g[6]*T+x,g[7]*E+b),v.push(p[0],p[1],0,p[2],p[3],0,p[4],p[5],0,p[6],p[7],0),m.push(0,1,2,2,1,3)}else for(var _=0;_<2;_++)for(var A=0;A<2;A++){var C=4*(2*A+_),S=r?[0,0,1,1,e[0][4]]:e[2*A+_],w=S[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],R=((_+_+1)/2-1)/2,M=((A+A+1)/2-1)/2,O=S[0],P=S[1],I=S[4]?S[3]:S[2],L=S[4]?S[2]:S[3],F=[p[0]/2+R,p[1]/2+M,p[2]/2+R,p[3]/2+M,p[4]/2+R,p[5]/2+M,p[6]/2+R,p[7]/2+M];d.push(w[0]*I+O,w[1]*L+P,w[2]*I+O,w[3]*L+P,w[4]*I+O,w[5]*L+P,w[6]*I+O,w[7]*L+P),v.push(1*F[0],1*F[1],0,1*F[2],1*F[3],0,1*F[4],1*F[5],0,1*F[6],1*F[7],0),m.push(C,1+C,2+C,2+C,1+C,3+C)}return i.setAttributeData("aPos",new Float32Array(v)),{index:m,aUV:d}},r.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),r=e.index,i=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(r)),n.setAttributeData("aUV",new Float32Array(i)),n.setDrawCount(r.length),n},r.configureMaterial=function(t){var e=t.side,r=t.occlusion,i=t.blending,n=t.mask,s=t.texture,o=this.maskManager.maskMode,a=this.material;a.blending=!0,a.depthTest=!0,a.depthMask=r,a.stencilRef=void 0!==n?[n,n]:void 0,Xe(a,i),We(a,o),He(a,e),a.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',a.setVector4("_TexOffset",new Se(0,0,1,1)),a.setTexture("_MainTex",s);var u=je(i),h=new Se;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=o,a.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},r.draw=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++){var r=this.materials[e];r.setVector2("_Size",this.transform.size),this.renderer.renderMode!==xt.BILLBOARD&&this.renderer.renderMode!==xt.VERTICAL_BILLBOARD&&this.renderer.renderMode!==xt.HORIZONTAL_BILLBOARD||r.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,r,e)}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i=e,n=null!=(r=i.renderer)?r:{},o=i.splits,a=i.textureSheetAnimation,u=i.mask;u&&this.maskManager.getMaskMode(u);var h,c,l,f=n.shape,p=o&&!a?o[0]:void 0,d=void 0;if(null==f||"aPoint"in f&&"index"in f||(d=Dn(f,p)),this.splits=o||Un,this.textureSheetAnimation=a,this.renderer={renderMode:null!=(h=n.renderMode)?h:xt.MESH,blending:null!=(c=n.blending)?c:lt.ALPHA,texture:n.texture?this.engine.findObject(n.texture):this.engine.emptyTexture,occlusion:!!n.occlusion,transparentOcclusion:!!n.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(l=n.side)?l:ft.DOUBLE,mask:this.maskManager.getRefValue(),shape:d},this.configureMaterial(this.renderer),i.geometry){var m=this.engine.findObject(i.geometry),v=i.splits&&!i.textureSheetAnimation?i.splits[0]:Un[0],y=v[0],g=v[1],x=Boolean(v[4]),b=x?v[3]:v[2],T=x?v[2]:v[3],E=x?-Math.PI/2:0,_=m.getAttributeData("aUV"),A=m.getAttributeData("aPos"),C=m.getIndexData(),S=[0,0];if(_&&A&&C){for(var w=_.length/2,R=0;R<w;R++){var M=3*R,O=2*R,P=A[M],I=A[M+1];S[0]=P,S[1]=I,Nn(S,S,E),_[O]=(S[0]+.5)*b+y,_[O+1]=(S[1]+.5)*T+g}this.geometry.setAttributeData("aPos",A.slice()),this.geometry.setAttributeData("aUV",_.slice()),this.geometry.setIndexData(C.slice()),this.geometry.setDrawCount(C.length)}this.geometry.subMeshes.length=0;for(var L,F=s(m.subMeshes);!(L=F()).done;){var V=L.value;this.geometry.subMeshes.push({offset:V.offset,indexCount:V.indexCount,vertexCount:V.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},oe(e,[{key:"color",get:function(){return this._color},set:function(t){this._color=t,this.material.setColor("_Color",this._color)}}]),e}(ve);exports.ShapeComponent=function(t){function e(e){var r;(r=t.call(this,e)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new au,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",r.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0});var i={shader:{vertex:r.vert,fragment:r.frag,glslVersion:exports.GLSLVersion.GLSL1}},n=Pr.create(e,i),s=Pr.create(e,i);return n.color=new Re(1,1,1,1),n.depthMask=!1,n.depthTest=!0,n.blending=!0,r.material=n,s.color=new Re(.25,.25,.25,1),s.depthMask=!1,s.depthTest=!0,s.blending=!0,r.materials[1]=s,r.strokeAttributes={width:1,alignment:.5,cap:Yt.Butt,join:Zt.Miter,miterLimit:10,color:new Re(1,1,1,1)},r.fillAttribute={color:new Re(1,1,1,1)},r.shapeAttribute={type:Wt.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}Ct(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){this.material.color=this.fillAttribute.color,this.materials[1].color=this.strokeAttributes.color,this.shapeDirty&&(this.buildPath(this.shapeAttribute),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1)},r.buildGeometryFromPath=function(t){var e=t.shapePrimitives,r=[],i=[];if(this.hasFill)for(var n,o=s(e);!(n=o()).done;){var a=n.value.shape,u=[],h=i.length,c=r.length/2;a.build(u),a.triangulate(u,r,c,i,h)}var l=i.length;if(this.hasStroke)for(var f,p=s(e);!(f=p()).done;){var d=f.value.shape,m=[],v=r.length/2,y=this.strokeAttributes,g=!0;this.shapeAttribute.type===Wt.Custom&&(g=d.closePath),d.build(m),Ha(m,y,!1,g,r,2,v,i)}var x=i.length-l,b=r.length/2,T=this.geometry.getAttributeData("aPos"),E=this.geometry.getAttributeData("aUV"),_=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!E||E.length<2*b)&&(E=new Float32Array(2*b)),(!_||_.length<i.length)&&(_=new Uint16Array(i.length));for(var A=0;A<b;A++){var C=3*A,S=2*A,w=2*A;T[C]=r[S],T[C+1]=r[S+1],T[C+2]=0,E[w]=T[C],E[w+1]=T[C+1]}_.set(i),this.geometry.setAttributeData("aPos",T),this.geometry.setAttributeData("aUV",E),this.geometry.setIndexData(_),this.geometry.setDrawCount(i.length);var R=this.geometry.subMeshes[0],M=this.geometry.subMeshes[1];R.indexCount=l,M.offset=2*l,M.indexCount=x},r.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case Wt.Custom:for(var e,r=this.shapeAttribute,i=r.points,n=r.easingIns,o=r.easingOuts,a=s(r.shapes);!(e=a()).done;){var u=e.value,h=u.indexes,c=i[h[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var l=1;l<h.length;l++){var f=h[l],p=h[l-1],d=i[f.point],m=i[p.point],v=o[p.easingOut],y=n[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+d.x,y.y+d.y,d.x,d.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=i[g.point],T=i[x.point],E=o[x.easingOut],_=n[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,_.x+b.x,_.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case Wt.Ellipse:var A=t;this.graphicsPath.ellipse(0,0,A.xRadius,A.yRadius);break;case Wt.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case Wt.Star:var S=t;this.graphicsPath.polyStar(S.pointCount,S.outerRadius,S.innerRadius,S.outerRoundness,S.innerRoundness,exports.StarType.Star);break;case Wt.Polygon:var w=t;this.graphicsPath.polyStar(w.pointCount,w.radius,w.radius,w.roundness,w.roundness,exports.StarType.Polygon)}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shapeDirty=!0;var r=e.stroke;r&&(this.hasStroke=!0,this.strokeAttributes.width=r.width,this.strokeAttributes.color.copyFrom(r.color),this.strokeAttributes.cap=r.cap,this.strokeAttributes.join=r.join);var i=e.fill;switch(i&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(i.color)),e.type){case Wt.Custom:for(var n,o=e,a={type:Wt.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:o.fill},u=s(o.points);!(n=u()).done;){var h=n.value;a.points.push(new Ae(h.x,h.y))}for(var c,l=s(o.easingIns);!(c=l()).done;){var f=c.value;a.easingIns.push(new Ae(f.x,f.y))}for(var p,d=s(o.easingOuts);!(p=d()).done;){var m=p.value;a.easingOuts.push(new Ae(m.x,m.y))}a.shapes=o.shapes,this.shapeAttribute=a;break;case Wt.Ellipse:var v=e,y={type:Wt.Ellipse,xRadius:v.xRadius,yRadius:v.yRadius,fill:v.fill};this.shapeAttribute=y;break;case Wt.Rectangle:var g=e,x={type:Wt.Rectangle,width:g.width,height:g.height,roundness:g.roundness,fill:g.fill};this.shapeAttribute=x;break;case Wt.Star:var b=e,T={type:Wt.Star,pointCount:b.pointCount,innerRadius:b.innerRadius,outerRadius:b.outerRadius,innerRoundness:b.innerRoundness,outerRoundness:b.outerRoundness,fill:b.fill};this.shapeAttribute=T;break;case Wt.Polygon:var E=e,_={type:Wt.Polygon,pointCount:E.pointCount,radius:E.radius,roundness:E.roundness,fill:E.fill};this.shapeAttribute=_}e.mask&&this.maskManager.getMaskMode(e.mask);var A=this.maskManager.getRefValue();this.material.stencilRef=void 0!==A?[A,A]:void 0,We(this.material,this.maskManager.maskMode)},oe(e,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),e}(Bn),exports.ShapeComponent=u([ce("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}Ct(e,t);var r=e.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,r=0,i=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,r=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,i=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,r=this.startPositionY*(1-s)+s*this.endPositionY,i=this.startPositionZ*(1-s)+s*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",r*this.amountOfMotion),o.setFloat("_PosZ",i*this.amountOfMotion)}},e}(de),u([le()],exports.Fake3DComponent.prototype,"loop",void 0),u([le()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),u([le()],exports.Fake3DComponent.prototype,"animationLength",void 0),u([le()],exports.Fake3DComponent.prototype,"mode",void 0),u([le()],exports.Fake3DComponent.prototype,"startPositionX",void 0),u([le()],exports.Fake3DComponent.prototype,"startPositionY",void 0),u([le()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),u([le()],exports.Fake3DComponent.prototype,"endPositionX",void 0),u([le()],exports.Fake3DComponent.prototype,"endPositionY",void 0),u([le()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),u([le()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),u([le()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),u([le()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),u([le()],exports.Fake3DComponent.prototype,"phaseX",void 0),u([le()],exports.Fake3DComponent.prototype,"phaseY",void 0),u([le()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=u([ce("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(zn=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[zn.Circular=0]="Circular",zn[zn.Linear=1]="Linear",exports.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.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())}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(de),exports.CameraController=u([ce(Qt.CameraController)],exports.CameraController);var Gn,jn=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t);exports.HitTestType=void 0,(Gn=exports.HitTestType||(exports.HitTestType={}))[Gn.triangle=1]="triangle",Gn[Gn.box=2]="box",Gn[Gn.sphere=3]="sphere",Gn[Gn.custom=4]="custom";var Xn="click",Hn="touchstart",Wn="touchmove",Yn="touchend",Zn=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var r=t.prototype;return r.bindListeners=function(){var t,r,i,n,s,o=this;s=function(t){return t};var a,u="mousedown",h="mousemove",c="mouseup",l=function(t,r,i,s,a){void 0===s&&(s=0),void 0===a&&(a=0);var u=0,h=0,c=e.performance.now();if(!o.target)return X.warn("Trigger TouchEvent after EventSystem is disposed."),{x:r,y:i,vx:0,vy:h,dx:s,dy:a,ts:c,width:0,height:0,origin:t};var l=o.target,f=l.width,p=l.height;if(n){var d=c-n.ts;u=(s-n.dx)/d||0,h=(a-n.dy)/d||0,n={dx:s,dy:a,ts:c}}return{x:r,y:i,vx:u,vy:h,dx:s,dy:a,ts:c,width:f,height:p,origin:t}};M()&&(s=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},u="touchstart",h="touchmove",c="touchend"),this.nativeHandlers=((a={})[u]=function(a){if(o.enabled){var u=s(a),h=qn(u);t=h.x,r=h.y,n=i={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:t,y:r},o.dispatchEvent(Hn,l(a,t,r))}},a[h]=function(e){if(i&&o.enabled){var n=qn(s(e));t=n.x,r=n.y,o.dispatchEvent(Wn,l(e,t,r,t-i.x,r-i.y))}},a[c]=function(e){if(i&&o.enabled){!o.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=s(e),a=qn(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=a.x,r=a.y,u<4&&o.dispatchEvent(Xn,l(e,t,r)),o.dispatchEvent(Yn,l(e,t,r,t-i.x,r-i.y))}i=0},a),Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.nativeHandlers[t])}))},r.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},r.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),y(r,e),function(){g(r,e)}},r.removeEventListener=function(t,e){var r=this.handlers[t];r&&g(r,e)},r.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function qn(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),s=n.left,o=n.top;return{x:(r-s)/n.width*2-1,y:1-(i-o)/n.height*2}}var Kn,Qn,Jn=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),$n=(Kn=new Float32Array(1),Qn=new Int32Array(Kn.buffer),function(t){Kn[0]=t;var e=Qn[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),ts=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=$n(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=$n(t[r])},t}();var es,rs=new Zr,is=new Oe;function ns(t,e,r,i,n,s,o){var a=t,u=i/n,h=i,c=e.speedOverLifetime;c&&(h=c.getIntegrateValue(0,i,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;a.copyFrom(s),a.addScaledVector(o,h),a.addScaledVector(r,l);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{};if(p.enabled){var d=new Ce;p.center&&d.setFromArray(p.center);var m=a.clone().subtract(d),v=p.asRotation,y=["x","y","z"].map((function(t){var e=p[t];return e?v?e.getValue(u):e.getIntegrateValue(0,i,n):0}));rs.setFromArray(y).negate(),is.setFromEuler(rs);var g=is.transformPoint(m);a.addVectors(d,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,i,n);a.x=a.x+_}if(T){var A=x?T.getValue(u):T.getIntegrateValue(0,i,n);a.y=a.y+A}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,i,n);a.z=a.z+C}}return a}function ss(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function os(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function as(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(r&&t!==r)for(var o=0;o<r.length;o++)t[o]=r[o];return t}var us=((es={})[bt.PARTICLE_ORIGIN_CENTER]=[0,0],es[bt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],es[bt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],es[bt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],es[bt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],es[bt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],es[bt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],es[bt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],es[bt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],es);function hs(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function cs(t,e,r){var i=r.position,n=new Ce(t,e,0),s=new Ce;return r.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(i),new Kr(i,s)}function ls(t,e,r){var i=t.x,n=t.y,s=t.z,o=new Ce(i-e,n+r,s),a=new Ce(i-e,n-r,s),u=new Ce(i+e,n-r,s),h=new Ce(i+e,n+r,s);return[{p0:o,p1:a,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function fs(t,e,r){return void 0===r&&(r=1e-6),Math.abs(t-e)<r}function ps(t,e){void 0===e&&(e=2);var r=Math.pow(10,e);return Math.floor(t*r)/r}var ds={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],r=this.getPointIndexInCurve(t,this.pointIndexCache),i=r.xIndex,n=r.yIndex,s=e[i],o=e[n];return new Ae(s,o)},getPointIndexInCurve:function(t,e){var r=t[0],i=t[2],n=r===Rt.LINE||r===Rt.EASE_OUT?0:r===Rt.EASE_IN||r===Rt.EASE||r===Rt.HOLD&&i===Rt.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 r=t[2];return!(e!==Rt.HOLD||!this.isKeyframeTypeLeftSideEase(r))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var r=t[2];return!(e!==Rt.HOLD||!this.isKeyframeTypeRightSideEase(r))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[Rt.EASE,Rt.EASE_IN,Rt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[Rt.EASE,Rt.EASE_OUT,Rt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===Rt.HOLD&&[Rt.HOLD,Rt.LINE_OUT,Rt.EASE_OUT].includes(r)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===Rt.HOLD&&[Rt.HOLD,Rt.LINE,Rt.EASE_IN].includes(r)}},ms=function(t,e){this.points=t,this.totalLength=e},vs={},ys={},gs=.1;function xs(t,e){return 1-3*e+3*t}function bs(t,e){return 3*e-6*t}function Ts(t){return 3*t}function Es(t,e,r){return((xs(e,r)*t+bs(e,r))*t+Ts(e))*t}function _s(t,e,r){return 3*xs(e,r)*t*t+2*bs(e,r)*t+Ts(e)}var As=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,r,i){var n=ps(e.x-t.x,3)+"_"+ps(e.y-t.y,3)+"_"+ps(e.z-t.z,3)+"&"+ps(r.x-t.x,3)+"_"+ps(r.y-t.y,3)+"_"+ps(r.z-t.z,3)+"&"+ps(i.x-t.x,3)+"_"+ps(i.y-t.y,3)+"_"+ps(i.z-t.z,3);if(ys[n])return{data:ys[n],interval:t};for(var s=[],o=null,a=0,u=0,h=0;h<300;h+=1){var c=new Ce,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(r.x-t.x)+3*(1-l)*Math.pow(l,2)*(i.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(r.y-t.y)+3*(1-l)*Math.pow(l,2)*(i.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(r.z-t.z)+3*(1-l)*Math.pow(l,2)*(i.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==o&&(u+=Math.pow(c.x-o.x,2),u+=Math.pow(c.y-o.y,2),u+=Math.pow(c.z-o.z,2)),o=c,a+=u=Math.sqrt(u),s[h]={partialLength:u,point:c}}var f=new ms(s,a);return ys[n]=f,{data:f,interval:new Ce(t.x,t.y,t.z)}}(t,e,r,i),s=n.data,o=n.interval;this.lengthData=s,this.interval=o,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(fs(1-t,0))return e.points[299].point.clone().add(this.interval);if(fs(e.totalLength,0))return this.p1.clone();var r=new Ce,i=ps(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(fs(n,i))return e.points[s].point.clone().add(this.interval);var o=!0,a=1;for(i<n&&(a=-1);o;){if(i>=n){if(299===s){r.x=e.points[s].point.x,r.y=e.points[s].point.y,r.z=e.points[s].point.z;break}if(i<n+e.points[s+1].partialLength){var u=(i-n)/e.points[s+1].partialLength;r.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,r.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,r.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}a>0&&s<299?(s+=a,n+=ps(e.points[s].partialLength,5)):a<0&&s>0?(n-=ps(e.points[s].partialLength,5),s+=a):o=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,r.add(this.interval),r},t}(),Cs=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.temp=new Me,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):fs(1-t,0)?this.temp.copyFrom(this.p2):(Rs.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Ss=function(){function t(t,e,r,i){this.mX1=t,this.mY1=e,this.mX2=r,this.mY2=i,this.precomputed=!1,this.mSampleValues=new Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,this.mX1===this.mY1&&this.mX2===this.mY2||this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),Es(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=Es(t*gs,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,r=0,i=1;10!==i&&e[i]<=t;++i)r+=gs;var n=r+(t-e[--i])/(e[i+1]-e[i])*gs,s=_s(n,this.mX1,this.mX2);return s>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var s=_s(e,r,i);if(0===s)return e;e-=(Es(e,r,i)-t)/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,r,i,n){var s,o,a=0;do{(s=Es(o=e+(r-e)/2,i,n)-t)>0?r=o:e=o}while(Math.abs(s)>1e-7&&++a<10);return o}(t,r,r+gs,this.mX1,this.mX2)},t}();function ws(t,e){var r=function(t,e,r){var i=t[1],n=ds.isHoldOutKeyframe(t),s=ds.isHoldInKeyframe(e),o=!s&&ds.isRightSideEase(t),a=!n&&ds.isLeftSideEase(e);if(o&&!a&&!s){var u=new Ae(i[i.length-4],i[i.length-3]),h=new Ae(i[i.length-2],i[i.length-1]),c=ds.getPointInCurve(e),l=new Ae(c.x,c.y);return{type:"ease",p0:u,p1:h,p2:new Ae(l.x-(l.x-u.x)/10,l.y),p3:l}}if(!o&&a&&!n){var f=e[1],p=ds.getPointInCurve(t),d=new Ae(p.x,p.y),m=new Ae(f[0],f[1]),v=new Ae(f[2],f[3]);return{type:"ease",p0:d,p1:new Ae(d.x+(v.x-d.x)/10,d.y),p2:m,p3:v}}if(o&&a){var y=e[1];return{type:"ease",p0:new Ae(i[i.length-4],i[i.length-3]),p1:new Ae(i[i.length-2],i[i.length-1]),p2:new Ae(y[0],y[1]),p3:new Ae(y[2],y[3])}}var g=ds.getPointInCurve(t),x=ds.getPointInCurve(e);n?x.y=g.y:s&&(g.y=x.y);return r?{type:"ease",p0:g,p1:new Ae((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new Ae((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}:{type:"line",p0:g,p1:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),i=r.p0,n=r.p1,s=r.p2,o=r.p3;k(s),k(o);var a,u,h=o.x-i.x,c=o.y-i.y,l=ps((n.x-i.x)/h,5),f=ps((s.x-i.x)/h,5);fs(c,0)?a=u=NaN:(a=ps((n.y-i.y)/c,5),u=ps((s.y-i.y)/c,5)),l<0&&(console.error("Invalid bezier points, x1 < 0",i,n,s,o),l=0),f<0&&(console.error("Invalid bezier points, x2 < 0",i,n,s,o),f=0),l>1&&(console.error("Invalid bezier points, x1 >= 1",i,n,s,o),l=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",i,n,s,o),f=1);var p,d=("bez_"+l+"_"+a+"_"+f+"_"+u).replace(/\./g,"p");return vs[d]?p=vs[d]:(p=new Ss(l,a,f,u),vs[d]=p),{points:[i,n,s,o],timeInterval:h,valueInterval:c,curve:p}}var Rs=function(){function t(){}return t.slerpFlat=function(t,e,r,i){var n=e.x,s=e.y,o=e.z,a=e.w,u=r.x,h=r.y,c=r.z,l=r.w;if(0===i)return t.x=n,t.y=s,t.z=o,void(t.w=a);if(1===i)return t.x=u,t.y=h,t.z=c,void(t.w=l);if(a!==l||n!==u||s!==h||o!==c){var f=1-i,p=n*u+s*h+o*c+a*l,d=p>=0?1:-1,m=1-p*p;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,p*d);f=Math.sin(f*y)/v,i=Math.sin(i*y)/v}var g=i*d;if(n=n*f+u*g,s=s*f+h*g,o=o*f+c*g,a=a*f+l*g,f===1-i){var x=1/Math.sqrt(n*n+s*s+o*o+a*a);n*=x,s*=x,o*=x,a*=x}}t.x=n,t.y=s,t.z=o,t.w=a},t}(),Ms="not_implement",Os=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Ms)},e.getIntegrateValue=function(t,e,r){throw new Error(Ms)},e.getIntegrateByTime=function(t,e){throw new Error(Ms)},e.getValue=function(t){throw new Error(Ms)},e.getMaxTime=function(){throw new Error(Ms)},e.toUniform=function(t){throw new Error(Ms)},e.map=function(t){throw new Error(Ms)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Ms)},t.getAllData=function(t,e){for(var r=new(e?ts:Float32Array)(4*t.index),i=0,n=0,s=t.curves;i<s.length;i++){var o=s[i].toData();r.set(o,n),n+=o.length}return e?r.data:r},t}(),Ps=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},r.getMaxTime=function(){return 0},e}(Os),Is=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(Os),Ls=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t,e){var r=null!=e?e:Math.random();return this.min+r*(this.max-this.min)},r.getIntegrateValue=function(t,e,r){var i=null!=r?r:1;return(this.min+i*(this.max-this.min))*(e-t)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Os),Fs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var s=Math.random();i[n]=e[n]*(1-s)+r[n]*s}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Os),Vs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,s=this.xCoord*r;return((i+e/s*(n-i)+i)*e-(i+t/s*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return js(e,0,this.xCoord,this.min,this.max)-js(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(Os),Ds=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=E(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1];if(n.stop<=t&&s.stop>t){var o=(t-n.stop)/(s.stop-n.stop);return _(n.color,s.color,o,!0)}}return e[r].color.slice()},e}(Os),Ns=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1],o=n[0],a=s[0];if(t>=o&&t<=a){var u=(t-o)/(a-o),h=n[1];return h+u*(s[1]-h)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,s=e?js:Gs,o=0;o<n;o++){var a=r[o],u=r[o+1],h=a[0],c=u[0];if(t>h&&t<=c)return i+s(t,h,c,a[1],u[1]);i+=s(c,h,c,a[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},r.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},r.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Os),ks=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t;this.curveMap={},this.keys=[];for(var r=0;r<e.length-1;r++){var i=ws(e[r],e[r+1]),n=i.points,s=i.curve,o=i.timeInterval,a=i.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())),this.curveMap[u.x+"&"+h.x]={points:n,timeInterval:o,valueInterval:a,curve:s,timeStart:Number(u.x),timeEnd:Number(h.x)}}this.startKeyframe=e[0],this.endKeyframe=e[e.length-1],this.keyTimeData=Object.keys(this.curveMap)},r.getValue=function(t){var e=0,r=this.keyTimeData,i=this.curveMap[r[0]].timeStart,n=this.curveMap[r[r.length-1]].timeEnd;if(t<=i)return ds.getPointIndexInCurve(this.startKeyframe,ds.pointIndexCache),this.startKeyframe[1][ds.pointIndexCache.yIndex];if(t>=n)return ds.getPointIndexInCurve(this.endKeyframe,ds.pointIndexCache),this.endKeyframe[1][ds.pointIndexCache.yIndex];for(var s=0;s<r.length;s++){var o=this.curveMap[r[s]].timeStart,a=this.curveMap[r[s]].timeEnd;if(t>=Number(o)&&t<Number(a)){e=this.getCurveValue(r[s],t);break}}return e},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=(e-t)/r,n=0,s=Object.keys(this.curveMap);if(i<=this.curveMap[s[0]].timeStart)return 0;for(var o=0;o<s.length;o++){var a=this.curveMap[s[o]].timeStart,u=this.curveMap[s[o]].timeEnd;if(i>=Number(u)&&(n+=r*this.getCurveIntegrateValue(s[o],Number(u))),i>=Number(a)&&i<Number(u)){n+=r*this.getCurveIntegrateValue(s[o],i);break}}return n},r.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},r.getCurveIntegrateValue=function(t,e){for(var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,o=0,a=(e-i.x)/20,u=0;u<=20;u++){var h=u*a/n,c=i.y+s*r.curve.getValue(h);o+=0===u||20===u?c:u%2==1?4*c:2*c}return o*=a/3},r.getCurveValue=function(t,e){var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,o=(e-i.x)/n,a=r.curve.getValue(o);return i.y+s*a},r.toUniform=function(t){var e=t.index,r=this.keys.length;return t.curves.push(this),t.index=e+r,t.max=Math.max(t.max,r),t.curveCount+=r,new Float32Array([5,e+1/r,e,r])},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveMap[t[t.length-1]].timeEnd},e}(Os),zs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],s=e[i+1];if(n[0]<=t&&s[0]>=t){var o=s[1]-n[1],a=void 0;if(0===o)a=(t-n[0])/(s[0]-n[0]);else a=(Xs(t,n,s)-n[1])/o;return this.calculateVec(i,a)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],s=0;s<r.length;s++)n[s]=r[s]*(1-e)+i[s]*e;return n},e}(Os),Us=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length){for(var n=0;n<e.length-1;n++){var s=e[n],o=e[n+1],a=new Ce(r[n][0],r[n][1],r[n][2]),u=new Ce(r[n+1][0],r[n+1][1],r[n+1][2]),h=new Ce(i[2*n][0],i[2*n][1],i[2*n][2]),c=new Ce(i[2*n+1][0],i[2*n+1][1],i[2*n+1][2]),l=ws(s,o),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new As(a,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},r.getValue=function(t){var e=ps(t,5),r=0,i=new Ce,n=this.keyTimeData;if(!n.length)return i;var s=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=s)return i=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return i=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<n.length;a++){var u=this.curveSegments[n[a]].timeStart,h=this.curveSegments[n[a]].timeEnd;if(e>=Number(u)&&e<Number(h)){var c=this.curveSegments[n[a]].pathCurve;r=this.getPercValue(n[a],e),i=c.getPointInPercent(r)}}return i},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=ps((e-i.x)/n,4);return _e(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Os),Bs=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length)for(var n=0;n<e.length-1;n++){var s=e[n],o=e[n+1],a=Me.fromArray(r[n]),u=Me.fromArray(r[n+1]),h=Me.fromArray(i[2*n]),c=Me.fromArray(i[2*n+1]),l=ws(s,o),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new Cs(a,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g}}},r.getValue=function(t){var e=0,r=ps(t,5),i=Object.keys(this.curveSegments),n=Number(i[0].split("&")[0]),s=Number(i[i.length-1].split("&")[1]);if(r<=n)return this.curveSegments[i[0]].pathCurve.getPointInPercent(0);if(r>=s)return this.curveSegments[i[i.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<i.length;o++){var a=i[o].split("&"),u=a[0],h=a[1];if(r>=Number(u)&&r<Number(h)){var c=this.curveSegments[i[o]].pathCurve;return e=this.getPercValue(i[o],r),c.getPointInPercent(e)}}return this.curveSegments[i[0]].pathCurve.getPointInPercent(0)},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=ps((e-i.x)/n,4);return _e(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Os);function Gs(t,e,r,i,n){var s=t-e;return(i+i+(n-i)*s/(r-e))*s/2}function js(t,e,r,i,n){var s=t*t,o=e*e;return(2*(s*t)*(i-n)+3*s*(e*n-r*i)-o*e*(2*i+n)+3*o*r*i)/(6*(e-r))}function Xs(t,e,r){var i=r[0]-e[0],n=e[3]*i,s=r[2]*i,o=(t-e[0])/i,a=o*o,u=a*o,h=u-2*a+o,c=u-a,l=-2*u+3*a;return(2*u-3*a+1)*e[1]+h*n+c*s+l*r[1]}function Hs(t,e){if(e){var r=e[0],i=e[1];if(r===wt.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===wt.LINE){var s=i.length;if(2===s&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&s++,i[i.length-1][0]<1&&s++;var o=Math.ceil(s/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}else if(r===wt.BEZIER_CURVE){var a=i.length-1;t.index+=2*a,t.curves.push(i),t.max=Math.max(t.max,2*a),t.curveCount+=2*a}}}function Ws(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function Ys(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ys=function(){return!!t})()}function Zs(t,e,r){return Zs=Ys()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&At(n,r.prototype),n},Zs.apply(null,arguments)}var qs,Ks=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Se,e}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=$s(t[0]),this.yCurve=$s(t[1]),this.zCurve=$s(t[2]),this.wCurve=$s(t[3])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t),i=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Os),Qs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Ae,e}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=$s(t[0]),this.yCurve=$s(t[1])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t);return this.value.set(e,r),this.value},e}(Os),Js=((qs={})[wt.RANDOM]=function(t){return o(t[0],Array)?new Fs(t):new Ls(t)},qs[wt.CONSTANT]=function(t){return new Ps(t)},qs[wt.CONSTANT_VEC2]=function(t){return new Ps(t)},qs[wt.CONSTANT_VEC3]=function(t){return new Ps(t)},qs[wt.CONSTANT_VEC4]=function(t){return new Ps(t)},qs[wt.RGBA_COLOR]=function(t){return new Ps(t)},qs[wt.COLORS]=function(t){return new Is(t.map((function(t){return b(t,!1)})))},qs[wt.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Vs([t[0][1],t[1][1]]):new Ns(t)},qs[wt.GRADIENT_COLOR]=function(t){return new Ds(t)},qs[wt.LINEAR_PATH]=function(t){return new zs(t)},qs[wt.BEZIER_CURVE]=function(t){return 1===t.length?new Ps(t[0][1][1]):new ks(t)},qs[wt.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Ps(Zs(Ce,[].concat(t[1][0]))):new Us(t)},qs[wt.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Ps(Zs(Me,[].concat(t[1][0]))):new Bs(t)},qs[wt.COLOR_CURVE]=function(t){return new to(t)},qs[wt.VECTOR4_CURVE]=function(t){return new Ks(t)},qs[wt.VECTOR2_CURVE]=function(t){return new Qs(t)},qs);function $s(t){if(!t||!isNaN(+t))return new Ps(t||0);if(o(t,Os))return t;if(Z(Js[t[0]]))return Js[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Ln["ValueType: 21/22 is not supported"]+".")}var to=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Re,e}Ct(e,t);var r=e.prototype;return r.onCreate=function(t){this.rCurve=$s(t[0]),this.gCurve=$s(t[1]),this.bCurve=$s(t[2]),this.aCurve=$s(t[3])},r.getValue=function(t){var e=this.rCurve.getValue(t),r=this.gCurve.getValue(t),i=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Os),eo=1,ro=function(){function t(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new Ce,n=new Me,s=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,s),e.x=s.x,e.y=s.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},e.createMaterial=function(t){var e,r=[["ENV_EDITOR",(null==(e=this.engine.renderer)?void 0:e.env)===In]],i=$s(this.color).getValue(0),n={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:exports.GLSLVersion.GLSL1,cacheId:t.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=Pr.create(this.engine,n);return s.blending=!0,s.depthTest=!1,s.setVector4("uPos",new Se(0,0,0,0)),s.setVector2("uSize",new Ae(1,1)),s.setVector4("uColor",new Se(i[0]/255,i[1]/255,i[2]/255,i[3])),s.setQuaternion("uQuat",new Me(0,0,0,0)),s},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Wr.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:ke.LINES,maxVertex:4})},e.createMesh=function(t,e){return ii.create(this.engine,{name:"Interact_preview"+eo++,priority:0,worldMatrix:Oe.fromIdentity(),geometry:t,material:e})},t}();function io(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var r=e.item.props.content.options.behavior,i=e.getBoundingBox();return i?{type:i.type,triangles:i.area,behavior:r}:void 0}},e}Ct(e,t);var r=e.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.props.content.options,e=this.item.engine.renderer.env,r=this.item.composition,i=this.interactData.options,n=i.type,s=i.showPreview;if(n===vt.CLICK&&(this.clickable=!0,s&&e===In)){var o=null==r?void 0:r.getRendererOptions();void 0!==o&&(this.previewContent=new ro(this.item.props.content,o,this.transform,this.engine))}t.type===vt.DRAG&&(e!==In||t.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(t,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,r=this.item.engine.renderer.env;if(e===vt.CLICK)this.clickable=!0;else if(e===vt.DRAG){var i,n=this.interactData.options,s=n.enableInEditor;if(r!==In||s)(null==(i=this.item.composition)?void 0:i.event)&&this.beginDragTarget(n,this.item.composition.event)}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var r,i=this.item.props.content.options;null==(r=this.item.composition)||r.addInteractiveItem(this.item,i.type)}}else if(this.item.time>=0){var n,s=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,s.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,io(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var r,i,n=t.cameraParam,s=n.position,o=n.fov,a=e.dy,u=e.dx*e.width/e.height,h=s[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(h),l=a*c,f=u*c,p=this.dragRange,d=p.dxRange,m=p.dyRange,v=s[0]-this.dragRatio[0]*f,y=s[1]-this.dragRatio[1]*l,g=d[0],x=d[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==(r=e.origin)||r.preventDefault();if(y!==b&&y!==T&&b!==T)null==(i=e.origin)||i.preventDefault();this.item.composition.camera.position=new Ce(v,y,h)}},r.beginDragTarget=function(t,r){var i=this;if("camera"===t.target){var n,s={touchstart:function(t){var e;if(i.canInteract()){i.dragEvent=null,i.bouncingArg=null;var r=null==(e=i.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}}},touchmove:function(t){i.handleDragMove(n,t),i.bouncingArg=t},touchend:function(t){if(i.canInteract()){var e=i.bouncingArg;if(!io(e,3)&&e){e.vx*=5,e.vy*=5,i.dragEvent=Ye({},n)}n=null}}};Object.keys(s).forEach((function(t){r.addEventListener(t,s[t])})),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(s).forEach((function(t){r.removeEventListener(t,s[t])}))}}},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=ls(Ce.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}},r.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===vt.DRAG){var r=e.options;r.dxRange&&(this.dragRange.dxRange=r.dxRange),r.dyRange&&(this.dragRange.dyRange=r.dyRange)}},r.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},oe(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(ve),exports.InteractComponent=u([ce(Qt.InteractComponent)],exports.InteractComponent);var no,so=function(){function t(){this.triangles=[],this.worldMatrix=new Oe,this.assemblyTriangles=function(t,e,r,i,n){for(var s=r;s<i;s+=3){var o=3*e[s],a=3*e[s+1],u=3*e[s+2],h={x:t[o],y:t[o+1],z:t[o+2]},c={x:t[a],y:t[a+1],z:t[a+2]},l={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:c,p2:l})}}}var e=t.prototype;return e.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},e.getBoundingBox=function(){for(var t,e=-Number.MAX_VALUE,r=-Number.MAX_VALUE,i=Number.MAX_VALUE,n=Number.MAX_VALUE,o=s(this.boundingBoxData.area);!(t=o()).done;){var a=t.value;e=Math.max(a.p0.x,a.p1.x,a.p2.x,e),r=Math.max(a.p0.y,a.p1.y,a.p2.y,r),i=Math.min(a.p0.x,a.p1.x,a.p2.x,i),n=Math.min(a.p0.y,a.p1.y,a.p2.y,n)}var u=[],h=new Ce(i,r,0),c=new Ce(e,r,0),l=new Ce(e,n,0),f=new Ce(i,n,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var r,i=[],n=s(this.triangles);!(r=n()).done;){var o=r.value;i.push({p0:o.p0,p1:o.p1,p2:o.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:exports.HitTestType.triangle,area:i}},e.geometryToTriangles=function(t){var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[];if(!e||!r)return i;if(0===t.subMeshes.length)this.assemblyTriangles(r,e,0,e.length,i);else for(var n,o=s(t.subMeshes);!(n=o()).done;){var a=n.value;if(void 0!==a.indexCount){var u=e.BYTES_PER_ELEMENT,h=a.offset/u,c=h+a.indexCount;this.assemblyTriangles(r,e,h,c,i)}}return i},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new Ce),t.p1=e.worldMatrix.transformPoint(t.p1,new Ce),t.p2=e.worldMatrix.transformPoint(t.p2,new Ce)})),t},t}(),oo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return Ct(e,t),e}(_t),ao=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=s(this.playableOutputs);!(e=r()).done;){e.value.context.deltaTime=t}for(var i,n=s(this.playableOutputs);!(i=n()).done;){var o=i.value;this.prepareFrameWithRoot(o)}for(var a,u=s(this.playableOutputs);!(a=u()).done;){var h=a.value;this.processFrameWithRoot(h)}},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrame(t.context),t.processFrame()},e.prepareFrameWithRoot=function(t){t.prepareFrame(),t.sourcePlayable.prepareFrame(t.context)},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),uo=function(){function t(t,e){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0,t.addPlayable(this)}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}(),ho=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t){this.sourcePlayable=t},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),co=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(pe);function lo(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused"}(no||(no={}));var fo=new Me,po=1,mo=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new Ce(0,0,0),this.quat=new Me(0,0,0,1),this.rotation=new Zr(0,0,0),this.scale=new Ce(1,1,1),this.anchor=new Ce(0,0,0),this.size=new Ae(1,1),this.children=[],this.worldMatrix=Oe.fromIdentity(),this.localMatrix=Oe.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new Ce(0,0,0),quat:new Me(0,0,0,1),scale:new Ce(1,1,1)},this.name="transform_"+po++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,r){this.position.x===t&&this.position.y===e&&this.position.z===r||(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){0===t&&0===e&&0===r||(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===r||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){this.quat.x===t&&this.quat.y===e&&this.quat.z===r&&this.quat.w===i||(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){this.scale.x===t&&this.scale.y===e&&this.scale.z===r||(this.scale.x=t,this.scale.y=e,this.scale.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var r=t.position,i=t.rotation,n=t.scale,s=t.size,a=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),r&&(o(r,Ce)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)o(a,Me)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(i){var c=e?-1:1;o(i,Zr)?this.setRotation(i.x*c,i.y*c,i.z*c):this.setRotation(i[0]*c,i[1]*c,i[2]*c)}n&&(o(n,Ce)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),s&&this.setSize(s.x,s.y),h&&(o(h,Ae)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){y(this.children,t)},e.removeChild=function(t){g(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Zr)},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.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Zr)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),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={position:(new Ce).copyFrom(t.position),rotation:new Zr(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:(new Ce).copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var r=fo.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},oe(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}(),vo=new Ce(1,1,1),yo=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new mo,this.viewportMatrix=Oe.fromIdentity(),this.viewMatrix=Oe.fromIdentity(),this.projectionMatrix=Oe.fromIdentity(),this.viewProjectionMatrix=Oe.fromIdentity(),this.inverseViewMatrix=Oe.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,s=void 0===n?20:n,o=e.fov,a=void 0===o?60:o,u=e.aspect,h=void 0===u?1:u,c=e.clipMode,l=void 0===c?St.portrait:c,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d,v=new Zr(m[0],m[1],m[2]),y=(new Me).setFromEuler(v);this.options={near:i,far:s,fov:a,aspect:h,clipMode:l},this.transform.setPosition(p[0],p[1],p[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 Ce(this.position.x,this.position.y,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();i.premultiply(n),r.multiply(n.invert())}var s=r.projectPoint(e).z,o=i.projectPoint(new Ce(1,1,s)),a=o.x,u=o.y,h=i.projectPoint(new Ce(-1,-1,s)),c=h.x,l=h.y;return new Ce((a-c)/2,(u-l)/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 Ye({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,s=t.aspect,o=t.position,a=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=s,this.position=o,this.rotation=a,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,r=e.fov,i=e.aspect,n=e.near,s=e.far,o=e.clipMode;this.projectionMatrix.perspective(r*ge,i,n,s,o===St.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),vo),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Oe.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},oe(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}(),go=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,s=t.probability;this.time=+e||0,this.interval=+r||1,this.count=o(i,Os)?i:$s(i),this.cycles=+n||1/0,this.probability=isNaN(s)?1:+s,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}(),xo=function(t){this.content=t},bo=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new xo(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new xo(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do{t.call(e||this,r.content,i--)}while(r=r.pre)},e.getNodeByIndex=function(t){var e=0,r=this.first;if(!r||t>=this.length||t<0)return null;for(;e<t;)r=r.next,e++;return r},t}(),To="lookup_texture",Eo="offscreen_canvas",_o={};function Ao(t){return _o[t]}var Co=new Ce,So=new Ce,wo=function(){function t(t,e){this.pointStart=[];var r,i=e.colorOverLifetime,n=e.colorOverTrail,s=e.maxTrailCount,a=e.opacityOverLifetime,u=void 0===a?$s(1):a,h=e.widthOverTrail,c=e.name,l=e.occlusion,f=e.blending,p=e.maskMode,d=e.mask,m=e.textureMap,v=void 0===m?[0,0,1,1]:m,y=e.texture,g=e.transparentOcclusion,x=e.minimumVertexDistance,b=e.lifetime,T=e.matrix,E=t.gpuCapability,_=E.detail,A=E.level,C=Math.max(e.pointCountPerTrail,2),S={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},w=_.maxVertexTextures>0,R=(null!=(r=t.renderer)?r:{}).env,M={},O=[["ENABLE_VERTEX_TEXTURE",w],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===In]],P=s>64,I=0;i&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,M.uColorOverLifetime=mr.createWithData(t,L(i))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,M.uColorOverTrail=mr.createWithData(t,L(n))),P?(O.push(["ATTR_TRAIL_START",1]),I|=8):M.uTrailStart=new Float32Array(s),M.uOpacityOverLifetimeValue=u.toUniform(S);var F=h.toUniform(S);O.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),M.uVCurveValues=Os.getAllData(S);var V={shader:{vertex:pi,fragment:li,macros:O,glslVersion:1===A?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+I+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},D=C*s*2,N=(C-1)*s,k=Float32Array.BYTES_PER_ELEMENT,z=12*k,U={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*D)},aSeed:{size:1,stride:z,offset:4*k,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*k,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*k,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(D)},aDir:{size:3,data:new Float32Array(3*D)}},indices:{data:new Uint16Array(6*D)},drawCount:6*N,name:"trail#"+c,bufferUsage:ke.DYNAMIC_DRAW};if(P)U.attributes.aTrailStart={size:1,data:new Float32Array(D)};else{var B=new Float32Array(D);U.attributes.aTrailStartIndex={size:1,data:B};for(var G=0;G<s;G++)for(var j=2*C,X=G*j,H=0;H<j;H++)B[X+H]=G}var W=je(f),Y=Pr.create(t,V);Y.blending=!0,Y.depthMask=l,Y.depthTest=!0,Y.stencilRef=d?[d,d]:void 0,We(Y,p),Xe(Y,f);var Z=this.mesh=ii.create(t,{name:"MTrail_"+c,material:Y,geometry:Wr.create(t,U)}),q=null!=y?y:mr.createWithData(t);Object.keys(M).map((function(t){var e=M[t];if(o(e,mr))Y.setTexture(t,e);else if("uTrailStart"===t)Y.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var r=[],i=0;i<e.length;i+=4){var n=new Se(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}Y.setVector4Array(t,r)}else Y.setVector4(t,Se.fromArray(e))})),Y.setFloat("uTime",0),Y.setVector4("uWidthOverTrail",Se.fromArray(F)),Y.setVector2("uTexOffset",new Ae(0,0)),Y.setVector4("uTextureMap",Se.fromArray(v)),Y.setVector4("uParams",new Se(0,C-1,0,0)),Y.setTexture("uMaskTex",q),Y.setVector4("uColorParams",new Se(y?1:0,+W,0,+(l&&!g))),this.maxTrailCount=s,this.pointCountPerTrail=C,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=P,this.lifetime=b,T&&(this.mesh.worldMatrix=T),this.geometry=Z.firstGeometry(),this.trailCursors=new Uint16Array(s)}var e=t.prototype;return e.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,o=n-1,a=i%n,u=(i-1)%n,h=(i-2)%n,c=this.getTrailPosition(t,u,Co);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+a,f=Po(c,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*l,y=new Float32Array(6);y.set(f,0),y.set(f,3),s.setAttributeSubData("aDir",v,y),s.setAttributeSubData("aTime",2*l,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(b,20),x[23]=-.5*m,s.setAttributeSubData("aColor",24*l,x),u>=0){var T=this.getTrailPosition(t,h,So),E=new Float32Array(Po(T,c,e)),_=6*(t*n+u);s.setAttributeSubData("aDir",_,E),s.setAttributeSubData("aDir",_+3,E);var A=t*n*2,C=new Uint16Array([2*u+A,2*u+1+A,2*a+A,2*a+A,2*u+1+A,2*a+1+A]),S=6*(t*o+(i-1)%o);s.setIndexSubData(S,C)}i=++this.trailCursors[t];var w=this.mesh.material,R=w.getVector4("uParams"),M=d[2];if(this.useAttributeTrailStart){for(var O=2*n,P=new Float32Array(O),I=0;I<O;I++)P[I]=M;s.setAttributeSubData("aTrailStart",t*P.length,P)}else{var L=w.getFloats("uTrailStart");null!=L&&(L[t]=M,w.setFloats("uTrailStart",L))}R&&(R.y=Math.max(R.y,i-1)-Math.max(0,i-n),w.setVector4("uParams",R))}},e.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,s=this.geometry.getAttributeData("aColor");return k(s),r.x=s[n],r.y=s[1+n],r.z=s[2+n],r}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();k(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");k(e);for(var r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();k(r),r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),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){},oe(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}(),Ro=new Ce,Mo=new Ce,Oo=new Ce;function Po(t,e,r){var i=Ro;return t||r?(t?r?(Mo.subtractVectors(e,t).normalize(),Mo.subtractVectors(r,e),Oo.copyFrom(Mo).normalize(),i.addVectors(Mo,Oo)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var Io=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}Ct(e,t);var r=e.prototype;return r.start=function(t){var e=t.output.getUserData();!this.particleSystem&&o(e,exports.VFXItem)&&(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem&&(this.particleSystem.name=e.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var r=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),Math.abs(this.time-this.lastTime)<.001&&(r=0),e.update(r)}this.lastTime=this.time},e}(uo),Lo=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){return new Io(t)},e}(co),Fo={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"},Vo=function(){function t(t,e){var r;this.particleCount=0,this.cachedRotationVector3=new Ce,this.cachedRotationMatrix=new qr,this.cachedLinearMove=new Ce,this.tempMatrix3=new qr,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,n,s=(null!=(r=t.renderer)?r:{}).env,a=e.speedOverLifetime,u=e.colorOverLifetime,h=e.linearVelOverLifetime,c=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,f=e.rotationOverLifetime,p=e.sprite,d=e.gravityModifier,m=e.maxCount,v=e.textureFlip,y=e.useSprite,g=e.name,x=e.gravity,b=e.forceTarget,T=e.side,E=e.occlusion,_=e.anchor,A=e.blending,C=e.maskMode,S=e.mask,w=e.transparentOcclusion,R=e.meshSlots,M=e.renderMode,O=void 0===M?0:M,P=e.diffuse,I=void 0===P?mr.createWithData(t):P,F=t.gpuCapability.detail,V=F.halfFloatTexture,D=F.maxVertexUniforms,N=[["RENDER_MODE",+O],["ENV_EDITOR",s===In]],k=t.gpuCapability.level,z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},B=D>0,G={},j=0,X=0;(this.useSprite=y,B&&N.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(N.push(["SPEED_OVER_LIFETIME",!0]),X|=2,G.uSpeedLifetimeValue=a.toUniform(z)),(null==p?void 0:p.animate)&&(N.push(["USE_SPRITE",!0]),X|=4,G.uFSprite=G.uSprite=new Float32Array([p.col,p.row,p.total,p.blend?1:0]),this.useSprite=!0),(null==u?void 0:u.color)&&(N.push(["COLOR_OVER_LIFETIME",!0]),X|=16,G.uColorOverLifetime=o(u.color,mr)?u.color:mr.createWithData(t,L(u.color))),(null==u?void 0:u.opacity)?G.uOpacityOverLifetimeValue=u.opacity.toUniform(z):G.uOpacityOverLifetimeValue=$s(1).toUniform(z),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==h?void 0:h[t])&&(G["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(z),r=1,X|=1<<7+e,h.enabled=!0),N.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==c?void 0:c[t])&&(G["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=c[t].toUniform(z),n=1,X|=1<<10+e,i=!0,c.enabled=!0),N.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==h?void 0:h.asMovement)&&(N.push(["AS_LINEAR_MOVEMENT",!0]),X|=32),i&&((null==c?void 0:c.asRotation)&&(N.push(["AS_ORBITAL_MOVEMENT",!0]),X|=64),G.uOrbCenter=new Float32Array((null==c?void 0:c.center)||[0,0,0])),G.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(z),null==l?void 0:l.separateAxes)&&(N.push(["SIZE_Y_BY_LIFE",1]),X|=16384,G.uSizeYByLifetimeValue=null==l||null==(n=l.y)?void 0:n.toUniform(z));(null==f?void 0:f.z)&&(G.uRZByLifeTimeValue=f.z.toUniform(z),X|=32768,N.push(["ROT_Z_LIFETIME",1])),(null==f?void 0:f.x)&&(G.uRXByLifeTimeValue=f.x.toUniform(z),X|=65536,N.push(["ROT_X_LIFETIME",1])),(null==f?void 0:f.y)&&(G.uRYByLifeTimeValue=f.y.toUniform(z),X|=1<<17,N.push(["ROT_Y_LIFETIME",1])),(null==f?void 0:f.asRotation)&&(N.push(["ROT_LIFETIME_AS_MOVEMENT",1]),X|=1<<18),G.uGravityModifierValue=d.toUniform(z),b&&(N.push(["FINAL_TARGET",!0]),X|=1<<19,G.uFinalTarget=new Float32Array(b.target||[0,0,0]),G.uForceCurve=b.curve.toUniform(z)),V&&U.max?(X|=1<<20,G.uFCurveValueTexture=vr(t,Os.getAllData(U,!0),U.index,1)):G.uFCurveValues=Os.getAllData(U);var H=z.max+z.curves.length-32>D;if(2===k&&(z.max=-1,z.index=R?R[0]:No(z.index),U.index>0&&(U.max=-1,U.index=R?R[1]:No(U.index))),H&&V&&B){var W=vr(t,Os.getAllData(z,!0),z.index,1);G.uVCurveValueTexture=W,j=1}else G.uVCurveValues=Os.getAllData(z);var Y=["-p:",O,X,z.index,z.max,U.index,U.max].join("+");N.push(["VERT_CURVE_VALUE_COUNT",z.index],["FRAG_CURVE_VALUE_COUNT",U.index],["VERT_MAX_KEY_FRAME_COUNT",z.max],["FRAG_MAX_KEY_FRAME_COUNT",U.max]),this.VERT_MAX_KEY_FRAME_COUNT=z.max;var Z={shader:{fragment:li,vertex:"#define LOOKUP_TEXTURE_CURVE "+j+"\n"+fi,glslVersion:1===k?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:Y,macros:N,name:"particle#"+g},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},q=je(A);G.uTexOffset=new Float32Array(I?[1/I.getWidth(),1/I.getHeight()]:[0,0]),G.uMaskTex=I,G.uColorParams=new Float32Array([I?1:0,+q,0,+(!!E&&!w)]),G.uParams=[0,0,0,0],G.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var K=Pr.create(t,Z);K.blending=!0,K.depthTest=!0,K.depthMask=!!E,K.stencilRef=S?[S,S]:void 0,We(K,C),Xe(K,A),He(K,T),Object.keys(G).map((function(t){var e=G[t];if(o(e,mr))K.setTexture(t,e);else{var r=[];switch(Fo[t]){case"vec4":K.setVector4(t,Se.fromArray(e));break;case"vec3":K.setVector3(t,Ce.fromArray(e));break;case"vec2":K.setVector2(t,Ae.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new Se(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}K.setVector4Array(t,r),r.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),K.setVector3("emissionColor",new Ce(0,0,0)),K.setFloat("emissionIntensity",0);var Q=Wr.create(t,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,s={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*i,data:new Float32Array(0)},aRotation1:{size:3,offset:3*i,stride:9*i,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*i,stride:9*i,dataSource:"aRotation0"}};e&&(s.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:s,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*m,this.useSprite,"particle#"+g)),J=ii.create(t,{name:"MParticle_"+g,material:K,geometry:Q});this.anchor=_,this.mesh=J,this.geometry=J.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=l,this.speedOverLifetime=a,this.linearVelOverLifetime=h,this.orbitalVelOverLifetime=c,this.orbitalVelOverLifetime=c,this.gravityModifier=d,this.rotationOverLifetime=f,this.maxCount=m,this.textureOffsets=v?[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"),r=32*t+4;return k(e),[e[r],e[r+1],e[r+2],e[r+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(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new r.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),r=Math.ceil(e.length/12);this.applyTranslation(r,t),this.applyRotation(r,t),this.applyLinearMove(r,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,s=this.geometry,o=i>this.maxParticleBufferCount,a=1;this.particleCount>300?a=(this.particleCount+100)/this.particleCount:this.particleCount>100?a=1.4:this.particleCount>0&&(a=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 c=new Ce,l=new Me,f=new Ce(1,1,1);e.transform.assignWorldTRS(c,l,f);var p,d=mo.getRotation(l,new Zr),m=c.toArray(),v=d.toArray(),y=this.textureOffsets,g=[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],A=Math.random();h&&(p=e.sprite);for(var C=0;C<4;C++){var S=2*C,w=3*C,R=4*C,M=12*C,O=8*C;u.aPos.set(m,M),T.fill(u.aPos,M+3),u.aRot.set(v,O),u.aRot[O+3]=A,u.aRot.set(E,O+4),h&&u.aSprite.set(p,w);var P=e.uv||b;if(P){var I=h?1-y[S+1]:y[S+1];g[0]=P[0]+y[S]*P[2],g[1]=P[1]+I*P[3]}u.aOffset.set(g,R);for(var L=C+C,F=(_[L]-this.anchor.x)*f.x,V=(_[L+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[M+6+D]=e.dirX.getElement(D)*F,u.aPos[M+9+D]=e.dirY.getElement(D)*V}var N=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(o){var z=x(s.getIndexData(),6*i,6*r,a);z.set(N,6*t),s.setIndexData(z),this.maxParticleBufferCount=z.length/6}else s.setIndexSubData(6*t,N);Object.keys(u).forEach((function(e){var i=u[e],h=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var c=s.getAttributeData(e);k(c);var l=x(c,n*h,4*r*h,a);l.set(i,i.length*t),s.setAttributeData(e,l)}else s.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),s.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var r=this.time,i=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");i.length<3*t&&(i=this.expandArray(i,3*t));for(var o=0,a=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;o=n[f],a=n[f+1],u=n[f+2];var p=r-s[4*l+2],d=s[4*l+3];if(h&&c){var m=this.gravityModifier.getIntegrateValue(0,p,d),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(p/d);o=o*x+v,a=a*x+y,u=u*x+g}else o+=v,a+=y,u+=g}var b=3*l;if(s[4*l+2]<r){var T=o*(e/1e3),E=a*(e/1e3),_=u*(e/1e3);i[b]+=T,i[b+1]+=E,i[b+2]+=_,i[b+3]+=T,i[b+4]+=E,i[b+5]+=_,i[b+6]+=T,i[b+7]+=E,i[b+8]+=_,i[b+9]+=T,i[b+10]+=E,i[b+11]+=_}}this.geometry.setAttributeData("aTranslation",i)},e.applyRotation=function(t,e){var r=this.geometry.getAttributeData("aRotation0"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),s=this.geometry.getAttributeData("aSeed"),a=this.time,u=this.cachedRotationMatrix;r.length<9*t&&(r=this.expandArray(r,9*t));for(var h=0;h<t;h+=4){var c=_e((a-i[4*h+2])/i[4*h+3],0,1),l=8*h,f=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),p=s[8*h+3],d=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(o(this.rotationOverLifetime.x,Ls)?d.x+=this.rotationOverLifetime.x.getValue(c,p):d.x+=this.rotationOverLifetime.x.getValue(c)),this.rotationOverLifetime.y&&(o(this.rotationOverLifetime.y,Ls)?d.y+=this.rotationOverLifetime.y.getValue(c,p):d.y+=this.rotationOverLifetime.y.getValue(c)),this.rotationOverLifetime.z&&(o(this.rotationOverLifetime.z,Ls)?d.z+=this.rotationOverLifetime.z.getValue(c,p):d.z+=this.rotationOverLifetime.z.getValue(c))):u.setZero(),0===d.dot(d)&&u.identity();var m=Math.PI/180,v=d.x*m,y=d.y*m,g=d.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),_=Math.cos(y),A=Math.cos(g);u.set(A,-T,0,T,A,0,0,0,1),u.multiply(this.tempMatrix3.set(_,0,b,0,1,0,-b,0,_)),u.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var C=9*h,S=u.elements;r.set(S,C),h+4<=t&&(r.set(S,C+9),r.set(S,C+18),r.set(S,C+27))}this.geometry.setAttributeData("aRotation0",r)},e.applyLinearMove=function(t,e){var r=this.geometry.getAttributeData("aLinearMove"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),s=this.time;r.length<3*t&&(r=this.expandArray(r,3*t));var a=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=s-i[4*u+2],c=i[4*u+3],l=h/c,f=n[8*u+3];a.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(o(this.linearVelOverLifetime.x,Ls)?a.x=this.linearVelOverLifetime.x.getValue(l,f):a.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(o(this.linearVelOverLifetime.y,Ls)?a.y=this.linearVelOverLifetime.y.getValue(l,f):a.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(o(this.linearVelOverLifetime.z,Ls)?a.z=this.linearVelOverLifetime.z.getValue(l,f):a.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(o(this.linearVelOverLifetime.x,Ls)?a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.y&&(o(this.linearVelOverLifetime.y,Ls)?a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.z&&(o(this.linearVelOverLifetime.z,Ls)?a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,c)));var p=3*u;r[p]=a.x,r[p+1]=a.y,r[p+2]=a.z,r[p+3]=a.x,r[p+4]=a.y,r[p+5]=a.z,r[p+6]=a.x,r[p+7]=a.y,r[p+8]=a.z,r[p+9]=a.x,r[p+10]=a.y,r[p+11]=a.z}this.geometry.setAttributeData("aLinearMove",r)},e.expandArray=function(t,e){var r=new Float32Array(e);return r.set(t),r},t}(),Do=[10,32,64,160];function No(t){for(var e=0;e<Do.length;e++){var r=Do[e];if(r>t)return r}return t||Do[0]}var ko=function(t){function e(e,r,i){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",r&&(n.particleMesh=new Vo(e,r)),i&&(n.trailMesh=new wo(e,i));var s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}Ct(e,t);var r=e.prototype;return r.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=s(this.meshes);!(t=e()).done;){t.value.onStart()}},r.onUpdate=function(t){var e,r=this.particleMesh.time,i=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new Se;this.particleMesh.mesh.material.setVector4("uParams",i.set(r,this.item.duration,0,0))},r.render=function(t){this.maskManager.drawStencilMask(t);for(var e,r=s(this.meshes);!(e=r()).done;){e.value.render(t)}},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(r){t.push(e[r])})),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach((function(e){t.push(r[e])}))}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(ve);exports.ParticleSystem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).destroyed=!1,i.getHitTestParams=function(t){var e=i.interaction;if(t||e)return{type:exports.HitTestType.custom,collect:function(t){return i.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ot.removeParticle,ray:t})}}},i.maskManager=new Ir(e),r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===wt.CONSTANT_VEC3?e.add(i[1]):t=$s(i)),this.basicTransform={position:e,rotation:r,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 s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,r=e.path,i=e.position.clone();if(r){var n=this.item.duration;i.add(r.getValue(t/n))}if(this.transform.setPosition(i.x,i.y,i.z),this.options.particleFollowParent){var s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var s=i.first;i.removeNode(s),r=n[1]=s.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new Se(n[0],n[1],n[2],t));for(var s=i.getAttributeData("aColor")||[],o=0;o<s.length;o+=32)s[8*o+7]=t},r.setColor=function(t,e,r,i){var n,s=this.renderer.particleMesh.mesh.material,o=this.renderer.particleMesh.mesh.geometry,a=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new Se(a[0],a[1],a[2],i));for(var u=o.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=r,u[8*h+7]=i},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new bo((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1,this.destroyed=!1},r.update=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var o=this.particleLink,a=(r-n)/this.item.duration,u=this.timePassed,h=!1,c=function(){e.trails&&!h&&(h=!0,o.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,a,s,n)})))};if(this.ended){if(this.item.endBehavior!==Mt.restart&&Mt.destroy===this.item.endBehavior){var l=o.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,p=this.lifetime;if(u<f){var d=1/s.rateOverTime.getValue(p),m=Math.floor((u-this.lastEmitTime)/d),v=m,y=d/m,g=r,x=i.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=o.first;return e.emissionStopped||o.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(p);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var _=s.bursts,A=(null==_?void 0:_.length)-1,C=0;A>=0&&C<x&&!b();A--){var S=_[A],w=!S.disabled&&S.getGeneratorOptions(u,p);if(w){var R=s.burstOffsets[A],M=R&&R[w.cycleIndex]||[0,0,0];S.once&&this.removeBurst(A);for(var O=0;O<w.count&&C<x;O++){var P;if(b())break;var I=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:O,burstCount:w.count}));I.delay+=g,C++,(P=I.transform).translate.apply(P,[].concat(M)),this.addParticle(I,x)}}}}else if(this.item.endBehavior===Mt.restart)c(),this.loopStartTime=r-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===Mt.freeze&&(this.frozen=!0)}}c()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],r=0;r<this.renderer.meshes.length;r++){var i=this.renderer.meshes[r].material;e.push(i.colorMask),i.colorMask=!1}for(var n,o=s(this.renderer.meshes);!(n=o()).done;){n.value.render(t)}for(var a=0;a<this.renderer.meshes.length;a++){this.renderer.meshes[a].material.colorMask=e[a]}}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose({material:{textures:exports.DestroyOptions.keep}})}))},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var s=t.last,o=!1;!o;){var a=s.content[0],u=s.content[3];if(a>this.timePassed){var h=this.getPointPosition(u);r.push({center:h,size:u.transform.scale}),s.pre?s=s.pre:o=!0}++n>i&&(o=!0)}return r},r.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],s=new Ce,o=!1;if(i&&i.content)do{var a=i.content,u=a[0],h=a[1];a[2];var c=a[3];if(u>this.timePassed){var l=this.getPointPosition(c),f=t.ray,p=!1;f&&(p=!!f.intersectSphere({center:l,radius:t.radius},s)),p&&(t.removeParticle&&(r.removeParticlePoint(h),this.clearPointTrail(h),i.content=[0]),n.push(l),t.multiple||(o=!0))}}while((i=i.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var s=this.trails,o=this.getPointPosition(r),a=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),h=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(h*=u[0]),s.sizeAffectsLifetime&&(c*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&o.subtract(l)}n.addTrailPoint(t,o,{color:a,lifetime:c,size:h,time:i})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,s=t.gravity,o=void 0===s?[]:s,a=this.options.forceTarget,u=this.lastUpdate-n,h=new Ce,c=Ce.fromArray(o);e.assignWorldTRS(h);var l=ns(new Ce,this.options,c,u,i,h,r);if(a){var f=a.target||[0,0,0],p=a.curve.getValue(u/i),d=1-p;l.x=l.x*d+f[0]*p,l.y=l.y*d+f[1]*p,l.z=l.z*d+f[2]*p}return l},r.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),s=e.particleFollowParent?Oe.IDENTITY:this.transform.getWorldMatrix(),o=t.position,a=s.transformPoint(o,new Ce),u=new mo({position:a,valid:!0}),h=t.direction;if(h=s.transformNormal(h,zo).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)Xo.setElement(c,e.turbulence[c].getValue(r));Ho.setFromVector3(Xo.negate()),Yo.setFromEuler(Ho).transformNormal(h).normalize()}var l,f=Go,p=jo;i.alignSpeedDirection?(p.copyFrom(h),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=Ce.Z.clone(),s.transformNormal(this.upDirectionWorld)),f.crossVectors(p,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),p.set(0,1,0));var d=this.textureSheetAnimation;d&&d.animate&&((l=Wo)[0]=d.animationDelay.getValue(r),l[1]=d.animationDuration.getValue(r),l[2]=d.cycles.getValue(r));var m=Bo;e.start3DRotation?m.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?m.set(0,0,e.startRotation.getValue(r)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(r);3===v.length&&(v[3]=1);var y=Uo;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var g=e.startSize.getValue(r),x=e.sizeAspect.getValue(r);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new Ce;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(r),lifetime:e.startLifetime.getValue(r),uv:qo(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:p,dirX:f,transform:u}},r.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&o(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e;this.props=r,this.destroyed=!1;var i,n,s,a,u,h=r.options,c=r.positionOverLifetime,l=void 0===c?{}:c,f=r.shape,p=null==l?void 0:l.gravityOverLifetime,d=ss(null==l?void 0:l.gravity),m=r.textureSheetAnimation,v=m?{animationDelay:$s(m.animationDelay||0),animationDuration:$s(m.animationDuration||1),cycles:$s(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&&(i=[$s(null!=(n=f.turbulenceX)?n:0),$s(null!=(s=f.turbulenceY)?s:0),$s(null!=(a=f.turbulenceZ)?a:0)]);this.name="ParticleSystem",this.shape=nn(f),this.emission={rateOverTime:$s(r.emission.rateOverTime),burstOffsets:Zo(null!=(u=r.emission.burstOffsets)?u:[]),bursts:(r.emission.bursts||[]).map((function(t){return new go(t)}))},this.textureSheetAnimation=v;var g,x,b=r.renderer||{},T=r.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?$s(T.z):$s(0),T.separateAxes&&(g.x=T.x&&$s(T.x),g.y=T.y&&$s(T.y))),(null==l?void 0:l.forceTarget)&&(x={target:l.target||[0,0,0],curve:$s(l.forceCurve||[wt.LINE,[[0,0],[1,1]]])});var E={x:l.linearX&&$s(l.linearX||0),y:l.linearY&&$s(l.linearY||0),z:l.linearZ&&$s(l.linearZ||0),asMovement:l.asMovement},_={x:l.orbitalX&&$s(l.orbitalX),y:l.orbitalY&&$s(l.orbitalY),z:l.orbitalZ&&$s(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},A=r.sizeOverLifetime||{},C=r.colorOverLifetime,S=(null==A?void 0:A.separateAxes)?{separateAxes:!0,x:$s(A.x),y:$s(A.y)}:{separateAxes:!1,x:$s(("size"in A?A.size:A.x)||1)};b.anchor=b.anchor||[0,0];var w,R=Ae.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:$s(h.startLifetime),startDelay:$s(h.startDelay||0),startSpeed:$s(l.startSpeed||0),startColor:$s(h.startColor),looping:!1,maxCount:null!=(w=h.maxCount)?w:0,gravityModifier:$s(p||0),gravity:d,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:i,speedOverLifetime:l.speedOverLifetime&&$s(l.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:_,forceTarget:x},h.startRotationZ&&(this.options.startRotation=$s(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=$s(h.startRotationX||0),this.options.startRotationY=$s(h.startRotationY||0),this.options.startRotationZ=$s(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=$s(h.startSizeX),this.options.startSizeY=$s(h.startSizeY)):(this.options.startSize=$s(h.startSize),this.options.sizeAspect=$s(h.sizeAspect||1));var M=this.getMaskOptions(r),O={meshSlots:h.meshSlots,name:this.name,matrix:Oe.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||xt.BILLBOARD,side:b.side||ft.DOUBLE,gravity:d,blending:b.blending||lt.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:M.maskRef,maskMode:M.maskMode,forceTarget:x,diffuse:b.texture?this.engine.findObject(b.texture):void 0,sizeOverLifetime:S,anchor:R};if(C){var P=C.color,I=C.opacity;O.colorOverLifetime={},I&&(O.colorOverLifetime.opacity=$s(C.opacity)),P&&(P[0]===wt.GRADIENT_COLOR?O.colorOverLifetime.color=C.color[1]:P[0]===wt.RGBA_COLOR?O.colorOverLifetime.color=mr.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):o(P,mr)&&(O.colorOverLifetime.color=P))}var L,F=[],V=[0,0,1,1];if(r.splits){var D=r.splits[0];V=(L=D[4])?[D[0],D[1],D[3],D[2]]:[D[0],D[1],D[2],D[3]]}if(v&&!v.animate)for(var N=L?v.row:v.col,k=L?v.col:v.row,z=v.total||N*k,U=0,B=0;B<N;B++)for(var G=0;G<k&&U<z;G++,U++)F.push([B*V[2]/N+V[0],G*V[3]/k+V[1],V[2]/N,V[3]/k]);else F.push(V);this.uvs=F,O.textureFlip=L;var j,X=r.trails;X&&(this.trails={lifetime:$s(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},M=this.getMaskOptions(X),j={name:"Trail",matrix:Oe.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:$s(X.opacityOverLifetime||1),widthOverTrail:$s(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:M.maskRef,maskMode:M.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===wt.GRADIENT_COLOR&&(j.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===wt.GRADIENT_COLOR&&(j.colorOverTrail=X.colorOverTrail[1])),this.renderer=new ko(this.engine,O,j),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var H,W=r.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(H=W.radius)?H:.4,behavior:W.behavior});this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},r.getMaskOptions=function(t){var e=exports.MaskMode.NONE,r=0;return t.mask&&(e=this.maskManager.getMaskMode(t.mask),r=this.maskManager.getRefValue()),{maskMode:e,maskRef:r}},oe(e,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{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}(de),exports.ParticleSystem=u([ce(Qt.ParticleSystem)],exports.ParticleSystem);var zo=new Ce,Uo=new Ae,Bo=new Zr,Go=new Ce,jo=new Ce,Xo=new Ce,Ho=new Zr,Wo=[0,0,0],Yo=new Oe;function Zo(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=o(t,Array),i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function qo(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var Ko,Qo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}Ct(e,t);var r=e.prototype;return r.processFrame=function(t){for(var e,r=s(this.clipPlayables);!(e=r()).done;){e.value.processFrame(t)}this.evaluate(t)},r.setClipWeight=function(t,e){if(o(t,uo)){for(var r=0;r<this.clipPlayables.length;r++)if(this.clipPlayables[r]===t)return void(this.clipWeights[r]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},r.getClipWeight=function(t){return this.clipWeights[t]},r.getClipPlayable=function(t){return this.clipPlayables[t]},r.evaluate=function(t){},e}(uo),Jo=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(o(e,exports.VFXItem)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?(r.transform.setValid(!0),r.setActive(!0)):(r.transform.setValid(!1),r.setActive(!1))}},e}(Qo),$o=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(uo),ta=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyName="",e}return Ct(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var r=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var i=0;i<this.clipPlayables.length;i++){var n=this.getClipWeight(i);if(n>0){var s=this.getClipPlayable(i);if(!o(s,$o)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var a=s.value;this.addWeightedValue(a,n),r=!0}}r&&(e[this.propertyName]=this.propertyValue)}}},e}(Qo),ea=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.setZero()},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.r+=t.r*e,r.g+=t.g*e,r.b+=t.b*e,r.a+=t.a*e},e}(ta),ra=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue=0},r.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(ta),ia=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){},e}(Qo),na=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){},e}(Qo),sa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();o(e,exports.CompositionComponent)&&(e.time=this.getTime())},e}(uo),oa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(o(e,exports.CompositionComponent)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?r.item.setActive(!0):r.item.setActive(!1)}},e}(Qo),aa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.evaluate=function(t){},e}(Qo),ua=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e,r.z+=t.z*e,r.w+=t.w*e},e}(ta),ha=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e},e}(ta),ca=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,r=this.duration;return e-r>0&&(this.endBehavior===Mt.restart?e%=r:this.endBehavior===Mt.freeze&&(e=Math.min(r,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}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},r.createTrackMixer=function(t){return new Qo(t)},r.createOutput=function(){return new ho},r.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},r.createMixerPlayableGraph=function(t,e){for(var r,i=[],n=s(this.clips);!(r=n()).done;){var o=r.value;i.push(o)}return this.compileClips(t,i,e)},r.compileClips=function(t,e,r){for(var i,n=this.createTrackMixer(t),o=s(e);!(i=o()).done;){var a=i.value,u=this.createClipPlayable(t,a);u.setDuration(a.duration);var h=new la(a,u,n,this);r.push(h),n.clipPlayables.push(u),n.setClipWeight(u,0)}return n},r.createPlayable=function(t){return new uo(t)},r.getChildTracks=function(){return this.children},r.addChild=function(t){this.children.push(t),t.parent=this},r.createClip=function(t,e){var r=new ca;return r.asset=new t(this.engine),r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=s(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},r.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},r.fromData=function(e){t.prototype.fromData.call(this,e);for(var r,i=s(this.children);!(r=i()).done;){r.value.parent=this}},e}(co),u([le(ca)],exports.TrackAsset.prototype,"clips",void 0),u([le()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=u([ce(Qt.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(Ko=exports.TrackType||(exports.TrackType={}))[Ko.MasterTrack=0]="MasterTrack",Ko[Ko.ObjectTrack=1]="ObjectTrack";var la=function(){function t(t,e,r,i){this.clip=t,this.playable=e,this.parentMixer=r,this.track=i,o(this.track.boundObject,exports.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(exports.ParticleSystem))}return t.prototype.evaluateAt=function(t){var e=this.clip,r=1,i=!1,n=!1,s=this.track.boundObject;t>=e.start+e.duration&&e.endBehavior===Mt.destroy?o(s,exports.VFXItem)&&exports.VFXItem.isParticle(s)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,i=!0):t-this.clip.start>=0?(r=1,n=!0):t<e.start&&(r=0),n&&this.playable.getPlayState()!==no.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var a=e.toLocalTime(t);this.playable.setTime(a),i&&this.playable.getPlayState()===no.Playing&&this.playable.pause()},oe(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 Ct(e,t),e.prototype.createTrackMixer=function(t){return new Jo(t)},e}(exports.TrackAsset),exports.ActivationTrack=u([ce(Qt.ActivationTrack)],exports.ActivationTrack);var fa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=this.path.split(".");this.propertyNames=r},e}(exports.TrackAsset);u([le()],fa.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createTrackMixer=function(t){var e=new ra(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},e}(fa),exports.FloatPropertyTrack=u([ce(Qt.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){return new na(t)},e}(exports.TrackAsset),exports.SpriteColorTrack=u([ce(Qt.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!o(this.parent.boundObject,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(exports.CompositionComponent)},r.createTrackMixer=function(t){return new oa(t)},e}(exports.TrackAsset),exports.SubCompositionTrack=u([ce(Qt.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){return new aa(t)},e}(exports.TrackAsset),exports.TransformTrack=u([ce(Qt.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.updateAnimatedObject=function(){o(this.parent.boundObject,ve)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(exports.TrackAsset),u([le()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=u([ce("MaterialTrack")],exports.MaterialTrack);var pa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){return new ia(t)},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){var e=new ua(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(fa),exports.Vector4PropertyTrack=u([ce(Qt.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){var e=new ha(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(fa),exports.Vector2PropertyTrack=u([ce("Vector2PropertyTrack")],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createTrackMixer=function(t){var e=new ea(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(fa),exports.ColorPropertyTrack=u([ce(Qt.ColorPropertyTrack)],exports.ColorPropertyTrack),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=u([ce(Qt.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=u([ce(Qt.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){return new sa(t)},e}(co),exports.SubCompositionPlayableAsset=u([ce(Qt.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){},r.create=function(t){if(o(this.boundObject,exports.VFXItem)){var e=this.boundObject;if(e.getComponent(exports.ParticleSystem)){var r=t.createTrack(pa,this,"ParticleTrack");r.boundObject=this.boundObject;var i=r.createClip(Lo);i.start=e.start,i.duration=e.duration,i.endBehavior=e.endBehavior}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=u([ce(Qt.ObjectBindingTrack)],exports.ObjectBindingTrack);var da=function(){function t(t,e,r){this.children=[],this.trackAsset=t,this.mixer=e,this.output=r}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}Ct(e,t);var r=e.prototype;return r.createPlayable=function(t){for(var e,r=new ma(t),i=s(this.tracks);!(e=i()).done;){var n=e.value;o(n,exports.ObjectBindingTrack)&&n.create(this)}return this.sortTracks(this.tracks),r.compileTracks(t,this.flattenedTracks),r},r.createTrack=function(t,e,r){var i=new t(this.engine);return i.name=r||t.name,e.addChild(i),this.invalidate(),i},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var r,i=s(t.getChildTracks());!(r=i()).done;){var n=r.value;e.push(n)}for(var o,a=s(t.getChildTracks());!(o=a()).done;){var u=o.value;this.addSubTracksRecursive(u,e)}},r.sortTracks=function(t){for(var e=[],r=0;r<t.length;r++)e.push(new va(t[r],r));e.sort(ya),t.length=0;for(var i,n=s(e);!(i=n()).done;){var o=i.value;t.push(o.track)}},r.fromData=function(t){},oe(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=s(this.tracks);!(t=e()).done;){var r=t.value;this.cacheFlattenedTracks.push(r),this.addSubTracksRecursive(r,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(co),u([le()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=u([ce(Qt.TimelineAsset)],exports.TimelineAsset);var ma=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clips=[],e.masterTrackInstances=[],e}Ct(e,t);var r=e.prototype;return r.prepareFrame=function(t){},r.evaluate=function(){for(var t,e=this.getTime(),r=s(this.clips);!(t=r()).done;){t.value.evaluateAt(e)}},r.compileTracks=function(t,e){for(var r,i=e,n={},o=s(i);!(r=o()).done;){var a=r.value,u=a.createPlayableGraph(t,this.clips),h=a.createOutput();h.setUserData(a.boundObject),t.addOutput(h),h.setSourcePlayable(u);var c=new da(a,u,h);n[a.getInstanceId()]=c,a.parent||this.masterTrackInstances.push(c)}for(var l,f=s(i);!(l=f()).done;)for(var p,d=l.value,m=n[d.getInstanceId()],v=s(d.getChildTracks());!(p=v()).done;){var y=n[p.value.getInstanceId()];m.addChild(y)}},e}(uo),va=function(t,e){this.track=t,this.originalIndex=e};function ya(t,e){var r=t.track.boundObject,i=e.track.boundObject;return o(r,exports.VFXItem)&&o(i,exports.VFXItem)?exports.VFXItem.isAncestor(r,i)?-1:exports.VFXItem.isAncestor(i,r)?1:t.originalIndex-e.originalIndex:t.originalIndex-e.originalIndex}exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=u([ce(Qt.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){var e=new $o(t);return e.curve=$s(this.curveData),e.value=e.curve.getValue(0),e},e}(co),u([le()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=u([ce(Qt.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset),exports.CompositionComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.startTime=0,e.items=[],e.state=no.Playing,e.reusable=!1,e.sceneBindings=[],e.graph=new ao,e}Ct(e,t);var r=e.prototype;return r.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new exports.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==Mt.destroy&&this.setReusable(!0),null==(t=this.item.composition)||t.refContent.push(this.item)},r.setReusable=function(t){for(var r,i=s(this.timelineAsset.tracks);!(r=i()).done;){var n=r.value.boundObject;if(o(n,exports.VFXItem)){var a=n.getComponent(e);a&&a.setReusable(t)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=no.Paused},r.resume=function(){this.state=no.Playing},r.onUpdate=function(t){if(this.state!==no.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},r.onEnable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!0)}},r.onDisable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!1)}},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},r.hitTest=function(t,e,r,i,n,s){for(var o,u=function(s){var a=o.items[s];if(a.isActive&&a.transform.getValid()&&!exports.VFXItem.isComposition(a)&&!l(a)){var u=a.getHitTestParams(n);if(u){var f=!1,p=new Ce;if(u.type===exports.HitTestType.triangle)for(var d=u.triangles,m=u.backfaceCulling,v=0;v<d.length;v++){var y=d[v];if(t.intersectTriangle(y,p,m)){f=!0,h.push(p);break}}else if(u.type===exports.HitTestType.box){var g=u.center,x=u.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.sphere){var E=u.center,_=u.radius;t.intersectSphere({center:E,radius:_},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.custom){var A=u.collect(t,new Ae(e,r));A&&A.length>0&&(A.forEach((function(t){h.push(t)})),f=!0)}if(f){var C={compContent:o.item,id:a.id,name:a.name,position:h[h.length-1],parentId:a.parentId,hitPositions:h,behavior:u.behavior};if(a.emit("click",C),i.push(C),c(C))return{v:i}}}}},h=[],c=(null==s?void 0:s.stop)||H,l=(null==s?void 0:s.skip)||H,f=(null==s?void 0:s.maxCount)||this.items.length,p=0;p<this.items.length&&i.length<f;p++){var d=(o=this,u(p));if("object"===a(d))return d.v}return i},r.setChildrenRenderOrder=function(t){for(var r,i=s(this.items);!(r=i()).done;){var n=r.value;n.renderOrder=t++;var o=n.getComponent(e);o&&(t=o.setChildrenRenderOrder(t))}return t},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i=e;this.startTime=null!=(r=i.startTime)?r:0},r.resolveBindings=function(){for(var t,e=s(this.sceneBindings);!(t=e()).done;){var r=t.value;r.key.boundObject=r.value}for(var i,n=s(this.timelineAsset.tracks);!(i=n()).done;){var o=i.value;this.updateTrackAnimatedObject(o)}},r.updateTrackAnimatedObject=function(t){for(var e,r=s(t.getChildTracks());!(e=r()).done;){var i=e.value;i.updateAnimatedObject(),this.updateTrackAnimatedObject(i)}},e}(de),u([le()],exports.CompositionComponent.prototype,"items",void 0),u([le()],exports.CompositionComponent.prototype,"sceneBindings",void 0),u([le()],exports.CompositionComponent.prototype,"timelineAsset",void 0),exports.CompositionComponent=u([ce("CompositionComponent")],exports.CompositionComponent);var ga,xa=function(){var t=this,e=this;this.listeners={},this.off=function(e,r){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==r})))},this.on=function(e,r,i){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:r,options:i}),function(){return t.off(e,r)}},this.once=function(e,r){t.on(e,r,{once:!0})},this.emit=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];var s;null==(s=e.listeners[t])||s.forEach((function(r){var n=r.listener,s=r.options;n.apply(void 0,[].concat(i)),(null==s?void 0:s.once)&&e.off(t,n)}))},this.getListeners=function(e){var r;return(null==(r=t.listeners[e])?void 0:r.map((function(t){return t.listener})))||[]}},ba=function(){function t(){this.update=new Ea,this.lateUpdate=new _a}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==de.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==de.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==de.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==de.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Ta=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 r=t.bind(e);this.ticks.includes(r)||this.ticks.push(r)},e.clear=function(){this.components=[]},t}(),Ea=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onUpdate(e)}},e}(Ta),_a=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onLateUpdate(e)}},e}(Ta),Aa=function(t){function e(r,i){var n,o;(n=t.call(this)||this).sceneTicking=new ba,n.speed=1,n.isEnded=!1,n.loaderData={},n.refContent=[],n.postProcessingEnabled=!1,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.isEndCalled=!1,n._textures=[];var a,u=r.reusable,h=void 0!==u&&u,c=r.speed,l=void 0===c?1:c,f=r.baseRenderOrder,p=void 0===f?0:f,d=r.renderer,m=r.event,v=r.width,y=r.height,g=r.handleItemMessage;n.renderer=d,n._textures=i.textures,n.postProcessingEnabled=null!=(a=null==(o=i.jsonScene.renderSettings)?void 0:o.postProcessingEnabled)&&a,n.getEngine().renderLevel=i.renderLevel,h&&(n.keepResource=!0,i.consumed=!0);for(var x,b=i.jsonScene.compositions[0],T=s(i.jsonScene.compositions);!(x=T()).done;){var E=x.value;E.id===i.jsonScene.compositionId&&(b=E)}k(b),n.rootItem=new exports.VFXItem(n.getEngine()),n.rootItem.name="rootItem",n.rootItem.duration=b.duration,n.rootItem.endBehavior=b.endBehavior,n.rootItem.composition=lo(n);for(var _,A,C,S=s(b.components);!(_=S()).done;){var w=_.value,R=n.getEngine().findObject(w);n.rootItem.components.push(R),R.item=n.rootItem}return n.rootComposition=n.rootItem.getComponent(exports.CompositionComponent),n.width=v,n.height=y,n.renderOrder=p,n.id=b.id,n.renderer=d,n.event=m,n.statistic={loadStart:null!=(A=i.startTime)?A:0,loadTime:null!=(C=i.totalTime)?C:0,compileTime:0,firstFrameTime:0},n.reusable=h,n.speed=l,n.name=b.name,n.pluginSystem=i.pluginSystem,n.pluginSystem.initializeComposition(lo(n),i),n.camera=new yo(n.name,Ye({},null==b?void 0:b.camera,{aspect:v/y})),n.url=i.url,n.assigned=!0,n.interactive=!0,n.handleItemMessage=g,n.createRenderFrame(),n.rendererOptions=null,e.buildItemTree(n.rootItem),n.rootComposition.setChildrenRenderOrder(0),n.pluginSystem.resetComposition(lo(n),n.renderFrame),n}Ct(e,t);var r=e.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.rootItem.setVisible(t)},r.getSpeed=function(){return this.speed},r.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new Ri({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.speed,r=this.getPaused();r&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),r&&this.pause(),this.emit("goto",{time:t})},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,r=e<0,i=Math.abs(e),n=r?-15:15;i>15;i-=15)this.update(n);this.update(r?-i:i)},r.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(t,e)}))},r.update=function(t){if(this.assigned&&!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var r=1e3*(this.time-e);this.updatePluginLoaders(r),this.sceneTicking.update.tick(r),this.sceneTicking.lateUpdate.tick(r),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Mt.destroy&&!this.reusable},r.callAwake=function(t){for(var e,r=s(t.components);!(e=r()).done;){var i=e.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var n,o=s(t.children);!(n=o()).done;){var a=n.value;this.callAwake(a)}},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},r.updateCompositionTime=function(t){if(this.rootComposition.state!==no.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var r=this.rootItem.duration,i=this.rootItem.endBehavior,n=!1;if(e-r>.001)switch(n=!0,i){case Mt.restart:e%=r,this.restart();break;case Mt.freeze:e=Math.min(r,e);case Mt.forward:case Mt.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return cs((t-r.z)/i,(e-r.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,r,i){if(this.isDestroyed||!this.interactive)return[];var n=[],s=this.getHitTestRay(t,e);return this.refContent.forEach((function(o){var a;null==(a=o.getComponent(exports.CompositionComponent))||a.hitTest(s,t,e,n,r,i)})),n},r.addInteractiveItem=function(t,e){if(e===vt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},r.removeInteractiveItem=function(t,e){e===vt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},r.destroyItem=function(t){var e=this;t.type==gt.composition?t.endBehavior!==Mt.freeze&&t.getComponent(exports.CompositionComponent).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},r.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},r.dispose=function(){var t,e,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&this.keepResource&&n.forEach((function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=H)})),this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.rendererOptions)||t.emptyTexture.dispose(),null==(e=this.pluginSystem)||e.destroyComposition(this),this.update=function(){X.error("Update disposed composition: "+r.name+".")},this.dispose=H,n&&this.keepResource&&n.forEach((function(t){t.dispose=i[t.id],t.dispose()})),this.renderer.env!==In&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},r.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},r.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},r.translate=function(t,e,r){this.rootItem.translate(t,e,r)},r.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},r.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},r.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},r.scale=function(t,e,r){this.rootItem.scale(t,e,r)},r.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return i((function(){return h(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]}}))}))()},e.buildItemTree=function(t){for(var e,r=new Map,i=t.getComponent(exports.CompositionComponent).items,n=s(i);!(e=n()).done;){var o=e.value;r.set(o.id,o)}for(var a,u=s(i);!(a=u()).done;){var h=a.value;if(void 0===h.parentId)h.setParent(t);else{var c=r.get(h.parentId);if(!c)throw new Error("The element references a non-existent element, please check the data.");h.setParent(c)}}},oe(e,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(xa);exports.VFXItem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).children=[],i.transform=new mo,i.time=-1,i.duration=0,i.start=0,i.endBehavior=Mt.forward,i.type=gt.base,i.components=[],i.isDuringPlay=!1,i.active=!0,i.visible=!0,i.speed=1,i.listIndex=0,i.isEnabled=!1,i.eventProcessor=new xa,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=e,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.on=function(t,e,r){this.eventProcessor.on(t,e,r)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,r,i=s(this.components);!(r=i()).done;){var n=r.value;if(o(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,r=[],i=s(this.components);!(e=i()).done;){var n=e.value;o(n,t)&&r.push(n)}return r},r.setParent=function(t){(t!==this||t)&&(this.parent&&g(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.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},r.setColor=function(t,e,r,i){},r.setOpacity=function(t){},r.setActive=function(t){this.active!==t&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,r=s(this.components);!(e=r()).done;){e.value.enabled=t}this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new mo({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,r){this.transform.translate(t,e,r)},r.rotate=function(t,e,r){var i=new Zr(t,e,r),n=Me.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},r.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,s=i.y,o=this.composition.renderer.getWidth()/2,a=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/a)*s,r)}},r.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},r.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},r.setScale=function(t,e,r){this.transform.setScale(t,e,r)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new Ce;return this.transform.assignWorldTRS(t),t},r.find=function(t){var e;if(this.name===t)return this;var r=[];(e=r).push.apply(e,[].concat(this.children));for(var i=0;i<r.length;){var n,s=r[i];if(i++,s.name===t)return s;(n=r).push.apply(n,[].concat(s.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;r.isDuringPlay||r.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&!r.isStartCalled&&(r.onStart(),r.isStartCalled=!0)}for(var i,n=s(this.components);!(i=n()).done;){var o=i.value;o.enabled&&!o.isEnableCalled&&o.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&r.isEnableCalled&&r.disable()}},r.fromData=function(r){t.prototype.fromData.call(this,r);var i=r.id,n=r.name,a=r.delay,u=r.parentId,h=r.endBehavior,c=r.transform,l=r.duration,f=void 0===l?0:l;this.props=r,this.type=r.type,this.id=i.toString(),this.name=n,this.start=a||this.start;var p={};if(c){var d;if(p.position=(new Ce).copyFrom(c.position),c.quat)p.quat=new Me(c.quat.x,c.quat.y,c.quat.z,c.quat.w);else p.rotation=(new Zr).copyFrom(null!=(d=c.eulerHint)?d:c.rotation);p.scale=(new Ce).copyFrom(c.scale),c.size&&(p.size=(new Ae).copyFrom(c.size)),c.anchor&&(p.anchor=(new Ae).copyFrom(c.anchor)),this.transform.setTransform(p)}if(this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=u,this.duration=f,this.endBehavior=h,r.content||(r.content={options:{}}),f<0)throw new Error("Item duration can't be less than 0, see "+Ln["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var m,v=s(r.components);!(m=v()).done;){var y=m.value,g=this.engine.findObject(y);this.components.push(g),o(g,exports.ParticleSystem)&&(this.components.includes(g.renderer)||this.components.push(g.renderer))}}e.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=Qt.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var r,i=s(this.components);!(r=i()).done;){var n=r.value;o(n,exports.EffectComponent)&&this.defination.components.push(n)}}this.defination.content={}},r.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,s=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(s),a=o.x,u=o.y;this.transform.translate(2*t*a/i,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=s(this.components.slice());!(t=e()).done;){t.value.dispose()}this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;this.parent&&r.setParent(this.parent)}var i;this.parent&&g(null==(i=this.parent)?void 0:i.children,this)},r.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");for(var r,i=s(e.components);!(r=i()).done;){var n=r.value,a=this.engine.findObject(n);if(a.item=this,this.components.push(a),a.setInstanceId($()),o(a,exports.CompositionComponent))for(var u,h=s(a.items);!(u=h()).done;){var c=u.value;c.setInstanceId($());for(var l,f=s(c.components);!(l=f()).done;){l.value.setInstanceId($())}}}Aa.buildItemTree(this)},r.resetGUID=function(t){var e,r=null!=(e=null==t?void 0:t.get(this))?e:$();this.setInstanceId(r);for(var i,n=s(this.components);!(i=n()).done;){var o,a=i.value,u=null!=(o=null==t?void 0:t.get(a))?o:$();a.setInstanceId(u)}for(var h,c=s(this.children);!(h=c()).done;){h.value.resetGUID(t)}},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,r=s(this.components);!(e=r()).done;){var i=e.value;t.set(i,i.getInstanceId())}for(var n,o=s(this.children);!(n=o()).done;){n.value.gatherPreviousObjectID(t)}},e.isComposition=function(t){return t.type===gt.composition},e.isSprite=function(t){return t.type===gt.sprite},e.isParticle=function(t){return t.type===gt.particle},e.isNull=function(t){return t.type===gt.null},e.isTree=function(t){return t.type===gt.tree},e.isCamera=function(t){return t.type===gt.camera},e.isAncestor=function(t,e){for(var r=e.parent;r;){if(r===t)return!0;r=r.parent}return!1},oe(e,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,r=s(this.children);!(e=r()).done;){var i=e.value;i.composition||(i.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){if(this.listIndex!==t){this.listIndex=t;for(var e,r=s(this.components);!(e=r()).done;){var i=e.value;o(i,ve)&&(i.priority=t)}}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),e}(pe),exports.VFXItem=u([ce(Qt.VFXItemData)],exports.VFXItem),exports.Item=void 0,(ga=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},ga.isComposition=function(t){return t.type===gt.composition},ga.isParticle=function(t){return t.type===gt.particle},ga.isNull=function(t){return t.type===gt.null};var Ca=[1,1,1,1],Sa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}Ct(e,t);var r=e.prototype;return r.processFrame=function(t){var e=t.output.getUserData();if(o(e,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var r,i;this.activeMaterial=null==(r=this.activeComponent)?void 0:r.material;var n=null==(i=this.activeMaterial)?void 0:i.getColor("_Color");n&&(this.startColor=n.toArray())}var s,a,u,h=os(Ca,1),c=this.time/e.duration,l=this.opacityOverLifetime,f=this.colorOverLifetime;if(f&&(h=T(f,c,!0),s=!0),l&&(h[3]*=l.getValue(c),s=!0),s)as(this.renderColor,h,this.startColor),null==(u=this.activeMaterial)||null==(a=u.getColor("_Color"))||a.setFromArray(this.renderColor)}},r.create=function(t){this.clipData=t;var e,r=t.colorOverLifetime;r&&(this.opacityOverLifetime=$s(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===wt.GRADIENT_COLOR&&(this.colorOverLifetime=E(r.color[1])));return this},r.getActiveComponent=function(t){return t.getComponent(Bn)},e}(uo),wa=0;function Ra(t){return t.maxVertexUniforms>=256?exports.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?exports.maxSpriteMeshItemCount=16:void 0}exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new Sa(t);return e.create(this.data),e},r.fromData=function(t){this.data=t},e}(co),exports.SpriteColorPlayableAsset=u([ce(Qt.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset),exports.SpriteComponent=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).frameAnimationLoop=!1,i.name="MSprite"+wa++,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.onUpdate=function(t){var e=this,r=this.item.time,i=this.item.duration;r>i&&this.frameAnimationLoop&&(r%=i);var n=Math.min(Math.max(r/i,0),1),s=this.textureSheetAnimation,o=this.renderer.texture.source.video;if(o&&(0===r?o.pause():o.play().catch((function(t){e.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),s){var a,u,h,c,l,f=s.total||s.row*s.col,p=0,d=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],p=y[0],d=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/s.row*m,c=1/s.col*v):(h=1/s.col*m,c=1/s.row*v),s.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/s.col),b=g-x*s.col;l=u?[h*x,c*(s.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(a=this.material.getVector4("_TexOffset"))||a.setFromArray([p+l[0],v+d-l[1],h,c])}},r.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())},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.interaction,i=e.options;this.interaction=r;var n=i.startColor||[1,1,1,1];this.material.setColor("_Color",(new Re).setFromArray(n))},e}(Bn),exports.SpriteComponent=u([ce(Qt.SpriteComponent)],exports.SpriteComponent),exports.maxSpriteMeshItemCount=8;var Ma=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),Oa=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),Pa=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),Ia=function(t){function e(e){var r;return(r=t.call(this,e)||this).animationStream=new Pa(lo(r)),r}return Ct(e,t),e}(uo),La=new Zr,Fa=new Ce(1,1,1),Va=new Ce,Da=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new Ce(e.x,e.y,e.x)};var r,i=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=$s(i.path));var o=i.linearX||i.linearY||i.linearZ;o&&(this.linearVelOverLifetime={x:i.linearX&&$s(i.linearX),y:i.linearY&&$s(i.linearY),z:i.linearZ&&$s(i.linearZ),asMovement:i.asMovement,enabled:!!o});var a=i.orbitalX||i.orbitalY||i.orbitalZ;a&&(this.orbitalVelOverLifetime={x:i.orbitalX&&$s(i.orbitalX),y:i.orbitalY&&$s(i.orbitalY),z:i.orbitalZ&&$s(i.orbitalZ),center:ss(i.orbCenter),asRotation:i.asRotation,enabled:!!a}),this.speedOverLifetime=i.speedOverLifetime&&$s(i.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=$s(s.x||1),this.sizeYOverLifetime=$s(s.y||1),this.sizeZOverLifetime=$s(s.z||1)):this.sizeXOverLifetime=$s(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:$s(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=$s(n.x||0),u.y=$s(n.y||0)}this.gravity=Ce.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=$s(null!=(r=null==i?void 0:i.gravityOverLifetime)?r:0),this.direction=(null==i?void 0:i.direction)?Ce.fromArray(i.direction).normalize():new Ce,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();o(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,r=e.duration,i=this.time/r;if(i=i<0?0:i>1?1:i,this.sizeXOverLifetime){Fa.x=this.sizeXOverLifetime.getValue(i),this.sizeSeparateAxes?(Fa.y=this.sizeYOverLifetime.getValue(i),Fa.z=this.sizeZOverLifetime.getValue(i)):Fa.z=Fa.y=Fa.x;var n=this.originalTransform.scale;e.transform.setScale(Fa.x*n.x,Fa.y*n.y,Fa.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(i):e.getIntegrateValue(0,i,r)},o=s(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;La.x=a?s(this.rotationOverLifetime.x):0,La.y=a?s(this.rotationOverLifetime.y):0,La.z=o;var u=La.addEulers(this.originalTransform.rotation,La);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Va;ns(h,this,this.gravity,this.time,r,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(i)),e.transform.setPosition(h.x,h.y,h.z)}},e}(Ia);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new Da(t);return e.data=this.transformAnimationData,e},r.fromData=function(t){this.transformAnimationData=t},e}(co),exports.TransformPlayableAsset=u([ce(Qt.TransformPlayableAsset)],exports.TransformPlayableAsset);var Na=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();o(e,exports.VFXItem)&&(e.time=this.time)},e}(uo);exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.createPlayable=function(t){return new Na(t)},e}(co),exports.ActivationPlayableAsset=u([ce(Qt.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}Ct(e,t);var r=e.prototype;return r.sampleAnimation=function(t,e){var r=e/t.duration;r=r<0?0:r>1?1:r;for(var i,n=s(this.positionCurves);!(i=n()).done;){var o=i.value,a=o.keyFrames.getValue(r),u=this.findTarget(t,o.path);null==u||u.transform.setPosition(a.x,a.y,a.z)}for(var h,c=s(this.rotationCurves);!(h=c()).done;){var l=h.value,f=l.keyFrames.getValue(r),p=this.findTarget(t,l.path);null==p||p.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var d,m=s(this.scaleCurves);!(d=m()).done;){var v=d.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setScale(y.x,y.y,y.z)}},r.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,r=s(t.positionCurves);!(e=r()).done;){var i=e.value,n={path:i.path,keyFrames:$s(i.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var o,a=s(t.rotationCurves);!(o=a()).done;){var u=o.value,h={path:u.path,keyFrames:$s(u.keyFrames)};this.duration=Math.max(this.duration,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}for(var c,l=s(t.scaleCurves);!(c=l()).done;){var f=c.value,p={path:f.path,keyFrames:$s(f.keyFrames)};this.duration=Math.max(this.duration,p.keyFrames.getMaxTime()),this.scaleCurves.push(p)}for(var d,m=s(t.floatCurves);!(d=m()).done;){var v=d.value,y={path:v.path,keyFrames:$s(v.keyFrames),property:v.property,className:v.className};this.duration=Math.max(this.duration,y.keyFrames.getMaxTime()),this.floatCurves.push(y)}},r.findTarget=function(t,e){for(var r,i=t,n=s(e);!(r=n()).done;){for(var o,a=r.value,u=!1,h=s(i.children);!(o=h()).done;){var c=o.value;if(c.name===a){i=c,u=!0;break}}if(!u)return}return i},e}(pe),exports.AnimationClip=u([ce(Qt.AnimationClip)],exports.AnimationClip);var ka=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();o(e,exports.VFXItem)&&e.composition&&this.clip.sampleAnimation(e,this.time)},e}(uo),za=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},oe(t,null,[{key:"shared",get:function(){return Ua.x=0,Ua.y=0,Ua}}]),t}(),Ua=new za,Ba=1e-4,Ga=1e-4;function ja(t,e,r,i,n,s,o,a){var u,h;o?(u=i,h=-r):(u=-i,h=r);var c=t-r*n+u,l=e-i*n+h,f=t+r*s+u,p=e+i*s+h;return a.push(c,l),a.push(f,p),2}function Xa(t,e,r,i,n,s,o,a){var u=r-t,h=i-e,c=Math.atan2(u,h),l=Math.atan2(n-t,s-e);a&&c<l?c+=2*Math.PI:!a&&c>l&&(l+=2*Math.PI);var f=c,p=l-c,d=Math.abs(p),m=Math.sqrt(u*u+h*h),v=1+(15*d*Math.sqrt(m)/Math.PI>>0),y=p/v;if(f+=y,a){o.push(t,e),o.push(r,i);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,s)}else{o.push(r,i),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,s),o.push(t,e)}return 2*v}function Ha(t,e,r,i,n,s,o,a,u){var h=Ba;if(0!==t.length){var c=e,l=c.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var r=0,i=0,n=t[e-2],s=t[e-1];i<e;i+=2){var o=t[i],a=t[i+1];r+=(o-n)*(a+s),n=o,s=a}return r<0?-1:1}(t);r&&(f*=-1),l=(l-.5)*f+.5}var p=new za(t[0],t[1]),d=new za(t[t.length-2],t[t.length-1]),m=i,v=Math.abs(p.x-d.x)<h&&Math.abs(p.y-d.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),d.set(t[t.length-2],t[t.length-1]));var y=.5*(p.x+d.x),g=.5*(d.y+p.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,E=x.length/2,_=c.width/2,A=_*_,C=c.miterLimit*c.miterLimit,S=t[0],w=t[1],R=t[2],M=t[3],O=0,P=0,I=-(w-M),L=S-R,F=0,V=0,D=Math.sqrt(I*I+L*L)+be;I/=D,L/=D,I*=_,L*=_;var N=2*(1-l),k=2*l;m||(c.cap===Yt.Round?T+=Xa(S-I*(N-k)*.5,w-L*(N-k)*.5,S-I*N,w-L*N,S+I*k,w+L*k,x,!0)+2:c.cap===Yt.Square&&(T+=ja(S,w,I,L,N,k,!0,x))),x.push(S-I*N,w-L*N),x.push(S+I*k,w+L*k);for(var z=1;z<b-1;++z){S=t[2*(z-1)],w=t[2*(z-1)+1],R=t[2*z],M=t[2*z+1],O=t[2*(z+1)],P=t[2*(z+1)+1],I=-(w-M),L=S-R,I/=D=Math.sqrt(I*I+L*L)+be,L/=D,I*=_,L*=_,F=-(M-P),V=R-O,F/=D=Math.sqrt(F*F+V*V)+be,V/=D,F*=_,V*=_;var U=R-S,B=w-M,G=R-O,j=P-M,X=U*G+B*j,H=B*G-j*U,W=H<0;if(Math.abs(H)<.001*Math.abs(X))x.push(R-I*N,M-L*N),x.push(R+I*k,M+L*k),X>=0&&(c.join===Zt.Round?T+=Xa(R,M,R-I*N,M-L*N,R-F*N,M-V*N,x,!1)+4:T+=2,x.push(R-F*k,M-V*k),x.push(R+F*N,M+V*N));else{var Y=(-I+S)*(-L+M)-(-I+R)*(-L+w),Z=(-F+O)*(-V+M)-(-F+R)*(-V+P),q=(U*Z-G*Y)/H,K=(j*Y-B*Z)/H,Q=(q-R)*(q-R)+(K-M)*(K-M),J=R+(q-R)*N,$=M+(K-M)*N,tt=R-(q-R)*k,et=M-(K-M)*k,rt=W?N:k;Q<=Math.min(U*U+B*B,G*G+j*j)+rt*rt*A?c.join===Zt.Bevel||Q/A>C?(W?(x.push(J,$),x.push(R+I*k,M+L*k),x.push(J,$),x.push(R+F*k,M+V*k)):(x.push(R-I*N,M-L*N),x.push(tt,et),x.push(R-F*N,M-V*N),x.push(tt,et)),T+=2):c.join===Zt.Round?W?(x.push(J,$),x.push(R+I*k,M+L*k),T+=Xa(R,M,R+I*k,M+L*k,R+F*k,M+V*k,x,!0)+4,x.push(J,$),x.push(R+F*k,M+V*k)):(x.push(R-I*N,M-L*N),x.push(tt,et),T+=Xa(R,M,R-I*N,M-L*N,R-F*N,M-V*N,x,!1)+4,x.push(R-F*N,M-V*N),x.push(tt,et)):(x.push(J,$),x.push(tt,et)):(x.push(R-I*N,M-L*N),x.push(R+I*k,M+L*k),c.join===Zt.Round?T+=W?Xa(R,M,R+I*k,M+L*k,R+F*k,M+V*k,x,!0)+2:Xa(R,M,R-I*N,M-L*N,R-F*N,M-V*N,x,!1)+2:c.join===Zt.Miter&&Q/A<=C&&(W?(x.push(tt,et),x.push(tt,et)):(x.push(J,$),x.push(J,$)),T+=2),x.push(R-F*N,M-V*N),x.push(R+F*k,M+V*k),T+=2)}}S=t[2*(b-2)],w=t[2*(b-2)+1],R=t[2*(b-1)],I=-(w-(M=t[2*(b-1)+1])),L=S-R,I/=D=Math.sqrt(I*I+L*L)+be,L/=D,I*=_,L*=_,x.push(R-I*N,M-L*N),x.push(R+I*k,M+L*k),m||(c.cap===Yt.Round?T+=Xa(R-I*(N-k)*.5,M-L*(N-k)*.5,R-I*N,M-L*N,R+I*k,M+L*k,x,!1)+2:c.cap===Yt.Square&&(T+=ja(R,M,I,L,N,k,!1,x)));for(var it=Ga*Ga,nt=E;nt<T+E-2;++nt)S=x[2*nt],w=x[2*nt+1],R=x[2*(nt+1)],M=x[2*(nt+1)+1],O=x[2*(nt+2)],P=x[2*(nt+2)+1],Math.abs(S*(M-P)+R*(P-w)+O*(w-M))<it||a.push(nt,nt+1,nt+2)}}var Wa=function(){},Ya="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Za={exports:{}};!function(t){var e;function r(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?i<n?e.a-t.a+i/(i+n)*(t.a-r.a):e.a-r.a+n/(i+n)*(r.a-t.a):0}function s(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?(e.a-r.a)*i+(e.a-t.a)*n:0}function o(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?i<n?e.b-t.b+i/(i+n)*(t.b-r.b):e.b-r.b+n/(i+n)*(r.b-t.b):0}function u(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?(e.b-r.b)*i+(e.b-t.b)*n:0}function h(t){return i(t.b.a,t.a)}function c(t){return i(t.a,t.b.a)}function l(t,e,r,i){return(t=0>t?0:t)<=(r=0>r?0:r)?0===r?(e+i)/2:e+t/(t+r)*(i-e):i+r/(t+r)*(e-i)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function p(t,e){var r=!1,i=!1;t!==e&&(e.a!==t.a&&(i=!0,E(e.a,t.a)),e.d!==t.d&&(r=!0,_(e.d,t.d)),g(e,t),i||(x(e,t.a),t.a.c=t),r||(b(e,t.d),t.d.a=t))}function d(t){var e=t.b,r=!1;t.d!==t.b.d&&(r=!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)),r||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),r=e.b;return g(e,t.e),e.a=t.b.a,x(r,e.a),e.d=r.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 r=!1,i=y(t),n=i.b;return e.d!==t.d&&(r=!0,_(e.d,t.d)),g(i,t.e),g(n,e),i.a=t.b.a,n.a=e.a,i.d=n.d=t.d,t.d.a=n,r||b(i,t.d),i}function y(t){var e=new J,r=new J,i=t.b.h;return r.h=i,i.b.h=e,e.h=t,t.b.h=r,e.b=r,e.c=e,e.e=r,r.b=e,r.c=r,r.e=e}function g(t,e){var r=t.c,i=e.c;r.b.e=e,i.b.e=t,t.c=i,e.c=r}function x(t,e){var r=e.f,i=new et(e,r);r.e=i,e.f=i,r=i.c=t;do{r.a=i,r=r.c}while(r!==t)}function b(t,e){var r=e.d,i=new Q(e,r);r.b=i,e.d=i,i.a=t,i.c=e.c,r=t;do{r.d=i,r=r.e}while(r!==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 r=t.c,i=r;do{i.a=e,i=i.c}while(i!==r);r=t.f,(i=t.e).f=r,r.e=i}function _(t,e){var r=t.a,i=r;do{i.d=e,i=i.e}while(i!==r);r=t.d,(i=t.b).d=r,r.b=i}function A(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 S(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,r){return t=t.a,e=e.a,r=r.a,e.b.a===t?r.b.a===t?i(e.a,r.a)?0>=s(r.b.a,e.a,r.a):0<=s(e.b.a,r.a,e.a):0>=s(r.b.a,t,r.a):r.b.a===t?0<=s(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(r.b.a,t,r.a))}function R(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function M(t,e){d(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do{t=pt(t)}while(t.a.a===e);return t.c&&(M(t,e=v(ft(t).a.b,t.a.e)),t=pt(t)),t}function P(t,e,r){var i=new lt;return i.a=r,i.e=H(t.f,e.e,i),r.i=i}function I(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function L(t){var e=t.a,r=e.d;r.c=t.d,r.a=e,R(t)}function F(t,e,r){for(t=e,e=e.a;t!==r;){t.c=!1;var i=ft(t),n=i.a;if(n.a!==e.a){if(!i.c){L(t);break}M(i,n=v(e.c.b,n.b))}e.c!==n&&(p($(n),n),p(e,n)),L(t),e=i.a,t=i}return e}function V(t,e,r,i,n,s){var o=!0;do{P(t,e,r.b),r=r.c}while(r!==i);for(null===n&&(n=ft(e).a.b.c);(r=(i=ft(e)).a.b).a===n.a;)r.c!==n&&(p($(r),r),p($(n),r)),i.f=e.f-r.f,i.d=I(t,i.f),e.b=!0,!o&&z(t,e)&&(S(r,n),R(e),d(n)),o=!1,e=i,n=r;e.b=!0,s&&B(t,e)}function D(t,e,r,i,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,r,i,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=r[0])}function N(t,e,r){var i=[null,null,null,null];i[0]=e.a.d,i[1]=r.a.d,D(t,e.a,i,[.5,.5,0,0],!1),p(e,r)}function k(t,e,r,i,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(r.b-t.b)+Math.abs(r.a-t.a),a=n+1;i[n]=.5*o/(s+o),i[a]=.5*s/(s+o),t.g[0]+=i[n]*e.g[0]+i[a]*r.g[0],t.g[1]+=i[n]*e.g[1]+i[a]*r.g[1],t.g[2]+=i[n]*e.g[2]+i[a]*r.g[2]}function z(t,e){var n=ft(e),o=e.a,a=n.a;if(i(o.a,a.a)){if(0<s(a.b.a,o.a,a.a))return!1;if(r(o.a,a.a)){if(o.a!==a.a){n=t.e;var u=o.a.h;if(0<=u){var h=(n=n.b).d,c=n.e,l=n.c,f=l[u];h[f]=h[n.a],l[h[f]]=f,f<=--n.a&&(1>=f||i(c[h[f>>1]],c[h[f]])?ht(n,f):ct(n,f)),c[u]=null,l[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;N(t,$(a),o)}}else m(a.b),p(o,$(a)),e.b=n.b=!0}else{if(0>s(o.b.a,a.a,o.a))return!1;pt(e).b=e.b=!0,m(o.b),p($(a),o)}return!0}function U(t,e){var h=ft(e),c=e.a,f=h.a,d=c.a,v=f.a,y=c.b.a,g=f.b.a,x=new et;if(s(y,t.a,d),s(g,t.a,v),d===v||Math.min(d.a,y.a)>Math.max(v.a,g.a))return!1;if(i(d,v)){if(0<s(g,d,v))return!1}else if(0>s(y,v,d))return!1;var b,T,E=y,_=d,A=g,C=v;if(i(E,_)||(b=E,E=_,_=b),i(A,C)||(b=A,A=C,C=b),i(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),i(A,_)?i(_,C)?(0>(b=n(E,A,_))+(T=n(A,_,C))&&(b=-b,T=-T),x.b=l(b,A.b,T,_.b)):(0>(b=s(E,A,_))+(T=-s(E,C,_))&&(b=-b,T=-T),x.b=l(b,A.b,T,C.b)):x.b=(A.b+_.b)/2,o(E,_)||(b=E,E=_,_=b),o(A,C)||(b=A,A=C,C=b),o(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),o(A,_)?o(_,C)?(0>(b=a(E,A,_))+(T=a(A,_,C))&&(b=-b,T=-T),x.a=l(b,A.a,T,_.a)):(0>(b=u(E,A,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=l(b,A.a,T,C.a)):x.a=(A.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(d,v)?d:v,i(E,x)&&(x.b=E.b,x.a=E.a),r(x,d)||r(x,v))return z(t,e),!1;if(!r(y,t.a)&&0<=s(y,t.a,x)||!r(g,t.a)&&0>=s(g,t.a,x)){if(g===t.a)return m(c.b),p(f.b,c),c=ft(e=O(e)).a,F(t,ft(e),h),V(t,e,$(c),c,c,!0),!0;if(y===t.a){m(f.b),p(c.e,$(f)),v=(d=h=e).a.b.a;do{d=pt(d)}while(d.a.b.a===v);return d=ft(e=d).a.b.c,h.a=$(f),V(t,e,(f=F(t,h,null)).c,c.b.c,d,!0),!0}return 0<=s(y,t.a,x)&&(pt(e).b=e.b=!0,m(c.b),c.a.b=t.a.b,c.a.a=t.a.a),0>=s(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(c.b),m(f.b),p($(f),c),c.a.b=x.b,c.a.a=x.a,c.a.h=it(t.e,c.a),c=c.a,f=[0,0,0,0],x=[d.d,y.d,v.d,g.d],c.g[0]=c.g[1]=c.g[2]=0,k(c,d,y,f,0),k(c,v,g,f,2),D(t,c,x,f,!0),pt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var r=ft(e);;){for(;r.b;)e=r,r=ft(r);if(!e.b&&(r=e,null===(e=pt(e))||!e.b))break;e.b=!1;var n,o=e.a,a=r.a;if(n=o.b.a!==a.b.a)t:{var u=ft(n=e),h=n.a,c=u.a,l=void 0;if(i(h.b.a,c.b.a)){if(0>s(h.b.a,c.b.a,h.a)){n=!1;break t}pt(n).b=n.b=!0,l=m(h),p(c.b,l),l.d.c=n.d}else{if(0<s(c.b.a,h.b.a,c.a)){n=!1;break t}n.b=u.b=!0,l=m(c),p(h.e,c.b),l.b.d.c=n.d}n=!0}if(n&&(r.c?(R(r),d(a),a=(r=ft(e)).a):e.c&&(R(e),d(o),o=(e=pt(r)).a)),o.a!==a.a)if(o.b.a===a.b.a||e.c||r.c||o.b.a!==t.a&&a.b.a!==t.a)z(t,e);else if(U(t,e))break;o.a===a.a&&o.b.a===a.b.a&&(S(a,o),R(e),d(o),e=pt(r))}}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 lt).a=o.c.b;var a=(l=n.f).a;do{a=a.a}while(null!==a.b&&!l.c(l.b,h,a.b));var u=ft(l=a.b),h=l.a;a=u.a;if(0===s(h.b.a,o,h.a))r((h=l.a).a,o)||r(h.b.a,o)||(m(h.b),l.c&&(d(h.c),l.c=!1),p(o.c,h),G(n,o));else{var c=i(a.b.a,h.b.a)?l:u;u=void 0;l.d||c.c?(u=c===l?v(o.c.b,h.e):v(a.b.c.b,o.c).b,c.c?M(c,u):(h=n,(l=P(n,l,u)).f=pt(l).f+l.a.f,l.d=I(h,l.f)),G(n,o)):V(n,l,o.c,o.c,null,!0)}return}if(l=(h=ft(n=O(n.i))).a,(h=F(t,h,null)).c===l){h=(l=h).c,a=ft(n),u=n.a,c=a.a;var l,f=!1;u.b.a!==c.b.a&&U(t,n),r(u.a,t.a)&&(p($(h),u),h=ft(n=O(n)).a,F(t,ft(n),a),f=!0),r(c.a,t.a)&&(p(l,$(c)),l=F(t,a,null),f=!0),f?V(t,n,l.c,h,h,!0):(o=i(c.a,u.a)?$(c):u,V(t,n,o=v(l.c.b,o),o.c,o.c,!1),o.b.i.c=!0,B(t,n))}else V(t,n,h.c,l,l,!0)}function j(t,e){var r=new lt,i=f(t.b);i.a.b=C,i.a.a=e,i.b.a.b=-C,i.b.a.a=e,t.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=H(i=t.f,i.a,r),r.e=i}function X(t){this.a=new W,this.b=t,this.c=w}function H(t,e,r){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,r));return t=new W(r,e.a,e),e.a.c=t,e.a=t}function W(t,e,r){this.b=t||null,this.a=e||this,this.c=r||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 rt(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new st}function it(t,e){if(t.e){var r,i=t.b,n=++i.a;return 2*n>i.f&&(i.f*=2,i.c=ot(i.c,i.f+1)),0===i.b?r=n:(r=i.b,i.b=i.c[i.b]),i.e[r]=e,i.c[r]=n,i.d[n]=r,i.h&&ct(i,n),r}return i=t.a++,t.c[i]=e,-(i+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&&i(at(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 st(){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 r=Array(e),i=0;i<t.length;i++)r[i]=t[i];for(;i<e;i++)r[i]=0;return r}function at(t){return t.e[t.d[1]]}function ut(t){var e=t.d,r=t.e,i=t.c,n=e[1],s=r[n];return 0<t.a&&(e[1]=e[t.a],i[e[1]]=1,r[n]=null,i[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),s}function ht(t,e){for(var r=t.d,n=t.e,s=t.c,o=e,a=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[a],n[h])){r[o]=a,s[a]=o;break}r[o]=h,s[h]=o,o=u}}function ct(t,e){for(var r=t.d,n=t.e,s=t.c,o=e,a=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[a])){r[o]=a,s[a]=o;break}r[o]=h,s[h]=o,o=u}}function lt(){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 pt(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,r){this.j[0]=t,this.j[1]=e,this.j[2]=r},e.z=function(t,e){var r=e||null;switch(t){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:K(this,100900)}},e.C=function(t,e){var r=!1,i=[0,0,0];q(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,r=!0),1e150<s&&(s=1e150,r=!0),i[n]=s}r&&K(this,100155),null===(r=this.q)?p(r=f(this.b),r.b):(m(r),r=r.e),r.a.d=e,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},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=[l=this.j[0],n=this.j[1],a=this.j[2]];if(0===l&&0===n&&0===a){for(var n=[-2e150,-2e150,-2e150],o=[2e150,2e150,2e150],a=[],u=[],l=(t=this.b.c).e;l!==t;l=l.e)for(var f=0;3>f;++f){var p=l.g[f];p<o[f]&&(o[f]=p,u[f]=l),p>n[f]&&(n[f]=p,a[f]=l)}if(l=0,n[1]-o[1]>n[0]-o[0]&&(l=1),n[2]-o[2]>n[l]-o[l]&&(l=2),o[l]>=n[l])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,o=u[l],a=a[l],u=[0,0,0],o=[o.g[0]-a.g[0],o.g[1]-a.g[1],o.g[2]-a.g[2]],f=[0,0,0],l=t.e;l!==t;l=l.e)f[0]=l.g[0]-a.g[0],f[1]=l.g[1]-a.g[1],f[2]=l.g[2]-a.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],(p=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=p,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[A(o)]=1)}t=!0}for(u=A(e),l=this.b.c,n=(u+1)%3,a=(u+2)%3,u=0<e[u]?1:-1,e=l.e;e!==l;e=e.e)e.b=e.g[n],e.a=u*e.g[a];if(t){for(e=0,l=(t=this.b.a).b;l!==t;l=l.b)if(!(0>=(n=l.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==l.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,l=(e=this.b.b).h;l!==e;l=t)t=l.h,n=l.e,r(l.a,l.b.a)&&l.e.e!==l&&(N(this,n,l),d(l),n=(l=n).e),n.e===l&&(n!==l&&(n!==t&&n!==t.b||(t=t.h),d(n)),l!==t&&l!==t.b||(t=t.h),d(l));for(this.e=e=new rt,l=(t=this.b.c).e;l!==t;l=l.e)l.h=it(e,l);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,r){return i(t[e],t[r])?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(l=this.e,0===l.a)t=at(l.b);else if(t=l.c[l.d[l.a-1]],0!==l.b.a&&(l=at(l.b),i(l,t))){t=l;break t}if(null===t||!r(t,e))break;t=nt(this.e),N(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,R(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,l=(e=this.b).a.b;l!==e.a;l=t)t=l.b,(l=l.a).e.e===l&&(S(l.c,l),d(l));if(!this.n){if(e=this.b,this.m)for(l=e.b.h;l!==e.b;l=t)t=l.h,l.b.d.c!==l.d.c?l.f=l.d.c?1:-1:d(l);else for(l=e.a.b;l!==e.a;l=t)if(t=l.b,l.c){for(l=l.a;i(l.b.a,l.a);l=l.c.b);for(;i(l.a,l.b.a);l=l.e);for(n=l.c.b,a=void 0;l.e!==n;)if(i(l.b.a,n.a)){for(;n.e!==l&&(h(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(a=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==l&&(c(l.c.b)||0<=s(l.b.a,l.a,l.c.b.a));)l=(a=v(l,l.c.b)).b;l=l.e}for(;n.e.e!==l;)n=(a=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),l=t.a;do{this.k&&this.k(l.a.d,this.c),l=l.e}while(l!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,l=!1,n=-1,a=e.a.d;a!==e.a;a=a.d)if(a.c){l||(this.h&&this.h(4,this.c),l=!0),u=a.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!==a.a)}l&&this.i&&this.i(this.c)}if(this.r){for(l=(e=this.b).a.b;l!==e.a;l=t)if(t=l.b,!l.c){a=(n=l.a).e,u=void 0;do{a=(u=a).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=l.d,(l=l.b).d=n,n.b=l}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Ya.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=Ya.libtess}(Za);var qa=function(){var t=new Za.exports.GluTesselator;return t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Za.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,r){return[t[0],t[1],t[2]]})),t.gluTessCallback(Za.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function Ka(t){qa.gluTessNormal(0,0,1);var e=[];qa.gluTessBeginPolygon(e);for(var r=0;r<t.length;r++){qa.gluTessBeginContour();for(var i=t[r],n=0;n<i.length;n+=2){var s=[i[n],i[n+1],0];qa.gluTessVertex(s,s)}qa.gluTessEndContour()}return qa.gluTessEndPolygon(),e}var Qa=function(t){function e(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var s=Array.isArray(r[0])?r[0]:r;if("number"!=typeof s[0]){for(var o=[],a=0,u=s.length;a<u;a++)o.push(s[a].x,s[a].y);s=o}return n.points=s,n.closePath=!0,n}Ct(e,t);var r=e.prototype;return r.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},r.contains=function(t,e){for(var r=!1,i=this.points.length/2,n=0,s=i-1;n<i;s=n++){var o=this.points[2*n],a=this.points[2*n+1],u=this.points[2*s],h=this.points[2*s+1];a>e!=h>e&&t<(e-a)/(h-a)*(u-o)+o&&(r=!r)}return r},r.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.points[this.points.length-2]},r.getY=function(){return this.points[this.points.length-1]},r.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},r.triangulate=function(t,e,r,i,n){var s=Ka([t]),o=e.length/2;0===s.length&&this.getLineEndPointsTriangle(t,s);for(var a=0;a<s.length;a++)e[2*r+a]=s[a];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=o+h},r.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var r=t[2]-t[0],i=t[3]-t[1],n=t[0],s=t[1],o=t[0],a=t[1];if(Math.abs(r)>=Math.abs(i))for(var u=0;u<t.length;u+=2){var h=t[u],c=t[u+1];h<n&&(n=h,s=c),h>o&&(o=h,a=c)}else for(var l=0;l<t.length;l+=2){var f=t[l],p=t[l+1];p<s&&(n=f,s=p),p>a&&(o=f,a=p)}e.push(n,s,o,a,o,a)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},oe(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Wa),Ja=8,$a=1.1920929e-7;function tu(t,e,r,i,n,s,o,a,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,r,i,n,s,o,a,u,h){eu(t,e,r,i,n,s,o,a,u,h,0),u.push(o,a)}(e,r,i,n,s,o,a,u,t,c*=c),t}function eu(t,e,r,i,n,s,o,a,u,h,c){if(!(c>Ja)){var l=(t+r)/2,f=(e+i)/2,p=(r+n)/2,d=(i+s)/2,m=(n+o)/2,v=(s+a)/2,y=(l+p)/2,g=(f+d)/2,x=(p+m)/2,b=(d+v)/2,T=(y+x)/2,E=(g+b)/2;if(c>0){var _=o-t,A=a-e,C=Math.abs((r-o)*A-(i-a)*_),S=Math.abs((n-o)*A-(s-a)*_);if(C>$a&&S>$a){if((C+S)*(C+S)<=h*(_*_+A*A))return void u.push(T,E)}else if(C>$a){if(C*C<=h*(_*_+A*A))return void u.push(T,E)}else if(S>$a){if(S*S<=h*(_*_+A*A))return void u.push(T,E)}else if((_=T-(t+o)/2)*_+(A=E-(e+a)/2)*A<=h)return void u.push(T,E)}eu(t,e,l,f,y,g,T,E,u,h,c+1),eu(T,E,x,b,m,v,o,a,u,h,c+1)}}var ru,iu=function(t){function e(e,r,i,n){var s;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=r,s.halfWidth=i,s.halfHeight=n,s}Ct(e,t);var r=e.prototype;return r.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},r.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var r=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return(r*=r)+(i*=i)<=1},r.strokeContains=function(t,e,r){var i=this.halfWidth,n=this.halfHeight;if(i<=0||n<=0)return!1;var s=r/2,o=i-s,a=n-s,u=i+s,h=n+s,c=t-this.x,l=e-this.y;return c*c/(o*o)+l*l/(a*a)>1&&c*c/(u*u)+l*l/(h*h)<=1},r.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.x},r.getY=function(){return this.y},r.build=function(t){var e=this.x,r=this.y,i=this.halfWidth,n=this.halfHeight;if(!(i>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(i+n)),o=8*s+0+0;if(0===o)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=r+0,t[2]=t[4]=e-0,t[5]=t[7]=r-0,t;var a=0,u=4*s+0+2,h=u,c=o,l=0+i,f=0,p=e+l,d=e-l,m=r+f;t[a++]=p,t[a++]=m,t[--u]=m,t[--u]=d;for(var v=1;v<s;v++){var y=Math.PI/2*(v/s),g=0+Math.cos(y)*i,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=r+x,_=r-x;t[a++]=b,t[a++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--c]=_,t[--c]=b}p=e+(l=0),d=e-l,m=r+(f=0+n);var A=r-f;return t[a++]=p,t[a++]=m,t[--c]=A,t[--c]=p,t},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=o;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Wa);exports.StarType=void 0,(ru=exports.StarType||(exports.StarType={}))[ru.Star=0]="Star",ru[ru.Polygon=1]="Polygon";var nu=function(t){function e(e,r,i,n,s,o){var a;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=0),(a=t.call(this)||this).pointCount=e,a.outerRadius=r,a.innerRadius=i,a.outerRoundness=n,a.innerRoundness=s,a.starType=o,a.v=[],a.in=[],a.out=[],a}Ct(e,t);var r=e.prototype;return r.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},r.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},r.copyTo=function(t){t.copyFrom(this)},r.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)tu(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var r=this.v.length-1;tu(t,this.v[r-1],this.v[r],this.out[r-1],this.out[r],this.in[0],this.in[1],this.v[0],this.v[1],1)},r.triangulate=function(t,e,r,i,n){for(var s=Ka([t]),o=e.length/2,a=0;a<s.length;a++)e[2*r+a]=s[a];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=o+h},r.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,r,i,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,o=!0,a=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,c=this.innerRoundness/100,l=2*Math.PI*a/(2*n),f=2*Math.PI*u/(2*n),p=-Math.PI/2;for(t=0;t<n;t++){r=o?h:c,i=o?l:f;var d=(e=o?a:u)*Math.cos(p),m=e*Math.sin(p),v=0===d&&0===m?0:m/Math.sqrt(d*d+m*m),y=0===d&&0===m?0:-d/Math.sqrt(d*d+m*m),g=2*t;this.v[g]=d,this.v[g+1]=m,this.in[g]=d+v*i*r*1,this.in[g+1]=m+y*i*r*1,this.out[g]=d-v*i*r*1,this.out[g+1]=m-y*i*r*1,o=!o,p+=1*s}},r.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),r=2*Math.PI/e,i=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*i/(4*e),o=.5*-Math.PI;for(t=0;t<e;t++){var a=i*Math.cos(o),u=i*Math.sin(o),h=0===a&&0===u?0:u/Math.sqrt(a*a+u*u),c=0===a&&0===u?0:-a/Math.sqrt(a*a+u*u),l=2*t;this.v[l]=a,this.v[l+1]=u,this.in[l]=a+h*s*n*1,this.in[l+1]=u+c*s*n*1,this.out[l]=a-h*s*n*1,this.out[l+1]=u-c*s*n*1,o+=1*r}},e}(Wa),su=function(t){function e(e,r,i,n,s){var o;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=20),(o=t.call(this)||this).x=e,o.y=r,o.width=i,o.height=n,o.roundness=s,o}Ct(e,t);var r=e.prototype;return r.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},r.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},r.copyTo=function(t){return t.copyFrom(this),t},r.build=function(t){var e,r=this.width/2,i=this.height/2,n=this.x+r,s=this.y+i,o=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,i)),a=r-o,u=i-e;if(o>=0&&e>=0&&a>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(o+e)),c=8*h+(a?4:0)+(u?4:0);if(0!==c){if(0===h)return t[0]=t[6]=n+a,t[1]=t[3]=s+u,t[2]=t[4]=n-a,void(t[5]=t[7]=s-u);var l=0,f=4*h+(a?2:0)+2,p=f,d=c,m=a+o,v=u,y=n+m,g=n-m,x=s+v;if(t[l++]=y,t[l++]=x,t[--f]=x,t[--f]=g,u){var b=s-v;t[p++]=g,t[p++]=b,t[--d]=b,t[--d]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=a+Math.cos(E)*o,A=u+Math.sin(E)*e,C=n+_,S=n-_,w=s+A,R=s-A;t[l++]=C,t[l++]=w,t[--f]=w,t[--f]=S,t[p++]=S,t[p++]=R,t[--d]=R,t[--d]=C}y=n+(m=a),g=n-m,x=s+(v=u+e);var M=s-v;t[l++]=y,t[l++]=x,t[--d]=M,t[--d]=y,a&&(t[l++]=g,t[l++]=x,t[--d]=M,t[--d]=g)}}},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,o=0,a=0;a<t.length;a+=2)s+=t[a],o+=t[a+1];s/=t.length/2,o/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=o;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Wa),ou=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=s(this.graphicsPath.instructions);!(t=e()).done;){var r=t.value,i=r.action,n=r.data;switch(i){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);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"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,r,i,n,s,o){this.ensurePoly();var a=this.currentPoly;return tu(a.points,a.lastX,a.lastY,t,e,r,i,n,s,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,r,i,n){return this.drawShape(new iu(t,e,r,i),n),this},e.polyStar=function(t,e,r,i,n,s,o){return this.drawShape(new nu(t,e,r,i,n,s),o),this},e.rect=function(t,e,r,i,n,s){return this.drawShape(new su(t,e,r,i,n),s),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var r=this.currentPoly;return r&&this.endPoly(),(r=new Qa).points.push(t,e),this.currentPoly=r,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 Qa,this.currentPoly.points.push(0,0))},t}(),au=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,r,i,n,s,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,r,i,n,s,o]}),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,r,i,n){return this.instructions.push({action:"ellipse",data:[t,e,r,i,n]}),this.dirty=!0,this},e.rect=function(t,e,r,i,n,s){return this.instructions.push({action:"rect",data:[t,e,r,i,n,s]}),this.dirty=!0,this},e.polyStar=function(t,e,r,i,n,s,o){return this.instructions.push({action:"polyStar",data:[t,e,r,i,n,s,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},oe(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new ou(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function uu(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?lo(t):e}var hu=new(function(){function t(){this.elements=[]}var r=t.prototype;return r.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},r.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return k(t),t}if(Ao(Eo))return e.window._createOffscreenCanvas(10,10);var r=e.document.createElement("canvas");return r.getContext("2d",{willReadFrequently:!0}),r},r.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?y(this.elements,t):t.remove()},t}()),cu=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,s=t.textOverflow,o=void 0===s?kt.clip:s,a=t.textBaseline,u=void 0===a?zt.top:a,h=t.textAlign,c=void 0===h?Ut.left:h,l=t.text,f=void 0===l?" ":l,p=t.letterSpace,d=void 0===p?0:p,m=t.autoWidth,v=void 0!==m&&m,y=t.fontSize,g=t.lineHeight,x=void 0===g?y:g,b=y+d;this.autoWidth=v,this.maxTextWidth=f.length*b,this.width=n,this.height=r,this.letterSpace=d,this.overflow=o,this.textBaseline=u,this.textAlign=c,this.lineHeight=x}var e=t.prototype;return e.getOffsetY=function(t,e,r,i){var n=t.outlineWidth,s=t.fontScale,o=(r-i)/3,a=i+n*s,u=r*(e-1),h=0;switch(this.textBaseline){case zt.top:h=a+o;break;case zt.middle:h=(this.height*s-u+a)/2;break;case zt.bottom:h=this.height*s-u-o}return h},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case Ut.left:r=t.outlineWidth*t.fontScale;break;case Ut.middle:r=(this.width*t.fontScale-e)/2;break;case Ut.right:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),lu=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,r,i,n,s,o,a=t.textColor,u=void 0===a?[1,1,1,1]:a,h=t.fontSize,c=void 0===h?40:h,l=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=c,l)&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(r=l.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth);f&&(this.hasShadow=!0,this.shadowBlur=null!=(i=f.shadowBlur)?i:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=f.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(o=f.shadowOffsetY)?o:0);this.fontStyle!==Gt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},fu=["serif","sans-serif","monospace","courier"],pu=0;exports.TextComponent=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.maxLineWidth=0,i.SCALE_FACTOR=.1,i.ALPHA_FIX_VALUE=1/255,i.name="MText"+pu++,r&&i.fromData(r),i.canvas=hu.getCanvas(),hu.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return uu(i);var n=r.options;return i.updateWithOptions(n),i.updateTexture(),i}Ct(e,t);var r=e.prototype;return r.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.interaction,i=e.options;this.interaction=r,this.updateWithOptions(i),this.renderText(i),this.material.setColor("_Color",new Re(1,1,1,1))},r.updateWithOptions=function(t){},r.updateTexture=function(t){},e}(Bn),exports.TextComponent=u([ce(Qt.TextComponent)],exports.TextComponent);var du=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new lu(t),this.textLayout=new cu(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var r=this.context,i=this.textLayout,n=i.letterSpace,s=i.overflow,o=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,a=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,c=0;c<t.length;c++){var l,f,p=t[c],d=(null!=(f=null==r||null==(l=r.measureText(p))?void 0:l.width)?f:0)*o;h+=n,s===kt.display?"\n"===p?(u++,h=0):(h+=d,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+d>a&&c>0||"\n"===p)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==p&&(h+=d))}return u},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){this.textStyle.fontFamily!==t||z(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,s=(i.width+r.fontOffset)*n,o=i.lineHeight*this.lineCount,a=r.fontSize*n,u=i.lineHeight*n;r.fontDesc=this.getFontDesc(a),this.char=(this.text||"").split(""),this.canvas.width=s,i.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/i.height)):this.canvas.height=i.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>s&&i.overflow===kt.display?e.font=this.getFontDesc(a*s/this.maxLineWidth):e.font=r.fontDesc,e.clearRect(0,0,s,h),r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+r.textColor[0]+", "+r.textColor[1]+", "+r.textColor[2]+", "+r.textColor[3]+")";for(var c=[],l=0,f=i.getOffsetY(r,this.lineCount,u,a),p=[],d=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=i.letterSpace*n)+y.width>s&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:p,charOffsetX:d}),l=0,f+=u,p=[],d=[]),"\n"!==v&&(p.push(v),d.push(l),l+=y.width)}c.push({y:f,width:l,chars:p,charOffsetX:d}),c.forEach((function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach((function(i,s){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[s],t.y),e.fillText(i,n+t.charOffsetX[s],t.y)}))})),r.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=mr.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:ke.LINEAR,minFilter:ke.LINEAR,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,r=e.fontSize,i=e.fontScale,n=e.fontFamily,s=e.textWeight,o=e.fontStyle,a=(t||r*i).toString()+"px ";return fu.includes(n)?a+=n:a+='"'+n+'"',s!==Bt.normal&&(a=s+" "+a),o!==Gt.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.outlineWidth,n=r[0],s=r[1],o=r[2],a=r[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*o+", "+a+")",t.lineWidth=2*i)},e.setupShadow=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,o=r[0],a=r[1],u=r[2],h=r[3];t&&(t.shadowColor="rgba("+255*o+", "+255*a+", "+255*u+", "+h+")",t.shadowBlur=i,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();et(exports.TextComponent,[du]);var mu=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(_t),vu=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(pe);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return Ct(e,t),e}(pe),u([le()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=u([ce(Qt.BinaryAsset)],exports.BinaryAsset);var yu=function(){function t(){}return t.serialize=function(e,r){e.toData(),r||(r={});var i=fe(e);if(i)for(var n,o=s(Object.keys(i));!(n=o()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?r[a]=u:Y(u)?(r[a]||(r[a]=[]),t.serializeArrayProperty(u,r[a],0)):pe.is(u)?r[a]={id:u.getInstanceId()}:q(u)&&(r[a]||(r[a]={}),t.serializeObjectProperty(u,r[a],0))}for(var h,c=s(Object.keys(e.defination));!(h=c()).done;){var l=h.value,f=e.defination[l];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?r[l]=f:Y(f)?(r[l]||(r[l]=[]),t.serializeArrayProperty(f,r[l],0)):pe.is(f)?r[l]={id:f.getInstanceId()}:q(f)&&(r[l]||(r[l]={}),t.serializeObjectProperty(f,r[l],0))}return r},t.deserialize=function(e,r){r.defination=e;var i=fe(r),n=r.engine;if(i)for(var o,a=s(Object.keys(i));!(o=a()).done;){var u=o.value,h=e[u];if(void 0!==h){var c=i[u].type;r[u]=t.deserializeProperty(h,n,0,c)}}r.fromData(r.defination)},t.checkTypedArray=function(t){return o(t,Int8Array)||o(t,Uint8Array)||o(t,Uint8ClampedArray)||o(t,Int16Array)||o(t,Uint16Array)||o(t,Int32Array)||o(t,Uint32Array)||o(t,Float32Array)||o(t,Float64Array)||o(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(q(t)&&1===Object.keys(t).length&&"id"in t&&W(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return q(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return K(t)||o(t,e.HTMLImageElement)},t.deserializeProperty=function(e,r,i,n,o){if(void 0===o&&(o=!0),!(i>14)){if(Y(e)){for(var a,u=[],h=s(e);!(a=h()).done;){var c=a.value;u.push(t.deserializeProperty(c,r,i+1,n,o))}return u}if(t.checkDataPath(e)){var l=r.findObject(e);return o?l:e}if(q(e)&&e.constructor===Object){var f;f=n?new n:{};for(var p,d=s(Object.keys(e));!(p=d()).done;){var m=p.value;f[m]=t.deserializeProperty(e[m],r,i+1,void 0,o)}return f}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r={});for(var n,o=s(Object.keys(e));!(n=o()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?r[a]=u:Y(u)?(r[a]||(r[a]=[]),t.serializeArrayProperty(u,r[a],i+1)):pe.is(u)?r[a]={id:u.getInstanceId()}:q(u)&&(r[a]||(r[a]={}),t.serializeObjectProperty(u,r[a],i+1))}}},t.serializeArrayProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?r[n]=s:Y(s)?(r[n]||(r[n]=[]),t.serializeArrayProperty(s,r[n],i+1)):pe.is(s)?r[n]={id:s.getInstanceId()}:q(s)&&(r[n]||(r[n]={}),t.serializeObjectProperty(s,r[n],i+1))}}},t}(),gu=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(!e)return null;var r,i=e.id,n=this.findData(i);if(n){switch(n.dataType){case Qt.Material:r=Pr.create(this.engine);break;case Qt.Geometry:r=Wr.create(this.engine);break;case Qt.Texture:r=mr.create(this.engine);break;default:var s=t.getClass(n.dataType);s&&(r=new s(this.engine))}if(r)return r.setInstanceId(n.id),this.engine.addInstance(r),yu.deserialize(n,r),r;console.error("Constructor for DataType: "+n.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return he[t]},t}(),xu=function(){function t(){}return t.prototype.loadGUID=function(t){return i((function(){return h(this,(function(t){return[2,void 0]}))}))()},t}();function bu(t,e){if(!t.includes(e))return t.push(e),!0}function Tu(t){if(Number.isFinite(t))return[wt.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===wt.CONSTANT)return[wt.CONSTANT,t[1]];if("lines"===e)return[wt.LINE,t[1]];if(e===wt.LINE){var i=r.map((function(t){return[Rt.LINE,t]}));return[wt.BEZIER_CURVE,i]}return"curve"===e||e===wt.CURVE?[wt.BEZIER_CURVE,Gu(r)]:t}}function Eu(t,e){return Array.isArray(t)&&"random"===t[0]?[wt.CONSTANT,t[1][e]]:Tu(t)}function _u(t){return t&&"color"===t[0]?wu(t[1],!0):[1,1,1,1]}function Au(t,e){if(t)return"colors"===t[0]?[wt.COLORS,t[1].map((function(t){return wu(t,e)}))]:"gradient"===t[0]?Su(t[1],e):"color"===t[0]?[wt.RGBA_COLOR,wu(t[1],e)]:t}function Cu(t){return t&&"random"===t[0]?[wt.RANDOM,t[1]]:Tu(t)}function Su(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),s=wu(t[i],e);r.push([n,s[0],s[1],s[2],s[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[wt.GRADIENT_COLOR,r]}}function wu(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else o(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=Ru(r)),r}function Ru(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Mu(t,e){return Array.isArray(t)?t[0]===wt.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Su(t[1],e):Su(t,e)}function Ou(t){if(t){if(3===t.length)return[wt.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===wt.BEZIER_PATH||e===wt.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],s=r[2],o=Gu(i);if(!s){s=[];for(var a=0;a<n.length;a++){var u=n[a].slice();0===a?s.push(u):a<n.length-1?(s.push(u),s.push(u)):s.push(u)}}return[wt.BEZIER_CURVE_PATH,[o,n,s]]}return t}}function Pu(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;t[i]=Number(t[i])}return t}function Iu(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;void 0===t[i]&&delete t[i]}return t}var Lu,Fu=Math.cos,Vu=Math.sin,Du=Math.PI/180,Nu=180/Math.PI;function ku(t,e){return t?[t[0]-.5,.5-t[1]]:e?Uu[e]:[0,0]}var zu,Uu=((Lu={})[bt.PARTICLE_ORIGIN_CENTER]=[0,0],Lu[bt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Lu[bt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Lu[bt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Lu[bt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Lu[bt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Lu[bt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Lu[bt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Lu[bt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Lu);function Bu(t,e,r,i){var n=r[0],s=r[1],o=i[0],a=o-n;return[[n+(o-n)/3,s+(t*=a)/3],[o-(o-n)/3,i[1]-(e*=a)/3]]}function Gu(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var o=t[s][3]*(e-r),a=t[s+1][2]*(e-r),u=[t[s][0],t[s][1]],h=[t[s+1][0],t[s+1][1]];if(u[0]!=h[0]){var c=Bu(o,a,u,h),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[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?[Rt.EASE_OUT,t]:e===n.length-1?[Rt.EASE_IN,t]:[Rt.EASE,t]}))}function ju(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===gt.null&&t.endBehavior===Mt.destroy&&(t.endBehavior=Mt.freeze)}))})),t.version=ht["2_1"],t}var Xu=new Map,Hu=new Map;function Wu(t){for(var e,r=s(t.components);!(e=r()).done;){var i=e.value;if(i.dataType===Qt.ShapeComponent){var n=i;if(n.type===Wt.Custom){var o,a=n;(null==(o=a.shapes)?void 0:o.length)>0&&a.shapes[0].fill&&(a.fill=a.shapes[0].fill);for(var u,h=new Array(a.easingIns.length),c=new Array(a.easingOuts.length).fill(!1),l=s(a.shapes);!(u=l()).done;)for(var f,p=s(u.value.indexes);!(f=p()).done;){var d=f.value,m=a.points[d.point],v=a.easingIns[d.easingIn],y=a.easingOuts[d.easingOut];h[d.easingIn]||(v.x-=m.x,v.y-=m.y,h[d.easingIn]=!0),c[d.easingOut]||(y.x-=m.x,y.y-=m.y,c[d.easingOut]=!0)}}}}return t}function Yu(t){Xu.clear(),Hu.clear();for(var e,r=t.compositions,i=t.items,n=s(t.components);!(e=n()).done;){var o=e.value;Xu.set(o.id,o)}for(var a,u=s(i);!(a=u()).done;){var h=a.value;Hu.set(h.id,h)}for(var c,l=s(r);!(c=l()).done;){qu(c.value)}return t}function Zu(t){var e;null==(e=t.plugins)||e.forEach((function(e,r){"richtext"===e&&(t.plugins[r]="rich-text")}));for(var r,i=s(t.items);!(r=i()).done;){var n=r.value;if(n.type===gt.sprite){var o=Xu.get(n.components[0].id);if(o){var a=o.renderer.shape,u=void 0;u=Number.isInteger(a)?t.shapes[a]:a,o.renderer.shape=u}}}for(var h,c=t.compositionId,l={},f=s(t.compositions);!(h=f()).done;){var p=h.value,d=$();l[p.id]=d,p.id===c&&(t.compositionId=d),p.id=d;var m={id:$(),dataType:"CompositionComponent",items:p.items,timelineAsset:p.timelineAsset,sceneBindings:p.sceneBindings,startTime:p.startTime};p.timelineAsset=void 0,p.sceneBindings=void 0,p.startTime=void 0,p.components=[{id:m.id}],t.components.push(m)}for(var v,y=s(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=l[x.refId])}}return t}function qu(t){for(var e,r=s(t.items);!(e=r()).done;){var i=e.value,n=Hu.get(i.id);if(!n)return;if(n.type===gt.sprite||n.type===gt.particle||n.type===gt.spine||n.type===gt.text||n.type===gt.richtext||n.type===gt.video||n.type===gt.shape){var o=Xu.get(n.components[0].id);o&&Ku(o)}}}function Ku(t){var e=t.renderer,r=null==e?void 0:e.maskMode;r&&r!==exports.MaskMode.NONE&&(r===exports.MaskMode.MASK?(t.mask={isMask:!0},zu=t.id):r!==pt.OBSCURED&&r!==pt.REVERSE_OBSCURED||(t.mask={inverted:r===pt.REVERSE_OBSCURED,reference:{id:zu}}))}function Qu(t){for(var e,r,i,n=function(){var t=h.value;t.endBehavior!==Xt&&t.endBehavior!==jt||(t.endBehavior=Mt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===gt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,r=s(t.items);!(e=r()).done;){var i=e.value;c[i.id]=$(),i.oldId=i.id,i.id=c[i.id],l[i.id]=i}t.items.forEach((function(e,r){if(e.parentId)if(e.parentId.includes("^")){var i=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=c[i]+"^"+n}else e.parentId=c[e.parentId];o.items.push(e),t.items[r]={id:e.id}}));var n=Ye({},t,{timelineAsset:{id:""},sceneBindings:[]});o.compositions.push(n),function(t,e,r){for(var i,n=[],o=[],a=[],u={tracks:[],id:$(),dataType:"TimelineAsset"},h=s(t.items);!(i=h()).done;){var c=e[i.value.id],l=[],f={id:$(),dataType:"ActivationPlayableAsset"};a.push(f);var p={id:$(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:f.id}}]};if(l.push({id:p.id}),o.push(p),c.type!==gt.particle){var d={id:$(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(d);var m={id:$(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};l.push({id:m.id}),o.push(m)}if(c.type===gt.sprite||c.type===gt.text){var v={id:$(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};a.push(v);var y={id:$(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:v.id}}]};l.push({id:y.id}),o.push(y)}if(c.type===gt.composition){var g={id:$(),dataType:"SubCompositionPlayableAsset"};a.push(g);var x={id:$(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:g.id}}]};l.push({id:x.id}),o.push(x)}var b={id:$(),dataType:"ObjectBindingTrack",children:l,clips:[]};o.push(b),u.tracks.push({id:b.id}),n.push({key:{id:b.id},value:{id:c.id}})}for(var T,E=[],_=s(o);!(T=_()).done;){var A=T.value;E.push({id:A.id})}t.timelineAsset={id:u.id},t.sceneBindings=n,r.miscs.push(u);for(var C,S=s(o);!(C=S()).done;){var w=C.value;r.miscs.push(w)}for(var R,M=s(a);!(R=M()).done;){var O=R.value;r.miscs.push(O)}}(n,l,o)},o=Ye({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),a=s(o.images);!(r=a()).done;){r.value.id=$()}if(null!=(e=o).textures||(e.textures=[]),o.textures.forEach((function(t){var e;t.id=$(),t.dataType=Qt.Texture,t.source={id:null==(e=o.images[t.source])?void 0:e.id}})),o.textures.length<o.images.length)for(var u=o.textures.length;u<o.images.length;u++)o.textures.push({id:$(),dataType:Qt.Texture,source:{id:o.images[u].id},flipY:!0});t.bins&&(i=t.bins,o.bins=i.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:$()}})));for(var h,c={},l={},f=s(t.compositions);!(h=f()).done;)n();for(var p,d=s(o.items);!(p=d()).done;){var m=p.value;if(m.content){if(m.content.renderer&&void 0!==m.content.renderer.texture){var v=m.content.renderer.texture;m.content.renderer.texture={id:o.textures[v].id}}if(m.content.trails&&void 0!==m.content.trails.texture){var y=m.content.trails.texture;m.content.trails.texture={id:o.textures[y].id}}}if(m.transform){var g,x,b,T=[].concat(null!=(g=m.transform.position)?g:[0,0,0]),E=[].concat(null!=(x=m.transform.rotation)?x:[0,0,0]),_=[].concat(null!=(b=m.transform.scale)?b:[1,1,1]);if(Object.assign(m,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:_[0],y:_[1],z:_[0]}}}),m.type===gt.sprite&&(m.transform.size={x:_[0],y:_[1]},m.transform.scale={x:1,y:1,z:1}),m.type===gt.sprite){var A=m.content;A.renderer||(A.renderer={});var C,S,w,R,M=A.renderer,O=ku(M.anchor,M.particleOrigin),P=m.transform.size;if(!M.anchor&&void 0!==M.particleOrigin)m.transform.position.x+=-O[0]*(null!=(C=null==P?void 0:P.x)?C:1),m.transform.position.y+=-O[1]*(null!=(S=null==P?void 0:P.y)?S:1);m.transform.anchor={x:O[0]*(null!=(w=null==P?void 0:P.x)?w:1),y:O[1]*(null!=(R=null==P?void 0:P.y)?R:1)}}}if(m.type===gt.particle){var I=m.content;I.renderer||(I.renderer={});var L=I.renderer;I.renderer.anchor=ku(L.anchor,L.particleOrigin)}if(m.type===gt.camera&&m.content.positionOverLifetime&&0!==Object.keys(m.content.positionOverLifetime).length&&(m.content.positionOverLifetime.asMovement=!0),void 0!==m.pn){var F=m.pn,V=t.plugins,D=void 0===V?[]:V;void 0!==F&&Number.isInteger(F)&&(m.pluginName=D[F])}switch("editor-gizmo"===m.pluginName&&(m.type="editor-gizmo"),"orientation-transformer"===m.pluginName&&(m.type="orientation-transformer"),m.content.options.target&&"editor-gizmo"===m.pluginName&&(m.content.options.target=c[m.content.options.target]),m.type===gt.spine&&t.spines&&0!==t.spines.length&&$u(t.spines[m.content.options.spine],m.content,o),m.type!==gt.sprite&&m.type!==gt.particle&&m.type!==gt.mesh&&m.type!==gt.skybox&&m.type!==gt.light&&"camera"!==m.type&&m.type!==gt.tree&&m.type!==gt.interact&&m.type!==gt.camera&&m.type!==gt.text&&m.type!==gt.spine&&"editor-gizmo"!==m.type&&"orientation-transformer"!==m.type||(m.components=[],o.components.push(m.content),m.content.id=$(),m.content.item={id:m.id},m.dataType=Qt.VFXItemData,m.components.push({id:m.content.id})),m.type!==gt.null&&m.type!==gt.composition||(m.components=[],m.dataType=Qt.VFXItemData),m.type){case gt.sprite:m.content.dataType=Qt.SpriteComponent;break;case gt.particle:m.content.dataType=Qt.ParticleSystem;break;case gt.mesh:m.content.dataType=Qt.MeshComponent;break;case gt.skybox:m.content.dataType=Qt.SkyboxComponent;break;case gt.light:m.content.dataType=Qt.LightComponent;break;case"camera":m.content.dataType=Qt.CameraComponent;break;case"editor-gizmo":m.content.dataType="GizmoComponent";break;case"orientation-transformer":m.content.dataType="OrientationComponent";break;case gt.tree:m.content.dataType=Qt.TreeComponent;break;case gt.interact:m.content.dataType=Qt.InteractComponent;break;case gt.camera:m.content.dataType=Qt.CameraController;break;case gt.text:m.content.dataType=Qt.TextComponent;break;case gt.spine:m.content.dataType=Qt.SpineComponent}}return o.version=ht["3_0"],o}function Ju(t){if(t)for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value,n=t[i],o=Array.isArray(n);o&&2===n.length&&Array.isArray(n[1])?t[i]="path"===i?Ou(n):Tu(n):o||"object"!=typeof n||Ju(n)}}function $u(t,e,r){e.resource={atlas:{bins:{id:r.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:r.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map((function(t){return{id:r.textures[t].id}}))}}function th(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},s={path:Ou(null==(r=t.transform)?void 0:r.path),gravity:i.gravity,gravityOverLifetime:Tu(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:Tu(n.linearX),linearY:Tu(n.linearY),linearZ:Tu(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Tu(n.orbitalX),orbitalY:Tu(n.orbitalY),orbitalZ:Tu(n.orbitalZ),speedOverLifetime:Tu(n.speedOverLifetime)};Iu(s);var o={options:{startColor:_u(i.startColor)},positionOverLifetime:s};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var a=t.rotationOverLifetime;if(a){var u=o.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};u.separateAxes?(u.x=Tu(a.x),u.y=Tu(a.y),u.z=Tu(a.z)):u.z=Tu(a.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=o.colorOverLifetime={opacity:Tu(h.opacity)};h.color&&(c.color=Mu(h.color))}var l=t.sizeOverLifetime;return l&&(o.sizeOverLifetime={separateAxes:l.separateAxes,size:Tu(l.size),x:Tu(l.x),y:Tu(l.y),z:Tu(l.z)}),o}var eh="2.5.0-alpha.6",rh=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,ih=/^(\d+)\.(\d+)$/,nh=!1;function sh(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,r;(function(t){var e=t.playerVersion||{},r=e.web,i=void 0===r?"":r;if(i){var n,s,o=null!=(n=rh.exec(i))?n:[],a=null!=(s=rh.exec(eh))?s:[],u=o[1],h=o[2],c=a[1],l=a[2];return Number(c)<Number(u)||Number(c)===Number(u)&&Number(l)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+eh+"). Some features may not work as expected.");if(function(t){var e,r=null==(e=t.version)?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==gt.mesh&&t.type!==gt.light||(t.endBehavior=1===t.endBehavior?Mt.destroy:t.endBehavior)}))}))}(t),rh.test(t.version))return nh="0"===(null==(r=/^(\d+)/.exec(t.version))?void 0:r[0]),Zu(Yu(Wu(Qu(ju(function(t){var e;oh=ht["1_0"];var r=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(oh=ht["1_3"]);var i,n=(t.requires||[]).slice(),s=t.images.map((function(e,r){return ah(e,r,t.imageTags||[])})),o=t.textures||s.map((function(t,e){return{source:e,flipY:!0}})),a={plugins:r,shapes:t.shapes||[],type:"ge",version:oh,playerVersion:null!=(i=t.playerVersion)?i:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return uh(t,{plugins:r,requires:n})})),images:s,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:o,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t))))));nh=!1;var i=ih.exec(t.version)||[],n=Number(i[1]),o=Number(i[2]);if(n)return(n<2||2===n&&o<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,r=s(t.items);!(e=r()).done;)Ju(e.value.content)})),t}(t)),n<3&&(t=Qu(ju(t))),i=ih.exec(t.version)||[],n=Number(i[1]),o=Number(i[2]),n<4&&(o<2&&(t=Wu(t)),o<3&&(t=Yu(t)),o<4&&(t=Zu(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var oh=ht["1_0"];function ah(t,e,r){var i=r[e];if("string"==typeof t)return{id:$(),renderLevel:i,url:t};if(t.template)return{id:$(),url:t.url,template:t.template,webp:t.webp,renderLevel:i};if(t.compressed)return{id:$(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{id:$(),url:t.url,webp:t.webp,renderLevel:i};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function uh(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Ye({clipMode:Ht},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return fh(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var s=null==(r=t.meta)?void 0:r.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(i.previewSize=s),i}var hh,ch=[0,0,0,1],lh=.5;function fh(t,e){var r;void 0===e&&(e={});var i,n,s,o,a,u,h=gt.base,c=t.endBehavior,l=NaN;if(t.content?(h=t.type||gt.plugin,u=t.pn,a=t.pluginName,s=t.content,n=t.content,isNaN(u)&&!a&&(a=s.options.type),t.duration&&(l=t.duration),i=t.transform||y(n.transform)):t.particle?(h=gt.particle,i=y((n=t.particle).transform,nh,!0),s=function(t){var e=t.options,r=t.transform,i={type:dt.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(i=Ye({},t.shape,{type:dt[s]}),t.shape.upDirection){var o=t.shape.upDirection,a=o[0],u=o[1],h=o[2];0===a&&0===u&&0===h&&delete i.upDirection}}e.startTurbulence&&(i.turbulenceX=Cu(e.turbulenceX),i.turbulenceY=Cu(e.turbulenceY),i.turbulenceZ=Cu(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Pu(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Pu(t)}))),c.rateOverTime&&(c.rateOverTime=Cu(c.rateOverTime));var l={renderer:t.renderer,shape:i,splits:t.splits,emission:c,options:{startLifetime:Cu(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Cu(e.startSize),startSizeX:Cu(e.startSizeX),startSizeY:Cu(e.startSizeY),sizeAspect:Cu(e.sizeAspect),maxCount:e.maxCount,startDelay:Cu(e.startDelay),startColor:Au(e.startColor,!0),startRotationZ:Cu(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=Cu(e.startRotationX),l.options.startRotationY=Cu(e.startRotationY)),r&&r.path&&(l.emitterTransform={path:Ou(r.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:Cu(f.x),y:Cu(f.y)}:l.sizeOverLifetime={size:Cu(f.size)});var p=t.velocityOverLifetime||{},d=p.speedOverLifetime;d=d?Tu(d):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Tu(e.gravityModifier),startSpeed:Cu(e.startSpeed),speedOverLifetime:d,asMovement:p.asMovement,linearX:Cu(p.linearX),linearY:Cu(p.linearY),linearZ:Cu(p.linearZ),asRotation:p.asRotation,orbCenter:p.orbCenter,orbitalX:Cu(p.orbitalX),orbitalY:Cu(p.orbitalY),orbitalZ:Cu(p.orbitalZ),forceTarget:p.forceTarget,target:p.target,forceCurve:Tu(p.forceCurve)},Iu(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Cu(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=Tu(m.y),l.rotationOverLifetime.x=Tu(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:Tu(v.opacity)};v.color&&(y.color=Mu(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Tu(g.cycles),animationDelay:Eu(g.animationDelay,0),animationDuration:Eu(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:Cu(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Tu(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Mu(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Mu(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:Cu(x.opacityOverLifetime)}),l.trails&&Iu(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(n)):t.sprite?(h=gt.sprite,s=function(t,e){var r=th(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}(n=t.sprite,i=y(n.transform,!1,!0))):t.cal?(h=gt.null,s=th(n=t.cal,i=y(n.transform,!1,!0))):t.ui?(h=gt.interact,i=y((n=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:vt.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&_u(r.previewColor),behavior:r.behavior||yt.NOTIFY};break;case"drag":e={type:vt.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:vt.MESSAGE}}return{options:e}}(n),i.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=gt.camera,i=y(n.transform),s=function(t){var e,r=t.options,i={options:{fov:r.fov,far:r.far,near:r.near,clipMode:r.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var s,o={path:Ou(null==(s=t.transform)?void 0:s.path),linearX:Tu(null==n?void 0:n.translateX),linearY:Tu(null==n?void 0:n.translateY),linearZ:Tu(null==n?void 0:n.translateZ)};Iu(o),i.positionOverLifetime=o}var a=t.rotationOverLifetime;if(a){var u={separateAxes:a.separateAxes,x:Tu(null==a?void 0:a.rotateX),y:Tu(null==a?void 0:a.rotateY),z:a.separateAxes?Tu(null==a?void 0:a.rotateZ):Tu(a.rotation)};Iu(u),i.rotationOverLifetime=u}return i}(n))),null==(r=s.renderer)?void 0:r.anchor){var f=new Float32Array(s.renderer.anchor);f[0]==lh&&f[1]==lh?delete s.renderer.anchor:e.requires&&bu(e.requires,"anchor")}if(n){var p,d,m=null==(p=n.options)?void 0:p.looping;if(m)c=Array.isArray(m)?m[1]?Mt.restart:Mt.destroy:Mt.restart;else c=c||(null==n||null==(d=n.options)?void 0:d.endBehavior)||Mt.destroy;n.options.renderLevel&&(o=n.options.renderLevel),isNaN(l)&&(l=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:l,id:t.id+"",transform:i,endBehavior:c,renderLevel:o,content:s};return a?e.plugins?(bu(e.plugins,a),v.pn=e.plugins.indexOf(a)):v.pluginName=a:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var s=(o=ch,a=i.rotation[0],u=i.rotation[1],h=i.rotation[2],c=Fu(a*Du/2),l=Fu(u*Du/2),f=Fu(h*Du/2),p=Vu(a*Du/2),d=Vu(u*Du/2),m=Vu(h*Du/2),o[0]=p*l*f+c*d*m,o[1]=c*d*f-p*l*m,o[2]=c*l*m+p*d*f,o[3]=c*l*f-p*d*m,o);i.rotation=function(t,e){var r,i,n,s=e[0],o=e[1],a=e[2],u=e[3],h=s+s,c=o+o,l=a+a,f=s*h,p=o*h,d=o*c,m=a*l,v=u*l,y=1-d-m,g=p-v,x=p+v,b=1-f-m,T=a*h-u*c,E=a*c+u*h,_=1-f-d;return t[1]=Math.asin((i=-1,(r=-T)>(n=1)?n:r<i?i:r))*Nu,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Nu,t[2]=Math.atan2(x,y)*Nu):(t[0]=0,t[2]=Math.atan2(-g,b)*Nu),t}([],s)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var o,a,u,h,c,l,f,p,d,m;return{}}}var ph,dh=((hh={})[ct.S]=[ct.S,ct.BPlus,ct.APlus],hh[ct.A]=[ct.A,ct.BPlus,ct.APlus],hh[ct.B]=[ct.B,ct.BPlus],hh);function mh(t,e){if(!t||!e)return!0;var r=dh[e];return!!r&&r.includes(t)}function vh(t,e){var r,i,n=null!=(i=null==t?void 0:t.background)?i:{},s=n.name,o=n.url;return s&&(e&&e[s]?r=e[s]:o&&(r=o)),r}function yh(t,e,r){return gh.apply(this,arguments)}function gh(){return(gh=i((function(t,r,i){var n,s;return h(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,er(t)];case 1:return n=a.sent(),[3,3];case 2:n=t,a.label=3;case 3:if(!n)throw new Error("Image not provided.");if(!r)return[2,n];if(s=vh(r,i)){if(W(s)&&s!==n.src)return[2,er(s)];if(o(s,e.HTMLImageElement))return[2,s]}return[2,n]}}))}))).apply(this,arguments)}exports.Scene=void 0,(ph=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return q(t)&&"jsonScene"in t},ph.isURL=function(t){return q(t)&&"url"in t},ph.isWithOptions=function(t){return q(t)&&"options"in t};var xh=1,bh=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ze),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=xh++,this.timers=[],this.updateOptions(t)}var r=t.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},r.loadScene=function(t,r,n){var s=this;return i((function(){var o,a,u,c,l,f,p,d,m,v,y,g,x;return h(this,(function(b){return a=W(t)?t:s.id,u=e.performance.now(),c=[],l=null==r?void 0:r.engine.gpuCapability,p=null!=(f=null==l?void 0:l.detail.compressedTexture)?f:exports.COMPRESSED_TEXTURE.NONE,d={},v=!1,y=new Promise((function(t,r){m=e.window.setTimeout((function(){v=!0,s.removeTimer(m);var t=e.performance.now()-u;r(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+c.join(" ")+", url: "+a+"."))}),1e3*s.timeout),s.timers.push(m)})),g=i((function(t,r){var i,n,s,o;return h(this,(function(a){switch(a.label){case 0:if(v)return[3,4];i=e.performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r()];case 2:return n=a.sent(),s=e.performance.now()-i,c.push("["+t+": "+s.toFixed(2)+"]"),d[t]=s,[2,n];case 3:throw o=a.sent(),new Error("Load error in "+t+", "+o+".");case 4:throw new Error("Load canceled.")}}))})),x=i((function(){var r,i,l,f,v,y,x,b,T,E,_,A,C,S;return h(this,(function(h){switch(h.label){case 0:return W(t)?(i=new e.URL(t,e.location.href).href,s.baseUrl=i,[4,g("loadJSON",(function(){return s.loadJSON(i)}))]):[3,2];case 1:return o=h.sent(),[3,3];case 2:o=t,s.baseUrl=e.location.href,h.label=3;case 3:return exports.Scene.isJSONObject(o)?(r=Ye({},o),[3,9]):[3,4];case 4:return[4,g("processJSON",(function(){return s.processJSON(o)}))];case 5:return l=h.sent(),f=l.jsonScene,v=l.pluginSystem,y=f.bins,x=void 0===y?[]:y,b=f.images,T=f.fonts,[4,Promise.all([g("processBins",(function(){return s.processBins(x)})),g("processImages",(function(){return s.processImages(b,p)})),g("plugin:processAssets",(function(){return s.processPluginAssets(f,v,n)})),g("processFontURL",(function(){return s.processFontURL(T)}))])];case 6:return E=h.sent(),_=E[0],A=E[1],[4,g("processTextures",(function(){return s.processTextures(A,_,f)}))];case 7:return C=h.sent(),r={timeInfos:d,url:t,renderLevel:s.options.renderLevel,storage:{},pluginSystem:v,jsonScene:f,bins:_,textureOptions:C,textures:[],images:A,assets:s.assets},[4,g("plugin:prepareResource",(function(){return v.loadResources(r,s.options)}))];case 8:h.sent(),h.label=9;case 9:return S=e.performance.now()-u,X.info("Load asset: totalTime: "+S.toFixed(4)+"ms "+c.join(" ")+", url: "+a+"."),e.window.clearTimeout(m),s.removeTimer(m),r.totalTime=S,r.startTime=u,r.timeInfos=d,[2,r]}}))})),[2,Promise.race([y,x()])]}))}))()},r.getAssets=function(){return this.assets},r.processJSON=function(t){var e=this;return i((function(){var r,i,n;return h(this,(function(s){switch(s.label){case 0:return r=sh(t),i=r.plugins,[4,(n=new ot(void 0===i?[]:i)).processRawJSON(r,e.options)];case 1:return s.sent(),[2,{jsonScene:r,pluginSystem:n}]}}))}))()},r.processBins=function(t){var r=this;return i((function(){var i,n,s;return h(this,(function(a){return i=r.options.renderLevel,n=r.baseUrl,s=t.map((function(s){if(o(s,ArrayBuffer))return s;if(mh(s.renderLevel,i))return r.loadBins(new e.URL(s.url,n).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(s)]}))}))()},r.processFontURL=function(r){var n=this;return i((function(){var s;return h(this,(function(o){return r?(s=r.map(i((function(r){var i,s,o;return h(this,(function(a){switch(a.label){case 0:if(!r.fontURL||t.fontCache.has(r.fontFamily))return[3,4];z(r.fontFamily)||console.warn("Risky font family: "+r.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),i=new e.URL(r.fontURL,n.baseUrl).href,[4,(o=new FontFace(null!=(s=r.fontFamily)?s:"","url("+i+")")).load()];case 2:return a.sent(),e.document.fonts.add(o),t.fontCache.add(r.fontFamily),[3,4];case 3:return a.sent(),X.warn("Invalid font family or font source: "+JSON.stringify(r.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(s)]):[2]}))}))()},r.processImages=function(t,r){void 0===r&&(r=0);var n=this;return i((function(){var s,a,u,c,l,f,p,d;return h(this,(function(m){switch(m.label){case 0:return s=n.options,a=s.useCompressedTexture,u=s.variables,c=s.disableWebP,l=s.disableAVIF,f=n.baseUrl,p=t.map(i((function(t,i){var s,p,d,m,v,y,g,x,b,T,E,_,A,C,S,w,R,M,O,P,I;return h(this,(function(i){switch(i.label){case 0:if(s=t.url,p=t.webp,d=t.avif,m=new e.URL(s,f).href,v=!c&&p?new e.URL(p,f).href:void 0,y=!l&&d?new e.URL(d,f).href:void 0,g=t.id,!("template"in t))return[3,8];if(x=t.template,!(b=x.background))return[3,7];T=vh(x,u),E=b.type===qt.video,_=b&&E?or:er,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,ur(T,_)];case 2:return o(A=i.sent(),e.HTMLVideoElement)?(n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.video},[2,A]):[3,3];case 3:return b&&Array.isArray(T)&&u&&(u[b.name]=A.src),n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.image},[4,yh(A,x,u)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw C=i.sent(),new Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("compressed"in t&&a&&r){if(S=t.compressed,r===exports.COMPRESSED_TEXTURE.ASTC?w=S.astc:r===exports.COMPRESSED_TEXTURE.PVRTC&&(w=S.pvrtc),w)return R=new e.URL(w,f).href,n.sourceFrom[g]={url:R,type:exports.TextureSourceType.compressed},[2,n.loadBins(R)]}else if(o(t,e.HTMLImageElement)||o(t,e.HTMLCanvasElement)||o(t,e.HTMLVideoElement)||o(t,mr))return[2,t];i.label=9;case 9:return y?[4,$e(m,y)]:[3,11];case 10:return I=i.sent(),[3,13];case 11:return[4,Qe(m,v)];case 12:I=i.sent(),i.label=13;case 13:return O=(M=I).url,P=M.image,n.sourceFrom[g]={url:O,type:exports.TextureSourceType.image},[2,P]}}))}))),[4,Promise.all(p)];case 1:return d=m.sent(),n.assignImagesToAssets(t,d),[2,d]}}))}))()},r.processPluginAssets=function(t,e,r){var n=this;return i((function(){var i,s,o,a,u;return h(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,r)];case 1:for(i=h.sent(),s=i.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),o=s.assets,a=s.loadedAssets,u=0;u<o.length;u++)n.assets[o[u].id]=a[u];return[2]}}))}))()},r.processTextures=function(t,r,n){var s=this;return i((function(){var a,u,c;return h(this,(function(l){return u=null!=(a=n.textures)?a:t.map((function(t,e){return{source:e}})),c=u.map(i((function(t,i){var a,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:if(o(t,mr))return[2,t];if(!("mipmaps"in t))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,cr(t,r,s.assets,n.bins)];case 2:return[2,h.sent()];case 3:throw a=h.sent(),new Error("Load texture "+i+" fails, error message: "+a+".");case 4:return u=t.source,c=t.id,f="",q(u)?(l=s.assets[u.id],f=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,er(tt(u))];case 6:l=h.sent(),h.label=7;case 7:if(l)return p=function(t,r,i){var n={id:i,dataType:Qt.Texture};if(o(t,mr))return Ye({},t.source,n);if(o(t,e.HTMLImageElement)||K(t))return Ye({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:ke.LINEAR,magFilter:ke.LINEAR},n);if(o(t,e.HTMLVideoElement))return Ye({sourceType:exports.TextureSourceType.video,video:t,minFilter:ke.LINEAR,magFilter:ke.LINEAR},n);if(o(t,ArrayBuffer))return Ye({},Tr(t),{sourceFrom:r},n);if("width"in t&&"height"in t&&"data"in t)return Ye({sourceType:exports.TextureSourceType.data,data:t,wrapS:ke.CLAMP_TO_EDGE,wrapT:ke.CLAMP_TO_EDGE,minFilter:ke.NEAREST,magFilter:ke.NEAREST},n);throw new Error("Invalid texture options.")}(l,s.sourceFrom[f],c),[2,p.sourceType===exports.TextureSourceType.compressed?p:Ye({},p,t)];throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(c)]}))}))()},r.loadJSON=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.loadBins=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.assignImagesToAssets=function(t,e){for(var r=0;r<t.length;r++)this.assets[t[r].id]=e[r]},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){this.timers.length&&this.timers.map((function(t){return e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t}();bh.fontCache=new Set;var Th,Eh=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(gr(t))}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var r=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(r=t.url),exports.Scene.isWithOptions(t)&&(e=Ye({},e,t.options))),{source:r,options:e}},e.updateTextVariables=function(t,e){var r=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===gt.text||t.type===gt.richtext){var i=e[t.name];if(!i)return;t.components.forEach((function(t){var e=t.id,n=r.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==Qt.TextComponent&&(null==n?void 0:n.dataType)!==Qt.RichTextComponent||(n.options.text=i)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},e.prepareAssets=function(t,e){this.engine.clearResources();for(var r,i=s(Object.keys(e));!(r=i()).done;){var n=r.value,o=e[n],a=new vu(this.engine);a.data=o,a.setInstanceId(n)}this.engine.addPackageDatas(t);for(var u,h=s(this.builtinObjects);!(u=h()).done;){var c=u.value;this.engine.addInstance(c)}},e.createShaderVariant=function(){for(var t,e=s(Object.keys(this.engine.objectInstance));!(t=e()).done;){var r=t.value,i=this.engine.objectInstance[r];o(i,Pr)&&i.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=s(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),_h=new Int32Array(2),Ah=new Float32Array(_h.buffer),Ch=new Float64Array(_h.buffer),Sh=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"}(Th||(Th={}));var wh=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var r=t.prototype;return r.clear=function(){this.position_=0},r.bytes=function(){return this.bytes_},r.position=function(){return this.position_},r.setPosition=function(t){this.position_=t},r.capacity=function(){return this.bytes_.length},r.readInt8=function(t){return this.readUint8(t)<<24>>24},r.readUint8=function(t){return this.bytes_[t]},r.readInt16=function(t){return this.readUint16(t)<<16>>16},r.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.readUint32=function(t){return this.readInt32(t)>>>0},r.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readFloat32=function(t){return _h[0]=this.readInt32(t),Ah[0]},r.readFloat64=function(t){return _h[Sh?0:1]=this.readInt32(t),_h[Sh?1:0]=this.readInt32(t+4),Ch[0]},r.writeInt8=function(t,e){this.bytes_[t]=e},r.writeUint8=function(t,e){this.bytes_[t]=e},r.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.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},r.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},r.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},r.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},r.writeFloat32=function(t,e){Ah[0]=e,this.writeInt32(t,_h[0])},r.writeFloat64=function(t,e){Ch[0]=e,this.writeInt32(t,_h[Sh?0:1]),this.writeInt32(t+4,_h[Sh?1:0])},r.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},r.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},r.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},r.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t);t+=4;var i=this.bytes_.subarray(t,t+r);return e===Th.UTF8_BYTES?i:this.text_decoder_.decode(i)},r.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},r.__indirect=function(t){return t+this.readInt32(t)},r.__vector=function(t){return t+this.readInt32(t)+4},r.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.__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},r.createScalarList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n)}return r},r.createObjList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n.unpack())}return r},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Rh=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=wh.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,r){e>this.minalign&&(this.minalign=e);for(var i=1+~(this.bb.capacity()-this.space+r)&e-1;this.space<i+e+r;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)},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,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,r){e!=r&&(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 r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=2*(r+2);this.addInt16(i);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(o)){for(var a=2;a<i;a+=2)if(this.bb.readInt16(s+a)!=this.bb.readInt16(o+a))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,r){var i=r?4:0;if(e){var n=e;if(this.prep(this.minalign,8+i),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var s=3;s>=0;s--)this.writeInt8(n.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&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 r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(e<this.bb.readInt16(i)&&0!=this.bb.readInt16(i+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(r,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=o(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=[],r=0;r<t.length;++r){var i=t[r];if(null===i)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(i))}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 r=e<<1,i=wh.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},t}(),Mh=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 Oh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,r,i){return t.startFBEffectsObjectData(e),t.addDataType(e,r),t.addData(e,i),t.endFBEffectsObjectData(e)},t}(),Oh=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,r=Mh.createDataVector(t,this.data);return Mh.createFBEffectsObjectData(t,e,r)},t}(),Ph=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 r=this.bb.__offset(this.bb_pos,4);return r?(e||new Mh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 Ih(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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,r){return t.startFBEffectsPackageData(e),t.addExportObjects(e,r),t.endFBEffectsPackageData(e)},t}(),Ih=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Ph.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Ph.createFBEffectsPackageData(t,e)},t}(),Lh=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 Fh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n){return t.startFBSubMesh(e),t.addOffset(e,r),t.addIndexCount(e,i),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Fh=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.offset=t,this.indexCount=e,this.vertexCount=r}return t.prototype.pack=function(t){return Lh.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Vh=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 Dh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n,s,o){return t.startFBVertexChannel(e),t.addSemantic(e,r),t.addOffset(e,i),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),Dh=function(){function t(t,e,r,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=r,this.dimension=i,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Vh.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Nh=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 r=this.bb.__offset(this.bb_pos,6);return r?(e||new Vh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 kh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,r,i){return t.startFBVertexData(e),t.addVertexCount(e,r),t.addChannels(e,i),t.endFBVertexData(e)},t}(),kh=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=Nh.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Nh.createFBVertexData(t,this.vertexCount,e)},t}(),zh=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 Nh).__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 r=this.bb.__offset(this.bb_pos,14);return r?(e||new Lh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+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 Uh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Uh=function(){function t(t,e,r,i,n,s,o,a,u,h,c,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===o&&(o=0),void 0===a&&(a=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===c&&(c=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=r,this.indexFormat=i,this.indexOffset=n,this.subMeshes=s,this.mode=o,this.buffer=a,this.binaryData=u,this.boneNames=h,this.rootBoneName=c,this.inverseBindMatrices=l}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,r=null!==this.name?t.createString(this.name):0,i=null!==this.vertexData?this.vertexData.pack(t):0,n=zh.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,o=zh.createBinaryDataVector(t,this.binaryData),a=zh.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=zh.createInverseBindMatricesVector(t,this.inverseBindMatrices);return zh.startFBGeometryData(t),zh.addId(t,e),zh.addName(t,r),zh.addVertexData(t,i),zh.addIndexFormat(t,this.indexFormat),zh.addIndexOffset(t,this.indexOffset),zh.addSubMeshes(t,n),zh.addMode(t,this.mode),zh.addBuffer(t,s),zh.addBinaryData(t,o),zh.addBoneNames(t,a),zh.addRootBoneName(t,u),zh.addInverseBindMatrices(t,h),zh.endFBGeometryData(t)},t}(),Bh=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 Rh(1),r=new Ih,i=[],n=s(this.exportObjectDatas);!(t=n()).done;){var o=t.value,a=void 0;o.dataType===Qt.Geometry&&(a=new Oh("Geometry",this.geometryDataToBinary(o))),a&&i.push(a)}return r.exportObjects=i,Ph.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new wh(t),r=Ph.getRootAsFBEffectsPackageData(e),i=0;i<r.exportObjectsLength();i++){var n=r.exportObjects(i);if(n){var s=n.dataArray(),o=n.dataType();if(s){var a=void 0;o===Qt.Geometry&&(a=this.binaryToGeometryData(s)),a&&this.exportObjectDatas.push(a)}}}},e.geometryDataToBinary=function(t){var e=new Rh(1),r=new Uh,i=t.indexFormat,n=t.indexOffset,o=t.mode,a=t.id,u=t.vertexData,h=t.boneNames,c=void 0===h?[]:h,l=t.rootBoneName,f=void 0===l?"":l,p=t.inverseBindMatrices,d=void 0===p?[]:p,m=t.binaryData,v=void 0===m?[]:m;r.indexFormat=i,r.indexOffset=n,r.mode=o,r.id=a,r.boneNames=c,r.rootBoneName=f,r.inverseBindMatrices=d,r.binaryData=v;var y=new kh;y.vertexCount=u.vertexCount,y.channels=[];for(var g,x=s(u.channels);!(g=x()).done;){var b=g.value,T=b.semantic,E=b.offset,_=b.format,A=b.dimension,C=b.normalize,S=new Dh(T,E,_,A,C);y.channels.push(S)}r.vertexData=y;for(var w,R=[],M=s(t.subMeshes);!(w=M()).done;){var O=w.value,P=O.offset,I=O.indexCount,L=O.vertexCount,F=new Fh(P,I,L);R.push(F)}return r.subMeshes=R,Ph.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new wh(t),r=zh.getRootAsFBGeometryData(e),i={vertexCount:0,channels:[]},n=r.vertexData();if(n){i.vertexCount=n.vertexCount();for(var s=0;s<n.channelsLength();s++){var o=n.channels(s);if(o){var a,u={semantic:null!=(a=o.semantic())?a:"",offset:o.offset(),format:o.format(),dimension:o.dimension(),normalize:o.normalize()};i.channels.push(u)}}}for(var h=[],c=0;c<r.subMeshesLength();c++){var l=r.subMeshes(c);if(l){var f={offset:l.offset(),vertexCount:l.vertexCount(),indexCount:l.indexCount()};h.push(f)}}for(var p=[],d=0;d<r.boneNamesLength();d++){var m=r.boneNames(d);p.push(m)}var v,y,g,x,b=r.inverseBindMatricesArray();return{vertexData:i,indexFormat:r.indexFormat(),indexOffset:r.indexOffset(),subMeshes:h,mode:r.mode(),buffer:null!=(v=r.buffer())?v:"",boneNames:p,rootBoneName:null!=(y=r.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=r.binaryDataArray())?g:void 0,id:null!=(x=r.id())?x:"",dataType:Qt.Geometry}},t}(),Gh=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new gu(this),this.emptyTexture=gr(this),this.transparentTexture=xr(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return q(t)&&t.constructor===Object?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,r=t.jsonScene,i=t.textureOptions,n=void 0===i?[]:i,o=r.items,a=void 0===o?[]:o,u=r.materials,h=void 0===u?[]:u,c=r.shaders,l=void 0===c?[]:c,f=r.geometries,p=void 0===f?[]:f,d=r.components,m=void 0===d?[]:d,v=r.animations,y=void 0===v?[]:v,g=r.bins,x=void 0===g?[]:g,b=r.miscs,T=void 0===b?[]:b,E=s(r.compositions);!(e=E()).done;){var _=e.value;this.addEffectsObjectData(_)}for(var A,C=s(a);!(A=C()).done;){var S=A.value;mh(S.renderLevel,t.renderLevel)||(S.components=[],S.type=gt.null),this.addEffectsObjectData(S)}for(var w,R=s(h);!(w=R()).done;){var M=w.value;this.addEffectsObjectData(M)}for(var O,P=s(l);!(O=P()).done;){var I=O.value;this.addEffectsObjectData(I)}for(var L,F=s(p);!(L=F()).done;){var V=L.value;this.addEffectsObjectData(V)}for(var D,N=s(m);!(D=N()).done;){var k=D.value;this.addEffectsObjectData(k)}for(var z,U=s(y);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G,j=s(T);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}for(var H=0;H<x.length;H++){var W=x[H],Y=t.bins[H];if(W.dataType===Qt.BinaryAsset)W.buffer=Y,W.id&&this.addEffectsObjectData(W);else{var Z=new Bh;Z.deserializeFromBinary(new Uint8Array(Y));for(var q,K=s(Z.exportObjectDatas);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}}}for(var J,$=s(n);!(J=$()).done;){var tt=J.value;this.addEffectsObjectData(tt)}},e.createVFXItems=function(t){var e=this;return i((function(){var r,i,n,o,a;return h(this,(function(u){for(r=t.jsonScene,i=s(r.items);!(n=i()).done;)o=n.value,"ECS"!==(a=o.type)&&"camera"!==a&&a!==gt.sprite&&a!==gt.particle&&a!==gt.mesh&&a!==gt.skybox&&a!==gt.light&&a!==gt.tree&&a!==gt.interact&&a!==gt.camera||e.database&&e.assetLoader.loadGUID(o);return[2]}))}))()},e.addTexture=function(t){this.destroyed||y(this.textures,t)},e.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.addMaterial=function(t){this.destroyed||y(this.materials,t)},e.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.addGeometry=function(t){this.destroyed||y(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.addMesh=function(t){this.destroyed||y(this.meshes,t)},e.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||y(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||g(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&X.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach((function(t){return t.dispose()})),this.meshes.forEach((function(t){return t.dispose()})),this.geometries.forEach((function(t){return t.dispose()})),this.materials.forEach((function(t){return t.dispose()})),this.textures.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},oe(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),jh=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var r=t.prototype;return r.getFPS=function(){return this.targetFPS},r.setFPS=function(t){this.targetFPS=_e(t,1,120),this.interval=Math.floor(1e3/t)-2},r.getPaused=function(){return this.paused},r.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var r=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},i=function(){t.intervalId=r(i),t.paused||t.tick()};i()}},r.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},r.pause=function(){this.paused=!0,this.dt=0},r.resume=function(){this.paused=!1,this.dt=0},r.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 r=0,i=this.tickers.length;r<i;r++){var n=this.tickers[r];n(this.dt)}}}},r.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},oe(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();st("camera",jn,exports.VFXItem),st("text",mu,exports.VFXItem),st("sprite",oo,exports.VFXItem),st("particle",Ma,exports.VFXItem),st("cal",Oa,exports.VFXItem),st("interact",Jn,exports.VFXItem);var Xh;X.info("Core version: 2.5.0-alpha.6.");var Hh,Wh=((Xh={})[ke.RGBA]=34842,Xh[ke.RGB]=34843,Xh[ke.ALPHA]=33325,Xh[ke.RED]=33325,Xh[ke.LUMINANCE_ALPHA]=33327,Xh[ke.LUMINANCE]=33325,Xh),Yh=((Hh={})[ke.RGBA]=34836,Hh[ke.RGB]=34837,Hh[ke.ALPHA]=33326,Hh[ke.RED]=33326,Hh[ke.LUMINANCE_ALPHA]=33328,Hh[ke.LUMINANCE]=33326,Hh),Zh=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,r&&i.fromData(r),i}Ct(e,t);var r=e.prototype;return r.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},r.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,r=this.source,i=r.target,n=void 0===i?e.TEXTURE_2D:i,s=r.name;this.textureBuffer=e.createTexture(),$h(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},r.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},r.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}},r.update=function(t){var e=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var r,i,n=this.target,s=this.source,o=this.pipelineContext.gl,a=this.engine.gpuCapability.detail,u=s.sourceType,h=s.data,c=s.cube,l=s.image,f=s.video,p=s.mipmaps,d=s.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=s.format,b=s.type,T=s.internalFormat,E=0,_=0;if(this.bind(u===exports.TextureSourceType.video),b===ke.HALF_FLOAT?((b=a.halfFloatTexture)||X.error("Half float texture is not support."),Ue(o)&&T===x&&(x===ke.LUMINANCE&&(x=ke.RED),T=Wh[x]),a.halfFloatLinear||(s.minFilter=s.magFilter=o.NEAREST,X.warn("Half float linear not support, change to NEAREST."))):b===o.FLOAT&&((b=a.floatTexture)||X.error("Float texture is not support."),Ue(o)&&T===x&&(x===ke.LUMINANCE&&(x=ke.RED),T=Yh[x]),a.floatLinear||(s.minFilter=o.NEAREST,s.magFilter=o.NEAREST,X.warn("Float linear not support, change to NEAREST."))),void 0===s.premultiplyAlpha&&(s.premultiplyAlpha=!1),o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),void 0===s.flipY&&(s.flipY=!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,s.flipY),u===exports.TextureSourceType.framebuffer)m&&(E=null!=(r=m.width)?r:0,_=null!=(i=m.height)?i:0,E&&_&&(this.width!==E||this.height!==_)&&o.texImage2D(n,0,T,E,_,0,x,b,null));else if(u===exports.TextureSourceType.data){var A;if(n===o.TEXTURE_CUBE_MAP)v.forEach((function(t,r){var i=e.texImage2DData(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else A=this.texImage2DData(o,n,0,T,x,b,h),E=A[0],_=A[1]}else if(u===exports.TextureSourceType.image||u===exports.TextureSourceType.video){if(n===o.TEXTURE_CUBE_MAP)c.forEach((function(t,r){var i=e.texImage2D(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else if(n===o.TEXTURE_2D){var C,S=null!=l?l:f;C=this.texImage2D(o,n,0,T,x,b,S),E=C[0],_=C[1]}y&&(qh(E)&&qh(_)||Ue(o))&&o.generateMipmap(n)}else if(u===exports.TextureSourceType.mipmaps){var w;n===o.TEXTURE_2D?p.forEach((function(t,r){var i;(w="data"in t?e.texImage2DData(o,n,r,T,x,b,t):e.texImage2D(o,n,r,T,x,b,t),0===r)&&(E=(i=w)[0],_=i[1])})):n===o.TEXTURE_CUBE_MAP&&d.forEach((function(t,r){t.forEach((function(t,i){var n;(w="data"in t?e.texImage2DData(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t):e.texImage2D(o,o.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t),0===r)&&(E=(n=w)[0],_=n[1])}))}))}else u===exports.TextureSourceType.compressed&&g&&0!==g.length&&(E=g[0].width,_=g[0].height,g.forEach((function(t,e){o.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=_,this.setTextureFilters(o,n,s)},r.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,s=r.wrapS,o=void 0===s?t.CLAMP_TO_EDGE:s,a=r.wrapT,u=void 0===a?t.CLAMP_TO_EDGE:a,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var c=Ue(t)||qh(this.width)&&qh(this.height),l=r.magFilter?r.magFilter:t.NEAREST,f=r.minFilter?r.minFilter:t.NEAREST;c||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,l),t.texParameteri(e,t.TEXTURE_WRAP_S,c?o:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e,i=this.assembleOptions(r),n=i.sourceType,s=i.sourceFrom,o=i.name,a=void 0===o?"":o;this.source=i,this.sourceType=n,this.sourceFrom=s,this.name=a,this.guid=e.id},r.texImage2D=function(t,e,r,i,n,s,o){var a,u=this,h=this.source,c=h.sourceType,l=h.minFilter,f=h.magFilter,p=h.wrapS,d=h.wrapT,m=null!=(a=this.engine.gpuCapability.detail.maxTextureSize)?a:2048,v=o;if(c!==exports.TextureSourceType.video){var y=l!==t.NEAREST||f!==t.NEAREST||p!==t.CLAMP_TO_EDGE||d!==t.CLAMP_TO_EDGE;(y=y||o.width>m||o.height>m)&&setTimeout((function(){v=u.resizeImage(o)}))}t.texImage2D(e,r,i,n,s,v);var g=[v.width,v.height];return c===exports.TextureSourceType.video?[o.videoWidth,o.videoHeight]:g},r.texImage2DData=function(t,e,r,i,n,s,o){var a=o.data,u=o.width,h=o.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,r,i,u,h,0,n,s,c),[u,h]},r.resizeImage=function(t,e,r){var i,n=null!=(i=this.engine.gpuCapability.detail.maxTextureSize)?i:2048;if(Ue(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var s=function(t,e,r,i){var n=t.width,s=t.height,o=Math.min(e,r||hs(n)),a=Math.min(e,i||hs(s));if(a!==s||o!==n){var u=hu.getCanvas(),h=u.getContext("2d");return u.width=o,u.height=a,null==h||h.drawImage(t,0,0,n,s,0,0,o,a),X.warn("Image resize from "+n+"x"+s+" to "+o+"x"+a+"."),u}}(t,n,e,r);return s||t},r.reloadData=function(){var t=this;return i((function(){return h(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Ar().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},r.offloadData=function(){if(this.initialized&&Ar().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[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<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},r.uploadCurrentVideoFrame=function(){var t=this;return i((function(){return h(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]}))}))()},r.updateSource=function(t){this.source=this.assembleOptions(Ye({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},r.restore=function(){},r.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){X.error("This texture has been destroyed.")},this.initialize=J,void 0!==this.engine&&this.engine.removeTexture(this)},e}(mr);function qh(t){return 0==(t&t-1)&&0!==t}var Kh=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().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 Ue(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),$h(e,t),e},e.bindVertexArray=function(t){var e;Ue(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Ue(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),Qh=1,Jh=function(){function t(t){this.engine=t,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var e={width:1,height:1,data:new Uint8Array([255])},r=t.getGLPipelineContext(),i=r.gl;this.gl=i,this.pipelineContext=r,this.emptyTexture2D=new Zh(t,{data:e,sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new Zh(t,{target:i.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+Qh,Qh++}var e=t.prototype;return e.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,n),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&y(this.renderbuffers,t),e},e.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.framebuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.drawGeometry=function(t,e,r){if(this.gl){var i=t,n=e.shaderVariant.program;if(n){var s=n.setupAttributes(i),o=this.gl,a=i.indicesBuffer,u=i.drawStart,h=i.drawCount,c=i.mode,l=i.subMeshes;if(l&&l.length){var f,p=l[r];if(h<0)return;if(u=p.offset,a)h=null!=(f=p.indexCount)?f:0;else h=p.vertexCount}a?o.drawElements(c,h,a.type,null!=u?u:0):o.drawArrays(c,u,h),null==s||s.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var r=this.gl.createFramebuffer();if(!r)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return y(this.framebuffers,t),$h(r,e,e),r},e.createVAO=function(t){return new Kh(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(this.textures,t),delete t.textureBuffer)},e.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),g(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(this.renderbuffers,t),delete t.buffer)},e.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach((function(e){return t.deleteGLFramebuffer(e)})),this.framebuffers.length=0,this.renderbuffers.forEach((function(e){return t.deleteGLRenderbuffer(e)})),this.renderbuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.lost=function(t){X.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},e.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},oe(t,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function $h(t,e,r){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var tc,ec,rc=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.name,i=e.data,n=e.elementCount,s=e.target,o=void 0===s?ke.ARRAY_BUFFER:s,a=e.type,u=void 0===a?ke.FLOAT:a,h=e.usage,c=void 0===h?ke.STATIC_DRAW:h,l=function(t){var e,r;return null!=(r=null==(e=ic[t])?void 0:e.BYTES_PER_ELEMENT)?r:0}(u);this.target=o,this.type=u,this.usage=c,this.glBuffer=this.createGLBuffer(r),this.bytesPerElement=l,i?this.bufferData(i):n&&this.bufferData(l*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return $h(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;r.bindBuffer(i,this.glBuffer),s>this.byteLength&&(this.byteLength=s,r.bufferData(i,s,this.usage)),r.bufferSubData(i,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Ue(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},oe(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ic=((tc={})[ke.INT]=Int32Array,tc[ke.FLOAT]=Float32Array,tc[ke.SHORT]=Int16Array,tc[ke.BYTE]=Int8Array,tc[ke.UNSIGNED_BYTE]=Uint8Array,tc[ke.UNSIGNED_INT]=Uint32Array,tc[ke.UNSIGNED_SHORT]=Uint16Array,tc);var nc=((ec={})[Uint8Array.BYTES_PER_ELEMENT]=ke.UNSIGNED_BYTE,ec[Uint16Array.BYTES_PER_ELEMENT]=ke.UNSIGNED_SHORT,ec[Uint32Array.BYTES_PER_ELEMENT]=ke.UNSIGNED_INT,ec),sc=1,oc=function(t){function r(e,r){var i;return(i=t.call(this,e)||this).drawCount=0,i.buffers={},i.vaos={},i.skin={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}Ct(r,t);var i=r.prototype;return i.getOptions=function(){return Ye({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;k(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new rc(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,s=r.target;this.bufferProps[i]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,s=e+r.length;if(i.data.length<s){var o=new r.constructor(s);o.set(i.data),i.data=o,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,n)),void 0!==a.end&&(a.end=Math.max(a.end,s-1))}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(o(t,Uint8Array)||o(t,Uint16Array)||o(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var r,i=t,n=t+e.length;if(this.indices.length<n){var s=new e.constructor(n);s.set(this.indices),this.indices=s,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,i)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}null==(r=this.indices)||r.set(e,i),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*Hr[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var r=nc[e.BYTES_PER_ELEMENT],i={data:e,target:ke.ELEMENT_ARRAY_BUFFER,type:r,name:this.name+"##index"};return new rc(t,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var s,o,a=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,o=i;else{var u=e[n].dataSource;s=t.buffers[u],o=r[u].data}if((a.dirty||a.discard)&&s&&o){if(a.discard)s.bufferData(o);else if(void 0!==a.start&&void 0!==a.end){var h=a.start*o.BYTES_PER_ELEMENT+o.byteOffset,c=a.end-a.start+1,l=new o.constructor(o.buffer,h,c);s.bufferSubData(a.start,l)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],s=e[i].dataSource;r[s]&&n&&(r[s].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,s=e.mode,a=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+sc++:u,c=e.bufferUsage,l=void 0===c?ke.STATIC_DRAW:c;this.name=h;var f={},p=[],d={},m={},v={},y=l;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(s)?ke.TRIANGLES:s,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,s=r.offset,a=r.normalize,u=r.type,h=void 0===u?ke.FLOAT:u,c=r.releasable,l=r.data;if(!h||"dataSource"in r||l||(l=Yr(h)),l){var g=o(l,Float32Array)?ke.FLOAT:ke.INT;f[t]={data:l,usage:y,target:ke.ARRAY_BUFFER,name:t},d[t]={size:i,stride:n,offset:s,type:null!=h?h:g,normalize:!!a,dataSource:t},v[t]=null!=c&&c,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(d[t]={size:i,stride:n,offset:s,type:h,dataSource:x,normalize:!!a})}p.push(t)})),m.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==a?void 0:a.data,this.indicesReleasable=!0===(null==a?void 0:a.releasable),this.bufferProps=f,this.attributes=d,this.attributesName=p,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},i.fromData=function(r){var i,n=this;if(t.prototype.fromData.call(this,r),this.subMeshes=r.subMeshes,r.buffer?i=new Uint8Array(function(t){for(var r=e.atob(t),i=new Uint8Array(r.length),n=0;n<r.length;n++)i[n]=r.charCodeAt(n);var s=i.buffer;return s}(r.buffer)):r.binaryData&&(i=r.binaryData),i){var s=r.vertexData.vertexCount;if(this.hasSemantic(r)){var o={mode:ke.TRIANGLES,attributes:{}};if(r.vertexData.channels.forEach((function(t){var e,r=null!=(e=ac[t.semantic])?e:t.semantic,a=n.createVertexTypedArray(t,i,s);o.attributes[r]={type:Ge(t.format),size:t.dimension,data:a,normalize:t.normalize}})),r.indexFormat!==te.None){var a=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset);o.indices={data:a},o.drawCount=a.length}else o.drawCount=s;this.processProps(o)}else{var u=r.vertexData.channels[0],h=r.vertexData.channels[1],c=r.vertexData.channels[2],l=this.createVertexTypedArray(u,i,s),f=this.createVertexTypedArray(h,i,s),p=this.createVertexTypedArray(c,i,s),d=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset),m={mode:ke.TRIANGLES,attributes:{aPos:{type:Ge(u.format),size:3,data:l,normalize:u.normalize},aUV:{type:Ge(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Ge(c.format),size:3,data:p,normalize:c.normalize}}};m.indices={data:d},m.drawCount=d.length,this.processProps(m)}this.skin={boneNames:r.boneNames,rootBoneName:r.rootBoneName,inverseBindMatrices:r.inverseBindMatrices}}},i.dispose=function(){var t,e=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){e.buffers[t].dispose()})),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach((function(t){var r;null==(r=e.vaos[t])||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0));this.destroyed=!0},i.createVertexTypedArray=function(t,e,r){var i=e.buffer;switch(t.format){case $t.Float32:return new Float32Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.Int16:return new Int16Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.Int8:return new Int8Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.UInt16:return new Uint16Array(i,e.byteOffset+t.offset,t.dimension*r);case $t.UInt8:return new Uint8Array(i,e.byteOffset+t.offset,t.dimension*r);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(i,e.byteOffset+t.offset,t.dimension*r)}},i.createIndexTypedArray=function(t,e,r){var i=e.buffer;switch(t){case te.UInt16:return new Uint16Array(i,e.byteOffset+r);case te.UInt32:return new Uint32Array(i,e.byteOffset+r);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(i,e.byteOffset+r)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},oe(r,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),r}(Wr),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 uc,hc,cc=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===r&&this.blendColor[2]===i&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=r,this.blendColor[2]=i,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===r&&this.blendFunctionParameters[2]===i&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=r,this.blendFunctionParameters[2]=i,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],r=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===r||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=r)},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=[ke.ONE,ke.ONE_MINUS_SRC_ALPHA,ke.ONE,ke.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[ke.FUNC_ADD,ke.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=ke.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=[ke.ALWAYS,ke.ALWAYS],this.stencilOpFail=[ke.KEEP,ke.KEEP],this.stencilOpZFail=[ke.KEEP,ke.KEEP],this.stencilOpZPass=[ke.KEEP,ke.KEEP],this.culling=!1,this.frontFace=ke.CCW,this.cullFace=ke.FRONT},e.apply=function(t){if(t.toggle(ke.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(ke.BLEND,this.blending),t.toggle(ke.DEPTH_TEST,this.depthTest),t.toggle(ke.STENCIL_TEST,this.stencilTest),t.toggle(ke.CULL_FACE,this.culling),t.toggle(ke.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(ke.BACK,this.stencilMask[1]),t.stencilMaskSeparate(ke.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(ke.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(ke.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(ke.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(ke.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[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}(),lc=Se,fc=Oe,pc=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.colors={},i.quaternions={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirty=!0,i.macrosDirty=!0,i.glMaterialState=new cc,r&&(i.shader=new exports.Shader(e),i.shader.shaderData=Ye({},r.shader,{id:$(),dataType:Qt.Shader})),i}Ct(e,t);var r=e.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];Z(r.initialize)?r.initialize():X.error("Failed to initialize texture: "+JSON.stringify(r)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var r=t.engine.getGLPipelineContext(),i=this.shaderVariant;if(i.program){var n;if(i.program.bind(),this.setupStates(r),e){for(var o,a=s(e.uniforms);!(o=a()).done;)n=o.value,this.checkUniform(n);for(var u,h=s(e.samplers);!(u=h()).done;)n=u.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(i.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)i.setFloat(n,e.floats[n]);for(n in e.ints)i.setInt(n,e.ints[n]);for(n in e.vector4s)i.setVector4(n,e.vector4s[n]);for(n in e.vector3s)i.setVector3(n,e.vector3s[n]);for(n in e.matrices)i.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)i.setFloat(n,this.floats[n]);for(n in this.ints)i.setInt(n,this.ints[n]);for(n in this.floatArrays)i.setFloats(n,this.floatArrays[n]);for(n in this.textures)i.setTexture(n,this.textures[n]);for(n in this.vector2s)i.setVector2(n,this.vector2s[n]);for(n in this.vector3s)i.setVector3(n,this.vector3s[n]);for(n in this.vector4s)i.setVector4(n,this.vector4s[n]);for(n in this.colors)i.setColor(n,this.colors[n]);for(n in this.quaternions)i.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)i.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)i.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)i.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)i.setMatrixArray(n,this.matrixArrays[n])}else{var c;null==(c=this.engine)||c.renderErrors.add(new Error("Shader program is not initialized."))}},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var r,i=s(e);!(r=i()).done;){var n=r.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var r,i=s(e);!(r=i()).done;)for(var n=r.value,o=0;o<16;o++)this.matrixArrays[t].push(n.elements[o])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var r=t||this.props,i=this.engine;k(i);var n=new e(i,r);return n.glMaterialState=Object.assign(new cc,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r=Ye({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===Tt.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var i,n,s=e.stringTags.RenderFace;for(i in s===Et.Front?(this.culling=!0,this.cullFace=ke.BACK):s===Et.Back?(this.culling=!0,this.cullFace=ke.FRONT):this.culling=!1,r.floats)this.setFloat(i,r.floats[i]);for(i in r.ints)this.setInt(i,r.ints[i]);for(i in r.vector4s){var o=r.vector4s[i];this.setVector4(i,new Se(o.x,o.y,o.z,o.w))}for(i in r.colors){var a=r.colors[i];this.setColor(i,new Re(a.r,a.g,a.b,a.a))}for(i in r.textures){var u=r.textures[i],h=this.engine.findObject(u.texture);this.setTexture(i,h);var c=u.offset,l=u.scale;c&&l&&this.setVector4(i+"_ST",new lc(l.x,l.y,c.x,c.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},r.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=Qt.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var r in this.ints)t.ints[r]=this.ints[r];for(var i in this.vector4s)t.vector4s[i]=this.vector4s[i];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var o=t.textures[s],a=this.getVector4(s+"_ST");a&&(o.scale={x:a.x,y:a.y},o.offset={x:a.z,y:a.w},delete t.vector4s[s+"_ST"])}return t},r.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new lc(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){for(var s=[],o=0;o<r.matrixArrays[e].length;o+=16){for(var a=fc.fromIdentity(),u=0;u<16;u++)a.elements[u]=r.matrixArrays[e][o+u];s.push(a)}this.setMatrixArray(e,s)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(t){var e,r=this;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),(null==t?void 0:t.textures)!==exports.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},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=J,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},oe(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Pr),dc=function(){function t(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var e=t.prototype;return e.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.copyTexture=function(t,e){this.renderer&&(t.initialize(),e.initialize(),e.updateSource({sourceType:exports.TextureSourceType.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var r=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(r)},e.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:ke.RGBA}},r=this.renderer.engine,i=new oc(r,{name:t,mode:ke.TRIANGLE_STRIP,attributes:{aPos:{type:ke.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=r.gpuCapability.level,s=new pc(r,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1}});s.blending=!1,s.depthTest=!1,s.culling=!1;var o=new ii(r,{name:t,geometry:i,material:s,priority:0});return new mc(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:exports.TextureLoadAction.whatever},attachments:[e],meshes:[o]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),mc=function(t){function e(){return t.apply(this,arguments)}Ct(e,t);var r=e.prototype;return r.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},r.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(ui),vc=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],k(t),this.gl=Pe(t,e,r),this.contextLostListener=function(t){for(var e,r,n=s(i.lostHandlers);!(r=n()).done;){r.value.lost(t)}null==(e=i.canvas)||e.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){for(var e,r,n=s(i.restoreHandlers);!(r=n()).done;){r.value.restore()}null==(e=i.canvas)||e.addEventListener("webglcontextlost",i.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),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}(),yc=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new Ni(e),r}Ct(e,t);var r=e.prototype;return r.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},r.getGLRenderer=function(){return this.renderer},r.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},r.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(Gh),gc=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,void 0!==r&&i.initialize(r),i}Ct(e,t);var r=e.prototype;return r.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},r.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderbuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):X.error("Invalid render buffer size: "+t+"x"+e+".")}}else X.error("Can't set size for uninitialized render buffer.")},r.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=J},e}(Vi),xc=1,bc=function(t){function e(e,r){var i;(i=t.call(this)||this).attachmentTextures=[];var n,s=e.depthStencilAttachment,o=e.viewport,a=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,c=void 0===h?1:h,l=e.name,f=void 0===l?"GLFramebuffer"+xc++:l;return i.renderer=r,i.engine=r.engine,i.depthStencilStorageType=null!=(n=null==s?void 0:s.storageType)?n:exports.RenderPassAttachmentStorageType.none,i.viewport=o,i.isCustomViewport=!!a,i.viewportScale=c,i.name=f,i.storeAction=u,i.updateProps(e),i}Ct(e,t);var r=e.prototype;return r.getDepthTexture=function(){return this.depthTexture},r.getStencilTexture=function(){return this.stencilTexture},r.getColorTextures=function(){return this.colorTextures},r.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),y(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&y(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&y(this.attachmentTextures,this.depthTexture.textureBuffer)},r.updateProps=function(t){var e,r,i=this.renderer,n=this.engine.gpuCapability,s=null!=(r=t.depthStencilAttachment)?r:{storageType:exports.RenderPassAttachmentStorageType.none},a=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,c=n.detail.readableDepthStencilTextures,l=s.storageType,f=s.storage;if(this.colorTextures=t.attachments.slice(),!a&&l!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(a&&(this.fbo=i.glRenderer.createGLFramebuffer(this,this.name)),l){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!o(f,gc))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new gc({format:ke.DEPTH_STENCIL,attachment:ke.DEPTH_STENCIL_ATTACHMENT,storageType:l},i.glRenderer);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!o(f,gc))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new gc({attachment:ke.DEPTH_ATTACHMENT,format:ke.DEPTH_COMPONENT16,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!o(f,gc))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new gc({attachment:ke.STENCIL_ATTACHMENT,format:ke.STENCIL_INDEX8,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Zh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:ke.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:ke.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Zh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:ke.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},r.getStoreAttachments=function(t,e){var r=this.renderer.glRenderer.gl,i=this.colorTextures.length;if(t&&Ue(r)&&i>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&y(n,e?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&y(n,e?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var s=0;s<i;s++)y(n,r["COLOR_ATTACHMENT"+s]);return n}},r.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;Ue(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext,i=this.viewport,n=i[0],s=i[1],o=i[2],a=i[3];r.bindFramebuffer(e.FRAMEBUFFER,this.fbo),r.viewport(n,s,o,a);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i&&i!==u&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var c=this,l=c.depthStencilRenderbuffer,f=c.depthTexture,p=c.stencilTexture;if(r.activeTexture(e.TEXTURE0),l)l.setSize(o,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,l.attachment,e.RENDERBUFFER,l.buffer);else if(f){f.source.data={width:o,height:a},f.update({data:{width:o,height:a,data:new Uint16Array(0)}});var d=f&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var m=e.checkFramebufferStatus(e.FRAMEBUFFER);if(m!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+m+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},r.resetColorTextures=function(t){var e=t,r=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,n=this.viewport,o=[];if(e){for(var a,u=s(e);!(a=u()).done;){a.value.initialize()}this.colorTextures=e.slice()}this.renderer.pipelineContext.activeTexture(r.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),i.framebufferTexture2D(r,r.FRAMEBUFFER,e,r.TEXTURE_2D,t.textureBuffer),o.push(!0)})),i.drawBuffers(r,o),this.updateAttachmentTextures()},r.resize=function(t,e,r,i){var n=this.viewport,s=n[0],o=n[1],a=n[2],u=n[3];s===t&&o===e&&a===r&&u===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},r.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,r,i=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(i===exports.RenderPassDestroyAttachmentType.force||i===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(r=this.depthTexture)||r.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},oe(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}(Ui),Tc=((uc={})[ke.FLOAT]=1,uc[ke.INT]=1,uc[ke.UNSIGNED_INT]=1,uc[ke.SHORT]=1,uc[ke.BOOL]=1,uc[ke.UNSIGNED_SHORT]=1,uc[ke.FLOAT_VEC2]=2,uc[ke.FLOAT_VEC3]=3,uc[ke.FLOAT_VEC4]=4,uc[ke.FLOAT_MAT2]=4,uc[ke.FLOAT_MAT3]=9,uc[ke.FLOAT_MAT4]=16,uc[ke.FLOAT_MAT2x3]=6,uc[ke.FLOAT_MAT2x4]=8,uc[ke.FLOAT_MAT4x3]=12,uc[ke.FLOAT_MAT4x2]=8,uc[ke.FLOAT_MAT3x4]=12,uc[ke.FLOAT_MAT3x2]=6,uc[ke.INT_VEC2]=2,uc[ke.INT_VEC3]=3,uc[ke.INT_VEC4]=4,uc[ke.UNSIGNED_INT_VEC2]=2,uc[ke.UNSIGNED_INT_VEC3]=3,uc[ke.UNSIGNED_INT_VEC4]=4,uc[ke.BOOL_VEC2]=2,uc[ke.BOOL_VEC3]=3,uc[ke.BOOL_VEC4]=4,uc),Ec=Sc(Float32Array),_c=Sc(Int32Array),Ac=Sc(Uint8Array);function Cc(t){return function(e,r,i,n){var s={start:r[1],dirty:!0};if(r[2]>1){var o=e;if(o.length){for(var a=n[1]||o.length,u=r[4]/t.BYTES_PER_ELEMENT,h=s.buffer=new t(a*u),c=n[0]||0,l=0;l<a;l++)h[l*u]=o[l+c];s.start+=c*u}}else s.buffer=new t([e]);return s}}function Sc(t){return function(e,r,i,n){for(var s=r[8],o=r[2],a=r[5],u=1===o?s:r[4],h=a?u/a:1,c=u/t.BYTES_PER_ELEMENT/h,l=s/t.BYTES_PER_ELEMENT/c,f=Tc[r[0]],p=f/h,d=(n[0]||0)*f,m=n[1]?h*n[1]:l,v=new t(c*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=d;g<m;g++){for(var T=0;T<p;T++)v[x+T]=e[b+T];x+=c,b+=p}return y}}function wc(t,e){for(var r=function(r){var s=t.getActiveUniformBlockName(e,r);k(s);var o={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};o.used=o.usedByVertexShader||o.usedByFragmentShader,i[r]=o;for(var a=o.uniformIndices,u=[],h=0;h<a.length;h++){var c=t.getActiveUniform(e,a[h]).name.replace("[0]","");o.uniforms[c]=[0,0,0,0,0,0,0,h,0],u[h]=c,n.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,a,r).forEach((function(t,e){var r=u[e];o.uniforms[r][i]=+t}))}));for(var l=0;l<u.length;l++){var f=o.uniforms[u[l]],p=o.uniforms[u[l+1]],d=p?p[1]:o.size;f[8]=d-f[1]}o.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices,s=Object.keys(i).map((function(t){return t+"["+i[t].join(":")+"]"})).join("+");return Rc(e+"+",r+"+",n.length+"+",s)}(o)+""},i=[],n=[],s=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=0;o<s;++o)r(o);return{blockSpecs:i,blockUniformNames:n}}function Rc(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var i=0,n=0;n<arguments.length;n++)for(var s=e[n],o=0;o<s.length;o++)i=Math.imul(31,i)+s.charCodeAt(o)|0;return i}(hc={})[ke.FLOAT]=Cc(Float32Array),hc[ke.INT]=Cc(Int32Array),hc[ke.UNSIGNED_INT]=Cc(Uint32Array),hc[ke.SHORT]=Cc(Int16Array),hc[ke.BOOL]=Cc(Uint8Array),hc[ke.UNSIGNED_SHORT]=Cc(Uint16Array),hc[ke.FLOAT_VEC2]=Ec,hc[ke.FLOAT_VEC3]=Ec,hc[ke.FLOAT_VEC4]=Ec,hc[ke.FLOAT_MAT2]=Ec,hc[ke.FLOAT_MAT3]=Ec,hc[ke.FLOAT_MAT4]=Ec,hc[ke.FLOAT_MAT2x3]=Ec,hc[ke.FLOAT_MAT2x4]=Ec,hc[ke.FLOAT_MAT4x3]=Ec,hc[ke.FLOAT_MAT4x2]=Ec,hc[ke.FLOAT_MAT3x4]=Ec,hc[ke.FLOAT_MAT3x2]=Ec,hc[ke.INT_VEC2]=_c,hc[ke.INT_VEC3]=_c,hc[ke.INT_VEC4]=_c,hc[ke.UNSIGNED_INT_VEC2]=_c,hc[ke.UNSIGNED_INT_VEC3]=_c,hc[ke.UNSIGNED_INT_VEC4]=_c,hc[ke.BOOL_VEC2]=Ac,hc[ke.BOOL_VEC3]=Ac,hc[ke.BOOL_VEC4]=Ac;var Mc=function(){function t(t,e,r){var i=this;this.engine=t,this.program=e,this.id=r,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),Ue(n))&&wc(n,e).blockSpecs.forEach((function(t){return i.uniformBlockMap[t.name]=t}));this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,r,i=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new Kh(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=r),r&&r.vao&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.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(),s.enableVertexAttribArray(r.loc),s.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),r&&(r.ready=!0)),r},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=t.getActiveAttrib(e,n);if(s){var o=s.name,a=s.type,u=s.size,h=t.getAttribLocation(e,o);r[o]={type:a,name:o,size:u,loc:h}}}return r},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),Oc=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).initialized=!1,i.uniformLocations={},i.samplerChannels={},i}Ct(e,t);var r=e.prototype;return r.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},r.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},r.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},r.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},r.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},r.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},r.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},r.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},r.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},r.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},r.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},r.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},r.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},r.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},r.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var o=r[i];this.samplerChannels[o]=i}},r.toData=function(){var t=this.defination;t.dataType=Qt.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},r.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(Lr),Pc=0,Ic=function(){function t(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var r=t.prototype;return r.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var r,i=[],n=s(Object.keys(this.cachedShaders));!(r=n()).done;){var o=r.value;this.cachedShaders[o].initialized||i.push(o)}t?i.length?Promise.all(i.map((function(t){return new Promise((function(r){return e.compileShader(e.cachedShaders[t],r)}))}))).then(t).catch((function(){return 0})):t([]):i.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},r.addShader=function(t,e){var r,i,n=[];t.macros&&(r=n).push.apply(r,[].concat(t.macros));e&&(i=n).push.apply(i,[].concat(e));var s=Ye({},t,{vertex:Ti.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:Ti.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),o=this.computeShaderCacheId(s);if(this.cachedShaders[o])return o;this.shaderAllDone=!1;var a=!1;return(s.shared||s.cacheId)&&(a=!0),this.cachedShaders[o]=new Oc(this.engine,Ye({},s,{vertex:s.vertex,fragment:s.fragment,name:s.name||o,shared:a})),this.cachedShaders[o].id=o,o},r.createShader=function(t,e){var r=this.addShader(t,e);return this.cachedShaders[r]},r.compileShader=function(t,r){var i=this,n=t.source,s=n.shared,o=n.vertex,a=n.fragment,u=n.name,h=t.source.cacheId,c=!1;(s||h)&&(c=!0);var l=this.pipelineContext.gl,f={shared:c,status:exports.ShaderCompileResultStatus.compiling},p=this.createProgram(l,o,a,f),d=this.glAsyncCompileExt,m=e.performance.now(),v=function(r){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=r,t.initialized=!0,t.pipelineContext=i.pipelineContext,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=r},y=function(){if(i.engine.isDestroyed)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==r?void 0:r(f);if(t.initialized)return null==r?void 0:r(f);var n=(!r||!d||d&&1==l.getProgramParameter(f.program,d.COMPLETION_STATUS_KHR))&&p();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){$h(n,u);var s=new Mc(i.engine,n,t.id);if(l.validateProgram(n),l.getProgramParameter(n,l.VALIDATE_STATUS))v(s);else{var h=l.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(s):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",o,"\nfragment:\n",a),l.deleteProgram(n))}}null==r||r(f)}else r&&e.requestAnimationFrame(y)};t.compileResult=f,y()},r.computeShaderCacheId=function(t){var e=t.vertex,r=void 0===e?"":e,i=t.fragment,n=void 0===i?"":i,s=t.shared,o=t.cacheId;return s||o?o||"shared_"+Rc(r,n):"instanced_"+Pc++},r.createProgram=function(t,e,r,i){var n=t.createProgram(),s=this.createGLShader(t,t.VERTEX_SHADER,e),o=this.createGLShader(t,t.FRAGMENT_SHADER,r);return n&&s&&o?(t.attachShader(n,s),t.attachShader(n,o),t.linkProgram(n),i.program=n,i.status=exports.ShaderCompileResultStatus.compiling,function(){if(i.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var a=t.getProgramInfoLog(n);console.error("Failed to link program: "+a+".");var u=Lc(t,s,"vertex",e),h=Lc(t,o,"fragment",r);return i.status=exports.ShaderCompileResultStatus.fail,u&&(i.error=u.error,i.status=u.status),h&&(i.error=h.error,i.status=h.status),n}return n}):(i.status=exports.ShaderCompileResultStatus.fail,function(){return null})},r.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Rc(null!=r?r:""),s=i.get(n);if(s)return s;var o=t.createShader(e);return o&&(t.shaderSource(o,r),t.compileShader(o),i.set(n,o)),o},r.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]},r.restore=function(){},r.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.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 Lc(t,e,r,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+r+" error: "+n,(null!=i?i:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}var Fc=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Ic(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=ke.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},e.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},e.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},e.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},e.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,r,i){this.set4("viewport",t,e,r,i)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,r){(this.currentTextureBinding!==e||r)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},e.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},e.set4=function(t,e,r,i,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),s.x===e&&s.y===r&&s.z===i&&s.w===n||this.gl[t](s.x=e,s.y=r,s.z=i,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},e.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},e.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},e.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),Vc=function(t){function e(e,r,i){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var s=Ye({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},i);n.context=new vc(e,r,s);var o=n.context.gl;return k(o),n.engine=new yc(o),n.engine.renderer=lo(n),n.pipelineContext=new Fc(n.engine,o),n.glRenderer=new Jh(n.engine),n.extension=new dc(lo(n)),n.renderingData={currentFrame:{}},n.framebuffer=new bc({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new Zh(n.engine,{sourceType:exports.TextureSourceType.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:exports.RenderPassAttachmentStorageType.none}},lo(n)),n}Ct(e,t);var r=e.prototype;return r.renderRenderFrame=function(t){var e,r=t;r.resource&&r.resource.color_b.initialize(),r.emptyTexture.initialize(),r.transparentTexture.initialize();var i=r._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=r.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(r.clearAction);var n=r.camera;this.renderingData.currentFrame=r,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),F(i);for(var o,a=s(i);!(o=a()).done;){var u=o.value,h=u.delegate;null==h.willBeginRenderPass||h.willBeginRenderPass.call(h,u,this.renderingData),this.renderRenderPass(u),null==h.didEndRenderPass||h.didEndRenderPass.call(h,u,this.renderingData)}for(var c,l=s(i);!(c=l()).done;){c.value.frameCleanup(this)}}},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,r=this.renderingData.currentPass.delegate,i=s(t);!(e=i()).done;){var n=e.value;null==r.willRenderMesh||r.willRenderMesh.call(r,n,this.renderingData),n.render(this),null==r.didRenderMesh||r.didRenderMesh.call(r,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,r){if(void 0===r&&(r=0),t&&e){e.initialize(),t.initialize(),t.flush();var i=this.renderingData;i.currentFrame.editorTransform&&e.setVector4("uEditorTransform",i.currentFrame.editorTransform);try{e.use(this,i.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e,r)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(t,e,r,i,n,s){if(this.temporaryRTs[t])return this.temporaryRTs[t];var o,a,u=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?o=ke.LINEAR:n===exports.FilterMode.Nearest&&(o=ke.NEAREST),s===exports.RenderTextureFormat.RGBA32?a=ke.UNSIGNED_BYTE:s===exports.RenderTextureFormat.RGBAHalf&&(a=ke.HALF_FLOAT),0===i?u=exports.RenderPassAttachmentStorageType.none:16===i?u=exports.RenderPassAttachmentStorageType.depth_16_opaque:24===i&&(u=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new Zh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:o,magFilter:o,internalFormat:ke.RGBA,format:ke.RGBA,type:a}),c=new bc({name:t,storeAction:{},viewport:[0,0,e,r],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=c,c},r.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},r.clear=function(t){var e=this.pipelineContext,r=0;if(t.colorAction===exports.TextureLoadAction.clear){var i=t.clearColor;i&&e.clearColor(i[0],i[1],i[2],i[3]),e.colorMask(!0,!0,!0,!0),r=ke.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),r|=ke.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),r|=ke.DEPTH_BUFFER_BIT}r&&e.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new Ni(t),this.engine.renderer=this,this.pipelineContext=new Fc(this.engine,t),this.glRenderer=new Jh(this.engine),this.extension=new dc(this)},r.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},oe(e,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),e}(Bi),Dc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Nc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",kc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",zc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Uc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Bc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",Gc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var jc=new Map;var Xc=!1,Hc=1,Wc=function(t){function r(r){var n;(n=t.call(this)||this).compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),n.handleEmitEvent("webglcontextlost",t),Yc(lo(n),!1)};var o=lo(n);n.restore=i((function(){var t;return h(this,(function(r){switch(r.label){case 0:return o.renderer.restore(),[4,Promise.all(o.compositions.map(i((function(t){var e,r,i,n,s,a,u,c,l,f,p,d;return h(this,(function(h){switch(h.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,s=t.reusable,a=t.renderOrder,u=t.transform,c=t.videoState,[4,o.loadScene(r)];case 1:(l=h.sent()).speed=i,l.reusable=s,l.keepResource=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),f=0,h.label=2;case 2:return f<c.length?c[f]?((p=l.textures[f].source.video).currentTime=null!=(d=c[f])?d:0,[4,p.play()]):[3,4]:[3,5];case 3:h.sent(),h.label=4;case 4:return f++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return o.compositions=r.sent(),o.emit("webglcontextrestored"),null==(t=o.ticker)||t.resume(),S()&&o.canvas&&(o.canvas.style.display="none",e.window.setTimeout((function(){o.canvas.style.display=""}),0)),[2]}}))})),n.handleResume=function(){n.emit("update",{player:lo(n),playing:!0})},n.handleClick=function(t){var e=t.x,r=t.y,i=[];n.compositions.forEach((function(t){for(var o,a=s(t.hitTest(e,r));!(o=a()).done;){var u=o.value;i.push(Ye({},u,{player:lo(n),composition:t}))}}));for(var o=0;o<i.length;o++){var a=i[o],u=a.behavior||yt.NOTIFY;u===yt.NOTIFY?(n.emit("click",Ye({},a,{compositionId:a.composition.id,compositionName:a.composition.name})),a.composition.emit("click",Ye({},a,{compositionId:a.composition.id,compositionName:a.composition.name}))):u===yt.RESUME_PLAYER&&n.resume()}};var a=r.container,u=r.canvas,c=r.fps,l=r.name,f=r.pixelRatio,p=r.manualRender,d=r.reportGPUTime,m=r.renderFramework,v=r.notifyTouch,y=r.onError,g=r.interactive,x=void 0!==g&&g,b=r.renderOptions,T=void 0===b?{}:b,E=r.env,_=void 0===E?"":E,A=T.willCaptureImage,w=T.premultipliedAlpha;if(n.onError=y,Xc||"debug-disable"===m)return uu(n);var R,M=(R=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===R[1]||"16"===R[1]&&"5"===R[2])?"webgl":"webgl2";m&&(M="webgl"===m?"webgl":"webgl2"),n.reportGPUTime=d,n.pixelRatio=Number.isFinite(f)?f:C(),n.offscreenMode=!0,n.env=_,n.name=l||""+Hc++;try{if(Ne.length)throw new Error("Errors before player create: "+Ne.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?n.canvas=u:(Zc(a),n.canvas=e.document.createElement("canvas"),a.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=Bi.create(n.canvas,M,{preserveDrawingBuffer:A,premultipliedAlpha:w}),n.renderer.env=_,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.assetService=new Eh(n.renderer.engine),p||(n.ticker=new jh(c),n.ticker.add(n.tick.bind(lo(n)))),n.event=new Zn(n.canvas,!!v),n.event.bindListeners(),n.event.addEventListener(Xn,n.handleClick),n.interactive=x,n.resize(),Ra(n.gpuCapability.detail)}catch(t){n.handleThrowError(t)}return jc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&X.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+Gc+".")})),jc.set(n.canvas,lo(n)),function(){for(var t,e=[],r=s(jc.values());!(t=r()).done;){var i=t.value;i.paused||e.push(i)}e.length>1&&X.error("Current running player count: "+e.length+", see "+Bc+".",e)}(),Yc(lo(n),!0),n}Ct(r,t);var n=r.prototype;return n.setSpeed=function(t){isNaN(t)||(this.speed=t)},n.getSpeed=function(){return this.speed},n.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},n.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(t,r){var n=this;return i((function(){var o,a,u,c,l,f,p,d,m,v,y,g,x,b,T,E,_,A,C,S;return h(this,(function(w){switch(w.label){case 0:return k(n.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),c=e.performance.now(),l=[],f=[],d=null==(p=null==r?void 0:r.autoplay)||p,m=null==(a=n.renderer.engine.gpuCapability)||null==(o=a.detail)?void 0:o.asyncShaderCompile,v=n.baseCompositionIndex,Y(t)?(y=l).push.apply(y,[].concat(t)):l.push(t),n.baseCompositionIndex+=l.length,d&&(n.autoPlaying=!0),g=[],[4,Promise.all(l.map(i((function(t,e){var i,s,o,a,u,c,l,p;return h(this,(function(h){switch(h.label){case 0:return i=n.assetService.assembleSceneLoadOptions(t,Ye({autoplay:d},r)),s=i.source,o=i.options,u=null!=(a=null==o?void 0:o.autoplay)?a:d,c=new bh(o),n.assetManagers.push(c),[4,c.loadScene(s,n.renderer,{env:n.env})];case 1:return l=h.sent(),n.disposed?(f.length=0,[2]):(n.assetService.prepareAssets(l,l.assets),n.assetService.updateTextVariables(l,c.options.variables),n.assetService.initializeTexture(l),l.pluginSystem.precompile(l.jsonScene.compositions,n.renderer),(p=n.createComposition(l,o)).setIndex(v+e),f[e]=p,g[e]=u,[2])}}))}))))];case 1:return w.sent(),x=e.performance.now(),[4,new Promise((function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(w.sent(),b=e.performance.now()-x,T=0;T<f.length;T++)g[T]?f[T].play():f[T].pause();for(null==(u=n.ticker)||u.start(),E=f.map((function(t){return t.name})),_=e.performance.now()-c,A=s(f);!(C=A()).done;)(S=C.value).statistic.compileTime=b,S.statistic.firstFrameTime=_;return X.info("First frame ["+E+"]: "+_.toFixed(4)+"ms."),X.info("Shader "+(m?"async":"sync")+" compile ["+E+"]: "+b.toFixed(4)+"ms."),[2,Y(t)?f:f[0]]}}))}))()},n.createComposition=function(t,e){var r=this;void 0===e&&(e={});var i=this.renderer,n=new Aa(Ye({},e,{renderer:i,width:i.getWidth(),height:i.getHeight(),event:this.event,handleItemMessage:function(t){r.emit("message",t)}}),t);return this.ticker&&e.renderLevel===ct.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==In&&this.assetService.createShaderVariant(),this.compositions.push(n),n},n.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()},n.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.doTick(0,!0)},n.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.doTick(0,!0),this.emit("update",{player:this,playing:!1})},n.playSequence=function(t){for(var e,r=function(e){t[e].on("end",(function(){t[e+1].play()}))},i=0;i<t.length-1;i++)r(i);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return i((function(){var e;return h(this,(function(r){switch(r.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:r.sent(),t.resumePending=!1,t.handleResume(),r.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}}))}))()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(t,e){var r,i=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(r=this.ticker)||r.pause());t=Math.min(t,33)*this.speed;var s=this.compositions,o=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var a,u=[],h=0;h<s.length;h++){var c=s[h];c.textureOffloaded?(o=!0,X.error("Composition "+c.name+" texture offloaded, skip render."),u.push(c)):(!c.isDestroyed&&c.renderer&&c.update(t),c.isDestroyed||u.push(c))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,o)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(a=this.ticker)?void 0:a.pause();if(!this.paused||e){var l=this.gpuCapability.level,f=this.renderer.context.gl,p=2===l&&this.reportGPUTime?Ie(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var d=0;d<s.length;d++)!s[d].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[d].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){return null==i.reportGPUTime?void 0:i.reportGPUTime.call(i,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},n.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},n.resize=function(){var t,r,i,n,s=this.canvas.parentElement;if(s){var o=this.getTargetSize(s);t=o[0],r=o[1],i=o[2],n=o[3]}else t=i=this.canvas.width,r=n=this.canvas.height;var a=t/r;if(t&&r){var u,h=e.document.documentElement.clientWidth;i>2*h&&X.error("DPI overflowed, width "+i+" is more than 2x document width "+h+", see "+Nc+".");var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>c||n>c)&&(X.error("Container size overflowed "+i+"x"+n+", see "+Dc+"."),a>1?(i=Math.round(c),n=Math.round(c/a)):(n=Math.round(c),i=Math.round(c*a))),this.renderer.resize(i,n),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",X.info("Resize player "+this.name+" ["+i+","+n+","+t+","+r+"]."),null==(u=this.compositions)||u.forEach((function(t){t.camera.aspect=a}))}},n.clearCanvas=function(t){t?this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},n.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},n.dispose=function(t){var r;if(X.info("Call player destroyed: "+this.name+"."),!this.disposed){jc.delete(this.canvas),this.pause(),null==(r=this.ticker)||r.stop(),this.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),this.event&&this.event.dispose(),this.assetService.dispose(),Yc(this,!1),o(this.canvas,e.HTMLCanvasElement)&&!t&&this.renderer.context&&(hu.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i="Never use destroyed player: "+this.name+" again, see "+Uc+".",n=function(){return function(t){throw new Error(t)}(i)},s=function(){return t=i,Promise.reject(t);var t};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},n.getTargetSize=function(t){Zc(t);var r,i,n=this.displayAspect,s=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),o=0,a=0;(s?(o=parseInt(s.width,10),a=parseInt(s.height,10)):(o=t.clientWidth,a=t.clientHeight),n)?o/a>n?r=(i=a*this.displayScale)*n:i=(r=o*this.displayScale)/n:(r=o,i=a);var u=this.pixelRatio,h=r,c=i;if(r=Math.round(r*u),(i=Math.round(i*u))<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+r+"x"+i+", see "+kc+".");r=i=h=c=1}return[h,c,r,i]},n.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},n.handleEmitEvent=function(t,r){this.onError?o(r,e.Event)?this.onError(new Error(r.type,{cause:t}),r):o(r,Error)?this.onError(new Error(r.message,{cause:t}),r):this.onError(new Error("Unknown error.",{cause:t}),r):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,r))},oe(r,[{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}}]),r}(xa);function Yc(t,e){Object.keys(rt).forEach((function(r){var i=rt[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function Zc(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+zc+".")}u([function(t,e,r){var n=r.value;return r.value=i((function(){var e,r,i,s,o=arguments;return h(this,(function(a){switch(a.label){case 0:for(e=o.length,r=new Array(e),i=0;i<e;i++)r[i]=o[i];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.apply(this,r)];case 2:return[2,a.sent()];case 3:return s=a.sent(),t.handleThrowError.call(this,s),[3,4];case 4:return[2]}}))})),r}],Wc.prototype,"loadScene",null),mr.create=function(t,e){return new Zh(t,e)},mr.createWithData=function(t,e,r){void 0===e&&(e=I("#fff")),void 0===r&&(r={});var i=r.type,n=void 0===i?ke.UNSIGNED_BYTE:i,s=r.format,o=void 0===s?ke.RGBA:s,a=r.internalFormat,u=r.wrapS,h=void 0===u?ke.MIRRORED_REPEAT:u,c=r.wrapT,l=void 0===c?ke.MIRRORED_REPEAT:c,f=r.minFilter,p=void 0===f?ke.NEAREST:f,d=r.magFilter,m=void 0===d?ke.NEAREST:d,v=r.flipY,y=void 0!==v&&v;return new Zh(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:o,internalFormat:a||o,wrapS:h,wrapT:l,minFilter:p,magFilter:m,flipY:y})},Pr.create=function(t,e){return new pc(t,e)},Wr.create=function(t,e){return new oc(t,e)},ii.create=function(t,e){return new ii(t,e)},Vi.create=function(t){return new gc(t)},Ui.create=function(t,e){return new bc(t,e)},Bi.create=function(t,e,r){return new Vc(t,e,r)},Gh.create=function(t){return new yc(t)};var qc="2.5.0-alpha.6";X.info("Player version: "+qc+"."),exports.AbstractPlugin=_t,exports.ActivationPlayable=Na,exports.AnimationClipPlayable=ka,exports.Asset=vu,exports.AssetLoader=gu,exports.AssetManager=bh,exports.AssetService=Eh,exports.BYTES_TYPE_MAP=Hr,exports.BaseRenderComponent=Bn,exports.Behaviour=me,exports.BezierCurve=ks,exports.BezierCurvePath=Us,exports.BezierCurveQuat=Bs,exports.COPY_FRAGMENT_SHADER=Nr,exports.COPY_MESH_SHADER_ID=Vr,exports.COPY_VERTEX_SHADER=Dr,exports.CalculateLoader=Oa,exports.Camera=yo,exports.CameraVFXItemLoader=jn,exports.ColorCurve=to,exports.Component=de,exports.Composition=Aa,exports.DEFAULT_FONTS=fu,exports.DEFAULT_FPS=60,exports.Database=xu,exports.Deferred=function(){var t=this;this.promise=new Promise((function(e,r){t.resolve=e,t.reject=r}))},exports.Downloader=Ze,exports.EFFECTS_COPY_MESH_NAME=Fr,exports.EVENT_TYPE_CLICK=Xn,exports.EVENT_TYPE_TOUCH_END=Yn,exports.EVENT_TYPE_TOUCH_MOVE=Wn,exports.EVENT_TYPE_TOUCH_START=Hn,exports.EffectsObject=pe,exports.EffectsPackage=Bh,exports.Ellipse=iu,exports.Engine=Gh,exports.EventEmitter=xa,exports.EventSystem=Zn,exports.Float16ArrayWrapper=ts,exports.Framebuffer=Ui,exports.GLEngine=yc,exports.GLGeometry=oc,exports.GLRenderer=Vc,exports.GPUCapability=Ni,exports.Geometry=Wr,exports.GlobalUniforms=Fi,exports.GradientValue=Ds,exports.GraphicsPath=au,exports.HELP_LINK=Ln,exports.InteractLoader=Jn,exports.InteractMesh=ro,exports.KTXTexture=br,exports.LineSegments=Ns,exports.LinearValue=Vs,exports.MaskProcessor=Ir,exports.Material=Pr,exports.MaterialDataBlock=Sr,exports.Mesh=ii,exports.MeshCollider=so,exports.PLAYER_OPTIONS_ENV_EDITOR=In,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=Io,exports.ParticleBehaviourPlayableAsset=Lo,exports.ParticleLoader=Ma,exports.ParticleMesh=Vo,exports.ParticleSystemRenderer=ko,exports.ParticleTrack=pa,exports.PassTextureCache=jr,exports.PathSegments=zs,exports.Player=Wc,exports.PluginSystem=ot,exports.PolyStar=nu,exports.Polygon=Qa,exports.PropertyTrack=fa,exports.RENDER_PASS_NAME_PREFIX=Si,exports.RENDER_PREFER_LOOKUP_TEXTURE=To,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=Is,exports.RandomValue=Ls,exports.RandomVectorValue=Fs,exports.RenderFrame=Ri,exports.RenderPass=ui,exports.RenderPassPriorityNormal=ni,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=oi,exports.Renderbuffer=Vi,exports.Renderer=Bi,exports.RendererComponent=ve,exports.RuntimeClip=la,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=Pn,exports.SemanticMap=Xr,exports.SerializationHelper=yu,exports.ShaderFactory=Ti,exports.ShaderVariant=Lr,exports.ShapePath=ou,exports.SpriteLoader=oo,exports.StaticValue=Ps,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=Eo,exports.TextComponentBase=du,exports.TextLayout=cu,exports.TextLoader=mu,exports.TextStyle=lu,exports.Texture=mr,exports.TextureFactory=_r,exports.Ticker=jh,exports.TimelineClip=ca,exports.TimelinePlayable=ma,exports.TrackSortWrapper=va,exports.Transform=mo,exports.TransformAnimationPlayable=Da,exports.ValueGetter=Os,exports.Vector2Curve=Qs,exports.Vector4Curve=Ks,exports.addByOrder=V,exports.addItem=y,exports.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(i)for(;t[n-1][r]<s[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>s[r]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},exports.applyMixins=et,exports.assertExist=k,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=tt,exports.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",exports.buildLine=Ha,exports.calculateTranslation=ns,exports.canvasPool=hu,exports.closePointEps=Ba,exports.colorGradingFrag=mi,exports.colorStopsFromGradient=E,exports.colorToArr=b,exports.combineImageTemplate=yh,exports.createCopyShader=kr,exports.createGLContext=Pe,exports.createKeyFrameMeta=Ws,exports.createShape=nn,exports.createValueGetter=$s,exports.curveEps=Ga,exports.decimalEqual=fs,exports.defaultPlugins=it,exports.deserializeMipmapTexture=cr,exports.disableAllPlayer=function(t){Xc=!!t},exports.earcut=wn,exports.effectsClass=ce,exports.effectsClassStore=he,exports.enlargeBuffer=x,exports.ensureFixedNumber=Tu,exports.ensureVec3=ss,exports.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},exports.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",exports.gaussianDownHFrag=vi,exports.gaussianDownVFrag=yi,exports.gaussianUpFrag=gi,exports.generateEmptyTypedArray=Yr,exports.generateGUID=$,exports.generateHalfFloatTexture=vr,exports.generateTransparentTexture=xr,exports.generateWhiteTexture=gr,exports.getActivePlayers=function(){return Array.from(jc.values())},exports.getBackgroundImage=vh,exports.getColorFromGradientStops=T,exports.getConfig=Ao,exports.getDefaultTextureFactory=Ar,exports.getGeometryByShape=Dn,exports.getGeometryTriangles=Vn,exports.getKTXTextureOptions=Tr,exports.getKeyFrameMetaByRawValue=Hs,exports.getMergedStore=fe,exports.getParticleMeshShader=function(t,e,r){var i;void 0===r&&(r="");var n,s=t.content,o=+((null==(i=s.renderer)?void 0:i.renderMode)||0),a=[["RENDER_MODE",o],["ENV_EDITOR",r===In]],u=e.level,h=e.detail,c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,p=(null!=(n=s.positionOverLifetime)?n:{}).speedOverLifetime,d=0,m=0;f&&a.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(a.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Hs(c,p));var v=s.textureSheetAnimation;v&&v.animate&&(a.push(["USE_SPRITE",!0]),m|=4);var y=s.colorOverLifetime;y&&y.color&&(a.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&Hs(c,g);var x,b=s.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[i])&&(Hs(c,b[i]),r=1,m|=1<<7+e),a.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var s=0;(null==b?void 0:b[n])&&(Hs(c,b[n]),s=1,m|=1<<10+e,x=!0),a.push(["ORB_VEL_"+t.toUpperCase(),s])})),(null==b?void 0:b.asMovement)&&(a.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==b?void 0:b.asRotation)&&(a.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),s.sizeOverLifetime){var T=s.sizeOverLifetime;T.separateAxes?(Hs(c,T.x),a.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Hs(c,T.y)):Hs(c,T.size)}if(s.rotationOverLifetime){var E=s.rotationOverLifetime;E.z&&(Hs(c,null==E?void 0:E.z),m|=32768,a.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(Hs(c,E.x),m|=65536,a.push(["ROT_X_LIFETIME",1])),E.y&&(Hs(c,E.y),m|=1<<17,a.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(a.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18)}Hs(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(a.push(["FINAL_TARGET",!0]),m|=1<<19,Hs(c,b.forceCurve));var _=h.halfFloatTexture;_&&l.max&&(m|=1<<20);var A=h.maxVertexUniforms,C=c.max+c.curves.length-32>A;Ao(To)&&(C=!0),2===u&&(c.max=-1,l.index>0&&(l.max=-1)),C&&_&&f&&(d=1);var S=["-p:",o,m,c.index,c.max,l.index,l.max].join("+"),w={fragment:li,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+fi,shared:!0,cacheId:S,macros:a,name:"particle#"+t.name};return a.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:w,vertex:c.index,fragment:l.index}},exports.getPixelRatio=C,exports.getPlayerByCanvas=function(t){return jc.get(t)},exports.getPreMultiAlpha=je,exports.getStandardComposition=uh,exports.getStandardImage=ah,exports.getStandardItem=fh,exports.getStandardJSON=sh,exports.getTextureSize=Mi,exports.glContext=ke,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return $t.Float32;case e.WebGLRenderingContext.SHORT:return $t.Int16;case e.WebGLRenderingContext.BYTE:return $t.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return $t.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return $t.UInt8;default:return $t.Float32}},exports.gpuTimer=Ie,exports.imageDataFromColor=I,exports.imageDataFromGradient=L,exports.initErrors=Ne,exports.initGLContext=ze,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=_,exports.isAlipayMiniApp=O,exports.isAndroid=w,exports.isArray=Y,exports.isCanvas=K,exports.isCanvasUsedByPlayer=function(t){return jc.has(t)},exports.isFunction=Z,exports.isIOS=S,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 O()||P()},exports.isObject=q,exports.isOpenHarmony=R,exports.isSimulatorCellPhone=M,exports.isString=W,exports.isUniformStruct=wr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&wr(t[0])},exports.isValidFontFamily=z,exports.isWebGL2=Ue,exports.isWechatMiniApp=P,exports.itemFrag=ci,exports.itemFrameFrag="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",exports.itemVert=hi,exports.loadAVIFOptional=$e,exports.loadBinary=ir,exports.loadBlob=function(t){return sr.apply(this,arguments)},exports.loadImage=er,exports.loadMedia=ur,exports.loadVideo=or,exports.loadWebPOptional=Qe,exports.logger=X,exports.math=ei,exports.modifyMaxKeyframeShader=function(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var o=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=r;break}}},exports.nearestPowerOfTwo=hs,exports.noop=H,exports.normalizeColor=Ru,exports.numberToFix=ps,exports.parsePercent=A,exports.particleFrag=li,exports.particleOriginTranslateMap=us,exports.particleUniformTypeMap=Fo,exports.particleVert=fi,exports.passRenderLevel=mh,exports.pluginLoaderMap=rt,exports.randomInRange=Q,exports.registerPlugin=st,exports.removeItem=g,exports.rotateVec2=Nn,exports.screenMeshVert=di,exports.serialize=le,exports.setBlendMode=Xe,exports.setConfig=function(t,e){return _o[t]=e},exports.setDefaultTextureFactory=function(t){Er=t},exports.setMaskMode=We,exports.setMaxSpriteMeshItemCount=function(t){exports.maxSpriteMeshItemCount=t},exports.setRayFromCamera=cs,exports.setSideMode=He,exports.setSpriteMeshMaxItemCountByGPU=Ra,exports.sortByOrder=F,exports.spec=ne,exports.thresholdFrag=xi,exports.throwDestroyedError=J,exports.trailVert=pi,exports.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},exports.trianglesFromRect=ls,exports.unregisterPlugin=function(t){delete nt[t],delete rt[t],g(it,t)},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=os,exports.vecMulCombine=as,exports.version=qc,exports.vertexFormatType2GLType=Ge;
2
2
  //# sourceMappingURL=weapp.js.map